diff --git a/.gitignore b/.gitignore index 60495c80..58382779 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .vscode/ .idea/ /metamodel -/openapi/ +/metamodel_generator/metamodel diff --git a/Makefile b/Makefile index 9d4dfc8d..f54f1aab 100644 --- a/Makefile +++ b/Makefile @@ -36,25 +36,50 @@ else $(error "please install 'shasum' or 'sha256sum'") endif -# Details of the metamodel used to check the model: -metamodel_version:=v0.0.67 -metamodel_url:=https://github.com/openshift-online/ocm-api-metamodel/releases/download/$(metamodel_version)/metamodel-$(UNAME)-amd64 -metamodel_sha1_url:=https://github.com/openshift-online/ocm-api-metamodel/releases/download/$(metamodel_version)/metamodel-$(UNAME)-amd64.sha256 +goimports_version:=v0.4.0 .PHONY: check check: metamodel - ./metamodel check --model=model + ./metamodel_generator/metamodel check --model=model + +verify: verify-clientapi verify-openapi +update: update-clientapi update-openapi .PHONY: openapi -openapi: metamodel - ./metamodel generate openapi --model=model --output=openapi +update-openapi: metamodel + ./metamodel_generator/metamodel generate openapi --model=clientapi/model --output=openapi + +verify-openapi: metamodel + $(eval TMPDIR := $(shell mktemp -d)) + ./metamodel_generator/metamodel generate openapi --model=clientapi/model --output=$(TMPDIR) + diff -r $(TMPDIR)/ openapi/ + rm -rf $(TMPDIR) + +update-clientapi: metamodel goimports-install + ./metamodel_generator/metamodel generate go \ + --model=clientapi/model \ + --generators=types,builders,json \ + --base=github.com/openshift-online/ocm-api-model/clientapi \ + --output=clientapi + pushd clientapi; go mod tidy; popd + +verify-clientapi: metamodel goimports-install + $(eval TMPDIR := $(shell mktemp -d)) + # copy content to make the diff clean + cp clientapi/go.mod $(TMPDIR) + cp clientapi/go.sum $(TMPDIR) + cp -r clientapi/model $(TMPDIR) + cp -r clientapi/dependencymagnet $(TMPDIR) + ./metamodel_generator/metamodel generate go \ + --model=clientapi/model \ + --generators=types,builders,json \ + --base=github.com/openshift-online/ocm-api-model/clientapi \ + --output=$(TMPDIR) + diff -r $(TMPDIR)/ clientapi/ + rm -rf $(TMPDIR) metamodel: - wget --progress=dot:giga --output-document="$@" "$(metamodel_url)" - @# the following echo line prints the sha256sum of the downloaded binary, and then the filename, - @# separated by TWO SPACES, do NOT change that - echo "$$(wget --output-document="$@" -O- --quiet - $(metamodel_sha1_url) | awk '{print $$1}') $@"|$(SHA256CMD) - chmod +x "$@" + $(MAKE) -C metamodel_generator metamodel # Enforce indentation by tabs. License contains 2 spaces, so reject 3+. lint: @@ -65,4 +90,22 @@ clean: rm -rf \ metamodel \ openapi \ + clientapi/accesstransparency \ + clientapi/accountsmgmt \ + clientapi/addonsmgmt \ + clientapi/arohcp \ + clientapi/authorizations \ + clientapi/clustersmgmt \ + clientapi/helpers \ + clientapi/jobqueue \ + clientapi/osdfleetmgmt \ + clientapi/servicelogs \ + clientapi/servicemgmt \ + clientapi/statusboard \ + clientapi/webrca \ $(NULL) + +.PHONY: goimports-install +goimports-install: + @GOBIN=$(LOCAL_BIN_PATH) go install golang.org/x/tools/cmd/goimports@$(goimports_version) + diff --git a/clientapi/accesstransparency/v1/access_protection_builder.go b/clientapi/accesstransparency/v1/access_protection_builder.go new file mode 100644 index 00000000..2747cd39 --- /dev/null +++ b/clientapi/accesstransparency/v1/access_protection_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +// AccessProtectionBuilder contains the data and logic needed to build 'access_protection' objects. +// +// Representation of an access protection. +type AccessProtectionBuilder struct { + bitmap_ uint32 + enabled bool +} + +// NewAccessProtection creates a new builder of 'access_protection' objects. +func NewAccessProtection() *AccessProtectionBuilder { + return &AccessProtectionBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AccessProtectionBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AccessProtectionBuilder) Enabled(value bool) *AccessProtectionBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AccessProtectionBuilder) Copy(object *AccessProtection) *AccessProtectionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + return b +} + +// Build creates a 'access_protection' object using the configuration stored in the builder. +func (b *AccessProtectionBuilder) Build() (object *AccessProtection, err error) { + object = new(AccessProtection) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + return +} diff --git a/clientapi/accesstransparency/v1/access_protection_list_builder.go b/clientapi/accesstransparency/v1/access_protection_list_builder.go new file mode 100644 index 00000000..c44cbdfd --- /dev/null +++ b/clientapi/accesstransparency/v1/access_protection_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +// AccessProtectionListBuilder contains the data and logic needed to build +// 'access_protection' objects. +type AccessProtectionListBuilder struct { + items []*AccessProtectionBuilder +} + +// NewAccessProtectionList creates a new builder of 'access_protection' objects. +func NewAccessProtectionList() *AccessProtectionListBuilder { + return new(AccessProtectionListBuilder) +} + +// Items sets the items of the list. +func (b *AccessProtectionListBuilder) Items(values ...*AccessProtectionBuilder) *AccessProtectionListBuilder { + b.items = make([]*AccessProtectionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AccessProtectionListBuilder) 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 *AccessProtectionListBuilder) Copy(list *AccessProtectionList) *AccessProtectionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AccessProtectionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAccessProtection().Copy(v) + } + } + return b +} + +// Build creates a list of 'access_protection' objects using the +// configuration stored in the builder. +func (b *AccessProtectionListBuilder) Build() (list *AccessProtectionList, err error) { + items := make([]*AccessProtection, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AccessProtectionList) + list.items = items + return +} diff --git a/clientapi/accesstransparency/v1/access_protection_list_type_json.go b/clientapi/accesstransparency/v1/access_protection_list_type_json.go new file mode 100644 index 00000000..17502cdb --- /dev/null +++ b/clientapi/accesstransparency/v1/access_protection_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessProtectionList writes a list of values of the 'access_protection' type to +// the given writer. +func MarshalAccessProtectionList(list []*AccessProtection, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessProtectionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessProtectionList writes a list of value of the 'access_protection' type to +// the given stream. +func WriteAccessProtectionList(list []*AccessProtection, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAccessProtection(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAccessProtectionList reads a list of values of the 'access_protection' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAccessProtectionList(source interface{}) (items []*AccessProtection, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAccessProtectionList(iterator) + err = iterator.Error + return +} + +// ReadAccessProtectionList reads list of values of the ”access_protection' type from +// the given iterator. +func ReadAccessProtectionList(iterator *jsoniter.Iterator) []*AccessProtection { + list := []*AccessProtection{} + for iterator.ReadArray() { + item := ReadAccessProtection(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accesstransparency/v1/access_protection_type.go b/clientapi/accesstransparency/v1/access_protection_type.go new file mode 100644 index 00000000..df9f5302 --- /dev/null +++ b/clientapi/accesstransparency/v1/access_protection_type.go @@ -0,0 +1,161 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +// AccessProtection represents the values of the 'access_protection' type. +// +// Representation of an access protection. +type AccessProtection struct { + bitmap_ uint32 + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AccessProtection) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *AccessProtection) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +func (o *AccessProtection) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// AccessProtectionListKind is the name of the type used to represent list of objects of +// type 'access_protection'. +const AccessProtectionListKind = "AccessProtectionList" + +// AccessProtectionListLinkKind is the name of the type used to represent links to list +// of objects of type 'access_protection'. +const AccessProtectionListLinkKind = "AccessProtectionListLink" + +// AccessProtectionNilKind is the name of the type used to nil lists of objects of +// type 'access_protection'. +const AccessProtectionListNilKind = "AccessProtectionListNil" + +// AccessProtectionList is a list of values of the 'access_protection' type. +type AccessProtectionList struct { + href string + link bool + items []*AccessProtection +} + +// Len returns the length of the list. +func (l *AccessProtectionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AccessProtectionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AccessProtectionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AccessProtectionList) SetItems(items []*AccessProtection) { + l.items = items +} + +// Items returns the items of the list. +func (l *AccessProtectionList) Items() []*AccessProtection { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AccessProtectionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AccessProtectionList) Get(i int) *AccessProtection { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AccessProtectionList) Slice() []*AccessProtection { + var slice []*AccessProtection + if l == nil { + slice = make([]*AccessProtection, 0) + } else { + slice = make([]*AccessProtection, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AccessProtectionList) Each(f func(item *AccessProtection) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AccessProtectionList) Range(f func(index int, item *AccessProtection) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accesstransparency/v1/access_protection_type_json.go b/clientapi/accesstransparency/v1/access_protection_type_json.go new file mode 100644 index 00000000..6e8eacec --- /dev/null +++ b/clientapi/accesstransparency/v1/access_protection_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessProtection writes a value of the 'access_protection' type to the given writer. +func MarshalAccessProtection(object *AccessProtection, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessProtection(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessProtection writes a value of the 'access_protection' type to the given stream. +func WriteAccessProtection(object *AccessProtection, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalAccessProtection reads a value of the 'access_protection' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAccessProtection(source interface{}) (object *AccessProtection, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAccessProtection(iterator) + err = iterator.Error + return +} + +// ReadAccessProtection reads a value of the 'access_protection' type from the given iterator. +func ReadAccessProtection(iterator *jsoniter.Iterator) *AccessProtection { + object := &AccessProtection{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accesstransparency/v1/access_request_builder.go b/clientapi/accesstransparency/v1/access_request_builder.go new file mode 100644 index 00000000..9d5aa831 --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_builder.go @@ -0,0 +1,254 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + time "time" +) + +// AccessRequestBuilder contains the data and logic needed to build 'access_request' objects. +// +// Representation of an access request. +type AccessRequestBuilder struct { + bitmap_ uint32 + id string + href string + clusterId string + createdAt time.Time + deadline string + deadlineAt time.Time + decisions []*DecisionBuilder + duration string + internalSupportCaseId string + justification string + organizationId string + requestedBy string + status *AccessRequestStatusBuilder + subscriptionId string + supportCaseId string + updatedAt time.Time +} + +// NewAccessRequest creates a new builder of 'access_request' objects. +func NewAccessRequest() *AccessRequestBuilder { + return &AccessRequestBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AccessRequestBuilder) Link(value bool) *AccessRequestBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AccessRequestBuilder) ID(value string) *AccessRequestBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AccessRequestBuilder) HREF(value string) *AccessRequestBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AccessRequestBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// ClusterId sets the value of the 'cluster_id' attribute to the given value. +func (b *AccessRequestBuilder) ClusterId(value string) *AccessRequestBuilder { + b.clusterId = value + b.bitmap_ |= 8 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *AccessRequestBuilder) CreatedAt(value time.Time) *AccessRequestBuilder { + b.createdAt = value + b.bitmap_ |= 16 + return b +} + +// Deadline sets the value of the 'deadline' attribute to the given value. +func (b *AccessRequestBuilder) Deadline(value string) *AccessRequestBuilder { + b.deadline = value + b.bitmap_ |= 32 + return b +} + +// DeadlineAt sets the value of the 'deadline_at' attribute to the given value. +func (b *AccessRequestBuilder) DeadlineAt(value time.Time) *AccessRequestBuilder { + b.deadlineAt = value + b.bitmap_ |= 64 + return b +} + +// Decisions sets the value of the 'decisions' attribute to the given values. +func (b *AccessRequestBuilder) Decisions(values ...*DecisionBuilder) *AccessRequestBuilder { + b.decisions = make([]*DecisionBuilder, len(values)) + copy(b.decisions, values) + b.bitmap_ |= 128 + return b +} + +// Duration sets the value of the 'duration' attribute to the given value. +func (b *AccessRequestBuilder) Duration(value string) *AccessRequestBuilder { + b.duration = value + b.bitmap_ |= 256 + return b +} + +// InternalSupportCaseId sets the value of the 'internal_support_case_id' attribute to the given value. +func (b *AccessRequestBuilder) InternalSupportCaseId(value string) *AccessRequestBuilder { + b.internalSupportCaseId = value + b.bitmap_ |= 512 + return b +} + +// Justification sets the value of the 'justification' attribute to the given value. +func (b *AccessRequestBuilder) Justification(value string) *AccessRequestBuilder { + b.justification = value + b.bitmap_ |= 1024 + return b +} + +// OrganizationId sets the value of the 'organization_id' attribute to the given value. +func (b *AccessRequestBuilder) OrganizationId(value string) *AccessRequestBuilder { + b.organizationId = value + b.bitmap_ |= 2048 + return b +} + +// RequestedBy sets the value of the 'requested_by' attribute to the given value. +func (b *AccessRequestBuilder) RequestedBy(value string) *AccessRequestBuilder { + b.requestedBy = value + b.bitmap_ |= 4096 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +// +// Representation of an access request status. +func (b *AccessRequestBuilder) Status(value *AccessRequestStatusBuilder) *AccessRequestBuilder { + b.status = value + if value != nil { + b.bitmap_ |= 8192 + } else { + b.bitmap_ &^= 8192 + } + return b +} + +// SubscriptionId sets the value of the 'subscription_id' attribute to the given value. +func (b *AccessRequestBuilder) SubscriptionId(value string) *AccessRequestBuilder { + b.subscriptionId = value + b.bitmap_ |= 16384 + return b +} + +// SupportCaseId sets the value of the 'support_case_id' attribute to the given value. +func (b *AccessRequestBuilder) SupportCaseId(value string) *AccessRequestBuilder { + b.supportCaseId = value + b.bitmap_ |= 32768 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *AccessRequestBuilder) UpdatedAt(value time.Time) *AccessRequestBuilder { + b.updatedAt = value + b.bitmap_ |= 65536 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AccessRequestBuilder) Copy(object *AccessRequest) *AccessRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.clusterId = object.clusterId + b.createdAt = object.createdAt + b.deadline = object.deadline + b.deadlineAt = object.deadlineAt + if object.decisions != nil { + b.decisions = make([]*DecisionBuilder, len(object.decisions)) + for i, v := range object.decisions { + b.decisions[i] = NewDecision().Copy(v) + } + } else { + b.decisions = nil + } + b.duration = object.duration + b.internalSupportCaseId = object.internalSupportCaseId + b.justification = object.justification + b.organizationId = object.organizationId + b.requestedBy = object.requestedBy + if object.status != nil { + b.status = NewAccessRequestStatus().Copy(object.status) + } else { + b.status = nil + } + b.subscriptionId = object.subscriptionId + b.supportCaseId = object.supportCaseId + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'access_request' object using the configuration stored in the builder. +func (b *AccessRequestBuilder) Build() (object *AccessRequest, err error) { + object = new(AccessRequest) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.clusterId = b.clusterId + object.createdAt = b.createdAt + object.deadline = b.deadline + object.deadlineAt = b.deadlineAt + if b.decisions != nil { + object.decisions = make([]*Decision, len(b.decisions)) + for i, v := range b.decisions { + object.decisions[i], err = v.Build() + if err != nil { + return + } + } + } + object.duration = b.duration + object.internalSupportCaseId = b.internalSupportCaseId + object.justification = b.justification + object.organizationId = b.organizationId + object.requestedBy = b.requestedBy + if b.status != nil { + object.status, err = b.status.Build() + if err != nil { + return + } + } + object.subscriptionId = b.subscriptionId + object.supportCaseId = b.supportCaseId + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/accesstransparency/v1/access_request_list_builder.go b/clientapi/accesstransparency/v1/access_request_list_builder.go new file mode 100644 index 00000000..6db7db3e --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +// AccessRequestListBuilder contains the data and logic needed to build +// 'access_request' objects. +type AccessRequestListBuilder struct { + items []*AccessRequestBuilder +} + +// NewAccessRequestList creates a new builder of 'access_request' objects. +func NewAccessRequestList() *AccessRequestListBuilder { + return new(AccessRequestListBuilder) +} + +// Items sets the items of the list. +func (b *AccessRequestListBuilder) Items(values ...*AccessRequestBuilder) *AccessRequestListBuilder { + b.items = make([]*AccessRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AccessRequestListBuilder) 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 *AccessRequestListBuilder) Copy(list *AccessRequestList) *AccessRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AccessRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAccessRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'access_request' objects using the +// configuration stored in the builder. +func (b *AccessRequestListBuilder) Build() (list *AccessRequestList, err error) { + items := make([]*AccessRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AccessRequestList) + list.items = items + return +} diff --git a/clientapi/accesstransparency/v1/access_request_list_type_json.go b/clientapi/accesstransparency/v1/access_request_list_type_json.go new file mode 100644 index 00000000..f6ce0ef0 --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessRequestList writes a list of values of the 'access_request' type to +// the given writer. +func MarshalAccessRequestList(list []*AccessRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessRequestList writes a list of value of the 'access_request' type to +// the given stream. +func WriteAccessRequestList(list []*AccessRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAccessRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAccessRequestList reads a list of values of the 'access_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAccessRequestList(source interface{}) (items []*AccessRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAccessRequestList(iterator) + err = iterator.Error + return +} + +// ReadAccessRequestList reads list of values of the ”access_request' type from +// the given iterator. +func ReadAccessRequestList(iterator *jsoniter.Iterator) []*AccessRequest { + list := []*AccessRequest{} + for iterator.ReadArray() { + item := ReadAccessRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accesstransparency/v1/access_request_post_request_builder.go b/clientapi/accesstransparency/v1/access_request_post_request_builder.go new file mode 100644 index 00000000..cf111736 --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_post_request_builder.go @@ -0,0 +1,123 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +// AccessRequestPostRequestBuilder contains the data and logic needed to build 'access_request_post_request' objects. +// +// Representation of an access request post request. +type AccessRequestPostRequestBuilder struct { + bitmap_ uint32 + clusterId string + deadline string + duration string + internalSupportCaseId string + justification string + subscriptionId string + supportCaseId string +} + +// NewAccessRequestPostRequest creates a new builder of 'access_request_post_request' objects. +func NewAccessRequestPostRequest() *AccessRequestPostRequestBuilder { + return &AccessRequestPostRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AccessRequestPostRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ClusterId sets the value of the 'cluster_id' attribute to the given value. +func (b *AccessRequestPostRequestBuilder) ClusterId(value string) *AccessRequestPostRequestBuilder { + b.clusterId = value + b.bitmap_ |= 1 + return b +} + +// Deadline sets the value of the 'deadline' attribute to the given value. +func (b *AccessRequestPostRequestBuilder) Deadline(value string) *AccessRequestPostRequestBuilder { + b.deadline = value + b.bitmap_ |= 2 + return b +} + +// Duration sets the value of the 'duration' attribute to the given value. +func (b *AccessRequestPostRequestBuilder) Duration(value string) *AccessRequestPostRequestBuilder { + b.duration = value + b.bitmap_ |= 4 + return b +} + +// InternalSupportCaseId sets the value of the 'internal_support_case_id' attribute to the given value. +func (b *AccessRequestPostRequestBuilder) InternalSupportCaseId(value string) *AccessRequestPostRequestBuilder { + b.internalSupportCaseId = value + b.bitmap_ |= 8 + return b +} + +// Justification sets the value of the 'justification' attribute to the given value. +func (b *AccessRequestPostRequestBuilder) Justification(value string) *AccessRequestPostRequestBuilder { + b.justification = value + b.bitmap_ |= 16 + return b +} + +// SubscriptionId sets the value of the 'subscription_id' attribute to the given value. +func (b *AccessRequestPostRequestBuilder) SubscriptionId(value string) *AccessRequestPostRequestBuilder { + b.subscriptionId = value + b.bitmap_ |= 32 + return b +} + +// SupportCaseId sets the value of the 'support_case_id' attribute to the given value. +func (b *AccessRequestPostRequestBuilder) SupportCaseId(value string) *AccessRequestPostRequestBuilder { + b.supportCaseId = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AccessRequestPostRequestBuilder) Copy(object *AccessRequestPostRequest) *AccessRequestPostRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.clusterId = object.clusterId + b.deadline = object.deadline + b.duration = object.duration + b.internalSupportCaseId = object.internalSupportCaseId + b.justification = object.justification + b.subscriptionId = object.subscriptionId + b.supportCaseId = object.supportCaseId + return b +} + +// Build creates a 'access_request_post_request' object using the configuration stored in the builder. +func (b *AccessRequestPostRequestBuilder) Build() (object *AccessRequestPostRequest, err error) { + object = new(AccessRequestPostRequest) + object.bitmap_ = b.bitmap_ + object.clusterId = b.clusterId + object.deadline = b.deadline + object.duration = b.duration + object.internalSupportCaseId = b.internalSupportCaseId + object.justification = b.justification + object.subscriptionId = b.subscriptionId + object.supportCaseId = b.supportCaseId + return +} diff --git a/clientapi/accesstransparency/v1/access_request_post_request_list_builder.go b/clientapi/accesstransparency/v1/access_request_post_request_list_builder.go new file mode 100644 index 00000000..f0bb5c23 --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_post_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +// AccessRequestPostRequestListBuilder contains the data and logic needed to build +// 'access_request_post_request' objects. +type AccessRequestPostRequestListBuilder struct { + items []*AccessRequestPostRequestBuilder +} + +// NewAccessRequestPostRequestList creates a new builder of 'access_request_post_request' objects. +func NewAccessRequestPostRequestList() *AccessRequestPostRequestListBuilder { + return new(AccessRequestPostRequestListBuilder) +} + +// Items sets the items of the list. +func (b *AccessRequestPostRequestListBuilder) Items(values ...*AccessRequestPostRequestBuilder) *AccessRequestPostRequestListBuilder { + b.items = make([]*AccessRequestPostRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AccessRequestPostRequestListBuilder) 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 *AccessRequestPostRequestListBuilder) Copy(list *AccessRequestPostRequestList) *AccessRequestPostRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AccessRequestPostRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAccessRequestPostRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'access_request_post_request' objects using the +// configuration stored in the builder. +func (b *AccessRequestPostRequestListBuilder) Build() (list *AccessRequestPostRequestList, err error) { + items := make([]*AccessRequestPostRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AccessRequestPostRequestList) + list.items = items + return +} diff --git a/clientapi/accesstransparency/v1/access_request_post_request_list_type_json.go b/clientapi/accesstransparency/v1/access_request_post_request_list_type_json.go new file mode 100644 index 00000000..e40a484b --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_post_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessRequestPostRequestList writes a list of values of the 'access_request_post_request' type to +// the given writer. +func MarshalAccessRequestPostRequestList(list []*AccessRequestPostRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessRequestPostRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessRequestPostRequestList writes a list of value of the 'access_request_post_request' type to +// the given stream. +func WriteAccessRequestPostRequestList(list []*AccessRequestPostRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAccessRequestPostRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAccessRequestPostRequestList reads a list of values of the 'access_request_post_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAccessRequestPostRequestList(source interface{}) (items []*AccessRequestPostRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAccessRequestPostRequestList(iterator) + err = iterator.Error + return +} + +// ReadAccessRequestPostRequestList reads list of values of the ”access_request_post_request' type from +// the given iterator. +func ReadAccessRequestPostRequestList(iterator *jsoniter.Iterator) []*AccessRequestPostRequest { + list := []*AccessRequestPostRequest{} + for iterator.ReadArray() { + item := ReadAccessRequestPostRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accesstransparency/v1/access_request_post_request_type.go b/clientapi/accesstransparency/v1/access_request_post_request_type.go new file mode 100644 index 00000000..9a14ebb9 --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_post_request_type.go @@ -0,0 +1,309 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +// AccessRequestPostRequest represents the values of the 'access_request_post_request' type. +// +// Representation of an access request post request. +type AccessRequestPostRequest struct { + bitmap_ uint32 + clusterId string + deadline string + duration string + internalSupportCaseId string + justification string + subscriptionId string + supportCaseId string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AccessRequestPostRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ClusterId returns the value of the 'cluster_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster from which the Access Request belongs to. +func (o *AccessRequestPostRequest) ClusterId() string { + if o != nil && o.bitmap_&1 != 0 { + return o.clusterId + } + return "" +} + +// GetClusterId returns the value of the 'cluster_id' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster from which the Access Request belongs to. +func (o *AccessRequestPostRequest) GetClusterId() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.clusterId + } + return +} + +// Deadline returns the value of the 'deadline' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// How long the Access Request can be in pending state waiting for a customer decision. +func (o *AccessRequestPostRequest) Deadline() string { + if o != nil && o.bitmap_&2 != 0 { + return o.deadline + } + return "" +} + +// GetDeadline returns the value of the 'deadline' attribute and +// a flag indicating if the attribute has a value. +// +// How long the Access Request can be in pending state waiting for a customer decision. +func (o *AccessRequestPostRequest) GetDeadline() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.deadline + } + return +} + +// Duration returns the value of the 'duration' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// How long the access will last after it's been approved. +func (o *AccessRequestPostRequest) Duration() string { + if o != nil && o.bitmap_&4 != 0 { + return o.duration + } + return "" +} + +// GetDuration returns the value of the 'duration' attribute and +// a flag indicating if the attribute has a value. +// +// How long the access will last after it's been approved. +func (o *AccessRequestPostRequest) GetDuration() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.duration + } + return +} + +// InternalSupportCaseId returns the value of the 'internal_support_case_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Internal support case id linking to jira ticket. +func (o *AccessRequestPostRequest) InternalSupportCaseId() string { + if o != nil && o.bitmap_&8 != 0 { + return o.internalSupportCaseId + } + return "" +} + +// GetInternalSupportCaseId returns the value of the 'internal_support_case_id' attribute and +// a flag indicating if the attribute has a value. +// +// Internal support case id linking to jira ticket. +func (o *AccessRequestPostRequest) GetInternalSupportCaseId() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.internalSupportCaseId + } + return +} + +// Justification returns the value of the 'justification' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Justification of the Access Request. +func (o *AccessRequestPostRequest) Justification() string { + if o != nil && o.bitmap_&16 != 0 { + return o.justification + } + return "" +} + +// GetJustification returns the value of the 'justification' attribute and +// a flag indicating if the attribute has a value. +// +// Justification of the Access Request. +func (o *AccessRequestPostRequest) GetJustification() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.justification + } + return +} + +// SubscriptionId returns the value of the 'subscription_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Subscription from which the Access Request belongs to. +func (o *AccessRequestPostRequest) SubscriptionId() string { + if o != nil && o.bitmap_&32 != 0 { + return o.subscriptionId + } + return "" +} + +// GetSubscriptionId returns the value of the 'subscription_id' attribute and +// a flag indicating if the attribute has a value. +// +// Subscription from which the Access Request belongs to. +func (o *AccessRequestPostRequest) GetSubscriptionId() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.subscriptionId + } + return +} + +// SupportCaseId returns the value of the 'support_case_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Support case ID linking to JIRA ticket. +func (o *AccessRequestPostRequest) SupportCaseId() string { + if o != nil && o.bitmap_&64 != 0 { + return o.supportCaseId + } + return "" +} + +// GetSupportCaseId returns the value of the 'support_case_id' attribute and +// a flag indicating if the attribute has a value. +// +// Support case ID linking to JIRA ticket. +func (o *AccessRequestPostRequest) GetSupportCaseId() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.supportCaseId + } + return +} + +// AccessRequestPostRequestListKind is the name of the type used to represent list of objects of +// type 'access_request_post_request'. +const AccessRequestPostRequestListKind = "AccessRequestPostRequestList" + +// AccessRequestPostRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'access_request_post_request'. +const AccessRequestPostRequestListLinkKind = "AccessRequestPostRequestListLink" + +// AccessRequestPostRequestNilKind is the name of the type used to nil lists of objects of +// type 'access_request_post_request'. +const AccessRequestPostRequestListNilKind = "AccessRequestPostRequestListNil" + +// AccessRequestPostRequestList is a list of values of the 'access_request_post_request' type. +type AccessRequestPostRequestList struct { + href string + link bool + items []*AccessRequestPostRequest +} + +// Len returns the length of the list. +func (l *AccessRequestPostRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AccessRequestPostRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AccessRequestPostRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AccessRequestPostRequestList) SetItems(items []*AccessRequestPostRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *AccessRequestPostRequestList) Items() []*AccessRequestPostRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AccessRequestPostRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AccessRequestPostRequestList) Get(i int) *AccessRequestPostRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AccessRequestPostRequestList) Slice() []*AccessRequestPostRequest { + var slice []*AccessRequestPostRequest + if l == nil { + slice = make([]*AccessRequestPostRequest, 0) + } else { + slice = make([]*AccessRequestPostRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AccessRequestPostRequestList) Each(f func(item *AccessRequestPostRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AccessRequestPostRequestList) Range(f func(index int, item *AccessRequestPostRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accesstransparency/v1/access_request_post_request_type_json.go b/clientapi/accesstransparency/v1/access_request_post_request_type_json.go new file mode 100644 index 00000000..19956d01 --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_post_request_type_json.go @@ -0,0 +1,164 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessRequestPostRequest writes a value of the 'access_request_post_request' type to the given writer. +func MarshalAccessRequestPostRequest(object *AccessRequestPostRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessRequestPostRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessRequestPostRequest writes a value of the 'access_request_post_request' type to the given stream. +func WriteAccessRequestPostRequest(object *AccessRequestPostRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterId) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deadline") + stream.WriteString(object.deadline) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("duration") + stream.WriteString(object.duration) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("internal_support_case_id") + stream.WriteString(object.internalSupportCaseId) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("justification") + stream.WriteString(object.justification) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionId) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("support_case_id") + stream.WriteString(object.supportCaseId) + } + stream.WriteObjectEnd() +} + +// UnmarshalAccessRequestPostRequest reads a value of the 'access_request_post_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAccessRequestPostRequest(source interface{}) (object *AccessRequestPostRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAccessRequestPostRequest(iterator) + err = iterator.Error + return +} + +// ReadAccessRequestPostRequest reads a value of the 'access_request_post_request' type from the given iterator. +func ReadAccessRequestPostRequest(iterator *jsoniter.Iterator) *AccessRequestPostRequest { + object := &AccessRequestPostRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "cluster_id": + value := iterator.ReadString() + object.clusterId = value + object.bitmap_ |= 1 + case "deadline": + value := iterator.ReadString() + object.deadline = value + object.bitmap_ |= 2 + case "duration": + value := iterator.ReadString() + object.duration = value + object.bitmap_ |= 4 + case "internal_support_case_id": + value := iterator.ReadString() + object.internalSupportCaseId = value + object.bitmap_ |= 8 + case "justification": + value := iterator.ReadString() + object.justification = value + object.bitmap_ |= 16 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionId = value + object.bitmap_ |= 32 + case "support_case_id": + value := iterator.ReadString() + object.supportCaseId = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accesstransparency/v1/access_request_state_list_type_json.go b/clientapi/accesstransparency/v1/access_request_state_list_type_json.go new file mode 100644 index 00000000..97438f8f --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_state_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessRequestStateList writes a list of values of the 'access_request_state' type to +// the given writer. +func MarshalAccessRequestStateList(list []AccessRequestState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessRequestStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessRequestStateList writes a list of value of the 'access_request_state' type to +// the given stream. +func WriteAccessRequestStateList(list []AccessRequestState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalAccessRequestStateList reads a list of values of the 'access_request_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAccessRequestStateList(source interface{}) (items []AccessRequestState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAccessRequestStateList(iterator) + err = iterator.Error + return +} + +// ReadAccessRequestStateList reads list of values of the ”access_request_state' type from +// the given iterator. +func ReadAccessRequestStateList(iterator *jsoniter.Iterator) []AccessRequestState { + list := []AccessRequestState{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := AccessRequestState(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/accesstransparency/v1/access_request_state_type.go b/clientapi/accesstransparency/v1/access_request_state_type.go new file mode 100644 index 00000000..653b16ab --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_state_type.go @@ -0,0 +1,34 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +// AccessRequestState represents the values of the 'access_request_state' enumerated type. +type AccessRequestState string + +const ( + // + AccessRequestStateApproved AccessRequestState = "Approved" + // + AccessRequestStateDenied AccessRequestState = "Denied" + // + AccessRequestStateExpired AccessRequestState = "Expired" + // + AccessRequestStatePending AccessRequestState = "Pending" +) diff --git a/clientapi/accesstransparency/v1/access_request_status_builder.go b/clientapi/accesstransparency/v1/access_request_status_builder.go new file mode 100644 index 00000000..535bafe4 --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_status_builder.go @@ -0,0 +1,79 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + time "time" +) + +// AccessRequestStatusBuilder contains the data and logic needed to build 'access_request_status' objects. +// +// Representation of an access request status. +type AccessRequestStatusBuilder struct { + bitmap_ uint32 + expiresAt time.Time + state AccessRequestState +} + +// NewAccessRequestStatus creates a new builder of 'access_request_status' objects. +func NewAccessRequestStatus() *AccessRequestStatusBuilder { + return &AccessRequestStatusBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AccessRequestStatusBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ExpiresAt sets the value of the 'expires_at' attribute to the given value. +func (b *AccessRequestStatusBuilder) ExpiresAt(value time.Time) *AccessRequestStatusBuilder { + b.expiresAt = value + b.bitmap_ |= 1 + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// Possible states to an access request status. +func (b *AccessRequestStatusBuilder) State(value AccessRequestState) *AccessRequestStatusBuilder { + b.state = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AccessRequestStatusBuilder) Copy(object *AccessRequestStatus) *AccessRequestStatusBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.expiresAt = object.expiresAt + b.state = object.state + return b +} + +// Build creates a 'access_request_status' object using the configuration stored in the builder. +func (b *AccessRequestStatusBuilder) Build() (object *AccessRequestStatus, err error) { + object = new(AccessRequestStatus) + object.bitmap_ = b.bitmap_ + object.expiresAt = b.expiresAt + object.state = b.state + return +} diff --git a/clientapi/accesstransparency/v1/access_request_status_list_builder.go b/clientapi/accesstransparency/v1/access_request_status_list_builder.go new file mode 100644 index 00000000..0f936f6e --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_status_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +// AccessRequestStatusListBuilder contains the data and logic needed to build +// 'access_request_status' objects. +type AccessRequestStatusListBuilder struct { + items []*AccessRequestStatusBuilder +} + +// NewAccessRequestStatusList creates a new builder of 'access_request_status' objects. +func NewAccessRequestStatusList() *AccessRequestStatusListBuilder { + return new(AccessRequestStatusListBuilder) +} + +// Items sets the items of the list. +func (b *AccessRequestStatusListBuilder) Items(values ...*AccessRequestStatusBuilder) *AccessRequestStatusListBuilder { + b.items = make([]*AccessRequestStatusBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AccessRequestStatusListBuilder) 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 *AccessRequestStatusListBuilder) Copy(list *AccessRequestStatusList) *AccessRequestStatusListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AccessRequestStatusBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAccessRequestStatus().Copy(v) + } + } + return b +} + +// Build creates a list of 'access_request_status' objects using the +// configuration stored in the builder. +func (b *AccessRequestStatusListBuilder) Build() (list *AccessRequestStatusList, err error) { + items := make([]*AccessRequestStatus, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AccessRequestStatusList) + list.items = items + return +} diff --git a/clientapi/accesstransparency/v1/access_request_status_list_type_json.go b/clientapi/accesstransparency/v1/access_request_status_list_type_json.go new file mode 100644 index 00000000..822901b7 --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_status_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessRequestStatusList writes a list of values of the 'access_request_status' type to +// the given writer. +func MarshalAccessRequestStatusList(list []*AccessRequestStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessRequestStatusList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessRequestStatusList writes a list of value of the 'access_request_status' type to +// the given stream. +func WriteAccessRequestStatusList(list []*AccessRequestStatus, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAccessRequestStatus(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAccessRequestStatusList reads a list of values of the 'access_request_status' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAccessRequestStatusList(source interface{}) (items []*AccessRequestStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAccessRequestStatusList(iterator) + err = iterator.Error + return +} + +// ReadAccessRequestStatusList reads list of values of the ”access_request_status' type from +// the given iterator. +func ReadAccessRequestStatusList(iterator *jsoniter.Iterator) []*AccessRequestStatus { + list := []*AccessRequestStatus{} + for iterator.ReadArray() { + item := ReadAccessRequestStatus(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accesstransparency/v1/access_request_status_type.go b/clientapi/accesstransparency/v1/access_request_status_type.go new file mode 100644 index 00000000..3d2d87b6 --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_status_type.go @@ -0,0 +1,195 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + time "time" +) + +// AccessRequestStatus represents the values of the 'access_request_status' type. +// +// Representation of an access request status. +type AccessRequestStatus struct { + bitmap_ uint32 + expiresAt time.Time + state AccessRequestState +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AccessRequestStatus) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ExpiresAt returns the value of the 'expires_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the access request will expire, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *AccessRequestStatus) ExpiresAt() time.Time { + if o != nil && o.bitmap_&1 != 0 { + return o.expiresAt + } + return time.Time{} +} + +// GetExpiresAt returns the value of the 'expires_at' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the access request will expire, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *AccessRequestStatus) GetExpiresAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.expiresAt + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Current state of the Access Request. +func (o *AccessRequestStatus) State() AccessRequestState { + if o != nil && o.bitmap_&2 != 0 { + return o.state + } + return AccessRequestState("") +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// Current state of the Access Request. +func (o *AccessRequestStatus) GetState() (value AccessRequestState, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.state + } + return +} + +// AccessRequestStatusListKind is the name of the type used to represent list of objects of +// type 'access_request_status'. +const AccessRequestStatusListKind = "AccessRequestStatusList" + +// AccessRequestStatusListLinkKind is the name of the type used to represent links to list +// of objects of type 'access_request_status'. +const AccessRequestStatusListLinkKind = "AccessRequestStatusListLink" + +// AccessRequestStatusNilKind is the name of the type used to nil lists of objects of +// type 'access_request_status'. +const AccessRequestStatusListNilKind = "AccessRequestStatusListNil" + +// AccessRequestStatusList is a list of values of the 'access_request_status' type. +type AccessRequestStatusList struct { + href string + link bool + items []*AccessRequestStatus +} + +// Len returns the length of the list. +func (l *AccessRequestStatusList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AccessRequestStatusList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AccessRequestStatusList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AccessRequestStatusList) SetItems(items []*AccessRequestStatus) { + l.items = items +} + +// Items returns the items of the list. +func (l *AccessRequestStatusList) Items() []*AccessRequestStatus { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AccessRequestStatusList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AccessRequestStatusList) Get(i int) *AccessRequestStatus { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AccessRequestStatusList) Slice() []*AccessRequestStatus { + var slice []*AccessRequestStatus + if l == nil { + slice = make([]*AccessRequestStatus, 0) + } else { + slice = make([]*AccessRequestStatus, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AccessRequestStatusList) Each(f func(item *AccessRequestStatus) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AccessRequestStatusList) Range(f func(index int, item *AccessRequestStatus) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accesstransparency/v1/access_request_status_type_json.go b/clientapi/accesstransparency/v1/access_request_status_type_json.go new file mode 100644 index 00000000..aad62f5f --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_status_type_json.go @@ -0,0 +1,105 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessRequestStatus writes a value of the 'access_request_status' type to the given writer. +func MarshalAccessRequestStatus(object *AccessRequestStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessRequestStatus(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessRequestStatus writes a value of the 'access_request_status' type to the given stream. +func WriteAccessRequestStatus(object *AccessRequestStatus, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("expires_at") + stream.WriteString((object.expiresAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(string(object.state)) + } + stream.WriteObjectEnd() +} + +// UnmarshalAccessRequestStatus reads a value of the 'access_request_status' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAccessRequestStatus(source interface{}) (object *AccessRequestStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAccessRequestStatus(iterator) + err = iterator.Error + return +} + +// ReadAccessRequestStatus reads a value of the 'access_request_status' type from the given iterator. +func ReadAccessRequestStatus(iterator *jsoniter.Iterator) *AccessRequestStatus { + object := &AccessRequestStatus{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "expires_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.expiresAt = value + object.bitmap_ |= 1 + case "state": + text := iterator.ReadString() + value := AccessRequestState(text) + object.state = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accesstransparency/v1/access_request_type.go b/clientapi/accesstransparency/v1/access_request_type.go new file mode 100644 index 00000000..44df8531 --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_type.go @@ -0,0 +1,587 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + time "time" +) + +// AccessRequestKind is the name of the type used to represent objects +// of type 'access_request'. +const AccessRequestKind = "AccessRequest" + +// AccessRequestLinkKind is the name of the type used to represent links +// to objects of type 'access_request'. +const AccessRequestLinkKind = "AccessRequestLink" + +// AccessRequestNilKind is the name of the type used to nil references +// to objects of type 'access_request'. +const AccessRequestNilKind = "AccessRequestNil" + +// AccessRequest represents the values of the 'access_request' type. +// +// Representation of an access request. +type AccessRequest struct { + bitmap_ uint32 + id string + href string + clusterId string + createdAt time.Time + deadline string + deadlineAt time.Time + decisions []*Decision + duration string + internalSupportCaseId string + justification string + organizationId string + requestedBy string + status *AccessRequestStatus + subscriptionId string + supportCaseId string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *AccessRequest) Kind() string { + if o == nil { + return AccessRequestNilKind + } + if o.bitmap_&1 != 0 { + return AccessRequestLinkKind + } + return AccessRequestKind +} + +// Link returns true if this is a link. +func (o *AccessRequest) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AccessRequest) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AccessRequest) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AccessRequest) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AccessRequest) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AccessRequest) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// ClusterId returns the value of the 'cluster_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster from which the Access Request belongs to. +func (o *AccessRequest) ClusterId() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clusterId + } + return "" +} + +// GetClusterId returns the value of the 'cluster_id' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster from which the Access Request belongs to. +func (o *AccessRequest) GetClusterId() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clusterId + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the access request was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *AccessRequest) CreatedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the access request was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *AccessRequest) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.createdAt + } + return +} + +// Deadline returns the value of the 'deadline' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// How long the Access Request can be in pending state waiting for a customer decision. +func (o *AccessRequest) Deadline() string { + if o != nil && o.bitmap_&32 != 0 { + return o.deadline + } + return "" +} + +// GetDeadline returns the value of the 'deadline' attribute and +// a flag indicating if the attribute has a value. +// +// How long the Access Request can be in pending state waiting for a customer decision. +func (o *AccessRequest) GetDeadline() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.deadline + } + return +} + +// DeadlineAt returns the value of the 'deadline_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time for the deadline that the Access Request needs to be decided, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *AccessRequest) DeadlineAt() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.deadlineAt + } + return time.Time{} +} + +// GetDeadlineAt returns the value of the 'deadline_at' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time for the deadline that the Access Request needs to be decided, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *AccessRequest) GetDeadlineAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.deadlineAt + } + return +} + +// Decisions returns the value of the 'decisions' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Decisions attached to the Access Request. +func (o *AccessRequest) Decisions() []*Decision { + if o != nil && o.bitmap_&128 != 0 { + return o.decisions + } + return nil +} + +// GetDecisions returns the value of the 'decisions' attribute and +// a flag indicating if the attribute has a value. +// +// Decisions attached to the Access Request. +func (o *AccessRequest) GetDecisions() (value []*Decision, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.decisions + } + return +} + +// Duration returns the value of the 'duration' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// How long the access will last after it's been approved. +func (o *AccessRequest) Duration() string { + if o != nil && o.bitmap_&256 != 0 { + return o.duration + } + return "" +} + +// GetDuration returns the value of the 'duration' attribute and +// a flag indicating if the attribute has a value. +// +// How long the access will last after it's been approved. +func (o *AccessRequest) GetDuration() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.duration + } + return +} + +// InternalSupportCaseId returns the value of the 'internal_support_case_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Internal support case id linking to jira ticket. +func (o *AccessRequest) InternalSupportCaseId() string { + if o != nil && o.bitmap_&512 != 0 { + return o.internalSupportCaseId + } + return "" +} + +// GetInternalSupportCaseId returns the value of the 'internal_support_case_id' attribute and +// a flag indicating if the attribute has a value. +// +// Internal support case id linking to jira ticket. +func (o *AccessRequest) GetInternalSupportCaseId() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.internalSupportCaseId + } + return +} + +// Justification returns the value of the 'justification' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Justification of the Access Request. +func (o *AccessRequest) Justification() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.justification + } + return "" +} + +// GetJustification returns the value of the 'justification' attribute and +// a flag indicating if the attribute has a value. +// +// Justification of the Access Request. +func (o *AccessRequest) GetJustification() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.justification + } + return +} + +// OrganizationId returns the value of the 'organization_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Organization from which the Access Request belongs to. +func (o *AccessRequest) OrganizationId() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.organizationId + } + return "" +} + +// GetOrganizationId returns the value of the 'organization_id' attribute and +// a flag indicating if the attribute has a value. +// +// Organization from which the Access Request belongs to. +func (o *AccessRequest) GetOrganizationId() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.organizationId + } + return +} + +// RequestedBy returns the value of the 'requested_by' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// User that requested the Access. +func (o *AccessRequest) RequestedBy() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.requestedBy + } + return "" +} + +// GetRequestedBy returns the value of the 'requested_by' attribute and +// a flag indicating if the attribute has a value. +// +// User that requested the Access. +func (o *AccessRequest) GetRequestedBy() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.requestedBy + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Access Request status. +func (o *AccessRequest) Status() *AccessRequestStatus { + if o != nil && o.bitmap_&8192 != 0 { + return o.status + } + return nil +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// Access Request status. +func (o *AccessRequest) GetStatus() (value *AccessRequestStatus, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.status + } + return +} + +// SubscriptionId returns the value of the 'subscription_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Subscription from which the Access Request belongs to. +func (o *AccessRequest) SubscriptionId() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.subscriptionId + } + return "" +} + +// GetSubscriptionId returns the value of the 'subscription_id' attribute and +// a flag indicating if the attribute has a value. +// +// Subscription from which the Access Request belongs to. +func (o *AccessRequest) GetSubscriptionId() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.subscriptionId + } + return +} + +// SupportCaseId returns the value of the 'support_case_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Support case ID linking to JIRA ticket. +func (o *AccessRequest) SupportCaseId() string { + if o != nil && o.bitmap_&32768 != 0 { + return o.supportCaseId + } + return "" +} + +// GetSupportCaseId returns the value of the 'support_case_id' attribute and +// a flag indicating if the attribute has a value. +// +// Support case ID linking to JIRA ticket. +func (o *AccessRequest) GetSupportCaseId() (value string, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.supportCaseId + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the access request was lastly updated, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *AccessRequest) UpdatedAt() time.Time { + if o != nil && o.bitmap_&65536 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the access request was lastly updated, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *AccessRequest) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.updatedAt + } + return +} + +// AccessRequestListKind is the name of the type used to represent list of objects of +// type 'access_request'. +const AccessRequestListKind = "AccessRequestList" + +// AccessRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'access_request'. +const AccessRequestListLinkKind = "AccessRequestListLink" + +// AccessRequestNilKind is the name of the type used to nil lists of objects of +// type 'access_request'. +const AccessRequestListNilKind = "AccessRequestListNil" + +// AccessRequestList is a list of values of the 'access_request' type. +type AccessRequestList struct { + href string + link bool + items []*AccessRequest +} + +// Kind returns the name of the type of the object. +func (l *AccessRequestList) Kind() string { + if l == nil { + return AccessRequestListNilKind + } + if l.link { + return AccessRequestListLinkKind + } + return AccessRequestListKind +} + +// Link returns true iif this is a link. +func (l *AccessRequestList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AccessRequestList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AccessRequestList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AccessRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AccessRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AccessRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AccessRequestList) SetItems(items []*AccessRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *AccessRequestList) Items() []*AccessRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AccessRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AccessRequestList) Get(i int) *AccessRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AccessRequestList) Slice() []*AccessRequest { + var slice []*AccessRequest + if l == nil { + slice = make([]*AccessRequest, 0) + } else { + slice = make([]*AccessRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AccessRequestList) Each(f func(item *AccessRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AccessRequestList) Range(f func(index int, item *AccessRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accesstransparency/v1/access_request_type_json.go b/clientapi/accesstransparency/v1/access_request_type_json.go new file mode 100644 index 00000000..a3e16234 --- /dev/null +++ b/clientapi/accesstransparency/v1/access_request_type_json.go @@ -0,0 +1,302 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessRequest writes a value of the 'access_request' type to the given writer. +func MarshalAccessRequest(object *AccessRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessRequest writes a value of the 'access_request' type to the given stream. +func WriteAccessRequest(object *AccessRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AccessRequestLinkKind) + } else { + stream.WriteString(AccessRequestKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterId) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deadline") + stream.WriteString(object.deadline) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deadline_at") + stream.WriteString((object.deadlineAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 && object.decisions != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("decisions") + WriteDecisionList(object.decisions, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("duration") + stream.WriteString(object.duration) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("internal_support_case_id") + stream.WriteString(object.internalSupportCaseId) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("justification") + stream.WriteString(object.justification) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationId) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("requested_by") + stream.WriteString(object.requestedBy) + count++ + } + present_ = object.bitmap_&8192 != 0 && object.status != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + WriteAccessRequestStatus(object.status, stream) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionId) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("support_case_id") + stream.WriteString(object.supportCaseId) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalAccessRequest reads a value of the 'access_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAccessRequest(source interface{}) (object *AccessRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAccessRequest(iterator) + err = iterator.Error + return +} + +// ReadAccessRequest reads a value of the 'access_request' type from the given iterator. +func ReadAccessRequest(iterator *jsoniter.Iterator) *AccessRequest { + object := &AccessRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AccessRequestLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "cluster_id": + value := iterator.ReadString() + object.clusterId = value + object.bitmap_ |= 8 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 16 + case "deadline": + value := iterator.ReadString() + object.deadline = value + object.bitmap_ |= 32 + case "deadline_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.deadlineAt = value + object.bitmap_ |= 64 + case "decisions": + value := ReadDecisionList(iterator) + object.decisions = value + object.bitmap_ |= 128 + case "duration": + value := iterator.ReadString() + object.duration = value + object.bitmap_ |= 256 + case "internal_support_case_id": + value := iterator.ReadString() + object.internalSupportCaseId = value + object.bitmap_ |= 512 + case "justification": + value := iterator.ReadString() + object.justification = value + object.bitmap_ |= 1024 + case "organization_id": + value := iterator.ReadString() + object.organizationId = value + object.bitmap_ |= 2048 + case "requested_by": + value := iterator.ReadString() + object.requestedBy = value + object.bitmap_ |= 4096 + case "status": + value := ReadAccessRequestStatus(iterator) + object.status = value + object.bitmap_ |= 8192 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionId = value + object.bitmap_ |= 16384 + case "support_case_id": + value := iterator.ReadString() + object.supportCaseId = value + object.bitmap_ |= 32768 + 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_ |= 65536 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accesstransparency/v1/boolean_list_type_json.go b/clientapi/accesstransparency/v1/boolean_list_type_json.go new file mode 100644 index 00000000..e6109d70 --- /dev/null +++ b/clientapi/accesstransparency/v1/boolean_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBooleanList writes a list of values of the 'boolean' type to +// the given writer. +func MarshalBooleanList(list []bool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBooleanList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBooleanList writes a list of value of the 'boolean' type to +// the given stream. +func WriteBooleanList(list []bool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteBool(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalBooleanList reads a list of values of the 'boolean' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBooleanList(source interface{}) (items []bool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBooleanList(iterator) + err = iterator.Error + return +} + +// ReadBooleanList reads list of values of the ”boolean' type from +// the given iterator. +func ReadBooleanList(iterator *jsoniter.Iterator) []bool { + list := []bool{} + for iterator.ReadArray() { + item := iterator.ReadBool() + list = append(list, item) + } + return list +} diff --git a/clientapi/accesstransparency/v1/date_list_type_json.go b/clientapi/accesstransparency/v1/date_list_type_json.go new file mode 100644 index 00000000..29930b00 --- /dev/null +++ b/clientapi/accesstransparency/v1/date_list_type_json.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDateList writes a list of values of the 'date' type to +// the given writer. +func MarshalDateList(list []time.Time, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDateList writes a list of value of the 'date' type to +// the given stream. +func WriteDateList(list []time.Time, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString((value).Format(time.RFC3339)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDateList reads a list of values of the 'date' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDateList(source interface{}) (items []time.Time, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDateList(iterator) + err = iterator.Error + return +} + +// ReadDateList reads list of values of the ”date' type from +// the given iterator. +func ReadDateList(iterator *jsoniter.Iterator) []time.Time { + list := []time.Time{} + for iterator.ReadArray() { + text := iterator.ReadString() + item, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + list = append(list, item) + } + return list +} diff --git a/clientapi/accesstransparency/v1/decision_builder.go b/clientapi/accesstransparency/v1/decision_builder.go new file mode 100644 index 00000000..cafc35de --- /dev/null +++ b/clientapi/accesstransparency/v1/decision_builder.go @@ -0,0 +1,135 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + time "time" +) + +// DecisionBuilder contains the data and logic needed to build 'decision' objects. +// +// Representation of an decision. +type DecisionBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + decidedBy string + decision DecisionDecision + justification string + updatedAt time.Time +} + +// NewDecision creates a new builder of 'decision' objects. +func NewDecision() *DecisionBuilder { + return &DecisionBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *DecisionBuilder) Link(value bool) *DecisionBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *DecisionBuilder) ID(value string) *DecisionBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *DecisionBuilder) HREF(value string) *DecisionBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *DecisionBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *DecisionBuilder) CreatedAt(value time.Time) *DecisionBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// DecidedBy sets the value of the 'decided_by' attribute to the given value. +func (b *DecisionBuilder) DecidedBy(value string) *DecisionBuilder { + b.decidedBy = value + b.bitmap_ |= 16 + return b +} + +// Decision sets the value of the 'decision' attribute to the given value. +// +// Possible decisions to a decision status. +func (b *DecisionBuilder) Decision(value DecisionDecision) *DecisionBuilder { + b.decision = value + b.bitmap_ |= 32 + return b +} + +// Justification sets the value of the 'justification' attribute to the given value. +func (b *DecisionBuilder) Justification(value string) *DecisionBuilder { + b.justification = value + b.bitmap_ |= 64 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *DecisionBuilder) UpdatedAt(value time.Time) *DecisionBuilder { + b.updatedAt = value + b.bitmap_ |= 128 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *DecisionBuilder) Copy(object *Decision) *DecisionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.decidedBy = object.decidedBy + b.decision = object.decision + b.justification = object.justification + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'decision' object using the configuration stored in the builder. +func (b *DecisionBuilder) Build() (object *Decision, err error) { + object = new(Decision) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.decidedBy = b.decidedBy + object.decision = b.decision + object.justification = b.justification + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/accesstransparency/v1/decision_decision_list_type_json.go b/clientapi/accesstransparency/v1/decision_decision_list_type_json.go new file mode 100644 index 00000000..e8826a3e --- /dev/null +++ b/clientapi/accesstransparency/v1/decision_decision_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDecisionDecisionList writes a list of values of the 'decision_decision' type to +// the given writer. +func MarshalDecisionDecisionList(list []DecisionDecision, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDecisionDecisionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDecisionDecisionList writes a list of value of the 'decision_decision' type to +// the given stream. +func WriteDecisionDecisionList(list []DecisionDecision, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDecisionDecisionList reads a list of values of the 'decision_decision' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDecisionDecisionList(source interface{}) (items []DecisionDecision, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDecisionDecisionList(iterator) + err = iterator.Error + return +} + +// ReadDecisionDecisionList reads list of values of the ”decision_decision' type from +// the given iterator. +func ReadDecisionDecisionList(iterator *jsoniter.Iterator) []DecisionDecision { + list := []DecisionDecision{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := DecisionDecision(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/accesstransparency/v1/decision_decision_type.go b/clientapi/accesstransparency/v1/decision_decision_type.go new file mode 100644 index 00000000..a5382bac --- /dev/null +++ b/clientapi/accesstransparency/v1/decision_decision_type.go @@ -0,0 +1,32 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +// DecisionDecision represents the values of the 'decision_decision' enumerated type. +type DecisionDecision string + +const ( + // + DecisionDecisionApproved DecisionDecision = "Approved" + // + DecisionDecisionDenied DecisionDecision = "Denied" + // + DecisionDecisionExpired DecisionDecision = "Expired" +) diff --git a/clientapi/accesstransparency/v1/decision_list_builder.go b/clientapi/accesstransparency/v1/decision_list_builder.go new file mode 100644 index 00000000..fa1fb6a2 --- /dev/null +++ b/clientapi/accesstransparency/v1/decision_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +// DecisionListBuilder contains the data and logic needed to build +// 'decision' objects. +type DecisionListBuilder struct { + items []*DecisionBuilder +} + +// NewDecisionList creates a new builder of 'decision' objects. +func NewDecisionList() *DecisionListBuilder { + return new(DecisionListBuilder) +} + +// Items sets the items of the list. +func (b *DecisionListBuilder) Items(values ...*DecisionBuilder) *DecisionListBuilder { + b.items = make([]*DecisionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *DecisionListBuilder) 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 *DecisionListBuilder) Copy(list *DecisionList) *DecisionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*DecisionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewDecision().Copy(v) + } + } + return b +} + +// Build creates a list of 'decision' objects using the +// configuration stored in the builder. +func (b *DecisionListBuilder) Build() (list *DecisionList, err error) { + items := make([]*Decision, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(DecisionList) + list.items = items + return +} diff --git a/clientapi/accesstransparency/v1/decision_list_type_json.go b/clientapi/accesstransparency/v1/decision_list_type_json.go new file mode 100644 index 00000000..a431504f --- /dev/null +++ b/clientapi/accesstransparency/v1/decision_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDecisionList writes a list of values of the 'decision' type to +// the given writer. +func MarshalDecisionList(list []*Decision, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDecisionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDecisionList writes a list of value of the 'decision' type to +// the given stream. +func WriteDecisionList(list []*Decision, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteDecision(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalDecisionList reads a list of values of the 'decision' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDecisionList(source interface{}) (items []*Decision, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDecisionList(iterator) + err = iterator.Error + return +} + +// ReadDecisionList reads list of values of the ”decision' type from +// the given iterator. +func ReadDecisionList(iterator *jsoniter.Iterator) []*Decision { + list := []*Decision{} + for iterator.ReadArray() { + item := ReadDecision(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accesstransparency/v1/decision_type.go b/clientapi/accesstransparency/v1/decision_type.go new file mode 100644 index 00000000..8cc988e8 --- /dev/null +++ b/clientapi/accesstransparency/v1/decision_type.go @@ -0,0 +1,369 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + time "time" +) + +// DecisionKind is the name of the type used to represent objects +// of type 'decision'. +const DecisionKind = "Decision" + +// DecisionLinkKind is the name of the type used to represent links +// to objects of type 'decision'. +const DecisionLinkKind = "DecisionLink" + +// DecisionNilKind is the name of the type used to nil references +// to objects of type 'decision'. +const DecisionNilKind = "DecisionNil" + +// Decision represents the values of the 'decision' type. +// +// Representation of an decision. +type Decision struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + decidedBy string + decision DecisionDecision + justification string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *Decision) Kind() string { + if o == nil { + return DecisionNilKind + } + if o.bitmap_&1 != 0 { + return DecisionLinkKind + } + return DecisionKind +} + +// Link returns true if this is a link. +func (o *Decision) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Decision) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Decision) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Decision) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Decision) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Decision) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the decision was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *Decision) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the decision was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *Decision) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// DecidedBy returns the value of the 'decided_by' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// User that decided. +func (o *Decision) DecidedBy() string { + if o != nil && o.bitmap_&16 != 0 { + return o.decidedBy + } + return "" +} + +// GetDecidedBy returns the value of the 'decided_by' attribute and +// a flag indicating if the attribute has a value. +// +// User that decided. +func (o *Decision) GetDecidedBy() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.decidedBy + } + return +} + +// Decision returns the value of the 'decision' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// State of the decision. +func (o *Decision) Decision() DecisionDecision { + if o != nil && o.bitmap_&32 != 0 { + return o.decision + } + return DecisionDecision("") +} + +// GetDecision returns the value of the 'decision' attribute and +// a flag indicating if the attribute has a value. +// +// State of the decision. +func (o *Decision) GetDecision() (value DecisionDecision, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.decision + } + return +} + +// Justification returns the value of the 'justification' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Justification of the decision. +func (o *Decision) Justification() string { + if o != nil && o.bitmap_&64 != 0 { + return o.justification + } + return "" +} + +// GetJustification returns the value of the 'justification' attribute and +// a flag indicating if the attribute has a value. +// +// Justification of the decision. +func (o *Decision) GetJustification() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.justification + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the decision was lastly updated, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *Decision) UpdatedAt() time.Time { + if o != nil && o.bitmap_&128 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the decision was lastly updated, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *Decision) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.updatedAt + } + return +} + +// DecisionListKind is the name of the type used to represent list of objects of +// type 'decision'. +const DecisionListKind = "DecisionList" + +// DecisionListLinkKind is the name of the type used to represent links to list +// of objects of type 'decision'. +const DecisionListLinkKind = "DecisionListLink" + +// DecisionNilKind is the name of the type used to nil lists of objects of +// type 'decision'. +const DecisionListNilKind = "DecisionListNil" + +// DecisionList is a list of values of the 'decision' type. +type DecisionList struct { + href string + link bool + items []*Decision +} + +// Kind returns the name of the type of the object. +func (l *DecisionList) Kind() string { + if l == nil { + return DecisionListNilKind + } + if l.link { + return DecisionListLinkKind + } + return DecisionListKind +} + +// Link returns true iif this is a link. +func (l *DecisionList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *DecisionList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *DecisionList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *DecisionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *DecisionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *DecisionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *DecisionList) SetItems(items []*Decision) { + l.items = items +} + +// Items returns the items of the list. +func (l *DecisionList) Items() []*Decision { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *DecisionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *DecisionList) Get(i int) *Decision { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *DecisionList) Slice() []*Decision { + var slice []*Decision + if l == nil { + slice = make([]*Decision, 0) + } else { + slice = make([]*Decision, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *DecisionList) Each(f func(item *Decision) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *DecisionList) Range(f func(index int, item *Decision) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accesstransparency/v1/decision_type_json.go b/clientapi/accesstransparency/v1/decision_type_json.go new file mode 100644 index 00000000..4976af5f --- /dev/null +++ b/clientapi/accesstransparency/v1/decision_type_json.go @@ -0,0 +1,182 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDecision writes a value of the 'decision' type to the given writer. +func MarshalDecision(object *Decision, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDecision(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDecision writes a value of the 'decision' type to the given stream. +func WriteDecision(object *Decision, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(DecisionLinkKind) + } else { + stream.WriteString(DecisionKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("decided_by") + stream.WriteString(object.decidedBy) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("decision") + stream.WriteString(string(object.decision)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("justification") + stream.WriteString(object.justification) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalDecision reads a value of the 'decision' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalDecision(source interface{}) (object *Decision, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadDecision(iterator) + err = iterator.Error + return +} + +// ReadDecision reads a value of the 'decision' type from the given iterator. +func ReadDecision(iterator *jsoniter.Iterator) *Decision { + object := &Decision{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == DecisionLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "decided_by": + value := iterator.ReadString() + object.decidedBy = value + object.bitmap_ |= 16 + case "decision": + text := iterator.ReadString() + value := DecisionDecision(text) + object.decision = value + object.bitmap_ |= 32 + case "justification": + value := iterator.ReadString() + object.justification = value + object.bitmap_ |= 64 + 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_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accesstransparency/v1/float_list_type_json.go b/clientapi/accesstransparency/v1/float_list_type_json.go new file mode 100644 index 00000000..4db29c59 --- /dev/null +++ b/clientapi/accesstransparency/v1/float_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFloatList writes a list of values of the 'float' type to +// the given writer. +func MarshalFloatList(list []float64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFloatList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFloatList writes a list of value of the 'float' type to +// the given stream. +func WriteFloatList(list []float64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteFloat64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalFloatList reads a list of values of the 'float' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFloatList(source interface{}) (items []float64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFloatList(iterator) + err = iterator.Error + return +} + +// ReadFloatList reads list of values of the ”float' type from +// the given iterator. +func ReadFloatList(iterator *jsoniter.Iterator) []float64 { + list := []float64{} + for iterator.ReadArray() { + item := iterator.ReadFloat64() + list = append(list, item) + } + return list +} diff --git a/clientapi/accesstransparency/v1/integer_list_type_json.go b/clientapi/accesstransparency/v1/integer_list_type_json.go new file mode 100644 index 00000000..fcca52d8 --- /dev/null +++ b/clientapi/accesstransparency/v1/integer_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIntegerList writes a list of values of the 'integer' type to +// the given writer. +func MarshalIntegerList(list []int, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIntegerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIntegerList writes a list of value of the 'integer' type to +// the given stream. +func WriteIntegerList(list []int, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalIntegerList reads a list of values of the 'integer' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIntegerList(source interface{}) (items []int, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIntegerList(iterator) + err = iterator.Error + return +} + +// ReadIntegerList reads list of values of the ”integer' type from +// the given iterator. +func ReadIntegerList(iterator *jsoniter.Iterator) []int { + list := []int{} + for iterator.ReadArray() { + item := iterator.ReadInt() + list = append(list, item) + } + return list +} diff --git a/clientapi/accesstransparency/v1/interface_list_type_json.go b/clientapi/accesstransparency/v1/interface_list_type_json.go new file mode 100644 index 00000000..4b2239e7 --- /dev/null +++ b/clientapi/accesstransparency/v1/interface_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInterfaceList writes a list of values of the 'interface' type to +// the given writer. +func MarshalInterfaceList(list []interface{}, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInterfaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInterfaceList writes a list of value of the 'interface' type to +// the given stream. +func WriteInterfaceList(list []interface{}, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteVal(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalInterfaceList reads a list of values of the 'interface' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInterfaceList(source interface{}) (items []interface{}, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInterfaceList(iterator) + err = iterator.Error + return +} + +// ReadInterfaceList reads list of values of the ”interface' type from +// the given iterator. +func ReadInterfaceList(iterator *jsoniter.Iterator) []interface{} { + list := []interface{}{} + for iterator.ReadArray() { + var item interface{} + iterator.ReadVal(&item) + list = append(list, item) + } + return list +} diff --git a/clientapi/accesstransparency/v1/long_list_type_json.go b/clientapi/accesstransparency/v1/long_list_type_json.go new file mode 100644 index 00000000..115e7a72 --- /dev/null +++ b/clientapi/accesstransparency/v1/long_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLongList writes a list of values of the 'long' type to +// the given writer. +func MarshalLongList(list []int64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLongList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLongList writes a list of value of the 'long' type to +// the given stream. +func WriteLongList(list []int64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalLongList reads a list of values of the 'long' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLongList(source interface{}) (items []int64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLongList(iterator) + err = iterator.Error + return +} + +// ReadLongList reads list of values of the ”long' type from +// the given iterator. +func ReadLongList(iterator *jsoniter.Iterator) []int64 { + list := []int64{} + for iterator.ReadArray() { + item := iterator.ReadInt64() + list = append(list, item) + } + return list +} diff --git a/clientapi/accesstransparency/v1/metadata_reader.go b/clientapi/accesstransparency/v1/metadata_reader.go new file mode 100644 index 00000000..86ccb6d9 --- /dev/null +++ b/clientapi/accesstransparency/v1/metadata_reader.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMetadata writes a value of the metadata type to the given target, which +// can be a writer or a JSON encoder. +func MarshalMetadata(object *Metadata, writer io.Writer) error { + stream := helpers.NewStream(writer) + writeMetadata(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} +func writeMetadata(object *Metadata, stream *jsoniter.Stream) { + stream.WriteObjectStart() + if object.bitmap_&1 != 0 { + stream.WriteObjectField("server_version") + stream.WriteString(object.serverVersion) + } + stream.WriteObjectEnd() +} + +// UnmarshalMetadata reads a value of the metadata type from the given source, which +// which can be a reader, a slice of byte or a string. +func UnmarshalMetadata(source interface{}) (object *Metadata, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = readMetadata(iterator) + err = iterator.Error + return +} +func readMetadata(iterator *jsoniter.Iterator) *Metadata { + object := &Metadata{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "server_version": + object.serverVersion = iterator.ReadString() + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accesstransparency/v1/metadata_type.go b/clientapi/accesstransparency/v1/metadata_type.go new file mode 100644 index 00000000..6e41b656 --- /dev/null +++ b/clientapi/accesstransparency/v1/metadata_type.go @@ -0,0 +1,44 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +// Metadata contains the version metadata. +type Metadata struct { + bitmap_ uint32 + serverVersion string +} + +// ServerVersion returns the version of the server. +func (m *Metadata) ServerVersion() string { + if m != nil && m.bitmap_&1 != 0 { + return m.serverVersion + } + return "" +} + +// GetServerVersion returns the value of the server version and a flag indicating if +// the attribute has a value. +func (m *Metadata) GetServerVersion() (value string, ok bool) { + ok = m != nil && m.bitmap_&1 != 0 + if ok { + value = m.serverVersion + } + return +} diff --git a/clientapi/accesstransparency/v1/string_list_type_json.go b/clientapi/accesstransparency/v1/string_list_type_json.go new file mode 100644 index 00000000..b17ac7a4 --- /dev/null +++ b/clientapi/accesstransparency/v1/string_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStringList writes a list of values of the 'string' type to +// the given writer. +func MarshalStringList(list []string, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStringList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStringList writes a list of value of the 'string' type to +// the given stream. +func WriteStringList(list []string, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalStringList reads a list of values of the 'string' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStringList(source interface{}) (items []string, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStringList(iterator) + err = iterator.Error + return +} + +// ReadStringList reads list of values of the ”string' type from +// the given iterator. +func ReadStringList(iterator *jsoniter.Iterator) []string { + list := []string{} + for iterator.ReadArray() { + item := iterator.ReadString() + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/access_token_auth_builder.go b/clientapi/accountsmgmt/v1/access_token_auth_builder.go new file mode 100644 index 00000000..8334832c --- /dev/null +++ b/clientapi/accountsmgmt/v1/access_token_auth_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// AccessTokenAuthBuilder contains the data and logic needed to build 'access_token_auth' objects. +type AccessTokenAuthBuilder struct { + bitmap_ uint32 + auth string + email string +} + +// NewAccessTokenAuth creates a new builder of 'access_token_auth' objects. +func NewAccessTokenAuth() *AccessTokenAuthBuilder { + return &AccessTokenAuthBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AccessTokenAuthBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Auth sets the value of the 'auth' attribute to the given value. +func (b *AccessTokenAuthBuilder) Auth(value string) *AccessTokenAuthBuilder { + b.auth = value + b.bitmap_ |= 1 + return b +} + +// Email sets the value of the 'email' attribute to the given value. +func (b *AccessTokenAuthBuilder) Email(value string) *AccessTokenAuthBuilder { + b.email = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AccessTokenAuthBuilder) Copy(object *AccessTokenAuth) *AccessTokenAuthBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.auth = object.auth + b.email = object.email + return b +} + +// Build creates a 'access_token_auth' object using the configuration stored in the builder. +func (b *AccessTokenAuthBuilder) Build() (object *AccessTokenAuth, err error) { + object = new(AccessTokenAuth) + object.bitmap_ = b.bitmap_ + object.auth = b.auth + object.email = b.email + return +} diff --git a/clientapi/accountsmgmt/v1/access_token_auth_list_builder.go b/clientapi/accountsmgmt/v1/access_token_auth_list_builder.go new file mode 100644 index 00000000..3ec932b0 --- /dev/null +++ b/clientapi/accountsmgmt/v1/access_token_auth_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// AccessTokenAuthListBuilder contains the data and logic needed to build +// 'access_token_auth' objects. +type AccessTokenAuthListBuilder struct { + items []*AccessTokenAuthBuilder +} + +// NewAccessTokenAuthList creates a new builder of 'access_token_auth' objects. +func NewAccessTokenAuthList() *AccessTokenAuthListBuilder { + return new(AccessTokenAuthListBuilder) +} + +// Items sets the items of the list. +func (b *AccessTokenAuthListBuilder) Items(values ...*AccessTokenAuthBuilder) *AccessTokenAuthListBuilder { + b.items = make([]*AccessTokenAuthBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AccessTokenAuthListBuilder) 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 *AccessTokenAuthListBuilder) Copy(list *AccessTokenAuthList) *AccessTokenAuthListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AccessTokenAuthBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAccessTokenAuth().Copy(v) + } + } + return b +} + +// Build creates a list of 'access_token_auth' objects using the +// configuration stored in the builder. +func (b *AccessTokenAuthListBuilder) Build() (list *AccessTokenAuthList, err error) { + items := make([]*AccessTokenAuth, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AccessTokenAuthList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/access_token_auth_list_type_json.go b/clientapi/accountsmgmt/v1/access_token_auth_list_type_json.go new file mode 100644 index 00000000..f23e8c00 --- /dev/null +++ b/clientapi/accountsmgmt/v1/access_token_auth_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessTokenAuthList writes a list of values of the 'access_token_auth' type to +// the given writer. +func MarshalAccessTokenAuthList(list []*AccessTokenAuth, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessTokenAuthList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessTokenAuthList writes a list of value of the 'access_token_auth' type to +// the given stream. +func WriteAccessTokenAuthList(list []*AccessTokenAuth, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAccessTokenAuth(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAccessTokenAuthList reads a list of values of the 'access_token_auth' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAccessTokenAuthList(source interface{}) (items []*AccessTokenAuth, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAccessTokenAuthList(iterator) + err = iterator.Error + return +} + +// ReadAccessTokenAuthList reads list of values of the ”access_token_auth' type from +// the given iterator. +func ReadAccessTokenAuthList(iterator *jsoniter.Iterator) []*AccessTokenAuth { + list := []*AccessTokenAuth{} + for iterator.ReadArray() { + item := ReadAccessTokenAuth(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/access_token_auth_type.go b/clientapi/accountsmgmt/v1/access_token_auth_type.go new file mode 100644 index 00000000..206b2061 --- /dev/null +++ b/clientapi/accountsmgmt/v1/access_token_auth_type.go @@ -0,0 +1,179 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// AccessTokenAuth represents the values of the 'access_token_auth' type. +type AccessTokenAuth struct { + bitmap_ uint32 + auth string + email string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AccessTokenAuth) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Auth returns the value of the 'auth' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *AccessTokenAuth) Auth() string { + if o != nil && o.bitmap_&1 != 0 { + return o.auth + } + return "" +} + +// GetAuth returns the value of the 'auth' attribute and +// a flag indicating if the attribute has a value. +func (o *AccessTokenAuth) GetAuth() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.auth + } + return +} + +// Email returns the value of the 'email' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *AccessTokenAuth) Email() string { + if o != nil && o.bitmap_&2 != 0 { + return o.email + } + return "" +} + +// GetEmail returns the value of the 'email' attribute and +// a flag indicating if the attribute has a value. +func (o *AccessTokenAuth) GetEmail() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.email + } + return +} + +// AccessTokenAuthListKind is the name of the type used to represent list of objects of +// type 'access_token_auth'. +const AccessTokenAuthListKind = "AccessTokenAuthList" + +// AccessTokenAuthListLinkKind is the name of the type used to represent links to list +// of objects of type 'access_token_auth'. +const AccessTokenAuthListLinkKind = "AccessTokenAuthListLink" + +// AccessTokenAuthNilKind is the name of the type used to nil lists of objects of +// type 'access_token_auth'. +const AccessTokenAuthListNilKind = "AccessTokenAuthListNil" + +// AccessTokenAuthList is a list of values of the 'access_token_auth' type. +type AccessTokenAuthList struct { + href string + link bool + items []*AccessTokenAuth +} + +// Len returns the length of the list. +func (l *AccessTokenAuthList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AccessTokenAuthList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AccessTokenAuthList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AccessTokenAuthList) SetItems(items []*AccessTokenAuth) { + l.items = items +} + +// Items returns the items of the list. +func (l *AccessTokenAuthList) Items() []*AccessTokenAuth { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AccessTokenAuthList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AccessTokenAuthList) Get(i int) *AccessTokenAuth { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AccessTokenAuthList) Slice() []*AccessTokenAuth { + var slice []*AccessTokenAuth + if l == nil { + slice = make([]*AccessTokenAuth, 0) + } else { + slice = make([]*AccessTokenAuth, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AccessTokenAuthList) Each(f func(item *AccessTokenAuth) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AccessTokenAuthList) Range(f func(index int, item *AccessTokenAuth) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/access_token_auth_type_json.go b/clientapi/accountsmgmt/v1/access_token_auth_type_json.go new file mode 100644 index 00000000..e8628844 --- /dev/null +++ b/clientapi/accountsmgmt/v1/access_token_auth_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessTokenAuth writes a value of the 'access_token_auth' type to the given writer. +func MarshalAccessTokenAuth(object *AccessTokenAuth, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessTokenAuth(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessTokenAuth writes a value of the 'access_token_auth' type to the given stream. +func WriteAccessTokenAuth(object *AccessTokenAuth, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("auth") + stream.WriteString(object.auth) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("email") + stream.WriteString(object.email) + } + stream.WriteObjectEnd() +} + +// UnmarshalAccessTokenAuth reads a value of the 'access_token_auth' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAccessTokenAuth(source interface{}) (object *AccessTokenAuth, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAccessTokenAuth(iterator) + err = iterator.Error + return +} + +// ReadAccessTokenAuth reads a value of the 'access_token_auth' type from the given iterator. +func ReadAccessTokenAuth(iterator *jsoniter.Iterator) *AccessTokenAuth { + object := &AccessTokenAuth{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "auth": + value := iterator.ReadString() + object.auth = value + object.bitmap_ |= 1 + case "email": + value := iterator.ReadString() + object.email = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/access_token_builder.go b/clientapi/accountsmgmt/v1/access_token_builder.go new file mode 100644 index 00000000..150d3bc0 --- /dev/null +++ b/clientapi/accountsmgmt/v1/access_token_builder.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// AccessTokenBuilder contains the data and logic needed to build 'access_token' objects. +type AccessTokenBuilder struct { + bitmap_ uint32 + auths map[string]*AccessTokenAuthBuilder +} + +// NewAccessToken creates a new builder of 'access_token' objects. +func NewAccessToken() *AccessTokenBuilder { + return &AccessTokenBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AccessTokenBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Auths sets the value of the 'auths' attribute to the given value. +func (b *AccessTokenBuilder) Auths(value map[string]*AccessTokenAuthBuilder) *AccessTokenBuilder { + b.auths = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AccessTokenBuilder) Copy(object *AccessToken) *AccessTokenBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if len(object.auths) > 0 { + b.auths = map[string]*AccessTokenAuthBuilder{} + for k, v := range object.auths { + b.auths[k] = NewAccessTokenAuth().Copy(v) + } + } else { + b.auths = nil + } + return b +} + +// Build creates a 'access_token' object using the configuration stored in the builder. +func (b *AccessTokenBuilder) Build() (object *AccessToken, err error) { + object = new(AccessToken) + object.bitmap_ = b.bitmap_ + if b.auths != nil { + object.auths = make(map[string]*AccessTokenAuth) + for k, v := range b.auths { + object.auths[k], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/accountsmgmt/v1/access_token_list_builder.go b/clientapi/accountsmgmt/v1/access_token_list_builder.go new file mode 100644 index 00000000..b6a3be3c --- /dev/null +++ b/clientapi/accountsmgmt/v1/access_token_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// AccessTokenListBuilder contains the data and logic needed to build +// 'access_token' objects. +type AccessTokenListBuilder struct { + items []*AccessTokenBuilder +} + +// NewAccessTokenList creates a new builder of 'access_token' objects. +func NewAccessTokenList() *AccessTokenListBuilder { + return new(AccessTokenListBuilder) +} + +// Items sets the items of the list. +func (b *AccessTokenListBuilder) Items(values ...*AccessTokenBuilder) *AccessTokenListBuilder { + b.items = make([]*AccessTokenBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AccessTokenListBuilder) 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 *AccessTokenListBuilder) Copy(list *AccessTokenList) *AccessTokenListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AccessTokenBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAccessToken().Copy(v) + } + } + return b +} + +// Build creates a list of 'access_token' objects using the +// configuration stored in the builder. +func (b *AccessTokenListBuilder) Build() (list *AccessTokenList, err error) { + items := make([]*AccessToken, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AccessTokenList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/access_token_list_type_json.go b/clientapi/accountsmgmt/v1/access_token_list_type_json.go new file mode 100644 index 00000000..6437bfed --- /dev/null +++ b/clientapi/accountsmgmt/v1/access_token_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessTokenList writes a list of values of the 'access_token' type to +// the given writer. +func MarshalAccessTokenList(list []*AccessToken, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessTokenList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessTokenList writes a list of value of the 'access_token' type to +// the given stream. +func WriteAccessTokenList(list []*AccessToken, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAccessToken(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAccessTokenList reads a list of values of the 'access_token' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAccessTokenList(source interface{}) (items []*AccessToken, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAccessTokenList(iterator) + err = iterator.Error + return +} + +// ReadAccessTokenList reads list of values of the ”access_token' type from +// the given iterator. +func ReadAccessTokenList(iterator *jsoniter.Iterator) []*AccessToken { + list := []*AccessToken{} + for iterator.ReadArray() { + item := ReadAccessToken(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/access_token_type.go b/clientapi/accountsmgmt/v1/access_token_type.go new file mode 100644 index 00000000..3658660f --- /dev/null +++ b/clientapi/accountsmgmt/v1/access_token_type.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// AccessToken represents the values of the 'access_token' type. +type AccessToken struct { + bitmap_ uint32 + auths map[string]*AccessTokenAuth +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AccessToken) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Auths returns the value of the 'auths' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *AccessToken) Auths() map[string]*AccessTokenAuth { + if o != nil && o.bitmap_&1 != 0 { + return o.auths + } + return nil +} + +// GetAuths returns the value of the 'auths' attribute and +// a flag indicating if the attribute has a value. +func (o *AccessToken) GetAuths() (value map[string]*AccessTokenAuth, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.auths + } + return +} + +// AccessTokenListKind is the name of the type used to represent list of objects of +// type 'access_token'. +const AccessTokenListKind = "AccessTokenList" + +// AccessTokenListLinkKind is the name of the type used to represent links to list +// of objects of type 'access_token'. +const AccessTokenListLinkKind = "AccessTokenListLink" + +// AccessTokenNilKind is the name of the type used to nil lists of objects of +// type 'access_token'. +const AccessTokenListNilKind = "AccessTokenListNil" + +// AccessTokenList is a list of values of the 'access_token' type. +type AccessTokenList struct { + href string + link bool + items []*AccessToken +} + +// Len returns the length of the list. +func (l *AccessTokenList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AccessTokenList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AccessTokenList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AccessTokenList) SetItems(items []*AccessToken) { + l.items = items +} + +// Items returns the items of the list. +func (l *AccessTokenList) Items() []*AccessToken { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AccessTokenList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AccessTokenList) Get(i int) *AccessToken { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AccessTokenList) Slice() []*AccessToken { + var slice []*AccessToken + if l == nil { + slice = make([]*AccessToken, 0) + } else { + slice = make([]*AccessToken, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AccessTokenList) Each(f func(item *AccessToken) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AccessTokenList) Range(f func(index int, item *AccessToken) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/access_token_type_json.go b/clientapi/accountsmgmt/v1/access_token_type_json.go new file mode 100644 index 00000000..484e580f --- /dev/null +++ b/clientapi/accountsmgmt/v1/access_token_type_json.go @@ -0,0 +1,115 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessToken writes a value of the 'access_token' type to the given writer. +func MarshalAccessToken(object *AccessToken, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessToken(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessToken writes a value of the 'access_token' type to the given stream. +func WriteAccessToken(object *AccessToken, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.auths != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("auths") + if object.auths != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.auths)) + i := 0 + for key := range object.auths { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.auths[key] + stream.WriteObjectField(key) + WriteAccessTokenAuth(item, stream) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + } + stream.WriteObjectEnd() +} + +// UnmarshalAccessToken reads a value of the 'access_token' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAccessToken(source interface{}) (object *AccessToken, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAccessToken(iterator) + err = iterator.Error + return +} + +// ReadAccessToken reads a value of the 'access_token' type from the given iterator. +func ReadAccessToken(iterator *jsoniter.Iterator) *AccessToken { + object := &AccessToken{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "auths": + value := map[string]*AccessTokenAuth{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := ReadAccessTokenAuth(iterator) + value[key] = item + } + object.auths = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/account_builder.go b/clientapi/accountsmgmt/v1/account_builder.go new file mode 100644 index 00000000..7fc483cd --- /dev/null +++ b/clientapi/accountsmgmt/v1/account_builder.go @@ -0,0 +1,276 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// AccountBuilder contains the data and logic needed to build 'account' objects. +type AccountBuilder struct { + bitmap_ uint32 + id string + href string + banCode string + banDescription string + capabilities []*CapabilityBuilder + createdAt time.Time + email string + firstName string + labels []*LabelBuilder + lastName string + organization *OrganizationBuilder + rhitAccountID string + rhitWebUserId string + updatedAt time.Time + username string + banned bool + serviceAccount bool +} + +// NewAccount creates a new builder of 'account' objects. +func NewAccount() *AccountBuilder { + return &AccountBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AccountBuilder) Link(value bool) *AccountBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AccountBuilder) ID(value string) *AccountBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AccountBuilder) HREF(value string) *AccountBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AccountBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// BanCode sets the value of the 'ban_code' attribute to the given value. +func (b *AccountBuilder) BanCode(value string) *AccountBuilder { + b.banCode = value + b.bitmap_ |= 8 + return b +} + +// BanDescription sets the value of the 'ban_description' attribute to the given value. +func (b *AccountBuilder) BanDescription(value string) *AccountBuilder { + b.banDescription = value + b.bitmap_ |= 16 + return b +} + +// Banned sets the value of the 'banned' attribute to the given value. +func (b *AccountBuilder) Banned(value bool) *AccountBuilder { + b.banned = value + b.bitmap_ |= 32 + return b +} + +// Capabilities sets the value of the 'capabilities' attribute to the given values. +func (b *AccountBuilder) Capabilities(values ...*CapabilityBuilder) *AccountBuilder { + b.capabilities = make([]*CapabilityBuilder, len(values)) + copy(b.capabilities, values) + b.bitmap_ |= 64 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *AccountBuilder) CreatedAt(value time.Time) *AccountBuilder { + b.createdAt = value + b.bitmap_ |= 128 + return b +} + +// Email sets the value of the 'email' attribute to the given value. +func (b *AccountBuilder) Email(value string) *AccountBuilder { + b.email = value + b.bitmap_ |= 256 + return b +} + +// FirstName sets the value of the 'first_name' attribute to the given value. +func (b *AccountBuilder) FirstName(value string) *AccountBuilder { + b.firstName = value + b.bitmap_ |= 512 + return b +} + +// Labels sets the value of the 'labels' attribute to the given values. +func (b *AccountBuilder) Labels(values ...*LabelBuilder) *AccountBuilder { + b.labels = make([]*LabelBuilder, len(values)) + copy(b.labels, values) + b.bitmap_ |= 1024 + return b +} + +// LastName sets the value of the 'last_name' attribute to the given value. +func (b *AccountBuilder) LastName(value string) *AccountBuilder { + b.lastName = value + b.bitmap_ |= 2048 + return b +} + +// Organization sets the value of the 'organization' attribute to the given value. +func (b *AccountBuilder) Organization(value *OrganizationBuilder) *AccountBuilder { + b.organization = value + if value != nil { + b.bitmap_ |= 4096 + } else { + b.bitmap_ &^= 4096 + } + return b +} + +// RhitAccountID sets the value of the 'rhit_account_ID' attribute to the given value. +func (b *AccountBuilder) RhitAccountID(value string) *AccountBuilder { + b.rhitAccountID = value + b.bitmap_ |= 8192 + return b +} + +// RhitWebUserId sets the value of the 'rhit_web_user_id' attribute to the given value. +func (b *AccountBuilder) RhitWebUserId(value string) *AccountBuilder { + b.rhitWebUserId = value + b.bitmap_ |= 16384 + return b +} + +// ServiceAccount sets the value of the 'service_account' attribute to the given value. +func (b *AccountBuilder) ServiceAccount(value bool) *AccountBuilder { + b.serviceAccount = value + b.bitmap_ |= 32768 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *AccountBuilder) UpdatedAt(value time.Time) *AccountBuilder { + b.updatedAt = value + b.bitmap_ |= 65536 + return b +} + +// Username sets the value of the 'username' attribute to the given value. +func (b *AccountBuilder) Username(value string) *AccountBuilder { + b.username = value + b.bitmap_ |= 131072 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AccountBuilder) Copy(object *Account) *AccountBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.banCode = object.banCode + b.banDescription = object.banDescription + b.banned = object.banned + if object.capabilities != nil { + b.capabilities = make([]*CapabilityBuilder, len(object.capabilities)) + for i, v := range object.capabilities { + b.capabilities[i] = NewCapability().Copy(v) + } + } else { + b.capabilities = nil + } + b.createdAt = object.createdAt + b.email = object.email + b.firstName = object.firstName + if object.labels != nil { + b.labels = make([]*LabelBuilder, len(object.labels)) + for i, v := range object.labels { + b.labels[i] = NewLabel().Copy(v) + } + } else { + b.labels = nil + } + b.lastName = object.lastName + if object.organization != nil { + b.organization = NewOrganization().Copy(object.organization) + } else { + b.organization = nil + } + b.rhitAccountID = object.rhitAccountID + b.rhitWebUserId = object.rhitWebUserId + b.serviceAccount = object.serviceAccount + b.updatedAt = object.updatedAt + b.username = object.username + return b +} + +// Build creates a 'account' object using the configuration stored in the builder. +func (b *AccountBuilder) Build() (object *Account, err error) { + object = new(Account) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.banCode = b.banCode + object.banDescription = b.banDescription + object.banned = b.banned + if b.capabilities != nil { + object.capabilities = make([]*Capability, len(b.capabilities)) + for i, v := range b.capabilities { + object.capabilities[i], err = v.Build() + if err != nil { + return + } + } + } + object.createdAt = b.createdAt + object.email = b.email + object.firstName = b.firstName + if b.labels != nil { + object.labels = make([]*Label, len(b.labels)) + for i, v := range b.labels { + object.labels[i], err = v.Build() + if err != nil { + return + } + } + } + object.lastName = b.lastName + if b.organization != nil { + object.organization, err = b.organization.Build() + if err != nil { + return + } + } + object.rhitAccountID = b.rhitAccountID + object.rhitWebUserId = b.rhitWebUserId + object.serviceAccount = b.serviceAccount + object.updatedAt = b.updatedAt + object.username = b.username + return +} diff --git a/clientapi/accountsmgmt/v1/account_list_builder.go b/clientapi/accountsmgmt/v1/account_list_builder.go new file mode 100644 index 00000000..c2eaa95e --- /dev/null +++ b/clientapi/accountsmgmt/v1/account_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// AccountListBuilder contains the data and logic needed to build +// 'account' objects. +type AccountListBuilder struct { + items []*AccountBuilder +} + +// NewAccountList creates a new builder of 'account' objects. +func NewAccountList() *AccountListBuilder { + return new(AccountListBuilder) +} + +// Items sets the items of the list. +func (b *AccountListBuilder) Items(values ...*AccountBuilder) *AccountListBuilder { + b.items = make([]*AccountBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AccountListBuilder) 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 *AccountListBuilder) Copy(list *AccountList) *AccountListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AccountBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAccount().Copy(v) + } + } + return b +} + +// Build creates a list of 'account' objects using the +// configuration stored in the builder. +func (b *AccountListBuilder) Build() (list *AccountList, err error) { + items := make([]*Account, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AccountList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/account_list_type_json.go b/clientapi/accountsmgmt/v1/account_list_type_json.go new file mode 100644 index 00000000..13ef9e21 --- /dev/null +++ b/clientapi/accountsmgmt/v1/account_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccountList writes a list of values of the 'account' type to +// the given writer. +func MarshalAccountList(list []*Account, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccountList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccountList writes a list of value of the 'account' type to +// the given stream. +func WriteAccountList(list []*Account, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAccount(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAccountList reads a list of values of the 'account' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAccountList(source interface{}) (items []*Account, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAccountList(iterator) + err = iterator.Error + return +} + +// ReadAccountList reads list of values of the ”account' type from +// the given iterator. +func ReadAccountList(iterator *jsoniter.Iterator) []*Account { + list := []*Account{} + for iterator.ReadArray() { + item := ReadAccount(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/account_type.go b/clientapi/accountsmgmt/v1/account_type.go new file mode 100644 index 00000000..761b51cd --- /dev/null +++ b/clientapi/accountsmgmt/v1/account_type.go @@ -0,0 +1,547 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// AccountKind is the name of the type used to represent objects +// of type 'account'. +const AccountKind = "Account" + +// AccountLinkKind is the name of the type used to represent links +// to objects of type 'account'. +const AccountLinkKind = "AccountLink" + +// AccountNilKind is the name of the type used to nil references +// to objects of type 'account'. +const AccountNilKind = "AccountNil" + +// Account represents the values of the 'account' type. +type Account struct { + bitmap_ uint32 + id string + href string + banCode string + banDescription string + capabilities []*Capability + createdAt time.Time + email string + firstName string + labels []*Label + lastName string + organization *Organization + rhitAccountID string + rhitWebUserId string + updatedAt time.Time + username string + banned bool + serviceAccount bool +} + +// Kind returns the name of the type of the object. +func (o *Account) Kind() string { + if o == nil { + return AccountNilKind + } + if o.bitmap_&1 != 0 { + return AccountLinkKind + } + return AccountKind +} + +// Link returns true if this is a link. +func (o *Account) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Account) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Account) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Account) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Account) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Account) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// BanCode returns the value of the 'ban_code' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) BanCode() string { + if o != nil && o.bitmap_&8 != 0 { + return o.banCode + } + return "" +} + +// GetBanCode returns the value of the 'ban_code' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetBanCode() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.banCode + } + return +} + +// BanDescription returns the value of the 'ban_description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) BanDescription() string { + if o != nil && o.bitmap_&16 != 0 { + return o.banDescription + } + return "" +} + +// GetBanDescription returns the value of the 'ban_description' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetBanDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.banDescription + } + return +} + +// Banned returns the value of the 'banned' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) Banned() bool { + if o != nil && o.bitmap_&32 != 0 { + return o.banned + } + return false +} + +// GetBanned returns the value of the 'banned' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetBanned() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.banned + } + return +} + +// Capabilities returns the value of the 'capabilities' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) Capabilities() []*Capability { + if o != nil && o.bitmap_&64 != 0 { + return o.capabilities + } + return nil +} + +// GetCapabilities returns the value of the 'capabilities' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetCapabilities() (value []*Capability, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.capabilities + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) CreatedAt() time.Time { + if o != nil && o.bitmap_&128 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.createdAt + } + return +} + +// Email returns the value of the 'email' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) Email() string { + if o != nil && o.bitmap_&256 != 0 { + return o.email + } + return "" +} + +// GetEmail returns the value of the 'email' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetEmail() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.email + } + return +} + +// FirstName returns the value of the 'first_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) FirstName() string { + if o != nil && o.bitmap_&512 != 0 { + return o.firstName + } + return "" +} + +// GetFirstName returns the value of the 'first_name' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetFirstName() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.firstName + } + return +} + +// Labels returns the value of the 'labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) Labels() []*Label { + if o != nil && o.bitmap_&1024 != 0 { + return o.labels + } + return nil +} + +// GetLabels returns the value of the 'labels' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetLabels() (value []*Label, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.labels + } + return +} + +// LastName returns the value of the 'last_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) LastName() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.lastName + } + return "" +} + +// GetLastName returns the value of the 'last_name' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetLastName() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.lastName + } + return +} + +// Organization returns the value of the 'organization' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) Organization() *Organization { + if o != nil && o.bitmap_&4096 != 0 { + return o.organization + } + return nil +} + +// GetOrganization returns the value of the 'organization' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetOrganization() (value *Organization, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.organization + } + return +} + +// RhitAccountID returns the value of the 'rhit_account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// RhitAccountID will be deprecated in favor of RhitWebUserId +func (o *Account) RhitAccountID() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.rhitAccountID + } + return "" +} + +// GetRhitAccountID returns the value of the 'rhit_account_ID' attribute and +// a flag indicating if the attribute has a value. +// +// RhitAccountID will be deprecated in favor of RhitWebUserId +func (o *Account) GetRhitAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.rhitAccountID + } + return +} + +// RhitWebUserId returns the value of the 'rhit_web_user_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) RhitWebUserId() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.rhitWebUserId + } + return "" +} + +// GetRhitWebUserId returns the value of the 'rhit_web_user_id' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetRhitWebUserId() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.rhitWebUserId + } + return +} + +// ServiceAccount returns the value of the 'service_account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) ServiceAccount() bool { + if o != nil && o.bitmap_&32768 != 0 { + return o.serviceAccount + } + return false +} + +// GetServiceAccount returns the value of the 'service_account' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetServiceAccount() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.serviceAccount + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) UpdatedAt() time.Time { + if o != nil && o.bitmap_&65536 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.updatedAt + } + return +} + +// Username returns the value of the 'username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Account) Username() string { + if o != nil && o.bitmap_&131072 != 0 { + return o.username + } + return "" +} + +// GetUsername returns the value of the 'username' attribute and +// a flag indicating if the attribute has a value. +func (o *Account) GetUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&131072 != 0 + if ok { + value = o.username + } + return +} + +// AccountListKind is the name of the type used to represent list of objects of +// type 'account'. +const AccountListKind = "AccountList" + +// AccountListLinkKind is the name of the type used to represent links to list +// of objects of type 'account'. +const AccountListLinkKind = "AccountListLink" + +// AccountNilKind is the name of the type used to nil lists of objects of +// type 'account'. +const AccountListNilKind = "AccountListNil" + +// AccountList is a list of values of the 'account' type. +type AccountList struct { + href string + link bool + items []*Account +} + +// Kind returns the name of the type of the object. +func (l *AccountList) Kind() string { + if l == nil { + return AccountListNilKind + } + if l.link { + return AccountListLinkKind + } + return AccountListKind +} + +// Link returns true iif this is a link. +func (l *AccountList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AccountList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AccountList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AccountList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AccountList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AccountList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AccountList) SetItems(items []*Account) { + l.items = items +} + +// Items returns the items of the list. +func (l *AccountList) Items() []*Account { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AccountList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AccountList) Get(i int) *Account { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AccountList) Slice() []*Account { + var slice []*Account + if l == nil { + slice = make([]*Account, 0) + } else { + slice = make([]*Account, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AccountList) Each(f func(item *Account) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AccountList) Range(f func(index int, item *Account) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/account_type_json.go b/clientapi/accountsmgmt/v1/account_type_json.go new file mode 100644 index 00000000..361420b8 --- /dev/null +++ b/clientapi/accountsmgmt/v1/account_type_json.go @@ -0,0 +1,311 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccount writes a value of the 'account' type to the given writer. +func MarshalAccount(object *Account, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccount(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccount writes a value of the 'account' type to the given stream. +func WriteAccount(object *Account, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AccountLinkKind) + } else { + stream.WriteString(AccountKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ban_code") + stream.WriteString(object.banCode) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ban_description") + stream.WriteString(object.banDescription) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("banned") + stream.WriteBool(object.banned) + count++ + } + present_ = object.bitmap_&64 != 0 && object.capabilities != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("capabilities") + WriteCapabilityList(object.capabilities, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("email") + stream.WriteString(object.email) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("first_name") + stream.WriteString(object.firstName) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.labels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("labels") + WriteLabelList(object.labels, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_name") + stream.WriteString(object.lastName) + count++ + } + present_ = object.bitmap_&4096 != 0 && object.organization != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization") + WriteOrganization(object.organization, stream) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("rhit_account_id") + stream.WriteString(object.rhitAccountID) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("rhit_web_user_id") + stream.WriteString(object.rhitWebUserId) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_account") + stream.WriteBool(object.serviceAccount) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&131072 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("username") + stream.WriteString(object.username) + } + stream.WriteObjectEnd() +} + +// UnmarshalAccount reads a value of the 'account' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAccount(source interface{}) (object *Account, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAccount(iterator) + err = iterator.Error + return +} + +// ReadAccount reads a value of the 'account' type from the given iterator. +func ReadAccount(iterator *jsoniter.Iterator) *Account { + object := &Account{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AccountLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "ban_code": + value := iterator.ReadString() + object.banCode = value + object.bitmap_ |= 8 + case "ban_description": + value := iterator.ReadString() + object.banDescription = value + object.bitmap_ |= 16 + case "banned": + value := iterator.ReadBool() + object.banned = value + object.bitmap_ |= 32 + case "capabilities": + value := ReadCapabilityList(iterator) + object.capabilities = value + object.bitmap_ |= 64 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 128 + case "email": + value := iterator.ReadString() + object.email = value + object.bitmap_ |= 256 + case "first_name": + value := iterator.ReadString() + object.firstName = value + object.bitmap_ |= 512 + case "labels": + value := ReadLabelList(iterator) + object.labels = value + object.bitmap_ |= 1024 + case "last_name": + value := iterator.ReadString() + object.lastName = value + object.bitmap_ |= 2048 + case "organization": + value := ReadOrganization(iterator) + object.organization = value + object.bitmap_ |= 4096 + case "rhit_account_id": + value := iterator.ReadString() + object.rhitAccountID = value + object.bitmap_ |= 8192 + case "rhit_web_user_id": + value := iterator.ReadString() + object.rhitWebUserId = value + object.bitmap_ |= 16384 + case "service_account": + value := iterator.ReadBool() + object.serviceAccount = value + object.bitmap_ |= 32768 + 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_ |= 65536 + case "username": + value := iterator.ReadString() + object.username = value + object.bitmap_ |= 131072 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/action_list_type_json.go b/clientapi/accountsmgmt/v1/action_list_type_json.go new file mode 100644 index 00000000..e2e99d95 --- /dev/null +++ b/clientapi/accountsmgmt/v1/action_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalActionList writes a list of values of the 'action' type to +// the given writer. +func MarshalActionList(list []Action, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteActionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteActionList writes a list of value of the 'action' type to +// the given stream. +func WriteActionList(list []Action, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalActionList reads a list of values of the 'action' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalActionList(source interface{}) (items []Action, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadActionList(iterator) + err = iterator.Error + return +} + +// ReadActionList reads list of values of the ”action' type from +// the given iterator. +func ReadActionList(iterator *jsoniter.Iterator) []Action { + list := []Action{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := Action(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/action_type.go b/clientapi/accountsmgmt/v1/action_type.go new file mode 100644 index 00000000..a9781557 --- /dev/null +++ b/clientapi/accountsmgmt/v1/action_type.go @@ -0,0 +1,36 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// Action represents the values of the 'action' enumerated type. +type Action string + +const ( + // + ActionCreate Action = "create" + // + ActionDelete Action = "delete" + // + ActionGet Action = "get" + // + ActionList Action = "list" + // + ActionUpdate Action = "update" +) diff --git a/clientapi/accountsmgmt/v1/billing_model_item_builder.go b/clientapi/accountsmgmt/v1/billing_model_item_builder.go new file mode 100644 index 00000000..9a1de641 --- /dev/null +++ b/clientapi/accountsmgmt/v1/billing_model_item_builder.go @@ -0,0 +1,119 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// BillingModelItemBuilder contains the data and logic needed to build 'billing_model_item' objects. +// +// BillingModelItem represents a billing model +type BillingModelItemBuilder struct { + bitmap_ uint32 + id string + href string + billingModelType string + description string + displayName string + marketplace string +} + +// NewBillingModelItem creates a new builder of 'billing_model_item' objects. +func NewBillingModelItem() *BillingModelItemBuilder { + return &BillingModelItemBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *BillingModelItemBuilder) Link(value bool) *BillingModelItemBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *BillingModelItemBuilder) ID(value string) *BillingModelItemBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *BillingModelItemBuilder) HREF(value string) *BillingModelItemBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *BillingModelItemBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// BillingModelType sets the value of the 'billing_model_type' attribute to the given value. +func (b *BillingModelItemBuilder) BillingModelType(value string) *BillingModelItemBuilder { + b.billingModelType = value + b.bitmap_ |= 8 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *BillingModelItemBuilder) Description(value string) *BillingModelItemBuilder { + b.description = value + b.bitmap_ |= 16 + return b +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *BillingModelItemBuilder) DisplayName(value string) *BillingModelItemBuilder { + b.displayName = value + b.bitmap_ |= 32 + return b +} + +// Marketplace sets the value of the 'marketplace' attribute to the given value. +func (b *BillingModelItemBuilder) Marketplace(value string) *BillingModelItemBuilder { + b.marketplace = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *BillingModelItemBuilder) Copy(object *BillingModelItem) *BillingModelItemBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.billingModelType = object.billingModelType + b.description = object.description + b.displayName = object.displayName + b.marketplace = object.marketplace + return b +} + +// Build creates a 'billing_model_item' object using the configuration stored in the builder. +func (b *BillingModelItemBuilder) Build() (object *BillingModelItem, err error) { + object = new(BillingModelItem) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.billingModelType = b.billingModelType + object.description = b.description + object.displayName = b.displayName + object.marketplace = b.marketplace + return +} diff --git a/clientapi/accountsmgmt/v1/billing_model_item_list_builder.go b/clientapi/accountsmgmt/v1/billing_model_item_list_builder.go new file mode 100644 index 00000000..f01a1352 --- /dev/null +++ b/clientapi/accountsmgmt/v1/billing_model_item_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// BillingModelItemListBuilder contains the data and logic needed to build +// 'billing_model_item' objects. +type BillingModelItemListBuilder struct { + items []*BillingModelItemBuilder +} + +// NewBillingModelItemList creates a new builder of 'billing_model_item' objects. +func NewBillingModelItemList() *BillingModelItemListBuilder { + return new(BillingModelItemListBuilder) +} + +// Items sets the items of the list. +func (b *BillingModelItemListBuilder) Items(values ...*BillingModelItemBuilder) *BillingModelItemListBuilder { + b.items = make([]*BillingModelItemBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *BillingModelItemListBuilder) 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 *BillingModelItemListBuilder) Copy(list *BillingModelItemList) *BillingModelItemListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*BillingModelItemBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewBillingModelItem().Copy(v) + } + } + return b +} + +// Build creates a list of 'billing_model_item' objects using the +// configuration stored in the builder. +func (b *BillingModelItemListBuilder) Build() (list *BillingModelItemList, err error) { + items := make([]*BillingModelItem, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(BillingModelItemList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/billing_model_item_list_type_json.go b/clientapi/accountsmgmt/v1/billing_model_item_list_type_json.go new file mode 100644 index 00000000..f2dc2972 --- /dev/null +++ b/clientapi/accountsmgmt/v1/billing_model_item_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBillingModelItemList writes a list of values of the 'billing_model_item' type to +// the given writer. +func MarshalBillingModelItemList(list []*BillingModelItem, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBillingModelItemList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBillingModelItemList writes a list of value of the 'billing_model_item' type to +// the given stream. +func WriteBillingModelItemList(list []*BillingModelItem, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteBillingModelItem(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalBillingModelItemList reads a list of values of the 'billing_model_item' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBillingModelItemList(source interface{}) (items []*BillingModelItem, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBillingModelItemList(iterator) + err = iterator.Error + return +} + +// ReadBillingModelItemList reads list of values of the ”billing_model_item' type from +// the given iterator. +func ReadBillingModelItemList(iterator *jsoniter.Iterator) []*BillingModelItem { + list := []*BillingModelItem{} + for iterator.ReadArray() { + item := ReadBillingModelItem(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/billing_model_item_type.go b/clientapi/accountsmgmt/v1/billing_model_item_type.go new file mode 100644 index 00000000..d6547448 --- /dev/null +++ b/clientapi/accountsmgmt/v1/billing_model_item_type.go @@ -0,0 +1,337 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// BillingModelItemKind is the name of the type used to represent objects +// of type 'billing_model_item'. +const BillingModelItemKind = "BillingModelItem" + +// BillingModelItemLinkKind is the name of the type used to represent links +// to objects of type 'billing_model_item'. +const BillingModelItemLinkKind = "BillingModelItemLink" + +// BillingModelItemNilKind is the name of the type used to nil references +// to objects of type 'billing_model_item'. +const BillingModelItemNilKind = "BillingModelItemNil" + +// BillingModelItem represents the values of the 'billing_model_item' type. +// +// BillingModelItem represents a billing model +type BillingModelItem struct { + bitmap_ uint32 + id string + href string + billingModelType string + description string + displayName string + marketplace string +} + +// Kind returns the name of the type of the object. +func (o *BillingModelItem) Kind() string { + if o == nil { + return BillingModelItemNilKind + } + if o.bitmap_&1 != 0 { + return BillingModelItemLinkKind + } + return BillingModelItemKind +} + +// Link returns true if this is a link. +func (o *BillingModelItem) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *BillingModelItem) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *BillingModelItem) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *BillingModelItem) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *BillingModelItem) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *BillingModelItem) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// BillingModelType returns the value of the 'billing_model_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// BillingModelType is the type of the BillingModel. e.g. standard, marketplace. +func (o *BillingModelItem) BillingModelType() string { + if o != nil && o.bitmap_&8 != 0 { + return o.billingModelType + } + return "" +} + +// GetBillingModelType returns the value of the 'billing_model_type' attribute and +// a flag indicating if the attribute has a value. +// +// BillingModelType is the type of the BillingModel. e.g. standard, marketplace. +func (o *BillingModelItem) GetBillingModelType() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.billingModelType + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Single line description of the billing model. +func (o *BillingModelItem) Description() string { + if o != nil && o.bitmap_&16 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Single line description of the billing model. +func (o *BillingModelItem) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.description + } + return +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// User friendly display name of the billing model. +func (o *BillingModelItem) DisplayName() string { + if o != nil && o.bitmap_&32 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +// +// User friendly display name of the billing model. +func (o *BillingModelItem) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.displayName + } + return +} + +// Marketplace returns the value of the 'marketplace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the marketplace of the billing model. e.g. gcp, aws, etc. +func (o *BillingModelItem) Marketplace() string { + if o != nil && o.bitmap_&64 != 0 { + return o.marketplace + } + return "" +} + +// GetMarketplace returns the value of the 'marketplace' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the marketplace of the billing model. e.g. gcp, aws, etc. +func (o *BillingModelItem) GetMarketplace() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.marketplace + } + return +} + +// BillingModelItemListKind is the name of the type used to represent list of objects of +// type 'billing_model_item'. +const BillingModelItemListKind = "BillingModelItemList" + +// BillingModelItemListLinkKind is the name of the type used to represent links to list +// of objects of type 'billing_model_item'. +const BillingModelItemListLinkKind = "BillingModelItemListLink" + +// BillingModelItemNilKind is the name of the type used to nil lists of objects of +// type 'billing_model_item'. +const BillingModelItemListNilKind = "BillingModelItemListNil" + +// BillingModelItemList is a list of values of the 'billing_model_item' type. +type BillingModelItemList struct { + href string + link bool + items []*BillingModelItem +} + +// Kind returns the name of the type of the object. +func (l *BillingModelItemList) Kind() string { + if l == nil { + return BillingModelItemListNilKind + } + if l.link { + return BillingModelItemListLinkKind + } + return BillingModelItemListKind +} + +// Link returns true iif this is a link. +func (l *BillingModelItemList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *BillingModelItemList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *BillingModelItemList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *BillingModelItemList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *BillingModelItemList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *BillingModelItemList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *BillingModelItemList) SetItems(items []*BillingModelItem) { + l.items = items +} + +// Items returns the items of the list. +func (l *BillingModelItemList) Items() []*BillingModelItem { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *BillingModelItemList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *BillingModelItemList) Get(i int) *BillingModelItem { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *BillingModelItemList) Slice() []*BillingModelItem { + var slice []*BillingModelItem + if l == nil { + slice = make([]*BillingModelItem, 0) + } else { + slice = make([]*BillingModelItem, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *BillingModelItemList) Each(f func(item *BillingModelItem) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *BillingModelItemList) Range(f func(index int, item *BillingModelItem) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/billing_model_item_type_json.go b/clientapi/accountsmgmt/v1/billing_model_item_type_json.go new file mode 100644 index 00000000..7fe17444 --- /dev/null +++ b/clientapi/accountsmgmt/v1/billing_model_item_type_json.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBillingModelItem writes a value of the 'billing_model_item' type to the given writer. +func MarshalBillingModelItem(object *BillingModelItem, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBillingModelItem(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBillingModelItem writes a value of the 'billing_model_item' type to the given stream. +func WriteBillingModelItem(object *BillingModelItem, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(BillingModelItemLinkKind) + } else { + stream.WriteString(BillingModelItemKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_model_type") + stream.WriteString(object.billingModelType) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("marketplace") + stream.WriteString(object.marketplace) + } + stream.WriteObjectEnd() +} + +// UnmarshalBillingModelItem reads a value of the 'billing_model_item' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalBillingModelItem(source interface{}) (object *BillingModelItem, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadBillingModelItem(iterator) + err = iterator.Error + return +} + +// ReadBillingModelItem reads a value of the 'billing_model_item' type from the given iterator. +func ReadBillingModelItem(iterator *jsoniter.Iterator) *BillingModelItem { + object := &BillingModelItem{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == BillingModelItemLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "billing_model_type": + value := iterator.ReadString() + object.billingModelType = value + object.bitmap_ |= 8 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 16 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 32 + case "marketplace": + value := iterator.ReadString() + object.marketplace = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/billing_model_list_type_json.go b/clientapi/accountsmgmt/v1/billing_model_list_type_json.go new file mode 100644 index 00000000..a8837110 --- /dev/null +++ b/clientapi/accountsmgmt/v1/billing_model_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBillingModelList writes a list of values of the 'billing_model' type to +// the given writer. +func MarshalBillingModelList(list []BillingModel, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBillingModelList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBillingModelList writes a list of value of the 'billing_model' type to +// the given stream. +func WriteBillingModelList(list []BillingModel, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalBillingModelList reads a list of values of the 'billing_model' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBillingModelList(source interface{}) (items []BillingModel, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBillingModelList(iterator) + err = iterator.Error + return +} + +// ReadBillingModelList reads list of values of the ”billing_model' type from +// the given iterator. +func ReadBillingModelList(iterator *jsoniter.Iterator) []BillingModel { + list := []BillingModel{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := BillingModel(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/billing_model_type.go b/clientapi/accountsmgmt/v1/billing_model_type.go new file mode 100644 index 00000000..95fdfb7e --- /dev/null +++ b/clientapi/accountsmgmt/v1/billing_model_type.go @@ -0,0 +1,38 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// BillingModel represents the values of the 'billing_model' enumerated type. +type BillingModel string + +const ( + // BillingModelMarketplace Legacy Marketplace billing model. Currently only used for tests. Use cloud-provider specific billing models instead. + BillingModelMarketplace BillingModel = "marketplace" + // AWS Marketplace billing model. + BillingModelMarketplaceAWS BillingModel = "marketplace-aws" + // GCP Marketplace billing model. + BillingModelMarketplaceGCP BillingModel = "marketplace-gcp" + // RH Marketplace billing model. + BillingModelMarketplaceRHM BillingModel = "marketplace-rhm" + // Azure Marketplace billing model. + BillingModelMarketplaceAzure BillingModel = "marketplace-azure" + // Standard. This is the default billing model + BillingModelStandard BillingModel = "standard" +) diff --git a/clientapi/accountsmgmt/v1/boolean_list_type_json.go b/clientapi/accountsmgmt/v1/boolean_list_type_json.go new file mode 100644 index 00000000..500db027 --- /dev/null +++ b/clientapi/accountsmgmt/v1/boolean_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBooleanList writes a list of values of the 'boolean' type to +// the given writer. +func MarshalBooleanList(list []bool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBooleanList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBooleanList writes a list of value of the 'boolean' type to +// the given stream. +func WriteBooleanList(list []bool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteBool(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalBooleanList reads a list of values of the 'boolean' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBooleanList(source interface{}) (items []bool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBooleanList(iterator) + err = iterator.Error + return +} + +// ReadBooleanList reads list of values of the ”boolean' type from +// the given iterator. +func ReadBooleanList(iterator *jsoniter.Iterator) []bool { + list := []bool{} + for iterator.ReadArray() { + item := iterator.ReadBool() + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/capability_builder.go b/clientapi/accountsmgmt/v1/capability_builder.go new file mode 100644 index 00000000..e6913eae --- /dev/null +++ b/clientapi/accountsmgmt/v1/capability_builder.go @@ -0,0 +1,83 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// CapabilityBuilder contains the data and logic needed to build 'capability' objects. +// +// Capability model that represents internal labels with a key that matches a set list defined in AMS (defined in pkg/api/capability_types.go). +type CapabilityBuilder struct { + bitmap_ uint32 + name string + value string + inherited bool +} + +// NewCapability creates a new builder of 'capability' objects. +func NewCapability() *CapabilityBuilder { + return &CapabilityBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CapabilityBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Inherited sets the value of the 'inherited' attribute to the given value. +func (b *CapabilityBuilder) Inherited(value bool) *CapabilityBuilder { + b.inherited = value + b.bitmap_ |= 1 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *CapabilityBuilder) Name(value string) *CapabilityBuilder { + b.name = value + b.bitmap_ |= 2 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *CapabilityBuilder) Value(value string) *CapabilityBuilder { + b.value = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CapabilityBuilder) Copy(object *Capability) *CapabilityBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.inherited = object.inherited + b.name = object.name + b.value = object.value + return b +} + +// Build creates a 'capability' object using the configuration stored in the builder. +func (b *CapabilityBuilder) Build() (object *Capability, err error) { + object = new(Capability) + object.bitmap_ = b.bitmap_ + object.inherited = b.inherited + object.name = b.name + object.value = b.value + return +} diff --git a/clientapi/accountsmgmt/v1/capability_list_builder.go b/clientapi/accountsmgmt/v1/capability_list_builder.go new file mode 100644 index 00000000..8f9e554a --- /dev/null +++ b/clientapi/accountsmgmt/v1/capability_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// CapabilityListBuilder contains the data and logic needed to build +// 'capability' objects. +type CapabilityListBuilder struct { + items []*CapabilityBuilder +} + +// NewCapabilityList creates a new builder of 'capability' objects. +func NewCapabilityList() *CapabilityListBuilder { + return new(CapabilityListBuilder) +} + +// Items sets the items of the list. +func (b *CapabilityListBuilder) Items(values ...*CapabilityBuilder) *CapabilityListBuilder { + b.items = make([]*CapabilityBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CapabilityListBuilder) 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 *CapabilityListBuilder) Copy(list *CapabilityList) *CapabilityListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CapabilityBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCapability().Copy(v) + } + } + return b +} + +// Build creates a list of 'capability' objects using the +// configuration stored in the builder. +func (b *CapabilityListBuilder) Build() (list *CapabilityList, err error) { + items := make([]*Capability, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CapabilityList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/capability_list_type_json.go b/clientapi/accountsmgmt/v1/capability_list_type_json.go new file mode 100644 index 00000000..0a64a7de --- /dev/null +++ b/clientapi/accountsmgmt/v1/capability_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCapabilityList writes a list of values of the 'capability' type to +// the given writer. +func MarshalCapabilityList(list []*Capability, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCapabilityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCapabilityList writes a list of value of the 'capability' type to +// the given stream. +func WriteCapabilityList(list []*Capability, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCapability(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCapabilityList reads a list of values of the 'capability' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCapabilityList(source interface{}) (items []*Capability, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCapabilityList(iterator) + err = iterator.Error + return +} + +// ReadCapabilityList reads list of values of the ”capability' type from +// the given iterator. +func ReadCapabilityList(iterator *jsoniter.Iterator) []*Capability { + list := []*Capability{} + for iterator.ReadArray() { + item := ReadCapability(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/capability_type.go b/clientapi/accountsmgmt/v1/capability_type.go new file mode 100644 index 00000000..debc0df6 --- /dev/null +++ b/clientapi/accountsmgmt/v1/capability_type.go @@ -0,0 +1,213 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// Capability represents the values of the 'capability' type. +// +// Capability model that represents internal labels with a key that matches a set list defined in AMS (defined in pkg/api/capability_types.go). +type Capability struct { + bitmap_ uint32 + name string + value string + inherited bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Capability) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Inherited returns the value of the 'inherited' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Dynamic attribute of the capability that tells us that this capability was inherited from the subscription's organization. +func (o *Capability) Inherited() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.inherited + } + return false +} + +// GetInherited returns the value of the 'inherited' attribute and +// a flag indicating if the attribute has a value. +// +// Dynamic attribute of the capability that tells us that this capability was inherited from the subscription's organization. +func (o *Capability) GetInherited() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.inherited + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the capability label. +func (o *Capability) Name() string { + if o != nil && o.bitmap_&2 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the capability label. +func (o *Capability) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.name + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Value that can be assigned to the capability (eg. "true", "false" etc). +func (o *Capability) Value() string { + if o != nil && o.bitmap_&4 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Value that can be assigned to the capability (eg. "true", "false" etc). +func (o *Capability) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.value + } + return +} + +// CapabilityListKind is the name of the type used to represent list of objects of +// type 'capability'. +const CapabilityListKind = "CapabilityList" + +// CapabilityListLinkKind is the name of the type used to represent links to list +// of objects of type 'capability'. +const CapabilityListLinkKind = "CapabilityListLink" + +// CapabilityNilKind is the name of the type used to nil lists of objects of +// type 'capability'. +const CapabilityListNilKind = "CapabilityListNil" + +// CapabilityList is a list of values of the 'capability' type. +type CapabilityList struct { + href string + link bool + items []*Capability +} + +// Len returns the length of the list. +func (l *CapabilityList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CapabilityList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CapabilityList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CapabilityList) SetItems(items []*Capability) { + l.items = items +} + +// Items returns the items of the list. +func (l *CapabilityList) Items() []*Capability { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CapabilityList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CapabilityList) Get(i int) *Capability { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CapabilityList) Slice() []*Capability { + var slice []*Capability + if l == nil { + slice = make([]*Capability, 0) + } else { + slice = make([]*Capability, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CapabilityList) Each(f func(item *Capability) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CapabilityList) Range(f func(index int, item *Capability) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/capability_type_json.go b/clientapi/accountsmgmt/v1/capability_type_json.go new file mode 100644 index 00000000..0c8c9327 --- /dev/null +++ b/clientapi/accountsmgmt/v1/capability_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCapability writes a value of the 'capability' type to the given writer. +func MarshalCapability(object *Capability, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCapability(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCapability writes a value of the 'capability' type to the given stream. +func WriteCapability(object *Capability, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("inherited") + stream.WriteBool(object.inherited) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalCapability reads a value of the 'capability' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCapability(source interface{}) (object *Capability, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCapability(iterator) + err = iterator.Error + return +} + +// ReadCapability reads a value of the 'capability' type from the given iterator. +func ReadCapability(iterator *jsoniter.Iterator) *Capability { + object := &Capability{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "inherited": + value := iterator.ReadBool() + object.inherited = value + object.bitmap_ |= 1 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 2 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/cloud_account_builder.go b/clientapi/accountsmgmt/v1/cloud_account_builder.go new file mode 100644 index 00000000..b1ce0f6f --- /dev/null +++ b/clientapi/accountsmgmt/v1/cloud_account_builder.go @@ -0,0 +1,97 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// CloudAccountBuilder contains the data and logic needed to build 'cloud_account' objects. +type CloudAccountBuilder struct { + bitmap_ uint32 + cloudAccountID string + cloudProviderID string + contracts []*ContractBuilder +} + +// NewCloudAccount creates a new builder of 'cloud_account' objects. +func NewCloudAccount() *CloudAccountBuilder { + return &CloudAccountBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CloudAccountBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// CloudAccountID sets the value of the 'cloud_account_ID' attribute to the given value. +func (b *CloudAccountBuilder) CloudAccountID(value string) *CloudAccountBuilder { + b.cloudAccountID = value + b.bitmap_ |= 1 + return b +} + +// CloudProviderID sets the value of the 'cloud_provider_ID' attribute to the given value. +func (b *CloudAccountBuilder) CloudProviderID(value string) *CloudAccountBuilder { + b.cloudProviderID = value + b.bitmap_ |= 2 + return b +} + +// Contracts sets the value of the 'contracts' attribute to the given values. +func (b *CloudAccountBuilder) Contracts(values ...*ContractBuilder) *CloudAccountBuilder { + b.contracts = make([]*ContractBuilder, len(values)) + copy(b.contracts, values) + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CloudAccountBuilder) Copy(object *CloudAccount) *CloudAccountBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.cloudAccountID = object.cloudAccountID + b.cloudProviderID = object.cloudProviderID + if object.contracts != nil { + b.contracts = make([]*ContractBuilder, len(object.contracts)) + for i, v := range object.contracts { + b.contracts[i] = NewContract().Copy(v) + } + } else { + b.contracts = nil + } + return b +} + +// Build creates a 'cloud_account' object using the configuration stored in the builder. +func (b *CloudAccountBuilder) Build() (object *CloudAccount, err error) { + object = new(CloudAccount) + object.bitmap_ = b.bitmap_ + object.cloudAccountID = b.cloudAccountID + object.cloudProviderID = b.cloudProviderID + if b.contracts != nil { + object.contracts = make([]*Contract, len(b.contracts)) + for i, v := range b.contracts { + object.contracts[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/accountsmgmt/v1/cloud_account_list_builder.go b/clientapi/accountsmgmt/v1/cloud_account_list_builder.go new file mode 100644 index 00000000..4a9b100a --- /dev/null +++ b/clientapi/accountsmgmt/v1/cloud_account_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// CloudAccountListBuilder contains the data and logic needed to build +// 'cloud_account' objects. +type CloudAccountListBuilder struct { + items []*CloudAccountBuilder +} + +// NewCloudAccountList creates a new builder of 'cloud_account' objects. +func NewCloudAccountList() *CloudAccountListBuilder { + return new(CloudAccountListBuilder) +} + +// Items sets the items of the list. +func (b *CloudAccountListBuilder) Items(values ...*CloudAccountBuilder) *CloudAccountListBuilder { + b.items = make([]*CloudAccountBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CloudAccountListBuilder) 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 *CloudAccountListBuilder) Copy(list *CloudAccountList) *CloudAccountListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CloudAccountBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCloudAccount().Copy(v) + } + } + return b +} + +// Build creates a list of 'cloud_account' objects using the +// configuration stored in the builder. +func (b *CloudAccountListBuilder) Build() (list *CloudAccountList, err error) { + items := make([]*CloudAccount, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CloudAccountList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/cloud_account_list_type_json.go b/clientapi/accountsmgmt/v1/cloud_account_list_type_json.go new file mode 100644 index 00000000..2ffd49d1 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cloud_account_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudAccountList writes a list of values of the 'cloud_account' type to +// the given writer. +func MarshalCloudAccountList(list []*CloudAccount, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudAccountList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudAccountList writes a list of value of the 'cloud_account' type to +// the given stream. +func WriteCloudAccountList(list []*CloudAccount, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCloudAccount(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCloudAccountList reads a list of values of the 'cloud_account' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCloudAccountList(source interface{}) (items []*CloudAccount, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCloudAccountList(iterator) + err = iterator.Error + return +} + +// ReadCloudAccountList reads list of values of the ”cloud_account' type from +// the given iterator. +func ReadCloudAccountList(iterator *jsoniter.Iterator) []*CloudAccount { + list := []*CloudAccount{} + for iterator.ReadArray() { + item := ReadCloudAccount(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/cloud_account_type.go b/clientapi/accountsmgmt/v1/cloud_account_type.go new file mode 100644 index 00000000..147506d9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cloud_account_type.go @@ -0,0 +1,199 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// CloudAccount represents the values of the 'cloud_account' type. +type CloudAccount struct { + bitmap_ uint32 + cloudAccountID string + cloudProviderID string + contracts []*Contract +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CloudAccount) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// CloudAccountID returns the value of the 'cloud_account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudAccount) CloudAccountID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.cloudAccountID + } + return "" +} + +// GetCloudAccountID returns the value of the 'cloud_account_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudAccount) GetCloudAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.cloudAccountID + } + return +} + +// CloudProviderID returns the value of the 'cloud_provider_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudAccount) CloudProviderID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.cloudProviderID + } + return "" +} + +// GetCloudProviderID returns the value of the 'cloud_provider_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudAccount) GetCloudProviderID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.cloudProviderID + } + return +} + +// Contracts returns the value of the 'contracts' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudAccount) Contracts() []*Contract { + if o != nil && o.bitmap_&4 != 0 { + return o.contracts + } + return nil +} + +// GetContracts returns the value of the 'contracts' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudAccount) GetContracts() (value []*Contract, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.contracts + } + return +} + +// CloudAccountListKind is the name of the type used to represent list of objects of +// type 'cloud_account'. +const CloudAccountListKind = "CloudAccountList" + +// CloudAccountListLinkKind is the name of the type used to represent links to list +// of objects of type 'cloud_account'. +const CloudAccountListLinkKind = "CloudAccountListLink" + +// CloudAccountNilKind is the name of the type used to nil lists of objects of +// type 'cloud_account'. +const CloudAccountListNilKind = "CloudAccountListNil" + +// CloudAccountList is a list of values of the 'cloud_account' type. +type CloudAccountList struct { + href string + link bool + items []*CloudAccount +} + +// Len returns the length of the list. +func (l *CloudAccountList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CloudAccountList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CloudAccountList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CloudAccountList) SetItems(items []*CloudAccount) { + l.items = items +} + +// Items returns the items of the list. +func (l *CloudAccountList) Items() []*CloudAccount { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CloudAccountList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CloudAccountList) Get(i int) *CloudAccount { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CloudAccountList) Slice() []*CloudAccount { + var slice []*CloudAccount + if l == nil { + slice = make([]*CloudAccount, 0) + } else { + slice = make([]*CloudAccount, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CloudAccountList) Each(f func(item *CloudAccount) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CloudAccountList) Range(f func(index int, item *CloudAccount) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/cloud_account_type_json.go b/clientapi/accountsmgmt/v1/cloud_account_type_json.go new file mode 100644 index 00000000..c84ac3d0 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cloud_account_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudAccount writes a value of the 'cloud_account' type to the given writer. +func MarshalCloudAccount(object *CloudAccount, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudAccount(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudAccount writes a value of the 'cloud_account' type to the given stream. +func WriteCloudAccount(object *CloudAccount, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_account_id") + stream.WriteString(object.cloudAccountID) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider_id") + stream.WriteString(object.cloudProviderID) + count++ + } + present_ = object.bitmap_&4 != 0 && object.contracts != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("contracts") + WriteContractList(object.contracts, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalCloudAccount reads a value of the 'cloud_account' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCloudAccount(source interface{}) (object *CloudAccount, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCloudAccount(iterator) + err = iterator.Error + return +} + +// ReadCloudAccount reads a value of the 'cloud_account' type from the given iterator. +func ReadCloudAccount(iterator *jsoniter.Iterator) *CloudAccount { + object := &CloudAccount{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "cloud_account_id": + value := iterator.ReadString() + object.cloudAccountID = value + object.bitmap_ |= 1 + case "cloud_provider_id": + value := iterator.ReadString() + object.cloudProviderID = value + object.bitmap_ |= 2 + case "contracts": + value := ReadContractList(iterator) + object.contracts = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/cloud_resource_builder.go b/clientapi/accountsmgmt/v1/cloud_resource_builder.go new file mode 100644 index 00000000..d64d8731 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cloud_resource_builder.go @@ -0,0 +1,211 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// CloudResourceBuilder contains the data and logic needed to build 'cloud_resource' objects. +type CloudResourceBuilder struct { + bitmap_ uint32 + id string + href string + category string + categoryPretty string + cloudProvider string + cpuCores int + createdAt time.Time + genericName string + memory int + memoryPretty string + namePretty string + resourceType string + sizePretty string + updatedAt time.Time + active bool +} + +// NewCloudResource creates a new builder of 'cloud_resource' objects. +func NewCloudResource() *CloudResourceBuilder { + return &CloudResourceBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *CloudResourceBuilder) Link(value bool) *CloudResourceBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *CloudResourceBuilder) ID(value string) *CloudResourceBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *CloudResourceBuilder) HREF(value string) *CloudResourceBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CloudResourceBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Active sets the value of the 'active' attribute to the given value. +func (b *CloudResourceBuilder) Active(value bool) *CloudResourceBuilder { + b.active = value + b.bitmap_ |= 8 + return b +} + +// Category sets the value of the 'category' attribute to the given value. +func (b *CloudResourceBuilder) Category(value string) *CloudResourceBuilder { + b.category = value + b.bitmap_ |= 16 + return b +} + +// CategoryPretty sets the value of the 'category_pretty' attribute to the given value. +func (b *CloudResourceBuilder) CategoryPretty(value string) *CloudResourceBuilder { + b.categoryPretty = value + b.bitmap_ |= 32 + return b +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +func (b *CloudResourceBuilder) CloudProvider(value string) *CloudResourceBuilder { + b.cloudProvider = value + b.bitmap_ |= 64 + return b +} + +// CpuCores sets the value of the 'cpu_cores' attribute to the given value. +func (b *CloudResourceBuilder) CpuCores(value int) *CloudResourceBuilder { + b.cpuCores = value + b.bitmap_ |= 128 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *CloudResourceBuilder) CreatedAt(value time.Time) *CloudResourceBuilder { + b.createdAt = value + b.bitmap_ |= 256 + return b +} + +// GenericName sets the value of the 'generic_name' attribute to the given value. +func (b *CloudResourceBuilder) GenericName(value string) *CloudResourceBuilder { + b.genericName = value + b.bitmap_ |= 512 + return b +} + +// Memory sets the value of the 'memory' attribute to the given value. +func (b *CloudResourceBuilder) Memory(value int) *CloudResourceBuilder { + b.memory = value + b.bitmap_ |= 1024 + return b +} + +// MemoryPretty sets the value of the 'memory_pretty' attribute to the given value. +func (b *CloudResourceBuilder) MemoryPretty(value string) *CloudResourceBuilder { + b.memoryPretty = value + b.bitmap_ |= 2048 + return b +} + +// NamePretty sets the value of the 'name_pretty' attribute to the given value. +func (b *CloudResourceBuilder) NamePretty(value string) *CloudResourceBuilder { + b.namePretty = value + b.bitmap_ |= 4096 + return b +} + +// ResourceType sets the value of the 'resource_type' attribute to the given value. +func (b *CloudResourceBuilder) ResourceType(value string) *CloudResourceBuilder { + b.resourceType = value + b.bitmap_ |= 8192 + return b +} + +// SizePretty sets the value of the 'size_pretty' attribute to the given value. +func (b *CloudResourceBuilder) SizePretty(value string) *CloudResourceBuilder { + b.sizePretty = value + b.bitmap_ |= 16384 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *CloudResourceBuilder) UpdatedAt(value time.Time) *CloudResourceBuilder { + b.updatedAt = value + b.bitmap_ |= 32768 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CloudResourceBuilder) Copy(object *CloudResource) *CloudResourceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.active = object.active + b.category = object.category + b.categoryPretty = object.categoryPretty + b.cloudProvider = object.cloudProvider + b.cpuCores = object.cpuCores + b.createdAt = object.createdAt + b.genericName = object.genericName + b.memory = object.memory + b.memoryPretty = object.memoryPretty + b.namePretty = object.namePretty + b.resourceType = object.resourceType + b.sizePretty = object.sizePretty + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'cloud_resource' object using the configuration stored in the builder. +func (b *CloudResourceBuilder) Build() (object *CloudResource, err error) { + object = new(CloudResource) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.active = b.active + object.category = b.category + object.categoryPretty = b.categoryPretty + object.cloudProvider = b.cloudProvider + object.cpuCores = b.cpuCores + object.createdAt = b.createdAt + object.genericName = b.genericName + object.memory = b.memory + object.memoryPretty = b.memoryPretty + object.namePretty = b.namePretty + object.resourceType = b.resourceType + object.sizePretty = b.sizePretty + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/accountsmgmt/v1/cloud_resource_list_builder.go b/clientapi/accountsmgmt/v1/cloud_resource_list_builder.go new file mode 100644 index 00000000..65589a5a --- /dev/null +++ b/clientapi/accountsmgmt/v1/cloud_resource_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// CloudResourceListBuilder contains the data and logic needed to build +// 'cloud_resource' objects. +type CloudResourceListBuilder struct { + items []*CloudResourceBuilder +} + +// NewCloudResourceList creates a new builder of 'cloud_resource' objects. +func NewCloudResourceList() *CloudResourceListBuilder { + return new(CloudResourceListBuilder) +} + +// Items sets the items of the list. +func (b *CloudResourceListBuilder) Items(values ...*CloudResourceBuilder) *CloudResourceListBuilder { + b.items = make([]*CloudResourceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CloudResourceListBuilder) 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 *CloudResourceListBuilder) Copy(list *CloudResourceList) *CloudResourceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CloudResourceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCloudResource().Copy(v) + } + } + return b +} + +// Build creates a list of 'cloud_resource' objects using the +// configuration stored in the builder. +func (b *CloudResourceListBuilder) Build() (list *CloudResourceList, err error) { + items := make([]*CloudResource, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CloudResourceList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/cloud_resource_list_type_json.go b/clientapi/accountsmgmt/v1/cloud_resource_list_type_json.go new file mode 100644 index 00000000..feb9db6f --- /dev/null +++ b/clientapi/accountsmgmt/v1/cloud_resource_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudResourceList writes a list of values of the 'cloud_resource' type to +// the given writer. +func MarshalCloudResourceList(list []*CloudResource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudResourceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudResourceList writes a list of value of the 'cloud_resource' type to +// the given stream. +func WriteCloudResourceList(list []*CloudResource, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCloudResource(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCloudResourceList reads a list of values of the 'cloud_resource' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCloudResourceList(source interface{}) (items []*CloudResource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCloudResourceList(iterator) + err = iterator.Error + return +} + +// ReadCloudResourceList reads list of values of the ”cloud_resource' type from +// the given iterator. +func ReadCloudResourceList(iterator *jsoniter.Iterator) []*CloudResource { + list := []*CloudResource{} + for iterator.ReadArray() { + item := ReadCloudResource(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/cloud_resource_type.go b/clientapi/accountsmgmt/v1/cloud_resource_type.go new file mode 100644 index 00000000..73f426df --- /dev/null +++ b/clientapi/accountsmgmt/v1/cloud_resource_type.go @@ -0,0 +1,503 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// CloudResourceKind is the name of the type used to represent objects +// of type 'cloud_resource'. +const CloudResourceKind = "CloudResource" + +// CloudResourceLinkKind is the name of the type used to represent links +// to objects of type 'cloud_resource'. +const CloudResourceLinkKind = "CloudResourceLink" + +// CloudResourceNilKind is the name of the type used to nil references +// to objects of type 'cloud_resource'. +const CloudResourceNilKind = "CloudResourceNil" + +// CloudResource represents the values of the 'cloud_resource' type. +type CloudResource struct { + bitmap_ uint32 + id string + href string + category string + categoryPretty string + cloudProvider string + cpuCores int + createdAt time.Time + genericName string + memory int + memoryPretty string + namePretty string + resourceType string + sizePretty string + updatedAt time.Time + active bool +} + +// Kind returns the name of the type of the object. +func (o *CloudResource) Kind() string { + if o == nil { + return CloudResourceNilKind + } + if o.bitmap_&1 != 0 { + return CloudResourceLinkKind + } + return CloudResourceKind +} + +// Link returns true if this is a link. +func (o *CloudResource) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *CloudResource) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *CloudResource) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *CloudResource) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *CloudResource) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CloudResource) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Active returns the value of the 'active' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudResource) Active() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.active + } + return false +} + +// GetActive returns the value of the 'active' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudResource) GetActive() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.active + } + return +} + +// Category returns the value of the 'category' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudResource) Category() string { + if o != nil && o.bitmap_&16 != 0 { + return o.category + } + return "" +} + +// GetCategory returns the value of the 'category' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudResource) GetCategory() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.category + } + return +} + +// CategoryPretty returns the value of the 'category_pretty' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudResource) CategoryPretty() string { + if o != nil && o.bitmap_&32 != 0 { + return o.categoryPretty + } + return "" +} + +// GetCategoryPretty returns the value of the 'category_pretty' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudResource) GetCategoryPretty() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.categoryPretty + } + return +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudResource) CloudProvider() string { + if o != nil && o.bitmap_&64 != 0 { + return o.cloudProvider + } + return "" +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudResource) GetCloudProvider() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// CpuCores returns the value of the 'cpu_cores' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudResource) CpuCores() int { + if o != nil && o.bitmap_&128 != 0 { + return o.cpuCores + } + return 0 +} + +// GetCpuCores returns the value of the 'cpu_cores' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudResource) GetCpuCores() (value int, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.cpuCores + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudResource) CreatedAt() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudResource) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.createdAt + } + return +} + +// GenericName returns the value of the 'generic_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudResource) GenericName() string { + if o != nil && o.bitmap_&512 != 0 { + return o.genericName + } + return "" +} + +// GetGenericName returns the value of the 'generic_name' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudResource) GetGenericName() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.genericName + } + return +} + +// Memory returns the value of the 'memory' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudResource) Memory() int { + if o != nil && o.bitmap_&1024 != 0 { + return o.memory + } + return 0 +} + +// GetMemory returns the value of the 'memory' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudResource) GetMemory() (value int, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.memory + } + return +} + +// MemoryPretty returns the value of the 'memory_pretty' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudResource) MemoryPretty() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.memoryPretty + } + return "" +} + +// GetMemoryPretty returns the value of the 'memory_pretty' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudResource) GetMemoryPretty() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.memoryPretty + } + return +} + +// NamePretty returns the value of the 'name_pretty' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudResource) NamePretty() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.namePretty + } + return "" +} + +// GetNamePretty returns the value of the 'name_pretty' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudResource) GetNamePretty() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.namePretty + } + return +} + +// ResourceType returns the value of the 'resource_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudResource) ResourceType() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.resourceType + } + return "" +} + +// GetResourceType returns the value of the 'resource_type' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudResource) GetResourceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.resourceType + } + return +} + +// SizePretty returns the value of the 'size_pretty' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudResource) SizePretty() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.sizePretty + } + return "" +} + +// GetSizePretty returns the value of the 'size_pretty' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudResource) GetSizePretty() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.sizePretty + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CloudResource) UpdatedAt() time.Time { + if o != nil && o.bitmap_&32768 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *CloudResource) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.updatedAt + } + return +} + +// CloudResourceListKind is the name of the type used to represent list of objects of +// type 'cloud_resource'. +const CloudResourceListKind = "CloudResourceList" + +// CloudResourceListLinkKind is the name of the type used to represent links to list +// of objects of type 'cloud_resource'. +const CloudResourceListLinkKind = "CloudResourceListLink" + +// CloudResourceNilKind is the name of the type used to nil lists of objects of +// type 'cloud_resource'. +const CloudResourceListNilKind = "CloudResourceListNil" + +// CloudResourceList is a list of values of the 'cloud_resource' type. +type CloudResourceList struct { + href string + link bool + items []*CloudResource +} + +// Kind returns the name of the type of the object. +func (l *CloudResourceList) Kind() string { + if l == nil { + return CloudResourceListNilKind + } + if l.link { + return CloudResourceListLinkKind + } + return CloudResourceListKind +} + +// Link returns true iif this is a link. +func (l *CloudResourceList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *CloudResourceList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *CloudResourceList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *CloudResourceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CloudResourceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CloudResourceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CloudResourceList) SetItems(items []*CloudResource) { + l.items = items +} + +// Items returns the items of the list. +func (l *CloudResourceList) Items() []*CloudResource { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CloudResourceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CloudResourceList) Get(i int) *CloudResource { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CloudResourceList) Slice() []*CloudResource { + var slice []*CloudResource + if l == nil { + slice = make([]*CloudResource, 0) + } else { + slice = make([]*CloudResource, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CloudResourceList) Each(f func(item *CloudResource) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CloudResourceList) Range(f func(index int, item *CloudResource) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/cloud_resource_type_json.go b/clientapi/accountsmgmt/v1/cloud_resource_type_json.go new file mode 100644 index 00000000..7d261c18 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cloud_resource_type_json.go @@ -0,0 +1,285 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudResource writes a value of the 'cloud_resource' type to the given writer. +func MarshalCloudResource(object *CloudResource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudResource(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudResource writes a value of the 'cloud_resource' type to the given stream. +func WriteCloudResource(object *CloudResource, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(CloudResourceLinkKind) + } else { + stream.WriteString(CloudResourceKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("active") + stream.WriteBool(object.active) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("category") + stream.WriteString(object.category) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("category_pretty") + stream.WriteString(object.categoryPretty) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + stream.WriteString(object.cloudProvider) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cpu_cores") + stream.WriteInt(object.cpuCores) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("generic_name") + stream.WriteString(object.genericName) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("memory") + stream.WriteInt(object.memory) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("memory_pretty") + stream.WriteString(object.memoryPretty) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name_pretty") + stream.WriteString(object.namePretty) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_type") + stream.WriteString(object.resourceType) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("size_pretty") + stream.WriteString(object.sizePretty) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalCloudResource reads a value of the 'cloud_resource' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCloudResource(source interface{}) (object *CloudResource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCloudResource(iterator) + err = iterator.Error + return +} + +// ReadCloudResource reads a value of the 'cloud_resource' type from the given iterator. +func ReadCloudResource(iterator *jsoniter.Iterator) *CloudResource { + object := &CloudResource{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == CloudResourceLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "active": + value := iterator.ReadBool() + object.active = value + object.bitmap_ |= 8 + case "category": + value := iterator.ReadString() + object.category = value + object.bitmap_ |= 16 + case "category_pretty": + value := iterator.ReadString() + object.categoryPretty = value + object.bitmap_ |= 32 + case "cloud_provider": + value := iterator.ReadString() + object.cloudProvider = value + object.bitmap_ |= 64 + case "cpu_cores": + value := iterator.ReadInt() + object.cpuCores = value + object.bitmap_ |= 128 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 256 + case "generic_name": + value := iterator.ReadString() + object.genericName = value + object.bitmap_ |= 512 + case "memory": + value := iterator.ReadInt() + object.memory = value + object.bitmap_ |= 1024 + case "memory_pretty": + value := iterator.ReadString() + object.memoryPretty = value + object.bitmap_ |= 2048 + case "name_pretty": + value := iterator.ReadString() + object.namePretty = value + object.bitmap_ |= 4096 + case "resource_type": + value := iterator.ReadString() + object.resourceType = value + object.bitmap_ |= 8192 + case "size_pretty": + value := iterator.ReadString() + object.sizePretty = value + object.bitmap_ |= 16384 + 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_ |= 32768 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/cluster_authorization_request_builder.go b/clientapi/accountsmgmt/v1/cluster_authorization_request_builder.go new file mode 100644 index 00000000..f6970f6a --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_authorization_request_builder.go @@ -0,0 +1,227 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterAuthorizationRequestBuilder contains the data and logic needed to build 'cluster_authorization_request' objects. +type ClusterAuthorizationRequestBuilder struct { + bitmap_ uint32 + accountUsername string + availabilityZone string + cloudAccountID string + cloudProviderID string + clusterID string + displayName string + externalClusterID string + productID string + productCategory string + quotaVersion string + resources []*ReservedResourceBuilder + scope string + byoc bool + disconnected bool + managed bool + reserve bool +} + +// NewClusterAuthorizationRequest creates a new builder of 'cluster_authorization_request' objects. +func NewClusterAuthorizationRequest() *ClusterAuthorizationRequestBuilder { + return &ClusterAuthorizationRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterAuthorizationRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// BYOC sets the value of the 'BYOC' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) BYOC(value bool) *ClusterAuthorizationRequestBuilder { + b.byoc = value + b.bitmap_ |= 1 + return b +} + +// AccountUsername sets the value of the 'account_username' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) AccountUsername(value string) *ClusterAuthorizationRequestBuilder { + b.accountUsername = value + b.bitmap_ |= 2 + return b +} + +// AvailabilityZone sets the value of the 'availability_zone' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) AvailabilityZone(value string) *ClusterAuthorizationRequestBuilder { + b.availabilityZone = value + b.bitmap_ |= 4 + return b +} + +// CloudAccountID sets the value of the 'cloud_account_ID' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) CloudAccountID(value string) *ClusterAuthorizationRequestBuilder { + b.cloudAccountID = value + b.bitmap_ |= 8 + return b +} + +// CloudProviderID sets the value of the 'cloud_provider_ID' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) CloudProviderID(value string) *ClusterAuthorizationRequestBuilder { + b.cloudProviderID = value + b.bitmap_ |= 16 + return b +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) ClusterID(value string) *ClusterAuthorizationRequestBuilder { + b.clusterID = value + b.bitmap_ |= 32 + return b +} + +// Disconnected sets the value of the 'disconnected' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) Disconnected(value bool) *ClusterAuthorizationRequestBuilder { + b.disconnected = value + b.bitmap_ |= 64 + return b +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) DisplayName(value string) *ClusterAuthorizationRequestBuilder { + b.displayName = value + b.bitmap_ |= 128 + return b +} + +// ExternalClusterID sets the value of the 'external_cluster_ID' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) ExternalClusterID(value string) *ClusterAuthorizationRequestBuilder { + b.externalClusterID = value + b.bitmap_ |= 256 + return b +} + +// Managed sets the value of the 'managed' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) Managed(value bool) *ClusterAuthorizationRequestBuilder { + b.managed = value + b.bitmap_ |= 512 + return b +} + +// ProductID sets the value of the 'product_ID' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) ProductID(value string) *ClusterAuthorizationRequestBuilder { + b.productID = value + b.bitmap_ |= 1024 + return b +} + +// ProductCategory sets the value of the 'product_category' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) ProductCategory(value string) *ClusterAuthorizationRequestBuilder { + b.productCategory = value + b.bitmap_ |= 2048 + return b +} + +// QuotaVersion sets the value of the 'quota_version' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) QuotaVersion(value string) *ClusterAuthorizationRequestBuilder { + b.quotaVersion = value + b.bitmap_ |= 4096 + return b +} + +// Reserve sets the value of the 'reserve' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) Reserve(value bool) *ClusterAuthorizationRequestBuilder { + b.reserve = value + b.bitmap_ |= 8192 + return b +} + +// Resources sets the value of the 'resources' attribute to the given values. +func (b *ClusterAuthorizationRequestBuilder) Resources(values ...*ReservedResourceBuilder) *ClusterAuthorizationRequestBuilder { + b.resources = make([]*ReservedResourceBuilder, len(values)) + copy(b.resources, values) + b.bitmap_ |= 16384 + return b +} + +// Scope sets the value of the 'scope' attribute to the given value. +func (b *ClusterAuthorizationRequestBuilder) Scope(value string) *ClusterAuthorizationRequestBuilder { + b.scope = value + b.bitmap_ |= 32768 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterAuthorizationRequestBuilder) Copy(object *ClusterAuthorizationRequest) *ClusterAuthorizationRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.byoc = object.byoc + b.accountUsername = object.accountUsername + b.availabilityZone = object.availabilityZone + b.cloudAccountID = object.cloudAccountID + b.cloudProviderID = object.cloudProviderID + b.clusterID = object.clusterID + b.disconnected = object.disconnected + b.displayName = object.displayName + b.externalClusterID = object.externalClusterID + b.managed = object.managed + b.productID = object.productID + b.productCategory = object.productCategory + b.quotaVersion = object.quotaVersion + b.reserve = object.reserve + if object.resources != nil { + b.resources = make([]*ReservedResourceBuilder, len(object.resources)) + for i, v := range object.resources { + b.resources[i] = NewReservedResource().Copy(v) + } + } else { + b.resources = nil + } + b.scope = object.scope + return b +} + +// Build creates a 'cluster_authorization_request' object using the configuration stored in the builder. +func (b *ClusterAuthorizationRequestBuilder) Build() (object *ClusterAuthorizationRequest, err error) { + object = new(ClusterAuthorizationRequest) + object.bitmap_ = b.bitmap_ + object.byoc = b.byoc + object.accountUsername = b.accountUsername + object.availabilityZone = b.availabilityZone + object.cloudAccountID = b.cloudAccountID + object.cloudProviderID = b.cloudProviderID + object.clusterID = b.clusterID + object.disconnected = b.disconnected + object.displayName = b.displayName + object.externalClusterID = b.externalClusterID + object.managed = b.managed + object.productID = b.productID + object.productCategory = b.productCategory + object.quotaVersion = b.quotaVersion + object.reserve = b.reserve + if b.resources != nil { + object.resources = make([]*ReservedResource, len(b.resources)) + for i, v := range b.resources { + object.resources[i], err = v.Build() + if err != nil { + return + } + } + } + object.scope = b.scope + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_authorization_request_list_builder.go b/clientapi/accountsmgmt/v1/cluster_authorization_request_list_builder.go new file mode 100644 index 00000000..f6f465a2 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_authorization_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterAuthorizationRequestListBuilder contains the data and logic needed to build +// 'cluster_authorization_request' objects. +type ClusterAuthorizationRequestListBuilder struct { + items []*ClusterAuthorizationRequestBuilder +} + +// NewClusterAuthorizationRequestList creates a new builder of 'cluster_authorization_request' objects. +func NewClusterAuthorizationRequestList() *ClusterAuthorizationRequestListBuilder { + return new(ClusterAuthorizationRequestListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterAuthorizationRequestListBuilder) Items(values ...*ClusterAuthorizationRequestBuilder) *ClusterAuthorizationRequestListBuilder { + b.items = make([]*ClusterAuthorizationRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterAuthorizationRequestListBuilder) 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 *ClusterAuthorizationRequestListBuilder) Copy(list *ClusterAuthorizationRequestList) *ClusterAuthorizationRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterAuthorizationRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterAuthorizationRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_authorization_request' objects using the +// configuration stored in the builder. +func (b *ClusterAuthorizationRequestListBuilder) Build() (list *ClusterAuthorizationRequestList, err error) { + items := make([]*ClusterAuthorizationRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterAuthorizationRequestList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_authorization_request_list_type_json.go b/clientapi/accountsmgmt/v1/cluster_authorization_request_list_type_json.go new file mode 100644 index 00000000..5d2243c3 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_authorization_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterAuthorizationRequestList writes a list of values of the 'cluster_authorization_request' type to +// the given writer. +func MarshalClusterAuthorizationRequestList(list []*ClusterAuthorizationRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterAuthorizationRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterAuthorizationRequestList writes a list of value of the 'cluster_authorization_request' type to +// the given stream. +func WriteClusterAuthorizationRequestList(list []*ClusterAuthorizationRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterAuthorizationRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterAuthorizationRequestList reads a list of values of the 'cluster_authorization_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterAuthorizationRequestList(source interface{}) (items []*ClusterAuthorizationRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterAuthorizationRequestList(iterator) + err = iterator.Error + return +} + +// ReadClusterAuthorizationRequestList reads list of values of the ”cluster_authorization_request' type from +// the given iterator. +func ReadClusterAuthorizationRequestList(iterator *jsoniter.Iterator) []*ClusterAuthorizationRequest { + list := []*ClusterAuthorizationRequest{} + for iterator.ReadArray() { + item := ReadClusterAuthorizationRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/cluster_authorization_request_type.go b/clientapi/accountsmgmt/v1/cluster_authorization_request_type.go new file mode 100644 index 00000000..20ed85b1 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_authorization_request_type.go @@ -0,0 +1,459 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterAuthorizationRequest represents the values of the 'cluster_authorization_request' type. +type ClusterAuthorizationRequest struct { + bitmap_ uint32 + accountUsername string + availabilityZone string + cloudAccountID string + cloudProviderID string + clusterID string + displayName string + externalClusterID string + productID string + productCategory string + quotaVersion string + resources []*ReservedResource + scope string + byoc bool + disconnected bool + managed bool + reserve bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterAuthorizationRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// BYOC returns the value of the 'BYOC' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) BYOC() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.byoc + } + return false +} + +// GetBYOC returns the value of the 'BYOC' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetBYOC() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.byoc + } + return +} + +// AccountUsername returns the value of the 'account_username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) AccountUsername() string { + if o != nil && o.bitmap_&2 != 0 { + return o.accountUsername + } + return "" +} + +// GetAccountUsername returns the value of the 'account_username' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetAccountUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.accountUsername + } + return +} + +// AvailabilityZone returns the value of the 'availability_zone' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) AvailabilityZone() string { + if o != nil && o.bitmap_&4 != 0 { + return o.availabilityZone + } + return "" +} + +// GetAvailabilityZone returns the value of the 'availability_zone' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetAvailabilityZone() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.availabilityZone + } + return +} + +// CloudAccountID returns the value of the 'cloud_account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) CloudAccountID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.cloudAccountID + } + return "" +} + +// GetCloudAccountID returns the value of the 'cloud_account_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetCloudAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.cloudAccountID + } + return +} + +// CloudProviderID returns the value of the 'cloud_provider_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) CloudProviderID() string { + if o != nil && o.bitmap_&16 != 0 { + return o.cloudProviderID + } + return "" +} + +// GetCloudProviderID returns the value of the 'cloud_provider_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetCloudProviderID() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.cloudProviderID + } + return +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) ClusterID() string { + if o != nil && o.bitmap_&32 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.clusterID + } + return +} + +// Disconnected returns the value of the 'disconnected' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) Disconnected() bool { + if o != nil && o.bitmap_&64 != 0 { + return o.disconnected + } + return false +} + +// GetDisconnected returns the value of the 'disconnected' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetDisconnected() (value bool, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.disconnected + } + return +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) DisplayName() string { + if o != nil && o.bitmap_&128 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.displayName + } + return +} + +// ExternalClusterID returns the value of the 'external_cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) ExternalClusterID() string { + if o != nil && o.bitmap_&256 != 0 { + return o.externalClusterID + } + return "" +} + +// GetExternalClusterID returns the value of the 'external_cluster_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetExternalClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.externalClusterID + } + return +} + +// Managed returns the value of the 'managed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) Managed() bool { + if o != nil && o.bitmap_&512 != 0 { + return o.managed + } + return false +} + +// GetManaged returns the value of the 'managed' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetManaged() (value bool, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.managed + } + return +} + +// ProductID returns the value of the 'product_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) ProductID() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.productID + } + return "" +} + +// GetProductID returns the value of the 'product_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetProductID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.productID + } + return +} + +// ProductCategory returns the value of the 'product_category' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) ProductCategory() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.productCategory + } + return "" +} + +// GetProductCategory returns the value of the 'product_category' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetProductCategory() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.productCategory + } + return +} + +// QuotaVersion returns the value of the 'quota_version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) QuotaVersion() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.quotaVersion + } + return "" +} + +// GetQuotaVersion returns the value of the 'quota_version' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetQuotaVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.quotaVersion + } + return +} + +// Reserve returns the value of the 'reserve' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) Reserve() bool { + if o != nil && o.bitmap_&8192 != 0 { + return o.reserve + } + return false +} + +// GetReserve returns the value of the 'reserve' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetReserve() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.reserve + } + 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 *ClusterAuthorizationRequest) Resources() []*ReservedResource { + if o != nil && o.bitmap_&16384 != 0 { + return o.resources + } + return nil +} + +// GetResources returns the value of the 'resources' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetResources() (value []*ReservedResource, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.resources + } + return +} + +// Scope returns the value of the 'scope' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationRequest) Scope() string { + if o != nil && o.bitmap_&32768 != 0 { + return o.scope + } + return "" +} + +// GetScope returns the value of the 'scope' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationRequest) GetScope() (value string, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.scope + } + return +} + +// ClusterAuthorizationRequestListKind is the name of the type used to represent list of objects of +// type 'cluster_authorization_request'. +const ClusterAuthorizationRequestListKind = "ClusterAuthorizationRequestList" + +// ClusterAuthorizationRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_authorization_request'. +const ClusterAuthorizationRequestListLinkKind = "ClusterAuthorizationRequestListLink" + +// ClusterAuthorizationRequestNilKind is the name of the type used to nil lists of objects of +// type 'cluster_authorization_request'. +const ClusterAuthorizationRequestListNilKind = "ClusterAuthorizationRequestListNil" + +// ClusterAuthorizationRequestList is a list of values of the 'cluster_authorization_request' type. +type ClusterAuthorizationRequestList struct { + href string + link bool + items []*ClusterAuthorizationRequest +} + +// Len returns the length of the list. +func (l *ClusterAuthorizationRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterAuthorizationRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterAuthorizationRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterAuthorizationRequestList) SetItems(items []*ClusterAuthorizationRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterAuthorizationRequestList) Items() []*ClusterAuthorizationRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterAuthorizationRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterAuthorizationRequestList) Get(i int) *ClusterAuthorizationRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterAuthorizationRequestList) Slice() []*ClusterAuthorizationRequest { + var slice []*ClusterAuthorizationRequest + if l == nil { + slice = make([]*ClusterAuthorizationRequest, 0) + } else { + slice = make([]*ClusterAuthorizationRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterAuthorizationRequestList) Each(f func(item *ClusterAuthorizationRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterAuthorizationRequestList) Range(f func(index int, item *ClusterAuthorizationRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/cluster_authorization_request_type_json.go b/clientapi/accountsmgmt/v1/cluster_authorization_request_type_json.go new file mode 100644 index 00000000..915ab118 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_authorization_request_type_json.go @@ -0,0 +1,281 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterAuthorizationRequest writes a value of the 'cluster_authorization_request' type to the given writer. +func MarshalClusterAuthorizationRequest(object *ClusterAuthorizationRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterAuthorizationRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterAuthorizationRequest writes a value of the 'cluster_authorization_request' type to the given stream. +func WriteClusterAuthorizationRequest(object *ClusterAuthorizationRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("byoc") + stream.WriteBool(object.byoc) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_username") + stream.WriteString(object.accountUsername) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zone") + stream.WriteString(object.availabilityZone) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_account_id") + stream.WriteString(object.cloudAccountID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider_id") + stream.WriteString(object.cloudProviderID) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("disconnected") + stream.WriteBool(object.disconnected) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_cluster_id") + stream.WriteString(object.externalClusterID) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed") + stream.WriteBool(object.managed) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product_id") + stream.WriteString(object.productID) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product_category") + stream.WriteString(object.productCategory) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("quota_version") + stream.WriteString(object.quotaVersion) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("reserve") + stream.WriteBool(object.reserve) + count++ + } + present_ = object.bitmap_&16384 != 0 && object.resources != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resources") + WriteReservedResourceList(object.resources, stream) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("scope") + stream.WriteString(object.scope) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterAuthorizationRequest reads a value of the 'cluster_authorization_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterAuthorizationRequest(source interface{}) (object *ClusterAuthorizationRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterAuthorizationRequest(iterator) + err = iterator.Error + return +} + +// ReadClusterAuthorizationRequest reads a value of the 'cluster_authorization_request' type from the given iterator. +func ReadClusterAuthorizationRequest(iterator *jsoniter.Iterator) *ClusterAuthorizationRequest { + object := &ClusterAuthorizationRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "byoc": + value := iterator.ReadBool() + object.byoc = value + object.bitmap_ |= 1 + case "account_username": + value := iterator.ReadString() + object.accountUsername = value + object.bitmap_ |= 2 + case "availability_zone": + value := iterator.ReadString() + object.availabilityZone = value + object.bitmap_ |= 4 + case "cloud_account_id": + value := iterator.ReadString() + object.cloudAccountID = value + object.bitmap_ |= 8 + case "cloud_provider_id": + value := iterator.ReadString() + object.cloudProviderID = value + object.bitmap_ |= 16 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 32 + case "disconnected": + value := iterator.ReadBool() + object.disconnected = value + object.bitmap_ |= 64 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 128 + case "external_cluster_id": + value := iterator.ReadString() + object.externalClusterID = value + object.bitmap_ |= 256 + case "managed": + value := iterator.ReadBool() + object.managed = value + object.bitmap_ |= 512 + case "product_id": + value := iterator.ReadString() + object.productID = value + object.bitmap_ |= 1024 + case "product_category": + value := iterator.ReadString() + object.productCategory = value + object.bitmap_ |= 2048 + case "quota_version": + value := iterator.ReadString() + object.quotaVersion = value + object.bitmap_ |= 4096 + case "reserve": + value := iterator.ReadBool() + object.reserve = value + object.bitmap_ |= 8192 + case "resources": + value := ReadReservedResourceList(iterator) + object.resources = value + object.bitmap_ |= 16384 + case "scope": + value := iterator.ReadString() + object.scope = value + object.bitmap_ |= 32768 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/cluster_authorization_response_builder.go b/clientapi/accountsmgmt/v1/cluster_authorization_response_builder.go new file mode 100644 index 00000000..3ffdd7c9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_authorization_response_builder.go @@ -0,0 +1,110 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterAuthorizationResponseBuilder contains the data and logic needed to build 'cluster_authorization_response' objects. +type ClusterAuthorizationResponseBuilder struct { + bitmap_ uint32 + excessResources []*ReservedResourceBuilder + subscription *SubscriptionBuilder + allowed bool +} + +// NewClusterAuthorizationResponse creates a new builder of 'cluster_authorization_response' objects. +func NewClusterAuthorizationResponse() *ClusterAuthorizationResponseBuilder { + return &ClusterAuthorizationResponseBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterAuthorizationResponseBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Allowed sets the value of the 'allowed' attribute to the given value. +func (b *ClusterAuthorizationResponseBuilder) Allowed(value bool) *ClusterAuthorizationResponseBuilder { + b.allowed = value + b.bitmap_ |= 1 + return b +} + +// ExcessResources sets the value of the 'excess_resources' attribute to the given values. +func (b *ClusterAuthorizationResponseBuilder) ExcessResources(values ...*ReservedResourceBuilder) *ClusterAuthorizationResponseBuilder { + b.excessResources = make([]*ReservedResourceBuilder, len(values)) + copy(b.excessResources, values) + b.bitmap_ |= 2 + return b +} + +// Subscription sets the value of the 'subscription' attribute to the given value. +func (b *ClusterAuthorizationResponseBuilder) Subscription(value *SubscriptionBuilder) *ClusterAuthorizationResponseBuilder { + b.subscription = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterAuthorizationResponseBuilder) Copy(object *ClusterAuthorizationResponse) *ClusterAuthorizationResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.allowed = object.allowed + if object.excessResources != nil { + b.excessResources = make([]*ReservedResourceBuilder, len(object.excessResources)) + for i, v := range object.excessResources { + b.excessResources[i] = NewReservedResource().Copy(v) + } + } else { + b.excessResources = nil + } + if object.subscription != nil { + b.subscription = NewSubscription().Copy(object.subscription) + } else { + b.subscription = nil + } + return b +} + +// Build creates a 'cluster_authorization_response' object using the configuration stored in the builder. +func (b *ClusterAuthorizationResponseBuilder) Build() (object *ClusterAuthorizationResponse, err error) { + object = new(ClusterAuthorizationResponse) + object.bitmap_ = b.bitmap_ + object.allowed = b.allowed + if b.excessResources != nil { + object.excessResources = make([]*ReservedResource, len(b.excessResources)) + for i, v := range b.excessResources { + object.excessResources[i], err = v.Build() + if err != nil { + return + } + } + } + if b.subscription != nil { + object.subscription, err = b.subscription.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_authorization_response_list_builder.go b/clientapi/accountsmgmt/v1/cluster_authorization_response_list_builder.go new file mode 100644 index 00000000..f20f56cf --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_authorization_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterAuthorizationResponseListBuilder contains the data and logic needed to build +// 'cluster_authorization_response' objects. +type ClusterAuthorizationResponseListBuilder struct { + items []*ClusterAuthorizationResponseBuilder +} + +// NewClusterAuthorizationResponseList creates a new builder of 'cluster_authorization_response' objects. +func NewClusterAuthorizationResponseList() *ClusterAuthorizationResponseListBuilder { + return new(ClusterAuthorizationResponseListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterAuthorizationResponseListBuilder) Items(values ...*ClusterAuthorizationResponseBuilder) *ClusterAuthorizationResponseListBuilder { + b.items = make([]*ClusterAuthorizationResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterAuthorizationResponseListBuilder) 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 *ClusterAuthorizationResponseListBuilder) Copy(list *ClusterAuthorizationResponseList) *ClusterAuthorizationResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterAuthorizationResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterAuthorizationResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_authorization_response' objects using the +// configuration stored in the builder. +func (b *ClusterAuthorizationResponseListBuilder) Build() (list *ClusterAuthorizationResponseList, err error) { + items := make([]*ClusterAuthorizationResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterAuthorizationResponseList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_authorization_response_list_type_json.go b/clientapi/accountsmgmt/v1/cluster_authorization_response_list_type_json.go new file mode 100644 index 00000000..4be5db03 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_authorization_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterAuthorizationResponseList writes a list of values of the 'cluster_authorization_response' type to +// the given writer. +func MarshalClusterAuthorizationResponseList(list []*ClusterAuthorizationResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterAuthorizationResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterAuthorizationResponseList writes a list of value of the 'cluster_authorization_response' type to +// the given stream. +func WriteClusterAuthorizationResponseList(list []*ClusterAuthorizationResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterAuthorizationResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterAuthorizationResponseList reads a list of values of the 'cluster_authorization_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterAuthorizationResponseList(source interface{}) (items []*ClusterAuthorizationResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterAuthorizationResponseList(iterator) + err = iterator.Error + return +} + +// ReadClusterAuthorizationResponseList reads list of values of the ”cluster_authorization_response' type from +// the given iterator. +func ReadClusterAuthorizationResponseList(iterator *jsoniter.Iterator) []*ClusterAuthorizationResponse { + list := []*ClusterAuthorizationResponse{} + for iterator.ReadArray() { + item := ReadClusterAuthorizationResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/cluster_authorization_response_type.go b/clientapi/accountsmgmt/v1/cluster_authorization_response_type.go new file mode 100644 index 00000000..f2a7a368 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_authorization_response_type.go @@ -0,0 +1,199 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterAuthorizationResponse represents the values of the 'cluster_authorization_response' type. +type ClusterAuthorizationResponse struct { + bitmap_ uint32 + excessResources []*ReservedResource + subscription *Subscription + allowed bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterAuthorizationResponse) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Allowed returns the value of the 'allowed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationResponse) Allowed() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.allowed + } + return false +} + +// GetAllowed returns the value of the 'allowed' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationResponse) GetAllowed() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.allowed + } + return +} + +// ExcessResources returns the value of the 'excess_resources' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationResponse) ExcessResources() []*ReservedResource { + if o != nil && o.bitmap_&2 != 0 { + return o.excessResources + } + return nil +} + +// GetExcessResources returns the value of the 'excess_resources' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationResponse) GetExcessResources() (value []*ReservedResource, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.excessResources + } + return +} + +// Subscription returns the value of the 'subscription' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterAuthorizationResponse) Subscription() *Subscription { + if o != nil && o.bitmap_&4 != 0 { + return o.subscription + } + return nil +} + +// GetSubscription returns the value of the 'subscription' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterAuthorizationResponse) GetSubscription() (value *Subscription, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.subscription + } + return +} + +// ClusterAuthorizationResponseListKind is the name of the type used to represent list of objects of +// type 'cluster_authorization_response'. +const ClusterAuthorizationResponseListKind = "ClusterAuthorizationResponseList" + +// ClusterAuthorizationResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_authorization_response'. +const ClusterAuthorizationResponseListLinkKind = "ClusterAuthorizationResponseListLink" + +// ClusterAuthorizationResponseNilKind is the name of the type used to nil lists of objects of +// type 'cluster_authorization_response'. +const ClusterAuthorizationResponseListNilKind = "ClusterAuthorizationResponseListNil" + +// ClusterAuthorizationResponseList is a list of values of the 'cluster_authorization_response' type. +type ClusterAuthorizationResponseList struct { + href string + link bool + items []*ClusterAuthorizationResponse +} + +// Len returns the length of the list. +func (l *ClusterAuthorizationResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterAuthorizationResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterAuthorizationResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterAuthorizationResponseList) SetItems(items []*ClusterAuthorizationResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterAuthorizationResponseList) Items() []*ClusterAuthorizationResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterAuthorizationResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterAuthorizationResponseList) Get(i int) *ClusterAuthorizationResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterAuthorizationResponseList) Slice() []*ClusterAuthorizationResponse { + var slice []*ClusterAuthorizationResponse + if l == nil { + slice = make([]*ClusterAuthorizationResponse, 0) + } else { + slice = make([]*ClusterAuthorizationResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterAuthorizationResponseList) Each(f func(item *ClusterAuthorizationResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterAuthorizationResponseList) Range(f func(index int, item *ClusterAuthorizationResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/cluster_authorization_response_type_json.go b/clientapi/accountsmgmt/v1/cluster_authorization_response_type_json.go new file mode 100644 index 00000000..cbe54978 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_authorization_response_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterAuthorizationResponse writes a value of the 'cluster_authorization_response' type to the given writer. +func MarshalClusterAuthorizationResponse(object *ClusterAuthorizationResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterAuthorizationResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterAuthorizationResponse writes a value of the 'cluster_authorization_response' type to the given stream. +func WriteClusterAuthorizationResponse(object *ClusterAuthorizationResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("allowed") + stream.WriteBool(object.allowed) + count++ + } + present_ = object.bitmap_&2 != 0 && object.excessResources != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("excess_resources") + WriteReservedResourceList(object.excessResources, stream) + count++ + } + present_ = object.bitmap_&4 != 0 && object.subscription != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription") + WriteSubscription(object.subscription, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterAuthorizationResponse reads a value of the 'cluster_authorization_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterAuthorizationResponse(source interface{}) (object *ClusterAuthorizationResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterAuthorizationResponse(iterator) + err = iterator.Error + return +} + +// ReadClusterAuthorizationResponse reads a value of the 'cluster_authorization_response' type from the given iterator. +func ReadClusterAuthorizationResponse(iterator *jsoniter.Iterator) *ClusterAuthorizationResponse { + object := &ClusterAuthorizationResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "allowed": + value := iterator.ReadBool() + object.allowed = value + object.bitmap_ |= 1 + case "excess_resources": + value := ReadReservedResourceList(iterator) + object.excessResources = value + object.bitmap_ |= 2 + case "subscription": + value := ReadSubscription(iterator) + object.subscription = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/cluster_metrics_nodes_builder.go b/clientapi/accountsmgmt/v1/cluster_metrics_nodes_builder.go new file mode 100644 index 00000000..59454d5d --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_metrics_nodes_builder.go @@ -0,0 +1,91 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterMetricsNodesBuilder contains the data and logic needed to build 'cluster_metrics_nodes' objects. +type ClusterMetricsNodesBuilder struct { + bitmap_ uint32 + compute float64 + infra float64 + master float64 + total float64 +} + +// NewClusterMetricsNodes creates a new builder of 'cluster_metrics_nodes' objects. +func NewClusterMetricsNodes() *ClusterMetricsNodesBuilder { + return &ClusterMetricsNodesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterMetricsNodesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Compute sets the value of the 'compute' attribute to the given value. +func (b *ClusterMetricsNodesBuilder) Compute(value float64) *ClusterMetricsNodesBuilder { + b.compute = value + b.bitmap_ |= 1 + return b +} + +// Infra sets the value of the 'infra' attribute to the given value. +func (b *ClusterMetricsNodesBuilder) Infra(value float64) *ClusterMetricsNodesBuilder { + b.infra = value + b.bitmap_ |= 2 + return b +} + +// Master sets the value of the 'master' attribute to the given value. +func (b *ClusterMetricsNodesBuilder) Master(value float64) *ClusterMetricsNodesBuilder { + b.master = value + b.bitmap_ |= 4 + return b +} + +// Total sets the value of the 'total' attribute to the given value. +func (b *ClusterMetricsNodesBuilder) Total(value float64) *ClusterMetricsNodesBuilder { + b.total = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterMetricsNodesBuilder) Copy(object *ClusterMetricsNodes) *ClusterMetricsNodesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.compute = object.compute + b.infra = object.infra + b.master = object.master + b.total = object.total + return b +} + +// Build creates a 'cluster_metrics_nodes' object using the configuration stored in the builder. +func (b *ClusterMetricsNodesBuilder) Build() (object *ClusterMetricsNodes, err error) { + object = new(ClusterMetricsNodes) + object.bitmap_ = b.bitmap_ + object.compute = b.compute + object.infra = b.infra + object.master = b.master + object.total = b.total + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_metrics_nodes_list_builder.go b/clientapi/accountsmgmt/v1/cluster_metrics_nodes_list_builder.go new file mode 100644 index 00000000..9b2a82cd --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_metrics_nodes_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterMetricsNodesListBuilder contains the data and logic needed to build +// 'cluster_metrics_nodes' objects. +type ClusterMetricsNodesListBuilder struct { + items []*ClusterMetricsNodesBuilder +} + +// NewClusterMetricsNodesList creates a new builder of 'cluster_metrics_nodes' objects. +func NewClusterMetricsNodesList() *ClusterMetricsNodesListBuilder { + return new(ClusterMetricsNodesListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterMetricsNodesListBuilder) Items(values ...*ClusterMetricsNodesBuilder) *ClusterMetricsNodesListBuilder { + b.items = make([]*ClusterMetricsNodesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterMetricsNodesListBuilder) 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 *ClusterMetricsNodesListBuilder) Copy(list *ClusterMetricsNodesList) *ClusterMetricsNodesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterMetricsNodesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterMetricsNodes().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_metrics_nodes' objects using the +// configuration stored in the builder. +func (b *ClusterMetricsNodesListBuilder) Build() (list *ClusterMetricsNodesList, err error) { + items := make([]*ClusterMetricsNodes, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterMetricsNodesList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_metrics_nodes_list_type_json.go b/clientapi/accountsmgmt/v1/cluster_metrics_nodes_list_type_json.go new file mode 100644 index 00000000..ce0709dc --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_metrics_nodes_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterMetricsNodesList writes a list of values of the 'cluster_metrics_nodes' type to +// the given writer. +func MarshalClusterMetricsNodesList(list []*ClusterMetricsNodes, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterMetricsNodesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterMetricsNodesList writes a list of value of the 'cluster_metrics_nodes' type to +// the given stream. +func WriteClusterMetricsNodesList(list []*ClusterMetricsNodes, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterMetricsNodes(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterMetricsNodesList reads a list of values of the 'cluster_metrics_nodes' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterMetricsNodesList(source interface{}) (items []*ClusterMetricsNodes, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterMetricsNodesList(iterator) + err = iterator.Error + return +} + +// ReadClusterMetricsNodesList reads list of values of the ”cluster_metrics_nodes' type from +// the given iterator. +func ReadClusterMetricsNodesList(iterator *jsoniter.Iterator) []*ClusterMetricsNodes { + list := []*ClusterMetricsNodes{} + for iterator.ReadArray() { + item := ReadClusterMetricsNodes(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/cluster_metrics_nodes_type.go b/clientapi/accountsmgmt/v1/cluster_metrics_nodes_type.go new file mode 100644 index 00000000..fad8943e --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_metrics_nodes_type.go @@ -0,0 +1,219 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterMetricsNodes represents the values of the 'cluster_metrics_nodes' type. +type ClusterMetricsNodes struct { + bitmap_ uint32 + compute float64 + infra float64 + master float64 + total float64 +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterMetricsNodes) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Compute returns the value of the 'compute' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterMetricsNodes) Compute() float64 { + if o != nil && o.bitmap_&1 != 0 { + return o.compute + } + return 0.0 +} + +// GetCompute returns the value of the 'compute' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterMetricsNodes) GetCompute() (value float64, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.compute + } + return +} + +// Infra returns the value of the 'infra' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterMetricsNodes) Infra() float64 { + if o != nil && o.bitmap_&2 != 0 { + return o.infra + } + return 0.0 +} + +// GetInfra returns the value of the 'infra' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterMetricsNodes) GetInfra() (value float64, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.infra + } + return +} + +// Master returns the value of the 'master' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterMetricsNodes) Master() float64 { + if o != nil && o.bitmap_&4 != 0 { + return o.master + } + return 0.0 +} + +// GetMaster returns the value of the 'master' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterMetricsNodes) GetMaster() (value float64, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.master + } + return +} + +// Total returns the value of the 'total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterMetricsNodes) Total() float64 { + if o != nil && o.bitmap_&8 != 0 { + return o.total + } + return 0.0 +} + +// GetTotal returns the value of the 'total' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterMetricsNodes) GetTotal() (value float64, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.total + } + return +} + +// ClusterMetricsNodesListKind is the name of the type used to represent list of objects of +// type 'cluster_metrics_nodes'. +const ClusterMetricsNodesListKind = "ClusterMetricsNodesList" + +// ClusterMetricsNodesListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_metrics_nodes'. +const ClusterMetricsNodesListLinkKind = "ClusterMetricsNodesListLink" + +// ClusterMetricsNodesNilKind is the name of the type used to nil lists of objects of +// type 'cluster_metrics_nodes'. +const ClusterMetricsNodesListNilKind = "ClusterMetricsNodesListNil" + +// ClusterMetricsNodesList is a list of values of the 'cluster_metrics_nodes' type. +type ClusterMetricsNodesList struct { + href string + link bool + items []*ClusterMetricsNodes +} + +// Len returns the length of the list. +func (l *ClusterMetricsNodesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterMetricsNodesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterMetricsNodesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterMetricsNodesList) SetItems(items []*ClusterMetricsNodes) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterMetricsNodesList) Items() []*ClusterMetricsNodes { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterMetricsNodesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterMetricsNodesList) Get(i int) *ClusterMetricsNodes { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterMetricsNodesList) Slice() []*ClusterMetricsNodes { + var slice []*ClusterMetricsNodes + if l == nil { + slice = make([]*ClusterMetricsNodes, 0) + } else { + slice = make([]*ClusterMetricsNodes, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterMetricsNodesList) Each(f func(item *ClusterMetricsNodes) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterMetricsNodesList) Range(f func(index int, item *ClusterMetricsNodes) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/cluster_metrics_nodes_type_json.go b/clientapi/accountsmgmt/v1/cluster_metrics_nodes_type_json.go new file mode 100644 index 00000000..53a54990 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_metrics_nodes_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterMetricsNodes writes a value of the 'cluster_metrics_nodes' type to the given writer. +func MarshalClusterMetricsNodes(object *ClusterMetricsNodes, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterMetricsNodes(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterMetricsNodes writes a value of the 'cluster_metrics_nodes' type to the given stream. +func WriteClusterMetricsNodes(object *ClusterMetricsNodes, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute") + stream.WriteFloat64(object.compute) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("infra") + stream.WriteFloat64(object.infra) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("master") + stream.WriteFloat64(object.master) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("total") + stream.WriteFloat64(object.total) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterMetricsNodes reads a value of the 'cluster_metrics_nodes' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterMetricsNodes(source interface{}) (object *ClusterMetricsNodes, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterMetricsNodes(iterator) + err = iterator.Error + return +} + +// ReadClusterMetricsNodes reads a value of the 'cluster_metrics_nodes' type from the given iterator. +func ReadClusterMetricsNodes(iterator *jsoniter.Iterator) *ClusterMetricsNodes { + object := &ClusterMetricsNodes{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "compute": + value := iterator.ReadFloat64() + object.compute = value + object.bitmap_ |= 1 + case "infra": + value := iterator.ReadFloat64() + object.infra = value + object.bitmap_ |= 2 + case "master": + value := iterator.ReadFloat64() + object.master = value + object.bitmap_ |= 4 + case "total": + value := iterator.ReadFloat64() + object.total = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/cluster_registration_request_builder.go b/clientapi/accountsmgmt/v1/cluster_registration_request_builder.go new file mode 100644 index 00000000..6748241e --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_registration_request_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterRegistrationRequestBuilder contains the data and logic needed to build 'cluster_registration_request' objects. +type ClusterRegistrationRequestBuilder struct { + bitmap_ uint32 + authorizationToken string + clusterID string +} + +// NewClusterRegistrationRequest creates a new builder of 'cluster_registration_request' objects. +func NewClusterRegistrationRequest() *ClusterRegistrationRequestBuilder { + return &ClusterRegistrationRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterRegistrationRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AuthorizationToken sets the value of the 'authorization_token' attribute to the given value. +func (b *ClusterRegistrationRequestBuilder) AuthorizationToken(value string) *ClusterRegistrationRequestBuilder { + b.authorizationToken = value + b.bitmap_ |= 1 + return b +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *ClusterRegistrationRequestBuilder) ClusterID(value string) *ClusterRegistrationRequestBuilder { + b.clusterID = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterRegistrationRequestBuilder) Copy(object *ClusterRegistrationRequest) *ClusterRegistrationRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.authorizationToken = object.authorizationToken + b.clusterID = object.clusterID + return b +} + +// Build creates a 'cluster_registration_request' object using the configuration stored in the builder. +func (b *ClusterRegistrationRequestBuilder) Build() (object *ClusterRegistrationRequest, err error) { + object = new(ClusterRegistrationRequest) + object.bitmap_ = b.bitmap_ + object.authorizationToken = b.authorizationToken + object.clusterID = b.clusterID + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_registration_request_list_builder.go b/clientapi/accountsmgmt/v1/cluster_registration_request_list_builder.go new file mode 100644 index 00000000..0df671c8 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_registration_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterRegistrationRequestListBuilder contains the data and logic needed to build +// 'cluster_registration_request' objects. +type ClusterRegistrationRequestListBuilder struct { + items []*ClusterRegistrationRequestBuilder +} + +// NewClusterRegistrationRequestList creates a new builder of 'cluster_registration_request' objects. +func NewClusterRegistrationRequestList() *ClusterRegistrationRequestListBuilder { + return new(ClusterRegistrationRequestListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterRegistrationRequestListBuilder) Items(values ...*ClusterRegistrationRequestBuilder) *ClusterRegistrationRequestListBuilder { + b.items = make([]*ClusterRegistrationRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterRegistrationRequestListBuilder) 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 *ClusterRegistrationRequestListBuilder) Copy(list *ClusterRegistrationRequestList) *ClusterRegistrationRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterRegistrationRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterRegistrationRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_registration_request' objects using the +// configuration stored in the builder. +func (b *ClusterRegistrationRequestListBuilder) Build() (list *ClusterRegistrationRequestList, err error) { + items := make([]*ClusterRegistrationRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterRegistrationRequestList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_registration_request_list_type_json.go b/clientapi/accountsmgmt/v1/cluster_registration_request_list_type_json.go new file mode 100644 index 00000000..0b8f7558 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_registration_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterRegistrationRequestList writes a list of values of the 'cluster_registration_request' type to +// the given writer. +func MarshalClusterRegistrationRequestList(list []*ClusterRegistrationRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterRegistrationRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterRegistrationRequestList writes a list of value of the 'cluster_registration_request' type to +// the given stream. +func WriteClusterRegistrationRequestList(list []*ClusterRegistrationRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterRegistrationRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterRegistrationRequestList reads a list of values of the 'cluster_registration_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterRegistrationRequestList(source interface{}) (items []*ClusterRegistrationRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterRegistrationRequestList(iterator) + err = iterator.Error + return +} + +// ReadClusterRegistrationRequestList reads list of values of the ”cluster_registration_request' type from +// the given iterator. +func ReadClusterRegistrationRequestList(iterator *jsoniter.Iterator) []*ClusterRegistrationRequest { + list := []*ClusterRegistrationRequest{} + for iterator.ReadArray() { + item := ReadClusterRegistrationRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/cluster_registration_request_type.go b/clientapi/accountsmgmt/v1/cluster_registration_request_type.go new file mode 100644 index 00000000..ca13ab21 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_registration_request_type.go @@ -0,0 +1,179 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterRegistrationRequest represents the values of the 'cluster_registration_request' type. +type ClusterRegistrationRequest struct { + bitmap_ uint32 + authorizationToken string + clusterID string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterRegistrationRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AuthorizationToken returns the value of the 'authorization_token' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterRegistrationRequest) AuthorizationToken() string { + if o != nil && o.bitmap_&1 != 0 { + return o.authorizationToken + } + return "" +} + +// GetAuthorizationToken returns the value of the 'authorization_token' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterRegistrationRequest) GetAuthorizationToken() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.authorizationToken + } + return +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterRegistrationRequest) ClusterID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterRegistrationRequest) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.clusterID + } + return +} + +// ClusterRegistrationRequestListKind is the name of the type used to represent list of objects of +// type 'cluster_registration_request'. +const ClusterRegistrationRequestListKind = "ClusterRegistrationRequestList" + +// ClusterRegistrationRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_registration_request'. +const ClusterRegistrationRequestListLinkKind = "ClusterRegistrationRequestListLink" + +// ClusterRegistrationRequestNilKind is the name of the type used to nil lists of objects of +// type 'cluster_registration_request'. +const ClusterRegistrationRequestListNilKind = "ClusterRegistrationRequestListNil" + +// ClusterRegistrationRequestList is a list of values of the 'cluster_registration_request' type. +type ClusterRegistrationRequestList struct { + href string + link bool + items []*ClusterRegistrationRequest +} + +// Len returns the length of the list. +func (l *ClusterRegistrationRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterRegistrationRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterRegistrationRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterRegistrationRequestList) SetItems(items []*ClusterRegistrationRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterRegistrationRequestList) Items() []*ClusterRegistrationRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterRegistrationRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterRegistrationRequestList) Get(i int) *ClusterRegistrationRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterRegistrationRequestList) Slice() []*ClusterRegistrationRequest { + var slice []*ClusterRegistrationRequest + if l == nil { + slice = make([]*ClusterRegistrationRequest, 0) + } else { + slice = make([]*ClusterRegistrationRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterRegistrationRequestList) Each(f func(item *ClusterRegistrationRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterRegistrationRequestList) Range(f func(index int, item *ClusterRegistrationRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/cluster_registration_request_type_json.go b/clientapi/accountsmgmt/v1/cluster_registration_request_type_json.go new file mode 100644 index 00000000..c237aef4 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_registration_request_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterRegistrationRequest writes a value of the 'cluster_registration_request' type to the given writer. +func MarshalClusterRegistrationRequest(object *ClusterRegistrationRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterRegistrationRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterRegistrationRequest writes a value of the 'cluster_registration_request' type to the given stream. +func WriteClusterRegistrationRequest(object *ClusterRegistrationRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("authorization_token") + stream.WriteString(object.authorizationToken) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterRegistrationRequest reads a value of the 'cluster_registration_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterRegistrationRequest(source interface{}) (object *ClusterRegistrationRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterRegistrationRequest(iterator) + err = iterator.Error + return +} + +// ReadClusterRegistrationRequest reads a value of the 'cluster_registration_request' type from the given iterator. +func ReadClusterRegistrationRequest(iterator *jsoniter.Iterator) *ClusterRegistrationRequest { + object := &ClusterRegistrationRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "authorization_token": + value := iterator.ReadString() + object.authorizationToken = value + object.bitmap_ |= 1 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/cluster_registration_response_builder.go b/clientapi/accountsmgmt/v1/cluster_registration_response_builder.go new file mode 100644 index 00000000..fcbc7a45 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_registration_response_builder.go @@ -0,0 +1,91 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterRegistrationResponseBuilder contains the data and logic needed to build 'cluster_registration_response' objects. +type ClusterRegistrationResponseBuilder struct { + bitmap_ uint32 + accountID string + authorizationToken string + clusterID string + expiresAt string +} + +// NewClusterRegistrationResponse creates a new builder of 'cluster_registration_response' objects. +func NewClusterRegistrationResponse() *ClusterRegistrationResponseBuilder { + return &ClusterRegistrationResponseBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterRegistrationResponseBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AccountID sets the value of the 'account_ID' attribute to the given value. +func (b *ClusterRegistrationResponseBuilder) AccountID(value string) *ClusterRegistrationResponseBuilder { + b.accountID = value + b.bitmap_ |= 1 + return b +} + +// AuthorizationToken sets the value of the 'authorization_token' attribute to the given value. +func (b *ClusterRegistrationResponseBuilder) AuthorizationToken(value string) *ClusterRegistrationResponseBuilder { + b.authorizationToken = value + b.bitmap_ |= 2 + return b +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *ClusterRegistrationResponseBuilder) ClusterID(value string) *ClusterRegistrationResponseBuilder { + b.clusterID = value + b.bitmap_ |= 4 + return b +} + +// ExpiresAt sets the value of the 'expires_at' attribute to the given value. +func (b *ClusterRegistrationResponseBuilder) ExpiresAt(value string) *ClusterRegistrationResponseBuilder { + b.expiresAt = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterRegistrationResponseBuilder) Copy(object *ClusterRegistrationResponse) *ClusterRegistrationResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.accountID = object.accountID + b.authorizationToken = object.authorizationToken + b.clusterID = object.clusterID + b.expiresAt = object.expiresAt + return b +} + +// Build creates a 'cluster_registration_response' object using the configuration stored in the builder. +func (b *ClusterRegistrationResponseBuilder) Build() (object *ClusterRegistrationResponse, err error) { + object = new(ClusterRegistrationResponse) + object.bitmap_ = b.bitmap_ + object.accountID = b.accountID + object.authorizationToken = b.authorizationToken + object.clusterID = b.clusterID + object.expiresAt = b.expiresAt + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_registration_response_list_builder.go b/clientapi/accountsmgmt/v1/cluster_registration_response_list_builder.go new file mode 100644 index 00000000..4aa37afe --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_registration_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterRegistrationResponseListBuilder contains the data and logic needed to build +// 'cluster_registration_response' objects. +type ClusterRegistrationResponseListBuilder struct { + items []*ClusterRegistrationResponseBuilder +} + +// NewClusterRegistrationResponseList creates a new builder of 'cluster_registration_response' objects. +func NewClusterRegistrationResponseList() *ClusterRegistrationResponseListBuilder { + return new(ClusterRegistrationResponseListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterRegistrationResponseListBuilder) Items(values ...*ClusterRegistrationResponseBuilder) *ClusterRegistrationResponseListBuilder { + b.items = make([]*ClusterRegistrationResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterRegistrationResponseListBuilder) 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 *ClusterRegistrationResponseListBuilder) Copy(list *ClusterRegistrationResponseList) *ClusterRegistrationResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterRegistrationResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterRegistrationResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_registration_response' objects using the +// configuration stored in the builder. +func (b *ClusterRegistrationResponseListBuilder) Build() (list *ClusterRegistrationResponseList, err error) { + items := make([]*ClusterRegistrationResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterRegistrationResponseList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_registration_response_list_type_json.go b/clientapi/accountsmgmt/v1/cluster_registration_response_list_type_json.go new file mode 100644 index 00000000..6c9e17d7 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_registration_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterRegistrationResponseList writes a list of values of the 'cluster_registration_response' type to +// the given writer. +func MarshalClusterRegistrationResponseList(list []*ClusterRegistrationResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterRegistrationResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterRegistrationResponseList writes a list of value of the 'cluster_registration_response' type to +// the given stream. +func WriteClusterRegistrationResponseList(list []*ClusterRegistrationResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterRegistrationResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterRegistrationResponseList reads a list of values of the 'cluster_registration_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterRegistrationResponseList(source interface{}) (items []*ClusterRegistrationResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterRegistrationResponseList(iterator) + err = iterator.Error + return +} + +// ReadClusterRegistrationResponseList reads list of values of the ”cluster_registration_response' type from +// the given iterator. +func ReadClusterRegistrationResponseList(iterator *jsoniter.Iterator) []*ClusterRegistrationResponse { + list := []*ClusterRegistrationResponse{} + for iterator.ReadArray() { + item := ReadClusterRegistrationResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/cluster_registration_response_type.go b/clientapi/accountsmgmt/v1/cluster_registration_response_type.go new file mode 100644 index 00000000..e4fe40fb --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_registration_response_type.go @@ -0,0 +1,223 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterRegistrationResponse represents the values of the 'cluster_registration_response' type. +type ClusterRegistrationResponse struct { + bitmap_ uint32 + accountID string + authorizationToken string + clusterID string + expiresAt string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterRegistrationResponse) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AccountID returns the value of the 'account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterRegistrationResponse) AccountID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.accountID + } + return "" +} + +// GetAccountID returns the value of the 'account_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterRegistrationResponse) GetAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.accountID + } + return +} + +// AuthorizationToken returns the value of the 'authorization_token' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterRegistrationResponse) AuthorizationToken() string { + if o != nil && o.bitmap_&2 != 0 { + return o.authorizationToken + } + return "" +} + +// GetAuthorizationToken returns the value of the 'authorization_token' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterRegistrationResponse) GetAuthorizationToken() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.authorizationToken + } + return +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterRegistrationResponse) ClusterID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterRegistrationResponse) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.clusterID + } + return +} + +// ExpiresAt returns the value of the 'expires_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster registration expiration. +func (o *ClusterRegistrationResponse) ExpiresAt() string { + if o != nil && o.bitmap_&8 != 0 { + return o.expiresAt + } + return "" +} + +// GetExpiresAt returns the value of the 'expires_at' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster registration expiration. +func (o *ClusterRegistrationResponse) GetExpiresAt() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.expiresAt + } + return +} + +// ClusterRegistrationResponseListKind is the name of the type used to represent list of objects of +// type 'cluster_registration_response'. +const ClusterRegistrationResponseListKind = "ClusterRegistrationResponseList" + +// ClusterRegistrationResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_registration_response'. +const ClusterRegistrationResponseListLinkKind = "ClusterRegistrationResponseListLink" + +// ClusterRegistrationResponseNilKind is the name of the type used to nil lists of objects of +// type 'cluster_registration_response'. +const ClusterRegistrationResponseListNilKind = "ClusterRegistrationResponseListNil" + +// ClusterRegistrationResponseList is a list of values of the 'cluster_registration_response' type. +type ClusterRegistrationResponseList struct { + href string + link bool + items []*ClusterRegistrationResponse +} + +// Len returns the length of the list. +func (l *ClusterRegistrationResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterRegistrationResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterRegistrationResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterRegistrationResponseList) SetItems(items []*ClusterRegistrationResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterRegistrationResponseList) Items() []*ClusterRegistrationResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterRegistrationResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterRegistrationResponseList) Get(i int) *ClusterRegistrationResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterRegistrationResponseList) Slice() []*ClusterRegistrationResponse { + var slice []*ClusterRegistrationResponse + if l == nil { + slice = make([]*ClusterRegistrationResponse, 0) + } else { + slice = make([]*ClusterRegistrationResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterRegistrationResponseList) Each(f func(item *ClusterRegistrationResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterRegistrationResponseList) Range(f func(index int, item *ClusterRegistrationResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/cluster_registration_response_type_json.go b/clientapi/accountsmgmt/v1/cluster_registration_response_type_json.go new file mode 100644 index 00000000..7e26a4fc --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_registration_response_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterRegistrationResponse writes a value of the 'cluster_registration_response' type to the given writer. +func MarshalClusterRegistrationResponse(object *ClusterRegistrationResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterRegistrationResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterRegistrationResponse writes a value of the 'cluster_registration_response' type to the given stream. +func WriteClusterRegistrationResponse(object *ClusterRegistrationResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_id") + stream.WriteString(object.accountID) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("authorization_token") + stream.WriteString(object.authorizationToken) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("expires_at") + stream.WriteString(object.expiresAt) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterRegistrationResponse reads a value of the 'cluster_registration_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterRegistrationResponse(source interface{}) (object *ClusterRegistrationResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterRegistrationResponse(iterator) + err = iterator.Error + return +} + +// ReadClusterRegistrationResponse reads a value of the 'cluster_registration_response' type from the given iterator. +func ReadClusterRegistrationResponse(iterator *jsoniter.Iterator) *ClusterRegistrationResponse { + object := &ClusterRegistrationResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "account_id": + value := iterator.ReadString() + object.accountID = value + object.bitmap_ |= 1 + case "authorization_token": + value := iterator.ReadString() + object.authorizationToken = value + object.bitmap_ |= 2 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 4 + case "expires_at": + value := iterator.ReadString() + object.expiresAt = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/cluster_resource_builder.go b/clientapi/accountsmgmt/v1/cluster_resource_builder.go new file mode 100644 index 00000000..5d448d9e --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_resource_builder.go @@ -0,0 +1,111 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// ClusterResourceBuilder contains the data and logic needed to build 'cluster_resource' objects. +type ClusterResourceBuilder struct { + bitmap_ uint32 + total *ValueUnitBuilder + updatedTimestamp time.Time + used *ValueUnitBuilder +} + +// NewClusterResource creates a new builder of 'cluster_resource' objects. +func NewClusterResource() *ClusterResourceBuilder { + return &ClusterResourceBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterResourceBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Total sets the value of the 'total' attribute to the given value. +func (b *ClusterResourceBuilder) Total(value *ValueUnitBuilder) *ClusterResourceBuilder { + b.total = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// UpdatedTimestamp sets the value of the 'updated_timestamp' attribute to the given value. +func (b *ClusterResourceBuilder) UpdatedTimestamp(value time.Time) *ClusterResourceBuilder { + b.updatedTimestamp = value + b.bitmap_ |= 2 + return b +} + +// Used sets the value of the 'used' attribute to the given value. +func (b *ClusterResourceBuilder) Used(value *ValueUnitBuilder) *ClusterResourceBuilder { + b.used = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterResourceBuilder) Copy(object *ClusterResource) *ClusterResourceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.total != nil { + b.total = NewValueUnit().Copy(object.total) + } else { + b.total = nil + } + b.updatedTimestamp = object.updatedTimestamp + if object.used != nil { + b.used = NewValueUnit().Copy(object.used) + } else { + b.used = nil + } + return b +} + +// Build creates a 'cluster_resource' object using the configuration stored in the builder. +func (b *ClusterResourceBuilder) Build() (object *ClusterResource, err error) { + object = new(ClusterResource) + object.bitmap_ = b.bitmap_ + if b.total != nil { + object.total, err = b.total.Build() + if err != nil { + return + } + } + object.updatedTimestamp = b.updatedTimestamp + if b.used != nil { + object.used, err = b.used.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_resource_list_builder.go b/clientapi/accountsmgmt/v1/cluster_resource_list_builder.go new file mode 100644 index 00000000..edfce5be --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_resource_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterResourceListBuilder contains the data and logic needed to build +// 'cluster_resource' objects. +type ClusterResourceListBuilder struct { + items []*ClusterResourceBuilder +} + +// NewClusterResourceList creates a new builder of 'cluster_resource' objects. +func NewClusterResourceList() *ClusterResourceListBuilder { + return new(ClusterResourceListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterResourceListBuilder) Items(values ...*ClusterResourceBuilder) *ClusterResourceListBuilder { + b.items = make([]*ClusterResourceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterResourceListBuilder) 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 *ClusterResourceListBuilder) Copy(list *ClusterResourceList) *ClusterResourceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterResourceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterResource().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_resource' objects using the +// configuration stored in the builder. +func (b *ClusterResourceListBuilder) Build() (list *ClusterResourceList, err error) { + items := make([]*ClusterResource, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterResourceList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_resource_list_type_json.go b/clientapi/accountsmgmt/v1/cluster_resource_list_type_json.go new file mode 100644 index 00000000..1c530346 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_resource_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterResourceList writes a list of values of the 'cluster_resource' type to +// the given writer. +func MarshalClusterResourceList(list []*ClusterResource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterResourceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterResourceList writes a list of value of the 'cluster_resource' type to +// the given stream. +func WriteClusterResourceList(list []*ClusterResource, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterResource(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterResourceList reads a list of values of the 'cluster_resource' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterResourceList(source interface{}) (items []*ClusterResource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterResourceList(iterator) + err = iterator.Error + return +} + +// ReadClusterResourceList reads list of values of the ”cluster_resource' type from +// the given iterator. +func ReadClusterResourceList(iterator *jsoniter.Iterator) []*ClusterResource { + list := []*ClusterResource{} + for iterator.ReadArray() { + item := ReadClusterResource(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/cluster_resource_type.go b/clientapi/accountsmgmt/v1/cluster_resource_type.go new file mode 100644 index 00000000..c28de26e --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_resource_type.go @@ -0,0 +1,203 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// ClusterResource represents the values of the 'cluster_resource' type. +type ClusterResource struct { + bitmap_ uint32 + total *ValueUnit + updatedTimestamp time.Time + used *ValueUnit +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterResource) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Total returns the value of the 'total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterResource) Total() *ValueUnit { + if o != nil && o.bitmap_&1 != 0 { + return o.total + } + return nil +} + +// GetTotal returns the value of the 'total' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterResource) GetTotal() (value *ValueUnit, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.total + } + return +} + +// UpdatedTimestamp returns the value of the 'updated_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterResource) UpdatedTimestamp() time.Time { + if o != nil && o.bitmap_&2 != 0 { + return o.updatedTimestamp + } + return time.Time{} +} + +// GetUpdatedTimestamp returns the value of the 'updated_timestamp' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterResource) GetUpdatedTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.updatedTimestamp + } + return +} + +// Used returns the value of the 'used' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterResource) Used() *ValueUnit { + if o != nil && o.bitmap_&4 != 0 { + return o.used + } + return nil +} + +// GetUsed returns the value of the 'used' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterResource) GetUsed() (value *ValueUnit, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.used + } + return +} + +// ClusterResourceListKind is the name of the type used to represent list of objects of +// type 'cluster_resource'. +const ClusterResourceListKind = "ClusterResourceList" + +// ClusterResourceListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_resource'. +const ClusterResourceListLinkKind = "ClusterResourceListLink" + +// ClusterResourceNilKind is the name of the type used to nil lists of objects of +// type 'cluster_resource'. +const ClusterResourceListNilKind = "ClusterResourceListNil" + +// ClusterResourceList is a list of values of the 'cluster_resource' type. +type ClusterResourceList struct { + href string + link bool + items []*ClusterResource +} + +// Len returns the length of the list. +func (l *ClusterResourceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterResourceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterResourceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterResourceList) SetItems(items []*ClusterResource) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterResourceList) Items() []*ClusterResource { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterResourceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterResourceList) Get(i int) *ClusterResource { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterResourceList) Slice() []*ClusterResource { + var slice []*ClusterResource + if l == nil { + slice = make([]*ClusterResource, 0) + } else { + slice = make([]*ClusterResource, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterResourceList) Each(f func(item *ClusterResource) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterResourceList) Range(f func(index int, item *ClusterResource) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/cluster_resource_type_json.go b/clientapi/accountsmgmt/v1/cluster_resource_type_json.go new file mode 100644 index 00000000..cb82a832 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_resource_type_json.go @@ -0,0 +1,117 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterResource writes a value of the 'cluster_resource' type to the given writer. +func MarshalClusterResource(object *ClusterResource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterResource(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterResource writes a value of the 'cluster_resource' type to the given stream. +func WriteClusterResource(object *ClusterResource, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.total != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("total") + WriteValueUnit(object.total, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_timestamp") + stream.WriteString((object.updatedTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&4 != 0 && object.used != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("used") + WriteValueUnit(object.used, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterResource reads a value of the 'cluster_resource' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterResource(source interface{}) (object *ClusterResource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterResource(iterator) + err = iterator.Error + return +} + +// ReadClusterResource reads a value of the 'cluster_resource' type from the given iterator. +func ReadClusterResource(iterator *jsoniter.Iterator) *ClusterResource { + object := &ClusterResource{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "total": + value := ReadValueUnit(iterator) + object.total = value + object.bitmap_ |= 1 + case "updated_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.updatedTimestamp = value + object.bitmap_ |= 2 + case "used": + value := ReadValueUnit(iterator) + object.used = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/cluster_upgrade_builder.go b/clientapi/accountsmgmt/v1/cluster_upgrade_builder.go new file mode 100644 index 00000000..430cefaf --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_upgrade_builder.go @@ -0,0 +1,95 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// ClusterUpgradeBuilder contains the data and logic needed to build 'cluster_upgrade' objects. +type ClusterUpgradeBuilder struct { + bitmap_ uint32 + state string + updatedTimestamp time.Time + version string + available bool +} + +// NewClusterUpgrade creates a new builder of 'cluster_upgrade' objects. +func NewClusterUpgrade() *ClusterUpgradeBuilder { + return &ClusterUpgradeBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterUpgradeBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Available sets the value of the 'available' attribute to the given value. +func (b *ClusterUpgradeBuilder) Available(value bool) *ClusterUpgradeBuilder { + b.available = value + b.bitmap_ |= 1 + return b +} + +// State sets the value of the 'state' attribute to the given value. +func (b *ClusterUpgradeBuilder) State(value string) *ClusterUpgradeBuilder { + b.state = value + b.bitmap_ |= 2 + return b +} + +// UpdatedTimestamp sets the value of the 'updated_timestamp' attribute to the given value. +func (b *ClusterUpgradeBuilder) UpdatedTimestamp(value time.Time) *ClusterUpgradeBuilder { + b.updatedTimestamp = value + b.bitmap_ |= 4 + return b +} + +// Version sets the value of the 'version' attribute to the given value. +func (b *ClusterUpgradeBuilder) Version(value string) *ClusterUpgradeBuilder { + b.version = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterUpgradeBuilder) Copy(object *ClusterUpgrade) *ClusterUpgradeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.available = object.available + b.state = object.state + b.updatedTimestamp = object.updatedTimestamp + b.version = object.version + return b +} + +// Build creates a 'cluster_upgrade' object using the configuration stored in the builder. +func (b *ClusterUpgradeBuilder) Build() (object *ClusterUpgrade, err error) { + object = new(ClusterUpgrade) + object.bitmap_ = b.bitmap_ + object.available = b.available + object.state = b.state + object.updatedTimestamp = b.updatedTimestamp + object.version = b.version + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_upgrade_list_builder.go b/clientapi/accountsmgmt/v1/cluster_upgrade_list_builder.go new file mode 100644 index 00000000..2ab67c91 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_upgrade_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ClusterUpgradeListBuilder contains the data and logic needed to build +// 'cluster_upgrade' objects. +type ClusterUpgradeListBuilder struct { + items []*ClusterUpgradeBuilder +} + +// NewClusterUpgradeList creates a new builder of 'cluster_upgrade' objects. +func NewClusterUpgradeList() *ClusterUpgradeListBuilder { + return new(ClusterUpgradeListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterUpgradeListBuilder) Items(values ...*ClusterUpgradeBuilder) *ClusterUpgradeListBuilder { + b.items = make([]*ClusterUpgradeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterUpgradeListBuilder) 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 *ClusterUpgradeListBuilder) Copy(list *ClusterUpgradeList) *ClusterUpgradeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterUpgradeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterUpgrade().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_upgrade' objects using the +// configuration stored in the builder. +func (b *ClusterUpgradeListBuilder) Build() (list *ClusterUpgradeList, err error) { + items := make([]*ClusterUpgrade, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterUpgradeList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/cluster_upgrade_list_type_json.go b/clientapi/accountsmgmt/v1/cluster_upgrade_list_type_json.go new file mode 100644 index 00000000..0f9bc94b --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_upgrade_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterUpgradeList writes a list of values of the 'cluster_upgrade' type to +// the given writer. +func MarshalClusterUpgradeList(list []*ClusterUpgrade, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterUpgradeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterUpgradeList writes a list of value of the 'cluster_upgrade' type to +// the given stream. +func WriteClusterUpgradeList(list []*ClusterUpgrade, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterUpgrade(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterUpgradeList reads a list of values of the 'cluster_upgrade' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterUpgradeList(source interface{}) (items []*ClusterUpgrade, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterUpgradeList(iterator) + err = iterator.Error + return +} + +// ReadClusterUpgradeList reads list of values of the ”cluster_upgrade' type from +// the given iterator. +func ReadClusterUpgradeList(iterator *jsoniter.Iterator) []*ClusterUpgrade { + list := []*ClusterUpgrade{} + for iterator.ReadArray() { + item := ReadClusterUpgrade(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/cluster_upgrade_type.go b/clientapi/accountsmgmt/v1/cluster_upgrade_type.go new file mode 100644 index 00000000..c1e774fb --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_upgrade_type.go @@ -0,0 +1,223 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// ClusterUpgrade represents the values of the 'cluster_upgrade' type. +type ClusterUpgrade struct { + bitmap_ uint32 + state string + updatedTimestamp time.Time + version string + available bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterUpgrade) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Available returns the value of the 'available' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterUpgrade) Available() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.available + } + return false +} + +// GetAvailable returns the value of the 'available' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterUpgrade) GetAvailable() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.available + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterUpgrade) State() string { + if o != nil && o.bitmap_&2 != 0 { + return o.state + } + return "" +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterUpgrade) GetState() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.state + } + return +} + +// UpdatedTimestamp returns the value of the 'updated_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterUpgrade) UpdatedTimestamp() time.Time { + if o != nil && o.bitmap_&4 != 0 { + return o.updatedTimestamp + } + return time.Time{} +} + +// GetUpdatedTimestamp returns the value of the 'updated_timestamp' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterUpgrade) GetUpdatedTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.updatedTimestamp + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterUpgrade) Version() string { + if o != nil && o.bitmap_&8 != 0 { + return o.version + } + return "" +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterUpgrade) GetVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.version + } + return +} + +// ClusterUpgradeListKind is the name of the type used to represent list of objects of +// type 'cluster_upgrade'. +const ClusterUpgradeListKind = "ClusterUpgradeList" + +// ClusterUpgradeListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_upgrade'. +const ClusterUpgradeListLinkKind = "ClusterUpgradeListLink" + +// ClusterUpgradeNilKind is the name of the type used to nil lists of objects of +// type 'cluster_upgrade'. +const ClusterUpgradeListNilKind = "ClusterUpgradeListNil" + +// ClusterUpgradeList is a list of values of the 'cluster_upgrade' type. +type ClusterUpgradeList struct { + href string + link bool + items []*ClusterUpgrade +} + +// Len returns the length of the list. +func (l *ClusterUpgradeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterUpgradeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterUpgradeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterUpgradeList) SetItems(items []*ClusterUpgrade) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterUpgradeList) Items() []*ClusterUpgrade { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterUpgradeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterUpgradeList) Get(i int) *ClusterUpgrade { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterUpgradeList) Slice() []*ClusterUpgrade { + var slice []*ClusterUpgrade + if l == nil { + slice = make([]*ClusterUpgrade, 0) + } else { + slice = make([]*ClusterUpgrade, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterUpgradeList) Each(f func(item *ClusterUpgrade) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterUpgradeList) Range(f func(index int, item *ClusterUpgrade) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/cluster_upgrade_type_json.go b/clientapi/accountsmgmt/v1/cluster_upgrade_type_json.go new file mode 100644 index 00000000..2aea6269 --- /dev/null +++ b/clientapi/accountsmgmt/v1/cluster_upgrade_type_json.go @@ -0,0 +1,130 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterUpgrade writes a value of the 'cluster_upgrade' type to the given writer. +func MarshalClusterUpgrade(object *ClusterUpgrade, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterUpgrade(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterUpgrade writes a value of the 'cluster_upgrade' type to the given stream. +func WriteClusterUpgrade(object *ClusterUpgrade, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("available") + stream.WriteBool(object.available) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(object.state) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_timestamp") + stream.WriteString((object.updatedTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + stream.WriteString(object.version) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterUpgrade reads a value of the 'cluster_upgrade' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterUpgrade(source interface{}) (object *ClusterUpgrade, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterUpgrade(iterator) + err = iterator.Error + return +} + +// ReadClusterUpgrade reads a value of the 'cluster_upgrade' type from the given iterator. +func ReadClusterUpgrade(iterator *jsoniter.Iterator) *ClusterUpgrade { + object := &ClusterUpgrade{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "available": + value := iterator.ReadBool() + object.available = value + object.bitmap_ |= 1 + case "state": + value := iterator.ReadString() + object.state = value + object.bitmap_ |= 2 + case "updated_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.updatedTimestamp = value + object.bitmap_ |= 4 + case "version": + value := iterator.ReadString() + object.version = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/contract_builder.go b/clientapi/accountsmgmt/v1/contract_builder.go new file mode 100644 index 00000000..9b4063f4 --- /dev/null +++ b/clientapi/accountsmgmt/v1/contract_builder.go @@ -0,0 +1,101 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// ContractBuilder contains the data and logic needed to build 'contract' objects. +type ContractBuilder struct { + bitmap_ uint32 + dimensions []*ContractDimensionBuilder + endDate time.Time + startDate time.Time +} + +// NewContract creates a new builder of 'contract' objects. +func NewContract() *ContractBuilder { + return &ContractBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ContractBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Dimensions sets the value of the 'dimensions' attribute to the given values. +func (b *ContractBuilder) Dimensions(values ...*ContractDimensionBuilder) *ContractBuilder { + b.dimensions = make([]*ContractDimensionBuilder, len(values)) + copy(b.dimensions, values) + b.bitmap_ |= 1 + return b +} + +// EndDate sets the value of the 'end_date' attribute to the given value. +func (b *ContractBuilder) EndDate(value time.Time) *ContractBuilder { + b.endDate = value + b.bitmap_ |= 2 + return b +} + +// StartDate sets the value of the 'start_date' attribute to the given value. +func (b *ContractBuilder) StartDate(value time.Time) *ContractBuilder { + b.startDate = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ContractBuilder) Copy(object *Contract) *ContractBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.dimensions != nil { + b.dimensions = make([]*ContractDimensionBuilder, len(object.dimensions)) + for i, v := range object.dimensions { + b.dimensions[i] = NewContractDimension().Copy(v) + } + } else { + b.dimensions = nil + } + b.endDate = object.endDate + b.startDate = object.startDate + return b +} + +// Build creates a 'contract' object using the configuration stored in the builder. +func (b *ContractBuilder) Build() (object *Contract, err error) { + object = new(Contract) + object.bitmap_ = b.bitmap_ + if b.dimensions != nil { + object.dimensions = make([]*ContractDimension, len(b.dimensions)) + for i, v := range b.dimensions { + object.dimensions[i], err = v.Build() + if err != nil { + return + } + } + } + object.endDate = b.endDate + object.startDate = b.startDate + return +} diff --git a/clientapi/accountsmgmt/v1/contract_dimension_builder.go b/clientapi/accountsmgmt/v1/contract_dimension_builder.go new file mode 100644 index 00000000..5008f9d8 --- /dev/null +++ b/clientapi/accountsmgmt/v1/contract_dimension_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ContractDimensionBuilder contains the data and logic needed to build 'contract_dimension' objects. +type ContractDimensionBuilder struct { + bitmap_ uint32 + name string + value string +} + +// NewContractDimension creates a new builder of 'contract_dimension' objects. +func NewContractDimension() *ContractDimensionBuilder { + return &ContractDimensionBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ContractDimensionBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ContractDimensionBuilder) Name(value string) *ContractDimensionBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *ContractDimensionBuilder) Value(value string) *ContractDimensionBuilder { + b.value = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ContractDimensionBuilder) Copy(object *ContractDimension) *ContractDimensionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + b.value = object.value + return b +} + +// Build creates a 'contract_dimension' object using the configuration stored in the builder. +func (b *ContractDimensionBuilder) Build() (object *ContractDimension, err error) { + object = new(ContractDimension) + object.bitmap_ = b.bitmap_ + object.name = b.name + object.value = b.value + return +} diff --git a/clientapi/accountsmgmt/v1/contract_dimension_list_builder.go b/clientapi/accountsmgmt/v1/contract_dimension_list_builder.go new file mode 100644 index 00000000..47c9bcbc --- /dev/null +++ b/clientapi/accountsmgmt/v1/contract_dimension_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ContractDimensionListBuilder contains the data and logic needed to build +// 'contract_dimension' objects. +type ContractDimensionListBuilder struct { + items []*ContractDimensionBuilder +} + +// NewContractDimensionList creates a new builder of 'contract_dimension' objects. +func NewContractDimensionList() *ContractDimensionListBuilder { + return new(ContractDimensionListBuilder) +} + +// Items sets the items of the list. +func (b *ContractDimensionListBuilder) Items(values ...*ContractDimensionBuilder) *ContractDimensionListBuilder { + b.items = make([]*ContractDimensionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ContractDimensionListBuilder) 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 *ContractDimensionListBuilder) Copy(list *ContractDimensionList) *ContractDimensionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ContractDimensionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewContractDimension().Copy(v) + } + } + return b +} + +// Build creates a list of 'contract_dimension' objects using the +// configuration stored in the builder. +func (b *ContractDimensionListBuilder) Build() (list *ContractDimensionList, err error) { + items := make([]*ContractDimension, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ContractDimensionList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/contract_dimension_list_type_json.go b/clientapi/accountsmgmt/v1/contract_dimension_list_type_json.go new file mode 100644 index 00000000..63d140df --- /dev/null +++ b/clientapi/accountsmgmt/v1/contract_dimension_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalContractDimensionList writes a list of values of the 'contract_dimension' type to +// the given writer. +func MarshalContractDimensionList(list []*ContractDimension, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteContractDimensionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteContractDimensionList writes a list of value of the 'contract_dimension' type to +// the given stream. +func WriteContractDimensionList(list []*ContractDimension, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteContractDimension(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalContractDimensionList reads a list of values of the 'contract_dimension' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalContractDimensionList(source interface{}) (items []*ContractDimension, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadContractDimensionList(iterator) + err = iterator.Error + return +} + +// ReadContractDimensionList reads list of values of the ”contract_dimension' type from +// the given iterator. +func ReadContractDimensionList(iterator *jsoniter.Iterator) []*ContractDimension { + list := []*ContractDimension{} + for iterator.ReadArray() { + item := ReadContractDimension(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/contract_dimension_type.go b/clientapi/accountsmgmt/v1/contract_dimension_type.go new file mode 100644 index 00000000..f5950199 --- /dev/null +++ b/clientapi/accountsmgmt/v1/contract_dimension_type.go @@ -0,0 +1,179 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ContractDimension represents the values of the 'contract_dimension' type. +type ContractDimension struct { + bitmap_ uint32 + name string + value string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ContractDimension) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ContractDimension) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *ContractDimension) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ContractDimension) Value() string { + if o != nil && o.bitmap_&2 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +func (o *ContractDimension) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.value + } + return +} + +// ContractDimensionListKind is the name of the type used to represent list of objects of +// type 'contract_dimension'. +const ContractDimensionListKind = "ContractDimensionList" + +// ContractDimensionListLinkKind is the name of the type used to represent links to list +// of objects of type 'contract_dimension'. +const ContractDimensionListLinkKind = "ContractDimensionListLink" + +// ContractDimensionNilKind is the name of the type used to nil lists of objects of +// type 'contract_dimension'. +const ContractDimensionListNilKind = "ContractDimensionListNil" + +// ContractDimensionList is a list of values of the 'contract_dimension' type. +type ContractDimensionList struct { + href string + link bool + items []*ContractDimension +} + +// Len returns the length of the list. +func (l *ContractDimensionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ContractDimensionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ContractDimensionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ContractDimensionList) SetItems(items []*ContractDimension) { + l.items = items +} + +// Items returns the items of the list. +func (l *ContractDimensionList) Items() []*ContractDimension { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ContractDimensionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ContractDimensionList) Get(i int) *ContractDimension { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ContractDimensionList) Slice() []*ContractDimension { + var slice []*ContractDimension + if l == nil { + slice = make([]*ContractDimension, 0) + } else { + slice = make([]*ContractDimension, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ContractDimensionList) Each(f func(item *ContractDimension) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ContractDimensionList) Range(f func(index int, item *ContractDimension) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/contract_dimension_type_json.go b/clientapi/accountsmgmt/v1/contract_dimension_type_json.go new file mode 100644 index 00000000..925cf24f --- /dev/null +++ b/clientapi/accountsmgmt/v1/contract_dimension_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalContractDimension writes a value of the 'contract_dimension' type to the given writer. +func MarshalContractDimension(object *ContractDimension, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteContractDimension(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteContractDimension writes a value of the 'contract_dimension' type to the given stream. +func WriteContractDimension(object *ContractDimension, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalContractDimension reads a value of the 'contract_dimension' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalContractDimension(source interface{}) (object *ContractDimension, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadContractDimension(iterator) + err = iterator.Error + return +} + +// ReadContractDimension reads a value of the 'contract_dimension' type from the given iterator. +func ReadContractDimension(iterator *jsoniter.Iterator) *ContractDimension { + object := &ContractDimension{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/contract_list_builder.go b/clientapi/accountsmgmt/v1/contract_list_builder.go new file mode 100644 index 00000000..50191704 --- /dev/null +++ b/clientapi/accountsmgmt/v1/contract_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ContractListBuilder contains the data and logic needed to build +// 'contract' objects. +type ContractListBuilder struct { + items []*ContractBuilder +} + +// NewContractList creates a new builder of 'contract' objects. +func NewContractList() *ContractListBuilder { + return new(ContractListBuilder) +} + +// Items sets the items of the list. +func (b *ContractListBuilder) Items(values ...*ContractBuilder) *ContractListBuilder { + b.items = make([]*ContractBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ContractListBuilder) 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 *ContractListBuilder) Copy(list *ContractList) *ContractListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ContractBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewContract().Copy(v) + } + } + return b +} + +// Build creates a list of 'contract' objects using the +// configuration stored in the builder. +func (b *ContractListBuilder) Build() (list *ContractList, err error) { + items := make([]*Contract, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ContractList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/contract_list_type_json.go b/clientapi/accountsmgmt/v1/contract_list_type_json.go new file mode 100644 index 00000000..f7a12497 --- /dev/null +++ b/clientapi/accountsmgmt/v1/contract_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalContractList writes a list of values of the 'contract' type to +// the given writer. +func MarshalContractList(list []*Contract, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteContractList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteContractList writes a list of value of the 'contract' type to +// the given stream. +func WriteContractList(list []*Contract, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteContract(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalContractList reads a list of values of the 'contract' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalContractList(source interface{}) (items []*Contract, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadContractList(iterator) + err = iterator.Error + return +} + +// ReadContractList reads list of values of the ”contract' type from +// the given iterator. +func ReadContractList(iterator *jsoniter.Iterator) []*Contract { + list := []*Contract{} + for iterator.ReadArray() { + item := ReadContract(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/contract_type.go b/clientapi/accountsmgmt/v1/contract_type.go new file mode 100644 index 00000000..9b4946d1 --- /dev/null +++ b/clientapi/accountsmgmt/v1/contract_type.go @@ -0,0 +1,203 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// Contract represents the values of the 'contract' type. +type Contract struct { + bitmap_ uint32 + dimensions []*ContractDimension + endDate time.Time + startDate time.Time +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Contract) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Dimensions returns the value of the 'dimensions' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Contract) Dimensions() []*ContractDimension { + if o != nil && o.bitmap_&1 != 0 { + return o.dimensions + } + return nil +} + +// GetDimensions returns the value of the 'dimensions' attribute and +// a flag indicating if the attribute has a value. +func (o *Contract) GetDimensions() (value []*ContractDimension, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.dimensions + } + return +} + +// EndDate returns the value of the 'end_date' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Contract) EndDate() time.Time { + if o != nil && o.bitmap_&2 != 0 { + return o.endDate + } + return time.Time{} +} + +// GetEndDate returns the value of the 'end_date' attribute and +// a flag indicating if the attribute has a value. +func (o *Contract) GetEndDate() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.endDate + } + return +} + +// StartDate returns the value of the 'start_date' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Contract) StartDate() time.Time { + if o != nil && o.bitmap_&4 != 0 { + return o.startDate + } + return time.Time{} +} + +// GetStartDate returns the value of the 'start_date' attribute and +// a flag indicating if the attribute has a value. +func (o *Contract) GetStartDate() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.startDate + } + return +} + +// ContractListKind is the name of the type used to represent list of objects of +// type 'contract'. +const ContractListKind = "ContractList" + +// ContractListLinkKind is the name of the type used to represent links to list +// of objects of type 'contract'. +const ContractListLinkKind = "ContractListLink" + +// ContractNilKind is the name of the type used to nil lists of objects of +// type 'contract'. +const ContractListNilKind = "ContractListNil" + +// ContractList is a list of values of the 'contract' type. +type ContractList struct { + href string + link bool + items []*Contract +} + +// Len returns the length of the list. +func (l *ContractList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ContractList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ContractList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ContractList) SetItems(items []*Contract) { + l.items = items +} + +// Items returns the items of the list. +func (l *ContractList) Items() []*Contract { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ContractList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ContractList) Get(i int) *Contract { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ContractList) Slice() []*Contract { + var slice []*Contract + if l == nil { + slice = make([]*Contract, 0) + } else { + slice = make([]*Contract, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ContractList) Each(f func(item *Contract) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ContractList) Range(f func(index int, item *Contract) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/contract_type_json.go b/clientapi/accountsmgmt/v1/contract_type_json.go new file mode 100644 index 00000000..e6fa2ff9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/contract_type_json.go @@ -0,0 +1,121 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalContract writes a value of the 'contract' type to the given writer. +func MarshalContract(object *Contract, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteContract(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteContract writes a value of the 'contract' type to the given stream. +func WriteContract(object *Contract, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.dimensions != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("dimensions") + WriteContractDimensionList(object.dimensions, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("end_date") + stream.WriteString((object.endDate).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("start_date") + stream.WriteString((object.startDate).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalContract reads a value of the 'contract' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalContract(source interface{}) (object *Contract, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadContract(iterator) + err = iterator.Error + return +} + +// ReadContract reads a value of the 'contract' type from the given iterator. +func ReadContract(iterator *jsoniter.Iterator) *Contract { + object := &Contract{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "dimensions": + value := ReadContractDimensionList(iterator) + object.dimensions = value + object.bitmap_ |= 1 + case "end_date": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.endDate = value + object.bitmap_ |= 2 + case "start_date": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.startDate = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/date_list_type_json.go b/clientapi/accountsmgmt/v1/date_list_type_json.go new file mode 100644 index 00000000..8d41e69d --- /dev/null +++ b/clientapi/accountsmgmt/v1/date_list_type_json.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDateList writes a list of values of the 'date' type to +// the given writer. +func MarshalDateList(list []time.Time, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDateList writes a list of value of the 'date' type to +// the given stream. +func WriteDateList(list []time.Time, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString((value).Format(time.RFC3339)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDateList reads a list of values of the 'date' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDateList(source interface{}) (items []time.Time, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDateList(iterator) + err = iterator.Error + return +} + +// ReadDateList reads list of values of the ”date' type from +// the given iterator. +func ReadDateList(iterator *jsoniter.Iterator) []time.Time { + list := []time.Time{} + for iterator.ReadArray() { + text := iterator.ReadString() + item, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/default_capability_builder.go b/clientapi/accountsmgmt/v1/default_capability_builder.go new file mode 100644 index 00000000..64b56054 --- /dev/null +++ b/clientapi/accountsmgmt/v1/default_capability_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// DefaultCapabilityBuilder contains the data and logic needed to build 'default_capability' objects. +type DefaultCapabilityBuilder struct { + bitmap_ uint32 + name string + value string +} + +// NewDefaultCapability creates a new builder of 'default_capability' objects. +func NewDefaultCapability() *DefaultCapabilityBuilder { + return &DefaultCapabilityBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *DefaultCapabilityBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *DefaultCapabilityBuilder) Name(value string) *DefaultCapabilityBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *DefaultCapabilityBuilder) Value(value string) *DefaultCapabilityBuilder { + b.value = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *DefaultCapabilityBuilder) Copy(object *DefaultCapability) *DefaultCapabilityBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + b.value = object.value + return b +} + +// Build creates a 'default_capability' object using the configuration stored in the builder. +func (b *DefaultCapabilityBuilder) Build() (object *DefaultCapability, err error) { + object = new(DefaultCapability) + object.bitmap_ = b.bitmap_ + object.name = b.name + object.value = b.value + return +} diff --git a/clientapi/accountsmgmt/v1/default_capability_list_builder.go b/clientapi/accountsmgmt/v1/default_capability_list_builder.go new file mode 100644 index 00000000..7141ecd6 --- /dev/null +++ b/clientapi/accountsmgmt/v1/default_capability_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// DefaultCapabilityListBuilder contains the data and logic needed to build +// 'default_capability' objects. +type DefaultCapabilityListBuilder struct { + items []*DefaultCapabilityBuilder +} + +// NewDefaultCapabilityList creates a new builder of 'default_capability' objects. +func NewDefaultCapabilityList() *DefaultCapabilityListBuilder { + return new(DefaultCapabilityListBuilder) +} + +// Items sets the items of the list. +func (b *DefaultCapabilityListBuilder) Items(values ...*DefaultCapabilityBuilder) *DefaultCapabilityListBuilder { + b.items = make([]*DefaultCapabilityBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *DefaultCapabilityListBuilder) 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 *DefaultCapabilityListBuilder) Copy(list *DefaultCapabilityList) *DefaultCapabilityListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*DefaultCapabilityBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewDefaultCapability().Copy(v) + } + } + return b +} + +// Build creates a list of 'default_capability' objects using the +// configuration stored in the builder. +func (b *DefaultCapabilityListBuilder) Build() (list *DefaultCapabilityList, err error) { + items := make([]*DefaultCapability, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(DefaultCapabilityList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/default_capability_list_type_json.go b/clientapi/accountsmgmt/v1/default_capability_list_type_json.go new file mode 100644 index 00000000..a24342c5 --- /dev/null +++ b/clientapi/accountsmgmt/v1/default_capability_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDefaultCapabilityList writes a list of values of the 'default_capability' type to +// the given writer. +func MarshalDefaultCapabilityList(list []*DefaultCapability, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDefaultCapabilityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDefaultCapabilityList writes a list of value of the 'default_capability' type to +// the given stream. +func WriteDefaultCapabilityList(list []*DefaultCapability, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteDefaultCapability(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalDefaultCapabilityList reads a list of values of the 'default_capability' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDefaultCapabilityList(source interface{}) (items []*DefaultCapability, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDefaultCapabilityList(iterator) + err = iterator.Error + return +} + +// ReadDefaultCapabilityList reads list of values of the ”default_capability' type from +// the given iterator. +func ReadDefaultCapabilityList(iterator *jsoniter.Iterator) []*DefaultCapability { + list := []*DefaultCapability{} + for iterator.ReadArray() { + item := ReadDefaultCapability(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/default_capability_type.go b/clientapi/accountsmgmt/v1/default_capability_type.go new file mode 100644 index 00000000..d4db08ca --- /dev/null +++ b/clientapi/accountsmgmt/v1/default_capability_type.go @@ -0,0 +1,187 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// DefaultCapability represents the values of the 'default_capability' type. +type DefaultCapability struct { + bitmap_ uint32 + name string + value string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *DefaultCapability) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the default capability (the key). +func (o *DefaultCapability) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the default capability (the key). +func (o *DefaultCapability) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Value of the default capability. +func (o *DefaultCapability) Value() string { + if o != nil && o.bitmap_&2 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Value of the default capability. +func (o *DefaultCapability) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.value + } + return +} + +// DefaultCapabilityListKind is the name of the type used to represent list of objects of +// type 'default_capability'. +const DefaultCapabilityListKind = "DefaultCapabilityList" + +// DefaultCapabilityListLinkKind is the name of the type used to represent links to list +// of objects of type 'default_capability'. +const DefaultCapabilityListLinkKind = "DefaultCapabilityListLink" + +// DefaultCapabilityNilKind is the name of the type used to nil lists of objects of +// type 'default_capability'. +const DefaultCapabilityListNilKind = "DefaultCapabilityListNil" + +// DefaultCapabilityList is a list of values of the 'default_capability' type. +type DefaultCapabilityList struct { + href string + link bool + items []*DefaultCapability +} + +// Len returns the length of the list. +func (l *DefaultCapabilityList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *DefaultCapabilityList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *DefaultCapabilityList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *DefaultCapabilityList) SetItems(items []*DefaultCapability) { + l.items = items +} + +// Items returns the items of the list. +func (l *DefaultCapabilityList) Items() []*DefaultCapability { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *DefaultCapabilityList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *DefaultCapabilityList) Get(i int) *DefaultCapability { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *DefaultCapabilityList) Slice() []*DefaultCapability { + var slice []*DefaultCapability + if l == nil { + slice = make([]*DefaultCapability, 0) + } else { + slice = make([]*DefaultCapability, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *DefaultCapabilityList) Each(f func(item *DefaultCapability) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *DefaultCapabilityList) Range(f func(index int, item *DefaultCapability) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/default_capability_type_json.go b/clientapi/accountsmgmt/v1/default_capability_type_json.go new file mode 100644 index 00000000..a80d9453 --- /dev/null +++ b/clientapi/accountsmgmt/v1/default_capability_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDefaultCapability writes a value of the 'default_capability' type to the given writer. +func MarshalDefaultCapability(object *DefaultCapability, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDefaultCapability(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDefaultCapability writes a value of the 'default_capability' type to the given stream. +func WriteDefaultCapability(object *DefaultCapability, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalDefaultCapability reads a value of the 'default_capability' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalDefaultCapability(source interface{}) (object *DefaultCapability, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadDefaultCapability(iterator) + err = iterator.Error + return +} + +// ReadDefaultCapability reads a value of the 'default_capability' type from the given iterator. +func ReadDefaultCapability(iterator *jsoniter.Iterator) *DefaultCapability { + object := &DefaultCapability{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/deleted_subscription_builder.go b/clientapi/accountsmgmt/v1/deleted_subscription_builder.go new file mode 100644 index 00000000..6b272b2a --- /dev/null +++ b/clientapi/accountsmgmt/v1/deleted_subscription_builder.go @@ -0,0 +1,403 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// DeletedSubscriptionBuilder contains the data and logic needed to build 'deleted_subscription' objects. +type DeletedSubscriptionBuilder struct { + bitmap_ uint64 + id string + href string + billingExpirationDate time.Time + billingMarketplaceAccount string + cloudAccountID string + cloudProviderID string + clusterID string + clusterBillingModel BillingModel + consoleURL string + consumerUUID string + cpuTotal int + createdAt time.Time + creatorId string + displayName string + externalClusterID string + lastReconcileDate time.Time + lastReleasedAt time.Time + lastTelemetryDate time.Time + metrics string + organizationID string + planID string + productBundle string + provenance string + queryTimestamp time.Time + regionID string + serviceLevel string + socketTotal int + status string + supportLevel string + systemUnits string + trialEndDate time.Time + usage string + managed bool + released bool +} + +// NewDeletedSubscription creates a new builder of 'deleted_subscription' objects. +func NewDeletedSubscription() *DeletedSubscriptionBuilder { + return &DeletedSubscriptionBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *DeletedSubscriptionBuilder) Link(value bool) *DeletedSubscriptionBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *DeletedSubscriptionBuilder) ID(value string) *DeletedSubscriptionBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *DeletedSubscriptionBuilder) HREF(value string) *DeletedSubscriptionBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *DeletedSubscriptionBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// BillingExpirationDate sets the value of the 'billing_expiration_date' attribute to the given value. +func (b *DeletedSubscriptionBuilder) BillingExpirationDate(value time.Time) *DeletedSubscriptionBuilder { + b.billingExpirationDate = value + b.bitmap_ |= 8 + return b +} + +// BillingMarketplaceAccount sets the value of the 'billing_marketplace_account' attribute to the given value. +func (b *DeletedSubscriptionBuilder) BillingMarketplaceAccount(value string) *DeletedSubscriptionBuilder { + b.billingMarketplaceAccount = value + b.bitmap_ |= 16 + return b +} + +// CloudAccountID sets the value of the 'cloud_account_ID' attribute to the given value. +func (b *DeletedSubscriptionBuilder) CloudAccountID(value string) *DeletedSubscriptionBuilder { + b.cloudAccountID = value + b.bitmap_ |= 32 + return b +} + +// CloudProviderID sets the value of the 'cloud_provider_ID' attribute to the given value. +func (b *DeletedSubscriptionBuilder) CloudProviderID(value string) *DeletedSubscriptionBuilder { + b.cloudProviderID = value + b.bitmap_ |= 64 + return b +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *DeletedSubscriptionBuilder) ClusterID(value string) *DeletedSubscriptionBuilder { + b.clusterID = value + b.bitmap_ |= 128 + return b +} + +// ClusterBillingModel sets the value of the 'cluster_billing_model' attribute to the given value. +// +// Billing model for subscripiton and reserved_resource resources. +func (b *DeletedSubscriptionBuilder) ClusterBillingModel(value BillingModel) *DeletedSubscriptionBuilder { + b.clusterBillingModel = value + b.bitmap_ |= 256 + return b +} + +// ConsoleURL sets the value of the 'console_URL' attribute to the given value. +func (b *DeletedSubscriptionBuilder) ConsoleURL(value string) *DeletedSubscriptionBuilder { + b.consoleURL = value + b.bitmap_ |= 512 + return b +} + +// ConsumerUUID sets the value of the 'consumer_UUID' attribute to the given value. +func (b *DeletedSubscriptionBuilder) ConsumerUUID(value string) *DeletedSubscriptionBuilder { + b.consumerUUID = value + b.bitmap_ |= 1024 + return b +} + +// CpuTotal sets the value of the 'cpu_total' attribute to the given value. +func (b *DeletedSubscriptionBuilder) CpuTotal(value int) *DeletedSubscriptionBuilder { + b.cpuTotal = value + b.bitmap_ |= 2048 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *DeletedSubscriptionBuilder) CreatedAt(value time.Time) *DeletedSubscriptionBuilder { + b.createdAt = value + b.bitmap_ |= 4096 + return b +} + +// CreatorId sets the value of the 'creator_id' attribute to the given value. +func (b *DeletedSubscriptionBuilder) CreatorId(value string) *DeletedSubscriptionBuilder { + b.creatorId = value + b.bitmap_ |= 8192 + return b +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *DeletedSubscriptionBuilder) DisplayName(value string) *DeletedSubscriptionBuilder { + b.displayName = value + b.bitmap_ |= 16384 + return b +} + +// ExternalClusterID sets the value of the 'external_cluster_ID' attribute to the given value. +func (b *DeletedSubscriptionBuilder) ExternalClusterID(value string) *DeletedSubscriptionBuilder { + b.externalClusterID = value + b.bitmap_ |= 32768 + return b +} + +// LastReconcileDate sets the value of the 'last_reconcile_date' attribute to the given value. +func (b *DeletedSubscriptionBuilder) LastReconcileDate(value time.Time) *DeletedSubscriptionBuilder { + b.lastReconcileDate = value + b.bitmap_ |= 65536 + return b +} + +// LastReleasedAt sets the value of the 'last_released_at' attribute to the given value. +func (b *DeletedSubscriptionBuilder) LastReleasedAt(value time.Time) *DeletedSubscriptionBuilder { + b.lastReleasedAt = value + b.bitmap_ |= 131072 + return b +} + +// LastTelemetryDate sets the value of the 'last_telemetry_date' attribute to the given value. +func (b *DeletedSubscriptionBuilder) LastTelemetryDate(value time.Time) *DeletedSubscriptionBuilder { + b.lastTelemetryDate = value + b.bitmap_ |= 262144 + return b +} + +// Managed sets the value of the 'managed' attribute to the given value. +func (b *DeletedSubscriptionBuilder) Managed(value bool) *DeletedSubscriptionBuilder { + b.managed = value + b.bitmap_ |= 524288 + return b +} + +// Metrics sets the value of the 'metrics' attribute to the given value. +func (b *DeletedSubscriptionBuilder) Metrics(value string) *DeletedSubscriptionBuilder { + b.metrics = value + b.bitmap_ |= 1048576 + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *DeletedSubscriptionBuilder) OrganizationID(value string) *DeletedSubscriptionBuilder { + b.organizationID = value + b.bitmap_ |= 2097152 + return b +} + +// PlanID sets the value of the 'plan_ID' attribute to the given value. +func (b *DeletedSubscriptionBuilder) PlanID(value string) *DeletedSubscriptionBuilder { + b.planID = value + b.bitmap_ |= 4194304 + return b +} + +// ProductBundle sets the value of the 'product_bundle' attribute to the given value. +func (b *DeletedSubscriptionBuilder) ProductBundle(value string) *DeletedSubscriptionBuilder { + b.productBundle = value + b.bitmap_ |= 8388608 + return b +} + +// Provenance sets the value of the 'provenance' attribute to the given value. +func (b *DeletedSubscriptionBuilder) Provenance(value string) *DeletedSubscriptionBuilder { + b.provenance = value + b.bitmap_ |= 16777216 + return b +} + +// QueryTimestamp sets the value of the 'query_timestamp' attribute to the given value. +func (b *DeletedSubscriptionBuilder) QueryTimestamp(value time.Time) *DeletedSubscriptionBuilder { + b.queryTimestamp = value + b.bitmap_ |= 33554432 + return b +} + +// RegionID sets the value of the 'region_ID' attribute to the given value. +func (b *DeletedSubscriptionBuilder) RegionID(value string) *DeletedSubscriptionBuilder { + b.regionID = value + b.bitmap_ |= 67108864 + return b +} + +// Released sets the value of the 'released' attribute to the given value. +func (b *DeletedSubscriptionBuilder) Released(value bool) *DeletedSubscriptionBuilder { + b.released = value + b.bitmap_ |= 134217728 + return b +} + +// ServiceLevel sets the value of the 'service_level' attribute to the given value. +func (b *DeletedSubscriptionBuilder) ServiceLevel(value string) *DeletedSubscriptionBuilder { + b.serviceLevel = value + b.bitmap_ |= 268435456 + return b +} + +// SocketTotal sets the value of the 'socket_total' attribute to the given value. +func (b *DeletedSubscriptionBuilder) SocketTotal(value int) *DeletedSubscriptionBuilder { + b.socketTotal = value + b.bitmap_ |= 536870912 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *DeletedSubscriptionBuilder) Status(value string) *DeletedSubscriptionBuilder { + b.status = value + b.bitmap_ |= 1073741824 + return b +} + +// SupportLevel sets the value of the 'support_level' attribute to the given value. +func (b *DeletedSubscriptionBuilder) SupportLevel(value string) *DeletedSubscriptionBuilder { + b.supportLevel = value + b.bitmap_ |= 2147483648 + return b +} + +// SystemUnits sets the value of the 'system_units' attribute to the given value. +func (b *DeletedSubscriptionBuilder) SystemUnits(value string) *DeletedSubscriptionBuilder { + b.systemUnits = value + b.bitmap_ |= 4294967296 + return b +} + +// TrialEndDate sets the value of the 'trial_end_date' attribute to the given value. +func (b *DeletedSubscriptionBuilder) TrialEndDate(value time.Time) *DeletedSubscriptionBuilder { + b.trialEndDate = value + b.bitmap_ |= 8589934592 + return b +} + +// Usage sets the value of the 'usage' attribute to the given value. +func (b *DeletedSubscriptionBuilder) Usage(value string) *DeletedSubscriptionBuilder { + b.usage = value + b.bitmap_ |= 17179869184 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *DeletedSubscriptionBuilder) Copy(object *DeletedSubscription) *DeletedSubscriptionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.billingExpirationDate = object.billingExpirationDate + b.billingMarketplaceAccount = object.billingMarketplaceAccount + b.cloudAccountID = object.cloudAccountID + b.cloudProviderID = object.cloudProviderID + b.clusterID = object.clusterID + b.clusterBillingModel = object.clusterBillingModel + b.consoleURL = object.consoleURL + b.consumerUUID = object.consumerUUID + b.cpuTotal = object.cpuTotal + b.createdAt = object.createdAt + b.creatorId = object.creatorId + b.displayName = object.displayName + b.externalClusterID = object.externalClusterID + b.lastReconcileDate = object.lastReconcileDate + b.lastReleasedAt = object.lastReleasedAt + b.lastTelemetryDate = object.lastTelemetryDate + b.managed = object.managed + b.metrics = object.metrics + b.organizationID = object.organizationID + b.planID = object.planID + b.productBundle = object.productBundle + b.provenance = object.provenance + b.queryTimestamp = object.queryTimestamp + b.regionID = object.regionID + b.released = object.released + b.serviceLevel = object.serviceLevel + b.socketTotal = object.socketTotal + b.status = object.status + b.supportLevel = object.supportLevel + b.systemUnits = object.systemUnits + b.trialEndDate = object.trialEndDate + b.usage = object.usage + return b +} + +// Build creates a 'deleted_subscription' object using the configuration stored in the builder. +func (b *DeletedSubscriptionBuilder) Build() (object *DeletedSubscription, err error) { + object = new(DeletedSubscription) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.billingExpirationDate = b.billingExpirationDate + object.billingMarketplaceAccount = b.billingMarketplaceAccount + object.cloudAccountID = b.cloudAccountID + object.cloudProviderID = b.cloudProviderID + object.clusterID = b.clusterID + object.clusterBillingModel = b.clusterBillingModel + object.consoleURL = b.consoleURL + object.consumerUUID = b.consumerUUID + object.cpuTotal = b.cpuTotal + object.createdAt = b.createdAt + object.creatorId = b.creatorId + object.displayName = b.displayName + object.externalClusterID = b.externalClusterID + object.lastReconcileDate = b.lastReconcileDate + object.lastReleasedAt = b.lastReleasedAt + object.lastTelemetryDate = b.lastTelemetryDate + object.managed = b.managed + object.metrics = b.metrics + object.organizationID = b.organizationID + object.planID = b.planID + object.productBundle = b.productBundle + object.provenance = b.provenance + object.queryTimestamp = b.queryTimestamp + object.regionID = b.regionID + object.released = b.released + object.serviceLevel = b.serviceLevel + object.socketTotal = b.socketTotal + object.status = b.status + object.supportLevel = b.supportLevel + object.systemUnits = b.systemUnits + object.trialEndDate = b.trialEndDate + object.usage = b.usage + return +} diff --git a/clientapi/accountsmgmt/v1/deleted_subscription_list_builder.go b/clientapi/accountsmgmt/v1/deleted_subscription_list_builder.go new file mode 100644 index 00000000..54b190a9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/deleted_subscription_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// DeletedSubscriptionListBuilder contains the data and logic needed to build +// 'deleted_subscription' objects. +type DeletedSubscriptionListBuilder struct { + items []*DeletedSubscriptionBuilder +} + +// NewDeletedSubscriptionList creates a new builder of 'deleted_subscription' objects. +func NewDeletedSubscriptionList() *DeletedSubscriptionListBuilder { + return new(DeletedSubscriptionListBuilder) +} + +// Items sets the items of the list. +func (b *DeletedSubscriptionListBuilder) Items(values ...*DeletedSubscriptionBuilder) *DeletedSubscriptionListBuilder { + b.items = make([]*DeletedSubscriptionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *DeletedSubscriptionListBuilder) 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 *DeletedSubscriptionListBuilder) Copy(list *DeletedSubscriptionList) *DeletedSubscriptionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*DeletedSubscriptionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewDeletedSubscription().Copy(v) + } + } + return b +} + +// Build creates a list of 'deleted_subscription' objects using the +// configuration stored in the builder. +func (b *DeletedSubscriptionListBuilder) Build() (list *DeletedSubscriptionList, err error) { + items := make([]*DeletedSubscription, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(DeletedSubscriptionList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/deleted_subscription_list_type_json.go b/clientapi/accountsmgmt/v1/deleted_subscription_list_type_json.go new file mode 100644 index 00000000..28361a7c --- /dev/null +++ b/clientapi/accountsmgmt/v1/deleted_subscription_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDeletedSubscriptionList writes a list of values of the 'deleted_subscription' type to +// the given writer. +func MarshalDeletedSubscriptionList(list []*DeletedSubscription, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDeletedSubscriptionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDeletedSubscriptionList writes a list of value of the 'deleted_subscription' type to +// the given stream. +func WriteDeletedSubscriptionList(list []*DeletedSubscription, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteDeletedSubscription(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalDeletedSubscriptionList reads a list of values of the 'deleted_subscription' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDeletedSubscriptionList(source interface{}) (items []*DeletedSubscription, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDeletedSubscriptionList(iterator) + err = iterator.Error + return +} + +// ReadDeletedSubscriptionList reads list of values of the ”deleted_subscription' type from +// the given iterator. +func ReadDeletedSubscriptionList(iterator *jsoniter.Iterator) []*DeletedSubscription { + list := []*DeletedSubscription{} + for iterator.ReadArray() { + item := ReadDeletedSubscription(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/deleted_subscription_type.go b/clientapi/accountsmgmt/v1/deleted_subscription_type.go new file mode 100644 index 00000000..84d3fc28 --- /dev/null +++ b/clientapi/accountsmgmt/v1/deleted_subscription_type.go @@ -0,0 +1,883 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// DeletedSubscriptionKind is the name of the type used to represent objects +// of type 'deleted_subscription'. +const DeletedSubscriptionKind = "DeletedSubscription" + +// DeletedSubscriptionLinkKind is the name of the type used to represent links +// to objects of type 'deleted_subscription'. +const DeletedSubscriptionLinkKind = "DeletedSubscriptionLink" + +// DeletedSubscriptionNilKind is the name of the type used to nil references +// to objects of type 'deleted_subscription'. +const DeletedSubscriptionNilKind = "DeletedSubscriptionNil" + +// DeletedSubscription represents the values of the 'deleted_subscription' type. +type DeletedSubscription struct { + bitmap_ uint64 + id string + href string + billingExpirationDate time.Time + billingMarketplaceAccount string + cloudAccountID string + cloudProviderID string + clusterID string + clusterBillingModel BillingModel + consoleURL string + consumerUUID string + cpuTotal int + createdAt time.Time + creatorId string + displayName string + externalClusterID string + lastReconcileDate time.Time + lastReleasedAt time.Time + lastTelemetryDate time.Time + metrics string + organizationID string + planID string + productBundle string + provenance string + queryTimestamp time.Time + regionID string + serviceLevel string + socketTotal int + status string + supportLevel string + systemUnits string + trialEndDate time.Time + usage string + managed bool + released bool +} + +// Kind returns the name of the type of the object. +func (o *DeletedSubscription) Kind() string { + if o == nil { + return DeletedSubscriptionNilKind + } + if o.bitmap_&1 != 0 { + return DeletedSubscriptionLinkKind + } + return DeletedSubscriptionKind +} + +// Link returns true if this is a link. +func (o *DeletedSubscription) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *DeletedSubscription) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *DeletedSubscription) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *DeletedSubscription) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *DeletedSubscription) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *DeletedSubscription) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// BillingExpirationDate returns the value of the 'billing_expiration_date' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) BillingExpirationDate() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.billingExpirationDate + } + return time.Time{} +} + +// GetBillingExpirationDate returns the value of the 'billing_expiration_date' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetBillingExpirationDate() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.billingExpirationDate + } + return +} + +// BillingMarketplaceAccount returns the value of the 'billing_marketplace_account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) BillingMarketplaceAccount() string { + if o != nil && o.bitmap_&16 != 0 { + return o.billingMarketplaceAccount + } + return "" +} + +// GetBillingMarketplaceAccount returns the value of the 'billing_marketplace_account' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetBillingMarketplaceAccount() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.billingMarketplaceAccount + } + return +} + +// CloudAccountID returns the value of the 'cloud_account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) CloudAccountID() string { + if o != nil && o.bitmap_&32 != 0 { + return o.cloudAccountID + } + return "" +} + +// GetCloudAccountID returns the value of the 'cloud_account_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetCloudAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.cloudAccountID + } + return +} + +// CloudProviderID returns the value of the 'cloud_provider_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) CloudProviderID() string { + if o != nil && o.bitmap_&64 != 0 { + return o.cloudProviderID + } + return "" +} + +// GetCloudProviderID returns the value of the 'cloud_provider_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetCloudProviderID() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.cloudProviderID + } + return +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) ClusterID() string { + if o != nil && o.bitmap_&128 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.clusterID + } + return +} + +// ClusterBillingModel returns the value of the 'cluster_billing_model' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) ClusterBillingModel() BillingModel { + if o != nil && o.bitmap_&256 != 0 { + return o.clusterBillingModel + } + return BillingModel("") +} + +// GetClusterBillingModel returns the value of the 'cluster_billing_model' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetClusterBillingModel() (value BillingModel, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.clusterBillingModel + } + return +} + +// ConsoleURL returns the value of the 'console_URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) ConsoleURL() string { + if o != nil && o.bitmap_&512 != 0 { + return o.consoleURL + } + return "" +} + +// GetConsoleURL returns the value of the 'console_URL' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetConsoleURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.consoleURL + } + return +} + +// ConsumerUUID returns the value of the 'consumer_UUID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) ConsumerUUID() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.consumerUUID + } + return "" +} + +// GetConsumerUUID returns the value of the 'consumer_UUID' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetConsumerUUID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.consumerUUID + } + return +} + +// CpuTotal returns the value of the 'cpu_total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) CpuTotal() int { + if o != nil && o.bitmap_&2048 != 0 { + return o.cpuTotal + } + return 0 +} + +// GetCpuTotal returns the value of the 'cpu_total' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetCpuTotal() (value int, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.cpuTotal + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) CreatedAt() time.Time { + if o != nil && o.bitmap_&4096 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.createdAt + } + return +} + +// CreatorId returns the value of the 'creator_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) CreatorId() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.creatorId + } + return "" +} + +// GetCreatorId returns the value of the 'creator_id' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetCreatorId() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.creatorId + } + return +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) DisplayName() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.displayName + } + return +} + +// ExternalClusterID returns the value of the 'external_cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) ExternalClusterID() string { + if o != nil && o.bitmap_&32768 != 0 { + return o.externalClusterID + } + return "" +} + +// GetExternalClusterID returns the value of the 'external_cluster_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetExternalClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.externalClusterID + } + return +} + +// LastReconcileDate returns the value of the 'last_reconcile_date' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) LastReconcileDate() time.Time { + if o != nil && o.bitmap_&65536 != 0 { + return o.lastReconcileDate + } + return time.Time{} +} + +// GetLastReconcileDate returns the value of the 'last_reconcile_date' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetLastReconcileDate() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.lastReconcileDate + } + return +} + +// LastReleasedAt returns the value of the 'last_released_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) LastReleasedAt() time.Time { + if o != nil && o.bitmap_&131072 != 0 { + return o.lastReleasedAt + } + return time.Time{} +} + +// GetLastReleasedAt returns the value of the 'last_released_at' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetLastReleasedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&131072 != 0 + if ok { + value = o.lastReleasedAt + } + return +} + +// LastTelemetryDate returns the value of the 'last_telemetry_date' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) LastTelemetryDate() time.Time { + if o != nil && o.bitmap_&262144 != 0 { + return o.lastTelemetryDate + } + return time.Time{} +} + +// GetLastTelemetryDate returns the value of the 'last_telemetry_date' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetLastTelemetryDate() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&262144 != 0 + if ok { + value = o.lastTelemetryDate + } + return +} + +// Managed returns the value of the 'managed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) Managed() bool { + if o != nil && o.bitmap_&524288 != 0 { + return o.managed + } + return false +} + +// GetManaged returns the value of the 'managed' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetManaged() (value bool, ok bool) { + ok = o != nil && o.bitmap_&524288 != 0 + if ok { + value = o.managed + } + return +} + +// Metrics returns the value of the 'metrics' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) Metrics() string { + if o != nil && o.bitmap_&1048576 != 0 { + return o.metrics + } + return "" +} + +// GetMetrics returns the value of the 'metrics' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetMetrics() (value string, ok bool) { + ok = o != nil && o.bitmap_&1048576 != 0 + if ok { + value = o.metrics + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) OrganizationID() string { + if o != nil && o.bitmap_&2097152 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2097152 != 0 + if ok { + value = o.organizationID + } + return +} + +// PlanID returns the value of the 'plan_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) PlanID() string { + if o != nil && o.bitmap_&4194304 != 0 { + return o.planID + } + return "" +} + +// GetPlanID returns the value of the 'plan_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetPlanID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4194304 != 0 + if ok { + value = o.planID + } + return +} + +// ProductBundle returns the value of the 'product_bundle' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) ProductBundle() string { + if o != nil && o.bitmap_&8388608 != 0 { + return o.productBundle + } + return "" +} + +// GetProductBundle returns the value of the 'product_bundle' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetProductBundle() (value string, ok bool) { + ok = o != nil && o.bitmap_&8388608 != 0 + if ok { + value = o.productBundle + } + return +} + +// Provenance returns the value of the 'provenance' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) Provenance() string { + if o != nil && o.bitmap_&16777216 != 0 { + return o.provenance + } + return "" +} + +// GetProvenance returns the value of the 'provenance' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetProvenance() (value string, ok bool) { + ok = o != nil && o.bitmap_&16777216 != 0 + if ok { + value = o.provenance + } + return +} + +// QueryTimestamp returns the value of the 'query_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) QueryTimestamp() time.Time { + if o != nil && o.bitmap_&33554432 != 0 { + return o.queryTimestamp + } + return time.Time{} +} + +// GetQueryTimestamp returns the value of the 'query_timestamp' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetQueryTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&33554432 != 0 + if ok { + value = o.queryTimestamp + } + return +} + +// RegionID returns the value of the 'region_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) RegionID() string { + if o != nil && o.bitmap_&67108864 != 0 { + return o.regionID + } + return "" +} + +// GetRegionID returns the value of the 'region_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetRegionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&67108864 != 0 + if ok { + value = o.regionID + } + return +} + +// Released returns the value of the 'released' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) Released() bool { + if o != nil && o.bitmap_&134217728 != 0 { + return o.released + } + return false +} + +// GetReleased returns the value of the 'released' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetReleased() (value bool, ok bool) { + ok = o != nil && o.bitmap_&134217728 != 0 + if ok { + value = o.released + } + return +} + +// ServiceLevel returns the value of the 'service_level' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) ServiceLevel() string { + if o != nil && o.bitmap_&268435456 != 0 { + return o.serviceLevel + } + return "" +} + +// GetServiceLevel returns the value of the 'service_level' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetServiceLevel() (value string, ok bool) { + ok = o != nil && o.bitmap_&268435456 != 0 + if ok { + value = o.serviceLevel + } + return +} + +// SocketTotal returns the value of the 'socket_total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) SocketTotal() int { + if o != nil && o.bitmap_&536870912 != 0 { + return o.socketTotal + } + return 0 +} + +// GetSocketTotal returns the value of the 'socket_total' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetSocketTotal() (value int, ok bool) { + ok = o != nil && o.bitmap_&536870912 != 0 + if ok { + value = o.socketTotal + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) Status() string { + if o != nil && o.bitmap_&1073741824 != 0 { + return o.status + } + return "" +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetStatus() (value string, ok bool) { + ok = o != nil && o.bitmap_&1073741824 != 0 + if ok { + value = o.status + } + return +} + +// SupportLevel returns the value of the 'support_level' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) SupportLevel() string { + if o != nil && o.bitmap_&2147483648 != 0 { + return o.supportLevel + } + return "" +} + +// GetSupportLevel returns the value of the 'support_level' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetSupportLevel() (value string, ok bool) { + ok = o != nil && o.bitmap_&2147483648 != 0 + if ok { + value = o.supportLevel + } + return +} + +// SystemUnits returns the value of the 'system_units' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) SystemUnits() string { + if o != nil && o.bitmap_&4294967296 != 0 { + return o.systemUnits + } + return "" +} + +// GetSystemUnits returns the value of the 'system_units' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetSystemUnits() (value string, ok bool) { + ok = o != nil && o.bitmap_&4294967296 != 0 + if ok { + value = o.systemUnits + } + return +} + +// TrialEndDate returns the value of the 'trial_end_date' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) TrialEndDate() time.Time { + if o != nil && o.bitmap_&8589934592 != 0 { + return o.trialEndDate + } + return time.Time{} +} + +// GetTrialEndDate returns the value of the 'trial_end_date' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetTrialEndDate() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8589934592 != 0 + if ok { + value = o.trialEndDate + } + return +} + +// Usage returns the value of the 'usage' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *DeletedSubscription) Usage() string { + if o != nil && o.bitmap_&17179869184 != 0 { + return o.usage + } + return "" +} + +// GetUsage returns the value of the 'usage' attribute and +// a flag indicating if the attribute has a value. +func (o *DeletedSubscription) GetUsage() (value string, ok bool) { + ok = o != nil && o.bitmap_&17179869184 != 0 + if ok { + value = o.usage + } + return +} + +// DeletedSubscriptionListKind is the name of the type used to represent list of objects of +// type 'deleted_subscription'. +const DeletedSubscriptionListKind = "DeletedSubscriptionList" + +// DeletedSubscriptionListLinkKind is the name of the type used to represent links to list +// of objects of type 'deleted_subscription'. +const DeletedSubscriptionListLinkKind = "DeletedSubscriptionListLink" + +// DeletedSubscriptionNilKind is the name of the type used to nil lists of objects of +// type 'deleted_subscription'. +const DeletedSubscriptionListNilKind = "DeletedSubscriptionListNil" + +// DeletedSubscriptionList is a list of values of the 'deleted_subscription' type. +type DeletedSubscriptionList struct { + href string + link bool + items []*DeletedSubscription +} + +// Kind returns the name of the type of the object. +func (l *DeletedSubscriptionList) Kind() string { + if l == nil { + return DeletedSubscriptionListNilKind + } + if l.link { + return DeletedSubscriptionListLinkKind + } + return DeletedSubscriptionListKind +} + +// Link returns true iif this is a link. +func (l *DeletedSubscriptionList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *DeletedSubscriptionList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *DeletedSubscriptionList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *DeletedSubscriptionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *DeletedSubscriptionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *DeletedSubscriptionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *DeletedSubscriptionList) SetItems(items []*DeletedSubscription) { + l.items = items +} + +// Items returns the items of the list. +func (l *DeletedSubscriptionList) Items() []*DeletedSubscription { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *DeletedSubscriptionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *DeletedSubscriptionList) Get(i int) *DeletedSubscription { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *DeletedSubscriptionList) Slice() []*DeletedSubscription { + var slice []*DeletedSubscription + if l == nil { + slice = make([]*DeletedSubscription, 0) + } else { + slice = make([]*DeletedSubscription, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *DeletedSubscriptionList) Each(f func(item *DeletedSubscription) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *DeletedSubscriptionList) Range(f func(index int, item *DeletedSubscription) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/deleted_subscription_type_json.go b/clientapi/accountsmgmt/v1/deleted_subscription_type_json.go new file mode 100644 index 00000000..5a6efe46 --- /dev/null +++ b/clientapi/accountsmgmt/v1/deleted_subscription_type_json.go @@ -0,0 +1,553 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDeletedSubscription writes a value of the 'deleted_subscription' type to the given writer. +func MarshalDeletedSubscription(object *DeletedSubscription, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDeletedSubscription(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDeletedSubscription writes a value of the 'deleted_subscription' type to the given stream. +func WriteDeletedSubscription(object *DeletedSubscription, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(DeletedSubscriptionLinkKind) + } else { + stream.WriteString(DeletedSubscriptionKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_expiration_date") + stream.WriteString((object.billingExpirationDate).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_marketplace_account") + stream.WriteString(object.billingMarketplaceAccount) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_account_id") + stream.WriteString(object.cloudAccountID) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider_id") + stream.WriteString(object.cloudProviderID) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_billing_model") + stream.WriteString(string(object.clusterBillingModel)) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("console_url") + stream.WriteString(object.consoleURL) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("consumer_uuid") + stream.WriteString(object.consumerUUID) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cpu_total") + stream.WriteInt(object.cpuTotal) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creator_id") + stream.WriteString(object.creatorId) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_cluster_id") + stream.WriteString(object.externalClusterID) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_reconcile_date") + stream.WriteString((object.lastReconcileDate).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&131072 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_released_at") + stream.WriteString((object.lastReleasedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&262144 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_telemetry_date") + stream.WriteString((object.lastTelemetryDate).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&524288 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed") + stream.WriteBool(object.managed) + count++ + } + present_ = object.bitmap_&1048576 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("metrics") + stream.WriteString(object.metrics) + count++ + } + present_ = object.bitmap_&2097152 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&4194304 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("plan_id") + stream.WriteString(object.planID) + count++ + } + present_ = object.bitmap_&8388608 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product_bundle") + stream.WriteString(object.productBundle) + count++ + } + present_ = object.bitmap_&16777216 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("provenance") + stream.WriteString(object.provenance) + count++ + } + present_ = object.bitmap_&33554432 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("query_timestamp") + stream.WriteString((object.queryTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&67108864 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region_id") + stream.WriteString(object.regionID) + count++ + } + present_ = object.bitmap_&134217728 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("released") + stream.WriteBool(object.released) + count++ + } + present_ = object.bitmap_&268435456 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_level") + stream.WriteString(object.serviceLevel) + count++ + } + present_ = object.bitmap_&536870912 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("socket_total") + stream.WriteInt(object.socketTotal) + count++ + } + present_ = object.bitmap_&1073741824 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteString(object.status) + count++ + } + present_ = object.bitmap_&2147483648 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("support_level") + stream.WriteString(object.supportLevel) + count++ + } + present_ = object.bitmap_&4294967296 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("system_units") + stream.WriteString(object.systemUnits) + count++ + } + present_ = object.bitmap_&8589934592 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("trial_end_date") + stream.WriteString((object.trialEndDate).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&17179869184 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("usage") + stream.WriteString(object.usage) + } + stream.WriteObjectEnd() +} + +// UnmarshalDeletedSubscription reads a value of the 'deleted_subscription' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalDeletedSubscription(source interface{}) (object *DeletedSubscription, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadDeletedSubscription(iterator) + err = iterator.Error + return +} + +// ReadDeletedSubscription reads a value of the 'deleted_subscription' type from the given iterator. +func ReadDeletedSubscription(iterator *jsoniter.Iterator) *DeletedSubscription { + object := &DeletedSubscription{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == DeletedSubscriptionLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "billing_expiration_date": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.billingExpirationDate = value + object.bitmap_ |= 8 + case "billing_marketplace_account": + value := iterator.ReadString() + object.billingMarketplaceAccount = value + object.bitmap_ |= 16 + case "cloud_account_id": + value := iterator.ReadString() + object.cloudAccountID = value + object.bitmap_ |= 32 + case "cloud_provider_id": + value := iterator.ReadString() + object.cloudProviderID = value + object.bitmap_ |= 64 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 128 + case "cluster_billing_model": + text := iterator.ReadString() + value := BillingModel(text) + object.clusterBillingModel = value + object.bitmap_ |= 256 + case "console_url": + value := iterator.ReadString() + object.consoleURL = value + object.bitmap_ |= 512 + case "consumer_uuid": + value := iterator.ReadString() + object.consumerUUID = value + object.bitmap_ |= 1024 + case "cpu_total": + value := iterator.ReadInt() + object.cpuTotal = value + object.bitmap_ |= 2048 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 4096 + case "creator_id": + value := iterator.ReadString() + object.creatorId = value + object.bitmap_ |= 8192 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 16384 + case "external_cluster_id": + value := iterator.ReadString() + object.externalClusterID = value + object.bitmap_ |= 32768 + case "last_reconcile_date": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastReconcileDate = value + object.bitmap_ |= 65536 + case "last_released_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastReleasedAt = value + object.bitmap_ |= 131072 + case "last_telemetry_date": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastTelemetryDate = value + object.bitmap_ |= 262144 + case "managed": + value := iterator.ReadBool() + object.managed = value + object.bitmap_ |= 524288 + case "metrics": + value := iterator.ReadString() + object.metrics = value + object.bitmap_ |= 1048576 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 2097152 + case "plan_id": + value := iterator.ReadString() + object.planID = value + object.bitmap_ |= 4194304 + case "product_bundle": + value := iterator.ReadString() + object.productBundle = value + object.bitmap_ |= 8388608 + case "provenance": + value := iterator.ReadString() + object.provenance = value + object.bitmap_ |= 16777216 + case "query_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.queryTimestamp = value + object.bitmap_ |= 33554432 + case "region_id": + value := iterator.ReadString() + object.regionID = value + object.bitmap_ |= 67108864 + case "released": + value := iterator.ReadBool() + object.released = value + object.bitmap_ |= 134217728 + case "service_level": + value := iterator.ReadString() + object.serviceLevel = value + object.bitmap_ |= 268435456 + case "socket_total": + value := iterator.ReadInt() + object.socketTotal = value + object.bitmap_ |= 536870912 + case "status": + value := iterator.ReadString() + object.status = value + object.bitmap_ |= 1073741824 + case "support_level": + value := iterator.ReadString() + object.supportLevel = value + object.bitmap_ |= 2147483648 + case "system_units": + value := iterator.ReadString() + object.systemUnits = value + object.bitmap_ |= 4294967296 + case "trial_end_date": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.trialEndDate = value + object.bitmap_ |= 8589934592 + case "usage": + value := iterator.ReadString() + object.usage = value + object.bitmap_ |= 17179869184 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/feature_toggle_builder.go b/clientapi/accountsmgmt/v1/feature_toggle_builder.go new file mode 100644 index 00000000..51029238 --- /dev/null +++ b/clientapi/accountsmgmt/v1/feature_toggle_builder.go @@ -0,0 +1,87 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// FeatureToggleBuilder contains the data and logic needed to build 'feature_toggle' objects. +type FeatureToggleBuilder struct { + bitmap_ uint32 + id string + href string + enabled bool +} + +// NewFeatureToggle creates a new builder of 'feature_toggle' objects. +func NewFeatureToggle() *FeatureToggleBuilder { + return &FeatureToggleBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *FeatureToggleBuilder) Link(value bool) *FeatureToggleBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *FeatureToggleBuilder) ID(value string) *FeatureToggleBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *FeatureToggleBuilder) HREF(value string) *FeatureToggleBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *FeatureToggleBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *FeatureToggleBuilder) Enabled(value bool) *FeatureToggleBuilder { + b.enabled = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *FeatureToggleBuilder) Copy(object *FeatureToggle) *FeatureToggleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.enabled = object.enabled + return b +} + +// Build creates a 'feature_toggle' object using the configuration stored in the builder. +func (b *FeatureToggleBuilder) Build() (object *FeatureToggle, err error) { + object = new(FeatureToggle) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + return +} diff --git a/clientapi/accountsmgmt/v1/feature_toggle_list_builder.go b/clientapi/accountsmgmt/v1/feature_toggle_list_builder.go new file mode 100644 index 00000000..aff60291 --- /dev/null +++ b/clientapi/accountsmgmt/v1/feature_toggle_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// FeatureToggleListBuilder contains the data and logic needed to build +// 'feature_toggle' objects. +type FeatureToggleListBuilder struct { + items []*FeatureToggleBuilder +} + +// NewFeatureToggleList creates a new builder of 'feature_toggle' objects. +func NewFeatureToggleList() *FeatureToggleListBuilder { + return new(FeatureToggleListBuilder) +} + +// Items sets the items of the list. +func (b *FeatureToggleListBuilder) Items(values ...*FeatureToggleBuilder) *FeatureToggleListBuilder { + b.items = make([]*FeatureToggleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *FeatureToggleListBuilder) 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 *FeatureToggleListBuilder) Copy(list *FeatureToggleList) *FeatureToggleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*FeatureToggleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewFeatureToggle().Copy(v) + } + } + return b +} + +// Build creates a list of 'feature_toggle' objects using the +// configuration stored in the builder. +func (b *FeatureToggleListBuilder) Build() (list *FeatureToggleList, err error) { + items := make([]*FeatureToggle, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(FeatureToggleList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/feature_toggle_list_type_json.go b/clientapi/accountsmgmt/v1/feature_toggle_list_type_json.go new file mode 100644 index 00000000..ed429f6d --- /dev/null +++ b/clientapi/accountsmgmt/v1/feature_toggle_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFeatureToggleList writes a list of values of the 'feature_toggle' type to +// the given writer. +func MarshalFeatureToggleList(list []*FeatureToggle, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFeatureToggleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFeatureToggleList writes a list of value of the 'feature_toggle' type to +// the given stream. +func WriteFeatureToggleList(list []*FeatureToggle, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteFeatureToggle(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalFeatureToggleList reads a list of values of the 'feature_toggle' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFeatureToggleList(source interface{}) (items []*FeatureToggle, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFeatureToggleList(iterator) + err = iterator.Error + return +} + +// ReadFeatureToggleList reads list of values of the ”feature_toggle' type from +// the given iterator. +func ReadFeatureToggleList(iterator *jsoniter.Iterator) []*FeatureToggle { + list := []*FeatureToggle{} + for iterator.ReadArray() { + item := ReadFeatureToggle(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/feature_toggle_query_request_builder.go b/clientapi/accountsmgmt/v1/feature_toggle_query_request_builder.go new file mode 100644 index 00000000..ba145a5d --- /dev/null +++ b/clientapi/accountsmgmt/v1/feature_toggle_query_request_builder.go @@ -0,0 +1,61 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// FeatureToggleQueryRequestBuilder contains the data and logic needed to build 'feature_toggle_query_request' objects. +type FeatureToggleQueryRequestBuilder struct { + bitmap_ uint32 + organizationID string +} + +// NewFeatureToggleQueryRequest creates a new builder of 'feature_toggle_query_request' objects. +func NewFeatureToggleQueryRequest() *FeatureToggleQueryRequestBuilder { + return &FeatureToggleQueryRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *FeatureToggleQueryRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *FeatureToggleQueryRequestBuilder) OrganizationID(value string) *FeatureToggleQueryRequestBuilder { + b.organizationID = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *FeatureToggleQueryRequestBuilder) Copy(object *FeatureToggleQueryRequest) *FeatureToggleQueryRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.organizationID = object.organizationID + return b +} + +// Build creates a 'feature_toggle_query_request' object using the configuration stored in the builder. +func (b *FeatureToggleQueryRequestBuilder) Build() (object *FeatureToggleQueryRequest, err error) { + object = new(FeatureToggleQueryRequest) + object.bitmap_ = b.bitmap_ + object.organizationID = b.organizationID + return +} diff --git a/clientapi/accountsmgmt/v1/feature_toggle_query_request_list_builder.go b/clientapi/accountsmgmt/v1/feature_toggle_query_request_list_builder.go new file mode 100644 index 00000000..b3c84f15 --- /dev/null +++ b/clientapi/accountsmgmt/v1/feature_toggle_query_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// FeatureToggleQueryRequestListBuilder contains the data and logic needed to build +// 'feature_toggle_query_request' objects. +type FeatureToggleQueryRequestListBuilder struct { + items []*FeatureToggleQueryRequestBuilder +} + +// NewFeatureToggleQueryRequestList creates a new builder of 'feature_toggle_query_request' objects. +func NewFeatureToggleQueryRequestList() *FeatureToggleQueryRequestListBuilder { + return new(FeatureToggleQueryRequestListBuilder) +} + +// Items sets the items of the list. +func (b *FeatureToggleQueryRequestListBuilder) Items(values ...*FeatureToggleQueryRequestBuilder) *FeatureToggleQueryRequestListBuilder { + b.items = make([]*FeatureToggleQueryRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *FeatureToggleQueryRequestListBuilder) 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 *FeatureToggleQueryRequestListBuilder) Copy(list *FeatureToggleQueryRequestList) *FeatureToggleQueryRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*FeatureToggleQueryRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewFeatureToggleQueryRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'feature_toggle_query_request' objects using the +// configuration stored in the builder. +func (b *FeatureToggleQueryRequestListBuilder) Build() (list *FeatureToggleQueryRequestList, err error) { + items := make([]*FeatureToggleQueryRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(FeatureToggleQueryRequestList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/feature_toggle_query_request_list_type_json.go b/clientapi/accountsmgmt/v1/feature_toggle_query_request_list_type_json.go new file mode 100644 index 00000000..31955164 --- /dev/null +++ b/clientapi/accountsmgmt/v1/feature_toggle_query_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFeatureToggleQueryRequestList writes a list of values of the 'feature_toggle_query_request' type to +// the given writer. +func MarshalFeatureToggleQueryRequestList(list []*FeatureToggleQueryRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFeatureToggleQueryRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFeatureToggleQueryRequestList writes a list of value of the 'feature_toggle_query_request' type to +// the given stream. +func WriteFeatureToggleQueryRequestList(list []*FeatureToggleQueryRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteFeatureToggleQueryRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalFeatureToggleQueryRequestList reads a list of values of the 'feature_toggle_query_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFeatureToggleQueryRequestList(source interface{}) (items []*FeatureToggleQueryRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFeatureToggleQueryRequestList(iterator) + err = iterator.Error + return +} + +// ReadFeatureToggleQueryRequestList reads list of values of the ”feature_toggle_query_request' type from +// the given iterator. +func ReadFeatureToggleQueryRequestList(iterator *jsoniter.Iterator) []*FeatureToggleQueryRequest { + list := []*FeatureToggleQueryRequest{} + for iterator.ReadArray() { + item := ReadFeatureToggleQueryRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/feature_toggle_query_request_type.go b/clientapi/accountsmgmt/v1/feature_toggle_query_request_type.go new file mode 100644 index 00000000..9fe7cdb3 --- /dev/null +++ b/clientapi/accountsmgmt/v1/feature_toggle_query_request_type.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// FeatureToggleQueryRequest represents the values of the 'feature_toggle_query_request' type. +type FeatureToggleQueryRequest struct { + bitmap_ uint32 + organizationID string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *FeatureToggleQueryRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FeatureToggleQueryRequest) OrganizationID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *FeatureToggleQueryRequest) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.organizationID + } + return +} + +// FeatureToggleQueryRequestListKind is the name of the type used to represent list of objects of +// type 'feature_toggle_query_request'. +const FeatureToggleQueryRequestListKind = "FeatureToggleQueryRequestList" + +// FeatureToggleQueryRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'feature_toggle_query_request'. +const FeatureToggleQueryRequestListLinkKind = "FeatureToggleQueryRequestListLink" + +// FeatureToggleQueryRequestNilKind is the name of the type used to nil lists of objects of +// type 'feature_toggle_query_request'. +const FeatureToggleQueryRequestListNilKind = "FeatureToggleQueryRequestListNil" + +// FeatureToggleQueryRequestList is a list of values of the 'feature_toggle_query_request' type. +type FeatureToggleQueryRequestList struct { + href string + link bool + items []*FeatureToggleQueryRequest +} + +// Len returns the length of the list. +func (l *FeatureToggleQueryRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *FeatureToggleQueryRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *FeatureToggleQueryRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *FeatureToggleQueryRequestList) SetItems(items []*FeatureToggleQueryRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *FeatureToggleQueryRequestList) Items() []*FeatureToggleQueryRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *FeatureToggleQueryRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *FeatureToggleQueryRequestList) Get(i int) *FeatureToggleQueryRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *FeatureToggleQueryRequestList) Slice() []*FeatureToggleQueryRequest { + var slice []*FeatureToggleQueryRequest + if l == nil { + slice = make([]*FeatureToggleQueryRequest, 0) + } else { + slice = make([]*FeatureToggleQueryRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *FeatureToggleQueryRequestList) Each(f func(item *FeatureToggleQueryRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *FeatureToggleQueryRequestList) Range(f func(index int, item *FeatureToggleQueryRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/feature_toggle_query_request_type_json.go b/clientapi/accountsmgmt/v1/feature_toggle_query_request_type_json.go new file mode 100644 index 00000000..42199ce1 --- /dev/null +++ b/clientapi/accountsmgmt/v1/feature_toggle_query_request_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFeatureToggleQueryRequest writes a value of the 'feature_toggle_query_request' type to the given writer. +func MarshalFeatureToggleQueryRequest(object *FeatureToggleQueryRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFeatureToggleQueryRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFeatureToggleQueryRequest writes a value of the 'feature_toggle_query_request' type to the given stream. +func WriteFeatureToggleQueryRequest(object *FeatureToggleQueryRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + } + stream.WriteObjectEnd() +} + +// UnmarshalFeatureToggleQueryRequest reads a value of the 'feature_toggle_query_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalFeatureToggleQueryRequest(source interface{}) (object *FeatureToggleQueryRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadFeatureToggleQueryRequest(iterator) + err = iterator.Error + return +} + +// ReadFeatureToggleQueryRequest reads a value of the 'feature_toggle_query_request' type from the given iterator. +func ReadFeatureToggleQueryRequest(iterator *jsoniter.Iterator) *FeatureToggleQueryRequest { + object := &FeatureToggleQueryRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/feature_toggle_type.go b/clientapi/accountsmgmt/v1/feature_toggle_type.go new file mode 100644 index 00000000..18015987 --- /dev/null +++ b/clientapi/accountsmgmt/v1/feature_toggle_type.go @@ -0,0 +1,259 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// FeatureToggleKind is the name of the type used to represent objects +// of type 'feature_toggle'. +const FeatureToggleKind = "FeatureToggle" + +// FeatureToggleLinkKind is the name of the type used to represent links +// to objects of type 'feature_toggle'. +const FeatureToggleLinkKind = "FeatureToggleLink" + +// FeatureToggleNilKind is the name of the type used to nil references +// to objects of type 'feature_toggle'. +const FeatureToggleNilKind = "FeatureToggleNil" + +// FeatureToggle represents the values of the 'feature_toggle' type. +type FeatureToggle struct { + bitmap_ uint32 + id string + href string + enabled bool +} + +// Kind returns the name of the type of the object. +func (o *FeatureToggle) Kind() string { + if o == nil { + return FeatureToggleNilKind + } + if o.bitmap_&1 != 0 { + return FeatureToggleLinkKind + } + return FeatureToggleKind +} + +// Link returns true if this is a link. +func (o *FeatureToggle) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *FeatureToggle) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *FeatureToggle) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *FeatureToggle) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *FeatureToggle) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *FeatureToggle) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FeatureToggle) Enabled() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +func (o *FeatureToggle) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.enabled + } + return +} + +// FeatureToggleListKind is the name of the type used to represent list of objects of +// type 'feature_toggle'. +const FeatureToggleListKind = "FeatureToggleList" + +// FeatureToggleListLinkKind is the name of the type used to represent links to list +// of objects of type 'feature_toggle'. +const FeatureToggleListLinkKind = "FeatureToggleListLink" + +// FeatureToggleNilKind is the name of the type used to nil lists of objects of +// type 'feature_toggle'. +const FeatureToggleListNilKind = "FeatureToggleListNil" + +// FeatureToggleList is a list of values of the 'feature_toggle' type. +type FeatureToggleList struct { + href string + link bool + items []*FeatureToggle +} + +// Kind returns the name of the type of the object. +func (l *FeatureToggleList) Kind() string { + if l == nil { + return FeatureToggleListNilKind + } + if l.link { + return FeatureToggleListLinkKind + } + return FeatureToggleListKind +} + +// Link returns true iif this is a link. +func (l *FeatureToggleList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *FeatureToggleList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *FeatureToggleList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *FeatureToggleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *FeatureToggleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *FeatureToggleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *FeatureToggleList) SetItems(items []*FeatureToggle) { + l.items = items +} + +// Items returns the items of the list. +func (l *FeatureToggleList) Items() []*FeatureToggle { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *FeatureToggleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *FeatureToggleList) Get(i int) *FeatureToggle { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *FeatureToggleList) Slice() []*FeatureToggle { + var slice []*FeatureToggle + if l == nil { + slice = make([]*FeatureToggle, 0) + } else { + slice = make([]*FeatureToggle, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *FeatureToggleList) Each(f func(item *FeatureToggle) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *FeatureToggleList) Range(f func(index int, item *FeatureToggle) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/feature_toggle_type_json.go b/clientapi/accountsmgmt/v1/feature_toggle_type_json.go new file mode 100644 index 00000000..b0aa24d4 --- /dev/null +++ b/clientapi/accountsmgmt/v1/feature_toggle_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFeatureToggle writes a value of the 'feature_toggle' type to the given writer. +func MarshalFeatureToggle(object *FeatureToggle, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFeatureToggle(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFeatureToggle writes a value of the 'feature_toggle' type to the given stream. +func WriteFeatureToggle(object *FeatureToggle, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(FeatureToggleLinkKind) + } else { + stream.WriteString(FeatureToggleKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalFeatureToggle reads a value of the 'feature_toggle' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalFeatureToggle(source interface{}) (object *FeatureToggle, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadFeatureToggle(iterator) + err = iterator.Error + return +} + +// ReadFeatureToggle reads a value of the 'feature_toggle' type from the given iterator. +func ReadFeatureToggle(iterator *jsoniter.Iterator) *FeatureToggle { + object := &FeatureToggle{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == FeatureToggleLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/float_list_type_json.go b/clientapi/accountsmgmt/v1/float_list_type_json.go new file mode 100644 index 00000000..34d2d29d --- /dev/null +++ b/clientapi/accountsmgmt/v1/float_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFloatList writes a list of values of the 'float' type to +// the given writer. +func MarshalFloatList(list []float64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFloatList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFloatList writes a list of value of the 'float' type to +// the given stream. +func WriteFloatList(list []float64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteFloat64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalFloatList reads a list of values of the 'float' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFloatList(source interface{}) (items []float64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFloatList(iterator) + err = iterator.Error + return +} + +// ReadFloatList reads list of values of the ”float' type from +// the given iterator. +func ReadFloatList(iterator *jsoniter.Iterator) []float64 { + list := []float64{} + for iterator.ReadArray() { + item := iterator.ReadFloat64() + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/generic_notify_details_response_builder.go b/clientapi/accountsmgmt/v1/generic_notify_details_response_builder.go new file mode 100644 index 00000000..bfe22fe6 --- /dev/null +++ b/clientapi/accountsmgmt/v1/generic_notify_details_response_builder.go @@ -0,0 +1,143 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// GenericNotifyDetailsResponseBuilder contains the data and logic needed to build 'generic_notify_details_response' objects. +// +// class that defines notify details response in general. +type GenericNotifyDetailsResponseBuilder struct { + bitmap_ uint32 + id string + href string + associates []string + items []*NotificationDetailsResponseBuilder + recipients []string +} + +// NewGenericNotifyDetailsResponse creates a new builder of 'generic_notify_details_response' objects. +func NewGenericNotifyDetailsResponse() *GenericNotifyDetailsResponseBuilder { + return &GenericNotifyDetailsResponseBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *GenericNotifyDetailsResponseBuilder) Link(value bool) *GenericNotifyDetailsResponseBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *GenericNotifyDetailsResponseBuilder) ID(value string) *GenericNotifyDetailsResponseBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *GenericNotifyDetailsResponseBuilder) HREF(value string) *GenericNotifyDetailsResponseBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GenericNotifyDetailsResponseBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Associates sets the value of the 'associates' attribute to the given values. +func (b *GenericNotifyDetailsResponseBuilder) Associates(values ...string) *GenericNotifyDetailsResponseBuilder { + b.associates = make([]string, len(values)) + copy(b.associates, values) + b.bitmap_ |= 8 + return b +} + +// Items sets the value of the 'items' attribute to the given values. +func (b *GenericNotifyDetailsResponseBuilder) Items(values ...*NotificationDetailsResponseBuilder) *GenericNotifyDetailsResponseBuilder { + b.items = make([]*NotificationDetailsResponseBuilder, len(values)) + copy(b.items, values) + b.bitmap_ |= 16 + return b +} + +// Recipients sets the value of the 'recipients' attribute to the given values. +func (b *GenericNotifyDetailsResponseBuilder) Recipients(values ...string) *GenericNotifyDetailsResponseBuilder { + b.recipients = make([]string, len(values)) + copy(b.recipients, values) + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GenericNotifyDetailsResponseBuilder) Copy(object *GenericNotifyDetailsResponse) *GenericNotifyDetailsResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.associates != nil { + b.associates = make([]string, len(object.associates)) + copy(b.associates, object.associates) + } else { + b.associates = nil + } + if object.items != nil { + b.items = make([]*NotificationDetailsResponseBuilder, len(object.items)) + for i, v := range object.items { + b.items[i] = NewNotificationDetailsResponse().Copy(v) + } + } else { + b.items = nil + } + if object.recipients != nil { + b.recipients = make([]string, len(object.recipients)) + copy(b.recipients, object.recipients) + } else { + b.recipients = nil + } + return b +} + +// Build creates a 'generic_notify_details_response' object using the configuration stored in the builder. +func (b *GenericNotifyDetailsResponseBuilder) Build() (object *GenericNotifyDetailsResponse, err error) { + object = new(GenericNotifyDetailsResponse) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.associates != nil { + object.associates = make([]string, len(b.associates)) + copy(object.associates, b.associates) + } + if b.items != nil { + object.items = make([]*NotificationDetailsResponse, len(b.items)) + for i, v := range b.items { + object.items[i], err = v.Build() + if err != nil { + return + } + } + } + if b.recipients != nil { + object.recipients = make([]string, len(b.recipients)) + copy(object.recipients, b.recipients) + } + return +} diff --git a/clientapi/accountsmgmt/v1/generic_notify_details_response_list_builder.go b/clientapi/accountsmgmt/v1/generic_notify_details_response_list_builder.go new file mode 100644 index 00000000..27b74619 --- /dev/null +++ b/clientapi/accountsmgmt/v1/generic_notify_details_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// GenericNotifyDetailsResponseListBuilder contains the data and logic needed to build +// 'generic_notify_details_response' objects. +type GenericNotifyDetailsResponseListBuilder struct { + items []*GenericNotifyDetailsResponseBuilder +} + +// NewGenericNotifyDetailsResponseList creates a new builder of 'generic_notify_details_response' objects. +func NewGenericNotifyDetailsResponseList() *GenericNotifyDetailsResponseListBuilder { + return new(GenericNotifyDetailsResponseListBuilder) +} + +// Items sets the items of the list. +func (b *GenericNotifyDetailsResponseListBuilder) Items(values ...*GenericNotifyDetailsResponseBuilder) *GenericNotifyDetailsResponseListBuilder { + b.items = make([]*GenericNotifyDetailsResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GenericNotifyDetailsResponseListBuilder) 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 *GenericNotifyDetailsResponseListBuilder) Copy(list *GenericNotifyDetailsResponseList) *GenericNotifyDetailsResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GenericNotifyDetailsResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGenericNotifyDetailsResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'generic_notify_details_response' objects using the +// configuration stored in the builder. +func (b *GenericNotifyDetailsResponseListBuilder) Build() (list *GenericNotifyDetailsResponseList, err error) { + items := make([]*GenericNotifyDetailsResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GenericNotifyDetailsResponseList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/generic_notify_details_response_list_type_json.go b/clientapi/accountsmgmt/v1/generic_notify_details_response_list_type_json.go new file mode 100644 index 00000000..f4ab80ef --- /dev/null +++ b/clientapi/accountsmgmt/v1/generic_notify_details_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGenericNotifyDetailsResponseList writes a list of values of the 'generic_notify_details_response' type to +// the given writer. +func MarshalGenericNotifyDetailsResponseList(list []*GenericNotifyDetailsResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGenericNotifyDetailsResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGenericNotifyDetailsResponseList writes a list of value of the 'generic_notify_details_response' type to +// the given stream. +func WriteGenericNotifyDetailsResponseList(list []*GenericNotifyDetailsResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGenericNotifyDetailsResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGenericNotifyDetailsResponseList reads a list of values of the 'generic_notify_details_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGenericNotifyDetailsResponseList(source interface{}) (items []*GenericNotifyDetailsResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGenericNotifyDetailsResponseList(iterator) + err = iterator.Error + return +} + +// ReadGenericNotifyDetailsResponseList reads list of values of the ”generic_notify_details_response' type from +// the given iterator. +func ReadGenericNotifyDetailsResponseList(iterator *jsoniter.Iterator) []*GenericNotifyDetailsResponse { + list := []*GenericNotifyDetailsResponse{} + for iterator.ReadArray() { + item := ReadGenericNotifyDetailsResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/generic_notify_details_response_type.go b/clientapi/accountsmgmt/v1/generic_notify_details_response_type.go new file mode 100644 index 00000000..7ace633f --- /dev/null +++ b/clientapi/accountsmgmt/v1/generic_notify_details_response_type.go @@ -0,0 +1,313 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// GenericNotifyDetailsResponseKind is the name of the type used to represent objects +// of type 'generic_notify_details_response'. +const GenericNotifyDetailsResponseKind = "GenericNotifyDetailsResponse" + +// GenericNotifyDetailsResponseLinkKind is the name of the type used to represent links +// to objects of type 'generic_notify_details_response'. +const GenericNotifyDetailsResponseLinkKind = "GenericNotifyDetailsResponseLink" + +// GenericNotifyDetailsResponseNilKind is the name of the type used to nil references +// to objects of type 'generic_notify_details_response'. +const GenericNotifyDetailsResponseNilKind = "GenericNotifyDetailsResponseNil" + +// GenericNotifyDetailsResponse represents the values of the 'generic_notify_details_response' type. +// +// class that defines notify details response in general. +type GenericNotifyDetailsResponse struct { + bitmap_ uint32 + id string + href string + associates []string + items []*NotificationDetailsResponse + recipients []string +} + +// Kind returns the name of the type of the object. +func (o *GenericNotifyDetailsResponse) Kind() string { + if o == nil { + return GenericNotifyDetailsResponseNilKind + } + if o.bitmap_&1 != 0 { + return GenericNotifyDetailsResponseLinkKind + } + return GenericNotifyDetailsResponseKind +} + +// Link returns true if this is a link. +func (o *GenericNotifyDetailsResponse) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *GenericNotifyDetailsResponse) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *GenericNotifyDetailsResponse) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *GenericNotifyDetailsResponse) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *GenericNotifyDetailsResponse) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GenericNotifyDetailsResponse) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Associates returns the value of the 'associates' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Retrieved List of associates email address. +func (o *GenericNotifyDetailsResponse) Associates() []string { + if o != nil && o.bitmap_&8 != 0 { + return o.associates + } + return nil +} + +// GetAssociates returns the value of the 'associates' attribute and +// a flag indicating if the attribute has a value. +// +// Retrieved List of associates email address. +func (o *GenericNotifyDetailsResponse) GetAssociates() (value []string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.associates + } + return +} + +// Items returns the value of the 'items' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Retrieved list of additional notify details parameters key-value. +func (o *GenericNotifyDetailsResponse) Items() []*NotificationDetailsResponse { + if o != nil && o.bitmap_&16 != 0 { + return o.items + } + return nil +} + +// GetItems returns the value of the 'items' attribute and +// a flag indicating if the attribute has a value. +// +// Retrieved list of additional notify details parameters key-value. +func (o *GenericNotifyDetailsResponse) GetItems() (value []*NotificationDetailsResponse, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.items + } + return +} + +// Recipients returns the value of the 'recipients' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Retrieved List of recipients username. +func (o *GenericNotifyDetailsResponse) Recipients() []string { + if o != nil && o.bitmap_&32 != 0 { + return o.recipients + } + return nil +} + +// GetRecipients returns the value of the 'recipients' attribute and +// a flag indicating if the attribute has a value. +// +// Retrieved List of recipients username. +func (o *GenericNotifyDetailsResponse) GetRecipients() (value []string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.recipients + } + return +} + +// GenericNotifyDetailsResponseListKind is the name of the type used to represent list of objects of +// type 'generic_notify_details_response'. +const GenericNotifyDetailsResponseListKind = "GenericNotifyDetailsResponseList" + +// GenericNotifyDetailsResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'generic_notify_details_response'. +const GenericNotifyDetailsResponseListLinkKind = "GenericNotifyDetailsResponseListLink" + +// GenericNotifyDetailsResponseNilKind is the name of the type used to nil lists of objects of +// type 'generic_notify_details_response'. +const GenericNotifyDetailsResponseListNilKind = "GenericNotifyDetailsResponseListNil" + +// GenericNotifyDetailsResponseList is a list of values of the 'generic_notify_details_response' type. +type GenericNotifyDetailsResponseList struct { + href string + link bool + items []*GenericNotifyDetailsResponse +} + +// Kind returns the name of the type of the object. +func (l *GenericNotifyDetailsResponseList) Kind() string { + if l == nil { + return GenericNotifyDetailsResponseListNilKind + } + if l.link { + return GenericNotifyDetailsResponseListLinkKind + } + return GenericNotifyDetailsResponseListKind +} + +// Link returns true iif this is a link. +func (l *GenericNotifyDetailsResponseList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *GenericNotifyDetailsResponseList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *GenericNotifyDetailsResponseList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *GenericNotifyDetailsResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GenericNotifyDetailsResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GenericNotifyDetailsResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GenericNotifyDetailsResponseList) SetItems(items []*GenericNotifyDetailsResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *GenericNotifyDetailsResponseList) Items() []*GenericNotifyDetailsResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GenericNotifyDetailsResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GenericNotifyDetailsResponseList) Get(i int) *GenericNotifyDetailsResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GenericNotifyDetailsResponseList) Slice() []*GenericNotifyDetailsResponse { + var slice []*GenericNotifyDetailsResponse + if l == nil { + slice = make([]*GenericNotifyDetailsResponse, 0) + } else { + slice = make([]*GenericNotifyDetailsResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GenericNotifyDetailsResponseList) Each(f func(item *GenericNotifyDetailsResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GenericNotifyDetailsResponseList) Range(f func(index int, item *GenericNotifyDetailsResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/generic_notify_details_response_type_json.go b/clientapi/accountsmgmt/v1/generic_notify_details_response_type_json.go new file mode 100644 index 00000000..eb544c1f --- /dev/null +++ b/clientapi/accountsmgmt/v1/generic_notify_details_response_type_json.go @@ -0,0 +1,146 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGenericNotifyDetailsResponse writes a value of the 'generic_notify_details_response' type to the given writer. +func MarshalGenericNotifyDetailsResponse(object *GenericNotifyDetailsResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGenericNotifyDetailsResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGenericNotifyDetailsResponse writes a value of the 'generic_notify_details_response' type to the given stream. +func WriteGenericNotifyDetailsResponse(object *GenericNotifyDetailsResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(GenericNotifyDetailsResponseLinkKind) + } else { + stream.WriteString(GenericNotifyDetailsResponseKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.associates != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("associates") + WriteStringList(object.associates, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.items != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("items") + WriteNotificationDetailsResponseList(object.items, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.recipients != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("recipients") + WriteStringList(object.recipients, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalGenericNotifyDetailsResponse reads a value of the 'generic_notify_details_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGenericNotifyDetailsResponse(source interface{}) (object *GenericNotifyDetailsResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGenericNotifyDetailsResponse(iterator) + err = iterator.Error + return +} + +// ReadGenericNotifyDetailsResponse reads a value of the 'generic_notify_details_response' type from the given iterator. +func ReadGenericNotifyDetailsResponse(iterator *jsoniter.Iterator) *GenericNotifyDetailsResponse { + object := &GenericNotifyDetailsResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == GenericNotifyDetailsResponseLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "associates": + value := ReadStringList(iterator) + object.associates = value + object.bitmap_ |= 8 + case "items": + value := ReadNotificationDetailsResponseList(iterator) + object.items = value + object.bitmap_ |= 16 + case "recipients": + value := ReadStringList(iterator) + object.recipients = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/integer_list_type_json.go b/clientapi/accountsmgmt/v1/integer_list_type_json.go new file mode 100644 index 00000000..57c1f613 --- /dev/null +++ b/clientapi/accountsmgmt/v1/integer_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIntegerList writes a list of values of the 'integer' type to +// the given writer. +func MarshalIntegerList(list []int, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIntegerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIntegerList writes a list of value of the 'integer' type to +// the given stream. +func WriteIntegerList(list []int, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalIntegerList reads a list of values of the 'integer' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIntegerList(source interface{}) (items []int, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIntegerList(iterator) + err = iterator.Error + return +} + +// ReadIntegerList reads list of values of the ”integer' type from +// the given iterator. +func ReadIntegerList(iterator *jsoniter.Iterator) []int { + list := []int{} + for iterator.ReadArray() { + item := iterator.ReadInt() + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/interface_list_type_json.go b/clientapi/accountsmgmt/v1/interface_list_type_json.go new file mode 100644 index 00000000..ccc115b8 --- /dev/null +++ b/clientapi/accountsmgmt/v1/interface_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInterfaceList writes a list of values of the 'interface' type to +// the given writer. +func MarshalInterfaceList(list []interface{}, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInterfaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInterfaceList writes a list of value of the 'interface' type to +// the given stream. +func WriteInterfaceList(list []interface{}, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteVal(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalInterfaceList reads a list of values of the 'interface' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInterfaceList(source interface{}) (items []interface{}, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInterfaceList(iterator) + err = iterator.Error + return +} + +// ReadInterfaceList reads list of values of the ”interface' type from +// the given iterator. +func ReadInterfaceList(iterator *jsoniter.Iterator) []interface{} { + list := []interface{}{} + for iterator.ReadArray() { + var item interface{} + iterator.ReadVal(&item) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/label_builder.go b/clientapi/accountsmgmt/v1/label_builder.go new file mode 100644 index 00000000..7771600a --- /dev/null +++ b/clientapi/accountsmgmt/v1/label_builder.go @@ -0,0 +1,181 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// LabelBuilder contains the data and logic needed to build 'label' objects. +type LabelBuilder struct { + bitmap_ uint32 + id string + href string + accountID string + createdAt time.Time + key string + managedBy string + organizationID string + subscriptionID string + type_ string + updatedAt time.Time + value string + internal bool +} + +// NewLabel creates a new builder of 'label' objects. +func NewLabel() *LabelBuilder { + return &LabelBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *LabelBuilder) Link(value bool) *LabelBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *LabelBuilder) ID(value string) *LabelBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *LabelBuilder) HREF(value string) *LabelBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *LabelBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AccountID sets the value of the 'account_ID' attribute to the given value. +func (b *LabelBuilder) AccountID(value string) *LabelBuilder { + b.accountID = value + b.bitmap_ |= 8 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *LabelBuilder) CreatedAt(value time.Time) *LabelBuilder { + b.createdAt = value + b.bitmap_ |= 16 + return b +} + +// Internal sets the value of the 'internal' attribute to the given value. +func (b *LabelBuilder) Internal(value bool) *LabelBuilder { + b.internal = value + b.bitmap_ |= 32 + return b +} + +// Key sets the value of the 'key' attribute to the given value. +func (b *LabelBuilder) Key(value string) *LabelBuilder { + b.key = value + b.bitmap_ |= 64 + return b +} + +// ManagedBy sets the value of the 'managed_by' attribute to the given value. +func (b *LabelBuilder) ManagedBy(value string) *LabelBuilder { + b.managedBy = value + b.bitmap_ |= 128 + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *LabelBuilder) OrganizationID(value string) *LabelBuilder { + b.organizationID = value + b.bitmap_ |= 256 + return b +} + +// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value. +func (b *LabelBuilder) SubscriptionID(value string) *LabelBuilder { + b.subscriptionID = value + b.bitmap_ |= 512 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *LabelBuilder) Type(value string) *LabelBuilder { + b.type_ = value + b.bitmap_ |= 1024 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *LabelBuilder) UpdatedAt(value time.Time) *LabelBuilder { + b.updatedAt = value + b.bitmap_ |= 2048 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *LabelBuilder) Value(value string) *LabelBuilder { + b.value = value + b.bitmap_ |= 4096 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *LabelBuilder) Copy(object *Label) *LabelBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.accountID = object.accountID + b.createdAt = object.createdAt + b.internal = object.internal + b.key = object.key + b.managedBy = object.managedBy + b.organizationID = object.organizationID + b.subscriptionID = object.subscriptionID + b.type_ = object.type_ + b.updatedAt = object.updatedAt + b.value = object.value + return b +} + +// Build creates a 'label' object using the configuration stored in the builder. +func (b *LabelBuilder) Build() (object *Label, err error) { + object = new(Label) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.accountID = b.accountID + object.createdAt = b.createdAt + object.internal = b.internal + object.key = b.key + object.managedBy = b.managedBy + object.organizationID = b.organizationID + object.subscriptionID = b.subscriptionID + object.type_ = b.type_ + object.updatedAt = b.updatedAt + object.value = b.value + return +} diff --git a/clientapi/accountsmgmt/v1/label_list_builder.go b/clientapi/accountsmgmt/v1/label_list_builder.go new file mode 100644 index 00000000..c350f99c --- /dev/null +++ b/clientapi/accountsmgmt/v1/label_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// LabelListBuilder contains the data and logic needed to build +// 'label' objects. +type LabelListBuilder struct { + items []*LabelBuilder +} + +// NewLabelList creates a new builder of 'label' objects. +func NewLabelList() *LabelListBuilder { + return new(LabelListBuilder) +} + +// Items sets the items of the list. +func (b *LabelListBuilder) Items(values ...*LabelBuilder) *LabelListBuilder { + b.items = make([]*LabelBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *LabelListBuilder) 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 *LabelListBuilder) Copy(list *LabelList) *LabelListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*LabelBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewLabel().Copy(v) + } + } + return b +} + +// Build creates a list of 'label' objects using the +// configuration stored in the builder. +func (b *LabelListBuilder) Build() (list *LabelList, err error) { + items := make([]*Label, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(LabelList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/label_list_type_json.go b/clientapi/accountsmgmt/v1/label_list_type_json.go new file mode 100644 index 00000000..26e5fa04 --- /dev/null +++ b/clientapi/accountsmgmt/v1/label_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLabelList writes a list of values of the 'label' type to +// the given writer. +func MarshalLabelList(list []*Label, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLabelList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLabelList writes a list of value of the 'label' type to +// the given stream. +func WriteLabelList(list []*Label, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteLabel(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalLabelList reads a list of values of the 'label' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLabelList(source interface{}) (items []*Label, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLabelList(iterator) + err = iterator.Error + return +} + +// ReadLabelList reads list of values of the ”label' type from +// the given iterator. +func ReadLabelList(iterator *jsoniter.Iterator) []*Label { + list := []*Label{} + for iterator.ReadArray() { + item := ReadLabel(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/label_type.go b/clientapi/accountsmgmt/v1/label_type.go new file mode 100644 index 00000000..dc8b2ef4 --- /dev/null +++ b/clientapi/accountsmgmt/v1/label_type.go @@ -0,0 +1,443 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// LabelKind is the name of the type used to represent objects +// of type 'label'. +const LabelKind = "Label" + +// LabelLinkKind is the name of the type used to represent links +// to objects of type 'label'. +const LabelLinkKind = "LabelLink" + +// LabelNilKind is the name of the type used to nil references +// to objects of type 'label'. +const LabelNilKind = "LabelNil" + +// Label represents the values of the 'label' type. +type Label struct { + bitmap_ uint32 + id string + href string + accountID string + createdAt time.Time + key string + managedBy string + organizationID string + subscriptionID string + type_ string + updatedAt time.Time + value string + internal bool +} + +// Kind returns the name of the type of the object. +func (o *Label) Kind() string { + if o == nil { + return LabelNilKind + } + if o.bitmap_&1 != 0 { + return LabelLinkKind + } + return LabelKind +} + +// Link returns true if this is a link. +func (o *Label) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Label) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Label) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Label) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Label) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Label) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AccountID returns the value of the 'account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Label) AccountID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.accountID + } + return "" +} + +// GetAccountID returns the value of the 'account_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *Label) GetAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.accountID + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Label) CreatedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Label) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.createdAt + } + return +} + +// Internal returns the value of the 'internal' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Label) Internal() bool { + if o != nil && o.bitmap_&32 != 0 { + return o.internal + } + return false +} + +// GetInternal returns the value of the 'internal' attribute and +// a flag indicating if the attribute has a value. +func (o *Label) GetInternal() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.internal + } + return +} + +// Key returns the value of the 'key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Label) Key() string { + if o != nil && o.bitmap_&64 != 0 { + return o.key + } + return "" +} + +// GetKey returns the value of the 'key' attribute and +// a flag indicating if the attribute has a value. +func (o *Label) GetKey() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.key + } + return +} + +// ManagedBy returns the value of the 'managed_by' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Label) ManagedBy() string { + if o != nil && o.bitmap_&128 != 0 { + return o.managedBy + } + return "" +} + +// GetManagedBy returns the value of the 'managed_by' attribute and +// a flag indicating if the attribute has a value. +func (o *Label) GetManagedBy() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.managedBy + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Label) OrganizationID() string { + if o != nil && o.bitmap_&256 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *Label) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.organizationID + } + return +} + +// SubscriptionID returns the value of the 'subscription_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Label) SubscriptionID() string { + if o != nil && o.bitmap_&512 != 0 { + return o.subscriptionID + } + return "" +} + +// GetSubscriptionID returns the value of the 'subscription_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *Label) GetSubscriptionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.subscriptionID + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Label) Type() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +func (o *Label) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.type_ + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Label) UpdatedAt() time.Time { + if o != nil && o.bitmap_&2048 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Label) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.updatedAt + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Label) Value() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +func (o *Label) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.value + } + return +} + +// LabelListKind is the name of the type used to represent list of objects of +// type 'label'. +const LabelListKind = "LabelList" + +// LabelListLinkKind is the name of the type used to represent links to list +// of objects of type 'label'. +const LabelListLinkKind = "LabelListLink" + +// LabelNilKind is the name of the type used to nil lists of objects of +// type 'label'. +const LabelListNilKind = "LabelListNil" + +// LabelList is a list of values of the 'label' type. +type LabelList struct { + href string + link bool + items []*Label +} + +// Kind returns the name of the type of the object. +func (l *LabelList) Kind() string { + if l == nil { + return LabelListNilKind + } + if l.link { + return LabelListLinkKind + } + return LabelListKind +} + +// Link returns true iif this is a link. +func (l *LabelList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *LabelList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *LabelList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *LabelList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *LabelList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *LabelList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *LabelList) SetItems(items []*Label) { + l.items = items +} + +// Items returns the items of the list. +func (l *LabelList) Items() []*Label { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *LabelList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *LabelList) Get(i int) *Label { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *LabelList) Slice() []*Label { + var slice []*Label + if l == nil { + slice = make([]*Label, 0) + } else { + slice = make([]*Label, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *LabelList) Each(f func(item *Label) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *LabelList) Range(f func(index int, item *Label) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/label_type_json.go b/clientapi/accountsmgmt/v1/label_type_json.go new file mode 100644 index 00000000..6f7dc5a4 --- /dev/null +++ b/clientapi/accountsmgmt/v1/label_type_json.go @@ -0,0 +1,246 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLabel writes a value of the 'label' type to the given writer. +func MarshalLabel(object *Label, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLabel(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLabel writes a value of the 'label' type to the given stream. +func WriteLabel(object *Label, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(LabelLinkKind) + } else { + stream.WriteString(LabelKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_id") + stream.WriteString(object.accountID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("internal") + stream.WriteBool(object.internal) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key") + stream.WriteString(object.key) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_by") + stream.WriteString(object.managedBy) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionID) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalLabel reads a value of the 'label' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalLabel(source interface{}) (object *Label, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadLabel(iterator) + err = iterator.Error + return +} + +// ReadLabel reads a value of the 'label' type from the given iterator. +func ReadLabel(iterator *jsoniter.Iterator) *Label { + object := &Label{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == LabelLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "account_id": + value := iterator.ReadString() + object.accountID = value + object.bitmap_ |= 8 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 16 + case "internal": + value := iterator.ReadBool() + object.internal = value + object.bitmap_ |= 32 + case "key": + value := iterator.ReadString() + object.key = value + object.bitmap_ |= 64 + case "managed_by": + value := iterator.ReadString() + object.managedBy = value + object.bitmap_ |= 128 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 256 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionID = value + object.bitmap_ |= 512 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 1024 + 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_ |= 2048 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 4096 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/long_list_type_json.go b/clientapi/accountsmgmt/v1/long_list_type_json.go new file mode 100644 index 00000000..47fcb8ca --- /dev/null +++ b/clientapi/accountsmgmt/v1/long_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLongList writes a list of values of the 'long' type to +// the given writer. +func MarshalLongList(list []int64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLongList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLongList writes a list of value of the 'long' type to +// the given stream. +func WriteLongList(list []int64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalLongList reads a list of values of the 'long' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLongList(source interface{}) (items []int64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLongList(iterator) + err = iterator.Error + return +} + +// ReadLongList reads list of values of the ”long' type from +// the given iterator. +func ReadLongList(iterator *jsoniter.Iterator) []int64 { + list := []int64{} + for iterator.ReadArray() { + item := iterator.ReadInt64() + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/metadata_reader.go b/clientapi/accountsmgmt/v1/metadata_reader.go new file mode 100644 index 00000000..3c4d01ec --- /dev/null +++ b/clientapi/accountsmgmt/v1/metadata_reader.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMetadata writes a value of the metadata type to the given target, which +// can be a writer or a JSON encoder. +func MarshalMetadata(object *Metadata, writer io.Writer) error { + stream := helpers.NewStream(writer) + writeMetadata(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} +func writeMetadata(object *Metadata, stream *jsoniter.Stream) { + stream.WriteObjectStart() + if object.bitmap_&1 != 0 { + stream.WriteObjectField("server_version") + stream.WriteString(object.serverVersion) + } + stream.WriteObjectEnd() +} + +// UnmarshalMetadata reads a value of the metadata type from the given source, which +// which can be a reader, a slice of byte or a string. +func UnmarshalMetadata(source interface{}) (object *Metadata, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = readMetadata(iterator) + err = iterator.Error + return +} +func readMetadata(iterator *jsoniter.Iterator) *Metadata { + object := &Metadata{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "server_version": + object.serverVersion = iterator.ReadString() + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/metadata_type.go b/clientapi/accountsmgmt/v1/metadata_type.go new file mode 100644 index 00000000..fd28eebe --- /dev/null +++ b/clientapi/accountsmgmt/v1/metadata_type.go @@ -0,0 +1,44 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// Metadata contains the version metadata. +type Metadata struct { + bitmap_ uint32 + serverVersion string +} + +// ServerVersion returns the version of the server. +func (m *Metadata) ServerVersion() string { + if m != nil && m.bitmap_&1 != 0 { + return m.serverVersion + } + return "" +} + +// GetServerVersion returns the value of the server version and a flag indicating if +// the attribute has a value. +func (m *Metadata) GetServerVersion() (value string, ok bool) { + ok = m != nil && m.bitmap_&1 != 0 + if ok { + value = m.serverVersion + } + return +} diff --git a/clientapi/accountsmgmt/v1/notification_details_request_builder.go b/clientapi/accountsmgmt/v1/notification_details_request_builder.go new file mode 100644 index 00000000..381e5614 --- /dev/null +++ b/clientapi/accountsmgmt/v1/notification_details_request_builder.go @@ -0,0 +1,124 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// NotificationDetailsRequestBuilder contains the data and logic needed to build 'notification_details_request' objects. +// +// This struct is a request to get a templated email to a user related to this. +// subscription/cluster. +type NotificationDetailsRequestBuilder struct { + bitmap_ uint32 + bccAddress string + clusterID string + clusterUUID string + subject string + subscriptionID string + includeRedHatAssociates bool + internalOnly bool +} + +// NewNotificationDetailsRequest creates a new builder of 'notification_details_request' objects. +func NewNotificationDetailsRequest() *NotificationDetailsRequestBuilder { + return &NotificationDetailsRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NotificationDetailsRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// BccAddress sets the value of the 'bcc_address' attribute to the given value. +func (b *NotificationDetailsRequestBuilder) BccAddress(value string) *NotificationDetailsRequestBuilder { + b.bccAddress = value + b.bitmap_ |= 1 + return b +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *NotificationDetailsRequestBuilder) ClusterID(value string) *NotificationDetailsRequestBuilder { + b.clusterID = value + b.bitmap_ |= 2 + return b +} + +// ClusterUUID sets the value of the 'cluster_UUID' attribute to the given value. +func (b *NotificationDetailsRequestBuilder) ClusterUUID(value string) *NotificationDetailsRequestBuilder { + b.clusterUUID = value + b.bitmap_ |= 4 + return b +} + +// IncludeRedHatAssociates sets the value of the 'include_red_hat_associates' attribute to the given value. +func (b *NotificationDetailsRequestBuilder) IncludeRedHatAssociates(value bool) *NotificationDetailsRequestBuilder { + b.includeRedHatAssociates = value + b.bitmap_ |= 8 + return b +} + +// InternalOnly sets the value of the 'internal_only' attribute to the given value. +func (b *NotificationDetailsRequestBuilder) InternalOnly(value bool) *NotificationDetailsRequestBuilder { + b.internalOnly = value + b.bitmap_ |= 16 + return b +} + +// Subject sets the value of the 'subject' attribute to the given value. +func (b *NotificationDetailsRequestBuilder) Subject(value string) *NotificationDetailsRequestBuilder { + b.subject = value + b.bitmap_ |= 32 + return b +} + +// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value. +func (b *NotificationDetailsRequestBuilder) SubscriptionID(value string) *NotificationDetailsRequestBuilder { + b.subscriptionID = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NotificationDetailsRequestBuilder) Copy(object *NotificationDetailsRequest) *NotificationDetailsRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.bccAddress = object.bccAddress + b.clusterID = object.clusterID + b.clusterUUID = object.clusterUUID + b.includeRedHatAssociates = object.includeRedHatAssociates + b.internalOnly = object.internalOnly + b.subject = object.subject + b.subscriptionID = object.subscriptionID + return b +} + +// Build creates a 'notification_details_request' object using the configuration stored in the builder. +func (b *NotificationDetailsRequestBuilder) Build() (object *NotificationDetailsRequest, err error) { + object = new(NotificationDetailsRequest) + object.bitmap_ = b.bitmap_ + object.bccAddress = b.bccAddress + object.clusterID = b.clusterID + object.clusterUUID = b.clusterUUID + object.includeRedHatAssociates = b.includeRedHatAssociates + object.internalOnly = b.internalOnly + object.subject = b.subject + object.subscriptionID = b.subscriptionID + return +} diff --git a/clientapi/accountsmgmt/v1/notification_details_request_list_builder.go b/clientapi/accountsmgmt/v1/notification_details_request_list_builder.go new file mode 100644 index 00000000..5e5e100f --- /dev/null +++ b/clientapi/accountsmgmt/v1/notification_details_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// NotificationDetailsRequestListBuilder contains the data and logic needed to build +// 'notification_details_request' objects. +type NotificationDetailsRequestListBuilder struct { + items []*NotificationDetailsRequestBuilder +} + +// NewNotificationDetailsRequestList creates a new builder of 'notification_details_request' objects. +func NewNotificationDetailsRequestList() *NotificationDetailsRequestListBuilder { + return new(NotificationDetailsRequestListBuilder) +} + +// Items sets the items of the list. +func (b *NotificationDetailsRequestListBuilder) Items(values ...*NotificationDetailsRequestBuilder) *NotificationDetailsRequestListBuilder { + b.items = make([]*NotificationDetailsRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NotificationDetailsRequestListBuilder) 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 *NotificationDetailsRequestListBuilder) Copy(list *NotificationDetailsRequestList) *NotificationDetailsRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NotificationDetailsRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNotificationDetailsRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'notification_details_request' objects using the +// configuration stored in the builder. +func (b *NotificationDetailsRequestListBuilder) Build() (list *NotificationDetailsRequestList, err error) { + items := make([]*NotificationDetailsRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NotificationDetailsRequestList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/notification_details_request_list_type_json.go b/clientapi/accountsmgmt/v1/notification_details_request_list_type_json.go new file mode 100644 index 00000000..a6e0593c --- /dev/null +++ b/clientapi/accountsmgmt/v1/notification_details_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNotificationDetailsRequestList writes a list of values of the 'notification_details_request' type to +// the given writer. +func MarshalNotificationDetailsRequestList(list []*NotificationDetailsRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNotificationDetailsRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNotificationDetailsRequestList writes a list of value of the 'notification_details_request' type to +// the given stream. +func WriteNotificationDetailsRequestList(list []*NotificationDetailsRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNotificationDetailsRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNotificationDetailsRequestList reads a list of values of the 'notification_details_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNotificationDetailsRequestList(source interface{}) (items []*NotificationDetailsRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNotificationDetailsRequestList(iterator) + err = iterator.Error + return +} + +// ReadNotificationDetailsRequestList reads list of values of the ”notification_details_request' type from +// the given iterator. +func ReadNotificationDetailsRequestList(iterator *jsoniter.Iterator) []*NotificationDetailsRequest { + list := []*NotificationDetailsRequest{} + for iterator.ReadArray() { + item := ReadNotificationDetailsRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/notification_details_request_type.go b/clientapi/accountsmgmt/v1/notification_details_request_type.go new file mode 100644 index 00000000..787f1df9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/notification_details_request_type.go @@ -0,0 +1,310 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// NotificationDetailsRequest represents the values of the 'notification_details_request' type. +// +// This struct is a request to get a templated email to a user related to this. +// subscription/cluster. +type NotificationDetailsRequest struct { + bitmap_ uint32 + bccAddress string + clusterID string + clusterUUID string + subject string + subscriptionID string + includeRedHatAssociates bool + internalOnly bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NotificationDetailsRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// BccAddress returns the value of the 'bcc_address' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The BCC address to be included on the email that is sent. +func (o *NotificationDetailsRequest) BccAddress() string { + if o != nil && o.bitmap_&1 != 0 { + return o.bccAddress + } + return "" +} + +// GetBccAddress returns the value of the 'bcc_address' attribute and +// a flag indicating if the attribute has a value. +// +// The BCC address to be included on the email that is sent. +func (o *NotificationDetailsRequest) GetBccAddress() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.bccAddress + } + return +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Cluster (internal id) the resource type belongs to. +func (o *NotificationDetailsRequest) ClusterID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Cluster (internal id) the resource type belongs to. +func (o *NotificationDetailsRequest) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.clusterID + } + return +} + +// ClusterUUID returns the value of the 'cluster_UUID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Cluster (external id) the resource type belongs to. +func (o *NotificationDetailsRequest) ClusterUUID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.clusterUUID + } + return "" +} + +// GetClusterUUID returns the value of the 'cluster_UUID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Cluster (external id) the resource type belongs to. +func (o *NotificationDetailsRequest) GetClusterUUID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.clusterUUID + } + return +} + +// IncludeRedHatAssociates returns the value of the 'include_red_hat_associates' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates whether to include red hat associates in the email notification. +func (o *NotificationDetailsRequest) IncludeRedHatAssociates() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.includeRedHatAssociates + } + return false +} + +// GetIncludeRedHatAssociates returns the value of the 'include_red_hat_associates' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates whether to include red hat associates in the email notification. +func (o *NotificationDetailsRequest) GetIncludeRedHatAssociates() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.includeRedHatAssociates + } + return +} + +// InternalOnly returns the value of the 'internal_only' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates whether the service log is internal only to RH. +func (o *NotificationDetailsRequest) InternalOnly() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.internalOnly + } + return false +} + +// GetInternalOnly returns the value of the 'internal_only' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates whether the service log is internal only to RH. +func (o *NotificationDetailsRequest) GetInternalOnly() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.internalOnly + } + return +} + +// Subject returns the value of the 'subject' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The email subject. +func (o *NotificationDetailsRequest) Subject() string { + if o != nil && o.bitmap_&32 != 0 { + return o.subject + } + return "" +} + +// GetSubject returns the value of the 'subject' attribute and +// a flag indicating if the attribute has a value. +// +// The email subject. +func (o *NotificationDetailsRequest) GetSubject() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.subject + } + return +} + +// SubscriptionID returns the value of the 'subscription_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Subscription the resource type belongs to. +func (o *NotificationDetailsRequest) SubscriptionID() string { + if o != nil && o.bitmap_&64 != 0 { + return o.subscriptionID + } + return "" +} + +// GetSubscriptionID returns the value of the 'subscription_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Subscription the resource type belongs to. +func (o *NotificationDetailsRequest) GetSubscriptionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.subscriptionID + } + return +} + +// NotificationDetailsRequestListKind is the name of the type used to represent list of objects of +// type 'notification_details_request'. +const NotificationDetailsRequestListKind = "NotificationDetailsRequestList" + +// NotificationDetailsRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'notification_details_request'. +const NotificationDetailsRequestListLinkKind = "NotificationDetailsRequestListLink" + +// NotificationDetailsRequestNilKind is the name of the type used to nil lists of objects of +// type 'notification_details_request'. +const NotificationDetailsRequestListNilKind = "NotificationDetailsRequestListNil" + +// NotificationDetailsRequestList is a list of values of the 'notification_details_request' type. +type NotificationDetailsRequestList struct { + href string + link bool + items []*NotificationDetailsRequest +} + +// Len returns the length of the list. +func (l *NotificationDetailsRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NotificationDetailsRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NotificationDetailsRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NotificationDetailsRequestList) SetItems(items []*NotificationDetailsRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *NotificationDetailsRequestList) Items() []*NotificationDetailsRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NotificationDetailsRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NotificationDetailsRequestList) Get(i int) *NotificationDetailsRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NotificationDetailsRequestList) Slice() []*NotificationDetailsRequest { + var slice []*NotificationDetailsRequest + if l == nil { + slice = make([]*NotificationDetailsRequest, 0) + } else { + slice = make([]*NotificationDetailsRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NotificationDetailsRequestList) Each(f func(item *NotificationDetailsRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NotificationDetailsRequestList) Range(f func(index int, item *NotificationDetailsRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/notification_details_request_type_json.go b/clientapi/accountsmgmt/v1/notification_details_request_type_json.go new file mode 100644 index 00000000..d372a2a0 --- /dev/null +++ b/clientapi/accountsmgmt/v1/notification_details_request_type_json.go @@ -0,0 +1,164 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNotificationDetailsRequest writes a value of the 'notification_details_request' type to the given writer. +func MarshalNotificationDetailsRequest(object *NotificationDetailsRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNotificationDetailsRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNotificationDetailsRequest writes a value of the 'notification_details_request' type to the given stream. +func WriteNotificationDetailsRequest(object *NotificationDetailsRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("bcc_address") + stream.WriteString(object.bccAddress) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_uuid") + stream.WriteString(object.clusterUUID) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("include_red_hat_associates") + stream.WriteBool(object.includeRedHatAssociates) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("internal_only") + stream.WriteBool(object.internalOnly) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subject") + stream.WriteString(object.subject) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionID) + } + stream.WriteObjectEnd() +} + +// UnmarshalNotificationDetailsRequest reads a value of the 'notification_details_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNotificationDetailsRequest(source interface{}) (object *NotificationDetailsRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNotificationDetailsRequest(iterator) + err = iterator.Error + return +} + +// ReadNotificationDetailsRequest reads a value of the 'notification_details_request' type from the given iterator. +func ReadNotificationDetailsRequest(iterator *jsoniter.Iterator) *NotificationDetailsRequest { + object := &NotificationDetailsRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "bcc_address": + value := iterator.ReadString() + object.bccAddress = value + object.bitmap_ |= 1 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 2 + case "cluster_uuid": + value := iterator.ReadString() + object.clusterUUID = value + object.bitmap_ |= 4 + case "include_red_hat_associates": + value := iterator.ReadBool() + object.includeRedHatAssociates = value + object.bitmap_ |= 8 + case "internal_only": + value := iterator.ReadBool() + object.internalOnly = value + object.bitmap_ |= 16 + case "subject": + value := iterator.ReadString() + object.subject = value + object.bitmap_ |= 32 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionID = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/notification_details_response_builder.go b/clientapi/accountsmgmt/v1/notification_details_response_builder.go new file mode 100644 index 00000000..814590d2 --- /dev/null +++ b/clientapi/accountsmgmt/v1/notification_details_response_builder.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// NotificationDetailsResponseBuilder contains the data and logic needed to build 'notification_details_response' objects. +// +// This class is a single response item for the notify details list. +type NotificationDetailsResponseBuilder struct { + bitmap_ uint32 + id string + href string + key string + value string +} + +// NewNotificationDetailsResponse creates a new builder of 'notification_details_response' objects. +func NewNotificationDetailsResponse() *NotificationDetailsResponseBuilder { + return &NotificationDetailsResponseBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *NotificationDetailsResponseBuilder) Link(value bool) *NotificationDetailsResponseBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *NotificationDetailsResponseBuilder) ID(value string) *NotificationDetailsResponseBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *NotificationDetailsResponseBuilder) HREF(value string) *NotificationDetailsResponseBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NotificationDetailsResponseBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Key sets the value of the 'key' attribute to the given value. +func (b *NotificationDetailsResponseBuilder) Key(value string) *NotificationDetailsResponseBuilder { + b.key = value + b.bitmap_ |= 8 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *NotificationDetailsResponseBuilder) Value(value string) *NotificationDetailsResponseBuilder { + b.value = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NotificationDetailsResponseBuilder) Copy(object *NotificationDetailsResponse) *NotificationDetailsResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.key = object.key + b.value = object.value + return b +} + +// Build creates a 'notification_details_response' object using the configuration stored in the builder. +func (b *NotificationDetailsResponseBuilder) Build() (object *NotificationDetailsResponse, err error) { + object = new(NotificationDetailsResponse) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.key = b.key + object.value = b.value + return +} diff --git a/clientapi/accountsmgmt/v1/notification_details_response_list_builder.go b/clientapi/accountsmgmt/v1/notification_details_response_list_builder.go new file mode 100644 index 00000000..481544a0 --- /dev/null +++ b/clientapi/accountsmgmt/v1/notification_details_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// NotificationDetailsResponseListBuilder contains the data and logic needed to build +// 'notification_details_response' objects. +type NotificationDetailsResponseListBuilder struct { + items []*NotificationDetailsResponseBuilder +} + +// NewNotificationDetailsResponseList creates a new builder of 'notification_details_response' objects. +func NewNotificationDetailsResponseList() *NotificationDetailsResponseListBuilder { + return new(NotificationDetailsResponseListBuilder) +} + +// Items sets the items of the list. +func (b *NotificationDetailsResponseListBuilder) Items(values ...*NotificationDetailsResponseBuilder) *NotificationDetailsResponseListBuilder { + b.items = make([]*NotificationDetailsResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NotificationDetailsResponseListBuilder) 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 *NotificationDetailsResponseListBuilder) Copy(list *NotificationDetailsResponseList) *NotificationDetailsResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NotificationDetailsResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNotificationDetailsResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'notification_details_response' objects using the +// configuration stored in the builder. +func (b *NotificationDetailsResponseListBuilder) Build() (list *NotificationDetailsResponseList, err error) { + items := make([]*NotificationDetailsResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NotificationDetailsResponseList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/notification_details_response_list_type_json.go b/clientapi/accountsmgmt/v1/notification_details_response_list_type_json.go new file mode 100644 index 00000000..9325c96a --- /dev/null +++ b/clientapi/accountsmgmt/v1/notification_details_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNotificationDetailsResponseList writes a list of values of the 'notification_details_response' type to +// the given writer. +func MarshalNotificationDetailsResponseList(list []*NotificationDetailsResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNotificationDetailsResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNotificationDetailsResponseList writes a list of value of the 'notification_details_response' type to +// the given stream. +func WriteNotificationDetailsResponseList(list []*NotificationDetailsResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNotificationDetailsResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNotificationDetailsResponseList reads a list of values of the 'notification_details_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNotificationDetailsResponseList(source interface{}) (items []*NotificationDetailsResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNotificationDetailsResponseList(iterator) + err = iterator.Error + return +} + +// ReadNotificationDetailsResponseList reads list of values of the ”notification_details_response' type from +// the given iterator. +func ReadNotificationDetailsResponseList(iterator *jsoniter.Iterator) []*NotificationDetailsResponse { + list := []*NotificationDetailsResponse{} + for iterator.ReadArray() { + item := ReadNotificationDetailsResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/notification_details_response_type.go b/clientapi/accountsmgmt/v1/notification_details_response_type.go new file mode 100644 index 00000000..c30d348f --- /dev/null +++ b/clientapi/accountsmgmt/v1/notification_details_response_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// NotificationDetailsResponseKind is the name of the type used to represent objects +// of type 'notification_details_response'. +const NotificationDetailsResponseKind = "NotificationDetailsResponse" + +// NotificationDetailsResponseLinkKind is the name of the type used to represent links +// to objects of type 'notification_details_response'. +const NotificationDetailsResponseLinkKind = "NotificationDetailsResponseLink" + +// NotificationDetailsResponseNilKind is the name of the type used to nil references +// to objects of type 'notification_details_response'. +const NotificationDetailsResponseNilKind = "NotificationDetailsResponseNil" + +// NotificationDetailsResponse represents the values of the 'notification_details_response' type. +// +// This class is a single response item for the notify details list. +type NotificationDetailsResponse struct { + bitmap_ uint32 + id string + href string + key string + value string +} + +// Kind returns the name of the type of the object. +func (o *NotificationDetailsResponse) Kind() string { + if o == nil { + return NotificationDetailsResponseNilKind + } + if o.bitmap_&1 != 0 { + return NotificationDetailsResponseLinkKind + } + return NotificationDetailsResponseKind +} + +// Link returns true if this is a link. +func (o *NotificationDetailsResponse) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *NotificationDetailsResponse) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *NotificationDetailsResponse) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *NotificationDetailsResponse) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *NotificationDetailsResponse) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NotificationDetailsResponse) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Key returns the value of the 'key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the key of the response parameter. +func (o *NotificationDetailsResponse) Key() string { + if o != nil && o.bitmap_&8 != 0 { + return o.key + } + return "" +} + +// GetKey returns the value of the 'key' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the key of the response parameter. +func (o *NotificationDetailsResponse) GetKey() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.key + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the value of the response parameter. +func (o *NotificationDetailsResponse) Value() string { + if o != nil && o.bitmap_&16 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the value of the response parameter. +func (o *NotificationDetailsResponse) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.value + } + return +} + +// NotificationDetailsResponseListKind is the name of the type used to represent list of objects of +// type 'notification_details_response'. +const NotificationDetailsResponseListKind = "NotificationDetailsResponseList" + +// NotificationDetailsResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'notification_details_response'. +const NotificationDetailsResponseListLinkKind = "NotificationDetailsResponseListLink" + +// NotificationDetailsResponseNilKind is the name of the type used to nil lists of objects of +// type 'notification_details_response'. +const NotificationDetailsResponseListNilKind = "NotificationDetailsResponseListNil" + +// NotificationDetailsResponseList is a list of values of the 'notification_details_response' type. +type NotificationDetailsResponseList struct { + href string + link bool + items []*NotificationDetailsResponse +} + +// Kind returns the name of the type of the object. +func (l *NotificationDetailsResponseList) Kind() string { + if l == nil { + return NotificationDetailsResponseListNilKind + } + if l.link { + return NotificationDetailsResponseListLinkKind + } + return NotificationDetailsResponseListKind +} + +// Link returns true iif this is a link. +func (l *NotificationDetailsResponseList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *NotificationDetailsResponseList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *NotificationDetailsResponseList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *NotificationDetailsResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NotificationDetailsResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NotificationDetailsResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NotificationDetailsResponseList) SetItems(items []*NotificationDetailsResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *NotificationDetailsResponseList) Items() []*NotificationDetailsResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NotificationDetailsResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NotificationDetailsResponseList) Get(i int) *NotificationDetailsResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NotificationDetailsResponseList) Slice() []*NotificationDetailsResponse { + var slice []*NotificationDetailsResponse + if l == nil { + slice = make([]*NotificationDetailsResponse, 0) + } else { + slice = make([]*NotificationDetailsResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NotificationDetailsResponseList) Each(f func(item *NotificationDetailsResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NotificationDetailsResponseList) Range(f func(index int, item *NotificationDetailsResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/notification_details_response_type_json.go b/clientapi/accountsmgmt/v1/notification_details_response_type_json.go new file mode 100644 index 00000000..8775b0a9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/notification_details_response_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNotificationDetailsResponse writes a value of the 'notification_details_response' type to the given writer. +func MarshalNotificationDetailsResponse(object *NotificationDetailsResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNotificationDetailsResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNotificationDetailsResponse writes a value of the 'notification_details_response' type to the given stream. +func WriteNotificationDetailsResponse(object *NotificationDetailsResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(NotificationDetailsResponseLinkKind) + } else { + stream.WriteString(NotificationDetailsResponseKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key") + stream.WriteString(object.key) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalNotificationDetailsResponse reads a value of the 'notification_details_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNotificationDetailsResponse(source interface{}) (object *NotificationDetailsResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNotificationDetailsResponse(iterator) + err = iterator.Error + return +} + +// ReadNotificationDetailsResponse reads a value of the 'notification_details_response' type from the given iterator. +func ReadNotificationDetailsResponse(iterator *jsoniter.Iterator) *NotificationDetailsResponse { + object := &NotificationDetailsResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == NotificationDetailsResponseLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "key": + value := iterator.ReadString() + object.key = value + object.bitmap_ |= 8 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/organization_builder.go b/clientapi/accountsmgmt/v1/organization_builder.go new file mode 100644 index 00000000..221424e0 --- /dev/null +++ b/clientapi/accountsmgmt/v1/organization_builder.go @@ -0,0 +1,183 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// OrganizationBuilder contains the data and logic needed to build 'organization' objects. +type OrganizationBuilder struct { + bitmap_ uint32 + id string + href string + capabilities []*CapabilityBuilder + createdAt time.Time + ebsAccountID string + externalID string + labels []*LabelBuilder + name string + updatedAt time.Time +} + +// NewOrganization creates a new builder of 'organization' objects. +func NewOrganization() *OrganizationBuilder { + return &OrganizationBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *OrganizationBuilder) Link(value bool) *OrganizationBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *OrganizationBuilder) ID(value string) *OrganizationBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *OrganizationBuilder) HREF(value string) *OrganizationBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *OrganizationBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Capabilities sets the value of the 'capabilities' attribute to the given values. +func (b *OrganizationBuilder) Capabilities(values ...*CapabilityBuilder) *OrganizationBuilder { + b.capabilities = make([]*CapabilityBuilder, len(values)) + copy(b.capabilities, values) + b.bitmap_ |= 8 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *OrganizationBuilder) CreatedAt(value time.Time) *OrganizationBuilder { + b.createdAt = value + b.bitmap_ |= 16 + return b +} + +// EbsAccountID sets the value of the 'ebs_account_ID' attribute to the given value. +func (b *OrganizationBuilder) EbsAccountID(value string) *OrganizationBuilder { + b.ebsAccountID = value + b.bitmap_ |= 32 + return b +} + +// ExternalID sets the value of the 'external_ID' attribute to the given value. +func (b *OrganizationBuilder) ExternalID(value string) *OrganizationBuilder { + b.externalID = value + b.bitmap_ |= 64 + return b +} + +// Labels sets the value of the 'labels' attribute to the given values. +func (b *OrganizationBuilder) Labels(values ...*LabelBuilder) *OrganizationBuilder { + b.labels = make([]*LabelBuilder, len(values)) + copy(b.labels, values) + b.bitmap_ |= 128 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *OrganizationBuilder) Name(value string) *OrganizationBuilder { + b.name = value + b.bitmap_ |= 256 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *OrganizationBuilder) UpdatedAt(value time.Time) *OrganizationBuilder { + b.updatedAt = value + b.bitmap_ |= 512 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *OrganizationBuilder) Copy(object *Organization) *OrganizationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.capabilities != nil { + b.capabilities = make([]*CapabilityBuilder, len(object.capabilities)) + for i, v := range object.capabilities { + b.capabilities[i] = NewCapability().Copy(v) + } + } else { + b.capabilities = nil + } + b.createdAt = object.createdAt + b.ebsAccountID = object.ebsAccountID + b.externalID = object.externalID + if object.labels != nil { + b.labels = make([]*LabelBuilder, len(object.labels)) + for i, v := range object.labels { + b.labels[i] = NewLabel().Copy(v) + } + } else { + b.labels = nil + } + b.name = object.name + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'organization' object using the configuration stored in the builder. +func (b *OrganizationBuilder) Build() (object *Organization, err error) { + object = new(Organization) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.capabilities != nil { + object.capabilities = make([]*Capability, len(b.capabilities)) + for i, v := range b.capabilities { + object.capabilities[i], err = v.Build() + if err != nil { + return + } + } + } + object.createdAt = b.createdAt + object.ebsAccountID = b.ebsAccountID + object.externalID = b.externalID + if b.labels != nil { + object.labels = make([]*Label, len(b.labels)) + for i, v := range b.labels { + object.labels[i], err = v.Build() + if err != nil { + return + } + } + } + object.name = b.name + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/accountsmgmt/v1/organization_list_builder.go b/clientapi/accountsmgmt/v1/organization_list_builder.go new file mode 100644 index 00000000..25205b8f --- /dev/null +++ b/clientapi/accountsmgmt/v1/organization_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// OrganizationListBuilder contains the data and logic needed to build +// 'organization' objects. +type OrganizationListBuilder struct { + items []*OrganizationBuilder +} + +// NewOrganizationList creates a new builder of 'organization' objects. +func NewOrganizationList() *OrganizationListBuilder { + return new(OrganizationListBuilder) +} + +// Items sets the items of the list. +func (b *OrganizationListBuilder) Items(values ...*OrganizationBuilder) *OrganizationListBuilder { + b.items = make([]*OrganizationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *OrganizationListBuilder) 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 *OrganizationListBuilder) Copy(list *OrganizationList) *OrganizationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*OrganizationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewOrganization().Copy(v) + } + } + return b +} + +// Build creates a list of 'organization' objects using the +// configuration stored in the builder. +func (b *OrganizationListBuilder) Build() (list *OrganizationList, err error) { + items := make([]*Organization, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(OrganizationList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/organization_list_type_json.go b/clientapi/accountsmgmt/v1/organization_list_type_json.go new file mode 100644 index 00000000..ec433fe4 --- /dev/null +++ b/clientapi/accountsmgmt/v1/organization_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOrganizationList writes a list of values of the 'organization' type to +// the given writer. +func MarshalOrganizationList(list []*Organization, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOrganizationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOrganizationList writes a list of value of the 'organization' type to +// the given stream. +func WriteOrganizationList(list []*Organization, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteOrganization(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalOrganizationList reads a list of values of the 'organization' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalOrganizationList(source interface{}) (items []*Organization, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadOrganizationList(iterator) + err = iterator.Error + return +} + +// ReadOrganizationList reads list of values of the ”organization' type from +// the given iterator. +func ReadOrganizationList(iterator *jsoniter.Iterator) []*Organization { + list := []*Organization{} + for iterator.ReadArray() { + item := ReadOrganization(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/organization_type.go b/clientapi/accountsmgmt/v1/organization_type.go new file mode 100644 index 00000000..86fb94f8 --- /dev/null +++ b/clientapi/accountsmgmt/v1/organization_type.go @@ -0,0 +1,383 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// OrganizationKind is the name of the type used to represent objects +// of type 'organization'. +const OrganizationKind = "Organization" + +// OrganizationLinkKind is the name of the type used to represent links +// to objects of type 'organization'. +const OrganizationLinkKind = "OrganizationLink" + +// OrganizationNilKind is the name of the type used to nil references +// to objects of type 'organization'. +const OrganizationNilKind = "OrganizationNil" + +// Organization represents the values of the 'organization' type. +type Organization struct { + bitmap_ uint32 + id string + href string + capabilities []*Capability + createdAt time.Time + ebsAccountID string + externalID string + labels []*Label + name string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *Organization) Kind() string { + if o == nil { + return OrganizationNilKind + } + if o.bitmap_&1 != 0 { + return OrganizationLinkKind + } + return OrganizationKind +} + +// Link returns true if this is a link. +func (o *Organization) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Organization) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Organization) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Organization) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Organization) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Organization) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Capabilities returns the value of the 'capabilities' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Organization) Capabilities() []*Capability { + if o != nil && o.bitmap_&8 != 0 { + return o.capabilities + } + return nil +} + +// GetCapabilities returns the value of the 'capabilities' attribute and +// a flag indicating if the attribute has a value. +func (o *Organization) GetCapabilities() (value []*Capability, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.capabilities + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Organization) CreatedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Organization) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.createdAt + } + return +} + +// EbsAccountID returns the value of the 'ebs_account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Organization) EbsAccountID() string { + if o != nil && o.bitmap_&32 != 0 { + return o.ebsAccountID + } + return "" +} + +// GetEbsAccountID returns the value of the 'ebs_account_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *Organization) GetEbsAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.ebsAccountID + } + return +} + +// ExternalID returns the value of the 'external_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Organization) ExternalID() string { + if o != nil && o.bitmap_&64 != 0 { + return o.externalID + } + return "" +} + +// GetExternalID returns the value of the 'external_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *Organization) GetExternalID() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.externalID + } + return +} + +// Labels returns the value of the 'labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Organization) Labels() []*Label { + if o != nil && o.bitmap_&128 != 0 { + return o.labels + } + return nil +} + +// GetLabels returns the value of the 'labels' attribute and +// a flag indicating if the attribute has a value. +func (o *Organization) GetLabels() (value []*Label, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.labels + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Organization) Name() string { + if o != nil && o.bitmap_&256 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *Organization) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.name + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Organization) UpdatedAt() time.Time { + if o != nil && o.bitmap_&512 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Organization) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.updatedAt + } + return +} + +// OrganizationListKind is the name of the type used to represent list of objects of +// type 'organization'. +const OrganizationListKind = "OrganizationList" + +// OrganizationListLinkKind is the name of the type used to represent links to list +// of objects of type 'organization'. +const OrganizationListLinkKind = "OrganizationListLink" + +// OrganizationNilKind is the name of the type used to nil lists of objects of +// type 'organization'. +const OrganizationListNilKind = "OrganizationListNil" + +// OrganizationList is a list of values of the 'organization' type. +type OrganizationList struct { + href string + link bool + items []*Organization +} + +// Kind returns the name of the type of the object. +func (l *OrganizationList) Kind() string { + if l == nil { + return OrganizationListNilKind + } + if l.link { + return OrganizationListLinkKind + } + return OrganizationListKind +} + +// Link returns true iif this is a link. +func (l *OrganizationList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *OrganizationList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *OrganizationList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *OrganizationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *OrganizationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *OrganizationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *OrganizationList) SetItems(items []*Organization) { + l.items = items +} + +// Items returns the items of the list. +func (l *OrganizationList) Items() []*Organization { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *OrganizationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *OrganizationList) Get(i int) *Organization { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *OrganizationList) Slice() []*Organization { + var slice []*Organization + if l == nil { + slice = make([]*Organization, 0) + } else { + slice = make([]*Organization, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *OrganizationList) Each(f func(item *Organization) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *OrganizationList) Range(f func(index int, item *Organization) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/organization_type_json.go b/clientapi/accountsmgmt/v1/organization_type_json.go new file mode 100644 index 00000000..3f614565 --- /dev/null +++ b/clientapi/accountsmgmt/v1/organization_type_json.go @@ -0,0 +1,207 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOrganization writes a value of the 'organization' type to the given writer. +func MarshalOrganization(object *Organization, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOrganization(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOrganization writes a value of the 'organization' type to the given stream. +func WriteOrganization(object *Organization, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(OrganizationLinkKind) + } else { + stream.WriteString(OrganizationKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.capabilities != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("capabilities") + WriteCapabilityList(object.capabilities, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ebs_account_id") + stream.WriteString(object.ebsAccountID) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_id") + stream.WriteString(object.externalID) + count++ + } + present_ = object.bitmap_&128 != 0 && object.labels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("labels") + WriteLabelList(object.labels, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalOrganization reads a value of the 'organization' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalOrganization(source interface{}) (object *Organization, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadOrganization(iterator) + err = iterator.Error + return +} + +// ReadOrganization reads a value of the 'organization' type from the given iterator. +func ReadOrganization(iterator *jsoniter.Iterator) *Organization { + object := &Organization{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == OrganizationLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "capabilities": + value := ReadCapabilityList(iterator) + object.capabilities = value + object.bitmap_ |= 8 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 16 + case "ebs_account_id": + value := iterator.ReadString() + object.ebsAccountID = value + object.bitmap_ |= 32 + case "external_id": + value := iterator.ReadString() + object.externalID = value + object.bitmap_ |= 64 + case "labels": + value := ReadLabelList(iterator) + object.labels = value + object.bitmap_ |= 128 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 256 + 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 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/permission_builder.go b/clientapi/accountsmgmt/v1/permission_builder.go new file mode 100644 index 00000000..e1a0b924 --- /dev/null +++ b/clientapi/accountsmgmt/v1/permission_builder.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// PermissionBuilder contains the data and logic needed to build 'permission' objects. +type PermissionBuilder struct { + bitmap_ uint32 + id string + href string + action Action + resource string +} + +// NewPermission creates a new builder of 'permission' objects. +func NewPermission() *PermissionBuilder { + return &PermissionBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *PermissionBuilder) Link(value bool) *PermissionBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *PermissionBuilder) ID(value string) *PermissionBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *PermissionBuilder) HREF(value string) *PermissionBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *PermissionBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Action sets the value of the 'action' attribute to the given value. +// +// Possible actions for a permission. +func (b *PermissionBuilder) Action(value Action) *PermissionBuilder { + b.action = value + b.bitmap_ |= 8 + return b +} + +// Resource sets the value of the 'resource' attribute to the given value. +func (b *PermissionBuilder) Resource(value string) *PermissionBuilder { + b.resource = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *PermissionBuilder) Copy(object *Permission) *PermissionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.action = object.action + b.resource = object.resource + return b +} + +// Build creates a 'permission' object using the configuration stored in the builder. +func (b *PermissionBuilder) Build() (object *Permission, err error) { + object = new(Permission) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.action = b.action + object.resource = b.resource + return +} diff --git a/clientapi/accountsmgmt/v1/permission_list_builder.go b/clientapi/accountsmgmt/v1/permission_list_builder.go new file mode 100644 index 00000000..238a6c29 --- /dev/null +++ b/clientapi/accountsmgmt/v1/permission_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// PermissionListBuilder contains the data and logic needed to build +// 'permission' objects. +type PermissionListBuilder struct { + items []*PermissionBuilder +} + +// NewPermissionList creates a new builder of 'permission' objects. +func NewPermissionList() *PermissionListBuilder { + return new(PermissionListBuilder) +} + +// Items sets the items of the list. +func (b *PermissionListBuilder) Items(values ...*PermissionBuilder) *PermissionListBuilder { + b.items = make([]*PermissionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *PermissionListBuilder) 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 *PermissionListBuilder) Copy(list *PermissionList) *PermissionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*PermissionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewPermission().Copy(v) + } + } + return b +} + +// Build creates a list of 'permission' objects using the +// configuration stored in the builder. +func (b *PermissionListBuilder) Build() (list *PermissionList, err error) { + items := make([]*Permission, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(PermissionList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/permission_list_type_json.go b/clientapi/accountsmgmt/v1/permission_list_type_json.go new file mode 100644 index 00000000..4f846dc7 --- /dev/null +++ b/clientapi/accountsmgmt/v1/permission_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPermissionList writes a list of values of the 'permission' type to +// the given writer. +func MarshalPermissionList(list []*Permission, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePermissionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePermissionList writes a list of value of the 'permission' type to +// the given stream. +func WritePermissionList(list []*Permission, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WritePermission(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalPermissionList reads a list of values of the 'permission' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalPermissionList(source interface{}) (items []*Permission, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadPermissionList(iterator) + err = iterator.Error + return +} + +// ReadPermissionList reads list of values of the ”permission' type from +// the given iterator. +func ReadPermissionList(iterator *jsoniter.Iterator) []*Permission { + list := []*Permission{} + for iterator.ReadArray() { + item := ReadPermission(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/permission_type.go b/clientapi/accountsmgmt/v1/permission_type.go new file mode 100644 index 00000000..17961ae9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/permission_type.go @@ -0,0 +1,279 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// PermissionKind is the name of the type used to represent objects +// of type 'permission'. +const PermissionKind = "Permission" + +// PermissionLinkKind is the name of the type used to represent links +// to objects of type 'permission'. +const PermissionLinkKind = "PermissionLink" + +// PermissionNilKind is the name of the type used to nil references +// to objects of type 'permission'. +const PermissionNilKind = "PermissionNil" + +// Permission represents the values of the 'permission' type. +type Permission struct { + bitmap_ uint32 + id string + href string + action Action + resource string +} + +// Kind returns the name of the type of the object. +func (o *Permission) Kind() string { + if o == nil { + return PermissionNilKind + } + if o.bitmap_&1 != 0 { + return PermissionLinkKind + } + return PermissionKind +} + +// Link returns true if this is a link. +func (o *Permission) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Permission) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Permission) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Permission) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Permission) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Permission) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Action returns the value of the 'action' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Permission) Action() Action { + if o != nil && o.bitmap_&8 != 0 { + return o.action + } + return Action("") +} + +// GetAction returns the value of the 'action' attribute and +// a flag indicating if the attribute has a value. +func (o *Permission) GetAction() (value Action, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.action + } + return +} + +// Resource returns the value of the 'resource' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Permission) Resource() string { + if o != nil && o.bitmap_&16 != 0 { + return o.resource + } + return "" +} + +// GetResource returns the value of the 'resource' attribute and +// a flag indicating if the attribute has a value. +func (o *Permission) GetResource() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.resource + } + return +} + +// PermissionListKind is the name of the type used to represent list of objects of +// type 'permission'. +const PermissionListKind = "PermissionList" + +// PermissionListLinkKind is the name of the type used to represent links to list +// of objects of type 'permission'. +const PermissionListLinkKind = "PermissionListLink" + +// PermissionNilKind is the name of the type used to nil lists of objects of +// type 'permission'. +const PermissionListNilKind = "PermissionListNil" + +// PermissionList is a list of values of the 'permission' type. +type PermissionList struct { + href string + link bool + items []*Permission +} + +// Kind returns the name of the type of the object. +func (l *PermissionList) Kind() string { + if l == nil { + return PermissionListNilKind + } + if l.link { + return PermissionListLinkKind + } + return PermissionListKind +} + +// Link returns true iif this is a link. +func (l *PermissionList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *PermissionList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *PermissionList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *PermissionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *PermissionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *PermissionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *PermissionList) SetItems(items []*Permission) { + l.items = items +} + +// Items returns the items of the list. +func (l *PermissionList) Items() []*Permission { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *PermissionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *PermissionList) Get(i int) *Permission { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *PermissionList) Slice() []*Permission { + var slice []*Permission + if l == nil { + slice = make([]*Permission, 0) + } else { + slice = make([]*Permission, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *PermissionList) Each(f func(item *Permission) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *PermissionList) Range(f func(index int, item *Permission) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/permission_type_json.go b/clientapi/accountsmgmt/v1/permission_type_json.go new file mode 100644 index 00000000..59974a7d --- /dev/null +++ b/clientapi/accountsmgmt/v1/permission_type_json.go @@ -0,0 +1,134 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPermission writes a value of the 'permission' type to the given writer. +func MarshalPermission(object *Permission, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePermission(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePermission writes a value of the 'permission' type to the given stream. +func WritePermission(object *Permission, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(PermissionLinkKind) + } else { + stream.WriteString(PermissionKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("action") + stream.WriteString(string(object.action)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource") + stream.WriteString(object.resource) + } + stream.WriteObjectEnd() +} + +// UnmarshalPermission reads a value of the 'permission' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalPermission(source interface{}) (object *Permission, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadPermission(iterator) + err = iterator.Error + return +} + +// ReadPermission reads a value of the 'permission' type from the given iterator. +func ReadPermission(iterator *jsoniter.Iterator) *Permission { + object := &Permission{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == PermissionLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "action": + text := iterator.ReadString() + value := Action(text) + object.action = value + object.bitmap_ |= 8 + case "resource": + value := iterator.ReadString() + object.resource = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/plan_builder.go b/clientapi/accountsmgmt/v1/plan_builder.go new file mode 100644 index 00000000..c4d72929 --- /dev/null +++ b/clientapi/accountsmgmt/v1/plan_builder.go @@ -0,0 +1,107 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// PlanBuilder contains the data and logic needed to build 'plan' objects. +type PlanBuilder struct { + bitmap_ uint32 + id string + href string + category string + name string + type_ string +} + +// NewPlan creates a new builder of 'plan' objects. +func NewPlan() *PlanBuilder { + return &PlanBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *PlanBuilder) Link(value bool) *PlanBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *PlanBuilder) ID(value string) *PlanBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *PlanBuilder) HREF(value string) *PlanBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *PlanBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Category sets the value of the 'category' attribute to the given value. +func (b *PlanBuilder) Category(value string) *PlanBuilder { + b.category = value + b.bitmap_ |= 8 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *PlanBuilder) Name(value string) *PlanBuilder { + b.name = value + b.bitmap_ |= 16 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *PlanBuilder) Type(value string) *PlanBuilder { + b.type_ = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *PlanBuilder) Copy(object *Plan) *PlanBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.category = object.category + b.name = object.name + b.type_ = object.type_ + return b +} + +// Build creates a 'plan' object using the configuration stored in the builder. +func (b *PlanBuilder) Build() (object *Plan, err error) { + object = new(Plan) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.category = b.category + object.name = b.name + object.type_ = b.type_ + return +} diff --git a/clientapi/accountsmgmt/v1/plan_id_list_type_json.go b/clientapi/accountsmgmt/v1/plan_id_list_type_json.go new file mode 100644 index 00000000..3b839547 --- /dev/null +++ b/clientapi/accountsmgmt/v1/plan_id_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPlanIDList writes a list of values of the 'plan_ID' type to +// the given writer. +func MarshalPlanIDList(list []PlanID, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePlanIDList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePlanIDList writes a list of value of the 'plan_ID' type to +// the given stream. +func WritePlanIDList(list []PlanID, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalPlanIDList reads a list of values of the 'plan_ID' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalPlanIDList(source interface{}) (items []PlanID, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadPlanIDList(iterator) + err = iterator.Error + return +} + +// ReadPlanIDList reads list of values of the ”plan_ID' type from +// the given iterator. +func ReadPlanIDList(iterator *jsoniter.Iterator) []PlanID { + list := []PlanID{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := PlanID(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/plan_id_type.go b/clientapi/accountsmgmt/v1/plan_id_type.go new file mode 100644 index 00000000..f56e0265 --- /dev/null +++ b/clientapi/accountsmgmt/v1/plan_id_type.go @@ -0,0 +1,28 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// PlanID represents the values of the 'plan_ID' enumerated type. +type PlanID string + +const ( + // + PlanIDOCP PlanID = "ocp" +) diff --git a/clientapi/accountsmgmt/v1/plan_list_builder.go b/clientapi/accountsmgmt/v1/plan_list_builder.go new file mode 100644 index 00000000..ce9d4281 --- /dev/null +++ b/clientapi/accountsmgmt/v1/plan_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// PlanListBuilder contains the data and logic needed to build +// 'plan' objects. +type PlanListBuilder struct { + items []*PlanBuilder +} + +// NewPlanList creates a new builder of 'plan' objects. +func NewPlanList() *PlanListBuilder { + return new(PlanListBuilder) +} + +// Items sets the items of the list. +func (b *PlanListBuilder) Items(values ...*PlanBuilder) *PlanListBuilder { + b.items = make([]*PlanBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *PlanListBuilder) 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 *PlanListBuilder) Copy(list *PlanList) *PlanListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*PlanBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewPlan().Copy(v) + } + } + return b +} + +// Build creates a list of 'plan' objects using the +// configuration stored in the builder. +func (b *PlanListBuilder) Build() (list *PlanList, err error) { + items := make([]*Plan, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(PlanList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/plan_list_type_json.go b/clientapi/accountsmgmt/v1/plan_list_type_json.go new file mode 100644 index 00000000..bb437697 --- /dev/null +++ b/clientapi/accountsmgmt/v1/plan_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPlanList writes a list of values of the 'plan' type to +// the given writer. +func MarshalPlanList(list []*Plan, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePlanList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePlanList writes a list of value of the 'plan' type to +// the given stream. +func WritePlanList(list []*Plan, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WritePlan(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalPlanList reads a list of values of the 'plan' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalPlanList(source interface{}) (items []*Plan, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadPlanList(iterator) + err = iterator.Error + return +} + +// ReadPlanList reads list of values of the ”plan' type from +// the given iterator. +func ReadPlanList(iterator *jsoniter.Iterator) []*Plan { + list := []*Plan{} + for iterator.ReadArray() { + item := ReadPlan(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/plan_type.go b/clientapi/accountsmgmt/v1/plan_type.go new file mode 100644 index 00000000..1a0665e3 --- /dev/null +++ b/clientapi/accountsmgmt/v1/plan_type.go @@ -0,0 +1,299 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// PlanKind is the name of the type used to represent objects +// of type 'plan'. +const PlanKind = "Plan" + +// PlanLinkKind is the name of the type used to represent links +// to objects of type 'plan'. +const PlanLinkKind = "PlanLink" + +// PlanNilKind is the name of the type used to nil references +// to objects of type 'plan'. +const PlanNilKind = "PlanNil" + +// Plan represents the values of the 'plan' type. +type Plan struct { + bitmap_ uint32 + id string + href string + category string + name string + type_ string +} + +// Kind returns the name of the type of the object. +func (o *Plan) Kind() string { + if o == nil { + return PlanNilKind + } + if o.bitmap_&1 != 0 { + return PlanLinkKind + } + return PlanKind +} + +// Link returns true if this is a link. +func (o *Plan) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Plan) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Plan) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Plan) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Plan) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Plan) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Category returns the value of the 'category' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Plan) Category() string { + if o != nil && o.bitmap_&8 != 0 { + return o.category + } + return "" +} + +// GetCategory returns the value of the 'category' attribute and +// a flag indicating if the attribute has a value. +func (o *Plan) GetCategory() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.category + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Plan) Name() string { + if o != nil && o.bitmap_&16 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *Plan) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.name + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Plan) Type() string { + if o != nil && o.bitmap_&32 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +func (o *Plan) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.type_ + } + return +} + +// PlanListKind is the name of the type used to represent list of objects of +// type 'plan'. +const PlanListKind = "PlanList" + +// PlanListLinkKind is the name of the type used to represent links to list +// of objects of type 'plan'. +const PlanListLinkKind = "PlanListLink" + +// PlanNilKind is the name of the type used to nil lists of objects of +// type 'plan'. +const PlanListNilKind = "PlanListNil" + +// PlanList is a list of values of the 'plan' type. +type PlanList struct { + href string + link bool + items []*Plan +} + +// Kind returns the name of the type of the object. +func (l *PlanList) Kind() string { + if l == nil { + return PlanListNilKind + } + if l.link { + return PlanListLinkKind + } + return PlanListKind +} + +// Link returns true iif this is a link. +func (l *PlanList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *PlanList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *PlanList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *PlanList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *PlanList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *PlanList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *PlanList) SetItems(items []*Plan) { + l.items = items +} + +// Items returns the items of the list. +func (l *PlanList) Items() []*Plan { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *PlanList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *PlanList) Get(i int) *Plan { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *PlanList) Slice() []*Plan { + var slice []*Plan + if l == nil { + slice = make([]*Plan, 0) + } else { + slice = make([]*Plan, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *PlanList) Each(f func(item *Plan) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *PlanList) Range(f func(index int, item *Plan) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/plan_type_json.go b/clientapi/accountsmgmt/v1/plan_type_json.go new file mode 100644 index 00000000..3986e07a --- /dev/null +++ b/clientapi/accountsmgmt/v1/plan_type_json.go @@ -0,0 +1,146 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPlan writes a value of the 'plan' type to the given writer. +func MarshalPlan(object *Plan, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePlan(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePlan writes a value of the 'plan' type to the given stream. +func WritePlan(object *Plan, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(PlanLinkKind) + } else { + stream.WriteString(PlanKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("category") + stream.WriteString(object.category) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalPlan reads a value of the 'plan' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalPlan(source interface{}) (object *Plan, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadPlan(iterator) + err = iterator.Error + return +} + +// ReadPlan reads a value of the 'plan' type from the given iterator. +func ReadPlan(iterator *jsoniter.Iterator) *Plan { + object := &Plan{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == PlanLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "category": + value := iterator.ReadString() + object.category = value + object.bitmap_ |= 8 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 16 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/pull_secrets_request_builder.go b/clientapi/accountsmgmt/v1/pull_secrets_request_builder.go new file mode 100644 index 00000000..bdf2001e --- /dev/null +++ b/clientapi/accountsmgmt/v1/pull_secrets_request_builder.go @@ -0,0 +1,61 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// PullSecretsRequestBuilder contains the data and logic needed to build 'pull_secrets_request' objects. +type PullSecretsRequestBuilder struct { + bitmap_ uint32 + externalResourceId string +} + +// NewPullSecretsRequest creates a new builder of 'pull_secrets_request' objects. +func NewPullSecretsRequest() *PullSecretsRequestBuilder { + return &PullSecretsRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *PullSecretsRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ExternalResourceId sets the value of the 'external_resource_id' attribute to the given value. +func (b *PullSecretsRequestBuilder) ExternalResourceId(value string) *PullSecretsRequestBuilder { + b.externalResourceId = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *PullSecretsRequestBuilder) Copy(object *PullSecretsRequest) *PullSecretsRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.externalResourceId = object.externalResourceId + return b +} + +// Build creates a 'pull_secrets_request' object using the configuration stored in the builder. +func (b *PullSecretsRequestBuilder) Build() (object *PullSecretsRequest, err error) { + object = new(PullSecretsRequest) + object.bitmap_ = b.bitmap_ + object.externalResourceId = b.externalResourceId + return +} diff --git a/clientapi/accountsmgmt/v1/pull_secrets_request_list_builder.go b/clientapi/accountsmgmt/v1/pull_secrets_request_list_builder.go new file mode 100644 index 00000000..0731ceab --- /dev/null +++ b/clientapi/accountsmgmt/v1/pull_secrets_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// PullSecretsRequestListBuilder contains the data and logic needed to build +// 'pull_secrets_request' objects. +type PullSecretsRequestListBuilder struct { + items []*PullSecretsRequestBuilder +} + +// NewPullSecretsRequestList creates a new builder of 'pull_secrets_request' objects. +func NewPullSecretsRequestList() *PullSecretsRequestListBuilder { + return new(PullSecretsRequestListBuilder) +} + +// Items sets the items of the list. +func (b *PullSecretsRequestListBuilder) Items(values ...*PullSecretsRequestBuilder) *PullSecretsRequestListBuilder { + b.items = make([]*PullSecretsRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *PullSecretsRequestListBuilder) 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 *PullSecretsRequestListBuilder) Copy(list *PullSecretsRequestList) *PullSecretsRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*PullSecretsRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewPullSecretsRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'pull_secrets_request' objects using the +// configuration stored in the builder. +func (b *PullSecretsRequestListBuilder) Build() (list *PullSecretsRequestList, err error) { + items := make([]*PullSecretsRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(PullSecretsRequestList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/pull_secrets_request_list_type_json.go b/clientapi/accountsmgmt/v1/pull_secrets_request_list_type_json.go new file mode 100644 index 00000000..daa042df --- /dev/null +++ b/clientapi/accountsmgmt/v1/pull_secrets_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPullSecretsRequestList writes a list of values of the 'pull_secrets_request' type to +// the given writer. +func MarshalPullSecretsRequestList(list []*PullSecretsRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePullSecretsRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePullSecretsRequestList writes a list of value of the 'pull_secrets_request' type to +// the given stream. +func WritePullSecretsRequestList(list []*PullSecretsRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WritePullSecretsRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalPullSecretsRequestList reads a list of values of the 'pull_secrets_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalPullSecretsRequestList(source interface{}) (items []*PullSecretsRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadPullSecretsRequestList(iterator) + err = iterator.Error + return +} + +// ReadPullSecretsRequestList reads list of values of the ”pull_secrets_request' type from +// the given iterator. +func ReadPullSecretsRequestList(iterator *jsoniter.Iterator) []*PullSecretsRequest { + list := []*PullSecretsRequest{} + for iterator.ReadArray() { + item := ReadPullSecretsRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/pull_secrets_request_type.go b/clientapi/accountsmgmt/v1/pull_secrets_request_type.go new file mode 100644 index 00000000..bbcf5964 --- /dev/null +++ b/clientapi/accountsmgmt/v1/pull_secrets_request_type.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// PullSecretsRequest represents the values of the 'pull_secrets_request' type. +type PullSecretsRequest struct { + bitmap_ uint32 + externalResourceId string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *PullSecretsRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ExternalResourceId returns the value of the 'external_resource_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *PullSecretsRequest) ExternalResourceId() string { + if o != nil && o.bitmap_&1 != 0 { + return o.externalResourceId + } + return "" +} + +// GetExternalResourceId returns the value of the 'external_resource_id' attribute and +// a flag indicating if the attribute has a value. +func (o *PullSecretsRequest) GetExternalResourceId() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.externalResourceId + } + return +} + +// PullSecretsRequestListKind is the name of the type used to represent list of objects of +// type 'pull_secrets_request'. +const PullSecretsRequestListKind = "PullSecretsRequestList" + +// PullSecretsRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'pull_secrets_request'. +const PullSecretsRequestListLinkKind = "PullSecretsRequestListLink" + +// PullSecretsRequestNilKind is the name of the type used to nil lists of objects of +// type 'pull_secrets_request'. +const PullSecretsRequestListNilKind = "PullSecretsRequestListNil" + +// PullSecretsRequestList is a list of values of the 'pull_secrets_request' type. +type PullSecretsRequestList struct { + href string + link bool + items []*PullSecretsRequest +} + +// Len returns the length of the list. +func (l *PullSecretsRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *PullSecretsRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *PullSecretsRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *PullSecretsRequestList) SetItems(items []*PullSecretsRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *PullSecretsRequestList) Items() []*PullSecretsRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *PullSecretsRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *PullSecretsRequestList) Get(i int) *PullSecretsRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *PullSecretsRequestList) Slice() []*PullSecretsRequest { + var slice []*PullSecretsRequest + if l == nil { + slice = make([]*PullSecretsRequest, 0) + } else { + slice = make([]*PullSecretsRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *PullSecretsRequestList) Each(f func(item *PullSecretsRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *PullSecretsRequestList) Range(f func(index int, item *PullSecretsRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/pull_secrets_request_type_json.go b/clientapi/accountsmgmt/v1/pull_secrets_request_type_json.go new file mode 100644 index 00000000..acdc63ff --- /dev/null +++ b/clientapi/accountsmgmt/v1/pull_secrets_request_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPullSecretsRequest writes a value of the 'pull_secrets_request' type to the given writer. +func MarshalPullSecretsRequest(object *PullSecretsRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePullSecretsRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePullSecretsRequest writes a value of the 'pull_secrets_request' type to the given stream. +func WritePullSecretsRequest(object *PullSecretsRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_resource_id") + stream.WriteString(object.externalResourceId) + } + stream.WriteObjectEnd() +} + +// UnmarshalPullSecretsRequest reads a value of the 'pull_secrets_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalPullSecretsRequest(source interface{}) (object *PullSecretsRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadPullSecretsRequest(iterator) + err = iterator.Error + return +} + +// ReadPullSecretsRequest reads a value of the 'pull_secrets_request' type from the given iterator. +func ReadPullSecretsRequest(iterator *jsoniter.Iterator) *PullSecretsRequest { + object := &PullSecretsRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "external_resource_id": + value := iterator.ReadString() + object.externalResourceId = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/quota_authorization_request_builder.go b/clientapi/accountsmgmt/v1/quota_authorization_request_builder.go new file mode 100644 index 00000000..f1a7c961 --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_authorization_request_builder.go @@ -0,0 +1,147 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// QuotaAuthorizationRequestBuilder contains the data and logic needed to build 'quota_authorization_request' objects. +type QuotaAuthorizationRequestBuilder struct { + bitmap_ uint32 + accountUsername string + availabilityZone string + displayName string + productID string + productCategory string + quotaVersion string + resources []*ReservedResourceBuilder + reserve bool +} + +// NewQuotaAuthorizationRequest creates a new builder of 'quota_authorization_request' objects. +func NewQuotaAuthorizationRequest() *QuotaAuthorizationRequestBuilder { + return &QuotaAuthorizationRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *QuotaAuthorizationRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AccountUsername sets the value of the 'account_username' attribute to the given value. +func (b *QuotaAuthorizationRequestBuilder) AccountUsername(value string) *QuotaAuthorizationRequestBuilder { + b.accountUsername = value + b.bitmap_ |= 1 + return b +} + +// AvailabilityZone sets the value of the 'availability_zone' attribute to the given value. +func (b *QuotaAuthorizationRequestBuilder) AvailabilityZone(value string) *QuotaAuthorizationRequestBuilder { + b.availabilityZone = value + b.bitmap_ |= 2 + return b +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *QuotaAuthorizationRequestBuilder) DisplayName(value string) *QuotaAuthorizationRequestBuilder { + b.displayName = value + b.bitmap_ |= 4 + return b +} + +// ProductID sets the value of the 'product_ID' attribute to the given value. +func (b *QuotaAuthorizationRequestBuilder) ProductID(value string) *QuotaAuthorizationRequestBuilder { + b.productID = value + b.bitmap_ |= 8 + return b +} + +// ProductCategory sets the value of the 'product_category' attribute to the given value. +func (b *QuotaAuthorizationRequestBuilder) ProductCategory(value string) *QuotaAuthorizationRequestBuilder { + b.productCategory = value + b.bitmap_ |= 16 + return b +} + +// QuotaVersion sets the value of the 'quota_version' attribute to the given value. +func (b *QuotaAuthorizationRequestBuilder) QuotaVersion(value string) *QuotaAuthorizationRequestBuilder { + b.quotaVersion = value + b.bitmap_ |= 32 + return b +} + +// Reserve sets the value of the 'reserve' attribute to the given value. +func (b *QuotaAuthorizationRequestBuilder) Reserve(value bool) *QuotaAuthorizationRequestBuilder { + b.reserve = value + b.bitmap_ |= 64 + return b +} + +// Resources sets the value of the 'resources' attribute to the given values. +func (b *QuotaAuthorizationRequestBuilder) Resources(values ...*ReservedResourceBuilder) *QuotaAuthorizationRequestBuilder { + b.resources = make([]*ReservedResourceBuilder, len(values)) + copy(b.resources, values) + b.bitmap_ |= 128 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *QuotaAuthorizationRequestBuilder) Copy(object *QuotaAuthorizationRequest) *QuotaAuthorizationRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.accountUsername = object.accountUsername + b.availabilityZone = object.availabilityZone + b.displayName = object.displayName + b.productID = object.productID + b.productCategory = object.productCategory + b.quotaVersion = object.quotaVersion + b.reserve = object.reserve + if object.resources != nil { + b.resources = make([]*ReservedResourceBuilder, len(object.resources)) + for i, v := range object.resources { + b.resources[i] = NewReservedResource().Copy(v) + } + } else { + b.resources = nil + } + return b +} + +// Build creates a 'quota_authorization_request' object using the configuration stored in the builder. +func (b *QuotaAuthorizationRequestBuilder) Build() (object *QuotaAuthorizationRequest, err error) { + object = new(QuotaAuthorizationRequest) + object.bitmap_ = b.bitmap_ + object.accountUsername = b.accountUsername + object.availabilityZone = b.availabilityZone + object.displayName = b.displayName + object.productID = b.productID + object.productCategory = b.productCategory + object.quotaVersion = b.quotaVersion + object.reserve = b.reserve + if b.resources != nil { + object.resources = make([]*ReservedResource, len(b.resources)) + for i, v := range b.resources { + object.resources[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/accountsmgmt/v1/quota_authorization_request_list_builder.go b/clientapi/accountsmgmt/v1/quota_authorization_request_list_builder.go new file mode 100644 index 00000000..09c72e9b --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_authorization_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// QuotaAuthorizationRequestListBuilder contains the data and logic needed to build +// 'quota_authorization_request' objects. +type QuotaAuthorizationRequestListBuilder struct { + items []*QuotaAuthorizationRequestBuilder +} + +// NewQuotaAuthorizationRequestList creates a new builder of 'quota_authorization_request' objects. +func NewQuotaAuthorizationRequestList() *QuotaAuthorizationRequestListBuilder { + return new(QuotaAuthorizationRequestListBuilder) +} + +// Items sets the items of the list. +func (b *QuotaAuthorizationRequestListBuilder) Items(values ...*QuotaAuthorizationRequestBuilder) *QuotaAuthorizationRequestListBuilder { + b.items = make([]*QuotaAuthorizationRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *QuotaAuthorizationRequestListBuilder) 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 *QuotaAuthorizationRequestListBuilder) Copy(list *QuotaAuthorizationRequestList) *QuotaAuthorizationRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*QuotaAuthorizationRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewQuotaAuthorizationRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'quota_authorization_request' objects using the +// configuration stored in the builder. +func (b *QuotaAuthorizationRequestListBuilder) Build() (list *QuotaAuthorizationRequestList, err error) { + items := make([]*QuotaAuthorizationRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(QuotaAuthorizationRequestList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/quota_authorization_request_list_type_json.go b/clientapi/accountsmgmt/v1/quota_authorization_request_list_type_json.go new file mode 100644 index 00000000..e8b4c6a5 --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_authorization_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalQuotaAuthorizationRequestList writes a list of values of the 'quota_authorization_request' type to +// the given writer. +func MarshalQuotaAuthorizationRequestList(list []*QuotaAuthorizationRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteQuotaAuthorizationRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteQuotaAuthorizationRequestList writes a list of value of the 'quota_authorization_request' type to +// the given stream. +func WriteQuotaAuthorizationRequestList(list []*QuotaAuthorizationRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteQuotaAuthorizationRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalQuotaAuthorizationRequestList reads a list of values of the 'quota_authorization_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalQuotaAuthorizationRequestList(source interface{}) (items []*QuotaAuthorizationRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadQuotaAuthorizationRequestList(iterator) + err = iterator.Error + return +} + +// ReadQuotaAuthorizationRequestList reads list of values of the ”quota_authorization_request' type from +// the given iterator. +func ReadQuotaAuthorizationRequestList(iterator *jsoniter.Iterator) []*QuotaAuthorizationRequest { + list := []*QuotaAuthorizationRequest{} + for iterator.ReadArray() { + item := ReadQuotaAuthorizationRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/quota_authorization_request_type.go b/clientapi/accountsmgmt/v1/quota_authorization_request_type.go new file mode 100644 index 00000000..9e503881 --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_authorization_request_type.go @@ -0,0 +1,299 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// QuotaAuthorizationRequest represents the values of the 'quota_authorization_request' type. +type QuotaAuthorizationRequest struct { + bitmap_ uint32 + accountUsername string + availabilityZone string + displayName string + productID string + productCategory string + quotaVersion string + resources []*ReservedResource + reserve bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *QuotaAuthorizationRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AccountUsername returns the value of the 'account_username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaAuthorizationRequest) AccountUsername() string { + if o != nil && o.bitmap_&1 != 0 { + return o.accountUsername + } + return "" +} + +// GetAccountUsername returns the value of the 'account_username' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaAuthorizationRequest) GetAccountUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.accountUsername + } + return +} + +// AvailabilityZone returns the value of the 'availability_zone' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaAuthorizationRequest) AvailabilityZone() string { + if o != nil && o.bitmap_&2 != 0 { + return o.availabilityZone + } + return "" +} + +// GetAvailabilityZone returns the value of the 'availability_zone' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaAuthorizationRequest) GetAvailabilityZone() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.availabilityZone + } + return +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaAuthorizationRequest) DisplayName() string { + if o != nil && o.bitmap_&4 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaAuthorizationRequest) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.displayName + } + return +} + +// ProductID returns the value of the 'product_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaAuthorizationRequest) ProductID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.productID + } + return "" +} + +// GetProductID returns the value of the 'product_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaAuthorizationRequest) GetProductID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.productID + } + return +} + +// ProductCategory returns the value of the 'product_category' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaAuthorizationRequest) ProductCategory() string { + if o != nil && o.bitmap_&16 != 0 { + return o.productCategory + } + return "" +} + +// GetProductCategory returns the value of the 'product_category' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaAuthorizationRequest) GetProductCategory() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.productCategory + } + return +} + +// QuotaVersion returns the value of the 'quota_version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaAuthorizationRequest) QuotaVersion() string { + if o != nil && o.bitmap_&32 != 0 { + return o.quotaVersion + } + return "" +} + +// GetQuotaVersion returns the value of the 'quota_version' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaAuthorizationRequest) GetQuotaVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.quotaVersion + } + return +} + +// Reserve returns the value of the 'reserve' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaAuthorizationRequest) Reserve() bool { + if o != nil && o.bitmap_&64 != 0 { + return o.reserve + } + return false +} + +// GetReserve returns the value of the 'reserve' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaAuthorizationRequest) GetReserve() (value bool, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.reserve + } + 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 *QuotaAuthorizationRequest) Resources() []*ReservedResource { + if o != nil && o.bitmap_&128 != 0 { + return o.resources + } + return nil +} + +// GetResources returns the value of the 'resources' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaAuthorizationRequest) GetResources() (value []*ReservedResource, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.resources + } + return +} + +// QuotaAuthorizationRequestListKind is the name of the type used to represent list of objects of +// type 'quota_authorization_request'. +const QuotaAuthorizationRequestListKind = "QuotaAuthorizationRequestList" + +// QuotaAuthorizationRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'quota_authorization_request'. +const QuotaAuthorizationRequestListLinkKind = "QuotaAuthorizationRequestListLink" + +// QuotaAuthorizationRequestNilKind is the name of the type used to nil lists of objects of +// type 'quota_authorization_request'. +const QuotaAuthorizationRequestListNilKind = "QuotaAuthorizationRequestListNil" + +// QuotaAuthorizationRequestList is a list of values of the 'quota_authorization_request' type. +type QuotaAuthorizationRequestList struct { + href string + link bool + items []*QuotaAuthorizationRequest +} + +// Len returns the length of the list. +func (l *QuotaAuthorizationRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *QuotaAuthorizationRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *QuotaAuthorizationRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *QuotaAuthorizationRequestList) SetItems(items []*QuotaAuthorizationRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *QuotaAuthorizationRequestList) Items() []*QuotaAuthorizationRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *QuotaAuthorizationRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *QuotaAuthorizationRequestList) Get(i int) *QuotaAuthorizationRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *QuotaAuthorizationRequestList) Slice() []*QuotaAuthorizationRequest { + var slice []*QuotaAuthorizationRequest + if l == nil { + slice = make([]*QuotaAuthorizationRequest, 0) + } else { + slice = make([]*QuotaAuthorizationRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *QuotaAuthorizationRequestList) Each(f func(item *QuotaAuthorizationRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *QuotaAuthorizationRequestList) Range(f func(index int, item *QuotaAuthorizationRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/quota_authorization_request_type_json.go b/clientapi/accountsmgmt/v1/quota_authorization_request_type_json.go new file mode 100644 index 00000000..6c464d01 --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_authorization_request_type_json.go @@ -0,0 +1,177 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalQuotaAuthorizationRequest writes a value of the 'quota_authorization_request' type to the given writer. +func MarshalQuotaAuthorizationRequest(object *QuotaAuthorizationRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteQuotaAuthorizationRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteQuotaAuthorizationRequest writes a value of the 'quota_authorization_request' type to the given stream. +func WriteQuotaAuthorizationRequest(object *QuotaAuthorizationRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_username") + stream.WriteString(object.accountUsername) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zone") + stream.WriteString(object.availabilityZone) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product_id") + stream.WriteString(object.productID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product_category") + stream.WriteString(object.productCategory) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("quota_version") + stream.WriteString(object.quotaVersion) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("reserve") + stream.WriteBool(object.reserve) + count++ + } + present_ = object.bitmap_&128 != 0 && object.resources != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resources") + WriteReservedResourceList(object.resources, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalQuotaAuthorizationRequest reads a value of the 'quota_authorization_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalQuotaAuthorizationRequest(source interface{}) (object *QuotaAuthorizationRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadQuotaAuthorizationRequest(iterator) + err = iterator.Error + return +} + +// ReadQuotaAuthorizationRequest reads a value of the 'quota_authorization_request' type from the given iterator. +func ReadQuotaAuthorizationRequest(iterator *jsoniter.Iterator) *QuotaAuthorizationRequest { + object := &QuotaAuthorizationRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "account_username": + value := iterator.ReadString() + object.accountUsername = value + object.bitmap_ |= 1 + case "availability_zone": + value := iterator.ReadString() + object.availabilityZone = value + object.bitmap_ |= 2 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 4 + case "product_id": + value := iterator.ReadString() + object.productID = value + object.bitmap_ |= 8 + case "product_category": + value := iterator.ReadString() + object.productCategory = value + object.bitmap_ |= 16 + case "quota_version": + value := iterator.ReadString() + object.quotaVersion = value + object.bitmap_ |= 32 + case "reserve": + value := iterator.ReadBool() + object.reserve = value + object.bitmap_ |= 64 + case "resources": + value := ReadReservedResourceList(iterator) + object.resources = value + object.bitmap_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/quota_authorization_response_builder.go b/clientapi/accountsmgmt/v1/quota_authorization_response_builder.go new file mode 100644 index 00000000..43168f08 --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_authorization_response_builder.go @@ -0,0 +1,110 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// QuotaAuthorizationResponseBuilder contains the data and logic needed to build 'quota_authorization_response' objects. +type QuotaAuthorizationResponseBuilder struct { + bitmap_ uint32 + excessResources []*ReservedResourceBuilder + subscription *SubscriptionBuilder + allowed bool +} + +// NewQuotaAuthorizationResponse creates a new builder of 'quota_authorization_response' objects. +func NewQuotaAuthorizationResponse() *QuotaAuthorizationResponseBuilder { + return &QuotaAuthorizationResponseBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *QuotaAuthorizationResponseBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Allowed sets the value of the 'allowed' attribute to the given value. +func (b *QuotaAuthorizationResponseBuilder) Allowed(value bool) *QuotaAuthorizationResponseBuilder { + b.allowed = value + b.bitmap_ |= 1 + return b +} + +// ExcessResources sets the value of the 'excess_resources' attribute to the given values. +func (b *QuotaAuthorizationResponseBuilder) ExcessResources(values ...*ReservedResourceBuilder) *QuotaAuthorizationResponseBuilder { + b.excessResources = make([]*ReservedResourceBuilder, len(values)) + copy(b.excessResources, values) + b.bitmap_ |= 2 + return b +} + +// Subscription sets the value of the 'subscription' attribute to the given value. +func (b *QuotaAuthorizationResponseBuilder) Subscription(value *SubscriptionBuilder) *QuotaAuthorizationResponseBuilder { + b.subscription = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *QuotaAuthorizationResponseBuilder) Copy(object *QuotaAuthorizationResponse) *QuotaAuthorizationResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.allowed = object.allowed + if object.excessResources != nil { + b.excessResources = make([]*ReservedResourceBuilder, len(object.excessResources)) + for i, v := range object.excessResources { + b.excessResources[i] = NewReservedResource().Copy(v) + } + } else { + b.excessResources = nil + } + if object.subscription != nil { + b.subscription = NewSubscription().Copy(object.subscription) + } else { + b.subscription = nil + } + return b +} + +// Build creates a 'quota_authorization_response' object using the configuration stored in the builder. +func (b *QuotaAuthorizationResponseBuilder) Build() (object *QuotaAuthorizationResponse, err error) { + object = new(QuotaAuthorizationResponse) + object.bitmap_ = b.bitmap_ + object.allowed = b.allowed + if b.excessResources != nil { + object.excessResources = make([]*ReservedResource, len(b.excessResources)) + for i, v := range b.excessResources { + object.excessResources[i], err = v.Build() + if err != nil { + return + } + } + } + if b.subscription != nil { + object.subscription, err = b.subscription.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/accountsmgmt/v1/quota_authorization_response_list_builder.go b/clientapi/accountsmgmt/v1/quota_authorization_response_list_builder.go new file mode 100644 index 00000000..d1a5ce84 --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_authorization_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// QuotaAuthorizationResponseListBuilder contains the data and logic needed to build +// 'quota_authorization_response' objects. +type QuotaAuthorizationResponseListBuilder struct { + items []*QuotaAuthorizationResponseBuilder +} + +// NewQuotaAuthorizationResponseList creates a new builder of 'quota_authorization_response' objects. +func NewQuotaAuthorizationResponseList() *QuotaAuthorizationResponseListBuilder { + return new(QuotaAuthorizationResponseListBuilder) +} + +// Items sets the items of the list. +func (b *QuotaAuthorizationResponseListBuilder) Items(values ...*QuotaAuthorizationResponseBuilder) *QuotaAuthorizationResponseListBuilder { + b.items = make([]*QuotaAuthorizationResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *QuotaAuthorizationResponseListBuilder) 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 *QuotaAuthorizationResponseListBuilder) Copy(list *QuotaAuthorizationResponseList) *QuotaAuthorizationResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*QuotaAuthorizationResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewQuotaAuthorizationResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'quota_authorization_response' objects using the +// configuration stored in the builder. +func (b *QuotaAuthorizationResponseListBuilder) Build() (list *QuotaAuthorizationResponseList, err error) { + items := make([]*QuotaAuthorizationResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(QuotaAuthorizationResponseList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/quota_authorization_response_list_type_json.go b/clientapi/accountsmgmt/v1/quota_authorization_response_list_type_json.go new file mode 100644 index 00000000..8af787c9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_authorization_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalQuotaAuthorizationResponseList writes a list of values of the 'quota_authorization_response' type to +// the given writer. +func MarshalQuotaAuthorizationResponseList(list []*QuotaAuthorizationResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteQuotaAuthorizationResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteQuotaAuthorizationResponseList writes a list of value of the 'quota_authorization_response' type to +// the given stream. +func WriteQuotaAuthorizationResponseList(list []*QuotaAuthorizationResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteQuotaAuthorizationResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalQuotaAuthorizationResponseList reads a list of values of the 'quota_authorization_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalQuotaAuthorizationResponseList(source interface{}) (items []*QuotaAuthorizationResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadQuotaAuthorizationResponseList(iterator) + err = iterator.Error + return +} + +// ReadQuotaAuthorizationResponseList reads list of values of the ”quota_authorization_response' type from +// the given iterator. +func ReadQuotaAuthorizationResponseList(iterator *jsoniter.Iterator) []*QuotaAuthorizationResponse { + list := []*QuotaAuthorizationResponse{} + for iterator.ReadArray() { + item := ReadQuotaAuthorizationResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/quota_authorization_response_type.go b/clientapi/accountsmgmt/v1/quota_authorization_response_type.go new file mode 100644 index 00000000..790aaa7e --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_authorization_response_type.go @@ -0,0 +1,199 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// QuotaAuthorizationResponse represents the values of the 'quota_authorization_response' type. +type QuotaAuthorizationResponse struct { + bitmap_ uint32 + excessResources []*ReservedResource + subscription *Subscription + allowed bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *QuotaAuthorizationResponse) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Allowed returns the value of the 'allowed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaAuthorizationResponse) Allowed() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.allowed + } + return false +} + +// GetAllowed returns the value of the 'allowed' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaAuthorizationResponse) GetAllowed() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.allowed + } + return +} + +// ExcessResources returns the value of the 'excess_resources' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaAuthorizationResponse) ExcessResources() []*ReservedResource { + if o != nil && o.bitmap_&2 != 0 { + return o.excessResources + } + return nil +} + +// GetExcessResources returns the value of the 'excess_resources' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaAuthorizationResponse) GetExcessResources() (value []*ReservedResource, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.excessResources + } + return +} + +// Subscription returns the value of the 'subscription' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaAuthorizationResponse) Subscription() *Subscription { + if o != nil && o.bitmap_&4 != 0 { + return o.subscription + } + return nil +} + +// GetSubscription returns the value of the 'subscription' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaAuthorizationResponse) GetSubscription() (value *Subscription, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.subscription + } + return +} + +// QuotaAuthorizationResponseListKind is the name of the type used to represent list of objects of +// type 'quota_authorization_response'. +const QuotaAuthorizationResponseListKind = "QuotaAuthorizationResponseList" + +// QuotaAuthorizationResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'quota_authorization_response'. +const QuotaAuthorizationResponseListLinkKind = "QuotaAuthorizationResponseListLink" + +// QuotaAuthorizationResponseNilKind is the name of the type used to nil lists of objects of +// type 'quota_authorization_response'. +const QuotaAuthorizationResponseListNilKind = "QuotaAuthorizationResponseListNil" + +// QuotaAuthorizationResponseList is a list of values of the 'quota_authorization_response' type. +type QuotaAuthorizationResponseList struct { + href string + link bool + items []*QuotaAuthorizationResponse +} + +// Len returns the length of the list. +func (l *QuotaAuthorizationResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *QuotaAuthorizationResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *QuotaAuthorizationResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *QuotaAuthorizationResponseList) SetItems(items []*QuotaAuthorizationResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *QuotaAuthorizationResponseList) Items() []*QuotaAuthorizationResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *QuotaAuthorizationResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *QuotaAuthorizationResponseList) Get(i int) *QuotaAuthorizationResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *QuotaAuthorizationResponseList) Slice() []*QuotaAuthorizationResponse { + var slice []*QuotaAuthorizationResponse + if l == nil { + slice = make([]*QuotaAuthorizationResponse, 0) + } else { + slice = make([]*QuotaAuthorizationResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *QuotaAuthorizationResponseList) Each(f func(item *QuotaAuthorizationResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *QuotaAuthorizationResponseList) Range(f func(index int, item *QuotaAuthorizationResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/quota_authorization_response_type_json.go b/clientapi/accountsmgmt/v1/quota_authorization_response_type_json.go new file mode 100644 index 00000000..a7960474 --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_authorization_response_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalQuotaAuthorizationResponse writes a value of the 'quota_authorization_response' type to the given writer. +func MarshalQuotaAuthorizationResponse(object *QuotaAuthorizationResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteQuotaAuthorizationResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteQuotaAuthorizationResponse writes a value of the 'quota_authorization_response' type to the given stream. +func WriteQuotaAuthorizationResponse(object *QuotaAuthorizationResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("allowed") + stream.WriteBool(object.allowed) + count++ + } + present_ = object.bitmap_&2 != 0 && object.excessResources != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("excess_resources") + WriteReservedResourceList(object.excessResources, stream) + count++ + } + present_ = object.bitmap_&4 != 0 && object.subscription != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription") + WriteSubscription(object.subscription, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalQuotaAuthorizationResponse reads a value of the 'quota_authorization_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalQuotaAuthorizationResponse(source interface{}) (object *QuotaAuthorizationResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadQuotaAuthorizationResponse(iterator) + err = iterator.Error + return +} + +// ReadQuotaAuthorizationResponse reads a value of the 'quota_authorization_response' type from the given iterator. +func ReadQuotaAuthorizationResponse(iterator *jsoniter.Iterator) *QuotaAuthorizationResponse { + object := &QuotaAuthorizationResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "allowed": + value := iterator.ReadBool() + object.allowed = value + object.bitmap_ |= 1 + case "excess_resources": + value := ReadReservedResourceList(iterator) + object.excessResources = value + object.bitmap_ |= 2 + case "subscription": + value := ReadSubscription(iterator) + object.subscription = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/quota_cost_builder.go b/clientapi/accountsmgmt/v1/quota_cost_builder.go new file mode 100644 index 00000000..f6846841 --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_cost_builder.go @@ -0,0 +1,153 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// QuotaCostBuilder contains the data and logic needed to build 'quota_cost' objects. +type QuotaCostBuilder struct { + bitmap_ uint32 + allowed int + cloudAccounts []*CloudAccountBuilder + consumed int + organizationID string + quotaID string + relatedResources []*RelatedResourceBuilder + version string +} + +// NewQuotaCost creates a new builder of 'quota_cost' objects. +func NewQuotaCost() *QuotaCostBuilder { + return &QuotaCostBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *QuotaCostBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Allowed sets the value of the 'allowed' attribute to the given value. +func (b *QuotaCostBuilder) Allowed(value int) *QuotaCostBuilder { + b.allowed = value + b.bitmap_ |= 1 + return b +} + +// CloudAccounts sets the value of the 'cloud_accounts' attribute to the given values. +func (b *QuotaCostBuilder) CloudAccounts(values ...*CloudAccountBuilder) *QuotaCostBuilder { + b.cloudAccounts = make([]*CloudAccountBuilder, len(values)) + copy(b.cloudAccounts, values) + b.bitmap_ |= 2 + return b +} + +// Consumed sets the value of the 'consumed' attribute to the given value. +func (b *QuotaCostBuilder) Consumed(value int) *QuotaCostBuilder { + b.consumed = value + b.bitmap_ |= 4 + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *QuotaCostBuilder) OrganizationID(value string) *QuotaCostBuilder { + b.organizationID = value + b.bitmap_ |= 8 + return b +} + +// QuotaID sets the value of the 'quota_ID' attribute to the given value. +func (b *QuotaCostBuilder) QuotaID(value string) *QuotaCostBuilder { + b.quotaID = value + b.bitmap_ |= 16 + return b +} + +// RelatedResources sets the value of the 'related_resources' attribute to the given values. +func (b *QuotaCostBuilder) RelatedResources(values ...*RelatedResourceBuilder) *QuotaCostBuilder { + b.relatedResources = make([]*RelatedResourceBuilder, len(values)) + copy(b.relatedResources, values) + b.bitmap_ |= 32 + return b +} + +// Version sets the value of the 'version' attribute to the given value. +func (b *QuotaCostBuilder) Version(value string) *QuotaCostBuilder { + b.version = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *QuotaCostBuilder) Copy(object *QuotaCost) *QuotaCostBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.allowed = object.allowed + if object.cloudAccounts != nil { + b.cloudAccounts = make([]*CloudAccountBuilder, len(object.cloudAccounts)) + for i, v := range object.cloudAccounts { + b.cloudAccounts[i] = NewCloudAccount().Copy(v) + } + } else { + b.cloudAccounts = nil + } + b.consumed = object.consumed + b.organizationID = object.organizationID + b.quotaID = object.quotaID + if object.relatedResources != nil { + b.relatedResources = make([]*RelatedResourceBuilder, len(object.relatedResources)) + for i, v := range object.relatedResources { + b.relatedResources[i] = NewRelatedResource().Copy(v) + } + } else { + b.relatedResources = nil + } + b.version = object.version + return b +} + +// Build creates a 'quota_cost' object using the configuration stored in the builder. +func (b *QuotaCostBuilder) Build() (object *QuotaCost, err error) { + object = new(QuotaCost) + object.bitmap_ = b.bitmap_ + object.allowed = b.allowed + if b.cloudAccounts != nil { + object.cloudAccounts = make([]*CloudAccount, len(b.cloudAccounts)) + for i, v := range b.cloudAccounts { + object.cloudAccounts[i], err = v.Build() + if err != nil { + return + } + } + } + object.consumed = b.consumed + object.organizationID = b.organizationID + object.quotaID = b.quotaID + if b.relatedResources != nil { + object.relatedResources = make([]*RelatedResource, len(b.relatedResources)) + for i, v := range b.relatedResources { + object.relatedResources[i], err = v.Build() + if err != nil { + return + } + } + } + object.version = b.version + return +} diff --git a/clientapi/accountsmgmt/v1/quota_cost_list_builder.go b/clientapi/accountsmgmt/v1/quota_cost_list_builder.go new file mode 100644 index 00000000..693a533f --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_cost_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// QuotaCostListBuilder contains the data and logic needed to build +// 'quota_cost' objects. +type QuotaCostListBuilder struct { + items []*QuotaCostBuilder +} + +// NewQuotaCostList creates a new builder of 'quota_cost' objects. +func NewQuotaCostList() *QuotaCostListBuilder { + return new(QuotaCostListBuilder) +} + +// Items sets the items of the list. +func (b *QuotaCostListBuilder) Items(values ...*QuotaCostBuilder) *QuotaCostListBuilder { + b.items = make([]*QuotaCostBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *QuotaCostListBuilder) 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 *QuotaCostListBuilder) Copy(list *QuotaCostList) *QuotaCostListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*QuotaCostBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewQuotaCost().Copy(v) + } + } + return b +} + +// Build creates a list of 'quota_cost' objects using the +// configuration stored in the builder. +func (b *QuotaCostListBuilder) Build() (list *QuotaCostList, err error) { + items := make([]*QuotaCost, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(QuotaCostList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/quota_cost_list_type_json.go b/clientapi/accountsmgmt/v1/quota_cost_list_type_json.go new file mode 100644 index 00000000..447ac09a --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_cost_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalQuotaCostList writes a list of values of the 'quota_cost' type to +// the given writer. +func MarshalQuotaCostList(list []*QuotaCost, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteQuotaCostList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteQuotaCostList writes a list of value of the 'quota_cost' type to +// the given stream. +func WriteQuotaCostList(list []*QuotaCost, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteQuotaCost(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalQuotaCostList reads a list of values of the 'quota_cost' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalQuotaCostList(source interface{}) (items []*QuotaCost, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadQuotaCostList(iterator) + err = iterator.Error + return +} + +// ReadQuotaCostList reads list of values of the ”quota_cost' type from +// the given iterator. +func ReadQuotaCostList(iterator *jsoniter.Iterator) []*QuotaCost { + list := []*QuotaCost{} + for iterator.ReadArray() { + item := ReadQuotaCost(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/quota_cost_type.go b/clientapi/accountsmgmt/v1/quota_cost_type.go new file mode 100644 index 00000000..19ce2141 --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_cost_type.go @@ -0,0 +1,279 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// QuotaCost represents the values of the 'quota_cost' type. +type QuotaCost struct { + bitmap_ uint32 + allowed int + cloudAccounts []*CloudAccount + consumed int + organizationID string + quotaID string + relatedResources []*RelatedResource + version string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *QuotaCost) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Allowed returns the value of the 'allowed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaCost) Allowed() int { + if o != nil && o.bitmap_&1 != 0 { + return o.allowed + } + return 0 +} + +// GetAllowed returns the value of the 'allowed' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaCost) GetAllowed() (value int, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.allowed + } + return +} + +// CloudAccounts returns the value of the 'cloud_accounts' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaCost) CloudAccounts() []*CloudAccount { + if o != nil && o.bitmap_&2 != 0 { + return o.cloudAccounts + } + return nil +} + +// GetCloudAccounts returns the value of the 'cloud_accounts' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaCost) GetCloudAccounts() (value []*CloudAccount, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.cloudAccounts + } + return +} + +// Consumed returns the value of the 'consumed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaCost) Consumed() int { + if o != nil && o.bitmap_&4 != 0 { + return o.consumed + } + return 0 +} + +// GetConsumed returns the value of the 'consumed' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaCost) GetConsumed() (value int, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.consumed + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaCost) OrganizationID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaCost) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.organizationID + } + return +} + +// QuotaID returns the value of the 'quota_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaCost) QuotaID() string { + if o != nil && o.bitmap_&16 != 0 { + return o.quotaID + } + return "" +} + +// GetQuotaID returns the value of the 'quota_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaCost) GetQuotaID() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.quotaID + } + return +} + +// RelatedResources returns the value of the 'related_resources' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaCost) RelatedResources() []*RelatedResource { + if o != nil && o.bitmap_&32 != 0 { + return o.relatedResources + } + return nil +} + +// GetRelatedResources returns the value of the 'related_resources' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaCost) GetRelatedResources() (value []*RelatedResource, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.relatedResources + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaCost) Version() string { + if o != nil && o.bitmap_&64 != 0 { + return o.version + } + return "" +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaCost) GetVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.version + } + return +} + +// QuotaCostListKind is the name of the type used to represent list of objects of +// type 'quota_cost'. +const QuotaCostListKind = "QuotaCostList" + +// QuotaCostListLinkKind is the name of the type used to represent links to list +// of objects of type 'quota_cost'. +const QuotaCostListLinkKind = "QuotaCostListLink" + +// QuotaCostNilKind is the name of the type used to nil lists of objects of +// type 'quota_cost'. +const QuotaCostListNilKind = "QuotaCostListNil" + +// QuotaCostList is a list of values of the 'quota_cost' type. +type QuotaCostList struct { + href string + link bool + items []*QuotaCost +} + +// Len returns the length of the list. +func (l *QuotaCostList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *QuotaCostList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *QuotaCostList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *QuotaCostList) SetItems(items []*QuotaCost) { + l.items = items +} + +// Items returns the items of the list. +func (l *QuotaCostList) Items() []*QuotaCost { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *QuotaCostList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *QuotaCostList) Get(i int) *QuotaCost { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *QuotaCostList) Slice() []*QuotaCost { + var slice []*QuotaCost + if l == nil { + slice = make([]*QuotaCost, 0) + } else { + slice = make([]*QuotaCost, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *QuotaCostList) Each(f func(item *QuotaCost) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *QuotaCostList) Range(f func(index int, item *QuotaCost) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/quota_cost_type_json.go b/clientapi/accountsmgmt/v1/quota_cost_type_json.go new file mode 100644 index 00000000..1c358cfd --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_cost_type_json.go @@ -0,0 +1,164 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalQuotaCost writes a value of the 'quota_cost' type to the given writer. +func MarshalQuotaCost(object *QuotaCost, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteQuotaCost(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteQuotaCost writes a value of the 'quota_cost' type to the given stream. +func WriteQuotaCost(object *QuotaCost, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("allowed") + stream.WriteInt(object.allowed) + count++ + } + present_ = object.bitmap_&2 != 0 && object.cloudAccounts != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_accounts") + WriteCloudAccountList(object.cloudAccounts, stream) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("consumed") + stream.WriteInt(object.consumed) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("quota_id") + stream.WriteString(object.quotaID) + count++ + } + present_ = object.bitmap_&32 != 0 && object.relatedResources != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("related_resources") + WriteRelatedResourceList(object.relatedResources, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + stream.WriteString(object.version) + } + stream.WriteObjectEnd() +} + +// UnmarshalQuotaCost reads a value of the 'quota_cost' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalQuotaCost(source interface{}) (object *QuotaCost, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadQuotaCost(iterator) + err = iterator.Error + return +} + +// ReadQuotaCost reads a value of the 'quota_cost' type from the given iterator. +func ReadQuotaCost(iterator *jsoniter.Iterator) *QuotaCost { + object := &QuotaCost{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "allowed": + value := iterator.ReadInt() + object.allowed = value + object.bitmap_ |= 1 + case "cloud_accounts": + value := ReadCloudAccountList(iterator) + object.cloudAccounts = value + object.bitmap_ |= 2 + case "consumed": + value := iterator.ReadInt() + object.consumed = value + object.bitmap_ |= 4 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 8 + case "quota_id": + value := iterator.ReadString() + object.quotaID = value + object.bitmap_ |= 16 + case "related_resources": + value := ReadRelatedResourceList(iterator) + object.relatedResources = value + object.bitmap_ |= 32 + case "version": + value := iterator.ReadString() + object.version = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/quota_rules_builder.go b/clientapi/accountsmgmt/v1/quota_rules_builder.go new file mode 100644 index 00000000..d2b26bcd --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_rules_builder.go @@ -0,0 +1,131 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// QuotaRulesBuilder contains the data and logic needed to build 'quota_rules' objects. +type QuotaRulesBuilder struct { + bitmap_ uint32 + availabilityZone string + billingModel string + byoc string + cloud string + cost int + name string + product string + quotaId string +} + +// NewQuotaRules creates a new builder of 'quota_rules' objects. +func NewQuotaRules() *QuotaRulesBuilder { + return &QuotaRulesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *QuotaRulesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AvailabilityZone sets the value of the 'availability_zone' attribute to the given value. +func (b *QuotaRulesBuilder) AvailabilityZone(value string) *QuotaRulesBuilder { + b.availabilityZone = value + b.bitmap_ |= 1 + return b +} + +// BillingModel sets the value of the 'billing_model' attribute to the given value. +func (b *QuotaRulesBuilder) BillingModel(value string) *QuotaRulesBuilder { + b.billingModel = value + b.bitmap_ |= 2 + return b +} + +// Byoc sets the value of the 'byoc' attribute to the given value. +func (b *QuotaRulesBuilder) Byoc(value string) *QuotaRulesBuilder { + b.byoc = value + b.bitmap_ |= 4 + return b +} + +// Cloud sets the value of the 'cloud' attribute to the given value. +func (b *QuotaRulesBuilder) Cloud(value string) *QuotaRulesBuilder { + b.cloud = value + b.bitmap_ |= 8 + return b +} + +// Cost sets the value of the 'cost' attribute to the given value. +func (b *QuotaRulesBuilder) Cost(value int) *QuotaRulesBuilder { + b.cost = value + b.bitmap_ |= 16 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *QuotaRulesBuilder) Name(value string) *QuotaRulesBuilder { + b.name = value + b.bitmap_ |= 32 + return b +} + +// Product sets the value of the 'product' attribute to the given value. +func (b *QuotaRulesBuilder) Product(value string) *QuotaRulesBuilder { + b.product = value + b.bitmap_ |= 64 + return b +} + +// QuotaId sets the value of the 'quota_id' attribute to the given value. +func (b *QuotaRulesBuilder) QuotaId(value string) *QuotaRulesBuilder { + b.quotaId = value + b.bitmap_ |= 128 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *QuotaRulesBuilder) Copy(object *QuotaRules) *QuotaRulesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.availabilityZone = object.availabilityZone + b.billingModel = object.billingModel + b.byoc = object.byoc + b.cloud = object.cloud + b.cost = object.cost + b.name = object.name + b.product = object.product + b.quotaId = object.quotaId + return b +} + +// Build creates a 'quota_rules' object using the configuration stored in the builder. +func (b *QuotaRulesBuilder) Build() (object *QuotaRules, err error) { + object = new(QuotaRules) + object.bitmap_ = b.bitmap_ + object.availabilityZone = b.availabilityZone + object.billingModel = b.billingModel + object.byoc = b.byoc + object.cloud = b.cloud + object.cost = b.cost + object.name = b.name + object.product = b.product + object.quotaId = b.quotaId + return +} diff --git a/clientapi/accountsmgmt/v1/quota_rules_list_builder.go b/clientapi/accountsmgmt/v1/quota_rules_list_builder.go new file mode 100644 index 00000000..8423babe --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_rules_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// QuotaRulesListBuilder contains the data and logic needed to build +// 'quota_rules' objects. +type QuotaRulesListBuilder struct { + items []*QuotaRulesBuilder +} + +// NewQuotaRulesList creates a new builder of 'quota_rules' objects. +func NewQuotaRulesList() *QuotaRulesListBuilder { + return new(QuotaRulesListBuilder) +} + +// Items sets the items of the list. +func (b *QuotaRulesListBuilder) Items(values ...*QuotaRulesBuilder) *QuotaRulesListBuilder { + b.items = make([]*QuotaRulesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *QuotaRulesListBuilder) 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 *QuotaRulesListBuilder) Copy(list *QuotaRulesList) *QuotaRulesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*QuotaRulesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewQuotaRules().Copy(v) + } + } + return b +} + +// Build creates a list of 'quota_rules' objects using the +// configuration stored in the builder. +func (b *QuotaRulesListBuilder) Build() (list *QuotaRulesList, err error) { + items := make([]*QuotaRules, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(QuotaRulesList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/quota_rules_list_type_json.go b/clientapi/accountsmgmt/v1/quota_rules_list_type_json.go new file mode 100644 index 00000000..8c2965a9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_rules_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalQuotaRulesList writes a list of values of the 'quota_rules' type to +// the given writer. +func MarshalQuotaRulesList(list []*QuotaRules, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteQuotaRulesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteQuotaRulesList writes a list of value of the 'quota_rules' type to +// the given stream. +func WriteQuotaRulesList(list []*QuotaRules, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteQuotaRules(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalQuotaRulesList reads a list of values of the 'quota_rules' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalQuotaRulesList(source interface{}) (items []*QuotaRules, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadQuotaRulesList(iterator) + err = iterator.Error + return +} + +// ReadQuotaRulesList reads list of values of the ”quota_rules' type from +// the given iterator. +func ReadQuotaRulesList(iterator *jsoniter.Iterator) []*QuotaRules { + list := []*QuotaRules{} + for iterator.ReadArray() { + item := ReadQuotaRules(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/quota_rules_type.go b/clientapi/accountsmgmt/v1/quota_rules_type.go new file mode 100644 index 00000000..6b9673a3 --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_rules_type.go @@ -0,0 +1,299 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// QuotaRules represents the values of the 'quota_rules' type. +type QuotaRules struct { + bitmap_ uint32 + availabilityZone string + billingModel string + byoc string + cloud string + cost int + name string + product string + quotaId string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *QuotaRules) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AvailabilityZone returns the value of the 'availability_zone' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaRules) AvailabilityZone() string { + if o != nil && o.bitmap_&1 != 0 { + return o.availabilityZone + } + return "" +} + +// GetAvailabilityZone returns the value of the 'availability_zone' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaRules) GetAvailabilityZone() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.availabilityZone + } + return +} + +// BillingModel returns the value of the 'billing_model' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaRules) BillingModel() string { + if o != nil && o.bitmap_&2 != 0 { + return o.billingModel + } + return "" +} + +// GetBillingModel returns the value of the 'billing_model' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaRules) GetBillingModel() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.billingModel + } + return +} + +// Byoc returns the value of the 'byoc' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaRules) Byoc() string { + if o != nil && o.bitmap_&4 != 0 { + return o.byoc + } + return "" +} + +// GetByoc returns the value of the 'byoc' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaRules) GetByoc() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.byoc + } + return +} + +// Cloud returns the value of the 'cloud' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaRules) Cloud() string { + if o != nil && o.bitmap_&8 != 0 { + return o.cloud + } + return "" +} + +// GetCloud returns the value of the 'cloud' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaRules) GetCloud() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.cloud + } + return +} + +// Cost returns the value of the 'cost' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaRules) Cost() int { + if o != nil && o.bitmap_&16 != 0 { + return o.cost + } + return 0 +} + +// GetCost returns the value of the 'cost' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaRules) GetCost() (value int, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.cost + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaRules) Name() string { + if o != nil && o.bitmap_&32 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaRules) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.name + } + return +} + +// Product returns the value of the 'product' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaRules) Product() string { + if o != nil && o.bitmap_&64 != 0 { + return o.product + } + return "" +} + +// GetProduct returns the value of the 'product' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaRules) GetProduct() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.product + } + return +} + +// QuotaId returns the value of the 'quota_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *QuotaRules) QuotaId() string { + if o != nil && o.bitmap_&128 != 0 { + return o.quotaId + } + return "" +} + +// GetQuotaId returns the value of the 'quota_id' attribute and +// a flag indicating if the attribute has a value. +func (o *QuotaRules) GetQuotaId() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.quotaId + } + return +} + +// QuotaRulesListKind is the name of the type used to represent list of objects of +// type 'quota_rules'. +const QuotaRulesListKind = "QuotaRulesList" + +// QuotaRulesListLinkKind is the name of the type used to represent links to list +// of objects of type 'quota_rules'. +const QuotaRulesListLinkKind = "QuotaRulesListLink" + +// QuotaRulesNilKind is the name of the type used to nil lists of objects of +// type 'quota_rules'. +const QuotaRulesListNilKind = "QuotaRulesListNil" + +// QuotaRulesList is a list of values of the 'quota_rules' type. +type QuotaRulesList struct { + href string + link bool + items []*QuotaRules +} + +// Len returns the length of the list. +func (l *QuotaRulesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *QuotaRulesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *QuotaRulesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *QuotaRulesList) SetItems(items []*QuotaRules) { + l.items = items +} + +// Items returns the items of the list. +func (l *QuotaRulesList) Items() []*QuotaRules { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *QuotaRulesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *QuotaRulesList) Get(i int) *QuotaRules { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *QuotaRulesList) Slice() []*QuotaRules { + var slice []*QuotaRules + if l == nil { + slice = make([]*QuotaRules, 0) + } else { + slice = make([]*QuotaRules, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *QuotaRulesList) Each(f func(item *QuotaRules) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *QuotaRulesList) Range(f func(index int, item *QuotaRules) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/quota_rules_type_json.go b/clientapi/accountsmgmt/v1/quota_rules_type_json.go new file mode 100644 index 00000000..1cebee5a --- /dev/null +++ b/clientapi/accountsmgmt/v1/quota_rules_type_json.go @@ -0,0 +1,177 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalQuotaRules writes a value of the 'quota_rules' type to the given writer. +func MarshalQuotaRules(object *QuotaRules, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteQuotaRules(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteQuotaRules writes a value of the 'quota_rules' type to the given stream. +func WriteQuotaRules(object *QuotaRules, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zone") + stream.WriteString(object.availabilityZone) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_model") + stream.WriteString(object.billingModel) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("byoc") + stream.WriteString(object.byoc) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud") + stream.WriteString(object.cloud) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cost") + stream.WriteInt(object.cost) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product") + stream.WriteString(object.product) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("quota_id") + stream.WriteString(object.quotaId) + } + stream.WriteObjectEnd() +} + +// UnmarshalQuotaRules reads a value of the 'quota_rules' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalQuotaRules(source interface{}) (object *QuotaRules, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadQuotaRules(iterator) + err = iterator.Error + return +} + +// ReadQuotaRules reads a value of the 'quota_rules' type from the given iterator. +func ReadQuotaRules(iterator *jsoniter.Iterator) *QuotaRules { + object := &QuotaRules{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "availability_zone": + value := iterator.ReadString() + object.availabilityZone = value + object.bitmap_ |= 1 + case "billing_model": + value := iterator.ReadString() + object.billingModel = value + object.bitmap_ |= 2 + case "byoc": + value := iterator.ReadString() + object.byoc = value + object.bitmap_ |= 4 + case "cloud": + value := iterator.ReadString() + object.cloud = value + object.bitmap_ |= 8 + case "cost": + value := iterator.ReadInt() + object.cost = value + object.bitmap_ |= 16 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 32 + case "product": + value := iterator.ReadString() + object.product = value + object.bitmap_ |= 64 + case "quota_id": + value := iterator.ReadString() + object.quotaId = value + object.bitmap_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/registry_builder.go b/clientapi/accountsmgmt/v1/registry_builder.go new file mode 100644 index 00000000..20f3efe4 --- /dev/null +++ b/clientapi/accountsmgmt/v1/registry_builder.go @@ -0,0 +1,161 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// RegistryBuilder contains the data and logic needed to build 'registry' objects. +type RegistryBuilder struct { + bitmap_ uint32 + id string + href string + url string + createdAt time.Time + name string + orgName string + teamName string + type_ string + updatedAt time.Time + cloudAlias bool +} + +// NewRegistry creates a new builder of 'registry' objects. +func NewRegistry() *RegistryBuilder { + return &RegistryBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *RegistryBuilder) Link(value bool) *RegistryBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *RegistryBuilder) ID(value string) *RegistryBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *RegistryBuilder) HREF(value string) *RegistryBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RegistryBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// URL sets the value of the 'URL' attribute to the given value. +func (b *RegistryBuilder) URL(value string) *RegistryBuilder { + b.url = value + b.bitmap_ |= 8 + return b +} + +// CloudAlias sets the value of the 'cloud_alias' attribute to the given value. +func (b *RegistryBuilder) CloudAlias(value bool) *RegistryBuilder { + b.cloudAlias = value + b.bitmap_ |= 16 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *RegistryBuilder) CreatedAt(value time.Time) *RegistryBuilder { + b.createdAt = value + b.bitmap_ |= 32 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *RegistryBuilder) Name(value string) *RegistryBuilder { + b.name = value + b.bitmap_ |= 64 + return b +} + +// OrgName sets the value of the 'org_name' attribute to the given value. +func (b *RegistryBuilder) OrgName(value string) *RegistryBuilder { + b.orgName = value + b.bitmap_ |= 128 + return b +} + +// TeamName sets the value of the 'team_name' attribute to the given value. +func (b *RegistryBuilder) TeamName(value string) *RegistryBuilder { + b.teamName = value + b.bitmap_ |= 256 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *RegistryBuilder) Type(value string) *RegistryBuilder { + b.type_ = value + b.bitmap_ |= 512 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *RegistryBuilder) UpdatedAt(value time.Time) *RegistryBuilder { + b.updatedAt = value + b.bitmap_ |= 1024 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RegistryBuilder) Copy(object *Registry) *RegistryBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.url = object.url + b.cloudAlias = object.cloudAlias + b.createdAt = object.createdAt + b.name = object.name + b.orgName = object.orgName + b.teamName = object.teamName + b.type_ = object.type_ + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'registry' object using the configuration stored in the builder. +func (b *RegistryBuilder) Build() (object *Registry, err error) { + object = new(Registry) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.url = b.url + object.cloudAlias = b.cloudAlias + object.createdAt = b.createdAt + object.name = b.name + object.orgName = b.orgName + object.teamName = b.teamName + object.type_ = b.type_ + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/accountsmgmt/v1/registry_credential_builder.go b/clientapi/accountsmgmt/v1/registry_credential_builder.go new file mode 100644 index 00000000..ba5ec6c8 --- /dev/null +++ b/clientapi/accountsmgmt/v1/registry_credential_builder.go @@ -0,0 +1,177 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// RegistryCredentialBuilder contains the data and logic needed to build 'registry_credential' objects. +type RegistryCredentialBuilder struct { + bitmap_ uint32 + id string + href string + account *AccountBuilder + createdAt time.Time + externalResourceID string + registry *RegistryBuilder + token string + updatedAt time.Time + username string +} + +// NewRegistryCredential creates a new builder of 'registry_credential' objects. +func NewRegistryCredential() *RegistryCredentialBuilder { + return &RegistryCredentialBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *RegistryCredentialBuilder) Link(value bool) *RegistryCredentialBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *RegistryCredentialBuilder) ID(value string) *RegistryCredentialBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *RegistryCredentialBuilder) HREF(value string) *RegistryCredentialBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RegistryCredentialBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Account sets the value of the 'account' attribute to the given value. +func (b *RegistryCredentialBuilder) Account(value *AccountBuilder) *RegistryCredentialBuilder { + b.account = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *RegistryCredentialBuilder) CreatedAt(value time.Time) *RegistryCredentialBuilder { + b.createdAt = value + b.bitmap_ |= 16 + return b +} + +// ExternalResourceID sets the value of the 'external_resource_ID' attribute to the given value. +func (b *RegistryCredentialBuilder) ExternalResourceID(value string) *RegistryCredentialBuilder { + b.externalResourceID = value + b.bitmap_ |= 32 + return b +} + +// Registry sets the value of the 'registry' attribute to the given value. +func (b *RegistryCredentialBuilder) Registry(value *RegistryBuilder) *RegistryCredentialBuilder { + b.registry = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Token sets the value of the 'token' attribute to the given value. +func (b *RegistryCredentialBuilder) Token(value string) *RegistryCredentialBuilder { + b.token = value + b.bitmap_ |= 128 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *RegistryCredentialBuilder) UpdatedAt(value time.Time) *RegistryCredentialBuilder { + b.updatedAt = value + b.bitmap_ |= 256 + return b +} + +// Username sets the value of the 'username' attribute to the given value. +func (b *RegistryCredentialBuilder) Username(value string) *RegistryCredentialBuilder { + b.username = value + b.bitmap_ |= 512 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RegistryCredentialBuilder) Copy(object *RegistryCredential) *RegistryCredentialBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.account != nil { + b.account = NewAccount().Copy(object.account) + } else { + b.account = nil + } + b.createdAt = object.createdAt + b.externalResourceID = object.externalResourceID + if object.registry != nil { + b.registry = NewRegistry().Copy(object.registry) + } else { + b.registry = nil + } + b.token = object.token + b.updatedAt = object.updatedAt + b.username = object.username + return b +} + +// Build creates a 'registry_credential' object using the configuration stored in the builder. +func (b *RegistryCredentialBuilder) Build() (object *RegistryCredential, err error) { + object = new(RegistryCredential) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.account != nil { + object.account, err = b.account.Build() + if err != nil { + return + } + } + object.createdAt = b.createdAt + object.externalResourceID = b.externalResourceID + if b.registry != nil { + object.registry, err = b.registry.Build() + if err != nil { + return + } + } + object.token = b.token + object.updatedAt = b.updatedAt + object.username = b.username + return +} diff --git a/clientapi/accountsmgmt/v1/registry_credential_list_builder.go b/clientapi/accountsmgmt/v1/registry_credential_list_builder.go new file mode 100644 index 00000000..268baab7 --- /dev/null +++ b/clientapi/accountsmgmt/v1/registry_credential_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// RegistryCredentialListBuilder contains the data and logic needed to build +// 'registry_credential' objects. +type RegistryCredentialListBuilder struct { + items []*RegistryCredentialBuilder +} + +// NewRegistryCredentialList creates a new builder of 'registry_credential' objects. +func NewRegistryCredentialList() *RegistryCredentialListBuilder { + return new(RegistryCredentialListBuilder) +} + +// Items sets the items of the list. +func (b *RegistryCredentialListBuilder) Items(values ...*RegistryCredentialBuilder) *RegistryCredentialListBuilder { + b.items = make([]*RegistryCredentialBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RegistryCredentialListBuilder) 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 *RegistryCredentialListBuilder) Copy(list *RegistryCredentialList) *RegistryCredentialListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RegistryCredentialBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRegistryCredential().Copy(v) + } + } + return b +} + +// Build creates a list of 'registry_credential' objects using the +// configuration stored in the builder. +func (b *RegistryCredentialListBuilder) Build() (list *RegistryCredentialList, err error) { + items := make([]*RegistryCredential, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RegistryCredentialList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/registry_credential_list_type_json.go b/clientapi/accountsmgmt/v1/registry_credential_list_type_json.go new file mode 100644 index 00000000..18a41e93 --- /dev/null +++ b/clientapi/accountsmgmt/v1/registry_credential_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRegistryCredentialList writes a list of values of the 'registry_credential' type to +// the given writer. +func MarshalRegistryCredentialList(list []*RegistryCredential, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistryCredentialList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistryCredentialList writes a list of value of the 'registry_credential' type to +// the given stream. +func WriteRegistryCredentialList(list []*RegistryCredential, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRegistryCredential(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRegistryCredentialList reads a list of values of the 'registry_credential' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRegistryCredentialList(source interface{}) (items []*RegistryCredential, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRegistryCredentialList(iterator) + err = iterator.Error + return +} + +// ReadRegistryCredentialList reads list of values of the ”registry_credential' type from +// the given iterator. +func ReadRegistryCredentialList(iterator *jsoniter.Iterator) []*RegistryCredential { + list := []*RegistryCredential{} + for iterator.ReadArray() { + item := ReadRegistryCredential(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/registry_credential_type.go b/clientapi/accountsmgmt/v1/registry_credential_type.go new file mode 100644 index 00000000..839e8952 --- /dev/null +++ b/clientapi/accountsmgmt/v1/registry_credential_type.go @@ -0,0 +1,383 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// RegistryCredentialKind is the name of the type used to represent objects +// of type 'registry_credential'. +const RegistryCredentialKind = "RegistryCredential" + +// RegistryCredentialLinkKind is the name of the type used to represent links +// to objects of type 'registry_credential'. +const RegistryCredentialLinkKind = "RegistryCredentialLink" + +// RegistryCredentialNilKind is the name of the type used to nil references +// to objects of type 'registry_credential'. +const RegistryCredentialNilKind = "RegistryCredentialNil" + +// RegistryCredential represents the values of the 'registry_credential' type. +type RegistryCredential struct { + bitmap_ uint32 + id string + href string + account *Account + createdAt time.Time + externalResourceID string + registry *Registry + token string + updatedAt time.Time + username string +} + +// Kind returns the name of the type of the object. +func (o *RegistryCredential) Kind() string { + if o == nil { + return RegistryCredentialNilKind + } + if o.bitmap_&1 != 0 { + return RegistryCredentialLinkKind + } + return RegistryCredentialKind +} + +// Link returns true if this is a link. +func (o *RegistryCredential) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *RegistryCredential) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *RegistryCredential) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *RegistryCredential) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *RegistryCredential) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RegistryCredential) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Account returns the value of the 'account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RegistryCredential) Account() *Account { + if o != nil && o.bitmap_&8 != 0 { + return o.account + } + return nil +} + +// GetAccount returns the value of the 'account' attribute and +// a flag indicating if the attribute has a value. +func (o *RegistryCredential) GetAccount() (value *Account, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.account + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RegistryCredential) CreatedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *RegistryCredential) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.createdAt + } + return +} + +// ExternalResourceID returns the value of the 'external_resource_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RegistryCredential) ExternalResourceID() string { + if o != nil && o.bitmap_&32 != 0 { + return o.externalResourceID + } + return "" +} + +// GetExternalResourceID returns the value of the 'external_resource_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *RegistryCredential) GetExternalResourceID() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.externalResourceID + } + return +} + +// Registry returns the value of the 'registry' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RegistryCredential) Registry() *Registry { + if o != nil && o.bitmap_&64 != 0 { + return o.registry + } + return nil +} + +// GetRegistry returns the value of the 'registry' attribute and +// a flag indicating if the attribute has a value. +func (o *RegistryCredential) GetRegistry() (value *Registry, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.registry + } + return +} + +// Token returns the value of the 'token' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RegistryCredential) Token() string { + if o != nil && o.bitmap_&128 != 0 { + return o.token + } + return "" +} + +// GetToken returns the value of the 'token' attribute and +// a flag indicating if the attribute has a value. +func (o *RegistryCredential) GetToken() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.token + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RegistryCredential) UpdatedAt() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *RegistryCredential) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.updatedAt + } + return +} + +// Username returns the value of the 'username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RegistryCredential) Username() string { + if o != nil && o.bitmap_&512 != 0 { + return o.username + } + return "" +} + +// GetUsername returns the value of the 'username' attribute and +// a flag indicating if the attribute has a value. +func (o *RegistryCredential) GetUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.username + } + return +} + +// RegistryCredentialListKind is the name of the type used to represent list of objects of +// type 'registry_credential'. +const RegistryCredentialListKind = "RegistryCredentialList" + +// RegistryCredentialListLinkKind is the name of the type used to represent links to list +// of objects of type 'registry_credential'. +const RegistryCredentialListLinkKind = "RegistryCredentialListLink" + +// RegistryCredentialNilKind is the name of the type used to nil lists of objects of +// type 'registry_credential'. +const RegistryCredentialListNilKind = "RegistryCredentialListNil" + +// RegistryCredentialList is a list of values of the 'registry_credential' type. +type RegistryCredentialList struct { + href string + link bool + items []*RegistryCredential +} + +// Kind returns the name of the type of the object. +func (l *RegistryCredentialList) Kind() string { + if l == nil { + return RegistryCredentialListNilKind + } + if l.link { + return RegistryCredentialListLinkKind + } + return RegistryCredentialListKind +} + +// Link returns true iif this is a link. +func (l *RegistryCredentialList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *RegistryCredentialList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *RegistryCredentialList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *RegistryCredentialList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RegistryCredentialList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RegistryCredentialList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RegistryCredentialList) SetItems(items []*RegistryCredential) { + l.items = items +} + +// Items returns the items of the list. +func (l *RegistryCredentialList) Items() []*RegistryCredential { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RegistryCredentialList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RegistryCredentialList) Get(i int) *RegistryCredential { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RegistryCredentialList) Slice() []*RegistryCredential { + var slice []*RegistryCredential + if l == nil { + slice = make([]*RegistryCredential, 0) + } else { + slice = make([]*RegistryCredential, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RegistryCredentialList) Each(f func(item *RegistryCredential) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RegistryCredentialList) Range(f func(index int, item *RegistryCredential) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/registry_credential_type_json.go b/clientapi/accountsmgmt/v1/registry_credential_type_json.go new file mode 100644 index 00000000..70b22c68 --- /dev/null +++ b/clientapi/accountsmgmt/v1/registry_credential_type_json.go @@ -0,0 +1,207 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRegistryCredential writes a value of the 'registry_credential' type to the given writer. +func MarshalRegistryCredential(object *RegistryCredential, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistryCredential(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistryCredential writes a value of the 'registry_credential' type to the given stream. +func WriteRegistryCredential(object *RegistryCredential, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(RegistryCredentialLinkKind) + } else { + stream.WriteString(RegistryCredentialKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.account != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account") + WriteAccount(object.account, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_resource_id") + stream.WriteString(object.externalResourceID) + count++ + } + present_ = object.bitmap_&64 != 0 && object.registry != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("registry") + WriteRegistry(object.registry, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("token") + stream.WriteString(object.token) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("username") + stream.WriteString(object.username) + } + stream.WriteObjectEnd() +} + +// UnmarshalRegistryCredential reads a value of the 'registry_credential' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRegistryCredential(source interface{}) (object *RegistryCredential, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRegistryCredential(iterator) + err = iterator.Error + return +} + +// ReadRegistryCredential reads a value of the 'registry_credential' type from the given iterator. +func ReadRegistryCredential(iterator *jsoniter.Iterator) *RegistryCredential { + object := &RegistryCredential{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == RegistryCredentialLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "account": + value := ReadAccount(iterator) + object.account = value + object.bitmap_ |= 8 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 16 + case "external_resource_id": + value := iterator.ReadString() + object.externalResourceID = value + object.bitmap_ |= 32 + case "registry": + value := ReadRegistry(iterator) + object.registry = value + object.bitmap_ |= 64 + case "token": + value := iterator.ReadString() + object.token = value + object.bitmap_ |= 128 + 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_ |= 256 + case "username": + value := iterator.ReadString() + object.username = value + object.bitmap_ |= 512 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/registry_list_builder.go b/clientapi/accountsmgmt/v1/registry_list_builder.go new file mode 100644 index 00000000..76cd4713 --- /dev/null +++ b/clientapi/accountsmgmt/v1/registry_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// RegistryListBuilder contains the data and logic needed to build +// 'registry' objects. +type RegistryListBuilder struct { + items []*RegistryBuilder +} + +// NewRegistryList creates a new builder of 'registry' objects. +func NewRegistryList() *RegistryListBuilder { + return new(RegistryListBuilder) +} + +// Items sets the items of the list. +func (b *RegistryListBuilder) Items(values ...*RegistryBuilder) *RegistryListBuilder { + b.items = make([]*RegistryBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RegistryListBuilder) 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 *RegistryListBuilder) Copy(list *RegistryList) *RegistryListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RegistryBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRegistry().Copy(v) + } + } + return b +} + +// Build creates a list of 'registry' objects using the +// configuration stored in the builder. +func (b *RegistryListBuilder) Build() (list *RegistryList, err error) { + items := make([]*Registry, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RegistryList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/registry_list_type_json.go b/clientapi/accountsmgmt/v1/registry_list_type_json.go new file mode 100644 index 00000000..cb7966a0 --- /dev/null +++ b/clientapi/accountsmgmt/v1/registry_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRegistryList writes a list of values of the 'registry' type to +// the given writer. +func MarshalRegistryList(list []*Registry, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistryList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistryList writes a list of value of the 'registry' type to +// the given stream. +func WriteRegistryList(list []*Registry, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRegistry(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRegistryList reads a list of values of the 'registry' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRegistryList(source interface{}) (items []*Registry, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRegistryList(iterator) + err = iterator.Error + return +} + +// ReadRegistryList reads list of values of the ”registry' type from +// the given iterator. +func ReadRegistryList(iterator *jsoniter.Iterator) []*Registry { + list := []*Registry{} + for iterator.ReadArray() { + item := ReadRegistry(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/registry_type.go b/clientapi/accountsmgmt/v1/registry_type.go new file mode 100644 index 00000000..350f73f7 --- /dev/null +++ b/clientapi/accountsmgmt/v1/registry_type.go @@ -0,0 +1,403 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// RegistryKind is the name of the type used to represent objects +// of type 'registry'. +const RegistryKind = "Registry" + +// RegistryLinkKind is the name of the type used to represent links +// to objects of type 'registry'. +const RegistryLinkKind = "RegistryLink" + +// RegistryNilKind is the name of the type used to nil references +// to objects of type 'registry'. +const RegistryNilKind = "RegistryNil" + +// Registry represents the values of the 'registry' type. +type Registry struct { + bitmap_ uint32 + id string + href string + url string + createdAt time.Time + name string + orgName string + teamName string + type_ string + updatedAt time.Time + cloudAlias bool +} + +// Kind returns the name of the type of the object. +func (o *Registry) Kind() string { + if o == nil { + return RegistryNilKind + } + if o.bitmap_&1 != 0 { + return RegistryLinkKind + } + return RegistryKind +} + +// Link returns true if this is a link. +func (o *Registry) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Registry) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Registry) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Registry) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Registry) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Registry) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// URL returns the value of the 'URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Registry) URL() string { + if o != nil && o.bitmap_&8 != 0 { + return o.url + } + return "" +} + +// GetURL returns the value of the 'URL' attribute and +// a flag indicating if the attribute has a value. +func (o *Registry) GetURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.url + } + return +} + +// CloudAlias returns the value of the 'cloud_alias' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Registry) CloudAlias() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.cloudAlias + } + return false +} + +// GetCloudAlias returns the value of the 'cloud_alias' attribute and +// a flag indicating if the attribute has a value. +func (o *Registry) GetCloudAlias() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.cloudAlias + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Registry) CreatedAt() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Registry) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.createdAt + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Registry) Name() string { + if o != nil && o.bitmap_&64 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *Registry) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.name + } + return +} + +// OrgName returns the value of the 'org_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Registry) OrgName() string { + if o != nil && o.bitmap_&128 != 0 { + return o.orgName + } + return "" +} + +// GetOrgName returns the value of the 'org_name' attribute and +// a flag indicating if the attribute has a value. +func (o *Registry) GetOrgName() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.orgName + } + return +} + +// TeamName returns the value of the 'team_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Registry) TeamName() string { + if o != nil && o.bitmap_&256 != 0 { + return o.teamName + } + return "" +} + +// GetTeamName returns the value of the 'team_name' attribute and +// a flag indicating if the attribute has a value. +func (o *Registry) GetTeamName() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.teamName + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Registry) Type() string { + if o != nil && o.bitmap_&512 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +func (o *Registry) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.type_ + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Registry) UpdatedAt() time.Time { + if o != nil && o.bitmap_&1024 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Registry) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.updatedAt + } + return +} + +// RegistryListKind is the name of the type used to represent list of objects of +// type 'registry'. +const RegistryListKind = "RegistryList" + +// RegistryListLinkKind is the name of the type used to represent links to list +// of objects of type 'registry'. +const RegistryListLinkKind = "RegistryListLink" + +// RegistryNilKind is the name of the type used to nil lists of objects of +// type 'registry'. +const RegistryListNilKind = "RegistryListNil" + +// RegistryList is a list of values of the 'registry' type. +type RegistryList struct { + href string + link bool + items []*Registry +} + +// Kind returns the name of the type of the object. +func (l *RegistryList) Kind() string { + if l == nil { + return RegistryListNilKind + } + if l.link { + return RegistryListLinkKind + } + return RegistryListKind +} + +// Link returns true iif this is a link. +func (l *RegistryList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *RegistryList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *RegistryList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *RegistryList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RegistryList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RegistryList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RegistryList) SetItems(items []*Registry) { + l.items = items +} + +// Items returns the items of the list. +func (l *RegistryList) Items() []*Registry { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RegistryList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RegistryList) Get(i int) *Registry { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RegistryList) Slice() []*Registry { + var slice []*Registry + if l == nil { + slice = make([]*Registry, 0) + } else { + slice = make([]*Registry, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RegistryList) Each(f func(item *Registry) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RegistryList) Range(f func(index int, item *Registry) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/registry_type_json.go b/clientapi/accountsmgmt/v1/registry_type_json.go new file mode 100644 index 00000000..409547a2 --- /dev/null +++ b/clientapi/accountsmgmt/v1/registry_type_json.go @@ -0,0 +1,220 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRegistry writes a value of the 'registry' type to the given writer. +func MarshalRegistry(object *Registry, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistry(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistry writes a value of the 'registry' type to the given stream. +func WriteRegistry(object *Registry, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(RegistryLinkKind) + } else { + stream.WriteString(RegistryKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("url") + stream.WriteString(object.url) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_alias") + stream.WriteBool(object.cloudAlias) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("org_name") + stream.WriteString(object.orgName) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("team_name") + stream.WriteString(object.teamName) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalRegistry reads a value of the 'registry' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRegistry(source interface{}) (object *Registry, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRegistry(iterator) + err = iterator.Error + return +} + +// ReadRegistry reads a value of the 'registry' type from the given iterator. +func ReadRegistry(iterator *jsoniter.Iterator) *Registry { + object := &Registry{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == RegistryLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "url": + value := iterator.ReadString() + object.url = value + object.bitmap_ |= 8 + case "cloud_alias": + value := iterator.ReadBool() + object.cloudAlias = value + object.bitmap_ |= 16 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 32 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 64 + case "org_name": + value := iterator.ReadString() + object.orgName = value + object.bitmap_ |= 128 + case "team_name": + value := iterator.ReadString() + object.teamName = value + object.bitmap_ |= 256 + case "type": + value := iterator.ReadString() + object.type_ = value + 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_ |= 1024 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/related_resource_builder.go b/clientapi/accountsmgmt/v1/related_resource_builder.go new file mode 100644 index 00000000..81fe245b --- /dev/null +++ b/clientapi/accountsmgmt/v1/related_resource_builder.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// RelatedResourceBuilder contains the data and logic needed to build 'related_resource' objects. +// +// Resource which can be provisioned using the allowed quota. +type RelatedResourceBuilder struct { + bitmap_ uint32 + byoc string + availabilityZoneType string + billingModel string + cloudProvider string + cost int + product string + resourceName string + resourceType string +} + +// NewRelatedResource creates a new builder of 'related_resource' objects. +func NewRelatedResource() *RelatedResourceBuilder { + return &RelatedResourceBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RelatedResourceBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// BYOC sets the value of the 'BYOC' attribute to the given value. +func (b *RelatedResourceBuilder) BYOC(value string) *RelatedResourceBuilder { + b.byoc = value + b.bitmap_ |= 1 + return b +} + +// AvailabilityZoneType sets the value of the 'availability_zone_type' attribute to the given value. +func (b *RelatedResourceBuilder) AvailabilityZoneType(value string) *RelatedResourceBuilder { + b.availabilityZoneType = value + b.bitmap_ |= 2 + return b +} + +// BillingModel sets the value of the 'billing_model' attribute to the given value. +func (b *RelatedResourceBuilder) BillingModel(value string) *RelatedResourceBuilder { + b.billingModel = value + b.bitmap_ |= 4 + return b +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +func (b *RelatedResourceBuilder) CloudProvider(value string) *RelatedResourceBuilder { + b.cloudProvider = value + b.bitmap_ |= 8 + return b +} + +// Cost sets the value of the 'cost' attribute to the given value. +func (b *RelatedResourceBuilder) Cost(value int) *RelatedResourceBuilder { + b.cost = value + b.bitmap_ |= 16 + return b +} + +// Product sets the value of the 'product' attribute to the given value. +func (b *RelatedResourceBuilder) Product(value string) *RelatedResourceBuilder { + b.product = value + b.bitmap_ |= 32 + return b +} + +// ResourceName sets the value of the 'resource_name' attribute to the given value. +func (b *RelatedResourceBuilder) ResourceName(value string) *RelatedResourceBuilder { + b.resourceName = value + b.bitmap_ |= 64 + return b +} + +// ResourceType sets the value of the 'resource_type' attribute to the given value. +func (b *RelatedResourceBuilder) ResourceType(value string) *RelatedResourceBuilder { + b.resourceType = value + b.bitmap_ |= 128 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RelatedResourceBuilder) Copy(object *RelatedResource) *RelatedResourceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.byoc = object.byoc + b.availabilityZoneType = object.availabilityZoneType + b.billingModel = object.billingModel + b.cloudProvider = object.cloudProvider + b.cost = object.cost + b.product = object.product + b.resourceName = object.resourceName + b.resourceType = object.resourceType + return b +} + +// Build creates a 'related_resource' object using the configuration stored in the builder. +func (b *RelatedResourceBuilder) Build() (object *RelatedResource, err error) { + object = new(RelatedResource) + object.bitmap_ = b.bitmap_ + object.byoc = b.byoc + object.availabilityZoneType = b.availabilityZoneType + object.billingModel = b.billingModel + object.cloudProvider = b.cloudProvider + object.cost = b.cost + object.product = b.product + object.resourceName = b.resourceName + object.resourceType = b.resourceType + return +} diff --git a/clientapi/accountsmgmt/v1/related_resource_list_builder.go b/clientapi/accountsmgmt/v1/related_resource_list_builder.go new file mode 100644 index 00000000..1ab26b0f --- /dev/null +++ b/clientapi/accountsmgmt/v1/related_resource_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// RelatedResourceListBuilder contains the data and logic needed to build +// 'related_resource' objects. +type RelatedResourceListBuilder struct { + items []*RelatedResourceBuilder +} + +// NewRelatedResourceList creates a new builder of 'related_resource' objects. +func NewRelatedResourceList() *RelatedResourceListBuilder { + return new(RelatedResourceListBuilder) +} + +// Items sets the items of the list. +func (b *RelatedResourceListBuilder) Items(values ...*RelatedResourceBuilder) *RelatedResourceListBuilder { + b.items = make([]*RelatedResourceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RelatedResourceListBuilder) 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 *RelatedResourceListBuilder) Copy(list *RelatedResourceList) *RelatedResourceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RelatedResourceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRelatedResource().Copy(v) + } + } + return b +} + +// Build creates a list of 'related_resource' objects using the +// configuration stored in the builder. +func (b *RelatedResourceListBuilder) Build() (list *RelatedResourceList, err error) { + items := make([]*RelatedResource, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RelatedResourceList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/related_resource_list_type_json.go b/clientapi/accountsmgmt/v1/related_resource_list_type_json.go new file mode 100644 index 00000000..86813080 --- /dev/null +++ b/clientapi/accountsmgmt/v1/related_resource_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRelatedResourceList writes a list of values of the 'related_resource' type to +// the given writer. +func MarshalRelatedResourceList(list []*RelatedResource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRelatedResourceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRelatedResourceList writes a list of value of the 'related_resource' type to +// the given stream. +func WriteRelatedResourceList(list []*RelatedResource, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRelatedResource(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRelatedResourceList reads a list of values of the 'related_resource' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRelatedResourceList(source interface{}) (items []*RelatedResource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRelatedResourceList(iterator) + err = iterator.Error + return +} + +// ReadRelatedResourceList reads list of values of the ”related_resource' type from +// the given iterator. +func ReadRelatedResourceList(iterator *jsoniter.Iterator) []*RelatedResource { + list := []*RelatedResource{} + for iterator.ReadArray() { + item := ReadRelatedResource(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/related_resource_type.go b/clientapi/accountsmgmt/v1/related_resource_type.go new file mode 100644 index 00000000..7c081482 --- /dev/null +++ b/clientapi/accountsmgmt/v1/related_resource_type.go @@ -0,0 +1,301 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// RelatedResource represents the values of the 'related_resource' type. +// +// Resource which can be provisioned using the allowed quota. +type RelatedResource struct { + bitmap_ uint32 + byoc string + availabilityZoneType string + billingModel string + cloudProvider string + cost int + product string + resourceName string + resourceType string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RelatedResource) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// BYOC returns the value of the 'BYOC' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RelatedResource) BYOC() string { + if o != nil && o.bitmap_&1 != 0 { + return o.byoc + } + return "" +} + +// GetBYOC returns the value of the 'BYOC' attribute and +// a flag indicating if the attribute has a value. +func (o *RelatedResource) GetBYOC() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.byoc + } + return +} + +// AvailabilityZoneType returns the value of the 'availability_zone_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RelatedResource) AvailabilityZoneType() string { + if o != nil && o.bitmap_&2 != 0 { + return o.availabilityZoneType + } + return "" +} + +// GetAvailabilityZoneType returns the value of the 'availability_zone_type' attribute and +// a flag indicating if the attribute has a value. +func (o *RelatedResource) GetAvailabilityZoneType() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.availabilityZoneType + } + return +} + +// BillingModel returns the value of the 'billing_model' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RelatedResource) BillingModel() string { + if o != nil && o.bitmap_&4 != 0 { + return o.billingModel + } + return "" +} + +// GetBillingModel returns the value of the 'billing_model' attribute and +// a flag indicating if the attribute has a value. +func (o *RelatedResource) GetBillingModel() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.billingModel + } + return +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RelatedResource) CloudProvider() string { + if o != nil && o.bitmap_&8 != 0 { + return o.cloudProvider + } + return "" +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +func (o *RelatedResource) GetCloudProvider() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// Cost returns the value of the 'cost' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RelatedResource) Cost() int { + if o != nil && o.bitmap_&16 != 0 { + return o.cost + } + return 0 +} + +// GetCost returns the value of the 'cost' attribute and +// a flag indicating if the attribute has a value. +func (o *RelatedResource) GetCost() (value int, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.cost + } + return +} + +// Product returns the value of the 'product' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RelatedResource) Product() string { + if o != nil && o.bitmap_&32 != 0 { + return o.product + } + return "" +} + +// GetProduct returns the value of the 'product' attribute and +// a flag indicating if the attribute has a value. +func (o *RelatedResource) GetProduct() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.product + } + return +} + +// ResourceName returns the value of the 'resource_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RelatedResource) ResourceName() string { + if o != nil && o.bitmap_&64 != 0 { + return o.resourceName + } + return "" +} + +// GetResourceName returns the value of the 'resource_name' attribute and +// a flag indicating if the attribute has a value. +func (o *RelatedResource) GetResourceName() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.resourceName + } + return +} + +// ResourceType returns the value of the 'resource_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RelatedResource) ResourceType() string { + if o != nil && o.bitmap_&128 != 0 { + return o.resourceType + } + return "" +} + +// GetResourceType returns the value of the 'resource_type' attribute and +// a flag indicating if the attribute has a value. +func (o *RelatedResource) GetResourceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.resourceType + } + return +} + +// RelatedResourceListKind is the name of the type used to represent list of objects of +// type 'related_resource'. +const RelatedResourceListKind = "RelatedResourceList" + +// RelatedResourceListLinkKind is the name of the type used to represent links to list +// of objects of type 'related_resource'. +const RelatedResourceListLinkKind = "RelatedResourceListLink" + +// RelatedResourceNilKind is the name of the type used to nil lists of objects of +// type 'related_resource'. +const RelatedResourceListNilKind = "RelatedResourceListNil" + +// RelatedResourceList is a list of values of the 'related_resource' type. +type RelatedResourceList struct { + href string + link bool + items []*RelatedResource +} + +// Len returns the length of the list. +func (l *RelatedResourceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RelatedResourceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RelatedResourceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RelatedResourceList) SetItems(items []*RelatedResource) { + l.items = items +} + +// Items returns the items of the list. +func (l *RelatedResourceList) Items() []*RelatedResource { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RelatedResourceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RelatedResourceList) Get(i int) *RelatedResource { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RelatedResourceList) Slice() []*RelatedResource { + var slice []*RelatedResource + if l == nil { + slice = make([]*RelatedResource, 0) + } else { + slice = make([]*RelatedResource, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RelatedResourceList) Each(f func(item *RelatedResource) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RelatedResourceList) Range(f func(index int, item *RelatedResource) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/related_resource_type_json.go b/clientapi/accountsmgmt/v1/related_resource_type_json.go new file mode 100644 index 00000000..88123517 --- /dev/null +++ b/clientapi/accountsmgmt/v1/related_resource_type_json.go @@ -0,0 +1,177 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRelatedResource writes a value of the 'related_resource' type to the given writer. +func MarshalRelatedResource(object *RelatedResource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRelatedResource(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRelatedResource writes a value of the 'related_resource' type to the given stream. +func WriteRelatedResource(object *RelatedResource, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("byoc") + stream.WriteString(object.byoc) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zone_type") + stream.WriteString(object.availabilityZoneType) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_model") + stream.WriteString(object.billingModel) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + stream.WriteString(object.cloudProvider) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cost") + stream.WriteInt(object.cost) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product") + stream.WriteString(object.product) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_name") + stream.WriteString(object.resourceName) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_type") + stream.WriteString(object.resourceType) + } + stream.WriteObjectEnd() +} + +// UnmarshalRelatedResource reads a value of the 'related_resource' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRelatedResource(source interface{}) (object *RelatedResource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRelatedResource(iterator) + err = iterator.Error + return +} + +// ReadRelatedResource reads a value of the 'related_resource' type from the given iterator. +func ReadRelatedResource(iterator *jsoniter.Iterator) *RelatedResource { + object := &RelatedResource{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "byoc": + value := iterator.ReadString() + object.byoc = value + object.bitmap_ |= 1 + case "availability_zone_type": + value := iterator.ReadString() + object.availabilityZoneType = value + object.bitmap_ |= 2 + case "billing_model": + value := iterator.ReadString() + object.billingModel = value + object.bitmap_ |= 4 + case "cloud_provider": + value := iterator.ReadString() + object.cloudProvider = value + object.bitmap_ |= 8 + case "cost": + value := iterator.ReadInt() + object.cost = value + object.bitmap_ |= 16 + case "product": + value := iterator.ReadString() + object.product = value + object.bitmap_ |= 32 + case "resource_name": + value := iterator.ReadString() + object.resourceName = value + object.bitmap_ |= 64 + case "resource_type": + value := iterator.ReadString() + object.resourceType = value + object.bitmap_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/reserved_resource_builder.go b/clientapi/accountsmgmt/v1/reserved_resource_builder.go new file mode 100644 index 00000000..30e0d5c6 --- /dev/null +++ b/clientapi/accountsmgmt/v1/reserved_resource_builder.go @@ -0,0 +1,157 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// ReservedResourceBuilder contains the data and logic needed to build 'reserved_resource' objects. +type ReservedResourceBuilder struct { + bitmap_ uint32 + availabilityZoneType string + billingMarketplaceAccount string + billingModel BillingModel + count int + createdAt time.Time + resourceName string + resourceType string + scope string + updatedAt time.Time + byoc bool +} + +// NewReservedResource creates a new builder of 'reserved_resource' objects. +func NewReservedResource() *ReservedResourceBuilder { + return &ReservedResourceBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ReservedResourceBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// BYOC sets the value of the 'BYOC' attribute to the given value. +func (b *ReservedResourceBuilder) BYOC(value bool) *ReservedResourceBuilder { + b.byoc = value + b.bitmap_ |= 1 + return b +} + +// AvailabilityZoneType sets the value of the 'availability_zone_type' attribute to the given value. +func (b *ReservedResourceBuilder) AvailabilityZoneType(value string) *ReservedResourceBuilder { + b.availabilityZoneType = value + b.bitmap_ |= 2 + return b +} + +// BillingMarketplaceAccount sets the value of the 'billing_marketplace_account' attribute to the given value. +func (b *ReservedResourceBuilder) BillingMarketplaceAccount(value string) *ReservedResourceBuilder { + b.billingMarketplaceAccount = value + b.bitmap_ |= 4 + return b +} + +// BillingModel sets the value of the 'billing_model' attribute to the given value. +// +// Billing model for subscripiton and reserved_resource resources. +func (b *ReservedResourceBuilder) BillingModel(value BillingModel) *ReservedResourceBuilder { + b.billingModel = value + b.bitmap_ |= 8 + return b +} + +// Count sets the value of the 'count' attribute to the given value. +func (b *ReservedResourceBuilder) Count(value int) *ReservedResourceBuilder { + b.count = value + b.bitmap_ |= 16 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *ReservedResourceBuilder) CreatedAt(value time.Time) *ReservedResourceBuilder { + b.createdAt = value + b.bitmap_ |= 32 + return b +} + +// ResourceName sets the value of the 'resource_name' attribute to the given value. +func (b *ReservedResourceBuilder) ResourceName(value string) *ReservedResourceBuilder { + b.resourceName = value + b.bitmap_ |= 64 + return b +} + +// ResourceType sets the value of the 'resource_type' attribute to the given value. +func (b *ReservedResourceBuilder) ResourceType(value string) *ReservedResourceBuilder { + b.resourceType = value + b.bitmap_ |= 128 + return b +} + +// Scope sets the value of the 'scope' attribute to the given value. +func (b *ReservedResourceBuilder) Scope(value string) *ReservedResourceBuilder { + b.scope = value + b.bitmap_ |= 256 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *ReservedResourceBuilder) UpdatedAt(value time.Time) *ReservedResourceBuilder { + b.updatedAt = value + b.bitmap_ |= 512 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ReservedResourceBuilder) Copy(object *ReservedResource) *ReservedResourceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.byoc = object.byoc + b.availabilityZoneType = object.availabilityZoneType + b.billingMarketplaceAccount = object.billingMarketplaceAccount + b.billingModel = object.billingModel + b.count = object.count + b.createdAt = object.createdAt + b.resourceName = object.resourceName + b.resourceType = object.resourceType + b.scope = object.scope + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'reserved_resource' object using the configuration stored in the builder. +func (b *ReservedResourceBuilder) Build() (object *ReservedResource, err error) { + object = new(ReservedResource) + object.bitmap_ = b.bitmap_ + object.byoc = b.byoc + object.availabilityZoneType = b.availabilityZoneType + object.billingMarketplaceAccount = b.billingMarketplaceAccount + object.billingModel = b.billingModel + object.count = b.count + object.createdAt = b.createdAt + object.resourceName = b.resourceName + object.resourceType = b.resourceType + object.scope = b.scope + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/accountsmgmt/v1/reserved_resource_list_builder.go b/clientapi/accountsmgmt/v1/reserved_resource_list_builder.go new file mode 100644 index 00000000..169b3de1 --- /dev/null +++ b/clientapi/accountsmgmt/v1/reserved_resource_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ReservedResourceListBuilder contains the data and logic needed to build +// 'reserved_resource' objects. +type ReservedResourceListBuilder struct { + items []*ReservedResourceBuilder +} + +// NewReservedResourceList creates a new builder of 'reserved_resource' objects. +func NewReservedResourceList() *ReservedResourceListBuilder { + return new(ReservedResourceListBuilder) +} + +// Items sets the items of the list. +func (b *ReservedResourceListBuilder) Items(values ...*ReservedResourceBuilder) *ReservedResourceListBuilder { + b.items = make([]*ReservedResourceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ReservedResourceListBuilder) 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 *ReservedResourceListBuilder) Copy(list *ReservedResourceList) *ReservedResourceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ReservedResourceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewReservedResource().Copy(v) + } + } + return b +} + +// Build creates a list of 'reserved_resource' objects using the +// configuration stored in the builder. +func (b *ReservedResourceListBuilder) Build() (list *ReservedResourceList, err error) { + items := make([]*ReservedResource, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ReservedResourceList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/reserved_resource_list_type_json.go b/clientapi/accountsmgmt/v1/reserved_resource_list_type_json.go new file mode 100644 index 00000000..a138afe9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/reserved_resource_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalReservedResourceList writes a list of values of the 'reserved_resource' type to +// the given writer. +func MarshalReservedResourceList(list []*ReservedResource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteReservedResourceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteReservedResourceList writes a list of value of the 'reserved_resource' type to +// the given stream. +func WriteReservedResourceList(list []*ReservedResource, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteReservedResource(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalReservedResourceList reads a list of values of the 'reserved_resource' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalReservedResourceList(source interface{}) (items []*ReservedResource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadReservedResourceList(iterator) + err = iterator.Error + return +} + +// ReadReservedResourceList reads list of values of the ”reserved_resource' type from +// the given iterator. +func ReadReservedResourceList(iterator *jsoniter.Iterator) []*ReservedResource { + list := []*ReservedResource{} + for iterator.ReadArray() { + item := ReadReservedResource(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/reserved_resource_type.go b/clientapi/accountsmgmt/v1/reserved_resource_type.go new file mode 100644 index 00000000..4bee0b32 --- /dev/null +++ b/clientapi/accountsmgmt/v1/reserved_resource_type.go @@ -0,0 +1,343 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// ReservedResource represents the values of the 'reserved_resource' type. +type ReservedResource struct { + bitmap_ uint32 + availabilityZoneType string + billingMarketplaceAccount string + billingModel BillingModel + count int + createdAt time.Time + resourceName string + resourceType string + scope string + updatedAt time.Time + byoc bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ReservedResource) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// BYOC returns the value of the 'BYOC' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ReservedResource) BYOC() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.byoc + } + return false +} + +// GetBYOC returns the value of the 'BYOC' attribute and +// a flag indicating if the attribute has a value. +func (o *ReservedResource) GetBYOC() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.byoc + } + return +} + +// AvailabilityZoneType returns the value of the 'availability_zone_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ReservedResource) AvailabilityZoneType() string { + if o != nil && o.bitmap_&2 != 0 { + return o.availabilityZoneType + } + return "" +} + +// GetAvailabilityZoneType returns the value of the 'availability_zone_type' attribute and +// a flag indicating if the attribute has a value. +func (o *ReservedResource) GetAvailabilityZoneType() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.availabilityZoneType + } + return +} + +// BillingMarketplaceAccount returns the value of the 'billing_marketplace_account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ReservedResource) BillingMarketplaceAccount() string { + if o != nil && o.bitmap_&4 != 0 { + return o.billingMarketplaceAccount + } + return "" +} + +// GetBillingMarketplaceAccount returns the value of the 'billing_marketplace_account' attribute and +// a flag indicating if the attribute has a value. +func (o *ReservedResource) GetBillingMarketplaceAccount() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.billingMarketplaceAccount + } + return +} + +// BillingModel returns the value of the 'billing_model' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ReservedResource) BillingModel() BillingModel { + if o != nil && o.bitmap_&8 != 0 { + return o.billingModel + } + return BillingModel("") +} + +// GetBillingModel returns the value of the 'billing_model' attribute and +// a flag indicating if the attribute has a value. +func (o *ReservedResource) GetBillingModel() (value BillingModel, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.billingModel + } + return +} + +// Count returns the value of the 'count' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ReservedResource) Count() int { + if o != nil && o.bitmap_&16 != 0 { + return o.count + } + return 0 +} + +// GetCount returns the value of the 'count' attribute and +// a flag indicating if the attribute has a value. +func (o *ReservedResource) GetCount() (value int, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.count + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ReservedResource) CreatedAt() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *ReservedResource) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.createdAt + } + return +} + +// ResourceName returns the value of the 'resource_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ReservedResource) ResourceName() string { + if o != nil && o.bitmap_&64 != 0 { + return o.resourceName + } + return "" +} + +// GetResourceName returns the value of the 'resource_name' attribute and +// a flag indicating if the attribute has a value. +func (o *ReservedResource) GetResourceName() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.resourceName + } + return +} + +// ResourceType returns the value of the 'resource_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ReservedResource) ResourceType() string { + if o != nil && o.bitmap_&128 != 0 { + return o.resourceType + } + return "" +} + +// GetResourceType returns the value of the 'resource_type' attribute and +// a flag indicating if the attribute has a value. +func (o *ReservedResource) GetResourceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.resourceType + } + return +} + +// Scope returns the value of the 'scope' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ReservedResource) Scope() string { + if o != nil && o.bitmap_&256 != 0 { + return o.scope + } + return "" +} + +// GetScope returns the value of the 'scope' attribute and +// a flag indicating if the attribute has a value. +func (o *ReservedResource) GetScope() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.scope + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ReservedResource) UpdatedAt() time.Time { + if o != nil && o.bitmap_&512 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *ReservedResource) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.updatedAt + } + return +} + +// ReservedResourceListKind is the name of the type used to represent list of objects of +// type 'reserved_resource'. +const ReservedResourceListKind = "ReservedResourceList" + +// ReservedResourceListLinkKind is the name of the type used to represent links to list +// of objects of type 'reserved_resource'. +const ReservedResourceListLinkKind = "ReservedResourceListLink" + +// ReservedResourceNilKind is the name of the type used to nil lists of objects of +// type 'reserved_resource'. +const ReservedResourceListNilKind = "ReservedResourceListNil" + +// ReservedResourceList is a list of values of the 'reserved_resource' type. +type ReservedResourceList struct { + href string + link bool + items []*ReservedResource +} + +// Len returns the length of the list. +func (l *ReservedResourceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ReservedResourceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ReservedResourceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ReservedResourceList) SetItems(items []*ReservedResource) { + l.items = items +} + +// Items returns the items of the list. +func (l *ReservedResourceList) Items() []*ReservedResource { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ReservedResourceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ReservedResourceList) Get(i int) *ReservedResource { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ReservedResourceList) Slice() []*ReservedResource { + var slice []*ReservedResource + if l == nil { + slice = make([]*ReservedResource, 0) + } else { + slice = make([]*ReservedResource, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ReservedResourceList) Each(f func(item *ReservedResource) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ReservedResourceList) Range(f func(index int, item *ReservedResource) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/reserved_resource_type_json.go b/clientapi/accountsmgmt/v1/reserved_resource_type_json.go new file mode 100644 index 00000000..b628f8f0 --- /dev/null +++ b/clientapi/accountsmgmt/v1/reserved_resource_type_json.go @@ -0,0 +1,213 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalReservedResource writes a value of the 'reserved_resource' type to the given writer. +func MarshalReservedResource(object *ReservedResource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteReservedResource(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteReservedResource writes a value of the 'reserved_resource' type to the given stream. +func WriteReservedResource(object *ReservedResource, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("byoc") + stream.WriteBool(object.byoc) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zone_type") + stream.WriteString(object.availabilityZoneType) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_marketplace_account") + stream.WriteString(object.billingMarketplaceAccount) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_model") + stream.WriteString(string(object.billingModel)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("count") + stream.WriteInt(object.count) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_name") + stream.WriteString(object.resourceName) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_type") + stream.WriteString(object.resourceType) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("scope") + stream.WriteString(object.scope) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalReservedResource reads a value of the 'reserved_resource' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalReservedResource(source interface{}) (object *ReservedResource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadReservedResource(iterator) + err = iterator.Error + return +} + +// ReadReservedResource reads a value of the 'reserved_resource' type from the given iterator. +func ReadReservedResource(iterator *jsoniter.Iterator) *ReservedResource { + object := &ReservedResource{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "byoc": + value := iterator.ReadBool() + object.byoc = value + object.bitmap_ |= 1 + case "availability_zone_type": + value := iterator.ReadString() + object.availabilityZoneType = value + object.bitmap_ |= 2 + case "billing_marketplace_account": + value := iterator.ReadString() + object.billingMarketplaceAccount = value + object.bitmap_ |= 4 + case "billing_model": + text := iterator.ReadString() + value := BillingModel(text) + object.billingModel = value + object.bitmap_ |= 8 + case "count": + value := iterator.ReadInt() + object.count = value + object.bitmap_ |= 16 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 32 + case "resource_name": + value := iterator.ReadString() + object.resourceName = value + object.bitmap_ |= 64 + case "resource_type": + value := iterator.ReadString() + object.resourceType = value + object.bitmap_ |= 128 + case "scope": + value := iterator.ReadString() + object.scope = value + object.bitmap_ |= 256 + 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 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/resource_builder.go b/clientapi/accountsmgmt/v1/resource_builder.go new file mode 100644 index 00000000..a58b27b2 --- /dev/null +++ b/clientapi/accountsmgmt/v1/resource_builder.go @@ -0,0 +1,139 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ResourceBuilder contains the data and logic needed to build 'resource' objects. +// +// Identifies computing resources +type ResourceBuilder struct { + bitmap_ uint32 + id string + href string + sku string + allowed int + availabilityZoneType string + resourceName string + resourceType string + byoc bool +} + +// NewResource creates a new builder of 'resource' objects. +func NewResource() *ResourceBuilder { + return &ResourceBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ResourceBuilder) Link(value bool) *ResourceBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ResourceBuilder) ID(value string) *ResourceBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ResourceBuilder) HREF(value string) *ResourceBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ResourceBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// BYOC sets the value of the 'BYOC' attribute to the given value. +func (b *ResourceBuilder) BYOC(value bool) *ResourceBuilder { + b.byoc = value + b.bitmap_ |= 8 + return b +} + +// SKU sets the value of the 'SKU' attribute to the given value. +func (b *ResourceBuilder) SKU(value string) *ResourceBuilder { + b.sku = value + b.bitmap_ |= 16 + return b +} + +// Allowed sets the value of the 'allowed' attribute to the given value. +func (b *ResourceBuilder) Allowed(value int) *ResourceBuilder { + b.allowed = value + b.bitmap_ |= 32 + return b +} + +// AvailabilityZoneType sets the value of the 'availability_zone_type' attribute to the given value. +func (b *ResourceBuilder) AvailabilityZoneType(value string) *ResourceBuilder { + b.availabilityZoneType = value + b.bitmap_ |= 64 + return b +} + +// ResourceName sets the value of the 'resource_name' attribute to the given value. +func (b *ResourceBuilder) ResourceName(value string) *ResourceBuilder { + b.resourceName = value + b.bitmap_ |= 128 + return b +} + +// ResourceType sets the value of the 'resource_type' attribute to the given value. +func (b *ResourceBuilder) ResourceType(value string) *ResourceBuilder { + b.resourceType = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ResourceBuilder) Copy(object *Resource) *ResourceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.byoc = object.byoc + b.sku = object.sku + b.allowed = object.allowed + b.availabilityZoneType = object.availabilityZoneType + b.resourceName = object.resourceName + b.resourceType = object.resourceType + return b +} + +// Build creates a 'resource' object using the configuration stored in the builder. +func (b *ResourceBuilder) Build() (object *Resource, err error) { + object = new(Resource) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.byoc = b.byoc + object.sku = b.sku + object.allowed = b.allowed + object.availabilityZoneType = b.availabilityZoneType + object.resourceName = b.resourceName + object.resourceType = b.resourceType + return +} diff --git a/clientapi/accountsmgmt/v1/resource_list_builder.go b/clientapi/accountsmgmt/v1/resource_list_builder.go new file mode 100644 index 00000000..cae0cd82 --- /dev/null +++ b/clientapi/accountsmgmt/v1/resource_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ResourceListBuilder contains the data and logic needed to build +// 'resource' objects. +type ResourceListBuilder struct { + items []*ResourceBuilder +} + +// NewResourceList creates a new builder of 'resource' objects. +func NewResourceList() *ResourceListBuilder { + return new(ResourceListBuilder) +} + +// Items sets the items of the list. +func (b *ResourceListBuilder) Items(values ...*ResourceBuilder) *ResourceListBuilder { + b.items = make([]*ResourceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ResourceListBuilder) 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 *ResourceListBuilder) Copy(list *ResourceList) *ResourceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ResourceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewResource().Copy(v) + } + } + return b +} + +// Build creates a list of 'resource' objects using the +// configuration stored in the builder. +func (b *ResourceListBuilder) Build() (list *ResourceList, err error) { + items := make([]*Resource, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ResourceList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/resource_list_type_json.go b/clientapi/accountsmgmt/v1/resource_list_type_json.go new file mode 100644 index 00000000..0a2b0cac --- /dev/null +++ b/clientapi/accountsmgmt/v1/resource_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalResourceList writes a list of values of the 'resource' type to +// the given writer. +func MarshalResourceList(list []*Resource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteResourceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteResourceList writes a list of value of the 'resource' type to +// the given stream. +func WriteResourceList(list []*Resource, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteResource(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalResourceList reads a list of values of the 'resource' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalResourceList(source interface{}) (items []*Resource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadResourceList(iterator) + err = iterator.Error + return +} + +// ReadResourceList reads list of values of the ”resource' type from +// the given iterator. +func ReadResourceList(iterator *jsoniter.Iterator) []*Resource { + list := []*Resource{} + for iterator.ReadArray() { + item := ReadResource(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/resource_quota_builder.go b/clientapi/accountsmgmt/v1/resource_quota_builder.go new file mode 100644 index 00000000..9c4899f2 --- /dev/null +++ b/clientapi/accountsmgmt/v1/resource_quota_builder.go @@ -0,0 +1,141 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// ResourceQuotaBuilder contains the data and logic needed to build 'resource_quota' objects. +type ResourceQuotaBuilder struct { + bitmap_ uint32 + id string + href string + sku string + createdAt time.Time + organizationID string + skuCount int + type_ string + updatedAt time.Time +} + +// NewResourceQuota creates a new builder of 'resource_quota' objects. +func NewResourceQuota() *ResourceQuotaBuilder { + return &ResourceQuotaBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ResourceQuotaBuilder) Link(value bool) *ResourceQuotaBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ResourceQuotaBuilder) ID(value string) *ResourceQuotaBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ResourceQuotaBuilder) HREF(value string) *ResourceQuotaBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ResourceQuotaBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// SKU sets the value of the 'SKU' attribute to the given value. +func (b *ResourceQuotaBuilder) SKU(value string) *ResourceQuotaBuilder { + b.sku = value + b.bitmap_ |= 8 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *ResourceQuotaBuilder) CreatedAt(value time.Time) *ResourceQuotaBuilder { + b.createdAt = value + b.bitmap_ |= 16 + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *ResourceQuotaBuilder) OrganizationID(value string) *ResourceQuotaBuilder { + b.organizationID = value + b.bitmap_ |= 32 + return b +} + +// SkuCount sets the value of the 'sku_count' attribute to the given value. +func (b *ResourceQuotaBuilder) SkuCount(value int) *ResourceQuotaBuilder { + b.skuCount = value + b.bitmap_ |= 64 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *ResourceQuotaBuilder) Type(value string) *ResourceQuotaBuilder { + b.type_ = value + b.bitmap_ |= 128 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *ResourceQuotaBuilder) UpdatedAt(value time.Time) *ResourceQuotaBuilder { + b.updatedAt = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ResourceQuotaBuilder) Copy(object *ResourceQuota) *ResourceQuotaBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.sku = object.sku + b.createdAt = object.createdAt + b.organizationID = object.organizationID + b.skuCount = object.skuCount + b.type_ = object.type_ + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'resource_quota' object using the configuration stored in the builder. +func (b *ResourceQuotaBuilder) Build() (object *ResourceQuota, err error) { + object = new(ResourceQuota) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.sku = b.sku + object.createdAt = b.createdAt + object.organizationID = b.organizationID + object.skuCount = b.skuCount + object.type_ = b.type_ + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/accountsmgmt/v1/resource_quota_list_builder.go b/clientapi/accountsmgmt/v1/resource_quota_list_builder.go new file mode 100644 index 00000000..2bfc3e72 --- /dev/null +++ b/clientapi/accountsmgmt/v1/resource_quota_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ResourceQuotaListBuilder contains the data and logic needed to build +// 'resource_quota' objects. +type ResourceQuotaListBuilder struct { + items []*ResourceQuotaBuilder +} + +// NewResourceQuotaList creates a new builder of 'resource_quota' objects. +func NewResourceQuotaList() *ResourceQuotaListBuilder { + return new(ResourceQuotaListBuilder) +} + +// Items sets the items of the list. +func (b *ResourceQuotaListBuilder) Items(values ...*ResourceQuotaBuilder) *ResourceQuotaListBuilder { + b.items = make([]*ResourceQuotaBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ResourceQuotaListBuilder) 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 *ResourceQuotaListBuilder) Copy(list *ResourceQuotaList) *ResourceQuotaListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ResourceQuotaBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewResourceQuota().Copy(v) + } + } + return b +} + +// Build creates a list of 'resource_quota' objects using the +// configuration stored in the builder. +func (b *ResourceQuotaListBuilder) Build() (list *ResourceQuotaList, err error) { + items := make([]*ResourceQuota, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ResourceQuotaList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/resource_quota_list_type_json.go b/clientapi/accountsmgmt/v1/resource_quota_list_type_json.go new file mode 100644 index 00000000..f795d03d --- /dev/null +++ b/clientapi/accountsmgmt/v1/resource_quota_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalResourceQuotaList writes a list of values of the 'resource_quota' type to +// the given writer. +func MarshalResourceQuotaList(list []*ResourceQuota, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteResourceQuotaList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteResourceQuotaList writes a list of value of the 'resource_quota' type to +// the given stream. +func WriteResourceQuotaList(list []*ResourceQuota, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteResourceQuota(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalResourceQuotaList reads a list of values of the 'resource_quota' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalResourceQuotaList(source interface{}) (items []*ResourceQuota, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadResourceQuotaList(iterator) + err = iterator.Error + return +} + +// ReadResourceQuotaList reads list of values of the ”resource_quota' type from +// the given iterator. +func ReadResourceQuotaList(iterator *jsoniter.Iterator) []*ResourceQuota { + list := []*ResourceQuota{} + for iterator.ReadArray() { + item := ReadResourceQuota(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/resource_quota_type.go b/clientapi/accountsmgmt/v1/resource_quota_type.go new file mode 100644 index 00000000..377ef9c7 --- /dev/null +++ b/clientapi/accountsmgmt/v1/resource_quota_type.go @@ -0,0 +1,363 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// ResourceQuotaKind is the name of the type used to represent objects +// of type 'resource_quota'. +const ResourceQuotaKind = "ResourceQuota" + +// ResourceQuotaLinkKind is the name of the type used to represent links +// to objects of type 'resource_quota'. +const ResourceQuotaLinkKind = "ResourceQuotaLink" + +// ResourceQuotaNilKind is the name of the type used to nil references +// to objects of type 'resource_quota'. +const ResourceQuotaNilKind = "ResourceQuotaNil" + +// ResourceQuota represents the values of the 'resource_quota' type. +type ResourceQuota struct { + bitmap_ uint32 + id string + href string + sku string + createdAt time.Time + organizationID string + skuCount int + type_ string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *ResourceQuota) Kind() string { + if o == nil { + return ResourceQuotaNilKind + } + if o.bitmap_&1 != 0 { + return ResourceQuotaLinkKind + } + return ResourceQuotaKind +} + +// Link returns true if this is a link. +func (o *ResourceQuota) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ResourceQuota) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ResourceQuota) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ResourceQuota) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ResourceQuota) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ResourceQuota) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// SKU returns the value of the 'SKU' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ResourceQuota) SKU() string { + if o != nil && o.bitmap_&8 != 0 { + return o.sku + } + return "" +} + +// GetSKU returns the value of the 'SKU' attribute and +// a flag indicating if the attribute has a value. +func (o *ResourceQuota) GetSKU() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.sku + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ResourceQuota) CreatedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *ResourceQuota) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.createdAt + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ResourceQuota) OrganizationID() string { + if o != nil && o.bitmap_&32 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *ResourceQuota) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.organizationID + } + return +} + +// SkuCount returns the value of the 'sku_count' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ResourceQuota) SkuCount() int { + if o != nil && o.bitmap_&64 != 0 { + return o.skuCount + } + return 0 +} + +// GetSkuCount returns the value of the 'sku_count' attribute and +// a flag indicating if the attribute has a value. +func (o *ResourceQuota) GetSkuCount() (value int, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.skuCount + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ResourceQuota) Type() string { + if o != nil && o.bitmap_&128 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +func (o *ResourceQuota) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.type_ + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ResourceQuota) UpdatedAt() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *ResourceQuota) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.updatedAt + } + return +} + +// ResourceQuotaListKind is the name of the type used to represent list of objects of +// type 'resource_quota'. +const ResourceQuotaListKind = "ResourceQuotaList" + +// ResourceQuotaListLinkKind is the name of the type used to represent links to list +// of objects of type 'resource_quota'. +const ResourceQuotaListLinkKind = "ResourceQuotaListLink" + +// ResourceQuotaNilKind is the name of the type used to nil lists of objects of +// type 'resource_quota'. +const ResourceQuotaListNilKind = "ResourceQuotaListNil" + +// ResourceQuotaList is a list of values of the 'resource_quota' type. +type ResourceQuotaList struct { + href string + link bool + items []*ResourceQuota +} + +// Kind returns the name of the type of the object. +func (l *ResourceQuotaList) Kind() string { + if l == nil { + return ResourceQuotaListNilKind + } + if l.link { + return ResourceQuotaListLinkKind + } + return ResourceQuotaListKind +} + +// Link returns true iif this is a link. +func (l *ResourceQuotaList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ResourceQuotaList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ResourceQuotaList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ResourceQuotaList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ResourceQuotaList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ResourceQuotaList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ResourceQuotaList) SetItems(items []*ResourceQuota) { + l.items = items +} + +// Items returns the items of the list. +func (l *ResourceQuotaList) Items() []*ResourceQuota { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ResourceQuotaList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ResourceQuotaList) Get(i int) *ResourceQuota { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ResourceQuotaList) Slice() []*ResourceQuota { + var slice []*ResourceQuota + if l == nil { + slice = make([]*ResourceQuota, 0) + } else { + slice = make([]*ResourceQuota, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ResourceQuotaList) Each(f func(item *ResourceQuota) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ResourceQuotaList) Range(f func(index int, item *ResourceQuota) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/resource_quota_type_json.go b/clientapi/accountsmgmt/v1/resource_quota_type_json.go new file mode 100644 index 00000000..431fe448 --- /dev/null +++ b/clientapi/accountsmgmt/v1/resource_quota_type_json.go @@ -0,0 +1,194 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalResourceQuota writes a value of the 'resource_quota' type to the given writer. +func MarshalResourceQuota(object *ResourceQuota, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteResourceQuota(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteResourceQuota writes a value of the 'resource_quota' type to the given stream. +func WriteResourceQuota(object *ResourceQuota, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ResourceQuotaLinkKind) + } else { + stream.WriteString(ResourceQuotaKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sku") + stream.WriteString(object.sku) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sku_count") + stream.WriteInt(object.skuCount) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalResourceQuota reads a value of the 'resource_quota' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalResourceQuota(source interface{}) (object *ResourceQuota, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadResourceQuota(iterator) + err = iterator.Error + return +} + +// ReadResourceQuota reads a value of the 'resource_quota' type from the given iterator. +func ReadResourceQuota(iterator *jsoniter.Iterator) *ResourceQuota { + object := &ResourceQuota{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ResourceQuotaLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "sku": + value := iterator.ReadString() + object.sku = value + object.bitmap_ |= 8 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 16 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 32 + case "sku_count": + value := iterator.ReadInt() + object.skuCount = value + object.bitmap_ |= 64 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 128 + 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_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/resource_type.go b/clientapi/accountsmgmt/v1/resource_type.go new file mode 100644 index 00000000..ca7a886b --- /dev/null +++ b/clientapi/accountsmgmt/v1/resource_type.go @@ -0,0 +1,369 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ResourceKind is the name of the type used to represent objects +// of type 'resource'. +const ResourceKind = "Resource" + +// ResourceLinkKind is the name of the type used to represent links +// to objects of type 'resource'. +const ResourceLinkKind = "ResourceLink" + +// ResourceNilKind is the name of the type used to nil references +// to objects of type 'resource'. +const ResourceNilKind = "ResourceNil" + +// Resource represents the values of the 'resource' type. +// +// Identifies computing resources +type Resource struct { + bitmap_ uint32 + id string + href string + sku string + allowed int + availabilityZoneType string + resourceName string + resourceType string + byoc bool +} + +// Kind returns the name of the type of the object. +func (o *Resource) Kind() string { + if o == nil { + return ResourceNilKind + } + if o.bitmap_&1 != 0 { + return ResourceLinkKind + } + return ResourceKind +} + +// Link returns true if this is a link. +func (o *Resource) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Resource) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Resource) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Resource) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Resource) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Resource) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// BYOC returns the value of the 'BYOC' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Resource) BYOC() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.byoc + } + return false +} + +// GetBYOC returns the value of the 'BYOC' attribute and +// a flag indicating if the attribute has a value. +func (o *Resource) GetBYOC() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.byoc + } + return +} + +// SKU returns the value of the 'SKU' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Resource) SKU() string { + if o != nil && o.bitmap_&16 != 0 { + return o.sku + } + return "" +} + +// GetSKU returns the value of the 'SKU' attribute and +// a flag indicating if the attribute has a value. +func (o *Resource) GetSKU() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.sku + } + return +} + +// Allowed returns the value of the 'allowed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Number of allowed nodes +func (o *Resource) Allowed() int { + if o != nil && o.bitmap_&32 != 0 { + return o.allowed + } + return 0 +} + +// GetAllowed returns the value of the 'allowed' attribute and +// a flag indicating if the attribute has a value. +// +// Number of allowed nodes +func (o *Resource) GetAllowed() (value int, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.allowed + } + return +} + +// AvailabilityZoneType returns the value of the 'availability_zone_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Resource) AvailabilityZoneType() string { + if o != nil && o.bitmap_&64 != 0 { + return o.availabilityZoneType + } + return "" +} + +// GetAvailabilityZoneType returns the value of the 'availability_zone_type' attribute and +// a flag indicating if the attribute has a value. +func (o *Resource) GetAvailabilityZoneType() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.availabilityZoneType + } + return +} + +// ResourceName returns the value of the 'resource_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// platform-specific name, such as "M5.2Xlarge" for a type of EC2 node +func (o *Resource) ResourceName() string { + if o != nil && o.bitmap_&128 != 0 { + return o.resourceName + } + return "" +} + +// GetResourceName returns the value of the 'resource_name' attribute and +// a flag indicating if the attribute has a value. +// +// platform-specific name, such as "M5.2Xlarge" for a type of EC2 node +func (o *Resource) GetResourceName() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.resourceName + } + return +} + +// ResourceType returns the value of the 'resource_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Resource) ResourceType() string { + if o != nil && o.bitmap_&256 != 0 { + return o.resourceType + } + return "" +} + +// GetResourceType returns the value of the 'resource_type' attribute and +// a flag indicating if the attribute has a value. +func (o *Resource) GetResourceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.resourceType + } + return +} + +// ResourceListKind is the name of the type used to represent list of objects of +// type 'resource'. +const ResourceListKind = "ResourceList" + +// ResourceListLinkKind is the name of the type used to represent links to list +// of objects of type 'resource'. +const ResourceListLinkKind = "ResourceListLink" + +// ResourceNilKind is the name of the type used to nil lists of objects of +// type 'resource'. +const ResourceListNilKind = "ResourceListNil" + +// ResourceList is a list of values of the 'resource' type. +type ResourceList struct { + href string + link bool + items []*Resource +} + +// Kind returns the name of the type of the object. +func (l *ResourceList) Kind() string { + if l == nil { + return ResourceListNilKind + } + if l.link { + return ResourceListLinkKind + } + return ResourceListKind +} + +// Link returns true iif this is a link. +func (l *ResourceList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ResourceList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ResourceList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ResourceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ResourceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ResourceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ResourceList) SetItems(items []*Resource) { + l.items = items +} + +// Items returns the items of the list. +func (l *ResourceList) Items() []*Resource { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ResourceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ResourceList) Get(i int) *Resource { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ResourceList) Slice() []*Resource { + var slice []*Resource + if l == nil { + slice = make([]*Resource, 0) + } else { + slice = make([]*Resource, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ResourceList) Each(f func(item *Resource) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ResourceList) Range(f func(index int, item *Resource) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/resource_type_json.go b/clientapi/accountsmgmt/v1/resource_type_json.go new file mode 100644 index 00000000..8f431879 --- /dev/null +++ b/clientapi/accountsmgmt/v1/resource_type_json.go @@ -0,0 +1,185 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalResource writes a value of the 'resource' type to the given writer. +func MarshalResource(object *Resource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteResource(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteResource writes a value of the 'resource' type to the given stream. +func WriteResource(object *Resource, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ResourceLinkKind) + } else { + stream.WriteString(ResourceKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("byoc") + stream.WriteBool(object.byoc) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sku") + stream.WriteString(object.sku) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("allowed") + stream.WriteInt(object.allowed) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zone_type") + stream.WriteString(object.availabilityZoneType) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_name") + stream.WriteString(object.resourceName) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_type") + stream.WriteString(object.resourceType) + } + stream.WriteObjectEnd() +} + +// UnmarshalResource reads a value of the 'resource' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalResource(source interface{}) (object *Resource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadResource(iterator) + err = iterator.Error + return +} + +// ReadResource reads a value of the 'resource' type from the given iterator. +func ReadResource(iterator *jsoniter.Iterator) *Resource { + object := &Resource{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ResourceLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "byoc": + value := iterator.ReadBool() + object.byoc = value + object.bitmap_ |= 8 + case "sku": + value := iterator.ReadString() + object.sku = value + object.bitmap_ |= 16 + case "allowed": + value := iterator.ReadInt() + object.allowed = value + object.bitmap_ |= 32 + case "availability_zone_type": + value := iterator.ReadString() + object.availabilityZoneType = value + object.bitmap_ |= 64 + case "resource_name": + value := iterator.ReadString() + object.resourceName = value + object.bitmap_ |= 128 + case "resource_type": + value := iterator.ReadString() + object.resourceType = value + object.bitmap_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/role_binding_builder.go b/clientapi/accountsmgmt/v1/role_binding_builder.go new file mode 100644 index 00000000..110695d0 --- /dev/null +++ b/clientapi/accountsmgmt/v1/role_binding_builder.go @@ -0,0 +1,263 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// RoleBindingBuilder contains the data and logic needed to build 'role_binding' objects. +type RoleBindingBuilder struct { + bitmap_ uint32 + id string + href string + account *AccountBuilder + accountID string + createdAt time.Time + managedBy string + organization *OrganizationBuilder + organizationID string + role *RoleBuilder + roleID string + subscription *SubscriptionBuilder + subscriptionID string + type_ string + updatedAt time.Time + configManaged bool +} + +// NewRoleBinding creates a new builder of 'role_binding' objects. +func NewRoleBinding() *RoleBindingBuilder { + return &RoleBindingBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *RoleBindingBuilder) Link(value bool) *RoleBindingBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *RoleBindingBuilder) ID(value string) *RoleBindingBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *RoleBindingBuilder) HREF(value string) *RoleBindingBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RoleBindingBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Account sets the value of the 'account' attribute to the given value. +func (b *RoleBindingBuilder) Account(value *AccountBuilder) *RoleBindingBuilder { + b.account = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// AccountID sets the value of the 'account_ID' attribute to the given value. +func (b *RoleBindingBuilder) AccountID(value string) *RoleBindingBuilder { + b.accountID = value + b.bitmap_ |= 16 + return b +} + +// ConfigManaged sets the value of the 'config_managed' attribute to the given value. +func (b *RoleBindingBuilder) ConfigManaged(value bool) *RoleBindingBuilder { + b.configManaged = value + b.bitmap_ |= 32 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *RoleBindingBuilder) CreatedAt(value time.Time) *RoleBindingBuilder { + b.createdAt = value + b.bitmap_ |= 64 + return b +} + +// ManagedBy sets the value of the 'managed_by' attribute to the given value. +func (b *RoleBindingBuilder) ManagedBy(value string) *RoleBindingBuilder { + b.managedBy = value + b.bitmap_ |= 128 + return b +} + +// Organization sets the value of the 'organization' attribute to the given value. +func (b *RoleBindingBuilder) Organization(value *OrganizationBuilder) *RoleBindingBuilder { + b.organization = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *RoleBindingBuilder) OrganizationID(value string) *RoleBindingBuilder { + b.organizationID = value + b.bitmap_ |= 512 + return b +} + +// Role sets the value of the 'role' attribute to the given value. +func (b *RoleBindingBuilder) Role(value *RoleBuilder) *RoleBindingBuilder { + b.role = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// RoleID sets the value of the 'role_ID' attribute to the given value. +func (b *RoleBindingBuilder) RoleID(value string) *RoleBindingBuilder { + b.roleID = value + b.bitmap_ |= 2048 + return b +} + +// Subscription sets the value of the 'subscription' attribute to the given value. +func (b *RoleBindingBuilder) Subscription(value *SubscriptionBuilder) *RoleBindingBuilder { + b.subscription = value + if value != nil { + b.bitmap_ |= 4096 + } else { + b.bitmap_ &^= 4096 + } + return b +} + +// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value. +func (b *RoleBindingBuilder) SubscriptionID(value string) *RoleBindingBuilder { + b.subscriptionID = value + b.bitmap_ |= 8192 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *RoleBindingBuilder) Type(value string) *RoleBindingBuilder { + b.type_ = value + b.bitmap_ |= 16384 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *RoleBindingBuilder) UpdatedAt(value time.Time) *RoleBindingBuilder { + b.updatedAt = value + b.bitmap_ |= 32768 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RoleBindingBuilder) Copy(object *RoleBinding) *RoleBindingBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.account != nil { + b.account = NewAccount().Copy(object.account) + } else { + b.account = nil + } + b.accountID = object.accountID + b.configManaged = object.configManaged + b.createdAt = object.createdAt + b.managedBy = object.managedBy + if object.organization != nil { + b.organization = NewOrganization().Copy(object.organization) + } else { + b.organization = nil + } + b.organizationID = object.organizationID + if object.role != nil { + b.role = NewRole().Copy(object.role) + } else { + b.role = nil + } + b.roleID = object.roleID + if object.subscription != nil { + b.subscription = NewSubscription().Copy(object.subscription) + } else { + b.subscription = nil + } + b.subscriptionID = object.subscriptionID + b.type_ = object.type_ + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'role_binding' object using the configuration stored in the builder. +func (b *RoleBindingBuilder) Build() (object *RoleBinding, err error) { + object = new(RoleBinding) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.account != nil { + object.account, err = b.account.Build() + if err != nil { + return + } + } + object.accountID = b.accountID + object.configManaged = b.configManaged + object.createdAt = b.createdAt + object.managedBy = b.managedBy + if b.organization != nil { + object.organization, err = b.organization.Build() + if err != nil { + return + } + } + object.organizationID = b.organizationID + if b.role != nil { + object.role, err = b.role.Build() + if err != nil { + return + } + } + object.roleID = b.roleID + if b.subscription != nil { + object.subscription, err = b.subscription.Build() + if err != nil { + return + } + } + object.subscriptionID = b.subscriptionID + object.type_ = b.type_ + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/accountsmgmt/v1/role_binding_list_builder.go b/clientapi/accountsmgmt/v1/role_binding_list_builder.go new file mode 100644 index 00000000..cd330096 --- /dev/null +++ b/clientapi/accountsmgmt/v1/role_binding_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// RoleBindingListBuilder contains the data and logic needed to build +// 'role_binding' objects. +type RoleBindingListBuilder struct { + items []*RoleBindingBuilder +} + +// NewRoleBindingList creates a new builder of 'role_binding' objects. +func NewRoleBindingList() *RoleBindingListBuilder { + return new(RoleBindingListBuilder) +} + +// Items sets the items of the list. +func (b *RoleBindingListBuilder) Items(values ...*RoleBindingBuilder) *RoleBindingListBuilder { + b.items = make([]*RoleBindingBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RoleBindingListBuilder) 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 *RoleBindingListBuilder) Copy(list *RoleBindingList) *RoleBindingListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RoleBindingBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRoleBinding().Copy(v) + } + } + return b +} + +// Build creates a list of 'role_binding' objects using the +// configuration stored in the builder. +func (b *RoleBindingListBuilder) Build() (list *RoleBindingList, err error) { + items := make([]*RoleBinding, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RoleBindingList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/role_binding_list_type_json.go b/clientapi/accountsmgmt/v1/role_binding_list_type_json.go new file mode 100644 index 00000000..2d769d42 --- /dev/null +++ b/clientapi/accountsmgmt/v1/role_binding_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRoleBindingList writes a list of values of the 'role_binding' type to +// the given writer. +func MarshalRoleBindingList(list []*RoleBinding, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRoleBindingList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRoleBindingList writes a list of value of the 'role_binding' type to +// the given stream. +func WriteRoleBindingList(list []*RoleBinding, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRoleBinding(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRoleBindingList reads a list of values of the 'role_binding' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRoleBindingList(source interface{}) (items []*RoleBinding, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRoleBindingList(iterator) + err = iterator.Error + return +} + +// ReadRoleBindingList reads list of values of the ”role_binding' type from +// the given iterator. +func ReadRoleBindingList(iterator *jsoniter.Iterator) []*RoleBinding { + list := []*RoleBinding{} + for iterator.ReadArray() { + item := ReadRoleBinding(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/role_binding_type.go b/clientapi/accountsmgmt/v1/role_binding_type.go new file mode 100644 index 00000000..d30abacb --- /dev/null +++ b/clientapi/accountsmgmt/v1/role_binding_type.go @@ -0,0 +1,503 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// RoleBindingKind is the name of the type used to represent objects +// of type 'role_binding'. +const RoleBindingKind = "RoleBinding" + +// RoleBindingLinkKind is the name of the type used to represent links +// to objects of type 'role_binding'. +const RoleBindingLinkKind = "RoleBindingLink" + +// RoleBindingNilKind is the name of the type used to nil references +// to objects of type 'role_binding'. +const RoleBindingNilKind = "RoleBindingNil" + +// RoleBinding represents the values of the 'role_binding' type. +type RoleBinding struct { + bitmap_ uint32 + id string + href string + account *Account + accountID string + createdAt time.Time + managedBy string + organization *Organization + organizationID string + role *Role + roleID string + subscription *Subscription + subscriptionID string + type_ string + updatedAt time.Time + configManaged bool +} + +// Kind returns the name of the type of the object. +func (o *RoleBinding) Kind() string { + if o == nil { + return RoleBindingNilKind + } + if o.bitmap_&1 != 0 { + return RoleBindingLinkKind + } + return RoleBindingKind +} + +// Link returns true if this is a link. +func (o *RoleBinding) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *RoleBinding) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *RoleBinding) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *RoleBinding) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *RoleBinding) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RoleBinding) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Account returns the value of the 'account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RoleBinding) Account() *Account { + if o != nil && o.bitmap_&8 != 0 { + return o.account + } + return nil +} + +// GetAccount returns the value of the 'account' attribute and +// a flag indicating if the attribute has a value. +func (o *RoleBinding) GetAccount() (value *Account, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.account + } + return +} + +// AccountID returns the value of the 'account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RoleBinding) AccountID() string { + if o != nil && o.bitmap_&16 != 0 { + return o.accountID + } + return "" +} + +// GetAccountID returns the value of the 'account_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *RoleBinding) GetAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.accountID + } + return +} + +// ConfigManaged returns the value of the 'config_managed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RoleBinding) ConfigManaged() bool { + if o != nil && o.bitmap_&32 != 0 { + return o.configManaged + } + return false +} + +// GetConfigManaged returns the value of the 'config_managed' attribute and +// a flag indicating if the attribute has a value. +func (o *RoleBinding) GetConfigManaged() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.configManaged + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RoleBinding) CreatedAt() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *RoleBinding) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.createdAt + } + return +} + +// ManagedBy returns the value of the 'managed_by' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RoleBinding) ManagedBy() string { + if o != nil && o.bitmap_&128 != 0 { + return o.managedBy + } + return "" +} + +// GetManagedBy returns the value of the 'managed_by' attribute and +// a flag indicating if the attribute has a value. +func (o *RoleBinding) GetManagedBy() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.managedBy + } + return +} + +// Organization returns the value of the 'organization' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RoleBinding) Organization() *Organization { + if o != nil && o.bitmap_&256 != 0 { + return o.organization + } + return nil +} + +// GetOrganization returns the value of the 'organization' attribute and +// a flag indicating if the attribute has a value. +func (o *RoleBinding) GetOrganization() (value *Organization, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.organization + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RoleBinding) OrganizationID() string { + if o != nil && o.bitmap_&512 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *RoleBinding) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.organizationID + } + return +} + +// Role returns the value of the 'role' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RoleBinding) Role() *Role { + if o != nil && o.bitmap_&1024 != 0 { + return o.role + } + return nil +} + +// GetRole returns the value of the 'role' attribute and +// a flag indicating if the attribute has a value. +func (o *RoleBinding) GetRole() (value *Role, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.role + } + return +} + +// RoleID returns the value of the 'role_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RoleBinding) RoleID() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.roleID + } + return "" +} + +// GetRoleID returns the value of the 'role_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *RoleBinding) GetRoleID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.roleID + } + return +} + +// Subscription returns the value of the 'subscription' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RoleBinding) Subscription() *Subscription { + if o != nil && o.bitmap_&4096 != 0 { + return o.subscription + } + return nil +} + +// GetSubscription returns the value of the 'subscription' attribute and +// a flag indicating if the attribute has a value. +func (o *RoleBinding) GetSubscription() (value *Subscription, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.subscription + } + return +} + +// SubscriptionID returns the value of the 'subscription_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RoleBinding) SubscriptionID() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.subscriptionID + } + return "" +} + +// GetSubscriptionID returns the value of the 'subscription_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *RoleBinding) GetSubscriptionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.subscriptionID + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RoleBinding) Type() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +func (o *RoleBinding) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.type_ + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RoleBinding) UpdatedAt() time.Time { + if o != nil && o.bitmap_&32768 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *RoleBinding) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.updatedAt + } + return +} + +// RoleBindingListKind is the name of the type used to represent list of objects of +// type 'role_binding'. +const RoleBindingListKind = "RoleBindingList" + +// RoleBindingListLinkKind is the name of the type used to represent links to list +// of objects of type 'role_binding'. +const RoleBindingListLinkKind = "RoleBindingListLink" + +// RoleBindingNilKind is the name of the type used to nil lists of objects of +// type 'role_binding'. +const RoleBindingListNilKind = "RoleBindingListNil" + +// RoleBindingList is a list of values of the 'role_binding' type. +type RoleBindingList struct { + href string + link bool + items []*RoleBinding +} + +// Kind returns the name of the type of the object. +func (l *RoleBindingList) Kind() string { + if l == nil { + return RoleBindingListNilKind + } + if l.link { + return RoleBindingListLinkKind + } + return RoleBindingListKind +} + +// Link returns true iif this is a link. +func (l *RoleBindingList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *RoleBindingList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *RoleBindingList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *RoleBindingList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RoleBindingList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RoleBindingList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RoleBindingList) SetItems(items []*RoleBinding) { + l.items = items +} + +// Items returns the items of the list. +func (l *RoleBindingList) Items() []*RoleBinding { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RoleBindingList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RoleBindingList) Get(i int) *RoleBinding { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RoleBindingList) Slice() []*RoleBinding { + var slice []*RoleBinding + if l == nil { + slice = make([]*RoleBinding, 0) + } else { + slice = make([]*RoleBinding, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RoleBindingList) Each(f func(item *RoleBinding) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RoleBindingList) Range(f func(index int, item *RoleBinding) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/role_binding_type_json.go b/clientapi/accountsmgmt/v1/role_binding_type_json.go new file mode 100644 index 00000000..572eede2 --- /dev/null +++ b/clientapi/accountsmgmt/v1/role_binding_type_json.go @@ -0,0 +1,285 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRoleBinding writes a value of the 'role_binding' type to the given writer. +func MarshalRoleBinding(object *RoleBinding, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRoleBinding(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRoleBinding writes a value of the 'role_binding' type to the given stream. +func WriteRoleBinding(object *RoleBinding, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(RoleBindingLinkKind) + } else { + stream.WriteString(RoleBindingKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.account != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account") + WriteAccount(object.account, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_id") + stream.WriteString(object.accountID) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("config_managed") + stream.WriteBool(object.configManaged) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_by") + stream.WriteString(object.managedBy) + count++ + } + present_ = object.bitmap_&256 != 0 && object.organization != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization") + WriteOrganization(object.organization, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.role != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role") + WriteRole(object.role, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role_id") + stream.WriteString(object.roleID) + count++ + } + present_ = object.bitmap_&4096 != 0 && object.subscription != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription") + WriteSubscription(object.subscription, stream) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionID) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalRoleBinding reads a value of the 'role_binding' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRoleBinding(source interface{}) (object *RoleBinding, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRoleBinding(iterator) + err = iterator.Error + return +} + +// ReadRoleBinding reads a value of the 'role_binding' type from the given iterator. +func ReadRoleBinding(iterator *jsoniter.Iterator) *RoleBinding { + object := &RoleBinding{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == RoleBindingLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "account": + value := ReadAccount(iterator) + object.account = value + object.bitmap_ |= 8 + case "account_id": + value := iterator.ReadString() + object.accountID = value + object.bitmap_ |= 16 + case "config_managed": + value := iterator.ReadBool() + object.configManaged = value + object.bitmap_ |= 32 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 64 + case "managed_by": + value := iterator.ReadString() + object.managedBy = value + object.bitmap_ |= 128 + case "organization": + value := ReadOrganization(iterator) + object.organization = value + object.bitmap_ |= 256 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 512 + case "role": + value := ReadRole(iterator) + object.role = value + object.bitmap_ |= 1024 + case "role_id": + value := iterator.ReadString() + object.roleID = value + object.bitmap_ |= 2048 + case "subscription": + value := ReadSubscription(iterator) + object.subscription = value + object.bitmap_ |= 4096 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionID = value + object.bitmap_ |= 8192 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 16384 + 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_ |= 32768 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/role_builder.go b/clientapi/accountsmgmt/v1/role_builder.go new file mode 100644 index 00000000..952e354d --- /dev/null +++ b/clientapi/accountsmgmt/v1/role_builder.go @@ -0,0 +1,113 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// RoleBuilder contains the data and logic needed to build 'role' objects. +type RoleBuilder struct { + bitmap_ uint32 + id string + href string + name string + permissions []*PermissionBuilder +} + +// NewRole creates a new builder of 'role' objects. +func NewRole() *RoleBuilder { + return &RoleBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *RoleBuilder) Link(value bool) *RoleBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *RoleBuilder) ID(value string) *RoleBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *RoleBuilder) HREF(value string) *RoleBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RoleBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *RoleBuilder) Name(value string) *RoleBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// Permissions sets the value of the 'permissions' attribute to the given values. +func (b *RoleBuilder) Permissions(values ...*PermissionBuilder) *RoleBuilder { + b.permissions = make([]*PermissionBuilder, len(values)) + copy(b.permissions, values) + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RoleBuilder) Copy(object *Role) *RoleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.name = object.name + if object.permissions != nil { + b.permissions = make([]*PermissionBuilder, len(object.permissions)) + for i, v := range object.permissions { + b.permissions[i] = NewPermission().Copy(v) + } + } else { + b.permissions = nil + } + return b +} + +// Build creates a 'role' object using the configuration stored in the builder. +func (b *RoleBuilder) Build() (object *Role, err error) { + object = new(Role) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.name = b.name + if b.permissions != nil { + object.permissions = make([]*Permission, len(b.permissions)) + for i, v := range b.permissions { + object.permissions[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/accountsmgmt/v1/role_list_builder.go b/clientapi/accountsmgmt/v1/role_list_builder.go new file mode 100644 index 00000000..e4c0273f --- /dev/null +++ b/clientapi/accountsmgmt/v1/role_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// RoleListBuilder contains the data and logic needed to build +// 'role' objects. +type RoleListBuilder struct { + items []*RoleBuilder +} + +// NewRoleList creates a new builder of 'role' objects. +func NewRoleList() *RoleListBuilder { + return new(RoleListBuilder) +} + +// Items sets the items of the list. +func (b *RoleListBuilder) Items(values ...*RoleBuilder) *RoleListBuilder { + b.items = make([]*RoleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RoleListBuilder) 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 *RoleListBuilder) Copy(list *RoleList) *RoleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RoleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRole().Copy(v) + } + } + return b +} + +// Build creates a list of 'role' objects using the +// configuration stored in the builder. +func (b *RoleListBuilder) Build() (list *RoleList, err error) { + items := make([]*Role, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RoleList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/role_list_type_json.go b/clientapi/accountsmgmt/v1/role_list_type_json.go new file mode 100644 index 00000000..a921c97b --- /dev/null +++ b/clientapi/accountsmgmt/v1/role_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRoleList writes a list of values of the 'role' type to +// the given writer. +func MarshalRoleList(list []*Role, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRoleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRoleList writes a list of value of the 'role' type to +// the given stream. +func WriteRoleList(list []*Role, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRole(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRoleList reads a list of values of the 'role' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRoleList(source interface{}) (items []*Role, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRoleList(iterator) + err = iterator.Error + return +} + +// ReadRoleList reads list of values of the ”role' type from +// the given iterator. +func ReadRoleList(iterator *jsoniter.Iterator) []*Role { + list := []*Role{} + for iterator.ReadArray() { + item := ReadRole(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/role_type.go b/clientapi/accountsmgmt/v1/role_type.go new file mode 100644 index 00000000..83b4175a --- /dev/null +++ b/clientapi/accountsmgmt/v1/role_type.go @@ -0,0 +1,279 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// RoleKind is the name of the type used to represent objects +// of type 'role'. +const RoleKind = "Role" + +// RoleLinkKind is the name of the type used to represent links +// to objects of type 'role'. +const RoleLinkKind = "RoleLink" + +// RoleNilKind is the name of the type used to nil references +// to objects of type 'role'. +const RoleNilKind = "RoleNil" + +// Role represents the values of the 'role' type. +type Role struct { + bitmap_ uint32 + id string + href string + name string + permissions []*Permission +} + +// Kind returns the name of the type of the object. +func (o *Role) Kind() string { + if o == nil { + return RoleNilKind + } + if o.bitmap_&1 != 0 { + return RoleLinkKind + } + return RoleKind +} + +// Link returns true if this is a link. +func (o *Role) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Role) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Role) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Role) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Role) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Role) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Role) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *Role) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// Permissions returns the value of the 'permissions' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Role) Permissions() []*Permission { + if o != nil && o.bitmap_&16 != 0 { + return o.permissions + } + return nil +} + +// GetPermissions returns the value of the 'permissions' attribute and +// a flag indicating if the attribute has a value. +func (o *Role) GetPermissions() (value []*Permission, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.permissions + } + return +} + +// RoleListKind is the name of the type used to represent list of objects of +// type 'role'. +const RoleListKind = "RoleList" + +// RoleListLinkKind is the name of the type used to represent links to list +// of objects of type 'role'. +const RoleListLinkKind = "RoleListLink" + +// RoleNilKind is the name of the type used to nil lists of objects of +// type 'role'. +const RoleListNilKind = "RoleListNil" + +// RoleList is a list of values of the 'role' type. +type RoleList struct { + href string + link bool + items []*Role +} + +// Kind returns the name of the type of the object. +func (l *RoleList) Kind() string { + if l == nil { + return RoleListNilKind + } + if l.link { + return RoleListLinkKind + } + return RoleListKind +} + +// Link returns true iif this is a link. +func (l *RoleList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *RoleList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *RoleList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *RoleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RoleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RoleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RoleList) SetItems(items []*Role) { + l.items = items +} + +// Items returns the items of the list. +func (l *RoleList) Items() []*Role { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RoleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RoleList) Get(i int) *Role { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RoleList) Slice() []*Role { + var slice []*Role + if l == nil { + slice = make([]*Role, 0) + } else { + slice = make([]*Role, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RoleList) Each(f func(item *Role) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RoleList) Range(f func(index int, item *Role) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/role_type_json.go b/clientapi/accountsmgmt/v1/role_type_json.go new file mode 100644 index 00000000..b5fbf5f9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/role_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRole writes a value of the 'role' type to the given writer. +func MarshalRole(object *Role, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRole(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRole writes a value of the 'role' type to the given stream. +func WriteRole(object *Role, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(RoleLinkKind) + } else { + stream.WriteString(RoleKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&16 != 0 && object.permissions != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("permissions") + WritePermissionList(object.permissions, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalRole reads a value of the 'role' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRole(source interface{}) (object *Role, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRole(iterator) + err = iterator.Error + return +} + +// ReadRole reads a value of the 'role' type from the given iterator. +func ReadRole(iterator *jsoniter.Iterator) *Role { + object := &Role{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == RoleLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + case "permissions": + value := ReadPermissionList(iterator) + object.permissions = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/sku_rule_builder.go b/clientapi/accountsmgmt/v1/sku_rule_builder.go new file mode 100644 index 00000000..09ae5f8f --- /dev/null +++ b/clientapi/accountsmgmt/v1/sku_rule_builder.go @@ -0,0 +1,109 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SkuRuleBuilder contains the data and logic needed to build 'sku_rule' objects. +// +// Identifies sku rule +type SkuRuleBuilder struct { + bitmap_ uint32 + id string + href string + allowed int + quotaId string + sku string +} + +// NewSkuRule creates a new builder of 'sku_rule' objects. +func NewSkuRule() *SkuRuleBuilder { + return &SkuRuleBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *SkuRuleBuilder) Link(value bool) *SkuRuleBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *SkuRuleBuilder) ID(value string) *SkuRuleBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *SkuRuleBuilder) HREF(value string) *SkuRuleBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SkuRuleBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Allowed sets the value of the 'allowed' attribute to the given value. +func (b *SkuRuleBuilder) Allowed(value int) *SkuRuleBuilder { + b.allowed = value + b.bitmap_ |= 8 + return b +} + +// QuotaId sets the value of the 'quota_id' attribute to the given value. +func (b *SkuRuleBuilder) QuotaId(value string) *SkuRuleBuilder { + b.quotaId = value + b.bitmap_ |= 16 + return b +} + +// Sku sets the value of the 'sku' attribute to the given value. +func (b *SkuRuleBuilder) Sku(value string) *SkuRuleBuilder { + b.sku = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SkuRuleBuilder) Copy(object *SkuRule) *SkuRuleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.allowed = object.allowed + b.quotaId = object.quotaId + b.sku = object.sku + return b +} + +// Build creates a 'sku_rule' object using the configuration stored in the builder. +func (b *SkuRuleBuilder) Build() (object *SkuRule, err error) { + object = new(SkuRule) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.allowed = b.allowed + object.quotaId = b.quotaId + object.sku = b.sku + return +} diff --git a/clientapi/accountsmgmt/v1/sku_rule_list_builder.go b/clientapi/accountsmgmt/v1/sku_rule_list_builder.go new file mode 100644 index 00000000..94486b50 --- /dev/null +++ b/clientapi/accountsmgmt/v1/sku_rule_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SkuRuleListBuilder contains the data and logic needed to build +// 'sku_rule' objects. +type SkuRuleListBuilder struct { + items []*SkuRuleBuilder +} + +// NewSkuRuleList creates a new builder of 'sku_rule' objects. +func NewSkuRuleList() *SkuRuleListBuilder { + return new(SkuRuleListBuilder) +} + +// Items sets the items of the list. +func (b *SkuRuleListBuilder) Items(values ...*SkuRuleBuilder) *SkuRuleListBuilder { + b.items = make([]*SkuRuleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SkuRuleListBuilder) 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 *SkuRuleListBuilder) Copy(list *SkuRuleList) *SkuRuleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SkuRuleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSkuRule().Copy(v) + } + } + return b +} + +// Build creates a list of 'sku_rule' objects using the +// configuration stored in the builder. +func (b *SkuRuleListBuilder) Build() (list *SkuRuleList, err error) { + items := make([]*SkuRule, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SkuRuleList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/sku_rule_list_type_json.go b/clientapi/accountsmgmt/v1/sku_rule_list_type_json.go new file mode 100644 index 00000000..e5487c75 --- /dev/null +++ b/clientapi/accountsmgmt/v1/sku_rule_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSkuRuleList writes a list of values of the 'sku_rule' type to +// the given writer. +func MarshalSkuRuleList(list []*SkuRule, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSkuRuleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSkuRuleList writes a list of value of the 'sku_rule' type to +// the given stream. +func WriteSkuRuleList(list []*SkuRule, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSkuRule(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSkuRuleList reads a list of values of the 'sku_rule' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSkuRuleList(source interface{}) (items []*SkuRule, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSkuRuleList(iterator) + err = iterator.Error + return +} + +// ReadSkuRuleList reads list of values of the ”sku_rule' type from +// the given iterator. +func ReadSkuRuleList(iterator *jsoniter.Iterator) []*SkuRule { + list := []*SkuRule{} + for iterator.ReadArray() { + item := ReadSkuRule(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/sku_rule_type.go b/clientapi/accountsmgmt/v1/sku_rule_type.go new file mode 100644 index 00000000..811dd061 --- /dev/null +++ b/clientapi/accountsmgmt/v1/sku_rule_type.go @@ -0,0 +1,313 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SkuRuleKind is the name of the type used to represent objects +// of type 'sku_rule'. +const SkuRuleKind = "SkuRule" + +// SkuRuleLinkKind is the name of the type used to represent links +// to objects of type 'sku_rule'. +const SkuRuleLinkKind = "SkuRuleLink" + +// SkuRuleNilKind is the name of the type used to nil references +// to objects of type 'sku_rule'. +const SkuRuleNilKind = "SkuRuleNil" + +// SkuRule represents the values of the 'sku_rule' type. +// +// Identifies sku rule +type SkuRule struct { + bitmap_ uint32 + id string + href string + allowed int + quotaId string + sku string +} + +// Kind returns the name of the type of the object. +func (o *SkuRule) Kind() string { + if o == nil { + return SkuRuleNilKind + } + if o.bitmap_&1 != 0 { + return SkuRuleLinkKind + } + return SkuRuleKind +} + +// Link returns true if this is a link. +func (o *SkuRule) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *SkuRule) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *SkuRule) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *SkuRule) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *SkuRule) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SkuRule) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Allowed returns the value of the 'allowed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Specifies the allowed parameter for calculation +func (o *SkuRule) Allowed() int { + if o != nil && o.bitmap_&8 != 0 { + return o.allowed + } + return 0 +} + +// GetAllowed returns the value of the 'allowed' attribute and +// a flag indicating if the attribute has a value. +// +// Specifies the allowed parameter for calculation +func (o *SkuRule) GetAllowed() (value int, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.allowed + } + return +} + +// QuotaId returns the value of the 'quota_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Specifies the quota id +func (o *SkuRule) QuotaId() string { + if o != nil && o.bitmap_&16 != 0 { + return o.quotaId + } + return "" +} + +// GetQuotaId returns the value of the 'quota_id' attribute and +// a flag indicating if the attribute has a value. +// +// Specifies the quota id +func (o *SkuRule) GetQuotaId() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.quotaId + } + return +} + +// Sku returns the value of the 'sku' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Specifies the sku, such as ""MW00504"" +func (o *SkuRule) Sku() string { + if o != nil && o.bitmap_&32 != 0 { + return o.sku + } + return "" +} + +// GetSku returns the value of the 'sku' attribute and +// a flag indicating if the attribute has a value. +// +// Specifies the sku, such as ""MW00504"" +func (o *SkuRule) GetSku() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.sku + } + return +} + +// SkuRuleListKind is the name of the type used to represent list of objects of +// type 'sku_rule'. +const SkuRuleListKind = "SkuRuleList" + +// SkuRuleListLinkKind is the name of the type used to represent links to list +// of objects of type 'sku_rule'. +const SkuRuleListLinkKind = "SkuRuleListLink" + +// SkuRuleNilKind is the name of the type used to nil lists of objects of +// type 'sku_rule'. +const SkuRuleListNilKind = "SkuRuleListNil" + +// SkuRuleList is a list of values of the 'sku_rule' type. +type SkuRuleList struct { + href string + link bool + items []*SkuRule +} + +// Kind returns the name of the type of the object. +func (l *SkuRuleList) Kind() string { + if l == nil { + return SkuRuleListNilKind + } + if l.link { + return SkuRuleListLinkKind + } + return SkuRuleListKind +} + +// Link returns true iif this is a link. +func (l *SkuRuleList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *SkuRuleList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *SkuRuleList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *SkuRuleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SkuRuleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SkuRuleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SkuRuleList) SetItems(items []*SkuRule) { + l.items = items +} + +// Items returns the items of the list. +func (l *SkuRuleList) Items() []*SkuRule { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SkuRuleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SkuRuleList) Get(i int) *SkuRule { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SkuRuleList) Slice() []*SkuRule { + var slice []*SkuRule + if l == nil { + slice = make([]*SkuRule, 0) + } else { + slice = make([]*SkuRule, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SkuRuleList) Each(f func(item *SkuRule) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SkuRuleList) Range(f func(index int, item *SkuRule) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/sku_rule_type_json.go b/clientapi/accountsmgmt/v1/sku_rule_type_json.go new file mode 100644 index 00000000..dce77744 --- /dev/null +++ b/clientapi/accountsmgmt/v1/sku_rule_type_json.go @@ -0,0 +1,146 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSkuRule writes a value of the 'sku_rule' type to the given writer. +func MarshalSkuRule(object *SkuRule, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSkuRule(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSkuRule writes a value of the 'sku_rule' type to the given stream. +func WriteSkuRule(object *SkuRule, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(SkuRuleLinkKind) + } else { + stream.WriteString(SkuRuleKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("allowed") + stream.WriteInt(object.allowed) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("quota_id") + stream.WriteString(object.quotaId) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sku") + stream.WriteString(object.sku) + } + stream.WriteObjectEnd() +} + +// UnmarshalSkuRule reads a value of the 'sku_rule' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSkuRule(source interface{}) (object *SkuRule, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSkuRule(iterator) + err = iterator.Error + return +} + +// ReadSkuRule reads a value of the 'sku_rule' type from the given iterator. +func ReadSkuRule(iterator *jsoniter.Iterator) *SkuRule { + object := &SkuRule{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == SkuRuleLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "allowed": + value := iterator.ReadInt() + object.allowed = value + object.bitmap_ |= 8 + case "quota_id": + value := iterator.ReadString() + object.quotaId = value + object.bitmap_ |= 16 + case "sku": + value := iterator.ReadString() + object.sku = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/string_list_type_json.go b/clientapi/accountsmgmt/v1/string_list_type_json.go new file mode 100644 index 00000000..9ccaae17 --- /dev/null +++ b/clientapi/accountsmgmt/v1/string_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStringList writes a list of values of the 'string' type to +// the given writer. +func MarshalStringList(list []string, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStringList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStringList writes a list of value of the 'string' type to +// the given stream. +func WriteStringList(list []string, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalStringList reads a list of values of the 'string' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStringList(source interface{}) (items []string, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStringList(iterator) + err = iterator.Error + return +} + +// ReadStringList reads list of values of the ”string' type from +// the given iterator. +func ReadStringList(iterator *jsoniter.Iterator) []string { + list := []string{} + for iterator.ReadArray() { + item := iterator.ReadString() + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/subscription_builder.go b/clientapi/accountsmgmt/v1/subscription_builder.go new file mode 100644 index 00000000..6cfa33e7 --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_builder.go @@ -0,0 +1,513 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// SubscriptionBuilder contains the data and logic needed to build 'subscription' objects. +type SubscriptionBuilder struct { + bitmap_ uint64 + id string + href string + billingMarketplaceAccount string + capabilities []*CapabilityBuilder + cloudAccountID string + cloudProviderID string + clusterID string + clusterBillingModel BillingModel + consoleURL string + consumerUUID string + cpuTotal int + createdAt time.Time + creator *AccountBuilder + displayName string + externalClusterID string + labels []*LabelBuilder + lastReconcileDate time.Time + lastReleasedAt time.Time + lastTelemetryDate time.Time + metrics []*SubscriptionMetricsBuilder + notificationContacts []*AccountBuilder + organizationID string + plan *PlanBuilder + productBundle string + provenance string + regionID string + serviceLevel string + socketTotal int + status string + supportLevel string + systemUnits string + trialEndDate time.Time + updatedAt time.Time + usage string + managed bool + released bool +} + +// NewSubscription creates a new builder of 'subscription' objects. +func NewSubscription() *SubscriptionBuilder { + return &SubscriptionBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *SubscriptionBuilder) Link(value bool) *SubscriptionBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *SubscriptionBuilder) ID(value string) *SubscriptionBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *SubscriptionBuilder) HREF(value string) *SubscriptionBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SubscriptionBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// BillingMarketplaceAccount sets the value of the 'billing_marketplace_account' attribute to the given value. +func (b *SubscriptionBuilder) BillingMarketplaceAccount(value string) *SubscriptionBuilder { + b.billingMarketplaceAccount = value + b.bitmap_ |= 8 + return b +} + +// Capabilities sets the value of the 'capabilities' attribute to the given values. +func (b *SubscriptionBuilder) Capabilities(values ...*CapabilityBuilder) *SubscriptionBuilder { + b.capabilities = make([]*CapabilityBuilder, len(values)) + copy(b.capabilities, values) + b.bitmap_ |= 16 + return b +} + +// CloudAccountID sets the value of the 'cloud_account_ID' attribute to the given value. +func (b *SubscriptionBuilder) CloudAccountID(value string) *SubscriptionBuilder { + b.cloudAccountID = value + b.bitmap_ |= 32 + return b +} + +// CloudProviderID sets the value of the 'cloud_provider_ID' attribute to the given value. +func (b *SubscriptionBuilder) CloudProviderID(value string) *SubscriptionBuilder { + b.cloudProviderID = value + b.bitmap_ |= 64 + return b +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *SubscriptionBuilder) ClusterID(value string) *SubscriptionBuilder { + b.clusterID = value + b.bitmap_ |= 128 + return b +} + +// ClusterBillingModel sets the value of the 'cluster_billing_model' attribute to the given value. +// +// Billing model for subscripiton and reserved_resource resources. +func (b *SubscriptionBuilder) ClusterBillingModel(value BillingModel) *SubscriptionBuilder { + b.clusterBillingModel = value + b.bitmap_ |= 256 + return b +} + +// ConsoleURL sets the value of the 'console_URL' attribute to the given value. +func (b *SubscriptionBuilder) ConsoleURL(value string) *SubscriptionBuilder { + b.consoleURL = value + b.bitmap_ |= 512 + return b +} + +// ConsumerUUID sets the value of the 'consumer_UUID' attribute to the given value. +func (b *SubscriptionBuilder) ConsumerUUID(value string) *SubscriptionBuilder { + b.consumerUUID = value + b.bitmap_ |= 1024 + return b +} + +// CpuTotal sets the value of the 'cpu_total' attribute to the given value. +func (b *SubscriptionBuilder) CpuTotal(value int) *SubscriptionBuilder { + b.cpuTotal = value + b.bitmap_ |= 2048 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *SubscriptionBuilder) CreatedAt(value time.Time) *SubscriptionBuilder { + b.createdAt = value + b.bitmap_ |= 4096 + return b +} + +// Creator sets the value of the 'creator' attribute to the given value. +func (b *SubscriptionBuilder) Creator(value *AccountBuilder) *SubscriptionBuilder { + b.creator = value + if value != nil { + b.bitmap_ |= 8192 + } else { + b.bitmap_ &^= 8192 + } + return b +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *SubscriptionBuilder) DisplayName(value string) *SubscriptionBuilder { + b.displayName = value + b.bitmap_ |= 16384 + return b +} + +// ExternalClusterID sets the value of the 'external_cluster_ID' attribute to the given value. +func (b *SubscriptionBuilder) ExternalClusterID(value string) *SubscriptionBuilder { + b.externalClusterID = value + b.bitmap_ |= 32768 + return b +} + +// Labels sets the value of the 'labels' attribute to the given values. +func (b *SubscriptionBuilder) Labels(values ...*LabelBuilder) *SubscriptionBuilder { + b.labels = make([]*LabelBuilder, len(values)) + copy(b.labels, values) + b.bitmap_ |= 65536 + return b +} + +// LastReconcileDate sets the value of the 'last_reconcile_date' attribute to the given value. +func (b *SubscriptionBuilder) LastReconcileDate(value time.Time) *SubscriptionBuilder { + b.lastReconcileDate = value + b.bitmap_ |= 131072 + return b +} + +// LastReleasedAt sets the value of the 'last_released_at' attribute to the given value. +func (b *SubscriptionBuilder) LastReleasedAt(value time.Time) *SubscriptionBuilder { + b.lastReleasedAt = value + b.bitmap_ |= 262144 + return b +} + +// LastTelemetryDate sets the value of the 'last_telemetry_date' attribute to the given value. +func (b *SubscriptionBuilder) LastTelemetryDate(value time.Time) *SubscriptionBuilder { + b.lastTelemetryDate = value + b.bitmap_ |= 524288 + return b +} + +// Managed sets the value of the 'managed' attribute to the given value. +func (b *SubscriptionBuilder) Managed(value bool) *SubscriptionBuilder { + b.managed = value + b.bitmap_ |= 1048576 + return b +} + +// Metrics sets the value of the 'metrics' attribute to the given values. +func (b *SubscriptionBuilder) Metrics(values ...*SubscriptionMetricsBuilder) *SubscriptionBuilder { + b.metrics = make([]*SubscriptionMetricsBuilder, len(values)) + copy(b.metrics, values) + b.bitmap_ |= 2097152 + return b +} + +// NotificationContacts sets the value of the 'notification_contacts' attribute to the given values. +func (b *SubscriptionBuilder) NotificationContacts(values ...*AccountBuilder) *SubscriptionBuilder { + b.notificationContacts = make([]*AccountBuilder, len(values)) + copy(b.notificationContacts, values) + b.bitmap_ |= 4194304 + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *SubscriptionBuilder) OrganizationID(value string) *SubscriptionBuilder { + b.organizationID = value + b.bitmap_ |= 8388608 + return b +} + +// Plan sets the value of the 'plan' attribute to the given value. +func (b *SubscriptionBuilder) Plan(value *PlanBuilder) *SubscriptionBuilder { + b.plan = value + if value != nil { + b.bitmap_ |= 16777216 + } else { + b.bitmap_ &^= 16777216 + } + return b +} + +// ProductBundle sets the value of the 'product_bundle' attribute to the given value. +func (b *SubscriptionBuilder) ProductBundle(value string) *SubscriptionBuilder { + b.productBundle = value + b.bitmap_ |= 33554432 + return b +} + +// Provenance sets the value of the 'provenance' attribute to the given value. +func (b *SubscriptionBuilder) Provenance(value string) *SubscriptionBuilder { + b.provenance = value + b.bitmap_ |= 67108864 + return b +} + +// RegionID sets the value of the 'region_ID' attribute to the given value. +func (b *SubscriptionBuilder) RegionID(value string) *SubscriptionBuilder { + b.regionID = value + b.bitmap_ |= 134217728 + return b +} + +// Released sets the value of the 'released' attribute to the given value. +func (b *SubscriptionBuilder) Released(value bool) *SubscriptionBuilder { + b.released = value + b.bitmap_ |= 268435456 + return b +} + +// ServiceLevel sets the value of the 'service_level' attribute to the given value. +func (b *SubscriptionBuilder) ServiceLevel(value string) *SubscriptionBuilder { + b.serviceLevel = value + b.bitmap_ |= 536870912 + return b +} + +// SocketTotal sets the value of the 'socket_total' attribute to the given value. +func (b *SubscriptionBuilder) SocketTotal(value int) *SubscriptionBuilder { + b.socketTotal = value + b.bitmap_ |= 1073741824 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *SubscriptionBuilder) Status(value string) *SubscriptionBuilder { + b.status = value + b.bitmap_ |= 2147483648 + return b +} + +// SupportLevel sets the value of the 'support_level' attribute to the given value. +func (b *SubscriptionBuilder) SupportLevel(value string) *SubscriptionBuilder { + b.supportLevel = value + b.bitmap_ |= 4294967296 + return b +} + +// SystemUnits sets the value of the 'system_units' attribute to the given value. +func (b *SubscriptionBuilder) SystemUnits(value string) *SubscriptionBuilder { + b.systemUnits = value + b.bitmap_ |= 8589934592 + return b +} + +// TrialEndDate sets the value of the 'trial_end_date' attribute to the given value. +func (b *SubscriptionBuilder) TrialEndDate(value time.Time) *SubscriptionBuilder { + b.trialEndDate = value + b.bitmap_ |= 17179869184 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *SubscriptionBuilder) UpdatedAt(value time.Time) *SubscriptionBuilder { + b.updatedAt = value + b.bitmap_ |= 34359738368 + return b +} + +// Usage sets the value of the 'usage' attribute to the given value. +func (b *SubscriptionBuilder) Usage(value string) *SubscriptionBuilder { + b.usage = value + b.bitmap_ |= 68719476736 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SubscriptionBuilder) Copy(object *Subscription) *SubscriptionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.billingMarketplaceAccount = object.billingMarketplaceAccount + if object.capabilities != nil { + b.capabilities = make([]*CapabilityBuilder, len(object.capabilities)) + for i, v := range object.capabilities { + b.capabilities[i] = NewCapability().Copy(v) + } + } else { + b.capabilities = nil + } + b.cloudAccountID = object.cloudAccountID + b.cloudProviderID = object.cloudProviderID + b.clusterID = object.clusterID + b.clusterBillingModel = object.clusterBillingModel + b.consoleURL = object.consoleURL + b.consumerUUID = object.consumerUUID + b.cpuTotal = object.cpuTotal + b.createdAt = object.createdAt + if object.creator != nil { + b.creator = NewAccount().Copy(object.creator) + } else { + b.creator = nil + } + b.displayName = object.displayName + b.externalClusterID = object.externalClusterID + if object.labels != nil { + b.labels = make([]*LabelBuilder, len(object.labels)) + for i, v := range object.labels { + b.labels[i] = NewLabel().Copy(v) + } + } else { + b.labels = nil + } + b.lastReconcileDate = object.lastReconcileDate + b.lastReleasedAt = object.lastReleasedAt + b.lastTelemetryDate = object.lastTelemetryDate + b.managed = object.managed + if object.metrics != nil { + b.metrics = make([]*SubscriptionMetricsBuilder, len(object.metrics)) + for i, v := range object.metrics { + b.metrics[i] = NewSubscriptionMetrics().Copy(v) + } + } else { + b.metrics = nil + } + if object.notificationContacts != nil { + b.notificationContacts = make([]*AccountBuilder, len(object.notificationContacts)) + for i, v := range object.notificationContacts { + b.notificationContacts[i] = NewAccount().Copy(v) + } + } else { + b.notificationContacts = nil + } + b.organizationID = object.organizationID + if object.plan != nil { + b.plan = NewPlan().Copy(object.plan) + } else { + b.plan = nil + } + b.productBundle = object.productBundle + b.provenance = object.provenance + b.regionID = object.regionID + b.released = object.released + b.serviceLevel = object.serviceLevel + b.socketTotal = object.socketTotal + b.status = object.status + b.supportLevel = object.supportLevel + b.systemUnits = object.systemUnits + b.trialEndDate = object.trialEndDate + b.updatedAt = object.updatedAt + b.usage = object.usage + return b +} + +// Build creates a 'subscription' object using the configuration stored in the builder. +func (b *SubscriptionBuilder) Build() (object *Subscription, err error) { + object = new(Subscription) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.billingMarketplaceAccount = b.billingMarketplaceAccount + if b.capabilities != nil { + object.capabilities = make([]*Capability, len(b.capabilities)) + for i, v := range b.capabilities { + object.capabilities[i], err = v.Build() + if err != nil { + return + } + } + } + object.cloudAccountID = b.cloudAccountID + object.cloudProviderID = b.cloudProviderID + object.clusterID = b.clusterID + object.clusterBillingModel = b.clusterBillingModel + object.consoleURL = b.consoleURL + object.consumerUUID = b.consumerUUID + object.cpuTotal = b.cpuTotal + object.createdAt = b.createdAt + if b.creator != nil { + object.creator, err = b.creator.Build() + if err != nil { + return + } + } + object.displayName = b.displayName + object.externalClusterID = b.externalClusterID + if b.labels != nil { + object.labels = make([]*Label, len(b.labels)) + for i, v := range b.labels { + object.labels[i], err = v.Build() + if err != nil { + return + } + } + } + object.lastReconcileDate = b.lastReconcileDate + object.lastReleasedAt = b.lastReleasedAt + object.lastTelemetryDate = b.lastTelemetryDate + object.managed = b.managed + if b.metrics != nil { + object.metrics = make([]*SubscriptionMetrics, len(b.metrics)) + for i, v := range b.metrics { + object.metrics[i], err = v.Build() + if err != nil { + return + } + } + } + if b.notificationContacts != nil { + object.notificationContacts = make([]*Account, len(b.notificationContacts)) + for i, v := range b.notificationContacts { + object.notificationContacts[i], err = v.Build() + if err != nil { + return + } + } + } + object.organizationID = b.organizationID + if b.plan != nil { + object.plan, err = b.plan.Build() + if err != nil { + return + } + } + object.productBundle = b.productBundle + object.provenance = b.provenance + object.regionID = b.regionID + object.released = b.released + object.serviceLevel = b.serviceLevel + object.socketTotal = b.socketTotal + object.status = b.status + object.supportLevel = b.supportLevel + object.systemUnits = b.systemUnits + object.trialEndDate = b.trialEndDate + object.updatedAt = b.updatedAt + object.usage = b.usage + return +} diff --git a/clientapi/accountsmgmt/v1/subscription_list_builder.go b/clientapi/accountsmgmt/v1/subscription_list_builder.go new file mode 100644 index 00000000..aab4ace6 --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SubscriptionListBuilder contains the data and logic needed to build +// 'subscription' objects. +type SubscriptionListBuilder struct { + items []*SubscriptionBuilder +} + +// NewSubscriptionList creates a new builder of 'subscription' objects. +func NewSubscriptionList() *SubscriptionListBuilder { + return new(SubscriptionListBuilder) +} + +// Items sets the items of the list. +func (b *SubscriptionListBuilder) Items(values ...*SubscriptionBuilder) *SubscriptionListBuilder { + b.items = make([]*SubscriptionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SubscriptionListBuilder) 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 *SubscriptionListBuilder) Copy(list *SubscriptionList) *SubscriptionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SubscriptionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSubscription().Copy(v) + } + } + return b +} + +// Build creates a list of 'subscription' objects using the +// configuration stored in the builder. +func (b *SubscriptionListBuilder) Build() (list *SubscriptionList, err error) { + items := make([]*Subscription, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SubscriptionList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/subscription_list_type_json.go b/clientapi/accountsmgmt/v1/subscription_list_type_json.go new file mode 100644 index 00000000..eae883fb --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSubscriptionList writes a list of values of the 'subscription' type to +// the given writer. +func MarshalSubscriptionList(list []*Subscription, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSubscriptionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSubscriptionList writes a list of value of the 'subscription' type to +// the given stream. +func WriteSubscriptionList(list []*Subscription, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSubscription(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSubscriptionList reads a list of values of the 'subscription' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSubscriptionList(source interface{}) (items []*Subscription, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSubscriptionList(iterator) + err = iterator.Error + return +} + +// ReadSubscriptionList reads list of values of the ”subscription' type from +// the given iterator. +func ReadSubscriptionList(iterator *jsoniter.Iterator) []*Subscription { + list := []*Subscription{} + for iterator.ReadArray() { + item := ReadSubscription(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/subscription_metrics_builder.go b/clientapi/accountsmgmt/v1/subscription_metrics_builder.go new file mode 100644 index 00000000..542b9672 --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_metrics_builder.go @@ -0,0 +1,390 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SubscriptionMetricsBuilder contains the data and logic needed to build 'subscription_metrics' objects. +// +// Each field is a metric fetched for a specific Subscription's cluster. +type SubscriptionMetricsBuilder struct { + bitmap_ uint32 + cloudProvider string + computeNodesCpu *ClusterResourceBuilder + computeNodesMemory *ClusterResourceBuilder + computeNodesSockets *ClusterResourceBuilder + consoleUrl string + cpu *ClusterResourceBuilder + criticalAlertsFiring float64 + healthState string + memory *ClusterResourceBuilder + nodes *ClusterMetricsNodesBuilder + openshiftVersion string + operatingSystem string + operatorsConditionFailing float64 + region string + sockets *ClusterResourceBuilder + state string + stateDescription string + storage *ClusterResourceBuilder + subscriptionCpuTotal float64 + subscriptionObligationExists float64 + subscriptionSocketTotal float64 + upgrade *ClusterUpgradeBuilder +} + +// NewSubscriptionMetrics creates a new builder of 'subscription_metrics' objects. +func NewSubscriptionMetrics() *SubscriptionMetricsBuilder { + return &SubscriptionMetricsBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SubscriptionMetricsBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +func (b *SubscriptionMetricsBuilder) CloudProvider(value string) *SubscriptionMetricsBuilder { + b.cloudProvider = value + b.bitmap_ |= 1 + return b +} + +// ComputeNodesCpu sets the value of the 'compute_nodes_cpu' attribute to the given value. +func (b *SubscriptionMetricsBuilder) ComputeNodesCpu(value *ClusterResourceBuilder) *SubscriptionMetricsBuilder { + b.computeNodesCpu = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// ComputeNodesMemory sets the value of the 'compute_nodes_memory' attribute to the given value. +func (b *SubscriptionMetricsBuilder) ComputeNodesMemory(value *ClusterResourceBuilder) *SubscriptionMetricsBuilder { + b.computeNodesMemory = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// ComputeNodesSockets sets the value of the 'compute_nodes_sockets' attribute to the given value. +func (b *SubscriptionMetricsBuilder) ComputeNodesSockets(value *ClusterResourceBuilder) *SubscriptionMetricsBuilder { + b.computeNodesSockets = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// ConsoleUrl sets the value of the 'console_url' attribute to the given value. +func (b *SubscriptionMetricsBuilder) ConsoleUrl(value string) *SubscriptionMetricsBuilder { + b.consoleUrl = value + b.bitmap_ |= 16 + return b +} + +// Cpu sets the value of the 'cpu' attribute to the given value. +func (b *SubscriptionMetricsBuilder) Cpu(value *ClusterResourceBuilder) *SubscriptionMetricsBuilder { + b.cpu = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// CriticalAlertsFiring sets the value of the 'critical_alerts_firing' attribute to the given value. +func (b *SubscriptionMetricsBuilder) CriticalAlertsFiring(value float64) *SubscriptionMetricsBuilder { + b.criticalAlertsFiring = value + b.bitmap_ |= 64 + return b +} + +// HealthState sets the value of the 'health_state' attribute to the given value. +func (b *SubscriptionMetricsBuilder) HealthState(value string) *SubscriptionMetricsBuilder { + b.healthState = value + b.bitmap_ |= 128 + return b +} + +// Memory sets the value of the 'memory' attribute to the given value. +func (b *SubscriptionMetricsBuilder) Memory(value *ClusterResourceBuilder) *SubscriptionMetricsBuilder { + b.memory = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// Nodes sets the value of the 'nodes' attribute to the given value. +func (b *SubscriptionMetricsBuilder) Nodes(value *ClusterMetricsNodesBuilder) *SubscriptionMetricsBuilder { + b.nodes = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// OpenshiftVersion sets the value of the 'openshift_version' attribute to the given value. +func (b *SubscriptionMetricsBuilder) OpenshiftVersion(value string) *SubscriptionMetricsBuilder { + b.openshiftVersion = value + b.bitmap_ |= 1024 + return b +} + +// OperatingSystem sets the value of the 'operating_system' attribute to the given value. +func (b *SubscriptionMetricsBuilder) OperatingSystem(value string) *SubscriptionMetricsBuilder { + b.operatingSystem = value + b.bitmap_ |= 2048 + return b +} + +// OperatorsConditionFailing sets the value of the 'operators_condition_failing' attribute to the given value. +func (b *SubscriptionMetricsBuilder) OperatorsConditionFailing(value float64) *SubscriptionMetricsBuilder { + b.operatorsConditionFailing = value + b.bitmap_ |= 4096 + return b +} + +// Region sets the value of the 'region' attribute to the given value. +func (b *SubscriptionMetricsBuilder) Region(value string) *SubscriptionMetricsBuilder { + b.region = value + b.bitmap_ |= 8192 + return b +} + +// Sockets sets the value of the 'sockets' attribute to the given value. +func (b *SubscriptionMetricsBuilder) Sockets(value *ClusterResourceBuilder) *SubscriptionMetricsBuilder { + b.sockets = value + if value != nil { + b.bitmap_ |= 16384 + } else { + b.bitmap_ &^= 16384 + } + return b +} + +// State sets the value of the 'state' attribute to the given value. +func (b *SubscriptionMetricsBuilder) State(value string) *SubscriptionMetricsBuilder { + b.state = value + b.bitmap_ |= 32768 + return b +} + +// StateDescription sets the value of the 'state_description' attribute to the given value. +func (b *SubscriptionMetricsBuilder) StateDescription(value string) *SubscriptionMetricsBuilder { + b.stateDescription = value + b.bitmap_ |= 65536 + return b +} + +// Storage sets the value of the 'storage' attribute to the given value. +func (b *SubscriptionMetricsBuilder) Storage(value *ClusterResourceBuilder) *SubscriptionMetricsBuilder { + b.storage = value + if value != nil { + b.bitmap_ |= 131072 + } else { + b.bitmap_ &^= 131072 + } + return b +} + +// SubscriptionCpuTotal sets the value of the 'subscription_cpu_total' attribute to the given value. +func (b *SubscriptionMetricsBuilder) SubscriptionCpuTotal(value float64) *SubscriptionMetricsBuilder { + b.subscriptionCpuTotal = value + b.bitmap_ |= 262144 + return b +} + +// SubscriptionObligationExists sets the value of the 'subscription_obligation_exists' attribute to the given value. +func (b *SubscriptionMetricsBuilder) SubscriptionObligationExists(value float64) *SubscriptionMetricsBuilder { + b.subscriptionObligationExists = value + b.bitmap_ |= 524288 + return b +} + +// SubscriptionSocketTotal sets the value of the 'subscription_socket_total' attribute to the given value. +func (b *SubscriptionMetricsBuilder) SubscriptionSocketTotal(value float64) *SubscriptionMetricsBuilder { + b.subscriptionSocketTotal = value + b.bitmap_ |= 1048576 + return b +} + +// Upgrade sets the value of the 'upgrade' attribute to the given value. +func (b *SubscriptionMetricsBuilder) Upgrade(value *ClusterUpgradeBuilder) *SubscriptionMetricsBuilder { + b.upgrade = value + if value != nil { + b.bitmap_ |= 2097152 + } else { + b.bitmap_ &^= 2097152 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SubscriptionMetricsBuilder) Copy(object *SubscriptionMetrics) *SubscriptionMetricsBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.cloudProvider = object.cloudProvider + if object.computeNodesCpu != nil { + b.computeNodesCpu = NewClusterResource().Copy(object.computeNodesCpu) + } else { + b.computeNodesCpu = nil + } + if object.computeNodesMemory != nil { + b.computeNodesMemory = NewClusterResource().Copy(object.computeNodesMemory) + } else { + b.computeNodesMemory = nil + } + if object.computeNodesSockets != nil { + b.computeNodesSockets = NewClusterResource().Copy(object.computeNodesSockets) + } else { + b.computeNodesSockets = nil + } + b.consoleUrl = object.consoleUrl + if object.cpu != nil { + b.cpu = NewClusterResource().Copy(object.cpu) + } else { + b.cpu = nil + } + b.criticalAlertsFiring = object.criticalAlertsFiring + b.healthState = object.healthState + if object.memory != nil { + b.memory = NewClusterResource().Copy(object.memory) + } else { + b.memory = nil + } + if object.nodes != nil { + b.nodes = NewClusterMetricsNodes().Copy(object.nodes) + } else { + b.nodes = nil + } + b.openshiftVersion = object.openshiftVersion + b.operatingSystem = object.operatingSystem + b.operatorsConditionFailing = object.operatorsConditionFailing + b.region = object.region + if object.sockets != nil { + b.sockets = NewClusterResource().Copy(object.sockets) + } else { + b.sockets = nil + } + b.state = object.state + b.stateDescription = object.stateDescription + if object.storage != nil { + b.storage = NewClusterResource().Copy(object.storage) + } else { + b.storage = nil + } + b.subscriptionCpuTotal = object.subscriptionCpuTotal + b.subscriptionObligationExists = object.subscriptionObligationExists + b.subscriptionSocketTotal = object.subscriptionSocketTotal + if object.upgrade != nil { + b.upgrade = NewClusterUpgrade().Copy(object.upgrade) + } else { + b.upgrade = nil + } + return b +} + +// Build creates a 'subscription_metrics' object using the configuration stored in the builder. +func (b *SubscriptionMetricsBuilder) Build() (object *SubscriptionMetrics, err error) { + object = new(SubscriptionMetrics) + object.bitmap_ = b.bitmap_ + object.cloudProvider = b.cloudProvider + if b.computeNodesCpu != nil { + object.computeNodesCpu, err = b.computeNodesCpu.Build() + if err != nil { + return + } + } + if b.computeNodesMemory != nil { + object.computeNodesMemory, err = b.computeNodesMemory.Build() + if err != nil { + return + } + } + if b.computeNodesSockets != nil { + object.computeNodesSockets, err = b.computeNodesSockets.Build() + if err != nil { + return + } + } + object.consoleUrl = b.consoleUrl + if b.cpu != nil { + object.cpu, err = b.cpu.Build() + if err != nil { + return + } + } + object.criticalAlertsFiring = b.criticalAlertsFiring + object.healthState = b.healthState + if b.memory != nil { + object.memory, err = b.memory.Build() + if err != nil { + return + } + } + if b.nodes != nil { + object.nodes, err = b.nodes.Build() + if err != nil { + return + } + } + object.openshiftVersion = b.openshiftVersion + object.operatingSystem = b.operatingSystem + object.operatorsConditionFailing = b.operatorsConditionFailing + object.region = b.region + if b.sockets != nil { + object.sockets, err = b.sockets.Build() + if err != nil { + return + } + } + object.state = b.state + object.stateDescription = b.stateDescription + if b.storage != nil { + object.storage, err = b.storage.Build() + if err != nil { + return + } + } + object.subscriptionCpuTotal = b.subscriptionCpuTotal + object.subscriptionObligationExists = b.subscriptionObligationExists + object.subscriptionSocketTotal = b.subscriptionSocketTotal + if b.upgrade != nil { + object.upgrade, err = b.upgrade.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/accountsmgmt/v1/subscription_metrics_list_builder.go b/clientapi/accountsmgmt/v1/subscription_metrics_list_builder.go new file mode 100644 index 00000000..83fe5e88 --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_metrics_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SubscriptionMetricsListBuilder contains the data and logic needed to build +// 'subscription_metrics' objects. +type SubscriptionMetricsListBuilder struct { + items []*SubscriptionMetricsBuilder +} + +// NewSubscriptionMetricsList creates a new builder of 'subscription_metrics' objects. +func NewSubscriptionMetricsList() *SubscriptionMetricsListBuilder { + return new(SubscriptionMetricsListBuilder) +} + +// Items sets the items of the list. +func (b *SubscriptionMetricsListBuilder) Items(values ...*SubscriptionMetricsBuilder) *SubscriptionMetricsListBuilder { + b.items = make([]*SubscriptionMetricsBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SubscriptionMetricsListBuilder) 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 *SubscriptionMetricsListBuilder) Copy(list *SubscriptionMetricsList) *SubscriptionMetricsListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SubscriptionMetricsBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSubscriptionMetrics().Copy(v) + } + } + return b +} + +// Build creates a list of 'subscription_metrics' objects using the +// configuration stored in the builder. +func (b *SubscriptionMetricsListBuilder) Build() (list *SubscriptionMetricsList, err error) { + items := make([]*SubscriptionMetrics, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SubscriptionMetricsList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/subscription_metrics_list_type_json.go b/clientapi/accountsmgmt/v1/subscription_metrics_list_type_json.go new file mode 100644 index 00000000..9ec2dd06 --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_metrics_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSubscriptionMetricsList writes a list of values of the 'subscription_metrics' type to +// the given writer. +func MarshalSubscriptionMetricsList(list []*SubscriptionMetrics, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSubscriptionMetricsList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSubscriptionMetricsList writes a list of value of the 'subscription_metrics' type to +// the given stream. +func WriteSubscriptionMetricsList(list []*SubscriptionMetrics, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSubscriptionMetrics(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSubscriptionMetricsList reads a list of values of the 'subscription_metrics' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSubscriptionMetricsList(source interface{}) (items []*SubscriptionMetrics, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSubscriptionMetricsList(iterator) + err = iterator.Error + return +} + +// ReadSubscriptionMetricsList reads list of values of the ”subscription_metrics' type from +// the given iterator. +func ReadSubscriptionMetricsList(iterator *jsoniter.Iterator) []*SubscriptionMetrics { + list := []*SubscriptionMetrics{} + for iterator.ReadArray() { + item := ReadSubscriptionMetrics(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/subscription_metrics_type.go b/clientapi/accountsmgmt/v1/subscription_metrics_type.go new file mode 100644 index 00000000..3f8c27f9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_metrics_type.go @@ -0,0 +1,581 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SubscriptionMetrics represents the values of the 'subscription_metrics' type. +// +// Each field is a metric fetched for a specific Subscription's cluster. +type SubscriptionMetrics struct { + bitmap_ uint32 + cloudProvider string + computeNodesCpu *ClusterResource + computeNodesMemory *ClusterResource + computeNodesSockets *ClusterResource + consoleUrl string + cpu *ClusterResource + criticalAlertsFiring float64 + healthState string + memory *ClusterResource + nodes *ClusterMetricsNodes + openshiftVersion string + operatingSystem string + operatorsConditionFailing float64 + region string + sockets *ClusterResource + state string + stateDescription string + storage *ClusterResource + subscriptionCpuTotal float64 + subscriptionObligationExists float64 + subscriptionSocketTotal float64 + upgrade *ClusterUpgrade +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SubscriptionMetrics) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) CloudProvider() string { + if o != nil && o.bitmap_&1 != 0 { + return o.cloudProvider + } + return "" +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetCloudProvider() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// ComputeNodesCpu returns the value of the 'compute_nodes_cpu' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) ComputeNodesCpu() *ClusterResource { + if o != nil && o.bitmap_&2 != 0 { + return o.computeNodesCpu + } + return nil +} + +// GetComputeNodesCpu returns the value of the 'compute_nodes_cpu' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetComputeNodesCpu() (value *ClusterResource, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.computeNodesCpu + } + return +} + +// ComputeNodesMemory returns the value of the 'compute_nodes_memory' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) ComputeNodesMemory() *ClusterResource { + if o != nil && o.bitmap_&4 != 0 { + return o.computeNodesMemory + } + return nil +} + +// GetComputeNodesMemory returns the value of the 'compute_nodes_memory' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetComputeNodesMemory() (value *ClusterResource, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.computeNodesMemory + } + return +} + +// ComputeNodesSockets returns the value of the 'compute_nodes_sockets' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) ComputeNodesSockets() *ClusterResource { + if o != nil && o.bitmap_&8 != 0 { + return o.computeNodesSockets + } + return nil +} + +// GetComputeNodesSockets returns the value of the 'compute_nodes_sockets' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetComputeNodesSockets() (value *ClusterResource, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.computeNodesSockets + } + return +} + +// ConsoleUrl returns the value of the 'console_url' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) ConsoleUrl() string { + if o != nil && o.bitmap_&16 != 0 { + return o.consoleUrl + } + return "" +} + +// GetConsoleUrl returns the value of the 'console_url' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetConsoleUrl() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.consoleUrl + } + return +} + +// Cpu returns the value of the 'cpu' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) Cpu() *ClusterResource { + if o != nil && o.bitmap_&32 != 0 { + return o.cpu + } + return nil +} + +// GetCpu returns the value of the 'cpu' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetCpu() (value *ClusterResource, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.cpu + } + return +} + +// CriticalAlertsFiring returns the value of the 'critical_alerts_firing' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) CriticalAlertsFiring() float64 { + if o != nil && o.bitmap_&64 != 0 { + return o.criticalAlertsFiring + } + return 0.0 +} + +// GetCriticalAlertsFiring returns the value of the 'critical_alerts_firing' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetCriticalAlertsFiring() (value float64, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.criticalAlertsFiring + } + return +} + +// HealthState returns the value of the 'health_state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) HealthState() string { + if o != nil && o.bitmap_&128 != 0 { + return o.healthState + } + return "" +} + +// GetHealthState returns the value of the 'health_state' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetHealthState() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.healthState + } + return +} + +// Memory returns the value of the 'memory' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) Memory() *ClusterResource { + if o != nil && o.bitmap_&256 != 0 { + return o.memory + } + return nil +} + +// GetMemory returns the value of the 'memory' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetMemory() (value *ClusterResource, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.memory + } + return +} + +// Nodes returns the value of the 'nodes' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) Nodes() *ClusterMetricsNodes { + if o != nil && o.bitmap_&512 != 0 { + return o.nodes + } + return nil +} + +// GetNodes returns the value of the 'nodes' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetNodes() (value *ClusterMetricsNodes, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.nodes + } + return +} + +// OpenshiftVersion returns the value of the 'openshift_version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) OpenshiftVersion() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.openshiftVersion + } + return "" +} + +// GetOpenshiftVersion returns the value of the 'openshift_version' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetOpenshiftVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.openshiftVersion + } + return +} + +// OperatingSystem returns the value of the 'operating_system' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) OperatingSystem() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.operatingSystem + } + return "" +} + +// GetOperatingSystem returns the value of the 'operating_system' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetOperatingSystem() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.operatingSystem + } + return +} + +// OperatorsConditionFailing returns the value of the 'operators_condition_failing' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) OperatorsConditionFailing() float64 { + if o != nil && o.bitmap_&4096 != 0 { + return o.operatorsConditionFailing + } + return 0.0 +} + +// GetOperatorsConditionFailing returns the value of the 'operators_condition_failing' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetOperatorsConditionFailing() (value float64, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.operatorsConditionFailing + } + return +} + +// Region returns the value of the 'region' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) Region() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.region + } + return "" +} + +// GetRegion returns the value of the 'region' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetRegion() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.region + } + return +} + +// Sockets returns the value of the 'sockets' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) Sockets() *ClusterResource { + if o != nil && o.bitmap_&16384 != 0 { + return o.sockets + } + return nil +} + +// GetSockets returns the value of the 'sockets' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetSockets() (value *ClusterResource, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.sockets + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) State() string { + if o != nil && o.bitmap_&32768 != 0 { + return o.state + } + return "" +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetState() (value string, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.state + } + return +} + +// StateDescription returns the value of the 'state_description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) StateDescription() string { + if o != nil && o.bitmap_&65536 != 0 { + return o.stateDescription + } + return "" +} + +// GetStateDescription returns the value of the 'state_description' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetStateDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.stateDescription + } + return +} + +// Storage returns the value of the 'storage' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) Storage() *ClusterResource { + if o != nil && o.bitmap_&131072 != 0 { + return o.storage + } + return nil +} + +// GetStorage returns the value of the 'storage' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetStorage() (value *ClusterResource, ok bool) { + ok = o != nil && o.bitmap_&131072 != 0 + if ok { + value = o.storage + } + return +} + +// SubscriptionCpuTotal returns the value of the 'subscription_cpu_total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) SubscriptionCpuTotal() float64 { + if o != nil && o.bitmap_&262144 != 0 { + return o.subscriptionCpuTotal + } + return 0.0 +} + +// GetSubscriptionCpuTotal returns the value of the 'subscription_cpu_total' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetSubscriptionCpuTotal() (value float64, ok bool) { + ok = o != nil && o.bitmap_&262144 != 0 + if ok { + value = o.subscriptionCpuTotal + } + return +} + +// SubscriptionObligationExists returns the value of the 'subscription_obligation_exists' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) SubscriptionObligationExists() float64 { + if o != nil && o.bitmap_&524288 != 0 { + return o.subscriptionObligationExists + } + return 0.0 +} + +// GetSubscriptionObligationExists returns the value of the 'subscription_obligation_exists' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetSubscriptionObligationExists() (value float64, ok bool) { + ok = o != nil && o.bitmap_&524288 != 0 + if ok { + value = o.subscriptionObligationExists + } + return +} + +// SubscriptionSocketTotal returns the value of the 'subscription_socket_total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) SubscriptionSocketTotal() float64 { + if o != nil && o.bitmap_&1048576 != 0 { + return o.subscriptionSocketTotal + } + return 0.0 +} + +// GetSubscriptionSocketTotal returns the value of the 'subscription_socket_total' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetSubscriptionSocketTotal() (value float64, ok bool) { + ok = o != nil && o.bitmap_&1048576 != 0 + if ok { + value = o.subscriptionSocketTotal + } + return +} + +// Upgrade returns the value of the 'upgrade' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SubscriptionMetrics) Upgrade() *ClusterUpgrade { + if o != nil && o.bitmap_&2097152 != 0 { + return o.upgrade + } + return nil +} + +// GetUpgrade returns the value of the 'upgrade' attribute and +// a flag indicating if the attribute has a value. +func (o *SubscriptionMetrics) GetUpgrade() (value *ClusterUpgrade, ok bool) { + ok = o != nil && o.bitmap_&2097152 != 0 + if ok { + value = o.upgrade + } + return +} + +// SubscriptionMetricsListKind is the name of the type used to represent list of objects of +// type 'subscription_metrics'. +const SubscriptionMetricsListKind = "SubscriptionMetricsList" + +// SubscriptionMetricsListLinkKind is the name of the type used to represent links to list +// of objects of type 'subscription_metrics'. +const SubscriptionMetricsListLinkKind = "SubscriptionMetricsListLink" + +// SubscriptionMetricsNilKind is the name of the type used to nil lists of objects of +// type 'subscription_metrics'. +const SubscriptionMetricsListNilKind = "SubscriptionMetricsListNil" + +// SubscriptionMetricsList is a list of values of the 'subscription_metrics' type. +type SubscriptionMetricsList struct { + href string + link bool + items []*SubscriptionMetrics +} + +// Len returns the length of the list. +func (l *SubscriptionMetricsList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SubscriptionMetricsList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SubscriptionMetricsList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SubscriptionMetricsList) SetItems(items []*SubscriptionMetrics) { + l.items = items +} + +// Items returns the items of the list. +func (l *SubscriptionMetricsList) Items() []*SubscriptionMetrics { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SubscriptionMetricsList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SubscriptionMetricsList) Get(i int) *SubscriptionMetrics { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SubscriptionMetricsList) Slice() []*SubscriptionMetrics { + var slice []*SubscriptionMetrics + if l == nil { + slice = make([]*SubscriptionMetrics, 0) + } else { + slice = make([]*SubscriptionMetrics, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SubscriptionMetricsList) Each(f func(item *SubscriptionMetrics) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SubscriptionMetricsList) Range(f func(index int, item *SubscriptionMetrics) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/subscription_metrics_type_json.go b/clientapi/accountsmgmt/v1/subscription_metrics_type_json.go new file mode 100644 index 00000000..9a5a330c --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_metrics_type_json.go @@ -0,0 +1,359 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSubscriptionMetrics writes a value of the 'subscription_metrics' type to the given writer. +func MarshalSubscriptionMetrics(object *SubscriptionMetrics, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSubscriptionMetrics(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSubscriptionMetrics writes a value of the 'subscription_metrics' type to the given stream. +func WriteSubscriptionMetrics(object *SubscriptionMetrics, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + stream.WriteString(object.cloudProvider) + count++ + } + present_ = object.bitmap_&2 != 0 && object.computeNodesCpu != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute_nodes_cpu") + WriteClusterResource(object.computeNodesCpu, stream) + count++ + } + present_ = object.bitmap_&4 != 0 && object.computeNodesMemory != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute_nodes_memory") + WriteClusterResource(object.computeNodesMemory, stream) + count++ + } + present_ = object.bitmap_&8 != 0 && object.computeNodesSockets != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute_nodes_sockets") + WriteClusterResource(object.computeNodesSockets, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("console_url") + stream.WriteString(object.consoleUrl) + count++ + } + present_ = object.bitmap_&32 != 0 && object.cpu != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cpu") + WriteClusterResource(object.cpu, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("critical_alerts_firing") + stream.WriteFloat64(object.criticalAlertsFiring) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("health_state") + stream.WriteString(object.healthState) + count++ + } + present_ = object.bitmap_&256 != 0 && object.memory != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("memory") + WriteClusterResource(object.memory, stream) + count++ + } + present_ = object.bitmap_&512 != 0 && object.nodes != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("nodes") + WriteClusterMetricsNodes(object.nodes, stream) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("openshift_version") + stream.WriteString(object.openshiftVersion) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operating_system") + stream.WriteString(object.operatingSystem) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operators_condition_failing") + stream.WriteFloat64(object.operatorsConditionFailing) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region") + stream.WriteString(object.region) + count++ + } + present_ = object.bitmap_&16384 != 0 && object.sockets != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sockets") + WriteClusterResource(object.sockets, stream) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(object.state) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state_description") + stream.WriteString(object.stateDescription) + count++ + } + present_ = object.bitmap_&131072 != 0 && object.storage != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("storage") + WriteClusterResource(object.storage, stream) + count++ + } + present_ = object.bitmap_&262144 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_cpu_total") + stream.WriteFloat64(object.subscriptionCpuTotal) + count++ + } + present_ = object.bitmap_&524288 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_obligation_exists") + stream.WriteFloat64(object.subscriptionObligationExists) + count++ + } + present_ = object.bitmap_&1048576 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_socket_total") + stream.WriteFloat64(object.subscriptionSocketTotal) + count++ + } + present_ = object.bitmap_&2097152 != 0 && object.upgrade != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("upgrade") + WriteClusterUpgrade(object.upgrade, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalSubscriptionMetrics reads a value of the 'subscription_metrics' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSubscriptionMetrics(source interface{}) (object *SubscriptionMetrics, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSubscriptionMetrics(iterator) + err = iterator.Error + return +} + +// ReadSubscriptionMetrics reads a value of the 'subscription_metrics' type from the given iterator. +func ReadSubscriptionMetrics(iterator *jsoniter.Iterator) *SubscriptionMetrics { + object := &SubscriptionMetrics{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "cloud_provider": + value := iterator.ReadString() + object.cloudProvider = value + object.bitmap_ |= 1 + case "compute_nodes_cpu": + value := ReadClusterResource(iterator) + object.computeNodesCpu = value + object.bitmap_ |= 2 + case "compute_nodes_memory": + value := ReadClusterResource(iterator) + object.computeNodesMemory = value + object.bitmap_ |= 4 + case "compute_nodes_sockets": + value := ReadClusterResource(iterator) + object.computeNodesSockets = value + object.bitmap_ |= 8 + case "console_url": + value := iterator.ReadString() + object.consoleUrl = value + object.bitmap_ |= 16 + case "cpu": + value := ReadClusterResource(iterator) + object.cpu = value + object.bitmap_ |= 32 + case "critical_alerts_firing": + value := iterator.ReadFloat64() + object.criticalAlertsFiring = value + object.bitmap_ |= 64 + case "health_state": + value := iterator.ReadString() + object.healthState = value + object.bitmap_ |= 128 + case "memory": + value := ReadClusterResource(iterator) + object.memory = value + object.bitmap_ |= 256 + case "nodes": + value := ReadClusterMetricsNodes(iterator) + object.nodes = value + object.bitmap_ |= 512 + case "openshift_version": + value := iterator.ReadString() + object.openshiftVersion = value + object.bitmap_ |= 1024 + case "operating_system": + value := iterator.ReadString() + object.operatingSystem = value + object.bitmap_ |= 2048 + case "operators_condition_failing": + value := iterator.ReadFloat64() + object.operatorsConditionFailing = value + object.bitmap_ |= 4096 + case "region": + value := iterator.ReadString() + object.region = value + object.bitmap_ |= 8192 + case "sockets": + value := ReadClusterResource(iterator) + object.sockets = value + object.bitmap_ |= 16384 + case "state": + value := iterator.ReadString() + object.state = value + object.bitmap_ |= 32768 + case "state_description": + value := iterator.ReadString() + object.stateDescription = value + object.bitmap_ |= 65536 + case "storage": + value := ReadClusterResource(iterator) + object.storage = value + object.bitmap_ |= 131072 + case "subscription_cpu_total": + value := iterator.ReadFloat64() + object.subscriptionCpuTotal = value + object.bitmap_ |= 262144 + case "subscription_obligation_exists": + value := iterator.ReadFloat64() + object.subscriptionObligationExists = value + object.bitmap_ |= 524288 + case "subscription_socket_total": + value := iterator.ReadFloat64() + object.subscriptionSocketTotal = value + object.bitmap_ |= 1048576 + case "upgrade": + value := ReadClusterUpgrade(iterator) + object.upgrade = value + object.bitmap_ |= 2097152 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/subscription_registration_builder.go b/clientapi/accountsmgmt/v1/subscription_registration_builder.go new file mode 100644 index 00000000..1765f210 --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_registration_builder.go @@ -0,0 +1,105 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SubscriptionRegistrationBuilder contains the data and logic needed to build 'subscription_registration' objects. +// +// Registration of a new subscription. +type SubscriptionRegistrationBuilder struct { + bitmap_ uint32 + clusterUUID string + consoleURL string + displayName string + planID PlanID + status string +} + +// NewSubscriptionRegistration creates a new builder of 'subscription_registration' objects. +func NewSubscriptionRegistration() *SubscriptionRegistrationBuilder { + return &SubscriptionRegistrationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SubscriptionRegistrationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ClusterUUID sets the value of the 'cluster_UUID' attribute to the given value. +func (b *SubscriptionRegistrationBuilder) ClusterUUID(value string) *SubscriptionRegistrationBuilder { + b.clusterUUID = value + b.bitmap_ |= 1 + return b +} + +// ConsoleURL sets the value of the 'console_URL' attribute to the given value. +func (b *SubscriptionRegistrationBuilder) ConsoleURL(value string) *SubscriptionRegistrationBuilder { + b.consoleURL = value + b.bitmap_ |= 2 + return b +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *SubscriptionRegistrationBuilder) DisplayName(value string) *SubscriptionRegistrationBuilder { + b.displayName = value + b.bitmap_ |= 4 + return b +} + +// PlanID sets the value of the 'plan_ID' attribute to the given value. +// +// Plan ID of subscription. +func (b *SubscriptionRegistrationBuilder) PlanID(value PlanID) *SubscriptionRegistrationBuilder { + b.planID = value + b.bitmap_ |= 8 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *SubscriptionRegistrationBuilder) Status(value string) *SubscriptionRegistrationBuilder { + b.status = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SubscriptionRegistrationBuilder) Copy(object *SubscriptionRegistration) *SubscriptionRegistrationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.clusterUUID = object.clusterUUID + b.consoleURL = object.consoleURL + b.displayName = object.displayName + b.planID = object.planID + b.status = object.status + return b +} + +// Build creates a 'subscription_registration' object using the configuration stored in the builder. +func (b *SubscriptionRegistrationBuilder) Build() (object *SubscriptionRegistration, err error) { + object = new(SubscriptionRegistration) + object.bitmap_ = b.bitmap_ + object.clusterUUID = b.clusterUUID + object.consoleURL = b.consoleURL + object.displayName = b.displayName + object.planID = b.planID + object.status = b.status + return +} diff --git a/clientapi/accountsmgmt/v1/subscription_registration_list_builder.go b/clientapi/accountsmgmt/v1/subscription_registration_list_builder.go new file mode 100644 index 00000000..5d917162 --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_registration_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SubscriptionRegistrationListBuilder contains the data and logic needed to build +// 'subscription_registration' objects. +type SubscriptionRegistrationListBuilder struct { + items []*SubscriptionRegistrationBuilder +} + +// NewSubscriptionRegistrationList creates a new builder of 'subscription_registration' objects. +func NewSubscriptionRegistrationList() *SubscriptionRegistrationListBuilder { + return new(SubscriptionRegistrationListBuilder) +} + +// Items sets the items of the list. +func (b *SubscriptionRegistrationListBuilder) Items(values ...*SubscriptionRegistrationBuilder) *SubscriptionRegistrationListBuilder { + b.items = make([]*SubscriptionRegistrationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SubscriptionRegistrationListBuilder) 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 *SubscriptionRegistrationListBuilder) Copy(list *SubscriptionRegistrationList) *SubscriptionRegistrationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SubscriptionRegistrationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSubscriptionRegistration().Copy(v) + } + } + return b +} + +// Build creates a list of 'subscription_registration' objects using the +// configuration stored in the builder. +func (b *SubscriptionRegistrationListBuilder) Build() (list *SubscriptionRegistrationList, err error) { + items := make([]*SubscriptionRegistration, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SubscriptionRegistrationList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/subscription_registration_list_type_json.go b/clientapi/accountsmgmt/v1/subscription_registration_list_type_json.go new file mode 100644 index 00000000..4a75a65e --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_registration_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSubscriptionRegistrationList writes a list of values of the 'subscription_registration' type to +// the given writer. +func MarshalSubscriptionRegistrationList(list []*SubscriptionRegistration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSubscriptionRegistrationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSubscriptionRegistrationList writes a list of value of the 'subscription_registration' type to +// the given stream. +func WriteSubscriptionRegistrationList(list []*SubscriptionRegistration, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSubscriptionRegistration(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSubscriptionRegistrationList reads a list of values of the 'subscription_registration' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSubscriptionRegistrationList(source interface{}) (items []*SubscriptionRegistration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSubscriptionRegistrationList(iterator) + err = iterator.Error + return +} + +// ReadSubscriptionRegistrationList reads list of values of the ”subscription_registration' type from +// the given iterator. +func ReadSubscriptionRegistrationList(iterator *jsoniter.Iterator) []*SubscriptionRegistration { + list := []*SubscriptionRegistration{} + for iterator.ReadArray() { + item := ReadSubscriptionRegistration(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/subscription_registration_type.go b/clientapi/accountsmgmt/v1/subscription_registration_type.go new file mode 100644 index 00000000..431e03a2 --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_registration_type.go @@ -0,0 +1,261 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SubscriptionRegistration represents the values of the 'subscription_registration' type. +// +// Registration of a new subscription. +type SubscriptionRegistration struct { + bitmap_ uint32 + clusterUUID string + consoleURL string + displayName string + planID PlanID + status string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SubscriptionRegistration) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ClusterUUID returns the value of the 'cluster_UUID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// External cluster ID. +func (o *SubscriptionRegistration) ClusterUUID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.clusterUUID + } + return "" +} + +// GetClusterUUID returns the value of the 'cluster_UUID' attribute and +// a flag indicating if the attribute has a value. +// +// External cluster ID. +func (o *SubscriptionRegistration) GetClusterUUID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.clusterUUID + } + return +} + +// ConsoleURL returns the value of the 'console_URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Console URL of subscription (optional). +func (o *SubscriptionRegistration) ConsoleURL() string { + if o != nil && o.bitmap_&2 != 0 { + return o.consoleURL + } + return "" +} + +// GetConsoleURL returns the value of the 'console_URL' attribute and +// a flag indicating if the attribute has a value. +// +// Console URL of subscription (optional). +func (o *SubscriptionRegistration) GetConsoleURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.consoleURL + } + return +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Display name of subscription (optional). +func (o *SubscriptionRegistration) DisplayName() string { + if o != nil && o.bitmap_&4 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +// +// Display name of subscription (optional). +func (o *SubscriptionRegistration) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.displayName + } + return +} + +// PlanID returns the value of the 'plan_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Plan ID of subscription. +func (o *SubscriptionRegistration) PlanID() PlanID { + if o != nil && o.bitmap_&8 != 0 { + return o.planID + } + return PlanID("") +} + +// GetPlanID returns the value of the 'plan_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Plan ID of subscription. +func (o *SubscriptionRegistration) GetPlanID() (value PlanID, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.planID + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Status of subscription. +func (o *SubscriptionRegistration) Status() string { + if o != nil && o.bitmap_&16 != 0 { + return o.status + } + return "" +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// Status of subscription. +func (o *SubscriptionRegistration) GetStatus() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.status + } + return +} + +// SubscriptionRegistrationListKind is the name of the type used to represent list of objects of +// type 'subscription_registration'. +const SubscriptionRegistrationListKind = "SubscriptionRegistrationList" + +// SubscriptionRegistrationListLinkKind is the name of the type used to represent links to list +// of objects of type 'subscription_registration'. +const SubscriptionRegistrationListLinkKind = "SubscriptionRegistrationListLink" + +// SubscriptionRegistrationNilKind is the name of the type used to nil lists of objects of +// type 'subscription_registration'. +const SubscriptionRegistrationListNilKind = "SubscriptionRegistrationListNil" + +// SubscriptionRegistrationList is a list of values of the 'subscription_registration' type. +type SubscriptionRegistrationList struct { + href string + link bool + items []*SubscriptionRegistration +} + +// Len returns the length of the list. +func (l *SubscriptionRegistrationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SubscriptionRegistrationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SubscriptionRegistrationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SubscriptionRegistrationList) SetItems(items []*SubscriptionRegistration) { + l.items = items +} + +// Items returns the items of the list. +func (l *SubscriptionRegistrationList) Items() []*SubscriptionRegistration { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SubscriptionRegistrationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SubscriptionRegistrationList) Get(i int) *SubscriptionRegistration { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SubscriptionRegistrationList) Slice() []*SubscriptionRegistration { + var slice []*SubscriptionRegistration + if l == nil { + slice = make([]*SubscriptionRegistration, 0) + } else { + slice = make([]*SubscriptionRegistration, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SubscriptionRegistrationList) Each(f func(item *SubscriptionRegistration) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SubscriptionRegistrationList) Range(f func(index int, item *SubscriptionRegistration) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/subscription_registration_type_json.go b/clientapi/accountsmgmt/v1/subscription_registration_type_json.go new file mode 100644 index 00000000..88c80cce --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_registration_type_json.go @@ -0,0 +1,139 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSubscriptionRegistration writes a value of the 'subscription_registration' type to the given writer. +func MarshalSubscriptionRegistration(object *SubscriptionRegistration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSubscriptionRegistration(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSubscriptionRegistration writes a value of the 'subscription_registration' type to the given stream. +func WriteSubscriptionRegistration(object *SubscriptionRegistration, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_uuid") + stream.WriteString(object.clusterUUID) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("console_url") + stream.WriteString(object.consoleURL) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("plan_id") + stream.WriteString(string(object.planID)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteString(object.status) + } + stream.WriteObjectEnd() +} + +// UnmarshalSubscriptionRegistration reads a value of the 'subscription_registration' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSubscriptionRegistration(source interface{}) (object *SubscriptionRegistration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSubscriptionRegistration(iterator) + err = iterator.Error + return +} + +// ReadSubscriptionRegistration reads a value of the 'subscription_registration' type from the given iterator. +func ReadSubscriptionRegistration(iterator *jsoniter.Iterator) *SubscriptionRegistration { + object := &SubscriptionRegistration{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "cluster_uuid": + value := iterator.ReadString() + object.clusterUUID = value + object.bitmap_ |= 1 + case "console_url": + value := iterator.ReadString() + object.consoleURL = value + object.bitmap_ |= 2 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 4 + case "plan_id": + text := iterator.ReadString() + value := PlanID(text) + object.planID = value + object.bitmap_ |= 8 + case "status": + value := iterator.ReadString() + object.status = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/subscription_type.go b/clientapi/accountsmgmt/v1/subscription_type.go new file mode 100644 index 00000000..cfb08970 --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_type.go @@ -0,0 +1,955 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + time "time" +) + +// SubscriptionKind is the name of the type used to represent objects +// of type 'subscription'. +const SubscriptionKind = "Subscription" + +// SubscriptionLinkKind is the name of the type used to represent links +// to objects of type 'subscription'. +const SubscriptionLinkKind = "SubscriptionLink" + +// SubscriptionNilKind is the name of the type used to nil references +// to objects of type 'subscription'. +const SubscriptionNilKind = "SubscriptionNil" + +// Subscription represents the values of the 'subscription' type. +type Subscription struct { + bitmap_ uint64 + id string + href string + billingMarketplaceAccount string + capabilities []*Capability + cloudAccountID string + cloudProviderID string + clusterID string + clusterBillingModel BillingModel + consoleURL string + consumerUUID string + cpuTotal int + createdAt time.Time + creator *Account + displayName string + externalClusterID string + labels []*Label + lastReconcileDate time.Time + lastReleasedAt time.Time + lastTelemetryDate time.Time + metrics []*SubscriptionMetrics + notificationContacts []*Account + organizationID string + plan *Plan + productBundle string + provenance string + regionID string + serviceLevel string + socketTotal int + status string + supportLevel string + systemUnits string + trialEndDate time.Time + updatedAt time.Time + usage string + managed bool + released bool +} + +// Kind returns the name of the type of the object. +func (o *Subscription) Kind() string { + if o == nil { + return SubscriptionNilKind + } + if o.bitmap_&1 != 0 { + return SubscriptionLinkKind + } + return SubscriptionKind +} + +// Link returns true if this is a link. +func (o *Subscription) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Subscription) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Subscription) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Subscription) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Subscription) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Subscription) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// BillingMarketplaceAccount returns the value of the 'billing_marketplace_account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) BillingMarketplaceAccount() string { + if o != nil && o.bitmap_&8 != 0 { + return o.billingMarketplaceAccount + } + return "" +} + +// GetBillingMarketplaceAccount returns the value of the 'billing_marketplace_account' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetBillingMarketplaceAccount() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.billingMarketplaceAccount + } + return +} + +// Capabilities returns the value of the 'capabilities' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) Capabilities() []*Capability { + if o != nil && o.bitmap_&16 != 0 { + return o.capabilities + } + return nil +} + +// GetCapabilities returns the value of the 'capabilities' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetCapabilities() (value []*Capability, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.capabilities + } + return +} + +// CloudAccountID returns the value of the 'cloud_account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) CloudAccountID() string { + if o != nil && o.bitmap_&32 != 0 { + return o.cloudAccountID + } + return "" +} + +// GetCloudAccountID returns the value of the 'cloud_account_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetCloudAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.cloudAccountID + } + return +} + +// CloudProviderID returns the value of the 'cloud_provider_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) CloudProviderID() string { + if o != nil && o.bitmap_&64 != 0 { + return o.cloudProviderID + } + return "" +} + +// GetCloudProviderID returns the value of the 'cloud_provider_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetCloudProviderID() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.cloudProviderID + } + return +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) ClusterID() string { + if o != nil && o.bitmap_&128 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.clusterID + } + return +} + +// ClusterBillingModel returns the value of the 'cluster_billing_model' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) ClusterBillingModel() BillingModel { + if o != nil && o.bitmap_&256 != 0 { + return o.clusterBillingModel + } + return BillingModel("") +} + +// GetClusterBillingModel returns the value of the 'cluster_billing_model' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetClusterBillingModel() (value BillingModel, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.clusterBillingModel + } + return +} + +// ConsoleURL returns the value of the 'console_URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) ConsoleURL() string { + if o != nil && o.bitmap_&512 != 0 { + return o.consoleURL + } + return "" +} + +// GetConsoleURL returns the value of the 'console_URL' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetConsoleURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.consoleURL + } + return +} + +// ConsumerUUID returns the value of the 'consumer_UUID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) ConsumerUUID() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.consumerUUID + } + return "" +} + +// GetConsumerUUID returns the value of the 'consumer_UUID' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetConsumerUUID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.consumerUUID + } + return +} + +// CpuTotal returns the value of the 'cpu_total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) CpuTotal() int { + if o != nil && o.bitmap_&2048 != 0 { + return o.cpuTotal + } + return 0 +} + +// GetCpuTotal returns the value of the 'cpu_total' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetCpuTotal() (value int, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.cpuTotal + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) CreatedAt() time.Time { + if o != nil && o.bitmap_&4096 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.createdAt + } + return +} + +// Creator returns the value of the 'creator' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the account that created the subscription. +func (o *Subscription) Creator() *Account { + if o != nil && o.bitmap_&8192 != 0 { + return o.creator + } + return nil +} + +// GetCreator returns the value of the 'creator' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the account that created the subscription. +func (o *Subscription) GetCreator() (value *Account, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.creator + } + return +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) DisplayName() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.displayName + } + return +} + +// ExternalClusterID returns the value of the 'external_cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) ExternalClusterID() string { + if o != nil && o.bitmap_&32768 != 0 { + return o.externalClusterID + } + return "" +} + +// GetExternalClusterID returns the value of the 'external_cluster_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetExternalClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.externalClusterID + } + return +} + +// Labels returns the value of the 'labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) Labels() []*Label { + if o != nil && o.bitmap_&65536 != 0 { + return o.labels + } + return nil +} + +// GetLabels returns the value of the 'labels' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetLabels() (value []*Label, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.labels + } + return +} + +// LastReconcileDate returns the value of the 'last_reconcile_date' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Last time this subscription were reconciled about cluster usage. +func (o *Subscription) LastReconcileDate() time.Time { + if o != nil && o.bitmap_&131072 != 0 { + return o.lastReconcileDate + } + return time.Time{} +} + +// GetLastReconcileDate returns the value of the 'last_reconcile_date' attribute and +// a flag indicating if the attribute has a value. +// +// Last time this subscription were reconciled about cluster usage. +func (o *Subscription) GetLastReconcileDate() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&131072 != 0 + if ok { + value = o.lastReconcileDate + } + return +} + +// LastReleasedAt returns the value of the 'last_released_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Last time status was set to Released for this cluster/subscription. +func (o *Subscription) LastReleasedAt() time.Time { + if o != nil && o.bitmap_&262144 != 0 { + return o.lastReleasedAt + } + return time.Time{} +} + +// GetLastReleasedAt returns the value of the 'last_released_at' attribute and +// a flag indicating if the attribute has a value. +// +// Last time status was set to Released for this cluster/subscription. +func (o *Subscription) GetLastReleasedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&262144 != 0 + if ok { + value = o.lastReleasedAt + } + return +} + +// LastTelemetryDate returns the value of the 'last_telemetry_date' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Last telemetry authorization request for this cluster/subscription in Unix time +func (o *Subscription) LastTelemetryDate() time.Time { + if o != nil && o.bitmap_&524288 != 0 { + return o.lastTelemetryDate + } + return time.Time{} +} + +// GetLastTelemetryDate returns the value of the 'last_telemetry_date' attribute and +// a flag indicating if the attribute has a value. +// +// Last telemetry authorization request for this cluster/subscription in Unix time +func (o *Subscription) GetLastTelemetryDate() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&524288 != 0 + if ok { + value = o.lastTelemetryDate + } + return +} + +// Managed returns the value of the 'managed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) Managed() bool { + if o != nil && o.bitmap_&1048576 != 0 { + return o.managed + } + return false +} + +// GetManaged returns the value of the 'managed' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetManaged() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1048576 != 0 + if ok { + value = o.managed + } + return +} + +// Metrics returns the value of the 'metrics' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Metrics array. One or zero elements will present. +func (o *Subscription) Metrics() []*SubscriptionMetrics { + if o != nil && o.bitmap_&2097152 != 0 { + return o.metrics + } + return nil +} + +// GetMetrics returns the value of the 'metrics' attribute and +// a flag indicating if the attribute has a value. +// +// Metrics array. One or zero elements will present. +func (o *Subscription) GetMetrics() (value []*SubscriptionMetrics, ok bool) { + ok = o != nil && o.bitmap_&2097152 != 0 + if ok { + value = o.metrics + } + return +} + +// NotificationContacts returns the value of the 'notification_contacts' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) NotificationContacts() []*Account { + if o != nil && o.bitmap_&4194304 != 0 { + return o.notificationContacts + } + return nil +} + +// GetNotificationContacts returns the value of the 'notification_contacts' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetNotificationContacts() (value []*Account, ok bool) { + ok = o != nil && o.bitmap_&4194304 != 0 + if ok { + value = o.notificationContacts + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) OrganizationID() string { + if o != nil && o.bitmap_&8388608 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8388608 != 0 + if ok { + value = o.organizationID + } + return +} + +// Plan returns the value of the 'plan' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) Plan() *Plan { + if o != nil && o.bitmap_&16777216 != 0 { + return o.plan + } + return nil +} + +// GetPlan returns the value of the 'plan' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetPlan() (value *Plan, ok bool) { + ok = o != nil && o.bitmap_&16777216 != 0 + if ok { + value = o.plan + } + return +} + +// ProductBundle returns the value of the 'product_bundle' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) ProductBundle() string { + if o != nil && o.bitmap_&33554432 != 0 { + return o.productBundle + } + return "" +} + +// GetProductBundle returns the value of the 'product_bundle' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetProductBundle() (value string, ok bool) { + ok = o != nil && o.bitmap_&33554432 != 0 + if ok { + value = o.productBundle + } + return +} + +// Provenance returns the value of the 'provenance' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The origin of cluster registration (values are defined in AMS at pkg/api/subscription_types.go). +func (o *Subscription) Provenance() string { + if o != nil && o.bitmap_&67108864 != 0 { + return o.provenance + } + return "" +} + +// GetProvenance returns the value of the 'provenance' attribute and +// a flag indicating if the attribute has a value. +// +// The origin of cluster registration (values are defined in AMS at pkg/api/subscription_types.go). +func (o *Subscription) GetProvenance() (value string, ok bool) { + ok = o != nil && o.bitmap_&67108864 != 0 + if ok { + value = o.provenance + } + return +} + +// RegionID returns the value of the 'region_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) RegionID() string { + if o != nil && o.bitmap_&134217728 != 0 { + return o.regionID + } + return "" +} + +// GetRegionID returns the value of the 'region_ID' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetRegionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&134217728 != 0 + if ok { + value = o.regionID + } + return +} + +// Released returns the value of the 'released' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Flag used to denote whether or not the owner of the cluster has released the ownership and ready to be transferred to a different user. +func (o *Subscription) Released() bool { + if o != nil && o.bitmap_&268435456 != 0 { + return o.released + } + return false +} + +// GetReleased returns the value of the 'released' attribute and +// a flag indicating if the attribute has a value. +// +// Flag used to denote whether or not the owner of the cluster has released the ownership and ready to be transferred to a different user. +func (o *Subscription) GetReleased() (value bool, ok bool) { + ok = o != nil && o.bitmap_&268435456 != 0 + if ok { + value = o.released + } + return +} + +// ServiceLevel returns the value of the 'service_level' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) ServiceLevel() string { + if o != nil && o.bitmap_&536870912 != 0 { + return o.serviceLevel + } + return "" +} + +// GetServiceLevel returns the value of the 'service_level' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetServiceLevel() (value string, ok bool) { + ok = o != nil && o.bitmap_&536870912 != 0 + if ok { + value = o.serviceLevel + } + return +} + +// SocketTotal returns the value of the 'socket_total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) SocketTotal() int { + if o != nil && o.bitmap_&1073741824 != 0 { + return o.socketTotal + } + return 0 +} + +// GetSocketTotal returns the value of the 'socket_total' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetSocketTotal() (value int, ok bool) { + ok = o != nil && o.bitmap_&1073741824 != 0 + if ok { + value = o.socketTotal + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) Status() string { + if o != nil && o.bitmap_&2147483648 != 0 { + return o.status + } + return "" +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetStatus() (value string, ok bool) { + ok = o != nil && o.bitmap_&2147483648 != 0 + if ok { + value = o.status + } + return +} + +// SupportLevel returns the value of the 'support_level' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) SupportLevel() string { + if o != nil && o.bitmap_&4294967296 != 0 { + return o.supportLevel + } + return "" +} + +// GetSupportLevel returns the value of the 'support_level' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetSupportLevel() (value string, ok bool) { + ok = o != nil && o.bitmap_&4294967296 != 0 + if ok { + value = o.supportLevel + } + return +} + +// SystemUnits returns the value of the 'system_units' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) SystemUnits() string { + if o != nil && o.bitmap_&8589934592 != 0 { + return o.systemUnits + } + return "" +} + +// GetSystemUnits returns the value of the 'system_units' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetSystemUnits() (value string, ok bool) { + ok = o != nil && o.bitmap_&8589934592 != 0 + if ok { + value = o.systemUnits + } + return +} + +// TrialEndDate returns the value of the 'trial_end_date' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// If the subscription is a trial, date the trial ends. +func (o *Subscription) TrialEndDate() time.Time { + if o != nil && o.bitmap_&17179869184 != 0 { + return o.trialEndDate + } + return time.Time{} +} + +// GetTrialEndDate returns the value of the 'trial_end_date' attribute and +// a flag indicating if the attribute has a value. +// +// If the subscription is a trial, date the trial ends. +func (o *Subscription) GetTrialEndDate() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&17179869184 != 0 + if ok { + value = o.trialEndDate + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) UpdatedAt() time.Time { + if o != nil && o.bitmap_&34359738368 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&34359738368 != 0 + if ok { + value = o.updatedAt + } + return +} + +// Usage returns the value of the 'usage' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Subscription) Usage() string { + if o != nil && o.bitmap_&68719476736 != 0 { + return o.usage + } + return "" +} + +// GetUsage returns the value of the 'usage' attribute and +// a flag indicating if the attribute has a value. +func (o *Subscription) GetUsage() (value string, ok bool) { + ok = o != nil && o.bitmap_&68719476736 != 0 + if ok { + value = o.usage + } + return +} + +// SubscriptionListKind is the name of the type used to represent list of objects of +// type 'subscription'. +const SubscriptionListKind = "SubscriptionList" + +// SubscriptionListLinkKind is the name of the type used to represent links to list +// of objects of type 'subscription'. +const SubscriptionListLinkKind = "SubscriptionListLink" + +// SubscriptionNilKind is the name of the type used to nil lists of objects of +// type 'subscription'. +const SubscriptionListNilKind = "SubscriptionListNil" + +// SubscriptionList is a list of values of the 'subscription' type. +type SubscriptionList struct { + href string + link bool + items []*Subscription +} + +// Kind returns the name of the type of the object. +func (l *SubscriptionList) Kind() string { + if l == nil { + return SubscriptionListNilKind + } + if l.link { + return SubscriptionListLinkKind + } + return SubscriptionListKind +} + +// Link returns true iif this is a link. +func (l *SubscriptionList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *SubscriptionList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *SubscriptionList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *SubscriptionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SubscriptionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SubscriptionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SubscriptionList) SetItems(items []*Subscription) { + l.items = items +} + +// Items returns the items of the list. +func (l *SubscriptionList) Items() []*Subscription { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SubscriptionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SubscriptionList) Get(i int) *Subscription { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SubscriptionList) Slice() []*Subscription { + var slice []*Subscription + if l == nil { + slice = make([]*Subscription, 0) + } else { + slice = make([]*Subscription, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SubscriptionList) Each(f func(item *Subscription) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SubscriptionList) Range(f func(index int, item *Subscription) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/subscription_type_json.go b/clientapi/accountsmgmt/v1/subscription_type_json.go new file mode 100644 index 00000000..e9ab6f71 --- /dev/null +++ b/clientapi/accountsmgmt/v1/subscription_type_json.go @@ -0,0 +1,575 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSubscription writes a value of the 'subscription' type to the given writer. +func MarshalSubscription(object *Subscription, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSubscription(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSubscription writes a value of the 'subscription' type to the given stream. +func WriteSubscription(object *Subscription, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(SubscriptionLinkKind) + } else { + stream.WriteString(SubscriptionKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_marketplace_account") + stream.WriteString(object.billingMarketplaceAccount) + count++ + } + present_ = object.bitmap_&16 != 0 && object.capabilities != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("capabilities") + WriteCapabilityList(object.capabilities, stream) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_account_id") + stream.WriteString(object.cloudAccountID) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider_id") + stream.WriteString(object.cloudProviderID) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_billing_model") + stream.WriteString(string(object.clusterBillingModel)) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("console_url") + stream.WriteString(object.consoleURL) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("consumer_uuid") + stream.WriteString(object.consumerUUID) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cpu_total") + stream.WriteInt(object.cpuTotal) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&8192 != 0 && object.creator != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creator") + WriteAccount(object.creator, stream) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_cluster_id") + stream.WriteString(object.externalClusterID) + count++ + } + present_ = object.bitmap_&65536 != 0 && object.labels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("labels") + WriteLabelList(object.labels, stream) + count++ + } + present_ = object.bitmap_&131072 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_reconcile_date") + stream.WriteString((object.lastReconcileDate).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&262144 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_released_at") + stream.WriteString((object.lastReleasedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&524288 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_telemetry_date") + stream.WriteString((object.lastTelemetryDate).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&1048576 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed") + stream.WriteBool(object.managed) + count++ + } + present_ = object.bitmap_&2097152 != 0 && object.metrics != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("metrics") + WriteSubscriptionMetricsList(object.metrics, stream) + count++ + } + present_ = object.bitmap_&4194304 != 0 && object.notificationContacts != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("notification_contacts") + WriteAccountList(object.notificationContacts, stream) + count++ + } + present_ = object.bitmap_&8388608 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&16777216 != 0 && object.plan != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("plan") + WritePlan(object.plan, stream) + count++ + } + present_ = object.bitmap_&33554432 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product_bundle") + stream.WriteString(object.productBundle) + count++ + } + present_ = object.bitmap_&67108864 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("provenance") + stream.WriteString(object.provenance) + count++ + } + present_ = object.bitmap_&134217728 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region_id") + stream.WriteString(object.regionID) + count++ + } + present_ = object.bitmap_&268435456 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("released") + stream.WriteBool(object.released) + count++ + } + present_ = object.bitmap_&536870912 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_level") + stream.WriteString(object.serviceLevel) + count++ + } + present_ = object.bitmap_&1073741824 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("socket_total") + stream.WriteInt(object.socketTotal) + count++ + } + present_ = object.bitmap_&2147483648 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteString(object.status) + count++ + } + present_ = object.bitmap_&4294967296 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("support_level") + stream.WriteString(object.supportLevel) + count++ + } + present_ = object.bitmap_&8589934592 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("system_units") + stream.WriteString(object.systemUnits) + count++ + } + present_ = object.bitmap_&17179869184 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("trial_end_date") + stream.WriteString((object.trialEndDate).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&34359738368 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&68719476736 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("usage") + stream.WriteString(object.usage) + } + stream.WriteObjectEnd() +} + +// UnmarshalSubscription reads a value of the 'subscription' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSubscription(source interface{}) (object *Subscription, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSubscription(iterator) + err = iterator.Error + return +} + +// ReadSubscription reads a value of the 'subscription' type from the given iterator. +func ReadSubscription(iterator *jsoniter.Iterator) *Subscription { + object := &Subscription{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == SubscriptionLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "billing_marketplace_account": + value := iterator.ReadString() + object.billingMarketplaceAccount = value + object.bitmap_ |= 8 + case "capabilities": + value := ReadCapabilityList(iterator) + object.capabilities = value + object.bitmap_ |= 16 + case "cloud_account_id": + value := iterator.ReadString() + object.cloudAccountID = value + object.bitmap_ |= 32 + case "cloud_provider_id": + value := iterator.ReadString() + object.cloudProviderID = value + object.bitmap_ |= 64 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 128 + case "cluster_billing_model": + text := iterator.ReadString() + value := BillingModel(text) + object.clusterBillingModel = value + object.bitmap_ |= 256 + case "console_url": + value := iterator.ReadString() + object.consoleURL = value + object.bitmap_ |= 512 + case "consumer_uuid": + value := iterator.ReadString() + object.consumerUUID = value + object.bitmap_ |= 1024 + case "cpu_total": + value := iterator.ReadInt() + object.cpuTotal = value + object.bitmap_ |= 2048 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 4096 + case "creator": + value := ReadAccount(iterator) + object.creator = value + object.bitmap_ |= 8192 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 16384 + case "external_cluster_id": + value := iterator.ReadString() + object.externalClusterID = value + object.bitmap_ |= 32768 + case "labels": + value := ReadLabelList(iterator) + object.labels = value + object.bitmap_ |= 65536 + case "last_reconcile_date": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastReconcileDate = value + object.bitmap_ |= 131072 + case "last_released_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastReleasedAt = value + object.bitmap_ |= 262144 + case "last_telemetry_date": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastTelemetryDate = value + object.bitmap_ |= 524288 + case "managed": + value := iterator.ReadBool() + object.managed = value + object.bitmap_ |= 1048576 + case "metrics": + value := ReadSubscriptionMetricsList(iterator) + object.metrics = value + object.bitmap_ |= 2097152 + case "notification_contacts": + value := ReadAccountList(iterator) + object.notificationContacts = value + object.bitmap_ |= 4194304 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 8388608 + case "plan": + value := ReadPlan(iterator) + object.plan = value + object.bitmap_ |= 16777216 + case "product_bundle": + value := iterator.ReadString() + object.productBundle = value + object.bitmap_ |= 33554432 + case "provenance": + value := iterator.ReadString() + object.provenance = value + object.bitmap_ |= 67108864 + case "region_id": + value := iterator.ReadString() + object.regionID = value + object.bitmap_ |= 134217728 + case "released": + value := iterator.ReadBool() + object.released = value + object.bitmap_ |= 268435456 + case "service_level": + value := iterator.ReadString() + object.serviceLevel = value + object.bitmap_ |= 536870912 + case "socket_total": + value := iterator.ReadInt() + object.socketTotal = value + object.bitmap_ |= 1073741824 + case "status": + value := iterator.ReadString() + object.status = value + object.bitmap_ |= 2147483648 + case "support_level": + value := iterator.ReadString() + object.supportLevel = value + object.bitmap_ |= 4294967296 + case "system_units": + value := iterator.ReadString() + object.systemUnits = value + object.bitmap_ |= 8589934592 + case "trial_end_date": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.trialEndDate = value + object.bitmap_ |= 17179869184 + 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_ |= 34359738368 + case "usage": + value := iterator.ReadString() + object.usage = value + object.bitmap_ |= 68719476736 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/summary_dashboard_builder.go b/clientapi/accountsmgmt/v1/summary_dashboard_builder.go new file mode 100644 index 00000000..e552e8d5 --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_dashboard_builder.go @@ -0,0 +1,103 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SummaryDashboardBuilder contains the data and logic needed to build 'summary_dashboard' objects. +type SummaryDashboardBuilder struct { + bitmap_ uint32 + id string + href string + metrics []*SummaryMetricsBuilder +} + +// NewSummaryDashboard creates a new builder of 'summary_dashboard' objects. +func NewSummaryDashboard() *SummaryDashboardBuilder { + return &SummaryDashboardBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *SummaryDashboardBuilder) Link(value bool) *SummaryDashboardBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *SummaryDashboardBuilder) ID(value string) *SummaryDashboardBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *SummaryDashboardBuilder) HREF(value string) *SummaryDashboardBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SummaryDashboardBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Metrics sets the value of the 'metrics' attribute to the given values. +func (b *SummaryDashboardBuilder) Metrics(values ...*SummaryMetricsBuilder) *SummaryDashboardBuilder { + b.metrics = make([]*SummaryMetricsBuilder, len(values)) + copy(b.metrics, values) + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SummaryDashboardBuilder) Copy(object *SummaryDashboard) *SummaryDashboardBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.metrics != nil { + b.metrics = make([]*SummaryMetricsBuilder, len(object.metrics)) + for i, v := range object.metrics { + b.metrics[i] = NewSummaryMetrics().Copy(v) + } + } else { + b.metrics = nil + } + return b +} + +// Build creates a 'summary_dashboard' object using the configuration stored in the builder. +func (b *SummaryDashboardBuilder) Build() (object *SummaryDashboard, err error) { + object = new(SummaryDashboard) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.metrics != nil { + object.metrics = make([]*SummaryMetrics, len(b.metrics)) + for i, v := range b.metrics { + object.metrics[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/accountsmgmt/v1/summary_dashboard_list_builder.go b/clientapi/accountsmgmt/v1/summary_dashboard_list_builder.go new file mode 100644 index 00000000..a62a0744 --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_dashboard_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SummaryDashboardListBuilder contains the data and logic needed to build +// 'summary_dashboard' objects. +type SummaryDashboardListBuilder struct { + items []*SummaryDashboardBuilder +} + +// NewSummaryDashboardList creates a new builder of 'summary_dashboard' objects. +func NewSummaryDashboardList() *SummaryDashboardListBuilder { + return new(SummaryDashboardListBuilder) +} + +// Items sets the items of the list. +func (b *SummaryDashboardListBuilder) Items(values ...*SummaryDashboardBuilder) *SummaryDashboardListBuilder { + b.items = make([]*SummaryDashboardBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SummaryDashboardListBuilder) 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 *SummaryDashboardListBuilder) Copy(list *SummaryDashboardList) *SummaryDashboardListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SummaryDashboardBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSummaryDashboard().Copy(v) + } + } + return b +} + +// Build creates a list of 'summary_dashboard' objects using the +// configuration stored in the builder. +func (b *SummaryDashboardListBuilder) Build() (list *SummaryDashboardList, err error) { + items := make([]*SummaryDashboard, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SummaryDashboardList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/summary_dashboard_list_type_json.go b/clientapi/accountsmgmt/v1/summary_dashboard_list_type_json.go new file mode 100644 index 00000000..e578f1b7 --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_dashboard_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSummaryDashboardList writes a list of values of the 'summary_dashboard' type to +// the given writer. +func MarshalSummaryDashboardList(list []*SummaryDashboard, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSummaryDashboardList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSummaryDashboardList writes a list of value of the 'summary_dashboard' type to +// the given stream. +func WriteSummaryDashboardList(list []*SummaryDashboard, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSummaryDashboard(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSummaryDashboardList reads a list of values of the 'summary_dashboard' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSummaryDashboardList(source interface{}) (items []*SummaryDashboard, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSummaryDashboardList(iterator) + err = iterator.Error + return +} + +// ReadSummaryDashboardList reads list of values of the ”summary_dashboard' type from +// the given iterator. +func ReadSummaryDashboardList(iterator *jsoniter.Iterator) []*SummaryDashboard { + list := []*SummaryDashboard{} + for iterator.ReadArray() { + item := ReadSummaryDashboard(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/summary_dashboard_type.go b/clientapi/accountsmgmt/v1/summary_dashboard_type.go new file mode 100644 index 00000000..dea9c4fd --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_dashboard_type.go @@ -0,0 +1,259 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SummaryDashboardKind is the name of the type used to represent objects +// of type 'summary_dashboard'. +const SummaryDashboardKind = "SummaryDashboard" + +// SummaryDashboardLinkKind is the name of the type used to represent links +// to objects of type 'summary_dashboard'. +const SummaryDashboardLinkKind = "SummaryDashboardLink" + +// SummaryDashboardNilKind is the name of the type used to nil references +// to objects of type 'summary_dashboard'. +const SummaryDashboardNilKind = "SummaryDashboardNil" + +// SummaryDashboard represents the values of the 'summary_dashboard' type. +type SummaryDashboard struct { + bitmap_ uint32 + id string + href string + metrics []*SummaryMetrics +} + +// Kind returns the name of the type of the object. +func (o *SummaryDashboard) Kind() string { + if o == nil { + return SummaryDashboardNilKind + } + if o.bitmap_&1 != 0 { + return SummaryDashboardLinkKind + } + return SummaryDashboardKind +} + +// Link returns true if this is a link. +func (o *SummaryDashboard) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *SummaryDashboard) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *SummaryDashboard) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *SummaryDashboard) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *SummaryDashboard) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SummaryDashboard) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Metrics returns the value of the 'metrics' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SummaryDashboard) Metrics() []*SummaryMetrics { + if o != nil && o.bitmap_&8 != 0 { + return o.metrics + } + return nil +} + +// GetMetrics returns the value of the 'metrics' attribute and +// a flag indicating if the attribute has a value. +func (o *SummaryDashboard) GetMetrics() (value []*SummaryMetrics, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.metrics + } + return +} + +// SummaryDashboardListKind is the name of the type used to represent list of objects of +// type 'summary_dashboard'. +const SummaryDashboardListKind = "SummaryDashboardList" + +// SummaryDashboardListLinkKind is the name of the type used to represent links to list +// of objects of type 'summary_dashboard'. +const SummaryDashboardListLinkKind = "SummaryDashboardListLink" + +// SummaryDashboardNilKind is the name of the type used to nil lists of objects of +// type 'summary_dashboard'. +const SummaryDashboardListNilKind = "SummaryDashboardListNil" + +// SummaryDashboardList is a list of values of the 'summary_dashboard' type. +type SummaryDashboardList struct { + href string + link bool + items []*SummaryDashboard +} + +// Kind returns the name of the type of the object. +func (l *SummaryDashboardList) Kind() string { + if l == nil { + return SummaryDashboardListNilKind + } + if l.link { + return SummaryDashboardListLinkKind + } + return SummaryDashboardListKind +} + +// Link returns true iif this is a link. +func (l *SummaryDashboardList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *SummaryDashboardList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *SummaryDashboardList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *SummaryDashboardList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SummaryDashboardList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SummaryDashboardList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SummaryDashboardList) SetItems(items []*SummaryDashboard) { + l.items = items +} + +// Items returns the items of the list. +func (l *SummaryDashboardList) Items() []*SummaryDashboard { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SummaryDashboardList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SummaryDashboardList) Get(i int) *SummaryDashboard { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SummaryDashboardList) Slice() []*SummaryDashboard { + var slice []*SummaryDashboard + if l == nil { + slice = make([]*SummaryDashboard, 0) + } else { + slice = make([]*SummaryDashboard, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SummaryDashboardList) Each(f func(item *SummaryDashboard) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SummaryDashboardList) Range(f func(index int, item *SummaryDashboard) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/summary_dashboard_type_json.go b/clientapi/accountsmgmt/v1/summary_dashboard_type_json.go new file mode 100644 index 00000000..305df481 --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_dashboard_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSummaryDashboard writes a value of the 'summary_dashboard' type to the given writer. +func MarshalSummaryDashboard(object *SummaryDashboard, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSummaryDashboard(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSummaryDashboard writes a value of the 'summary_dashboard' type to the given stream. +func WriteSummaryDashboard(object *SummaryDashboard, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(SummaryDashboardLinkKind) + } else { + stream.WriteString(SummaryDashboardKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.metrics != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("metrics") + WriteSummaryMetricsList(object.metrics, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalSummaryDashboard reads a value of the 'summary_dashboard' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSummaryDashboard(source interface{}) (object *SummaryDashboard, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSummaryDashboard(iterator) + err = iterator.Error + return +} + +// ReadSummaryDashboard reads a value of the 'summary_dashboard' type from the given iterator. +func ReadSummaryDashboard(iterator *jsoniter.Iterator) *SummaryDashboard { + object := &SummaryDashboard{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == SummaryDashboardLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "metrics": + value := ReadSummaryMetricsList(iterator) + object.metrics = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/summary_metrics_builder.go b/clientapi/accountsmgmt/v1/summary_metrics_builder.go new file mode 100644 index 00000000..7e40b8f9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_metrics_builder.go @@ -0,0 +1,87 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SummaryMetricsBuilder contains the data and logic needed to build 'summary_metrics' objects. +type SummaryMetricsBuilder struct { + bitmap_ uint32 + name string + vector []*SummarySampleBuilder +} + +// NewSummaryMetrics creates a new builder of 'summary_metrics' objects. +func NewSummaryMetrics() *SummaryMetricsBuilder { + return &SummaryMetricsBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SummaryMetricsBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *SummaryMetricsBuilder) Name(value string) *SummaryMetricsBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Vector sets the value of the 'vector' attribute to the given values. +func (b *SummaryMetricsBuilder) Vector(values ...*SummarySampleBuilder) *SummaryMetricsBuilder { + b.vector = make([]*SummarySampleBuilder, len(values)) + copy(b.vector, values) + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SummaryMetricsBuilder) Copy(object *SummaryMetrics) *SummaryMetricsBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + if object.vector != nil { + b.vector = make([]*SummarySampleBuilder, len(object.vector)) + for i, v := range object.vector { + b.vector[i] = NewSummarySample().Copy(v) + } + } else { + b.vector = nil + } + return b +} + +// Build creates a 'summary_metrics' object using the configuration stored in the builder. +func (b *SummaryMetricsBuilder) Build() (object *SummaryMetrics, err error) { + object = new(SummaryMetrics) + object.bitmap_ = b.bitmap_ + object.name = b.name + if b.vector != nil { + object.vector = make([]*SummarySample, len(b.vector)) + for i, v := range b.vector { + object.vector[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/accountsmgmt/v1/summary_metrics_list_builder.go b/clientapi/accountsmgmt/v1/summary_metrics_list_builder.go new file mode 100644 index 00000000..87866a53 --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_metrics_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SummaryMetricsListBuilder contains the data and logic needed to build +// 'summary_metrics' objects. +type SummaryMetricsListBuilder struct { + items []*SummaryMetricsBuilder +} + +// NewSummaryMetricsList creates a new builder of 'summary_metrics' objects. +func NewSummaryMetricsList() *SummaryMetricsListBuilder { + return new(SummaryMetricsListBuilder) +} + +// Items sets the items of the list. +func (b *SummaryMetricsListBuilder) Items(values ...*SummaryMetricsBuilder) *SummaryMetricsListBuilder { + b.items = make([]*SummaryMetricsBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SummaryMetricsListBuilder) 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 *SummaryMetricsListBuilder) Copy(list *SummaryMetricsList) *SummaryMetricsListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SummaryMetricsBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSummaryMetrics().Copy(v) + } + } + return b +} + +// Build creates a list of 'summary_metrics' objects using the +// configuration stored in the builder. +func (b *SummaryMetricsListBuilder) Build() (list *SummaryMetricsList, err error) { + items := make([]*SummaryMetrics, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SummaryMetricsList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/summary_metrics_list_type_json.go b/clientapi/accountsmgmt/v1/summary_metrics_list_type_json.go new file mode 100644 index 00000000..406bd9a7 --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_metrics_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSummaryMetricsList writes a list of values of the 'summary_metrics' type to +// the given writer. +func MarshalSummaryMetricsList(list []*SummaryMetrics, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSummaryMetricsList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSummaryMetricsList writes a list of value of the 'summary_metrics' type to +// the given stream. +func WriteSummaryMetricsList(list []*SummaryMetrics, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSummaryMetrics(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSummaryMetricsList reads a list of values of the 'summary_metrics' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSummaryMetricsList(source interface{}) (items []*SummaryMetrics, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSummaryMetricsList(iterator) + err = iterator.Error + return +} + +// ReadSummaryMetricsList reads list of values of the ”summary_metrics' type from +// the given iterator. +func ReadSummaryMetricsList(iterator *jsoniter.Iterator) []*SummaryMetrics { + list := []*SummaryMetrics{} + for iterator.ReadArray() { + item := ReadSummaryMetrics(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/summary_metrics_type.go b/clientapi/accountsmgmt/v1/summary_metrics_type.go new file mode 100644 index 00000000..3e2c17ff --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_metrics_type.go @@ -0,0 +1,179 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SummaryMetrics represents the values of the 'summary_metrics' type. +type SummaryMetrics struct { + bitmap_ uint32 + name string + vector []*SummarySample +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SummaryMetrics) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SummaryMetrics) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *SummaryMetrics) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Vector returns the value of the 'vector' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SummaryMetrics) Vector() []*SummarySample { + if o != nil && o.bitmap_&2 != 0 { + return o.vector + } + return nil +} + +// GetVector returns the value of the 'vector' attribute and +// a flag indicating if the attribute has a value. +func (o *SummaryMetrics) GetVector() (value []*SummarySample, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.vector + } + return +} + +// SummaryMetricsListKind is the name of the type used to represent list of objects of +// type 'summary_metrics'. +const SummaryMetricsListKind = "SummaryMetricsList" + +// SummaryMetricsListLinkKind is the name of the type used to represent links to list +// of objects of type 'summary_metrics'. +const SummaryMetricsListLinkKind = "SummaryMetricsListLink" + +// SummaryMetricsNilKind is the name of the type used to nil lists of objects of +// type 'summary_metrics'. +const SummaryMetricsListNilKind = "SummaryMetricsListNil" + +// SummaryMetricsList is a list of values of the 'summary_metrics' type. +type SummaryMetricsList struct { + href string + link bool + items []*SummaryMetrics +} + +// Len returns the length of the list. +func (l *SummaryMetricsList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SummaryMetricsList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SummaryMetricsList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SummaryMetricsList) SetItems(items []*SummaryMetrics) { + l.items = items +} + +// Items returns the items of the list. +func (l *SummaryMetricsList) Items() []*SummaryMetrics { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SummaryMetricsList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SummaryMetricsList) Get(i int) *SummaryMetrics { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SummaryMetricsList) Slice() []*SummaryMetrics { + var slice []*SummaryMetrics + if l == nil { + slice = make([]*SummaryMetrics, 0) + } else { + slice = make([]*SummaryMetrics, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SummaryMetricsList) Each(f func(item *SummaryMetrics) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SummaryMetricsList) Range(f func(index int, item *SummaryMetrics) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/summary_metrics_type_json.go b/clientapi/accountsmgmt/v1/summary_metrics_type_json.go new file mode 100644 index 00000000..558178fc --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_metrics_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSummaryMetrics writes a value of the 'summary_metrics' type to the given writer. +func MarshalSummaryMetrics(object *SummaryMetrics, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSummaryMetrics(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSummaryMetrics writes a value of the 'summary_metrics' type to the given stream. +func WriteSummaryMetrics(object *SummaryMetrics, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 && object.vector != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("vector") + WriteSummarySampleList(object.vector, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalSummaryMetrics reads a value of the 'summary_metrics' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSummaryMetrics(source interface{}) (object *SummaryMetrics, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSummaryMetrics(iterator) + err = iterator.Error + return +} + +// ReadSummaryMetrics reads a value of the 'summary_metrics' type from the given iterator. +func ReadSummaryMetrics(iterator *jsoniter.Iterator) *SummaryMetrics { + object := &SummaryMetrics{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "vector": + value := ReadSummarySampleList(iterator) + object.vector = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/summary_sample_builder.go b/clientapi/accountsmgmt/v1/summary_sample_builder.go new file mode 100644 index 00000000..5d32f165 --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_sample_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SummarySampleBuilder contains the data and logic needed to build 'summary_sample' objects. +type SummarySampleBuilder struct { + bitmap_ uint32 + time string + value float64 +} + +// NewSummarySample creates a new builder of 'summary_sample' objects. +func NewSummarySample() *SummarySampleBuilder { + return &SummarySampleBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SummarySampleBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Time sets the value of the 'time' attribute to the given value. +func (b *SummarySampleBuilder) Time(value string) *SummarySampleBuilder { + b.time = value + b.bitmap_ |= 1 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *SummarySampleBuilder) Value(value float64) *SummarySampleBuilder { + b.value = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SummarySampleBuilder) Copy(object *SummarySample) *SummarySampleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.time = object.time + b.value = object.value + return b +} + +// Build creates a 'summary_sample' object using the configuration stored in the builder. +func (b *SummarySampleBuilder) Build() (object *SummarySample, err error) { + object = new(SummarySample) + object.bitmap_ = b.bitmap_ + object.time = b.time + object.value = b.value + return +} diff --git a/clientapi/accountsmgmt/v1/summary_sample_list_builder.go b/clientapi/accountsmgmt/v1/summary_sample_list_builder.go new file mode 100644 index 00000000..c04a8004 --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_sample_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SummarySampleListBuilder contains the data and logic needed to build +// 'summary_sample' objects. +type SummarySampleListBuilder struct { + items []*SummarySampleBuilder +} + +// NewSummarySampleList creates a new builder of 'summary_sample' objects. +func NewSummarySampleList() *SummarySampleListBuilder { + return new(SummarySampleListBuilder) +} + +// Items sets the items of the list. +func (b *SummarySampleListBuilder) Items(values ...*SummarySampleBuilder) *SummarySampleListBuilder { + b.items = make([]*SummarySampleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SummarySampleListBuilder) 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 *SummarySampleListBuilder) Copy(list *SummarySampleList) *SummarySampleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SummarySampleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSummarySample().Copy(v) + } + } + return b +} + +// Build creates a list of 'summary_sample' objects using the +// configuration stored in the builder. +func (b *SummarySampleListBuilder) Build() (list *SummarySampleList, err error) { + items := make([]*SummarySample, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SummarySampleList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/summary_sample_list_type_json.go b/clientapi/accountsmgmt/v1/summary_sample_list_type_json.go new file mode 100644 index 00000000..f8808041 --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_sample_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSummarySampleList writes a list of values of the 'summary_sample' type to +// the given writer. +func MarshalSummarySampleList(list []*SummarySample, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSummarySampleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSummarySampleList writes a list of value of the 'summary_sample' type to +// the given stream. +func WriteSummarySampleList(list []*SummarySample, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSummarySample(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSummarySampleList reads a list of values of the 'summary_sample' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSummarySampleList(source interface{}) (items []*SummarySample, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSummarySampleList(iterator) + err = iterator.Error + return +} + +// ReadSummarySampleList reads list of values of the ”summary_sample' type from +// the given iterator. +func ReadSummarySampleList(iterator *jsoniter.Iterator) []*SummarySample { + list := []*SummarySample{} + for iterator.ReadArray() { + item := ReadSummarySample(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/summary_sample_type.go b/clientapi/accountsmgmt/v1/summary_sample_type.go new file mode 100644 index 00000000..20d7de6b --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_sample_type.go @@ -0,0 +1,179 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SummarySample represents the values of the 'summary_sample' type. +type SummarySample struct { + bitmap_ uint32 + time string + value float64 +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SummarySample) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Time returns the value of the 'time' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SummarySample) Time() string { + if o != nil && o.bitmap_&1 != 0 { + return o.time + } + return "" +} + +// GetTime returns the value of the 'time' attribute and +// a flag indicating if the attribute has a value. +func (o *SummarySample) GetTime() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.time + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SummarySample) Value() float64 { + if o != nil && o.bitmap_&2 != 0 { + return o.value + } + return 0.0 +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +func (o *SummarySample) GetValue() (value float64, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.value + } + return +} + +// SummarySampleListKind is the name of the type used to represent list of objects of +// type 'summary_sample'. +const SummarySampleListKind = "SummarySampleList" + +// SummarySampleListLinkKind is the name of the type used to represent links to list +// of objects of type 'summary_sample'. +const SummarySampleListLinkKind = "SummarySampleListLink" + +// SummarySampleNilKind is the name of the type used to nil lists of objects of +// type 'summary_sample'. +const SummarySampleListNilKind = "SummarySampleListNil" + +// SummarySampleList is a list of values of the 'summary_sample' type. +type SummarySampleList struct { + href string + link bool + items []*SummarySample +} + +// Len returns the length of the list. +func (l *SummarySampleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SummarySampleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SummarySampleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SummarySampleList) SetItems(items []*SummarySample) { + l.items = items +} + +// Items returns the items of the list. +func (l *SummarySampleList) Items() []*SummarySample { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SummarySampleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SummarySampleList) Get(i int) *SummarySample { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SummarySampleList) Slice() []*SummarySample { + var slice []*SummarySample + if l == nil { + slice = make([]*SummarySample, 0) + } else { + slice = make([]*SummarySample, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SummarySampleList) Each(f func(item *SummarySample) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SummarySampleList) Range(f func(index int, item *SummarySample) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/summary_sample_type_json.go b/clientapi/accountsmgmt/v1/summary_sample_type_json.go new file mode 100644 index 00000000..d0545834 --- /dev/null +++ b/clientapi/accountsmgmt/v1/summary_sample_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSummarySample writes a value of the 'summary_sample' type to the given writer. +func MarshalSummarySample(object *SummarySample, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSummarySample(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSummarySample writes a value of the 'summary_sample' type to the given stream. +func WriteSummarySample(object *SummarySample, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("time") + stream.WriteString(object.time) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteFloat64(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalSummarySample reads a value of the 'summary_sample' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSummarySample(source interface{}) (object *SummarySample, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSummarySample(iterator) + err = iterator.Error + return +} + +// ReadSummarySample reads a value of the 'summary_sample' type from the given iterator. +func ReadSummarySample(iterator *jsoniter.Iterator) *SummarySample { + object := &SummarySample{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "time": + value := iterator.ReadString() + object.time = value + object.bitmap_ |= 1 + case "value": + value := iterator.ReadFloat64() + object.value = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/support_case_request_builder.go b/clientapi/accountsmgmt/v1/support_case_request_builder.go new file mode 100644 index 00000000..b9a1ab11 --- /dev/null +++ b/clientapi/accountsmgmt/v1/support_case_request_builder.go @@ -0,0 +1,147 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SupportCaseRequestBuilder contains the data and logic needed to build 'support_case_request' objects. +type SupportCaseRequestBuilder struct { + bitmap_ uint32 + id string + href string + clusterId string + clusterUuid string + description string + eventStreamId string + severity string + subscriptionId string + summary string +} + +// NewSupportCaseRequest creates a new builder of 'support_case_request' objects. +func NewSupportCaseRequest() *SupportCaseRequestBuilder { + return &SupportCaseRequestBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *SupportCaseRequestBuilder) Link(value bool) *SupportCaseRequestBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *SupportCaseRequestBuilder) ID(value string) *SupportCaseRequestBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *SupportCaseRequestBuilder) HREF(value string) *SupportCaseRequestBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SupportCaseRequestBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// ClusterId sets the value of the 'cluster_id' attribute to the given value. +func (b *SupportCaseRequestBuilder) ClusterId(value string) *SupportCaseRequestBuilder { + b.clusterId = value + b.bitmap_ |= 8 + return b +} + +// ClusterUuid sets the value of the 'cluster_uuid' attribute to the given value. +func (b *SupportCaseRequestBuilder) ClusterUuid(value string) *SupportCaseRequestBuilder { + b.clusterUuid = value + b.bitmap_ |= 16 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *SupportCaseRequestBuilder) Description(value string) *SupportCaseRequestBuilder { + b.description = value + b.bitmap_ |= 32 + return b +} + +// EventStreamId sets the value of the 'event_stream_id' attribute to the given value. +func (b *SupportCaseRequestBuilder) EventStreamId(value string) *SupportCaseRequestBuilder { + b.eventStreamId = value + b.bitmap_ |= 64 + return b +} + +// Severity sets the value of the 'severity' attribute to the given value. +func (b *SupportCaseRequestBuilder) Severity(value string) *SupportCaseRequestBuilder { + b.severity = value + b.bitmap_ |= 128 + return b +} + +// SubscriptionId sets the value of the 'subscription_id' attribute to the given value. +func (b *SupportCaseRequestBuilder) SubscriptionId(value string) *SupportCaseRequestBuilder { + b.subscriptionId = value + b.bitmap_ |= 256 + return b +} + +// Summary sets the value of the 'summary' attribute to the given value. +func (b *SupportCaseRequestBuilder) Summary(value string) *SupportCaseRequestBuilder { + b.summary = value + b.bitmap_ |= 512 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SupportCaseRequestBuilder) Copy(object *SupportCaseRequest) *SupportCaseRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.clusterId = object.clusterId + b.clusterUuid = object.clusterUuid + b.description = object.description + b.eventStreamId = object.eventStreamId + b.severity = object.severity + b.subscriptionId = object.subscriptionId + b.summary = object.summary + return b +} + +// Build creates a 'support_case_request' object using the configuration stored in the builder. +func (b *SupportCaseRequestBuilder) Build() (object *SupportCaseRequest, err error) { + object = new(SupportCaseRequest) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.clusterId = b.clusterId + object.clusterUuid = b.clusterUuid + object.description = b.description + object.eventStreamId = b.eventStreamId + object.severity = b.severity + object.subscriptionId = b.subscriptionId + object.summary = b.summary + return +} diff --git a/clientapi/accountsmgmt/v1/support_case_request_list_builder.go b/clientapi/accountsmgmt/v1/support_case_request_list_builder.go new file mode 100644 index 00000000..47acf17d --- /dev/null +++ b/clientapi/accountsmgmt/v1/support_case_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SupportCaseRequestListBuilder contains the data and logic needed to build +// 'support_case_request' objects. +type SupportCaseRequestListBuilder struct { + items []*SupportCaseRequestBuilder +} + +// NewSupportCaseRequestList creates a new builder of 'support_case_request' objects. +func NewSupportCaseRequestList() *SupportCaseRequestListBuilder { + return new(SupportCaseRequestListBuilder) +} + +// Items sets the items of the list. +func (b *SupportCaseRequestListBuilder) Items(values ...*SupportCaseRequestBuilder) *SupportCaseRequestListBuilder { + b.items = make([]*SupportCaseRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SupportCaseRequestListBuilder) 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 *SupportCaseRequestListBuilder) Copy(list *SupportCaseRequestList) *SupportCaseRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SupportCaseRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSupportCaseRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'support_case_request' objects using the +// configuration stored in the builder. +func (b *SupportCaseRequestListBuilder) Build() (list *SupportCaseRequestList, err error) { + items := make([]*SupportCaseRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SupportCaseRequestList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/support_case_request_list_type_json.go b/clientapi/accountsmgmt/v1/support_case_request_list_type_json.go new file mode 100644 index 00000000..e2b4080c --- /dev/null +++ b/clientapi/accountsmgmt/v1/support_case_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSupportCaseRequestList writes a list of values of the 'support_case_request' type to +// the given writer. +func MarshalSupportCaseRequestList(list []*SupportCaseRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSupportCaseRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSupportCaseRequestList writes a list of value of the 'support_case_request' type to +// the given stream. +func WriteSupportCaseRequestList(list []*SupportCaseRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSupportCaseRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSupportCaseRequestList reads a list of values of the 'support_case_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSupportCaseRequestList(source interface{}) (items []*SupportCaseRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSupportCaseRequestList(iterator) + err = iterator.Error + return +} + +// ReadSupportCaseRequestList reads list of values of the ”support_case_request' type from +// the given iterator. +func ReadSupportCaseRequestList(iterator *jsoniter.Iterator) []*SupportCaseRequest { + list := []*SupportCaseRequest{} + for iterator.ReadArray() { + item := ReadSupportCaseRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/support_case_request_type.go b/clientapi/accountsmgmt/v1/support_case_request_type.go new file mode 100644 index 00000000..0a07c796 --- /dev/null +++ b/clientapi/accountsmgmt/v1/support_case_request_type.go @@ -0,0 +1,407 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SupportCaseRequestKind is the name of the type used to represent objects +// of type 'support_case_request'. +const SupportCaseRequestKind = "SupportCaseRequest" + +// SupportCaseRequestLinkKind is the name of the type used to represent links +// to objects of type 'support_case_request'. +const SupportCaseRequestLinkKind = "SupportCaseRequestLink" + +// SupportCaseRequestNilKind is the name of the type used to nil references +// to objects of type 'support_case_request'. +const SupportCaseRequestNilKind = "SupportCaseRequestNil" + +// SupportCaseRequest represents the values of the 'support_case_request' type. +type SupportCaseRequest struct { + bitmap_ uint32 + id string + href string + clusterId string + clusterUuid string + description string + eventStreamId string + severity string + subscriptionId string + summary string +} + +// Kind returns the name of the type of the object. +func (o *SupportCaseRequest) Kind() string { + if o == nil { + return SupportCaseRequestNilKind + } + if o.bitmap_&1 != 0 { + return SupportCaseRequestLinkKind + } + return SupportCaseRequestKind +} + +// Link returns true if this is a link. +func (o *SupportCaseRequest) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *SupportCaseRequest) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *SupportCaseRequest) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *SupportCaseRequest) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *SupportCaseRequest) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SupportCaseRequest) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// ClusterId returns the value of the 'cluster_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// (optional) cluster id of the cluster on which we create the support case for. +func (o *SupportCaseRequest) ClusterId() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clusterId + } + return "" +} + +// GetClusterId returns the value of the 'cluster_id' attribute and +// a flag indicating if the attribute has a value. +// +// (optional) cluster id of the cluster on which we create the support case for. +func (o *SupportCaseRequest) GetClusterId() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clusterId + } + return +} + +// ClusterUuid returns the value of the 'cluster_uuid' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// (optional) cluster uuid of the cluster on which we create the support case for. +func (o *SupportCaseRequest) ClusterUuid() string { + if o != nil && o.bitmap_&16 != 0 { + return o.clusterUuid + } + return "" +} + +// GetClusterUuid returns the value of the 'cluster_uuid' attribute and +// a flag indicating if the attribute has a value. +// +// (optional) cluster uuid of the cluster on which we create the support case for. +func (o *SupportCaseRequest) GetClusterUuid() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.clusterUuid + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Support case desciption. +func (o *SupportCaseRequest) Description() string { + if o != nil && o.bitmap_&32 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Support case desciption. +func (o *SupportCaseRequest) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.description + } + return +} + +// EventStreamId returns the value of the 'event_stream_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// (optional) event stream id for the support case so we could track it. +func (o *SupportCaseRequest) EventStreamId() string { + if o != nil && o.bitmap_&64 != 0 { + return o.eventStreamId + } + return "" +} + +// GetEventStreamId returns the value of the 'event_stream_id' attribute and +// a flag indicating if the attribute has a value. +// +// (optional) event stream id for the support case so we could track it. +func (o *SupportCaseRequest) GetEventStreamId() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.eventStreamId + } + return +} + +// Severity returns the value of the 'severity' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Support case severity. +func (o *SupportCaseRequest) Severity() string { + if o != nil && o.bitmap_&128 != 0 { + return o.severity + } + return "" +} + +// GetSeverity returns the value of the 'severity' attribute and +// a flag indicating if the attribute has a value. +// +// Support case severity. +func (o *SupportCaseRequest) GetSeverity() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.severity + } + return +} + +// SubscriptionId returns the value of the 'subscription_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// (optional) subscription id of the subscription on which we create the support case for. +func (o *SupportCaseRequest) SubscriptionId() string { + if o != nil && o.bitmap_&256 != 0 { + return o.subscriptionId + } + return "" +} + +// GetSubscriptionId returns the value of the 'subscription_id' attribute and +// a flag indicating if the attribute has a value. +// +// (optional) subscription id of the subscription on which we create the support case for. +func (o *SupportCaseRequest) GetSubscriptionId() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.subscriptionId + } + return +} + +// Summary returns the value of the 'summary' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Support case title. +func (o *SupportCaseRequest) Summary() string { + if o != nil && o.bitmap_&512 != 0 { + return o.summary + } + return "" +} + +// GetSummary returns the value of the 'summary' attribute and +// a flag indicating if the attribute has a value. +// +// Support case title. +func (o *SupportCaseRequest) GetSummary() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.summary + } + return +} + +// SupportCaseRequestListKind is the name of the type used to represent list of objects of +// type 'support_case_request'. +const SupportCaseRequestListKind = "SupportCaseRequestList" + +// SupportCaseRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'support_case_request'. +const SupportCaseRequestListLinkKind = "SupportCaseRequestListLink" + +// SupportCaseRequestNilKind is the name of the type used to nil lists of objects of +// type 'support_case_request'. +const SupportCaseRequestListNilKind = "SupportCaseRequestListNil" + +// SupportCaseRequestList is a list of values of the 'support_case_request' type. +type SupportCaseRequestList struct { + href string + link bool + items []*SupportCaseRequest +} + +// Kind returns the name of the type of the object. +func (l *SupportCaseRequestList) Kind() string { + if l == nil { + return SupportCaseRequestListNilKind + } + if l.link { + return SupportCaseRequestListLinkKind + } + return SupportCaseRequestListKind +} + +// Link returns true iif this is a link. +func (l *SupportCaseRequestList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *SupportCaseRequestList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *SupportCaseRequestList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *SupportCaseRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SupportCaseRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SupportCaseRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SupportCaseRequestList) SetItems(items []*SupportCaseRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *SupportCaseRequestList) Items() []*SupportCaseRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SupportCaseRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SupportCaseRequestList) Get(i int) *SupportCaseRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SupportCaseRequestList) Slice() []*SupportCaseRequest { + var slice []*SupportCaseRequest + if l == nil { + slice = make([]*SupportCaseRequest, 0) + } else { + slice = make([]*SupportCaseRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SupportCaseRequestList) Each(f func(item *SupportCaseRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SupportCaseRequestList) Range(f func(index int, item *SupportCaseRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/support_case_request_type_json.go b/clientapi/accountsmgmt/v1/support_case_request_type_json.go new file mode 100644 index 00000000..55a2826d --- /dev/null +++ b/clientapi/accountsmgmt/v1/support_case_request_type_json.go @@ -0,0 +1,198 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSupportCaseRequest writes a value of the 'support_case_request' type to the given writer. +func MarshalSupportCaseRequest(object *SupportCaseRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSupportCaseRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSupportCaseRequest writes a value of the 'support_case_request' type to the given stream. +func WriteSupportCaseRequest(object *SupportCaseRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(SupportCaseRequestLinkKind) + } else { + stream.WriteString(SupportCaseRequestKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterId) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_uuid") + stream.WriteString(object.clusterUuid) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("event_stream_id") + stream.WriteString(object.eventStreamId) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("severity") + stream.WriteString(object.severity) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionId) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("summary") + stream.WriteString(object.summary) + } + stream.WriteObjectEnd() +} + +// UnmarshalSupportCaseRequest reads a value of the 'support_case_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSupportCaseRequest(source interface{}) (object *SupportCaseRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSupportCaseRequest(iterator) + err = iterator.Error + return +} + +// ReadSupportCaseRequest reads a value of the 'support_case_request' type from the given iterator. +func ReadSupportCaseRequest(iterator *jsoniter.Iterator) *SupportCaseRequest { + object := &SupportCaseRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == SupportCaseRequestLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "cluster_id": + value := iterator.ReadString() + object.clusterId = value + object.bitmap_ |= 8 + case "cluster_uuid": + value := iterator.ReadString() + object.clusterUuid = value + object.bitmap_ |= 16 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 32 + case "event_stream_id": + value := iterator.ReadString() + object.eventStreamId = value + object.bitmap_ |= 64 + case "severity": + value := iterator.ReadString() + object.severity = value + object.bitmap_ |= 128 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionId = value + object.bitmap_ |= 256 + case "summary": + value := iterator.ReadString() + object.summary = value + object.bitmap_ |= 512 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/support_case_response_builder.go b/clientapi/accountsmgmt/v1/support_case_response_builder.go new file mode 100644 index 00000000..7aa4b11b --- /dev/null +++ b/clientapi/accountsmgmt/v1/support_case_response_builder.go @@ -0,0 +1,167 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SupportCaseResponseBuilder contains the data and logic needed to build 'support_case_response' objects. +type SupportCaseResponseBuilder struct { + bitmap_ uint32 + id string + href string + uri string + caseNumber string + clusterId string + clusterUuid string + description string + severity string + status string + subscriptionId string + summary string +} + +// NewSupportCaseResponse creates a new builder of 'support_case_response' objects. +func NewSupportCaseResponse() *SupportCaseResponseBuilder { + return &SupportCaseResponseBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *SupportCaseResponseBuilder) Link(value bool) *SupportCaseResponseBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *SupportCaseResponseBuilder) ID(value string) *SupportCaseResponseBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *SupportCaseResponseBuilder) HREF(value string) *SupportCaseResponseBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SupportCaseResponseBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// URI sets the value of the 'URI' attribute to the given value. +func (b *SupportCaseResponseBuilder) URI(value string) *SupportCaseResponseBuilder { + b.uri = value + b.bitmap_ |= 8 + return b +} + +// CaseNumber sets the value of the 'case_number' attribute to the given value. +func (b *SupportCaseResponseBuilder) CaseNumber(value string) *SupportCaseResponseBuilder { + b.caseNumber = value + b.bitmap_ |= 16 + return b +} + +// ClusterId sets the value of the 'cluster_id' attribute to the given value. +func (b *SupportCaseResponseBuilder) ClusterId(value string) *SupportCaseResponseBuilder { + b.clusterId = value + b.bitmap_ |= 32 + return b +} + +// ClusterUuid sets the value of the 'cluster_uuid' attribute to the given value. +func (b *SupportCaseResponseBuilder) ClusterUuid(value string) *SupportCaseResponseBuilder { + b.clusterUuid = value + b.bitmap_ |= 64 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *SupportCaseResponseBuilder) Description(value string) *SupportCaseResponseBuilder { + b.description = value + b.bitmap_ |= 128 + return b +} + +// Severity sets the value of the 'severity' attribute to the given value. +func (b *SupportCaseResponseBuilder) Severity(value string) *SupportCaseResponseBuilder { + b.severity = value + b.bitmap_ |= 256 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *SupportCaseResponseBuilder) Status(value string) *SupportCaseResponseBuilder { + b.status = value + b.bitmap_ |= 512 + return b +} + +// SubscriptionId sets the value of the 'subscription_id' attribute to the given value. +func (b *SupportCaseResponseBuilder) SubscriptionId(value string) *SupportCaseResponseBuilder { + b.subscriptionId = value + b.bitmap_ |= 1024 + return b +} + +// Summary sets the value of the 'summary' attribute to the given value. +func (b *SupportCaseResponseBuilder) Summary(value string) *SupportCaseResponseBuilder { + b.summary = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SupportCaseResponseBuilder) Copy(object *SupportCaseResponse) *SupportCaseResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.uri = object.uri + b.caseNumber = object.caseNumber + b.clusterId = object.clusterId + b.clusterUuid = object.clusterUuid + b.description = object.description + b.severity = object.severity + b.status = object.status + b.subscriptionId = object.subscriptionId + b.summary = object.summary + return b +} + +// Build creates a 'support_case_response' object using the configuration stored in the builder. +func (b *SupportCaseResponseBuilder) Build() (object *SupportCaseResponse, err error) { + object = new(SupportCaseResponse) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.uri = b.uri + object.caseNumber = b.caseNumber + object.clusterId = b.clusterId + object.clusterUuid = b.clusterUuid + object.description = b.description + object.severity = b.severity + object.status = b.status + object.subscriptionId = b.subscriptionId + object.summary = b.summary + return +} diff --git a/clientapi/accountsmgmt/v1/support_case_response_list_builder.go b/clientapi/accountsmgmt/v1/support_case_response_list_builder.go new file mode 100644 index 00000000..538e43d9 --- /dev/null +++ b/clientapi/accountsmgmt/v1/support_case_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SupportCaseResponseListBuilder contains the data and logic needed to build +// 'support_case_response' objects. +type SupportCaseResponseListBuilder struct { + items []*SupportCaseResponseBuilder +} + +// NewSupportCaseResponseList creates a new builder of 'support_case_response' objects. +func NewSupportCaseResponseList() *SupportCaseResponseListBuilder { + return new(SupportCaseResponseListBuilder) +} + +// Items sets the items of the list. +func (b *SupportCaseResponseListBuilder) Items(values ...*SupportCaseResponseBuilder) *SupportCaseResponseListBuilder { + b.items = make([]*SupportCaseResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SupportCaseResponseListBuilder) 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 *SupportCaseResponseListBuilder) Copy(list *SupportCaseResponseList) *SupportCaseResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SupportCaseResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSupportCaseResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'support_case_response' objects using the +// configuration stored in the builder. +func (b *SupportCaseResponseListBuilder) Build() (list *SupportCaseResponseList, err error) { + items := make([]*SupportCaseResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SupportCaseResponseList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/support_case_response_list_type_json.go b/clientapi/accountsmgmt/v1/support_case_response_list_type_json.go new file mode 100644 index 00000000..14489a8a --- /dev/null +++ b/clientapi/accountsmgmt/v1/support_case_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSupportCaseResponseList writes a list of values of the 'support_case_response' type to +// the given writer. +func MarshalSupportCaseResponseList(list []*SupportCaseResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSupportCaseResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSupportCaseResponseList writes a list of value of the 'support_case_response' type to +// the given stream. +func WriteSupportCaseResponseList(list []*SupportCaseResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSupportCaseResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSupportCaseResponseList reads a list of values of the 'support_case_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSupportCaseResponseList(source interface{}) (items []*SupportCaseResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSupportCaseResponseList(iterator) + err = iterator.Error + return +} + +// ReadSupportCaseResponseList reads list of values of the ”support_case_response' type from +// the given iterator. +func ReadSupportCaseResponseList(iterator *jsoniter.Iterator) []*SupportCaseResponse { + list := []*SupportCaseResponse{} + for iterator.ReadArray() { + item := ReadSupportCaseResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/support_case_response_type.go b/clientapi/accountsmgmt/v1/support_case_response_type.go new file mode 100644 index 00000000..98d4a31c --- /dev/null +++ b/clientapi/accountsmgmt/v1/support_case_response_type.go @@ -0,0 +1,455 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// SupportCaseResponseKind is the name of the type used to represent objects +// of type 'support_case_response'. +const SupportCaseResponseKind = "SupportCaseResponse" + +// SupportCaseResponseLinkKind is the name of the type used to represent links +// to objects of type 'support_case_response'. +const SupportCaseResponseLinkKind = "SupportCaseResponseLink" + +// SupportCaseResponseNilKind is the name of the type used to nil references +// to objects of type 'support_case_response'. +const SupportCaseResponseNilKind = "SupportCaseResponseNil" + +// SupportCaseResponse represents the values of the 'support_case_response' type. +type SupportCaseResponse struct { + bitmap_ uint32 + id string + href string + uri string + caseNumber string + clusterId string + clusterUuid string + description string + severity string + status string + subscriptionId string + summary string +} + +// Kind returns the name of the type of the object. +func (o *SupportCaseResponse) Kind() string { + if o == nil { + return SupportCaseResponseNilKind + } + if o.bitmap_&1 != 0 { + return SupportCaseResponseLinkKind + } + return SupportCaseResponseKind +} + +// Link returns true if this is a link. +func (o *SupportCaseResponse) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *SupportCaseResponse) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *SupportCaseResponse) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *SupportCaseResponse) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *SupportCaseResponse) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SupportCaseResponse) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// URI returns the value of the 'URI' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Support case uri. +func (o *SupportCaseResponse) URI() string { + if o != nil && o.bitmap_&8 != 0 { + return o.uri + } + return "" +} + +// GetURI returns the value of the 'URI' attribute and +// a flag indicating if the attribute has a value. +// +// Support case uri. +func (o *SupportCaseResponse) GetURI() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.uri + } + return +} + +// CaseNumber returns the value of the 'case_number' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Support case number. +func (o *SupportCaseResponse) CaseNumber() string { + if o != nil && o.bitmap_&16 != 0 { + return o.caseNumber + } + return "" +} + +// GetCaseNumber returns the value of the 'case_number' attribute and +// a flag indicating if the attribute has a value. +// +// Support case number. +func (o *SupportCaseResponse) GetCaseNumber() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.caseNumber + } + return +} + +// ClusterId returns the value of the 'cluster_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// (optional) cluster id of the cluster on which we created the support case for. +func (o *SupportCaseResponse) ClusterId() string { + if o != nil && o.bitmap_&32 != 0 { + return o.clusterId + } + return "" +} + +// GetClusterId returns the value of the 'cluster_id' attribute and +// a flag indicating if the attribute has a value. +// +// (optional) cluster id of the cluster on which we created the support case for. +func (o *SupportCaseResponse) GetClusterId() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.clusterId + } + return +} + +// ClusterUuid returns the value of the 'cluster_uuid' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// (optional) cluster uuid of the cluster on which we created the support case for. +func (o *SupportCaseResponse) ClusterUuid() string { + if o != nil && o.bitmap_&64 != 0 { + return o.clusterUuid + } + return "" +} + +// GetClusterUuid returns the value of the 'cluster_uuid' attribute and +// a flag indicating if the attribute has a value. +// +// (optional) cluster uuid of the cluster on which we created the support case for. +func (o *SupportCaseResponse) GetClusterUuid() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.clusterUuid + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Support case desciption. +func (o *SupportCaseResponse) Description() string { + if o != nil && o.bitmap_&128 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Support case desciption. +func (o *SupportCaseResponse) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.description + } + return +} + +// Severity returns the value of the 'severity' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Support case severity. +func (o *SupportCaseResponse) Severity() string { + if o != nil && o.bitmap_&256 != 0 { + return o.severity + } + return "" +} + +// GetSeverity returns the value of the 'severity' attribute and +// a flag indicating if the attribute has a value. +// +// Support case severity. +func (o *SupportCaseResponse) GetSeverity() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.severity + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Support case status. +func (o *SupportCaseResponse) Status() string { + if o != nil && o.bitmap_&512 != 0 { + return o.status + } + return "" +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// Support case status. +func (o *SupportCaseResponse) GetStatus() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.status + } + return +} + +// SubscriptionId returns the value of the 'subscription_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// (optional) subscription id of the subscription on which we created the support case for. +func (o *SupportCaseResponse) SubscriptionId() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.subscriptionId + } + return "" +} + +// GetSubscriptionId returns the value of the 'subscription_id' attribute and +// a flag indicating if the attribute has a value. +// +// (optional) subscription id of the subscription on which we created the support case for. +func (o *SupportCaseResponse) GetSubscriptionId() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.subscriptionId + } + return +} + +// Summary returns the value of the 'summary' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Support case title. +func (o *SupportCaseResponse) Summary() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.summary + } + return "" +} + +// GetSummary returns the value of the 'summary' attribute and +// a flag indicating if the attribute has a value. +// +// Support case title. +func (o *SupportCaseResponse) GetSummary() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.summary + } + return +} + +// SupportCaseResponseListKind is the name of the type used to represent list of objects of +// type 'support_case_response'. +const SupportCaseResponseListKind = "SupportCaseResponseList" + +// SupportCaseResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'support_case_response'. +const SupportCaseResponseListLinkKind = "SupportCaseResponseListLink" + +// SupportCaseResponseNilKind is the name of the type used to nil lists of objects of +// type 'support_case_response'. +const SupportCaseResponseListNilKind = "SupportCaseResponseListNil" + +// SupportCaseResponseList is a list of values of the 'support_case_response' type. +type SupportCaseResponseList struct { + href string + link bool + items []*SupportCaseResponse +} + +// Kind returns the name of the type of the object. +func (l *SupportCaseResponseList) Kind() string { + if l == nil { + return SupportCaseResponseListNilKind + } + if l.link { + return SupportCaseResponseListLinkKind + } + return SupportCaseResponseListKind +} + +// Link returns true iif this is a link. +func (l *SupportCaseResponseList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *SupportCaseResponseList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *SupportCaseResponseList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *SupportCaseResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SupportCaseResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SupportCaseResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SupportCaseResponseList) SetItems(items []*SupportCaseResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *SupportCaseResponseList) Items() []*SupportCaseResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SupportCaseResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SupportCaseResponseList) Get(i int) *SupportCaseResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SupportCaseResponseList) Slice() []*SupportCaseResponse { + var slice []*SupportCaseResponse + if l == nil { + slice = make([]*SupportCaseResponse, 0) + } else { + slice = make([]*SupportCaseResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SupportCaseResponseList) Each(f func(item *SupportCaseResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SupportCaseResponseList) Range(f func(index int, item *SupportCaseResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/support_case_response_type_json.go b/clientapi/accountsmgmt/v1/support_case_response_type_json.go new file mode 100644 index 00000000..c0baf7bb --- /dev/null +++ b/clientapi/accountsmgmt/v1/support_case_response_type_json.go @@ -0,0 +1,224 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSupportCaseResponse writes a value of the 'support_case_response' type to the given writer. +func MarshalSupportCaseResponse(object *SupportCaseResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSupportCaseResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSupportCaseResponse writes a value of the 'support_case_response' type to the given stream. +func WriteSupportCaseResponse(object *SupportCaseResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(SupportCaseResponseLinkKind) + } else { + stream.WriteString(SupportCaseResponseKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("uri") + stream.WriteString(object.uri) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("case_number") + stream.WriteString(object.caseNumber) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterId) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_uuid") + stream.WriteString(object.clusterUuid) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("severity") + stream.WriteString(object.severity) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteString(object.status) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionId) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("summary") + stream.WriteString(object.summary) + } + stream.WriteObjectEnd() +} + +// UnmarshalSupportCaseResponse reads a value of the 'support_case_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSupportCaseResponse(source interface{}) (object *SupportCaseResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSupportCaseResponse(iterator) + err = iterator.Error + return +} + +// ReadSupportCaseResponse reads a value of the 'support_case_response' type from the given iterator. +func ReadSupportCaseResponse(iterator *jsoniter.Iterator) *SupportCaseResponse { + object := &SupportCaseResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == SupportCaseResponseLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "uri": + value := iterator.ReadString() + object.uri = value + object.bitmap_ |= 8 + case "case_number": + value := iterator.ReadString() + object.caseNumber = value + object.bitmap_ |= 16 + case "cluster_id": + value := iterator.ReadString() + object.clusterId = value + object.bitmap_ |= 32 + case "cluster_uuid": + value := iterator.ReadString() + object.clusterUuid = value + object.bitmap_ |= 64 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 128 + case "severity": + value := iterator.ReadString() + object.severity = value + object.bitmap_ |= 256 + case "status": + value := iterator.ReadString() + object.status = value + object.bitmap_ |= 512 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionId = value + object.bitmap_ |= 1024 + case "summary": + value := iterator.ReadString() + object.summary = value + object.bitmap_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/template_parameter_builder.go b/clientapi/accountsmgmt/v1/template_parameter_builder.go new file mode 100644 index 00000000..8f49f3e8 --- /dev/null +++ b/clientapi/accountsmgmt/v1/template_parameter_builder.go @@ -0,0 +1,74 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// TemplateParameterBuilder contains the data and logic needed to build 'template_parameter' objects. +// +// A template parameter is used in an email to replace placeholder content with +// values specific to the email recipient. +type TemplateParameterBuilder struct { + bitmap_ uint32 + content string + name string +} + +// NewTemplateParameter creates a new builder of 'template_parameter' objects. +func NewTemplateParameter() *TemplateParameterBuilder { + return &TemplateParameterBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *TemplateParameterBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Content sets the value of the 'content' attribute to the given value. +func (b *TemplateParameterBuilder) Content(value string) *TemplateParameterBuilder { + b.content = value + b.bitmap_ |= 1 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *TemplateParameterBuilder) Name(value string) *TemplateParameterBuilder { + b.name = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *TemplateParameterBuilder) Copy(object *TemplateParameter) *TemplateParameterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.content = object.content + b.name = object.name + return b +} + +// Build creates a 'template_parameter' object using the configuration stored in the builder. +func (b *TemplateParameterBuilder) Build() (object *TemplateParameter, err error) { + object = new(TemplateParameter) + object.bitmap_ = b.bitmap_ + object.content = b.content + object.name = b.name + return +} diff --git a/clientapi/accountsmgmt/v1/template_parameter_list_builder.go b/clientapi/accountsmgmt/v1/template_parameter_list_builder.go new file mode 100644 index 00000000..03b88b02 --- /dev/null +++ b/clientapi/accountsmgmt/v1/template_parameter_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// TemplateParameterListBuilder contains the data and logic needed to build +// 'template_parameter' objects. +type TemplateParameterListBuilder struct { + items []*TemplateParameterBuilder +} + +// NewTemplateParameterList creates a new builder of 'template_parameter' objects. +func NewTemplateParameterList() *TemplateParameterListBuilder { + return new(TemplateParameterListBuilder) +} + +// Items sets the items of the list. +func (b *TemplateParameterListBuilder) Items(values ...*TemplateParameterBuilder) *TemplateParameterListBuilder { + b.items = make([]*TemplateParameterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *TemplateParameterListBuilder) 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 *TemplateParameterListBuilder) Copy(list *TemplateParameterList) *TemplateParameterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*TemplateParameterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewTemplateParameter().Copy(v) + } + } + return b +} + +// Build creates a list of 'template_parameter' objects using the +// configuration stored in the builder. +func (b *TemplateParameterListBuilder) Build() (list *TemplateParameterList, err error) { + items := make([]*TemplateParameter, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(TemplateParameterList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/template_parameter_list_type_json.go b/clientapi/accountsmgmt/v1/template_parameter_list_type_json.go new file mode 100644 index 00000000..138706f1 --- /dev/null +++ b/clientapi/accountsmgmt/v1/template_parameter_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTemplateParameterList writes a list of values of the 'template_parameter' type to +// the given writer. +func MarshalTemplateParameterList(list []*TemplateParameter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTemplateParameterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTemplateParameterList writes a list of value of the 'template_parameter' type to +// the given stream. +func WriteTemplateParameterList(list []*TemplateParameter, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteTemplateParameter(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalTemplateParameterList reads a list of values of the 'template_parameter' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalTemplateParameterList(source interface{}) (items []*TemplateParameter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadTemplateParameterList(iterator) + err = iterator.Error + return +} + +// ReadTemplateParameterList reads list of values of the ”template_parameter' type from +// the given iterator. +func ReadTemplateParameterList(iterator *jsoniter.Iterator) []*TemplateParameter { + list := []*TemplateParameter{} + for iterator.ReadArray() { + item := ReadTemplateParameter(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/template_parameter_type.go b/clientapi/accountsmgmt/v1/template_parameter_type.go new file mode 100644 index 00000000..8deb2982 --- /dev/null +++ b/clientapi/accountsmgmt/v1/template_parameter_type.go @@ -0,0 +1,190 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// TemplateParameter represents the values of the 'template_parameter' type. +// +// A template parameter is used in an email to replace placeholder content with +// values specific to the email recipient. +type TemplateParameter struct { + bitmap_ uint32 + content string + name string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *TemplateParameter) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Content returns the value of the 'content' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The content that will replace the template parameter in the email +func (o *TemplateParameter) Content() string { + if o != nil && o.bitmap_&1 != 0 { + return o.content + } + return "" +} + +// GetContent returns the value of the 'content' attribute and +// a flag indicating if the attribute has a value. +// +// The content that will replace the template parameter in the email +func (o *TemplateParameter) GetContent() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.content + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the value to be replaced +func (o *TemplateParameter) Name() string { + if o != nil && o.bitmap_&2 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the value to be replaced +func (o *TemplateParameter) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.name + } + return +} + +// TemplateParameterListKind is the name of the type used to represent list of objects of +// type 'template_parameter'. +const TemplateParameterListKind = "TemplateParameterList" + +// TemplateParameterListLinkKind is the name of the type used to represent links to list +// of objects of type 'template_parameter'. +const TemplateParameterListLinkKind = "TemplateParameterListLink" + +// TemplateParameterNilKind is the name of the type used to nil lists of objects of +// type 'template_parameter'. +const TemplateParameterListNilKind = "TemplateParameterListNil" + +// TemplateParameterList is a list of values of the 'template_parameter' type. +type TemplateParameterList struct { + href string + link bool + items []*TemplateParameter +} + +// Len returns the length of the list. +func (l *TemplateParameterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *TemplateParameterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *TemplateParameterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *TemplateParameterList) SetItems(items []*TemplateParameter) { + l.items = items +} + +// Items returns the items of the list. +func (l *TemplateParameterList) Items() []*TemplateParameter { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *TemplateParameterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *TemplateParameterList) Get(i int) *TemplateParameter { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *TemplateParameterList) Slice() []*TemplateParameter { + var slice []*TemplateParameter + if l == nil { + slice = make([]*TemplateParameter, 0) + } else { + slice = make([]*TemplateParameter, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *TemplateParameterList) Each(f func(item *TemplateParameter) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *TemplateParameterList) Range(f func(index int, item *TemplateParameter) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/template_parameter_type_json.go b/clientapi/accountsmgmt/v1/template_parameter_type_json.go new file mode 100644 index 00000000..8246c765 --- /dev/null +++ b/clientapi/accountsmgmt/v1/template_parameter_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTemplateParameter writes a value of the 'template_parameter' type to the given writer. +func MarshalTemplateParameter(object *TemplateParameter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTemplateParameter(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTemplateParameter writes a value of the 'template_parameter' type to the given stream. +func WriteTemplateParameter(object *TemplateParameter, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("content") + stream.WriteString(object.content) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + } + stream.WriteObjectEnd() +} + +// UnmarshalTemplateParameter reads a value of the 'template_parameter' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalTemplateParameter(source interface{}) (object *TemplateParameter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadTemplateParameter(iterator) + err = iterator.Error + return +} + +// ReadTemplateParameter reads a value of the 'template_parameter' type from the given iterator. +func ReadTemplateParameter(iterator *jsoniter.Iterator) *TemplateParameter { + object := &TemplateParameter{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "content": + value := iterator.ReadString() + object.content = value + object.bitmap_ |= 1 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/token_authorization_request_builder.go b/clientapi/accountsmgmt/v1/token_authorization_request_builder.go new file mode 100644 index 00000000..e3712936 --- /dev/null +++ b/clientapi/accountsmgmt/v1/token_authorization_request_builder.go @@ -0,0 +1,61 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// TokenAuthorizationRequestBuilder contains the data and logic needed to build 'token_authorization_request' objects. +type TokenAuthorizationRequestBuilder struct { + bitmap_ uint32 + authorizationToken string +} + +// NewTokenAuthorizationRequest creates a new builder of 'token_authorization_request' objects. +func NewTokenAuthorizationRequest() *TokenAuthorizationRequestBuilder { + return &TokenAuthorizationRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *TokenAuthorizationRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AuthorizationToken sets the value of the 'authorization_token' attribute to the given value. +func (b *TokenAuthorizationRequestBuilder) AuthorizationToken(value string) *TokenAuthorizationRequestBuilder { + b.authorizationToken = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *TokenAuthorizationRequestBuilder) Copy(object *TokenAuthorizationRequest) *TokenAuthorizationRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.authorizationToken = object.authorizationToken + return b +} + +// Build creates a 'token_authorization_request' object using the configuration stored in the builder. +func (b *TokenAuthorizationRequestBuilder) Build() (object *TokenAuthorizationRequest, err error) { + object = new(TokenAuthorizationRequest) + object.bitmap_ = b.bitmap_ + object.authorizationToken = b.authorizationToken + return +} diff --git a/clientapi/accountsmgmt/v1/token_authorization_request_list_builder.go b/clientapi/accountsmgmt/v1/token_authorization_request_list_builder.go new file mode 100644 index 00000000..813baa6a --- /dev/null +++ b/clientapi/accountsmgmt/v1/token_authorization_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// TokenAuthorizationRequestListBuilder contains the data and logic needed to build +// 'token_authorization_request' objects. +type TokenAuthorizationRequestListBuilder struct { + items []*TokenAuthorizationRequestBuilder +} + +// NewTokenAuthorizationRequestList creates a new builder of 'token_authorization_request' objects. +func NewTokenAuthorizationRequestList() *TokenAuthorizationRequestListBuilder { + return new(TokenAuthorizationRequestListBuilder) +} + +// Items sets the items of the list. +func (b *TokenAuthorizationRequestListBuilder) Items(values ...*TokenAuthorizationRequestBuilder) *TokenAuthorizationRequestListBuilder { + b.items = make([]*TokenAuthorizationRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *TokenAuthorizationRequestListBuilder) 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 *TokenAuthorizationRequestListBuilder) Copy(list *TokenAuthorizationRequestList) *TokenAuthorizationRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*TokenAuthorizationRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewTokenAuthorizationRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'token_authorization_request' objects using the +// configuration stored in the builder. +func (b *TokenAuthorizationRequestListBuilder) Build() (list *TokenAuthorizationRequestList, err error) { + items := make([]*TokenAuthorizationRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(TokenAuthorizationRequestList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/token_authorization_request_list_type_json.go b/clientapi/accountsmgmt/v1/token_authorization_request_list_type_json.go new file mode 100644 index 00000000..3769f12d --- /dev/null +++ b/clientapi/accountsmgmt/v1/token_authorization_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTokenAuthorizationRequestList writes a list of values of the 'token_authorization_request' type to +// the given writer. +func MarshalTokenAuthorizationRequestList(list []*TokenAuthorizationRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTokenAuthorizationRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTokenAuthorizationRequestList writes a list of value of the 'token_authorization_request' type to +// the given stream. +func WriteTokenAuthorizationRequestList(list []*TokenAuthorizationRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteTokenAuthorizationRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalTokenAuthorizationRequestList reads a list of values of the 'token_authorization_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalTokenAuthorizationRequestList(source interface{}) (items []*TokenAuthorizationRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadTokenAuthorizationRequestList(iterator) + err = iterator.Error + return +} + +// ReadTokenAuthorizationRequestList reads list of values of the ”token_authorization_request' type from +// the given iterator. +func ReadTokenAuthorizationRequestList(iterator *jsoniter.Iterator) []*TokenAuthorizationRequest { + list := []*TokenAuthorizationRequest{} + for iterator.ReadArray() { + item := ReadTokenAuthorizationRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/token_authorization_request_type.go b/clientapi/accountsmgmt/v1/token_authorization_request_type.go new file mode 100644 index 00000000..0a219168 --- /dev/null +++ b/clientapi/accountsmgmt/v1/token_authorization_request_type.go @@ -0,0 +1,163 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// TokenAuthorizationRequest represents the values of the 'token_authorization_request' type. +type TokenAuthorizationRequest struct { + bitmap_ uint32 + authorizationToken string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *TokenAuthorizationRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AuthorizationToken returns the value of the 'authorization_token' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The pull secret of a given account +func (o *TokenAuthorizationRequest) AuthorizationToken() string { + if o != nil && o.bitmap_&1 != 0 { + return o.authorizationToken + } + return "" +} + +// GetAuthorizationToken returns the value of the 'authorization_token' attribute and +// a flag indicating if the attribute has a value. +// +// The pull secret of a given account +func (o *TokenAuthorizationRequest) GetAuthorizationToken() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.authorizationToken + } + return +} + +// TokenAuthorizationRequestListKind is the name of the type used to represent list of objects of +// type 'token_authorization_request'. +const TokenAuthorizationRequestListKind = "TokenAuthorizationRequestList" + +// TokenAuthorizationRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'token_authorization_request'. +const TokenAuthorizationRequestListLinkKind = "TokenAuthorizationRequestListLink" + +// TokenAuthorizationRequestNilKind is the name of the type used to nil lists of objects of +// type 'token_authorization_request'. +const TokenAuthorizationRequestListNilKind = "TokenAuthorizationRequestListNil" + +// TokenAuthorizationRequestList is a list of values of the 'token_authorization_request' type. +type TokenAuthorizationRequestList struct { + href string + link bool + items []*TokenAuthorizationRequest +} + +// Len returns the length of the list. +func (l *TokenAuthorizationRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *TokenAuthorizationRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *TokenAuthorizationRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *TokenAuthorizationRequestList) SetItems(items []*TokenAuthorizationRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *TokenAuthorizationRequestList) Items() []*TokenAuthorizationRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *TokenAuthorizationRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *TokenAuthorizationRequestList) Get(i int) *TokenAuthorizationRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *TokenAuthorizationRequestList) Slice() []*TokenAuthorizationRequest { + var slice []*TokenAuthorizationRequest + if l == nil { + slice = make([]*TokenAuthorizationRequest, 0) + } else { + slice = make([]*TokenAuthorizationRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *TokenAuthorizationRequestList) Each(f func(item *TokenAuthorizationRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *TokenAuthorizationRequestList) Range(f func(index int, item *TokenAuthorizationRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/token_authorization_request_type_json.go b/clientapi/accountsmgmt/v1/token_authorization_request_type_json.go new file mode 100644 index 00000000..4f5bd558 --- /dev/null +++ b/clientapi/accountsmgmt/v1/token_authorization_request_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTokenAuthorizationRequest writes a value of the 'token_authorization_request' type to the given writer. +func MarshalTokenAuthorizationRequest(object *TokenAuthorizationRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTokenAuthorizationRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTokenAuthorizationRequest writes a value of the 'token_authorization_request' type to the given stream. +func WriteTokenAuthorizationRequest(object *TokenAuthorizationRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("authorization_token") + stream.WriteString(object.authorizationToken) + } + stream.WriteObjectEnd() +} + +// UnmarshalTokenAuthorizationRequest reads a value of the 'token_authorization_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalTokenAuthorizationRequest(source interface{}) (object *TokenAuthorizationRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadTokenAuthorizationRequest(iterator) + err = iterator.Error + return +} + +// ReadTokenAuthorizationRequest reads a value of the 'token_authorization_request' type from the given iterator. +func ReadTokenAuthorizationRequest(iterator *jsoniter.Iterator) *TokenAuthorizationRequest { + object := &TokenAuthorizationRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "authorization_token": + value := iterator.ReadString() + object.authorizationToken = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/token_authorization_response_builder.go b/clientapi/accountsmgmt/v1/token_authorization_response_builder.go new file mode 100644 index 00000000..fc58f51d --- /dev/null +++ b/clientapi/accountsmgmt/v1/token_authorization_response_builder.go @@ -0,0 +1,74 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// TokenAuthorizationResponseBuilder contains the data and logic needed to build 'token_authorization_response' objects. +type TokenAuthorizationResponseBuilder struct { + bitmap_ uint32 + account *AccountBuilder +} + +// NewTokenAuthorizationResponse creates a new builder of 'token_authorization_response' objects. +func NewTokenAuthorizationResponse() *TokenAuthorizationResponseBuilder { + return &TokenAuthorizationResponseBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *TokenAuthorizationResponseBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Account sets the value of the 'account' attribute to the given value. +func (b *TokenAuthorizationResponseBuilder) Account(value *AccountBuilder) *TokenAuthorizationResponseBuilder { + b.account = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *TokenAuthorizationResponseBuilder) Copy(object *TokenAuthorizationResponse) *TokenAuthorizationResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.account != nil { + b.account = NewAccount().Copy(object.account) + } else { + b.account = nil + } + return b +} + +// Build creates a 'token_authorization_response' object using the configuration stored in the builder. +func (b *TokenAuthorizationResponseBuilder) Build() (object *TokenAuthorizationResponse, err error) { + object = new(TokenAuthorizationResponse) + object.bitmap_ = b.bitmap_ + if b.account != nil { + object.account, err = b.account.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/accountsmgmt/v1/token_authorization_response_list_builder.go b/clientapi/accountsmgmt/v1/token_authorization_response_list_builder.go new file mode 100644 index 00000000..8cae1e20 --- /dev/null +++ b/clientapi/accountsmgmt/v1/token_authorization_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// TokenAuthorizationResponseListBuilder contains the data and logic needed to build +// 'token_authorization_response' objects. +type TokenAuthorizationResponseListBuilder struct { + items []*TokenAuthorizationResponseBuilder +} + +// NewTokenAuthorizationResponseList creates a new builder of 'token_authorization_response' objects. +func NewTokenAuthorizationResponseList() *TokenAuthorizationResponseListBuilder { + return new(TokenAuthorizationResponseListBuilder) +} + +// Items sets the items of the list. +func (b *TokenAuthorizationResponseListBuilder) Items(values ...*TokenAuthorizationResponseBuilder) *TokenAuthorizationResponseListBuilder { + b.items = make([]*TokenAuthorizationResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *TokenAuthorizationResponseListBuilder) 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 *TokenAuthorizationResponseListBuilder) Copy(list *TokenAuthorizationResponseList) *TokenAuthorizationResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*TokenAuthorizationResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewTokenAuthorizationResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'token_authorization_response' objects using the +// configuration stored in the builder. +func (b *TokenAuthorizationResponseListBuilder) Build() (list *TokenAuthorizationResponseList, err error) { + items := make([]*TokenAuthorizationResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(TokenAuthorizationResponseList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/token_authorization_response_list_type_json.go b/clientapi/accountsmgmt/v1/token_authorization_response_list_type_json.go new file mode 100644 index 00000000..81394bc3 --- /dev/null +++ b/clientapi/accountsmgmt/v1/token_authorization_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTokenAuthorizationResponseList writes a list of values of the 'token_authorization_response' type to +// the given writer. +func MarshalTokenAuthorizationResponseList(list []*TokenAuthorizationResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTokenAuthorizationResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTokenAuthorizationResponseList writes a list of value of the 'token_authorization_response' type to +// the given stream. +func WriteTokenAuthorizationResponseList(list []*TokenAuthorizationResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteTokenAuthorizationResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalTokenAuthorizationResponseList reads a list of values of the 'token_authorization_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalTokenAuthorizationResponseList(source interface{}) (items []*TokenAuthorizationResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadTokenAuthorizationResponseList(iterator) + err = iterator.Error + return +} + +// ReadTokenAuthorizationResponseList reads list of values of the ”token_authorization_response' type from +// the given iterator. +func ReadTokenAuthorizationResponseList(iterator *jsoniter.Iterator) []*TokenAuthorizationResponse { + list := []*TokenAuthorizationResponse{} + for iterator.ReadArray() { + item := ReadTokenAuthorizationResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/token_authorization_response_type.go b/clientapi/accountsmgmt/v1/token_authorization_response_type.go new file mode 100644 index 00000000..51024442 --- /dev/null +++ b/clientapi/accountsmgmt/v1/token_authorization_response_type.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// TokenAuthorizationResponse represents the values of the 'token_authorization_response' type. +type TokenAuthorizationResponse struct { + bitmap_ uint32 + account *Account +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *TokenAuthorizationResponse) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Account returns the value of the 'account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *TokenAuthorizationResponse) Account() *Account { + if o != nil && o.bitmap_&1 != 0 { + return o.account + } + return nil +} + +// GetAccount returns the value of the 'account' attribute and +// a flag indicating if the attribute has a value. +func (o *TokenAuthorizationResponse) GetAccount() (value *Account, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.account + } + return +} + +// TokenAuthorizationResponseListKind is the name of the type used to represent list of objects of +// type 'token_authorization_response'. +const TokenAuthorizationResponseListKind = "TokenAuthorizationResponseList" + +// TokenAuthorizationResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'token_authorization_response'. +const TokenAuthorizationResponseListLinkKind = "TokenAuthorizationResponseListLink" + +// TokenAuthorizationResponseNilKind is the name of the type used to nil lists of objects of +// type 'token_authorization_response'. +const TokenAuthorizationResponseListNilKind = "TokenAuthorizationResponseListNil" + +// TokenAuthorizationResponseList is a list of values of the 'token_authorization_response' type. +type TokenAuthorizationResponseList struct { + href string + link bool + items []*TokenAuthorizationResponse +} + +// Len returns the length of the list. +func (l *TokenAuthorizationResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *TokenAuthorizationResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *TokenAuthorizationResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *TokenAuthorizationResponseList) SetItems(items []*TokenAuthorizationResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *TokenAuthorizationResponseList) Items() []*TokenAuthorizationResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *TokenAuthorizationResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *TokenAuthorizationResponseList) Get(i int) *TokenAuthorizationResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *TokenAuthorizationResponseList) Slice() []*TokenAuthorizationResponse { + var slice []*TokenAuthorizationResponse + if l == nil { + slice = make([]*TokenAuthorizationResponse, 0) + } else { + slice = make([]*TokenAuthorizationResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *TokenAuthorizationResponseList) Each(f func(item *TokenAuthorizationResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *TokenAuthorizationResponseList) Range(f func(index int, item *TokenAuthorizationResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/token_authorization_response_type_json.go b/clientapi/accountsmgmt/v1/token_authorization_response_type_json.go new file mode 100644 index 00000000..b313cae7 --- /dev/null +++ b/clientapi/accountsmgmt/v1/token_authorization_response_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTokenAuthorizationResponse writes a value of the 'token_authorization_response' type to the given writer. +func MarshalTokenAuthorizationResponse(object *TokenAuthorizationResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTokenAuthorizationResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTokenAuthorizationResponse writes a value of the 'token_authorization_response' type to the given stream. +func WriteTokenAuthorizationResponse(object *TokenAuthorizationResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.account != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account") + WriteAccount(object.account, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalTokenAuthorizationResponse reads a value of the 'token_authorization_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalTokenAuthorizationResponse(source interface{}) (object *TokenAuthorizationResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadTokenAuthorizationResponse(iterator) + err = iterator.Error + return +} + +// ReadTokenAuthorizationResponse reads a value of the 'token_authorization_response' type from the given iterator. +func ReadTokenAuthorizationResponse(iterator *jsoniter.Iterator) *TokenAuthorizationResponse { + object := &TokenAuthorizationResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "account": + value := ReadAccount(iterator) + object.account = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/accountsmgmt/v1/value_unit_builder.go b/clientapi/accountsmgmt/v1/value_unit_builder.go new file mode 100644 index 00000000..b1e17e82 --- /dev/null +++ b/clientapi/accountsmgmt/v1/value_unit_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ValueUnitBuilder contains the data and logic needed to build 'value_unit' objects. +type ValueUnitBuilder struct { + bitmap_ uint32 + unit string + value float64 +} + +// NewValueUnit creates a new builder of 'value_unit' objects. +func NewValueUnit() *ValueUnitBuilder { + return &ValueUnitBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ValueUnitBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Unit sets the value of the 'unit' attribute to the given value. +func (b *ValueUnitBuilder) Unit(value string) *ValueUnitBuilder { + b.unit = value + b.bitmap_ |= 1 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *ValueUnitBuilder) Value(value float64) *ValueUnitBuilder { + b.value = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ValueUnitBuilder) Copy(object *ValueUnit) *ValueUnitBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.unit = object.unit + b.value = object.value + return b +} + +// Build creates a 'value_unit' object using the configuration stored in the builder. +func (b *ValueUnitBuilder) Build() (object *ValueUnit, err error) { + object = new(ValueUnit) + object.bitmap_ = b.bitmap_ + object.unit = b.unit + object.value = b.value + return +} diff --git a/clientapi/accountsmgmt/v1/value_unit_list_builder.go b/clientapi/accountsmgmt/v1/value_unit_list_builder.go new file mode 100644 index 00000000..e01e056c --- /dev/null +++ b/clientapi/accountsmgmt/v1/value_unit_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ValueUnitListBuilder contains the data and logic needed to build +// 'value_unit' objects. +type ValueUnitListBuilder struct { + items []*ValueUnitBuilder +} + +// NewValueUnitList creates a new builder of 'value_unit' objects. +func NewValueUnitList() *ValueUnitListBuilder { + return new(ValueUnitListBuilder) +} + +// Items sets the items of the list. +func (b *ValueUnitListBuilder) Items(values ...*ValueUnitBuilder) *ValueUnitListBuilder { + b.items = make([]*ValueUnitBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ValueUnitListBuilder) 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 *ValueUnitListBuilder) Copy(list *ValueUnitList) *ValueUnitListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ValueUnitBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewValueUnit().Copy(v) + } + } + return b +} + +// Build creates a list of 'value_unit' objects using the +// configuration stored in the builder. +func (b *ValueUnitListBuilder) Build() (list *ValueUnitList, err error) { + items := make([]*ValueUnit, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ValueUnitList) + list.items = items + return +} diff --git a/clientapi/accountsmgmt/v1/value_unit_list_type_json.go b/clientapi/accountsmgmt/v1/value_unit_list_type_json.go new file mode 100644 index 00000000..8e4ca606 --- /dev/null +++ b/clientapi/accountsmgmt/v1/value_unit_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalValueUnitList writes a list of values of the 'value_unit' type to +// the given writer. +func MarshalValueUnitList(list []*ValueUnit, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteValueUnitList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteValueUnitList writes a list of value of the 'value_unit' type to +// the given stream. +func WriteValueUnitList(list []*ValueUnit, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteValueUnit(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalValueUnitList reads a list of values of the 'value_unit' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalValueUnitList(source interface{}) (items []*ValueUnit, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadValueUnitList(iterator) + err = iterator.Error + return +} + +// ReadValueUnitList reads list of values of the ”value_unit' type from +// the given iterator. +func ReadValueUnitList(iterator *jsoniter.Iterator) []*ValueUnit { + list := []*ValueUnit{} + for iterator.ReadArray() { + item := ReadValueUnit(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/accountsmgmt/v1/value_unit_type.go b/clientapi/accountsmgmt/v1/value_unit_type.go new file mode 100644 index 00000000..ab20397c --- /dev/null +++ b/clientapi/accountsmgmt/v1/value_unit_type.go @@ -0,0 +1,179 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +// ValueUnit represents the values of the 'value_unit' type. +type ValueUnit struct { + bitmap_ uint32 + unit string + value float64 +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ValueUnit) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Unit returns the value of the 'unit' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ValueUnit) Unit() string { + if o != nil && o.bitmap_&1 != 0 { + return o.unit + } + return "" +} + +// GetUnit returns the value of the 'unit' attribute and +// a flag indicating if the attribute has a value. +func (o *ValueUnit) GetUnit() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.unit + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ValueUnit) Value() float64 { + if o != nil && o.bitmap_&2 != 0 { + return o.value + } + return 0.0 +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +func (o *ValueUnit) GetValue() (value float64, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.value + } + return +} + +// ValueUnitListKind is the name of the type used to represent list of objects of +// type 'value_unit'. +const ValueUnitListKind = "ValueUnitList" + +// ValueUnitListLinkKind is the name of the type used to represent links to list +// of objects of type 'value_unit'. +const ValueUnitListLinkKind = "ValueUnitListLink" + +// ValueUnitNilKind is the name of the type used to nil lists of objects of +// type 'value_unit'. +const ValueUnitListNilKind = "ValueUnitListNil" + +// ValueUnitList is a list of values of the 'value_unit' type. +type ValueUnitList struct { + href string + link bool + items []*ValueUnit +} + +// Len returns the length of the list. +func (l *ValueUnitList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ValueUnitList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ValueUnitList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ValueUnitList) SetItems(items []*ValueUnit) { + l.items = items +} + +// Items returns the items of the list. +func (l *ValueUnitList) Items() []*ValueUnit { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ValueUnitList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ValueUnitList) Get(i int) *ValueUnit { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ValueUnitList) Slice() []*ValueUnit { + var slice []*ValueUnit + if l == nil { + slice = make([]*ValueUnit, 0) + } else { + slice = make([]*ValueUnit, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ValueUnitList) Each(f func(item *ValueUnit) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ValueUnitList) Range(f func(index int, item *ValueUnit) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/accountsmgmt/v1/value_unit_type_json.go b/clientapi/accountsmgmt/v1/value_unit_type_json.go new file mode 100644 index 00000000..8e4db313 --- /dev/null +++ b/clientapi/accountsmgmt/v1/value_unit_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/accountsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalValueUnit writes a value of the 'value_unit' type to the given writer. +func MarshalValueUnit(object *ValueUnit, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteValueUnit(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteValueUnit writes a value of the 'value_unit' type to the given stream. +func WriteValueUnit(object *ValueUnit, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("unit") + stream.WriteString(object.unit) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteFloat64(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalValueUnit reads a value of the 'value_unit' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalValueUnit(source interface{}) (object *ValueUnit, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadValueUnit(iterator) + err = iterator.Error + return +} + +// ReadValueUnit reads a value of the 'value_unit' type from the given iterator. +func ReadValueUnit(iterator *jsoniter.Iterator) *ValueUnit { + object := &ValueUnit{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "unit": + value := iterator.ReadString() + object.unit = value + object.bitmap_ |= 1 + case "value": + value := iterator.ReadFloat64() + object.value = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/additional_catalog_source_builder.go b/clientapi/addonsmgmt/v1/additional_catalog_source_builder.go new file mode 100644 index 00000000..62030cd7 --- /dev/null +++ b/clientapi/addonsmgmt/v1/additional_catalog_source_builder.go @@ -0,0 +1,93 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AdditionalCatalogSourceBuilder contains the data and logic needed to build 'additional_catalog_source' objects. +// +// Representation of an addon catalog source object used by addon versions. +type AdditionalCatalogSourceBuilder struct { + bitmap_ uint32 + id string + image string + name string + enabled bool +} + +// NewAdditionalCatalogSource creates a new builder of 'additional_catalog_source' objects. +func NewAdditionalCatalogSource() *AdditionalCatalogSourceBuilder { + return &AdditionalCatalogSourceBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AdditionalCatalogSourceBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *AdditionalCatalogSourceBuilder) ID(value string) *AdditionalCatalogSourceBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AdditionalCatalogSourceBuilder) Enabled(value bool) *AdditionalCatalogSourceBuilder { + b.enabled = value + b.bitmap_ |= 2 + return b +} + +// Image sets the value of the 'image' attribute to the given value. +func (b *AdditionalCatalogSourceBuilder) Image(value string) *AdditionalCatalogSourceBuilder { + b.image = value + b.bitmap_ |= 4 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AdditionalCatalogSourceBuilder) Name(value string) *AdditionalCatalogSourceBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AdditionalCatalogSourceBuilder) Copy(object *AdditionalCatalogSource) *AdditionalCatalogSourceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.enabled = object.enabled + b.image = object.image + b.name = object.name + return b +} + +// Build creates a 'additional_catalog_source' object using the configuration stored in the builder. +func (b *AdditionalCatalogSourceBuilder) Build() (object *AdditionalCatalogSource, err error) { + object = new(AdditionalCatalogSource) + object.bitmap_ = b.bitmap_ + object.id = b.id + object.enabled = b.enabled + object.image = b.image + object.name = b.name + return +} diff --git a/clientapi/addonsmgmt/v1/additional_catalog_source_list_builder.go b/clientapi/addonsmgmt/v1/additional_catalog_source_list_builder.go new file mode 100644 index 00000000..1898c21e --- /dev/null +++ b/clientapi/addonsmgmt/v1/additional_catalog_source_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AdditionalCatalogSourceListBuilder contains the data and logic needed to build +// 'additional_catalog_source' objects. +type AdditionalCatalogSourceListBuilder struct { + items []*AdditionalCatalogSourceBuilder +} + +// NewAdditionalCatalogSourceList creates a new builder of 'additional_catalog_source' objects. +func NewAdditionalCatalogSourceList() *AdditionalCatalogSourceListBuilder { + return new(AdditionalCatalogSourceListBuilder) +} + +// Items sets the items of the list. +func (b *AdditionalCatalogSourceListBuilder) Items(values ...*AdditionalCatalogSourceBuilder) *AdditionalCatalogSourceListBuilder { + b.items = make([]*AdditionalCatalogSourceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AdditionalCatalogSourceListBuilder) 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 *AdditionalCatalogSourceListBuilder) Copy(list *AdditionalCatalogSourceList) *AdditionalCatalogSourceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AdditionalCatalogSourceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAdditionalCatalogSource().Copy(v) + } + } + return b +} + +// Build creates a list of 'additional_catalog_source' objects using the +// configuration stored in the builder. +func (b *AdditionalCatalogSourceListBuilder) Build() (list *AdditionalCatalogSourceList, err error) { + items := make([]*AdditionalCatalogSource, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AdditionalCatalogSourceList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/additional_catalog_source_list_type_json.go b/clientapi/addonsmgmt/v1/additional_catalog_source_list_type_json.go new file mode 100644 index 00000000..12c04387 --- /dev/null +++ b/clientapi/addonsmgmt/v1/additional_catalog_source_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAdditionalCatalogSourceList writes a list of values of the 'additional_catalog_source' type to +// the given writer. +func MarshalAdditionalCatalogSourceList(list []*AdditionalCatalogSource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAdditionalCatalogSourceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAdditionalCatalogSourceList writes a list of value of the 'additional_catalog_source' type to +// the given stream. +func WriteAdditionalCatalogSourceList(list []*AdditionalCatalogSource, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAdditionalCatalogSource(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAdditionalCatalogSourceList reads a list of values of the 'additional_catalog_source' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAdditionalCatalogSourceList(source interface{}) (items []*AdditionalCatalogSource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAdditionalCatalogSourceList(iterator) + err = iterator.Error + return +} + +// ReadAdditionalCatalogSourceList reads list of values of the ”additional_catalog_source' type from +// the given iterator. +func ReadAdditionalCatalogSourceList(iterator *jsoniter.Iterator) []*AdditionalCatalogSource { + list := []*AdditionalCatalogSource{} + for iterator.ReadArray() { + item := ReadAdditionalCatalogSource(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/additional_catalog_source_type.go b/clientapi/addonsmgmt/v1/additional_catalog_source_type.go new file mode 100644 index 00000000..5f2dd87d --- /dev/null +++ b/clientapi/addonsmgmt/v1/additional_catalog_source_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AdditionalCatalogSource represents the values of the 'additional_catalog_source' type. +// +// Representation of an addon catalog source object used by addon versions. +type AdditionalCatalogSource struct { + bitmap_ uint32 + id string + image string + name string + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AdditionalCatalogSource) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID of the additional catalog source +func (o *AdditionalCatalogSource) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID of the additional catalog source +func (o *AdditionalCatalogSource) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates is this additional catalog source is enabled for the addon +func (o *AdditionalCatalogSource) Enabled() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates is this additional catalog source is enabled for the addon +func (o *AdditionalCatalogSource) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.enabled + } + return +} + +// Image returns the value of the 'image' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Image of the additional catalog source. +func (o *AdditionalCatalogSource) Image() string { + if o != nil && o.bitmap_&4 != 0 { + return o.image + } + return "" +} + +// GetImage returns the value of the 'image' attribute and +// a flag indicating if the attribute has a value. +// +// Image of the additional catalog source. +func (o *AdditionalCatalogSource) GetImage() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.image + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the additional catalog source. +func (o *AdditionalCatalogSource) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the additional catalog source. +func (o *AdditionalCatalogSource) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// AdditionalCatalogSourceListKind is the name of the type used to represent list of objects of +// type 'additional_catalog_source'. +const AdditionalCatalogSourceListKind = "AdditionalCatalogSourceList" + +// AdditionalCatalogSourceListLinkKind is the name of the type used to represent links to list +// of objects of type 'additional_catalog_source'. +const AdditionalCatalogSourceListLinkKind = "AdditionalCatalogSourceListLink" + +// AdditionalCatalogSourceNilKind is the name of the type used to nil lists of objects of +// type 'additional_catalog_source'. +const AdditionalCatalogSourceListNilKind = "AdditionalCatalogSourceListNil" + +// AdditionalCatalogSourceList is a list of values of the 'additional_catalog_source' type. +type AdditionalCatalogSourceList struct { + href string + link bool + items []*AdditionalCatalogSource +} + +// Len returns the length of the list. +func (l *AdditionalCatalogSourceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AdditionalCatalogSourceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AdditionalCatalogSourceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AdditionalCatalogSourceList) SetItems(items []*AdditionalCatalogSource) { + l.items = items +} + +// Items returns the items of the list. +func (l *AdditionalCatalogSourceList) Items() []*AdditionalCatalogSource { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AdditionalCatalogSourceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AdditionalCatalogSourceList) Get(i int) *AdditionalCatalogSource { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AdditionalCatalogSourceList) Slice() []*AdditionalCatalogSource { + var slice []*AdditionalCatalogSource + if l == nil { + slice = make([]*AdditionalCatalogSource, 0) + } else { + slice = make([]*AdditionalCatalogSource, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AdditionalCatalogSourceList) Each(f func(item *AdditionalCatalogSource) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AdditionalCatalogSourceList) Range(f func(index int, item *AdditionalCatalogSource) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/additional_catalog_source_type_json.go b/clientapi/addonsmgmt/v1/additional_catalog_source_type_json.go new file mode 100644 index 00000000..741b9fcd --- /dev/null +++ b/clientapi/addonsmgmt/v1/additional_catalog_source_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAdditionalCatalogSource writes a value of the 'additional_catalog_source' type to the given writer. +func MarshalAdditionalCatalogSource(object *AdditionalCatalogSource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAdditionalCatalogSource(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAdditionalCatalogSource writes a value of the 'additional_catalog_source' type to the given stream. +func WriteAdditionalCatalogSource(object *AdditionalCatalogSource, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("image") + stream.WriteString(object.image) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + } + stream.WriteObjectEnd() +} + +// UnmarshalAdditionalCatalogSource reads a value of the 'additional_catalog_source' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAdditionalCatalogSource(source interface{}) (object *AdditionalCatalogSource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAdditionalCatalogSource(iterator) + err = iterator.Error + return +} + +// ReadAdditionalCatalogSource reads a value of the 'additional_catalog_source' type from the given iterator. +func ReadAdditionalCatalogSource(iterator *jsoniter.Iterator) *AdditionalCatalogSource { + object := &AdditionalCatalogSource{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 2 + case "image": + value := iterator.ReadString() + object.image = value + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_builder.go b/clientapi/addonsmgmt/v1/addon_builder.go new file mode 100644 index 00000000..5039e58e --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_builder.go @@ -0,0 +1,447 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonBuilder contains the data and logic needed to build 'addon' objects. +// +// Representation of an addon that can be installed in a cluster. +type AddonBuilder struct { + bitmap_ uint32 + id string + href string + commonAnnotations map[string]string + commonLabels map[string]string + config *AddonConfigBuilder + credentialsRequests []*CredentialRequestBuilder + description string + docsLink string + icon string + installMode AddonInstallMode + label string + name string + namespaces []*AddonNamespaceBuilder + operatorName string + parameters *AddonParameterListBuilder + requirements []*AddonRequirementBuilder + resourceCost float64 + resourceName string + subOperators []*AddonSubOperatorBuilder + targetNamespace string + version *AddonVersionBuilder + enabled bool + hasExternalResources bool + hidden bool + managedService bool +} + +// NewAddon creates a new builder of 'addon' objects. +func NewAddon() *AddonBuilder { + return &AddonBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddonBuilder) Link(value bool) *AddonBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddonBuilder) ID(value string) *AddonBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddonBuilder) HREF(value string) *AddonBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CommonAnnotations sets the value of the 'common_annotations' attribute to the given value. +func (b *AddonBuilder) CommonAnnotations(value map[string]string) *AddonBuilder { + b.commonAnnotations = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// CommonLabels sets the value of the 'common_labels' attribute to the given value. +func (b *AddonBuilder) CommonLabels(value map[string]string) *AddonBuilder { + b.commonLabels = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Config sets the value of the 'config' attribute to the given value. +// +// Representation of an addon config. +// The attributes under it are to be used by the addon once its installed in the cluster. +func (b *AddonBuilder) Config(value *AddonConfigBuilder) *AddonBuilder { + b.config = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// CredentialsRequests sets the value of the 'credentials_requests' attribute to the given values. +func (b *AddonBuilder) CredentialsRequests(values ...*CredentialRequestBuilder) *AddonBuilder { + b.credentialsRequests = make([]*CredentialRequestBuilder, len(values)) + copy(b.credentialsRequests, values) + b.bitmap_ |= 64 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *AddonBuilder) Description(value string) *AddonBuilder { + b.description = value + b.bitmap_ |= 128 + return b +} + +// DocsLink sets the value of the 'docs_link' attribute to the given value. +func (b *AddonBuilder) DocsLink(value string) *AddonBuilder { + b.docsLink = value + b.bitmap_ |= 256 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddonBuilder) Enabled(value bool) *AddonBuilder { + b.enabled = value + b.bitmap_ |= 512 + return b +} + +// HasExternalResources sets the value of the 'has_external_resources' attribute to the given value. +func (b *AddonBuilder) HasExternalResources(value bool) *AddonBuilder { + b.hasExternalResources = value + b.bitmap_ |= 1024 + return b +} + +// Hidden sets the value of the 'hidden' attribute to the given value. +func (b *AddonBuilder) Hidden(value bool) *AddonBuilder { + b.hidden = value + b.bitmap_ |= 2048 + return b +} + +// Icon sets the value of the 'icon' attribute to the given value. +func (b *AddonBuilder) Icon(value string) *AddonBuilder { + b.icon = value + b.bitmap_ |= 4096 + return b +} + +// InstallMode sets the value of the 'install_mode' attribute to the given value. +// +// Representation of an addon InstallMode field. +func (b *AddonBuilder) InstallMode(value AddonInstallMode) *AddonBuilder { + b.installMode = value + b.bitmap_ |= 8192 + return b +} + +// Label sets the value of the 'label' attribute to the given value. +func (b *AddonBuilder) Label(value string) *AddonBuilder { + b.label = value + b.bitmap_ |= 16384 + return b +} + +// ManagedService sets the value of the 'managed_service' attribute to the given value. +func (b *AddonBuilder) ManagedService(value bool) *AddonBuilder { + b.managedService = value + b.bitmap_ |= 32768 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AddonBuilder) Name(value string) *AddonBuilder { + b.name = value + b.bitmap_ |= 65536 + return b +} + +// Namespaces sets the value of the 'namespaces' attribute to the given values. +func (b *AddonBuilder) Namespaces(values ...*AddonNamespaceBuilder) *AddonBuilder { + b.namespaces = make([]*AddonNamespaceBuilder, len(values)) + copy(b.namespaces, values) + b.bitmap_ |= 131072 + return b +} + +// OperatorName sets the value of the 'operator_name' attribute to the given value. +func (b *AddonBuilder) OperatorName(value string) *AddonBuilder { + b.operatorName = value + b.bitmap_ |= 262144 + return b +} + +// Parameters sets the value of the 'parameters' attribute to the given values. +func (b *AddonBuilder) Parameters(value *AddonParameterListBuilder) *AddonBuilder { + b.parameters = value + b.bitmap_ |= 524288 + return b +} + +// Requirements sets the value of the 'requirements' attribute to the given values. +func (b *AddonBuilder) Requirements(values ...*AddonRequirementBuilder) *AddonBuilder { + b.requirements = make([]*AddonRequirementBuilder, len(values)) + copy(b.requirements, values) + b.bitmap_ |= 1048576 + return b +} + +// ResourceCost sets the value of the 'resource_cost' attribute to the given value. +func (b *AddonBuilder) ResourceCost(value float64) *AddonBuilder { + b.resourceCost = value + b.bitmap_ |= 2097152 + return b +} + +// ResourceName sets the value of the 'resource_name' attribute to the given value. +func (b *AddonBuilder) ResourceName(value string) *AddonBuilder { + b.resourceName = value + b.bitmap_ |= 4194304 + return b +} + +// SubOperators sets the value of the 'sub_operators' attribute to the given values. +func (b *AddonBuilder) SubOperators(values ...*AddonSubOperatorBuilder) *AddonBuilder { + b.subOperators = make([]*AddonSubOperatorBuilder, len(values)) + copy(b.subOperators, values) + b.bitmap_ |= 8388608 + return b +} + +// TargetNamespace sets the value of the 'target_namespace' attribute to the given value. +func (b *AddonBuilder) TargetNamespace(value string) *AddonBuilder { + b.targetNamespace = value + b.bitmap_ |= 16777216 + return b +} + +// Version sets the value of the 'version' attribute to the given value. +// +// Representation of an addon version. +func (b *AddonBuilder) Version(value *AddonVersionBuilder) *AddonBuilder { + b.version = value + if value != nil { + b.bitmap_ |= 33554432 + } else { + b.bitmap_ &^= 33554432 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonBuilder) Copy(object *Addon) *AddonBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if len(object.commonAnnotations) > 0 { + b.commonAnnotations = map[string]string{} + for k, v := range object.commonAnnotations { + b.commonAnnotations[k] = v + } + } else { + b.commonAnnotations = nil + } + if len(object.commonLabels) > 0 { + b.commonLabels = map[string]string{} + for k, v := range object.commonLabels { + b.commonLabels[k] = v + } + } else { + b.commonLabels = nil + } + if object.config != nil { + b.config = NewAddonConfig().Copy(object.config) + } else { + b.config = nil + } + if object.credentialsRequests != nil { + b.credentialsRequests = make([]*CredentialRequestBuilder, len(object.credentialsRequests)) + for i, v := range object.credentialsRequests { + b.credentialsRequests[i] = NewCredentialRequest().Copy(v) + } + } else { + b.credentialsRequests = nil + } + b.description = object.description + b.docsLink = object.docsLink + b.enabled = object.enabled + b.hasExternalResources = object.hasExternalResources + b.hidden = object.hidden + b.icon = object.icon + b.installMode = object.installMode + b.label = object.label + b.managedService = object.managedService + b.name = object.name + if object.namespaces != nil { + b.namespaces = make([]*AddonNamespaceBuilder, len(object.namespaces)) + for i, v := range object.namespaces { + b.namespaces[i] = NewAddonNamespace().Copy(v) + } + } else { + b.namespaces = nil + } + b.operatorName = object.operatorName + if object.parameters != nil { + b.parameters = NewAddonParameterList().Copy(object.parameters) + } else { + b.parameters = nil + } + if object.requirements != nil { + b.requirements = make([]*AddonRequirementBuilder, len(object.requirements)) + for i, v := range object.requirements { + b.requirements[i] = NewAddonRequirement().Copy(v) + } + } else { + b.requirements = nil + } + b.resourceCost = object.resourceCost + b.resourceName = object.resourceName + if object.subOperators != nil { + b.subOperators = make([]*AddonSubOperatorBuilder, len(object.subOperators)) + for i, v := range object.subOperators { + b.subOperators[i] = NewAddonSubOperator().Copy(v) + } + } else { + b.subOperators = nil + } + b.targetNamespace = object.targetNamespace + if object.version != nil { + b.version = NewAddonVersion().Copy(object.version) + } else { + b.version = nil + } + return b +} + +// Build creates a 'addon' object using the configuration stored in the builder. +func (b *AddonBuilder) Build() (object *Addon, err error) { + object = new(Addon) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.commonAnnotations != nil { + object.commonAnnotations = make(map[string]string) + for k, v := range b.commonAnnotations { + object.commonAnnotations[k] = v + } + } + if b.commonLabels != nil { + object.commonLabels = make(map[string]string) + for k, v := range b.commonLabels { + object.commonLabels[k] = v + } + } + if b.config != nil { + object.config, err = b.config.Build() + if err != nil { + return + } + } + if b.credentialsRequests != nil { + object.credentialsRequests = make([]*CredentialRequest, len(b.credentialsRequests)) + for i, v := range b.credentialsRequests { + object.credentialsRequests[i], err = v.Build() + if err != nil { + return + } + } + } + object.description = b.description + object.docsLink = b.docsLink + object.enabled = b.enabled + object.hasExternalResources = b.hasExternalResources + object.hidden = b.hidden + object.icon = b.icon + object.installMode = b.installMode + object.label = b.label + object.managedService = b.managedService + object.name = b.name + if b.namespaces != nil { + object.namespaces = make([]*AddonNamespace, len(b.namespaces)) + for i, v := range b.namespaces { + object.namespaces[i], err = v.Build() + if err != nil { + return + } + } + } + object.operatorName = b.operatorName + if b.parameters != nil { + object.parameters, err = b.parameters.Build() + if err != nil { + return + } + } + if b.requirements != nil { + object.requirements = make([]*AddonRequirement, len(b.requirements)) + for i, v := range b.requirements { + object.requirements[i], err = v.Build() + if err != nil { + return + } + } + } + object.resourceCost = b.resourceCost + object.resourceName = b.resourceName + if b.subOperators != nil { + object.subOperators = make([]*AddonSubOperator, len(b.subOperators)) + for i, v := range b.subOperators { + object.subOperators[i], err = v.Build() + if err != nil { + return + } + } + } + object.targetNamespace = b.targetNamespace + if b.version != nil { + object.version, err = b.version.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/addonsmgmt/v1/addon_config_builder.go b/clientapi/addonsmgmt/v1/addon_config_builder.go new file mode 100644 index 00000000..310c8dd8 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_config_builder.go @@ -0,0 +1,106 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonConfigBuilder contains the data and logic needed to build 'addon_config' objects. +// +// Representation of an addon config. +// The attributes under it are to be used by the addon once its installed in the cluster. +type AddonConfigBuilder struct { + bitmap_ uint32 + addOnEnvironmentVariables []*AddonEnvironmentVariableBuilder + addOnSecretPropagations []*AddonSecretPropagationBuilder +} + +// NewAddonConfig creates a new builder of 'addon_config' objects. +func NewAddonConfig() *AddonConfigBuilder { + return &AddonConfigBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonConfigBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AddOnEnvironmentVariables sets the value of the 'add_on_environment_variables' attribute to the given values. +func (b *AddonConfigBuilder) AddOnEnvironmentVariables(values ...*AddonEnvironmentVariableBuilder) *AddonConfigBuilder { + b.addOnEnvironmentVariables = make([]*AddonEnvironmentVariableBuilder, len(values)) + copy(b.addOnEnvironmentVariables, values) + b.bitmap_ |= 1 + return b +} + +// AddOnSecretPropagations sets the value of the 'add_on_secret_propagations' attribute to the given values. +func (b *AddonConfigBuilder) AddOnSecretPropagations(values ...*AddonSecretPropagationBuilder) *AddonConfigBuilder { + b.addOnSecretPropagations = make([]*AddonSecretPropagationBuilder, len(values)) + copy(b.addOnSecretPropagations, values) + b.bitmap_ |= 2 + 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 + } + b.bitmap_ = object.bitmap_ + 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.addOnSecretPropagations != nil { + b.addOnSecretPropagations = make([]*AddonSecretPropagationBuilder, len(object.addOnSecretPropagations)) + for i, v := range object.addOnSecretPropagations { + b.addOnSecretPropagations[i] = NewAddonSecretPropagation().Copy(v) + } + } else { + b.addOnSecretPropagations = nil + } + return b +} + +// Build creates a 'addon_config' object using the configuration stored in the builder. +func (b *AddonConfigBuilder) Build() (object *AddonConfig, err error) { + object = new(AddonConfig) + object.bitmap_ = b.bitmap_ + 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.addOnSecretPropagations != nil { + object.addOnSecretPropagations = make([]*AddonSecretPropagation, len(b.addOnSecretPropagations)) + for i, v := range b.addOnSecretPropagations { + object.addOnSecretPropagations[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/addonsmgmt/v1/addon_config_list_builder.go b/clientapi/addonsmgmt/v1/addon_config_list_builder.go new file mode 100644 index 00000000..4bfb134b --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_config_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonConfigListBuilder contains the data and logic needed to build +// 'addon_config' objects. +type AddonConfigListBuilder struct { + items []*AddonConfigBuilder +} + +// NewAddonConfigList creates a new builder of 'addon_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 'addon_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 +} diff --git a/clientapi/addonsmgmt/v1/addon_config_list_type_json.go b/clientapi/addonsmgmt/v1/addon_config_list_type_json.go new file mode 100644 index 00000000..c9458a40 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_config_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +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 'addon_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 'addon_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 'addon_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 ”addon_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 +} diff --git a/clientapi/addonsmgmt/v1/addon_config_type.go b/clientapi/addonsmgmt/v1/addon_config_type.go new file mode 100644 index 00000000..c90ad14a --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_config_type.go @@ -0,0 +1,190 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonConfig represents the values of the 'addon_config' type. +// +// Representation of an addon config. +// The attributes under it are to be used by the addon once its installed in the cluster. +type AddonConfig struct { + bitmap_ uint32 + addOnEnvironmentVariables []*AddonEnvironmentVariable + addOnSecretPropagations []*AddonSecretPropagation +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonConfig) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AddOnEnvironmentVariables returns the value of the 'add_on_environment_variables' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of environment variables for the addon +func (o *AddonConfig) AddOnEnvironmentVariables() []*AddonEnvironmentVariable { + if o != nil && o.bitmap_&1 != 0 { + return o.addOnEnvironmentVariables + } + return nil +} + +// GetAddOnEnvironmentVariables returns the value of the 'add_on_environment_variables' attribute and +// a flag indicating if the attribute has a value. +// +// List of environment variables for the addon +func (o *AddonConfig) GetAddOnEnvironmentVariables() (value []*AddonEnvironmentVariable, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.addOnEnvironmentVariables + } + return +} + +// AddOnSecretPropagations returns the value of the 'add_on_secret_propagations' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of secret propagations for the addon +func (o *AddonConfig) AddOnSecretPropagations() []*AddonSecretPropagation { + if o != nil && o.bitmap_&2 != 0 { + return o.addOnSecretPropagations + } + return nil +} + +// GetAddOnSecretPropagations returns the value of the 'add_on_secret_propagations' attribute and +// a flag indicating if the attribute has a value. +// +// List of secret propagations for the addon +func (o *AddonConfig) GetAddOnSecretPropagations() (value []*AddonSecretPropagation, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.addOnSecretPropagations + } + return +} + +// AddonConfigListKind is the name of the type used to represent list of objects of +// type 'addon_config'. +const AddonConfigListKind = "AddonConfigList" + +// AddonConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_config'. +const AddonConfigListLinkKind = "AddonConfigListLink" + +// AddonConfigNilKind is the name of the type used to nil lists of objects of +// type 'addon_config'. +const AddonConfigListNilKind = "AddonConfigListNil" + +// AddonConfigList is a list of values of the 'addon_config' type. +type AddonConfigList struct { + href string + link bool + items []*AddonConfig +} + +// Len returns the length of the list. +func (l *AddonConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonConfigList) SetItems(items []*AddonConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonConfigList) Items() []*AddonConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonConfigList) Get(i int) *AddonConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonConfigList) Slice() []*AddonConfig { + var slice []*AddonConfig + if l == nil { + slice = make([]*AddonConfig, 0) + } else { + slice = make([]*AddonConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonConfigList) Each(f func(item *AddonConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonConfigList) Range(f func(index int, item *AddonConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_config_type_json.go b/clientapi/addonsmgmt/v1/addon_config_type_json.go new file mode 100644 index 00000000..db5b0668 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_config_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonConfig writes a value of the 'addon_config' type to the given writer. +func MarshalAddonConfig(object *AddonConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonConfig writes a value of the 'addon_config' type to the given stream. +func WriteAddonConfig(object *AddonConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.addOnEnvironmentVariables != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("add_on_environment_variables") + WriteAddonEnvironmentVariableList(object.addOnEnvironmentVariables, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.addOnSecretPropagations != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("add_on_secret_propagations") + WriteAddonSecretPropagationList(object.addOnSecretPropagations, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonConfig reads a value of the 'addon_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonConfig(source interface{}) (object *AddonConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonConfig(iterator) + err = iterator.Error + return +} + +// ReadAddonConfig reads a value of the 'addon_config' type from the given iterator. +func ReadAddonConfig(iterator *jsoniter.Iterator) *AddonConfig { + object := &AddonConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "add_on_environment_variables": + value := ReadAddonEnvironmentVariableList(iterator) + object.addOnEnvironmentVariables = value + object.bitmap_ |= 1 + case "add_on_secret_propagations": + value := ReadAddonSecretPropagationList(iterator) + object.addOnSecretPropagations = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_environment_variable_builder.go b/clientapi/addonsmgmt/v1/addon_environment_variable_builder.go new file mode 100644 index 00000000..55334941 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_environment_variable_builder.go @@ -0,0 +1,93 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonEnvironmentVariableBuilder contains the data and logic needed to build 'addon_environment_variable' objects. +// +// Representation of an addon env object. +type AddonEnvironmentVariableBuilder struct { + bitmap_ uint32 + id string + name string + value string + enabled bool +} + +// NewAddonEnvironmentVariable creates a new builder of 'addon_environment_variable' objects. +func NewAddonEnvironmentVariable() *AddonEnvironmentVariableBuilder { + return &AddonEnvironmentVariableBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonEnvironmentVariableBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *AddonEnvironmentVariableBuilder) ID(value string) *AddonEnvironmentVariableBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddonEnvironmentVariableBuilder) Enabled(value bool) *AddonEnvironmentVariableBuilder { + b.enabled = value + b.bitmap_ |= 2 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AddonEnvironmentVariableBuilder) Name(value string) *AddonEnvironmentVariableBuilder { + b.name = value + b.bitmap_ |= 4 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *AddonEnvironmentVariableBuilder) Value(value string) *AddonEnvironmentVariableBuilder { + b.value = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonEnvironmentVariableBuilder) Copy(object *AddonEnvironmentVariable) *AddonEnvironmentVariableBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.enabled = object.enabled + b.name = object.name + b.value = object.value + return b +} + +// Build creates a 'addon_environment_variable' object using the configuration stored in the builder. +func (b *AddonEnvironmentVariableBuilder) Build() (object *AddonEnvironmentVariable, err error) { + object = new(AddonEnvironmentVariable) + object.bitmap_ = b.bitmap_ + object.id = b.id + object.enabled = b.enabled + object.name = b.name + object.value = b.value + return +} diff --git a/clientapi/addonsmgmt/v1/addon_environment_variable_list_builder.go b/clientapi/addonsmgmt/v1/addon_environment_variable_list_builder.go new file mode 100644 index 00000000..6337e69f --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_environment_variable_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonEnvironmentVariableListBuilder contains the data and logic needed to build +// 'addon_environment_variable' objects. +type AddonEnvironmentVariableListBuilder struct { + items []*AddonEnvironmentVariableBuilder +} + +// NewAddonEnvironmentVariableList creates a new builder of 'addon_environment_variable' objects. +func NewAddonEnvironmentVariableList() *AddonEnvironmentVariableListBuilder { + return new(AddonEnvironmentVariableListBuilder) +} + +// Items sets the items of the list. +func (b *AddonEnvironmentVariableListBuilder) Items(values ...*AddonEnvironmentVariableBuilder) *AddonEnvironmentVariableListBuilder { + b.items = make([]*AddonEnvironmentVariableBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonEnvironmentVariableListBuilder) 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 *AddonEnvironmentVariableListBuilder) Copy(list *AddonEnvironmentVariableList) *AddonEnvironmentVariableListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonEnvironmentVariableBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonEnvironmentVariable().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_environment_variable' objects using the +// configuration stored in the builder. +func (b *AddonEnvironmentVariableListBuilder) Build() (list *AddonEnvironmentVariableList, err error) { + items := make([]*AddonEnvironmentVariable, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonEnvironmentVariableList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_environment_variable_list_type_json.go b/clientapi/addonsmgmt/v1/addon_environment_variable_list_type_json.go new file mode 100644 index 00000000..0bfa2f74 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_environment_variable_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonEnvironmentVariableList writes a list of values of the 'addon_environment_variable' type to +// the given writer. +func MarshalAddonEnvironmentVariableList(list []*AddonEnvironmentVariable, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonEnvironmentVariableList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonEnvironmentVariableList writes a list of value of the 'addon_environment_variable' type to +// the given stream. +func WriteAddonEnvironmentVariableList(list []*AddonEnvironmentVariable, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonEnvironmentVariable(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonEnvironmentVariableList reads a list of values of the 'addon_environment_variable' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonEnvironmentVariableList(source interface{}) (items []*AddonEnvironmentVariable, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonEnvironmentVariableList(iterator) + err = iterator.Error + return +} + +// ReadAddonEnvironmentVariableList reads list of values of the ”addon_environment_variable' type from +// the given iterator. +func ReadAddonEnvironmentVariableList(iterator *jsoniter.Iterator) []*AddonEnvironmentVariable { + list := []*AddonEnvironmentVariable{} + for iterator.ReadArray() { + item := ReadAddonEnvironmentVariable(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_environment_variable_type.go b/clientapi/addonsmgmt/v1/addon_environment_variable_type.go new file mode 100644 index 00000000..e92cdc07 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_environment_variable_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonEnvironmentVariable represents the values of the 'addon_environment_variable' type. +// +// Representation of an addon env object. +type AddonEnvironmentVariable struct { + bitmap_ uint32 + id string + name string + value string + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonEnvironmentVariable) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID for the environment variable +func (o *AddonEnvironmentVariable) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID for the environment variable +func (o *AddonEnvironmentVariable) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates is this environment variable is enabled for the addon +func (o *AddonEnvironmentVariable) Enabled() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates is this environment variable is enabled for the addon +func (o *AddonEnvironmentVariable) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.enabled + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the environment variable +func (o *AddonEnvironmentVariable) Name() string { + if o != nil && o.bitmap_&4 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the environment variable +func (o *AddonEnvironmentVariable) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.name + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Value of the environment variable +func (o *AddonEnvironmentVariable) Value() string { + if o != nil && o.bitmap_&8 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Value of the environment variable +func (o *AddonEnvironmentVariable) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.value + } + return +} + +// AddonEnvironmentVariableListKind is the name of the type used to represent list of objects of +// type 'addon_environment_variable'. +const AddonEnvironmentVariableListKind = "AddonEnvironmentVariableList" + +// AddonEnvironmentVariableListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_environment_variable'. +const AddonEnvironmentVariableListLinkKind = "AddonEnvironmentVariableListLink" + +// AddonEnvironmentVariableNilKind is the name of the type used to nil lists of objects of +// type 'addon_environment_variable'. +const AddonEnvironmentVariableListNilKind = "AddonEnvironmentVariableListNil" + +// AddonEnvironmentVariableList is a list of values of the 'addon_environment_variable' type. +type AddonEnvironmentVariableList struct { + href string + link bool + items []*AddonEnvironmentVariable +} + +// Len returns the length of the list. +func (l *AddonEnvironmentVariableList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonEnvironmentVariableList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonEnvironmentVariableList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonEnvironmentVariableList) SetItems(items []*AddonEnvironmentVariable) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonEnvironmentVariableList) Items() []*AddonEnvironmentVariable { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonEnvironmentVariableList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonEnvironmentVariableList) Get(i int) *AddonEnvironmentVariable { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonEnvironmentVariableList) Slice() []*AddonEnvironmentVariable { + var slice []*AddonEnvironmentVariable + if l == nil { + slice = make([]*AddonEnvironmentVariable, 0) + } else { + slice = make([]*AddonEnvironmentVariable, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonEnvironmentVariableList) Each(f func(item *AddonEnvironmentVariable) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonEnvironmentVariableList) Range(f func(index int, item *AddonEnvironmentVariable) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_environment_variable_type_json.go b/clientapi/addonsmgmt/v1/addon_environment_variable_type_json.go new file mode 100644 index 00000000..291e5d0d --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_environment_variable_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonEnvironmentVariable writes a value of the 'addon_environment_variable' type to the given writer. +func MarshalAddonEnvironmentVariable(object *AddonEnvironmentVariable, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonEnvironmentVariable(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonEnvironmentVariable writes a value of the 'addon_environment_variable' type to the given stream. +func WriteAddonEnvironmentVariable(object *AddonEnvironmentVariable, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonEnvironmentVariable reads a value of the 'addon_environment_variable' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonEnvironmentVariable(source interface{}) (object *AddonEnvironmentVariable, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonEnvironmentVariable(iterator) + err = iterator.Error + return +} + +// ReadAddonEnvironmentVariable reads a value of the 'addon_environment_variable' type from the given iterator. +func ReadAddonEnvironmentVariable(iterator *jsoniter.Iterator) *AddonEnvironmentVariable { + object := &AddonEnvironmentVariable{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 2 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 4 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_install_mode_list_type_json.go b/clientapi/addonsmgmt/v1/addon_install_mode_list_type_json.go new file mode 100644 index 00000000..28053bb8 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_install_mode_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonInstallModeList writes a list of values of the 'addon_install_mode' type to +// the given writer. +func MarshalAddonInstallModeList(list []AddonInstallMode, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonInstallModeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonInstallModeList writes a list of value of the 'addon_install_mode' type to +// the given stream. +func WriteAddonInstallModeList(list []AddonInstallMode, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonInstallModeList reads a list of values of the 'addon_install_mode' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonInstallModeList(source interface{}) (items []AddonInstallMode, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonInstallModeList(iterator) + err = iterator.Error + return +} + +// ReadAddonInstallModeList reads list of values of the ”addon_install_mode' type from +// the given iterator. +func ReadAddonInstallModeList(iterator *jsoniter.Iterator) []AddonInstallMode { + list := []AddonInstallMode{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := AddonInstallMode(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_install_mode_type.go b/clientapi/addonsmgmt/v1/addon_install_mode_type.go new file mode 100644 index 00000000..ba702106 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_install_mode_type.go @@ -0,0 +1,32 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonInstallMode represents the values of the 'addon_install_mode' enumerated type. +type AddonInstallMode string + +const ( + // This mode means that the addon is deployed in all namespaces. + // However, the addon status is retrieved from the target namespace + AddonInstallModeAllNamespaces AddonInstallMode = "all_namespaces" + // This mode means that the the addon CRD exists in a single specific namespace. + // This namespace is reflected by the TargetNamespace addon field + AddonInstallModeOwnNamespace AddonInstallMode = "own_namespace" +) diff --git a/clientapi/addonsmgmt/v1/addon_installation_billing_builder.go b/clientapi/addonsmgmt/v1/addon_installation_billing_builder.go new file mode 100644 index 00000000..8772b8a2 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_billing_builder.go @@ -0,0 +1,105 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonInstallationBillingBuilder contains the data and logic needed to build 'addon_installation_billing' objects. +// +// Representation of an add-on installation billing. +type AddonInstallationBillingBuilder struct { + bitmap_ uint32 + billingMarketplaceAccount string + billingModel BillingModel + href string + id string + kind string +} + +// NewAddonInstallationBilling creates a new builder of 'addon_installation_billing' objects. +func NewAddonInstallationBilling() *AddonInstallationBillingBuilder { + return &AddonInstallationBillingBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonInstallationBillingBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// BillingMarketplaceAccount sets the value of the 'billing_marketplace_account' attribute to the given value. +func (b *AddonInstallationBillingBuilder) BillingMarketplaceAccount(value string) *AddonInstallationBillingBuilder { + b.billingMarketplaceAccount = value + b.bitmap_ |= 1 + return b +} + +// BillingModel sets the value of the 'billing_model' attribute to the given value. +// +// Representation of an billing model field. +func (b *AddonInstallationBillingBuilder) BillingModel(value BillingModel) *AddonInstallationBillingBuilder { + b.billingModel = value + b.bitmap_ |= 2 + return b +} + +// Href sets the value of the 'href' attribute to the given value. +func (b *AddonInstallationBillingBuilder) Href(value string) *AddonInstallationBillingBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Id sets the value of the 'id' attribute to the given value. +func (b *AddonInstallationBillingBuilder) Id(value string) *AddonInstallationBillingBuilder { + b.id = value + b.bitmap_ |= 8 + return b +} + +// Kind sets the value of the 'kind' attribute to the given value. +func (b *AddonInstallationBillingBuilder) Kind(value string) *AddonInstallationBillingBuilder { + b.kind = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonInstallationBillingBuilder) Copy(object *AddonInstallationBilling) *AddonInstallationBillingBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.billingMarketplaceAccount = object.billingMarketplaceAccount + b.billingModel = object.billingModel + b.href = object.href + b.id = object.id + b.kind = object.kind + return b +} + +// Build creates a 'addon_installation_billing' object using the configuration stored in the builder. +func (b *AddonInstallationBillingBuilder) Build() (object *AddonInstallationBilling, err error) { + object = new(AddonInstallationBilling) + object.bitmap_ = b.bitmap_ + object.billingMarketplaceAccount = b.billingMarketplaceAccount + object.billingModel = b.billingModel + object.href = b.href + object.id = b.id + object.kind = b.kind + return +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_billing_list_builder.go b/clientapi/addonsmgmt/v1/addon_installation_billing_list_builder.go new file mode 100644 index 00000000..7747bbee --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_billing_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonInstallationBillingListBuilder contains the data and logic needed to build +// 'addon_installation_billing' objects. +type AddonInstallationBillingListBuilder struct { + items []*AddonInstallationBillingBuilder +} + +// NewAddonInstallationBillingList creates a new builder of 'addon_installation_billing' objects. +func NewAddonInstallationBillingList() *AddonInstallationBillingListBuilder { + return new(AddonInstallationBillingListBuilder) +} + +// Items sets the items of the list. +func (b *AddonInstallationBillingListBuilder) Items(values ...*AddonInstallationBillingBuilder) *AddonInstallationBillingListBuilder { + b.items = make([]*AddonInstallationBillingBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonInstallationBillingListBuilder) 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 *AddonInstallationBillingListBuilder) Copy(list *AddonInstallationBillingList) *AddonInstallationBillingListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonInstallationBillingBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonInstallationBilling().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_installation_billing' objects using the +// configuration stored in the builder. +func (b *AddonInstallationBillingListBuilder) Build() (list *AddonInstallationBillingList, err error) { + items := make([]*AddonInstallationBilling, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonInstallationBillingList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_billing_list_type_json.go b/clientapi/addonsmgmt/v1/addon_installation_billing_list_type_json.go new file mode 100644 index 00000000..3486701b --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_billing_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonInstallationBillingList writes a list of values of the 'addon_installation_billing' type to +// the given writer. +func MarshalAddonInstallationBillingList(list []*AddonInstallationBilling, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonInstallationBillingList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonInstallationBillingList writes a list of value of the 'addon_installation_billing' type to +// the given stream. +func WriteAddonInstallationBillingList(list []*AddonInstallationBilling, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonInstallationBilling(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonInstallationBillingList reads a list of values of the 'addon_installation_billing' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonInstallationBillingList(source interface{}) (items []*AddonInstallationBilling, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonInstallationBillingList(iterator) + err = iterator.Error + return +} + +// ReadAddonInstallationBillingList reads list of values of the ”addon_installation_billing' type from +// the given iterator. +func ReadAddonInstallationBillingList(iterator *jsoniter.Iterator) []*AddonInstallationBilling { + list := []*AddonInstallationBilling{} + for iterator.ReadArray() { + item := ReadAddonInstallationBilling(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_billing_type.go b/clientapi/addonsmgmt/v1/addon_installation_billing_type.go new file mode 100644 index 00000000..1f58163f --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_billing_type.go @@ -0,0 +1,261 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonInstallationBilling represents the values of the 'addon_installation_billing' type. +// +// Representation of an add-on installation billing. +type AddonInstallationBilling struct { + bitmap_ uint32 + billingMarketplaceAccount string + billingModel BillingModel + href string + id string + kind string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonInstallationBilling) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// BillingMarketplaceAccount returns the value of the 'billing_marketplace_account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Account ID for billing market place +func (o *AddonInstallationBilling) BillingMarketplaceAccount() string { + if o != nil && o.bitmap_&1 != 0 { + return o.billingMarketplaceAccount + } + return "" +} + +// GetBillingMarketplaceAccount returns the value of the 'billing_marketplace_account' attribute and +// a flag indicating if the attribute has a value. +// +// Account ID for billing market place +func (o *AddonInstallationBilling) GetBillingMarketplaceAccount() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.billingMarketplaceAccount + } + return +} + +// BillingModel returns the value of the 'billing_model' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Billing Model for addon resources +func (o *AddonInstallationBilling) BillingModel() BillingModel { + if o != nil && o.bitmap_&2 != 0 { + return o.billingModel + } + return BillingModel("") +} + +// GetBillingModel returns the value of the 'billing_model' attribute and +// a flag indicating if the attribute has a value. +// +// Billing Model for addon resources +func (o *AddonInstallationBilling) GetBillingModel() (value BillingModel, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.billingModel + } + return +} + +// Href returns the value of the 'href' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Self link +func (o *AddonInstallationBilling) Href() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHref returns the value of the 'href' attribute and +// a flag indicating if the attribute has a value. +// +// Self link +func (o *AddonInstallationBilling) GetHref() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Id returns the value of the 'id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Unique identifier of the object +func (o *AddonInstallationBilling) Id() string { + if o != nil && o.bitmap_&8 != 0 { + return o.id + } + return "" +} + +// GetId returns the value of the 'id' attribute and +// a flag indicating if the attribute has a value. +// +// Unique identifier of the object +func (o *AddonInstallationBilling) GetId() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.id + } + return +} + +// Kind returns the value of the 'kind' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the type of this object +func (o *AddonInstallationBilling) Kind() string { + if o != nil && o.bitmap_&16 != 0 { + return o.kind + } + return "" +} + +// GetKind returns the value of the 'kind' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the type of this object +func (o *AddonInstallationBilling) GetKind() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.kind + } + return +} + +// AddonInstallationBillingListKind is the name of the type used to represent list of objects of +// type 'addon_installation_billing'. +const AddonInstallationBillingListKind = "AddonInstallationBillingList" + +// AddonInstallationBillingListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_installation_billing'. +const AddonInstallationBillingListLinkKind = "AddonInstallationBillingListLink" + +// AddonInstallationBillingNilKind is the name of the type used to nil lists of objects of +// type 'addon_installation_billing'. +const AddonInstallationBillingListNilKind = "AddonInstallationBillingListNil" + +// AddonInstallationBillingList is a list of values of the 'addon_installation_billing' type. +type AddonInstallationBillingList struct { + href string + link bool + items []*AddonInstallationBilling +} + +// Len returns the length of the list. +func (l *AddonInstallationBillingList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonInstallationBillingList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonInstallationBillingList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonInstallationBillingList) SetItems(items []*AddonInstallationBilling) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonInstallationBillingList) Items() []*AddonInstallationBilling { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonInstallationBillingList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonInstallationBillingList) Get(i int) *AddonInstallationBilling { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonInstallationBillingList) Slice() []*AddonInstallationBilling { + var slice []*AddonInstallationBilling + if l == nil { + slice = make([]*AddonInstallationBilling, 0) + } else { + slice = make([]*AddonInstallationBilling, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonInstallationBillingList) Each(f func(item *AddonInstallationBilling) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonInstallationBillingList) Range(f func(index int, item *AddonInstallationBilling) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_billing_type_json.go b/clientapi/addonsmgmt/v1/addon_installation_billing_type_json.go new file mode 100644 index 00000000..2438bb6d --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_billing_type_json.go @@ -0,0 +1,139 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonInstallationBilling writes a value of the 'addon_installation_billing' type to the given writer. +func MarshalAddonInstallationBilling(object *AddonInstallationBilling, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonInstallationBilling(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonInstallationBilling writes a value of the 'addon_installation_billing' type to the given stream. +func WriteAddonInstallationBilling(object *AddonInstallationBilling, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_marketplace_account") + stream.WriteString(object.billingMarketplaceAccount) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_model") + stream.WriteString(string(object.billingModel)) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kind") + stream.WriteString(object.kind) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonInstallationBilling reads a value of the 'addon_installation_billing' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonInstallationBilling(source interface{}) (object *AddonInstallationBilling, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonInstallationBilling(iterator) + err = iterator.Error + return +} + +// ReadAddonInstallationBilling reads a value of the 'addon_installation_billing' type from the given iterator. +func ReadAddonInstallationBilling(iterator *jsoniter.Iterator) *AddonInstallationBilling { + object := &AddonInstallationBilling{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "billing_marketplace_account": + value := iterator.ReadString() + object.billingMarketplaceAccount = value + object.bitmap_ |= 1 + case "billing_model": + text := iterator.ReadString() + value := BillingModel(text) + object.billingModel = value + object.bitmap_ |= 2 + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 4 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 8 + case "kind": + value := iterator.ReadString() + object.kind = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_builder.go b/clientapi/addonsmgmt/v1/addon_installation_builder.go new file mode 100644 index 00000000..25563848 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_builder.go @@ -0,0 +1,284 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + time "time" +) + +// AddonInstallationBuilder contains the data and logic needed to build 'addon_installation' objects. +// +// Representation of addon installation +type AddonInstallationBuilder struct { + bitmap_ uint32 + id string + href string + addon *AddonBuilder + addonVersion *AddonVersionBuilder + billing *AddonInstallationBillingBuilder + creationTimestamp time.Time + csvName string + deletedTimestamp time.Time + desiredVersion string + operatorVersion string + parameters *AddonInstallationParameterListBuilder + state AddonInstallationState + stateDescription string + subscription *ObjectReferenceBuilder + updatedTimestamp time.Time +} + +// NewAddonInstallation creates a new builder of 'addon_installation' objects. +func NewAddonInstallation() *AddonInstallationBuilder { + return &AddonInstallationBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddonInstallationBuilder) Link(value bool) *AddonInstallationBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddonInstallationBuilder) ID(value string) *AddonInstallationBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddonInstallationBuilder) HREF(value string) *AddonInstallationBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonInstallationBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Addon sets the value of the 'addon' attribute to the given value. +// +// Representation of an addon that can be installed in a cluster. +func (b *AddonInstallationBuilder) Addon(value *AddonBuilder) *AddonInstallationBuilder { + b.addon = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// AddonVersion sets the value of the 'addon_version' attribute to the given value. +// +// Representation of an addon version. +func (b *AddonInstallationBuilder) AddonVersion(value *AddonVersionBuilder) *AddonInstallationBuilder { + b.addonVersion = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Billing sets the value of the 'billing' attribute to the given value. +// +// Representation of an add-on installation billing. +func (b *AddonInstallationBuilder) Billing(value *AddonInstallationBillingBuilder) *AddonInstallationBuilder { + b.billing = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *AddonInstallationBuilder) CreationTimestamp(value time.Time) *AddonInstallationBuilder { + b.creationTimestamp = value + b.bitmap_ |= 64 + return b +} + +// CsvName sets the value of the 'csv_name' attribute to the given value. +func (b *AddonInstallationBuilder) CsvName(value string) *AddonInstallationBuilder { + b.csvName = value + b.bitmap_ |= 128 + return b +} + +// DeletedTimestamp sets the value of the 'deleted_timestamp' attribute to the given value. +func (b *AddonInstallationBuilder) DeletedTimestamp(value time.Time) *AddonInstallationBuilder { + b.deletedTimestamp = value + b.bitmap_ |= 256 + return b +} + +// DesiredVersion sets the value of the 'desired_version' attribute to the given value. +func (b *AddonInstallationBuilder) DesiredVersion(value string) *AddonInstallationBuilder { + b.desiredVersion = value + b.bitmap_ |= 512 + return b +} + +// OperatorVersion sets the value of the 'operator_version' attribute to the given value. +func (b *AddonInstallationBuilder) OperatorVersion(value string) *AddonInstallationBuilder { + b.operatorVersion = value + b.bitmap_ |= 1024 + return b +} + +// Parameters sets the value of the 'parameters' attribute to the given values. +func (b *AddonInstallationBuilder) Parameters(value *AddonInstallationParameterListBuilder) *AddonInstallationBuilder { + b.parameters = value + b.bitmap_ |= 2048 + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// representation of addon installation state +func (b *AddonInstallationBuilder) State(value AddonInstallationState) *AddonInstallationBuilder { + b.state = value + b.bitmap_ |= 4096 + return b +} + +// StateDescription sets the value of the 'state_description' attribute to the given value. +func (b *AddonInstallationBuilder) StateDescription(value string) *AddonInstallationBuilder { + b.stateDescription = value + b.bitmap_ |= 8192 + return b +} + +// Subscription sets the value of the 'subscription' attribute to the given value. +// +// representation of object reference/subscription +func (b *AddonInstallationBuilder) Subscription(value *ObjectReferenceBuilder) *AddonInstallationBuilder { + b.subscription = value + if value != nil { + b.bitmap_ |= 16384 + } else { + b.bitmap_ &^= 16384 + } + return b +} + +// UpdatedTimestamp sets the value of the 'updated_timestamp' attribute to the given value. +func (b *AddonInstallationBuilder) UpdatedTimestamp(value time.Time) *AddonInstallationBuilder { + b.updatedTimestamp = value + b.bitmap_ |= 32768 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonInstallationBuilder) Copy(object *AddonInstallation) *AddonInstallationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.addon != nil { + b.addon = NewAddon().Copy(object.addon) + } else { + b.addon = nil + } + if object.addonVersion != nil { + b.addonVersion = NewAddonVersion().Copy(object.addonVersion) + } else { + b.addonVersion = nil + } + if object.billing != nil { + b.billing = NewAddonInstallationBilling().Copy(object.billing) + } else { + b.billing = nil + } + b.creationTimestamp = object.creationTimestamp + b.csvName = object.csvName + b.deletedTimestamp = object.deletedTimestamp + b.desiredVersion = object.desiredVersion + b.operatorVersion = object.operatorVersion + if object.parameters != nil { + b.parameters = NewAddonInstallationParameterList().Copy(object.parameters) + } else { + b.parameters = nil + } + b.state = object.state + b.stateDescription = object.stateDescription + if object.subscription != nil { + b.subscription = NewObjectReference().Copy(object.subscription) + } else { + b.subscription = nil + } + b.updatedTimestamp = object.updatedTimestamp + return b +} + +// Build creates a 'addon_installation' object using the configuration stored in the builder. +func (b *AddonInstallationBuilder) Build() (object *AddonInstallation, err error) { + object = new(AddonInstallation) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.addon != nil { + object.addon, err = b.addon.Build() + if err != nil { + return + } + } + if b.addonVersion != nil { + object.addonVersion, err = b.addonVersion.Build() + if err != nil { + return + } + } + if b.billing != nil { + object.billing, err = b.billing.Build() + if err != nil { + return + } + } + object.creationTimestamp = b.creationTimestamp + object.csvName = b.csvName + object.deletedTimestamp = b.deletedTimestamp + object.desiredVersion = b.desiredVersion + object.operatorVersion = b.operatorVersion + if b.parameters != nil { + object.parameters, err = b.parameters.Build() + if err != nil { + return + } + } + object.state = b.state + object.stateDescription = b.stateDescription + if b.subscription != nil { + object.subscription, err = b.subscription.Build() + if err != nil { + return + } + } + object.updatedTimestamp = b.updatedTimestamp + return +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_list_builder.go b/clientapi/addonsmgmt/v1/addon_installation_list_builder.go new file mode 100644 index 00000000..021dc5bf --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonInstallationListBuilder contains the data and logic needed to build +// 'addon_installation' objects. +type AddonInstallationListBuilder struct { + items []*AddonInstallationBuilder +} + +// NewAddonInstallationList creates a new builder of 'addon_installation' objects. +func NewAddonInstallationList() *AddonInstallationListBuilder { + return new(AddonInstallationListBuilder) +} + +// Items sets the items of the list. +func (b *AddonInstallationListBuilder) Items(values ...*AddonInstallationBuilder) *AddonInstallationListBuilder { + b.items = make([]*AddonInstallationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonInstallationListBuilder) 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 *AddonInstallationListBuilder) Copy(list *AddonInstallationList) *AddonInstallationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonInstallationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonInstallation().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_installation' objects using the +// configuration stored in the builder. +func (b *AddonInstallationListBuilder) Build() (list *AddonInstallationList, err error) { + items := make([]*AddonInstallation, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonInstallationList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_list_type_json.go b/clientapi/addonsmgmt/v1/addon_installation_list_type_json.go new file mode 100644 index 00000000..d150be75 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonInstallationList writes a list of values of the 'addon_installation' type to +// the given writer. +func MarshalAddonInstallationList(list []*AddonInstallation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonInstallationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonInstallationList writes a list of value of the 'addon_installation' type to +// the given stream. +func WriteAddonInstallationList(list []*AddonInstallation, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonInstallation(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonInstallationList reads a list of values of the 'addon_installation' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonInstallationList(source interface{}) (items []*AddonInstallation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonInstallationList(iterator) + err = iterator.Error + return +} + +// ReadAddonInstallationList reads list of values of the ”addon_installation' type from +// the given iterator. +func ReadAddonInstallationList(iterator *jsoniter.Iterator) []*AddonInstallation { + list := []*AddonInstallation{} + for iterator.ReadArray() { + item := ReadAddonInstallation(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_parameter_builder.go b/clientapi/addonsmgmt/v1/addon_installation_parameter_builder.go new file mode 100644 index 00000000..1bbd65bb --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_parameter_builder.go @@ -0,0 +1,93 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonInstallationParameterBuilder contains the data and logic needed to build 'addon_installation_parameter' objects. +// +// representation of addon installation parameter +type AddonInstallationParameterBuilder struct { + bitmap_ uint32 + href string + id string + kind string + value string +} + +// NewAddonInstallationParameter creates a new builder of 'addon_installation_parameter' objects. +func NewAddonInstallationParameter() *AddonInstallationParameterBuilder { + return &AddonInstallationParameterBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonInstallationParameterBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Href sets the value of the 'href' attribute to the given value. +func (b *AddonInstallationParameterBuilder) Href(value string) *AddonInstallationParameterBuilder { + b.href = value + b.bitmap_ |= 1 + return b +} + +// Id sets the value of the 'id' attribute to the given value. +func (b *AddonInstallationParameterBuilder) Id(value string) *AddonInstallationParameterBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// Kind sets the value of the 'kind' attribute to the given value. +func (b *AddonInstallationParameterBuilder) Kind(value string) *AddonInstallationParameterBuilder { + b.kind = value + b.bitmap_ |= 4 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *AddonInstallationParameterBuilder) Value(value string) *AddonInstallationParameterBuilder { + b.value = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonInstallationParameterBuilder) Copy(object *AddonInstallationParameter) *AddonInstallationParameterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.href = object.href + b.id = object.id + b.kind = object.kind + b.value = object.value + return b +} + +// Build creates a 'addon_installation_parameter' object using the configuration stored in the builder. +func (b *AddonInstallationParameterBuilder) Build() (object *AddonInstallationParameter, err error) { + object = new(AddonInstallationParameter) + object.bitmap_ = b.bitmap_ + object.href = b.href + object.id = b.id + object.kind = b.kind + object.value = b.value + return +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_parameter_list_builder.go b/clientapi/addonsmgmt/v1/addon_installation_parameter_list_builder.go new file mode 100644 index 00000000..c2614b65 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_parameter_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonInstallationParameterListBuilder contains the data and logic needed to build +// 'addon_installation_parameter' objects. +type AddonInstallationParameterListBuilder struct { + items []*AddonInstallationParameterBuilder +} + +// NewAddonInstallationParameterList creates a new builder of 'addon_installation_parameter' objects. +func NewAddonInstallationParameterList() *AddonInstallationParameterListBuilder { + return new(AddonInstallationParameterListBuilder) +} + +// Items sets the items of the list. +func (b *AddonInstallationParameterListBuilder) Items(values ...*AddonInstallationParameterBuilder) *AddonInstallationParameterListBuilder { + b.items = make([]*AddonInstallationParameterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonInstallationParameterListBuilder) 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 *AddonInstallationParameterListBuilder) Copy(list *AddonInstallationParameterList) *AddonInstallationParameterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonInstallationParameterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonInstallationParameter().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_installation_parameter' objects using the +// configuration stored in the builder. +func (b *AddonInstallationParameterListBuilder) Build() (list *AddonInstallationParameterList, err error) { + items := make([]*AddonInstallationParameter, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonInstallationParameterList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_parameter_list_type_json.go b/clientapi/addonsmgmt/v1/addon_installation_parameter_list_type_json.go new file mode 100644 index 00000000..cc22b6a9 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_parameter_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonInstallationParameterList writes a list of values of the 'addon_installation_parameter' type to +// the given writer. +func MarshalAddonInstallationParameterList(list []*AddonInstallationParameter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonInstallationParameterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonInstallationParameterList writes a list of value of the 'addon_installation_parameter' type to +// the given stream. +func WriteAddonInstallationParameterList(list []*AddonInstallationParameter, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonInstallationParameter(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonInstallationParameterList reads a list of values of the 'addon_installation_parameter' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonInstallationParameterList(source interface{}) (items []*AddonInstallationParameter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonInstallationParameterList(iterator) + err = iterator.Error + return +} + +// ReadAddonInstallationParameterList reads list of values of the ”addon_installation_parameter' type from +// the given iterator. +func ReadAddonInstallationParameterList(iterator *jsoniter.Iterator) []*AddonInstallationParameter { + list := []*AddonInstallationParameter{} + for iterator.ReadArray() { + item := ReadAddonInstallationParameter(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_parameter_type.go b/clientapi/addonsmgmt/v1/addon_installation_parameter_type.go new file mode 100644 index 00000000..1a38baeb --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_parameter_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonInstallationParameter represents the values of the 'addon_installation_parameter' type. +// +// representation of addon installation parameter +type AddonInstallationParameter struct { + bitmap_ uint32 + href string + id string + kind string + value string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonInstallationParameter) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Href returns the value of the 'href' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Self link +func (o *AddonInstallationParameter) Href() string { + if o != nil && o.bitmap_&1 != 0 { + return o.href + } + return "" +} + +// GetHref returns the value of the 'href' attribute and +// a flag indicating if the attribute has a value. +// +// Self link +func (o *AddonInstallationParameter) GetHref() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.href + } + return +} + +// Id returns the value of the 'id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Unique identifier of the object +func (o *AddonInstallationParameter) Id() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetId returns the value of the 'id' attribute and +// a flag indicating if the attribute has a value. +// +// Unique identifier of the object +func (o *AddonInstallationParameter) GetId() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// Kind returns the value of the 'kind' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the type of this object +func (o *AddonInstallationParameter) Kind() string { + if o != nil && o.bitmap_&4 != 0 { + return o.kind + } + return "" +} + +// GetKind returns the value of the 'kind' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the type of this object +func (o *AddonInstallationParameter) GetKind() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.kind + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Value of the parameter +func (o *AddonInstallationParameter) Value() string { + if o != nil && o.bitmap_&8 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Value of the parameter +func (o *AddonInstallationParameter) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.value + } + return +} + +// AddonInstallationParameterListKind is the name of the type used to represent list of objects of +// type 'addon_installation_parameter'. +const AddonInstallationParameterListKind = "AddonInstallationParameterList" + +// AddonInstallationParameterListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_installation_parameter'. +const AddonInstallationParameterListLinkKind = "AddonInstallationParameterListLink" + +// AddonInstallationParameterNilKind is the name of the type used to nil lists of objects of +// type 'addon_installation_parameter'. +const AddonInstallationParameterListNilKind = "AddonInstallationParameterListNil" + +// AddonInstallationParameterList is a list of values of the 'addon_installation_parameter' type. +type AddonInstallationParameterList struct { + href string + link bool + items []*AddonInstallationParameter +} + +// Len returns the length of the list. +func (l *AddonInstallationParameterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonInstallationParameterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonInstallationParameterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonInstallationParameterList) SetItems(items []*AddonInstallationParameter) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonInstallationParameterList) Items() []*AddonInstallationParameter { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonInstallationParameterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonInstallationParameterList) Get(i int) *AddonInstallationParameter { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonInstallationParameterList) Slice() []*AddonInstallationParameter { + var slice []*AddonInstallationParameter + if l == nil { + slice = make([]*AddonInstallationParameter, 0) + } else { + slice = make([]*AddonInstallationParameter, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonInstallationParameterList) Each(f func(item *AddonInstallationParameter) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonInstallationParameterList) Range(f func(index int, item *AddonInstallationParameter) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_parameter_type_json.go b/clientapi/addonsmgmt/v1/addon_installation_parameter_type_json.go new file mode 100644 index 00000000..374420b0 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_parameter_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonInstallationParameter writes a value of the 'addon_installation_parameter' type to the given writer. +func MarshalAddonInstallationParameter(object *AddonInstallationParameter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonInstallationParameter(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonInstallationParameter writes a value of the 'addon_installation_parameter' type to the given stream. +func WriteAddonInstallationParameter(object *AddonInstallationParameter, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kind") + stream.WriteString(object.kind) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonInstallationParameter reads a value of the 'addon_installation_parameter' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonInstallationParameter(source interface{}) (object *AddonInstallationParameter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonInstallationParameter(iterator) + err = iterator.Error + return +} + +// ReadAddonInstallationParameter reads a value of the 'addon_installation_parameter' type from the given iterator. +func ReadAddonInstallationParameter(iterator *jsoniter.Iterator) *AddonInstallationParameter { + object := &AddonInstallationParameter{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 1 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 2 + case "kind": + value := iterator.ReadString() + object.kind = value + object.bitmap_ |= 4 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_parameters_builder.go b/clientapi/addonsmgmt/v1/addon_installation_parameters_builder.go new file mode 100644 index 00000000..58824cc0 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_parameters_builder.go @@ -0,0 +1,79 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonInstallationParametersBuilder contains the data and logic needed to build 'addon_installation_parameters' objects. +// +// representation of addon installation parameter +type AddonInstallationParametersBuilder struct { + bitmap_ uint32 + items []*AddonInstallationParameterBuilder +} + +// NewAddonInstallationParameters creates a new builder of 'addon_installation_parameters' objects. +func NewAddonInstallationParameters() *AddonInstallationParametersBuilder { + return &AddonInstallationParametersBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonInstallationParametersBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Items sets the value of the 'items' attribute to the given values. +func (b *AddonInstallationParametersBuilder) Items(values ...*AddonInstallationParameterBuilder) *AddonInstallationParametersBuilder { + b.items = make([]*AddonInstallationParameterBuilder, len(values)) + copy(b.items, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonInstallationParametersBuilder) Copy(object *AddonInstallationParameters) *AddonInstallationParametersBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.items != nil { + b.items = make([]*AddonInstallationParameterBuilder, len(object.items)) + for i, v := range object.items { + b.items[i] = NewAddonInstallationParameter().Copy(v) + } + } else { + b.items = nil + } + return b +} + +// Build creates a 'addon_installation_parameters' object using the configuration stored in the builder. +func (b *AddonInstallationParametersBuilder) Build() (object *AddonInstallationParameters, err error) { + object = new(AddonInstallationParameters) + object.bitmap_ = b.bitmap_ + if b.items != nil { + object.items = make([]*AddonInstallationParameter, len(b.items)) + for i, v := range b.items { + object.items[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_parameters_list_builder.go b/clientapi/addonsmgmt/v1/addon_installation_parameters_list_builder.go new file mode 100644 index 00000000..d7d6d492 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_parameters_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonInstallationParametersListBuilder contains the data and logic needed to build +// 'addon_installation_parameters' objects. +type AddonInstallationParametersListBuilder struct { + items []*AddonInstallationParametersBuilder +} + +// NewAddonInstallationParametersList creates a new builder of 'addon_installation_parameters' objects. +func NewAddonInstallationParametersList() *AddonInstallationParametersListBuilder { + return new(AddonInstallationParametersListBuilder) +} + +// Items sets the items of the list. +func (b *AddonInstallationParametersListBuilder) Items(values ...*AddonInstallationParametersBuilder) *AddonInstallationParametersListBuilder { + b.items = make([]*AddonInstallationParametersBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonInstallationParametersListBuilder) 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 *AddonInstallationParametersListBuilder) Copy(list *AddonInstallationParametersList) *AddonInstallationParametersListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonInstallationParametersBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonInstallationParameters().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_installation_parameters' objects using the +// configuration stored in the builder. +func (b *AddonInstallationParametersListBuilder) Build() (list *AddonInstallationParametersList, err error) { + items := make([]*AddonInstallationParameters, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonInstallationParametersList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_parameters_list_type_json.go b/clientapi/addonsmgmt/v1/addon_installation_parameters_list_type_json.go new file mode 100644 index 00000000..35c0f2c5 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_parameters_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonInstallationParametersList writes a list of values of the 'addon_installation_parameters' type to +// the given writer. +func MarshalAddonInstallationParametersList(list []*AddonInstallationParameters, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonInstallationParametersList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonInstallationParametersList writes a list of value of the 'addon_installation_parameters' type to +// the given stream. +func WriteAddonInstallationParametersList(list []*AddonInstallationParameters, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonInstallationParameters(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonInstallationParametersList reads a list of values of the 'addon_installation_parameters' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonInstallationParametersList(source interface{}) (items []*AddonInstallationParameters, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonInstallationParametersList(iterator) + err = iterator.Error + return +} + +// ReadAddonInstallationParametersList reads list of values of the ”addon_installation_parameters' type from +// the given iterator. +func ReadAddonInstallationParametersList(iterator *jsoniter.Iterator) []*AddonInstallationParameters { + list := []*AddonInstallationParameters{} + for iterator.ReadArray() { + item := ReadAddonInstallationParameters(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_parameters_type.go b/clientapi/addonsmgmt/v1/addon_installation_parameters_type.go new file mode 100644 index 00000000..27809b51 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_parameters_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonInstallationParameters represents the values of the 'addon_installation_parameters' type. +// +// representation of addon installation parameter +type AddonInstallationParameters struct { + bitmap_ uint32 + items []*AddonInstallationParameter +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonInstallationParameters) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Items returns the value of the 'items' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// list of addon installation parameters +func (o *AddonInstallationParameters) Items() []*AddonInstallationParameter { + if o != nil && o.bitmap_&1 != 0 { + return o.items + } + return nil +} + +// GetItems returns the value of the 'items' attribute and +// a flag indicating if the attribute has a value. +// +// list of addon installation parameters +func (o *AddonInstallationParameters) GetItems() (value []*AddonInstallationParameter, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.items + } + return +} + +// AddonInstallationParametersListKind is the name of the type used to represent list of objects of +// type 'addon_installation_parameters'. +const AddonInstallationParametersListKind = "AddonInstallationParametersList" + +// AddonInstallationParametersListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_installation_parameters'. +const AddonInstallationParametersListLinkKind = "AddonInstallationParametersListLink" + +// AddonInstallationParametersNilKind is the name of the type used to nil lists of objects of +// type 'addon_installation_parameters'. +const AddonInstallationParametersListNilKind = "AddonInstallationParametersListNil" + +// AddonInstallationParametersList is a list of values of the 'addon_installation_parameters' type. +type AddonInstallationParametersList struct { + href string + link bool + items []*AddonInstallationParameters +} + +// Len returns the length of the list. +func (l *AddonInstallationParametersList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonInstallationParametersList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonInstallationParametersList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonInstallationParametersList) SetItems(items []*AddonInstallationParameters) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonInstallationParametersList) Items() []*AddonInstallationParameters { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonInstallationParametersList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonInstallationParametersList) Get(i int) *AddonInstallationParameters { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonInstallationParametersList) Slice() []*AddonInstallationParameters { + var slice []*AddonInstallationParameters + if l == nil { + slice = make([]*AddonInstallationParameters, 0) + } else { + slice = make([]*AddonInstallationParameters, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonInstallationParametersList) Each(f func(item *AddonInstallationParameters) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonInstallationParametersList) Range(f func(index int, item *AddonInstallationParameters) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_parameters_type_json.go b/clientapi/addonsmgmt/v1/addon_installation_parameters_type_json.go new file mode 100644 index 00000000..8b19b255 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_parameters_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonInstallationParameters writes a value of the 'addon_installation_parameters' type to the given writer. +func MarshalAddonInstallationParameters(object *AddonInstallationParameters, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonInstallationParameters(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonInstallationParameters writes a value of the 'addon_installation_parameters' type to the given stream. +func WriteAddonInstallationParameters(object *AddonInstallationParameters, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.items != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("items") + WriteAddonInstallationParameterList(object.items, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonInstallationParameters reads a value of the 'addon_installation_parameters' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonInstallationParameters(source interface{}) (object *AddonInstallationParameters, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonInstallationParameters(iterator) + err = iterator.Error + return +} + +// ReadAddonInstallationParameters reads a value of the 'addon_installation_parameters' type from the given iterator. +func ReadAddonInstallationParameters(iterator *jsoniter.Iterator) *AddonInstallationParameters { + object := &AddonInstallationParameters{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "items": + value := ReadAddonInstallationParameterList(iterator) + object.items = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_state_list_type_json.go b/clientapi/addonsmgmt/v1/addon_installation_state_list_type_json.go new file mode 100644 index 00000000..4188015a --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_state_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonInstallationStateList writes a list of values of the 'addon_installation_state' type to +// the given writer. +func MarshalAddonInstallationStateList(list []AddonInstallationState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonInstallationStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonInstallationStateList writes a list of value of the 'addon_installation_state' type to +// the given stream. +func WriteAddonInstallationStateList(list []AddonInstallationState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonInstallationStateList reads a list of values of the 'addon_installation_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonInstallationStateList(source interface{}) (items []AddonInstallationState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonInstallationStateList(iterator) + err = iterator.Error + return +} + +// ReadAddonInstallationStateList reads list of values of the ”addon_installation_state' type from +// the given iterator. +func ReadAddonInstallationStateList(iterator *jsoniter.Iterator) []AddonInstallationState { + list := []AddonInstallationState{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := AddonInstallationState(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_state_type.go b/clientapi/addonsmgmt/v1/addon_installation_state_type.go new file mode 100644 index 00000000..0bb32eb2 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_state_type.go @@ -0,0 +1,46 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonInstallationState represents the values of the 'addon_installation_state' enumerated type. +type AddonInstallationState string + +const ( + // + AddonInstallationStateDeleteFailed AddonInstallationState = "delete-failed" + // + AddonInstallationStateDeletePending AddonInstallationState = "delete-pending" + // + AddonInstallationStateDeleted AddonInstallationState = "deleted" + // + AddonInstallationStateDeleting AddonInstallationState = "deleting" + // + AddonInstallationStateFailed AddonInstallationState = "failed" + // + AddonInstallationStateInstalling AddonInstallationState = "installing" + // + AddonInstallationStatePending AddonInstallationState = "pending" + // + AddonInstallationStateReady AddonInstallationState = "ready" + // + AddonInstallationStateUndefined AddonInstallationState = "undefined" + // + AddonInstallationStateUpgrading AddonInstallationState = "upgrading" +) diff --git a/clientapi/addonsmgmt/v1/addon_installation_type.go b/clientapi/addonsmgmt/v1/addon_installation_type.go new file mode 100644 index 00000000..8aa6525e --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_type.go @@ -0,0 +1,557 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + time "time" +) + +// AddonInstallationKind is the name of the type used to represent objects +// of type 'addon_installation'. +const AddonInstallationKind = "AddonInstallation" + +// AddonInstallationLinkKind is the name of the type used to represent links +// to objects of type 'addon_installation'. +const AddonInstallationLinkKind = "AddonInstallationLink" + +// AddonInstallationNilKind is the name of the type used to nil references +// to objects of type 'addon_installation'. +const AddonInstallationNilKind = "AddonInstallationNil" + +// AddonInstallation represents the values of the 'addon_installation' type. +// +// Representation of addon installation +type AddonInstallation struct { + bitmap_ uint32 + id string + href string + addon *Addon + addonVersion *AddonVersion + billing *AddonInstallationBilling + creationTimestamp time.Time + csvName string + deletedTimestamp time.Time + desiredVersion string + operatorVersion string + parameters *AddonInstallationParameterList + state AddonInstallationState + stateDescription string + subscription *ObjectReference + updatedTimestamp time.Time +} + +// Kind returns the name of the type of the object. +func (o *AddonInstallation) Kind() string { + if o == nil { + return AddonInstallationNilKind + } + if o.bitmap_&1 != 0 { + return AddonInstallationLinkKind + } + return AddonInstallationKind +} + +// Link returns true if this is a link. +func (o *AddonInstallation) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddonInstallation) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddonInstallation) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddonInstallation) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddonInstallation) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonInstallation) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Addon returns the value of the 'addon' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Addon installed +func (o *AddonInstallation) Addon() *Addon { + if o != nil && o.bitmap_&8 != 0 { + return o.addon + } + return nil +} + +// GetAddon returns the value of the 'addon' attribute and +// a flag indicating if the attribute has a value. +// +// Addon installed +func (o *AddonInstallation) GetAddon() (value *Addon, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.addon + } + return +} + +// AddonVersion returns the value of the 'addon_version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Addon version of the addon +func (o *AddonInstallation) AddonVersion() *AddonVersion { + if o != nil && o.bitmap_&16 != 0 { + return o.addonVersion + } + return nil +} + +// GetAddonVersion returns the value of the 'addon_version' attribute and +// a flag indicating if the attribute has a value. +// +// Addon version of the addon +func (o *AddonInstallation) GetAddonVersion() (value *AddonVersion, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.addonVersion + } + return +} + +// Billing returns the value of the 'billing' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Billing of addon installation. +func (o *AddonInstallation) Billing() *AddonInstallationBilling { + if o != nil && o.bitmap_&32 != 0 { + return o.billing + } + return nil +} + +// GetBilling returns the value of the 'billing' attribute and +// a flag indicating if the attribute has a value. +// +// Billing of addon installation. +func (o *AddonInstallation) GetBilling() (value *AddonInstallationBilling, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.billing + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the add-on was initially installed in the cluster. +func (o *AddonInstallation) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the add-on was initially installed in the cluster. +func (o *AddonInstallation) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// CsvName returns the value of the 'csv_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Current CSV installed on cluster +func (o *AddonInstallation) CsvName() string { + if o != nil && o.bitmap_&128 != 0 { + return o.csvName + } + return "" +} + +// GetCsvName returns the value of the 'csv_name' attribute and +// a flag indicating if the attribute has a value. +// +// Current CSV installed on cluster +func (o *AddonInstallation) GetCsvName() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.csvName + } + return +} + +// DeletedTimestamp returns the value of the 'deleted_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the add-on installation deleted at. +func (o *AddonInstallation) DeletedTimestamp() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.deletedTimestamp + } + return time.Time{} +} + +// GetDeletedTimestamp returns the value of the 'deleted_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the add-on installation deleted at. +func (o *AddonInstallation) GetDeletedTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.deletedTimestamp + } + return +} + +// DesiredVersion returns the value of the 'desired_version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Version of the next scheduled upgrade +func (o *AddonInstallation) DesiredVersion() string { + if o != nil && o.bitmap_&512 != 0 { + return o.desiredVersion + } + return "" +} + +// GetDesiredVersion returns the value of the 'desired_version' attribute and +// a flag indicating if the attribute has a value. +// +// Version of the next scheduled upgrade +func (o *AddonInstallation) GetDesiredVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.desiredVersion + } + return +} + +// OperatorVersion returns the value of the 'operator_version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Version of the operator installed by the add-on. +func (o *AddonInstallation) OperatorVersion() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.operatorVersion + } + return "" +} + +// GetOperatorVersion returns the value of the 'operator_version' attribute and +// a flag indicating if the attribute has a value. +// +// Version of the operator installed by the add-on. +func (o *AddonInstallation) GetOperatorVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.operatorVersion + } + return +} + +// Parameters returns the value of the 'parameters' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Parameters in the installation +func (o *AddonInstallation) Parameters() *AddonInstallationParameterList { + if o != nil && o.bitmap_&2048 != 0 { + return o.parameters + } + return nil +} + +// GetParameters returns the value of the 'parameters' attribute and +// a flag indicating if the attribute has a value. +// +// Parameters in the installation +func (o *AddonInstallation) GetParameters() (value *AddonInstallationParameterList, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.parameters + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Addon Installation State +func (o *AddonInstallation) State() AddonInstallationState { + if o != nil && o.bitmap_&4096 != 0 { + return o.state + } + return AddonInstallationState("") +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// Addon Installation State +func (o *AddonInstallation) GetState() (value AddonInstallationState, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.state + } + return +} + +// StateDescription returns the value of the 'state_description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Reason for the current State. +func (o *AddonInstallation) StateDescription() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.stateDescription + } + return "" +} + +// GetStateDescription returns the value of the 'state_description' attribute and +// a flag indicating if the attribute has a value. +// +// Reason for the current State. +func (o *AddonInstallation) GetStateDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.stateDescription + } + return +} + +// Subscription returns the value of the 'subscription' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Subscription for the addon installation +func (o *AddonInstallation) Subscription() *ObjectReference { + if o != nil && o.bitmap_&16384 != 0 { + return o.subscription + } + return nil +} + +// GetSubscription returns the value of the 'subscription' attribute and +// a flag indicating if the attribute has a value. +// +// Subscription for the addon installation +func (o *AddonInstallation) GetSubscription() (value *ObjectReference, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.subscription + } + return +} + +// UpdatedTimestamp returns the value of the 'updated_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the add-on installation information was last updated. +func (o *AddonInstallation) UpdatedTimestamp() time.Time { + if o != nil && o.bitmap_&32768 != 0 { + return o.updatedTimestamp + } + return time.Time{} +} + +// GetUpdatedTimestamp returns the value of the 'updated_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the add-on installation information was last updated. +func (o *AddonInstallation) GetUpdatedTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.updatedTimestamp + } + return +} + +// AddonInstallationListKind is the name of the type used to represent list of objects of +// type 'addon_installation'. +const AddonInstallationListKind = "AddonInstallationList" + +// AddonInstallationListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_installation'. +const AddonInstallationListLinkKind = "AddonInstallationListLink" + +// AddonInstallationNilKind is the name of the type used to nil lists of objects of +// type 'addon_installation'. +const AddonInstallationListNilKind = "AddonInstallationListNil" + +// AddonInstallationList is a list of values of the 'addon_installation' type. +type AddonInstallationList struct { + href string + link bool + items []*AddonInstallation +} + +// Kind returns the name of the type of the object. +func (l *AddonInstallationList) Kind() string { + if l == nil { + return AddonInstallationListNilKind + } + if l.link { + return AddonInstallationListLinkKind + } + return AddonInstallationListKind +} + +// Link returns true iif this is a link. +func (l *AddonInstallationList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddonInstallationList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddonInstallationList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddonInstallationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonInstallationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonInstallationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonInstallationList) SetItems(items []*AddonInstallation) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonInstallationList) Items() []*AddonInstallation { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonInstallationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonInstallationList) Get(i int) *AddonInstallation { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonInstallationList) Slice() []*AddonInstallation { + var slice []*AddonInstallation + if l == nil { + slice = make([]*AddonInstallation, 0) + } else { + slice = make([]*AddonInstallation, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonInstallationList) Each(f func(item *AddonInstallation) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonInstallationList) Range(f func(index int, item *AddonInstallation) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_installation_type_json.go b/clientapi/addonsmgmt/v1/addon_installation_type_json.go new file mode 100644 index 00000000..d122535c --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_installation_type_json.go @@ -0,0 +1,310 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonInstallation writes a value of the 'addon_installation' type to the given writer. +func MarshalAddonInstallation(object *AddonInstallation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonInstallation(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonInstallation writes a value of the 'addon_installation' type to the given stream. +func WriteAddonInstallation(object *AddonInstallation, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddonInstallationLinkKind) + } else { + stream.WriteString(AddonInstallationKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.addon != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("addon") + WriteAddon(object.addon, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.addonVersion != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("addon_version") + WriteAddonVersion(object.addonVersion, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.billing != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing") + WriteAddonInstallationBilling(object.billing, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("csv_name") + stream.WriteString(object.csvName) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deleted_timestamp") + stream.WriteString((object.deletedTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("desired_version") + stream.WriteString(object.desiredVersion) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_version") + stream.WriteString(object.operatorVersion) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.parameters != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("parameters") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteAddonInstallationParameterList(object.parameters.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(string(object.state)) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state_description") + stream.WriteString(object.stateDescription) + count++ + } + present_ = object.bitmap_&16384 != 0 && object.subscription != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription") + WriteObjectReference(object.subscription, stream) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_timestamp") + stream.WriteString((object.updatedTimestamp).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonInstallation reads a value of the 'addon_installation' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonInstallation(source interface{}) (object *AddonInstallation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonInstallation(iterator) + err = iterator.Error + return +} + +// ReadAddonInstallation reads a value of the 'addon_installation' type from the given iterator. +func ReadAddonInstallation(iterator *jsoniter.Iterator) *AddonInstallation { + object := &AddonInstallation{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddonInstallationLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "addon": + value := ReadAddon(iterator) + object.addon = value + object.bitmap_ |= 8 + case "addon_version": + value := ReadAddonVersion(iterator) + object.addonVersion = value + object.bitmap_ |= 16 + case "billing": + value := ReadAddonInstallationBilling(iterator) + object.billing = value + object.bitmap_ |= 32 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 64 + case "csv_name": + value := iterator.ReadString() + object.csvName = value + object.bitmap_ |= 128 + case "deleted_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.deletedTimestamp = value + object.bitmap_ |= 256 + case "desired_version": + value := iterator.ReadString() + object.desiredVersion = value + object.bitmap_ |= 512 + case "operator_version": + value := iterator.ReadString() + object.operatorVersion = value + object.bitmap_ |= 1024 + case "parameters": + value := &AddonInstallationParameterList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == AddonInstallationParameterListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadAddonInstallationParameterList(iterator)) + default: + iterator.ReadAny() + } + } + object.parameters = value + object.bitmap_ |= 2048 + case "state": + text := iterator.ReadString() + value := AddonInstallationState(text) + object.state = value + object.bitmap_ |= 4096 + case "state_description": + value := iterator.ReadString() + object.stateDescription = value + object.bitmap_ |= 8192 + case "subscription": + value := ReadObjectReference(iterator) + object.subscription = value + object.bitmap_ |= 16384 + case "updated_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.updatedTimestamp = value + object.bitmap_ |= 32768 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_list_builder.go b/clientapi/addonsmgmt/v1/addon_list_builder.go new file mode 100644 index 00000000..86f0c8cd --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonListBuilder contains the data and logic needed to build +// 'addon' objects. +type AddonListBuilder struct { + items []*AddonBuilder +} + +// NewAddonList creates a new builder of 'addon' objects. +func NewAddonList() *AddonListBuilder { + return new(AddonListBuilder) +} + +// Items sets the items of the list. +func (b *AddonListBuilder) Items(values ...*AddonBuilder) *AddonListBuilder { + b.items = make([]*AddonBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonListBuilder) 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 *AddonListBuilder) Copy(list *AddonList) *AddonListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddon().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon' objects using the +// configuration stored in the builder. +func (b *AddonListBuilder) Build() (list *AddonList, err error) { + items := make([]*Addon, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_list_type_json.go b/clientapi/addonsmgmt/v1/addon_list_type_json.go new file mode 100644 index 00000000..941567ca --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonList writes a list of values of the 'addon' type to +// the given writer. +func MarshalAddonList(list []*Addon, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonList writes a list of value of the 'addon' type to +// the given stream. +func WriteAddonList(list []*Addon, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddon(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonList reads a list of values of the 'addon' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonList(source interface{}) (items []*Addon, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonList(iterator) + err = iterator.Error + return +} + +// ReadAddonList reads list of values of the ”addon' type from +// the given iterator. +func ReadAddonList(iterator *jsoniter.Iterator) []*Addon { + list := []*Addon{} + for iterator.ReadArray() { + item := ReadAddon(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_namespace_builder.go b/clientapi/addonsmgmt/v1/addon_namespace_builder.go new file mode 100644 index 00000000..174ea4a0 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_namespace_builder.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonNamespaceBuilder contains the data and logic needed to build 'addon_namespace' objects. +// +// Representation of an addon namespace object. +type AddonNamespaceBuilder struct { + bitmap_ uint32 + annotations map[string]string + labels map[string]string + name string + enabled bool +} + +// NewAddonNamespace creates a new builder of 'addon_namespace' objects. +func NewAddonNamespace() *AddonNamespaceBuilder { + return &AddonNamespaceBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonNamespaceBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Annotations sets the value of the 'annotations' attribute to the given value. +func (b *AddonNamespaceBuilder) Annotations(value map[string]string) *AddonNamespaceBuilder { + b.annotations = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddonNamespaceBuilder) Enabled(value bool) *AddonNamespaceBuilder { + b.enabled = value + b.bitmap_ |= 2 + return b +} + +// Labels sets the value of the 'labels' attribute to the given value. +func (b *AddonNamespaceBuilder) Labels(value map[string]string) *AddonNamespaceBuilder { + b.labels = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AddonNamespaceBuilder) Name(value string) *AddonNamespaceBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonNamespaceBuilder) Copy(object *AddonNamespace) *AddonNamespaceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if len(object.annotations) > 0 { + b.annotations = map[string]string{} + for k, v := range object.annotations { + b.annotations[k] = v + } + } else { + b.annotations = nil + } + b.enabled = object.enabled + if len(object.labels) > 0 { + b.labels = map[string]string{} + for k, v := range object.labels { + b.labels[k] = v + } + } else { + b.labels = nil + } + b.name = object.name + return b +} + +// Build creates a 'addon_namespace' object using the configuration stored in the builder. +func (b *AddonNamespaceBuilder) Build() (object *AddonNamespace, err error) { + object = new(AddonNamespace) + object.bitmap_ = b.bitmap_ + if b.annotations != nil { + object.annotations = make(map[string]string) + for k, v := range b.annotations { + object.annotations[k] = v + } + } + object.enabled = b.enabled + if b.labels != nil { + object.labels = make(map[string]string) + for k, v := range b.labels { + object.labels[k] = v + } + } + object.name = b.name + return +} diff --git a/clientapi/addonsmgmt/v1/addon_namespace_list_builder.go b/clientapi/addonsmgmt/v1/addon_namespace_list_builder.go new file mode 100644 index 00000000..4c1b16cb --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_namespace_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonNamespaceListBuilder contains the data and logic needed to build +// 'addon_namespace' objects. +type AddonNamespaceListBuilder struct { + items []*AddonNamespaceBuilder +} + +// NewAddonNamespaceList creates a new builder of 'addon_namespace' objects. +func NewAddonNamespaceList() *AddonNamespaceListBuilder { + return new(AddonNamespaceListBuilder) +} + +// Items sets the items of the list. +func (b *AddonNamespaceListBuilder) Items(values ...*AddonNamespaceBuilder) *AddonNamespaceListBuilder { + b.items = make([]*AddonNamespaceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonNamespaceListBuilder) 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 *AddonNamespaceListBuilder) Copy(list *AddonNamespaceList) *AddonNamespaceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonNamespaceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonNamespace().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_namespace' objects using the +// configuration stored in the builder. +func (b *AddonNamespaceListBuilder) Build() (list *AddonNamespaceList, err error) { + items := make([]*AddonNamespace, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonNamespaceList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_namespace_list_type_json.go b/clientapi/addonsmgmt/v1/addon_namespace_list_type_json.go new file mode 100644 index 00000000..82a72a48 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_namespace_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonNamespaceList writes a list of values of the 'addon_namespace' type to +// the given writer. +func MarshalAddonNamespaceList(list []*AddonNamespace, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonNamespaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonNamespaceList writes a list of value of the 'addon_namespace' type to +// the given stream. +func WriteAddonNamespaceList(list []*AddonNamespace, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonNamespace(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonNamespaceList reads a list of values of the 'addon_namespace' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonNamespaceList(source interface{}) (items []*AddonNamespace, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonNamespaceList(iterator) + err = iterator.Error + return +} + +// ReadAddonNamespaceList reads list of values of the ”addon_namespace' type from +// the given iterator. +func ReadAddonNamespaceList(iterator *jsoniter.Iterator) []*AddonNamespace { + list := []*AddonNamespace{} + for iterator.ReadArray() { + item := ReadAddonNamespace(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_namespace_type.go b/clientapi/addonsmgmt/v1/addon_namespace_type.go new file mode 100644 index 00000000..2a4e404e --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_namespace_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonNamespace represents the values of the 'addon_namespace' type. +// +// Representation of an addon namespace object. +type AddonNamespace struct { + bitmap_ uint32 + annotations map[string]string + labels map[string]string + name string + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonNamespace) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Annotations returns the value of the 'annotations' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Annotations to be included in the addon namespace +func (o *AddonNamespace) Annotations() map[string]string { + if o != nil && o.bitmap_&1 != 0 { + return o.annotations + } + return nil +} + +// GetAnnotations returns the value of the 'annotations' attribute and +// a flag indicating if the attribute has a value. +// +// Annotations to be included in the addon namespace +func (o *AddonNamespace) GetAnnotations() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.annotations + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Enabled shows if this namespace object is in use +func (o *AddonNamespace) Enabled() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Enabled shows if this namespace object is in use +func (o *AddonNamespace) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.enabled + } + return +} + +// Labels returns the value of the 'labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Labels to be included in the addon namespace +func (o *AddonNamespace) Labels() map[string]string { + if o != nil && o.bitmap_&4 != 0 { + return o.labels + } + return nil +} + +// GetLabels returns the value of the 'labels' attribute and +// a flag indicating if the attribute has a value. +// +// Labels to be included in the addon namespace +func (o *AddonNamespace) GetLabels() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.labels + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the namespace +func (o *AddonNamespace) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the namespace +func (o *AddonNamespace) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// AddonNamespaceListKind is the name of the type used to represent list of objects of +// type 'addon_namespace'. +const AddonNamespaceListKind = "AddonNamespaceList" + +// AddonNamespaceListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_namespace'. +const AddonNamespaceListLinkKind = "AddonNamespaceListLink" + +// AddonNamespaceNilKind is the name of the type used to nil lists of objects of +// type 'addon_namespace'. +const AddonNamespaceListNilKind = "AddonNamespaceListNil" + +// AddonNamespaceList is a list of values of the 'addon_namespace' type. +type AddonNamespaceList struct { + href string + link bool + items []*AddonNamespace +} + +// Len returns the length of the list. +func (l *AddonNamespaceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonNamespaceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonNamespaceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonNamespaceList) SetItems(items []*AddonNamespace) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonNamespaceList) Items() []*AddonNamespace { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonNamespaceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonNamespaceList) Get(i int) *AddonNamespace { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonNamespaceList) Slice() []*AddonNamespace { + var slice []*AddonNamespace + if l == nil { + slice = make([]*AddonNamespace, 0) + } else { + slice = make([]*AddonNamespace, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonNamespaceList) Each(f func(item *AddonNamespace) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonNamespaceList) Range(f func(index int, item *AddonNamespace) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_namespace_type_json.go b/clientapi/addonsmgmt/v1/addon_namespace_type_json.go new file mode 100644 index 00000000..4690926e --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_namespace_type_json.go @@ -0,0 +1,182 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonNamespace writes a value of the 'addon_namespace' type to the given writer. +func MarshalAddonNamespace(object *AddonNamespace, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonNamespace(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonNamespace writes a value of the 'addon_namespace' type to the given stream. +func WriteAddonNamespace(object *AddonNamespace, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.annotations != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("annotations") + if object.annotations != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.annotations)) + i := 0 + for key := range object.annotations { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.annotations[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&4 != 0 && object.labels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("labels") + if object.labels != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.labels)) + i := 0 + for key := range object.labels { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.labels[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonNamespace reads a value of the 'addon_namespace' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonNamespace(source interface{}) (object *AddonNamespace, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonNamespace(iterator) + err = iterator.Error + return +} + +// ReadAddonNamespace reads a value of the 'addon_namespace' type from the given iterator. +func ReadAddonNamespace(iterator *jsoniter.Iterator) *AddonNamespace { + object := &AddonNamespace{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "annotations": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.annotations = value + object.bitmap_ |= 1 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 2 + case "labels": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.labels = value + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_parameter_builder.go b/clientapi/addonsmgmt/v1/addon_parameter_builder.go new file mode 100644 index 00000000..83252b38 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameter_builder.go @@ -0,0 +1,252 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonParameterBuilder contains the data and logic needed to build 'addon_parameter' objects. +// +// Representation of an addon parameter. +type AddonParameterBuilder struct { + bitmap_ uint32 + id string + addon *AddonBuilder + conditions []*AddonRequirementBuilder + defaultValue string + description string + editableDirection string + name string + options []*AddonParameterOptionBuilder + order int + validation string + validationErrMsg string + valueType AddonParameterValueType + editable bool + enabled bool + required bool +} + +// NewAddonParameter creates a new builder of 'addon_parameter' objects. +func NewAddonParameter() *AddonParameterBuilder { + return &AddonParameterBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonParameterBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *AddonParameterBuilder) ID(value string) *AddonParameterBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// Addon sets the value of the 'addon' attribute to the given value. +// +// Representation of an addon that can be installed in a cluster. +func (b *AddonParameterBuilder) Addon(value *AddonBuilder) *AddonParameterBuilder { + b.addon = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// Conditions sets the value of the 'conditions' attribute to the given values. +func (b *AddonParameterBuilder) Conditions(values ...*AddonRequirementBuilder) *AddonParameterBuilder { + b.conditions = make([]*AddonRequirementBuilder, len(values)) + copy(b.conditions, values) + b.bitmap_ |= 4 + return b +} + +// DefaultValue sets the value of the 'default_value' attribute to the given value. +func (b *AddonParameterBuilder) DefaultValue(value string) *AddonParameterBuilder { + b.defaultValue = value + b.bitmap_ |= 8 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *AddonParameterBuilder) Description(value string) *AddonParameterBuilder { + b.description = value + b.bitmap_ |= 16 + return b +} + +// Editable sets the value of the 'editable' attribute to the given value. +func (b *AddonParameterBuilder) Editable(value bool) *AddonParameterBuilder { + b.editable = value + b.bitmap_ |= 32 + return b +} + +// EditableDirection sets the value of the 'editable_direction' attribute to the given value. +func (b *AddonParameterBuilder) EditableDirection(value string) *AddonParameterBuilder { + b.editableDirection = value + b.bitmap_ |= 64 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddonParameterBuilder) Enabled(value bool) *AddonParameterBuilder { + b.enabled = value + b.bitmap_ |= 128 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AddonParameterBuilder) Name(value string) *AddonParameterBuilder { + b.name = value + b.bitmap_ |= 256 + return b +} + +// Options sets the value of the 'options' attribute to the given values. +func (b *AddonParameterBuilder) Options(values ...*AddonParameterOptionBuilder) *AddonParameterBuilder { + b.options = make([]*AddonParameterOptionBuilder, len(values)) + copy(b.options, values) + b.bitmap_ |= 512 + return b +} + +// Order sets the value of the 'order' attribute to the given value. +func (b *AddonParameterBuilder) Order(value int) *AddonParameterBuilder { + b.order = value + b.bitmap_ |= 1024 + return b +} + +// Required sets the value of the 'required' attribute to the given value. +func (b *AddonParameterBuilder) Required(value bool) *AddonParameterBuilder { + b.required = value + b.bitmap_ |= 2048 + return b +} + +// Validation sets the value of the 'validation' attribute to the given value. +func (b *AddonParameterBuilder) Validation(value string) *AddonParameterBuilder { + b.validation = value + b.bitmap_ |= 4096 + return b +} + +// ValidationErrMsg sets the value of the 'validation_err_msg' attribute to the given value. +func (b *AddonParameterBuilder) ValidationErrMsg(value string) *AddonParameterBuilder { + b.validationErrMsg = value + b.bitmap_ |= 8192 + return b +} + +// ValueType sets the value of the 'value_type' attribute to the given value. +// +// Representation of the value type for this specific addon parameter +func (b *AddonParameterBuilder) ValueType(value AddonParameterValueType) *AddonParameterBuilder { + b.valueType = value + b.bitmap_ |= 16384 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonParameterBuilder) Copy(object *AddonParameter) *AddonParameterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + if object.addon != nil { + b.addon = NewAddon().Copy(object.addon) + } else { + b.addon = nil + } + if object.conditions != nil { + b.conditions = make([]*AddonRequirementBuilder, len(object.conditions)) + for i, v := range object.conditions { + b.conditions[i] = NewAddonRequirement().Copy(v) + } + } else { + b.conditions = nil + } + b.defaultValue = object.defaultValue + b.description = object.description + b.editable = object.editable + b.editableDirection = object.editableDirection + b.enabled = object.enabled + b.name = object.name + if object.options != nil { + b.options = make([]*AddonParameterOptionBuilder, len(object.options)) + for i, v := range object.options { + b.options[i] = NewAddonParameterOption().Copy(v) + } + } else { + b.options = nil + } + b.order = object.order + b.required = object.required + b.validation = object.validation + b.validationErrMsg = object.validationErrMsg + b.valueType = object.valueType + return b +} + +// Build creates a 'addon_parameter' object using the configuration stored in the builder. +func (b *AddonParameterBuilder) Build() (object *AddonParameter, err error) { + object = new(AddonParameter) + object.bitmap_ = b.bitmap_ + object.id = b.id + if b.addon != nil { + object.addon, err = b.addon.Build() + if err != nil { + return + } + } + if b.conditions != nil { + object.conditions = make([]*AddonRequirement, len(b.conditions)) + for i, v := range b.conditions { + object.conditions[i], err = v.Build() + if err != nil { + return + } + } + } + object.defaultValue = b.defaultValue + object.description = b.description + object.editable = b.editable + object.editableDirection = b.editableDirection + object.enabled = b.enabled + object.name = b.name + if b.options != nil { + object.options = make([]*AddonParameterOption, len(b.options)) + for i, v := range b.options { + object.options[i], err = v.Build() + if err != nil { + return + } + } + } + object.order = b.order + object.required = b.required + object.validation = b.validation + object.validationErrMsg = b.validationErrMsg + object.valueType = b.valueType + return +} diff --git a/clientapi/addonsmgmt/v1/addon_parameter_list_builder.go b/clientapi/addonsmgmt/v1/addon_parameter_list_builder.go new file mode 100644 index 00000000..0a1cf85e --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameter_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonParameterListBuilder contains the data and logic needed to build +// 'addon_parameter' objects. +type AddonParameterListBuilder struct { + items []*AddonParameterBuilder +} + +// NewAddonParameterList creates a new builder of 'addon_parameter' objects. +func NewAddonParameterList() *AddonParameterListBuilder { + return new(AddonParameterListBuilder) +} + +// Items sets the items of the list. +func (b *AddonParameterListBuilder) Items(values ...*AddonParameterBuilder) *AddonParameterListBuilder { + b.items = make([]*AddonParameterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonParameterListBuilder) 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 *AddonParameterListBuilder) Copy(list *AddonParameterList) *AddonParameterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonParameterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonParameter().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_parameter' objects using the +// configuration stored in the builder. +func (b *AddonParameterListBuilder) Build() (list *AddonParameterList, err error) { + items := make([]*AddonParameter, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonParameterList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_parameter_list_type_json.go b/clientapi/addonsmgmt/v1/addon_parameter_list_type_json.go new file mode 100644 index 00000000..a417509d --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameter_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonParameterList writes a list of values of the 'addon_parameter' type to +// the given writer. +func MarshalAddonParameterList(list []*AddonParameter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonParameterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonParameterList writes a list of value of the 'addon_parameter' type to +// the given stream. +func WriteAddonParameterList(list []*AddonParameter, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonParameter(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonParameterList reads a list of values of the 'addon_parameter' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonParameterList(source interface{}) (items []*AddonParameter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonParameterList(iterator) + err = iterator.Error + return +} + +// ReadAddonParameterList reads list of values of the ”addon_parameter' type from +// the given iterator. +func ReadAddonParameterList(iterator *jsoniter.Iterator) []*AddonParameter { + list := []*AddonParameter{} + for iterator.ReadArray() { + item := ReadAddonParameter(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_parameter_option_builder.go b/clientapi/addonsmgmt/v1/addon_parameter_option_builder.go new file mode 100644 index 00000000..c0b93dd5 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameter_option_builder.go @@ -0,0 +1,109 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonParameterOptionBuilder contains the data and logic needed to build 'addon_parameter_option' objects. +// +// Representation of an addon parameter option. +type AddonParameterOptionBuilder struct { + bitmap_ uint32 + name string + rank int + requirements []*AddonRequirementBuilder + value string +} + +// NewAddonParameterOption creates a new builder of 'addon_parameter_option' objects. +func NewAddonParameterOption() *AddonParameterOptionBuilder { + return &AddonParameterOptionBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonParameterOptionBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AddonParameterOptionBuilder) Name(value string) *AddonParameterOptionBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Rank sets the value of the 'rank' attribute to the given value. +func (b *AddonParameterOptionBuilder) Rank(value int) *AddonParameterOptionBuilder { + b.rank = value + b.bitmap_ |= 2 + return b +} + +// Requirements sets the value of the 'requirements' attribute to the given values. +func (b *AddonParameterOptionBuilder) Requirements(values ...*AddonRequirementBuilder) *AddonParameterOptionBuilder { + b.requirements = make([]*AddonRequirementBuilder, len(values)) + copy(b.requirements, values) + b.bitmap_ |= 4 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *AddonParameterOptionBuilder) Value(value string) *AddonParameterOptionBuilder { + b.value = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonParameterOptionBuilder) Copy(object *AddonParameterOption) *AddonParameterOptionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + b.rank = object.rank + if object.requirements != nil { + b.requirements = make([]*AddonRequirementBuilder, len(object.requirements)) + for i, v := range object.requirements { + b.requirements[i] = NewAddonRequirement().Copy(v) + } + } else { + b.requirements = nil + } + b.value = object.value + return b +} + +// Build creates a 'addon_parameter_option' object using the configuration stored in the builder. +func (b *AddonParameterOptionBuilder) Build() (object *AddonParameterOption, err error) { + object = new(AddonParameterOption) + object.bitmap_ = b.bitmap_ + object.name = b.name + object.rank = b.rank + if b.requirements != nil { + object.requirements = make([]*AddonRequirement, len(b.requirements)) + for i, v := range b.requirements { + object.requirements[i], err = v.Build() + if err != nil { + return + } + } + } + object.value = b.value + return +} diff --git a/clientapi/addonsmgmt/v1/addon_parameter_option_list_builder.go b/clientapi/addonsmgmt/v1/addon_parameter_option_list_builder.go new file mode 100644 index 00000000..df80d27e --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameter_option_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonParameterOptionListBuilder contains the data and logic needed to build +// 'addon_parameter_option' objects. +type AddonParameterOptionListBuilder struct { + items []*AddonParameterOptionBuilder +} + +// NewAddonParameterOptionList creates a new builder of 'addon_parameter_option' objects. +func NewAddonParameterOptionList() *AddonParameterOptionListBuilder { + return new(AddonParameterOptionListBuilder) +} + +// Items sets the items of the list. +func (b *AddonParameterOptionListBuilder) Items(values ...*AddonParameterOptionBuilder) *AddonParameterOptionListBuilder { + b.items = make([]*AddonParameterOptionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonParameterOptionListBuilder) 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 *AddonParameterOptionListBuilder) Copy(list *AddonParameterOptionList) *AddonParameterOptionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonParameterOptionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonParameterOption().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_parameter_option' objects using the +// configuration stored in the builder. +func (b *AddonParameterOptionListBuilder) Build() (list *AddonParameterOptionList, err error) { + items := make([]*AddonParameterOption, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonParameterOptionList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_parameter_option_list_type_json.go b/clientapi/addonsmgmt/v1/addon_parameter_option_list_type_json.go new file mode 100644 index 00000000..6c01a2f8 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameter_option_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonParameterOptionList writes a list of values of the 'addon_parameter_option' type to +// the given writer. +func MarshalAddonParameterOptionList(list []*AddonParameterOption, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonParameterOptionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonParameterOptionList writes a list of value of the 'addon_parameter_option' type to +// the given stream. +func WriteAddonParameterOptionList(list []*AddonParameterOption, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonParameterOption(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonParameterOptionList reads a list of values of the 'addon_parameter_option' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonParameterOptionList(source interface{}) (items []*AddonParameterOption, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonParameterOptionList(iterator) + err = iterator.Error + return +} + +// ReadAddonParameterOptionList reads list of values of the ”addon_parameter_option' type from +// the given iterator. +func ReadAddonParameterOptionList(iterator *jsoniter.Iterator) []*AddonParameterOption { + list := []*AddonParameterOption{} + for iterator.ReadArray() { + item := ReadAddonParameterOption(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_parameter_option_type.go b/clientapi/addonsmgmt/v1/addon_parameter_option_type.go new file mode 100644 index 00000000..c766f458 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameter_option_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonParameterOption represents the values of the 'addon_parameter_option' type. +// +// Representation of an addon parameter option. +type AddonParameterOption struct { + bitmap_ uint32 + name string + rank int + requirements []*AddonRequirement + value string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonParameterOption) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the addon parameter option. +func (o *AddonParameterOption) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the addon parameter option. +func (o *AddonParameterOption) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Rank returns the value of the 'rank' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Rank of option to be used in cases where editable direction should be restricted. +func (o *AddonParameterOption) Rank() int { + if o != nil && o.bitmap_&2 != 0 { + return o.rank + } + return 0 +} + +// GetRank returns the value of the 'rank' attribute and +// a flag indicating if the attribute has a value. +// +// Rank of option to be used in cases where editable direction should be restricted. +func (o *AddonParameterOption) GetRank() (value int, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.rank + } + return +} + +// Requirements returns the value of the 'requirements' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of addon requirements for this parameter option. +func (o *AddonParameterOption) Requirements() []*AddonRequirement { + if o != nil && o.bitmap_&4 != 0 { + return o.requirements + } + return nil +} + +// GetRequirements returns the value of the 'requirements' attribute and +// a flag indicating if the attribute has a value. +// +// List of addon requirements for this parameter option. +func (o *AddonParameterOption) GetRequirements() (value []*AddonRequirement, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.requirements + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Value of the addon parameter option. +func (o *AddonParameterOption) Value() string { + if o != nil && o.bitmap_&8 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Value of the addon parameter option. +func (o *AddonParameterOption) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.value + } + return +} + +// AddonParameterOptionListKind is the name of the type used to represent list of objects of +// type 'addon_parameter_option'. +const AddonParameterOptionListKind = "AddonParameterOptionList" + +// AddonParameterOptionListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_parameter_option'. +const AddonParameterOptionListLinkKind = "AddonParameterOptionListLink" + +// AddonParameterOptionNilKind is the name of the type used to nil lists of objects of +// type 'addon_parameter_option'. +const AddonParameterOptionListNilKind = "AddonParameterOptionListNil" + +// AddonParameterOptionList is a list of values of the 'addon_parameter_option' type. +type AddonParameterOptionList struct { + href string + link bool + items []*AddonParameterOption +} + +// Len returns the length of the list. +func (l *AddonParameterOptionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonParameterOptionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonParameterOptionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonParameterOptionList) SetItems(items []*AddonParameterOption) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonParameterOptionList) Items() []*AddonParameterOption { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonParameterOptionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonParameterOptionList) Get(i int) *AddonParameterOption { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonParameterOptionList) Slice() []*AddonParameterOption { + var slice []*AddonParameterOption + if l == nil { + slice = make([]*AddonParameterOption, 0) + } else { + slice = make([]*AddonParameterOption, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonParameterOptionList) Each(f func(item *AddonParameterOption) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonParameterOptionList) Range(f func(index int, item *AddonParameterOption) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_parameter_option_type_json.go b/clientapi/addonsmgmt/v1/addon_parameter_option_type_json.go new file mode 100644 index 00000000..c56ac224 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameter_option_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonParameterOption writes a value of the 'addon_parameter_option' type to the given writer. +func MarshalAddonParameterOption(object *AddonParameterOption, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonParameterOption(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonParameterOption writes a value of the 'addon_parameter_option' type to the given stream. +func WriteAddonParameterOption(object *AddonParameterOption, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("rank") + stream.WriteInt(object.rank) + count++ + } + present_ = object.bitmap_&4 != 0 && object.requirements != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("requirements") + WriteAddonRequirementList(object.requirements, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonParameterOption reads a value of the 'addon_parameter_option' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonParameterOption(source interface{}) (object *AddonParameterOption, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonParameterOption(iterator) + err = iterator.Error + return +} + +// ReadAddonParameterOption reads a value of the 'addon_parameter_option' type from the given iterator. +func ReadAddonParameterOption(iterator *jsoniter.Iterator) *AddonParameterOption { + object := &AddonParameterOption{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "rank": + value := iterator.ReadInt() + object.rank = value + object.bitmap_ |= 2 + case "requirements": + value := ReadAddonRequirementList(iterator) + object.requirements = value + object.bitmap_ |= 4 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_parameter_type.go b/clientapi/addonsmgmt/v1/addon_parameter_type.go new file mode 100644 index 00000000..c77cdcfb --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameter_type.go @@ -0,0 +1,499 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonParameter represents the values of the 'addon_parameter' type. +// +// Representation of an addon parameter. +type AddonParameter struct { + bitmap_ uint32 + id string + addon *Addon + conditions []*AddonRequirement + defaultValue string + description string + editableDirection string + name string + options []*AddonParameterOption + order int + validation string + validationErrMsg string + valueType AddonParameterValueType + editable bool + enabled bool + required bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonParameter) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID for this addon parameter +func (o *AddonParameter) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID for this addon parameter +func (o *AddonParameter) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// Addon returns the value of the 'addon' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *AddonParameter) Addon() *Addon { + if o != nil && o.bitmap_&2 != 0 { + return o.addon + } + return nil +} + +// GetAddon returns the value of the 'addon' attribute and +// a flag indicating if the attribute has a value. +func (o *AddonParameter) GetAddon() (value *Addon, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.addon + } + return +} + +// Conditions returns the value of the 'conditions' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Conditions in which this parameter is valid for +func (o *AddonParameter) Conditions() []*AddonRequirement { + if o != nil && o.bitmap_&4 != 0 { + return o.conditions + } + return nil +} + +// GetConditions returns the value of the 'conditions' attribute and +// a flag indicating if the attribute has a value. +// +// Conditions in which this parameter is valid for +func (o *AddonParameter) GetConditions() (value []*AddonRequirement, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.conditions + } + return +} + +// DefaultValue returns the value of the 'default_value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the value default for the addon parameter. +func (o *AddonParameter) DefaultValue() string { + if o != nil && o.bitmap_&8 != 0 { + return o.defaultValue + } + return "" +} + +// GetDefaultValue returns the value of the 'default_value' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the value default for the addon parameter. +func (o *AddonParameter) GetDefaultValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.defaultValue + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Description of the addon parameter. +func (o *AddonParameter) Description() string { + if o != nil && o.bitmap_&16 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Description of the addon parameter. +func (o *AddonParameter) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.description + } + return +} + +// Editable returns the value of the 'editable' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this parameter can be edited after creation. +func (o *AddonParameter) Editable() bool { + if o != nil && o.bitmap_&32 != 0 { + return o.editable + } + return false +} + +// GetEditable returns the value of the 'editable' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this parameter can be edited after creation. +func (o *AddonParameter) GetEditable() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.editable + } + return +} + +// EditableDirection returns the value of the 'editable_direction' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Restricts if the parameter can be upscaled/downscaled +// Expected values are "up", "down", or "" (no restriction). +func (o *AddonParameter) EditableDirection() string { + if o != nil && o.bitmap_&64 != 0 { + return o.editableDirection + } + return "" +} + +// GetEditableDirection returns the value of the 'editable_direction' attribute and +// a flag indicating if the attribute has a value. +// +// Restricts if the parameter can be upscaled/downscaled +// Expected values are "up", "down", or "" (no restriction). +func (o *AddonParameter) GetEditableDirection() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.editableDirection + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this parameter is enabled for the addon. +func (o *AddonParameter) Enabled() bool { + if o != nil && o.bitmap_&128 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this parameter is enabled for the addon. +func (o *AddonParameter) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.enabled + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the addon parameter. +func (o *AddonParameter) Name() string { + if o != nil && o.bitmap_&256 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the addon parameter. +func (o *AddonParameter) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.name + } + return +} + +// Options returns the value of the 'options' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of options for the addon parameter value. +func (o *AddonParameter) Options() []*AddonParameterOption { + if o != nil && o.bitmap_&512 != 0 { + return o.options + } + return nil +} + +// GetOptions returns the value of the 'options' attribute and +// a flag indicating if the attribute has a value. +// +// List of options for the addon parameter value. +func (o *AddonParameter) GetOptions() (value []*AddonParameterOption, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.options + } + return +} + +// Order returns the value of the 'order' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the weight of the AddonParameter which would be used by sort order +func (o *AddonParameter) Order() int { + if o != nil && o.bitmap_&1024 != 0 { + return o.order + } + return 0 +} + +// GetOrder returns the value of the 'order' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the weight of the AddonParameter which would be used by sort order +func (o *AddonParameter) GetOrder() (value int, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.order + } + return +} + +// Required returns the value of the 'required' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this parameter is required by the addon. +func (o *AddonParameter) Required() bool { + if o != nil && o.bitmap_&2048 != 0 { + return o.required + } + return false +} + +// GetRequired returns the value of the 'required' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this parameter is required by the addon. +func (o *AddonParameter) GetRequired() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.required + } + return +} + +// Validation returns the value of the 'validation' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Validation rule for the addon parameter. +func (o *AddonParameter) Validation() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.validation + } + return "" +} + +// GetValidation returns the value of the 'validation' attribute and +// a flag indicating if the attribute has a value. +// +// Validation rule for the addon parameter. +func (o *AddonParameter) GetValidation() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.validation + } + return +} + +// ValidationErrMsg returns the value of the 'validation_err_msg' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Error message to return should the parameter be invalid. +func (o *AddonParameter) ValidationErrMsg() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.validationErrMsg + } + return "" +} + +// GetValidationErrMsg returns the value of the 'validation_err_msg' attribute and +// a flag indicating if the attribute has a value. +// +// Error message to return should the parameter be invalid. +func (o *AddonParameter) GetValidationErrMsg() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.validationErrMsg + } + return +} + +// ValueType returns the value of the 'value_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of value of the addon parameter. +func (o *AddonParameter) ValueType() AddonParameterValueType { + if o != nil && o.bitmap_&16384 != 0 { + return o.valueType + } + return AddonParameterValueType("") +} + +// GetValueType returns the value of the 'value_type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of value of the addon parameter. +func (o *AddonParameter) GetValueType() (value AddonParameterValueType, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.valueType + } + return +} + +// AddonParameterListKind is the name of the type used to represent list of objects of +// type 'addon_parameter'. +const AddonParameterListKind = "AddonParameterList" + +// AddonParameterListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_parameter'. +const AddonParameterListLinkKind = "AddonParameterListLink" + +// AddonParameterNilKind is the name of the type used to nil lists of objects of +// type 'addon_parameter'. +const AddonParameterListNilKind = "AddonParameterListNil" + +// AddonParameterList is a list of values of the 'addon_parameter' type. +type AddonParameterList struct { + href string + link bool + items []*AddonParameter +} + +// Len returns the length of the list. +func (l *AddonParameterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonParameterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonParameterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonParameterList) SetItems(items []*AddonParameter) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonParameterList) Items() []*AddonParameter { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonParameterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonParameterList) Get(i int) *AddonParameter { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonParameterList) Slice() []*AddonParameter { + var slice []*AddonParameter + if l == nil { + slice = make([]*AddonParameter, 0) + } else { + slice = make([]*AddonParameter, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonParameterList) Each(f func(item *AddonParameter) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonParameterList) Range(f func(index int, item *AddonParameter) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_parameter_type_json.go b/clientapi/addonsmgmt/v1/addon_parameter_type_json.go new file mode 100644 index 00000000..9f188e2e --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameter_type_json.go @@ -0,0 +1,269 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonParameter writes a value of the 'addon_parameter' type to the given writer. +func MarshalAddonParameter(object *AddonParameter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonParameter(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonParameter writes a value of the 'addon_parameter' type to the given stream. +func WriteAddonParameter(object *AddonParameter, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 && object.addon != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("addon") + WriteAddon(object.addon, stream) + count++ + } + present_ = object.bitmap_&4 != 0 && object.conditions != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("conditions") + WriteAddonRequirementList(object.conditions, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("default_value") + stream.WriteString(object.defaultValue) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("editable") + stream.WriteBool(object.editable) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("editable_direction") + stream.WriteString(object.editableDirection) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&512 != 0 && object.options != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("options") + WriteAddonParameterOptionList(object.options, stream) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("order") + stream.WriteInt(object.order) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("required") + stream.WriteBool(object.required) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("validation") + stream.WriteString(object.validation) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("validation_err_msg") + stream.WriteString(object.validationErrMsg) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value_type") + stream.WriteString(string(object.valueType)) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonParameter reads a value of the 'addon_parameter' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonParameter(source interface{}) (object *AddonParameter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonParameter(iterator) + err = iterator.Error + return +} + +// ReadAddonParameter reads a value of the 'addon_parameter' type from the given iterator. +func ReadAddonParameter(iterator *jsoniter.Iterator) *AddonParameter { + object := &AddonParameter{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "addon": + value := ReadAddon(iterator) + object.addon = value + object.bitmap_ |= 2 + case "conditions": + value := ReadAddonRequirementList(iterator) + object.conditions = value + object.bitmap_ |= 4 + case "default_value": + value := iterator.ReadString() + object.defaultValue = value + object.bitmap_ |= 8 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 16 + case "editable": + value := iterator.ReadBool() + object.editable = value + object.bitmap_ |= 32 + case "editable_direction": + value := iterator.ReadString() + object.editableDirection = value + object.bitmap_ |= 64 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 128 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 256 + case "options": + value := ReadAddonParameterOptionList(iterator) + object.options = value + object.bitmap_ |= 512 + case "order": + value := iterator.ReadInt() + object.order = value + object.bitmap_ |= 1024 + case "required": + value := iterator.ReadBool() + object.required = value + object.bitmap_ |= 2048 + case "validation": + value := iterator.ReadString() + object.validation = value + object.bitmap_ |= 4096 + case "validation_err_msg": + value := iterator.ReadString() + object.validationErrMsg = value + object.bitmap_ |= 8192 + case "value_type": + text := iterator.ReadString() + value := AddonParameterValueType(text) + object.valueType = value + object.bitmap_ |= 16384 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_parameter_value_type_list_type_json.go b/clientapi/addonsmgmt/v1/addon_parameter_value_type_list_type_json.go new file mode 100644 index 00000000..8c980426 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameter_value_type_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonParameterValueTypeList writes a list of values of the 'addon_parameter_value_type' type to +// the given writer. +func MarshalAddonParameterValueTypeList(list []AddonParameterValueType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonParameterValueTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonParameterValueTypeList writes a list of value of the 'addon_parameter_value_type' type to +// the given stream. +func WriteAddonParameterValueTypeList(list []AddonParameterValueType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonParameterValueTypeList reads a list of values of the 'addon_parameter_value_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonParameterValueTypeList(source interface{}) (items []AddonParameterValueType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonParameterValueTypeList(iterator) + err = iterator.Error + return +} + +// ReadAddonParameterValueTypeList reads list of values of the ”addon_parameter_value_type' type from +// the given iterator. +func ReadAddonParameterValueTypeList(iterator *jsoniter.Iterator) []AddonParameterValueType { + list := []AddonParameterValueType{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := AddonParameterValueType(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_parameter_value_type_type.go b/clientapi/addonsmgmt/v1/addon_parameter_value_type_type.go new file mode 100644 index 00000000..80d5407e --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameter_value_type_type.go @@ -0,0 +1,38 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonParameterValueType represents the values of the 'addon_parameter_value_type' enumerated type. +type AddonParameterValueType string + +const ( + // This value type enforces a valid CIDR value to be passed as parameter value + AddonParameterValueTypeCIDR AddonParameterValueType = "cidr" + // This value type must be a valid boolean + AddonParameterValueTypeBoolean AddonParameterValueType = "boolean" + // This value type must be a valid number, this includes integer and float type numbers + AddonParameterValueTypeNumber AddonParameterValueType = "number" + // This value must match a valid SKU resource in OCM + AddonParameterValueTypeResource AddonParameterValueType = "resource" + // This value must match a valid SKU resource in OCM and allows for validation of SKU resource in OCM + AddonParameterValueTypeResourceRequirement AddonParameterValueType = "resource_requirement" + // This value type must be a valid string + AddonParameterValueTypeString AddonParameterValueType = "string" +) diff --git a/clientapi/addonsmgmt/v1/addon_parameters_builder.go b/clientapi/addonsmgmt/v1/addon_parameters_builder.go new file mode 100644 index 00000000..39ebc599 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameters_builder.go @@ -0,0 +1,79 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonParametersBuilder contains the data and logic needed to build 'addon_parameters' objects. +// +// Representation of AddonParameters +type AddonParametersBuilder struct { + bitmap_ uint32 + items []*AddonParameterBuilder +} + +// NewAddonParameters creates a new builder of 'addon_parameters' objects. +func NewAddonParameters() *AddonParametersBuilder { + return &AddonParametersBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonParametersBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Items sets the value of the 'items' attribute to the given values. +func (b *AddonParametersBuilder) Items(values ...*AddonParameterBuilder) *AddonParametersBuilder { + b.items = make([]*AddonParameterBuilder, len(values)) + copy(b.items, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonParametersBuilder) Copy(object *AddonParameters) *AddonParametersBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.items != nil { + b.items = make([]*AddonParameterBuilder, len(object.items)) + for i, v := range object.items { + b.items[i] = NewAddonParameter().Copy(v) + } + } else { + b.items = nil + } + return b +} + +// Build creates a 'addon_parameters' object using the configuration stored in the builder. +func (b *AddonParametersBuilder) Build() (object *AddonParameters, err error) { + object = new(AddonParameters) + object.bitmap_ = b.bitmap_ + if b.items != nil { + object.items = make([]*AddonParameter, len(b.items)) + for i, v := range b.items { + object.items[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/addonsmgmt/v1/addon_parameters_list_builder.go b/clientapi/addonsmgmt/v1/addon_parameters_list_builder.go new file mode 100644 index 00000000..1b1a4182 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameters_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonParametersListBuilder contains the data and logic needed to build +// 'addon_parameters' objects. +type AddonParametersListBuilder struct { + items []*AddonParametersBuilder +} + +// NewAddonParametersList creates a new builder of 'addon_parameters' objects. +func NewAddonParametersList() *AddonParametersListBuilder { + return new(AddonParametersListBuilder) +} + +// Items sets the items of the list. +func (b *AddonParametersListBuilder) Items(values ...*AddonParametersBuilder) *AddonParametersListBuilder { + b.items = make([]*AddonParametersBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonParametersListBuilder) 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 *AddonParametersListBuilder) Copy(list *AddonParametersList) *AddonParametersListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonParametersBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonParameters().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_parameters' objects using the +// configuration stored in the builder. +func (b *AddonParametersListBuilder) Build() (list *AddonParametersList, err error) { + items := make([]*AddonParameters, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonParametersList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_parameters_list_type_json.go b/clientapi/addonsmgmt/v1/addon_parameters_list_type_json.go new file mode 100644 index 00000000..edb00aae --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameters_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonParametersList writes a list of values of the 'addon_parameters' type to +// the given writer. +func MarshalAddonParametersList(list []*AddonParameters, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonParametersList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonParametersList writes a list of value of the 'addon_parameters' type to +// the given stream. +func WriteAddonParametersList(list []*AddonParameters, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonParameters(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonParametersList reads a list of values of the 'addon_parameters' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonParametersList(source interface{}) (items []*AddonParameters, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonParametersList(iterator) + err = iterator.Error + return +} + +// ReadAddonParametersList reads list of values of the ”addon_parameters' type from +// the given iterator. +func ReadAddonParametersList(iterator *jsoniter.Iterator) []*AddonParameters { + list := []*AddonParameters{} + for iterator.ReadArray() { + item := ReadAddonParameters(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_parameters_type.go b/clientapi/addonsmgmt/v1/addon_parameters_type.go new file mode 100644 index 00000000..80bd3bc9 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameters_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonParameters represents the values of the 'addon_parameters' type. +// +// Representation of AddonParameters +type AddonParameters struct { + bitmap_ uint32 + items []*AddonParameter +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonParameters) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Items returns the value of the 'items' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of addon parameters +func (o *AddonParameters) Items() []*AddonParameter { + if o != nil && o.bitmap_&1 != 0 { + return o.items + } + return nil +} + +// GetItems returns the value of the 'items' attribute and +// a flag indicating if the attribute has a value. +// +// List of addon parameters +func (o *AddonParameters) GetItems() (value []*AddonParameter, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.items + } + return +} + +// AddonParametersListKind is the name of the type used to represent list of objects of +// type 'addon_parameters'. +const AddonParametersListKind = "AddonParametersList" + +// AddonParametersListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_parameters'. +const AddonParametersListLinkKind = "AddonParametersListLink" + +// AddonParametersNilKind is the name of the type used to nil lists of objects of +// type 'addon_parameters'. +const AddonParametersListNilKind = "AddonParametersListNil" + +// AddonParametersList is a list of values of the 'addon_parameters' type. +type AddonParametersList struct { + href string + link bool + items []*AddonParameters +} + +// Len returns the length of the list. +func (l *AddonParametersList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonParametersList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonParametersList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonParametersList) SetItems(items []*AddonParameters) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonParametersList) Items() []*AddonParameters { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonParametersList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonParametersList) Get(i int) *AddonParameters { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonParametersList) Slice() []*AddonParameters { + var slice []*AddonParameters + if l == nil { + slice = make([]*AddonParameters, 0) + } else { + slice = make([]*AddonParameters, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonParametersList) Each(f func(item *AddonParameters) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonParametersList) Range(f func(index int, item *AddonParameters) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_parameters_type_json.go b/clientapi/addonsmgmt/v1/addon_parameters_type_json.go new file mode 100644 index 00000000..3884a640 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_parameters_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonParameters writes a value of the 'addon_parameters' type to the given writer. +func MarshalAddonParameters(object *AddonParameters, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonParameters(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonParameters writes a value of the 'addon_parameters' type to the given stream. +func WriteAddonParameters(object *AddonParameters, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.items != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("items") + WriteAddonParameterList(object.items, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonParameters reads a value of the 'addon_parameters' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonParameters(source interface{}) (object *AddonParameters, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonParameters(iterator) + err = iterator.Error + return +} + +// ReadAddonParameters reads a value of the 'addon_parameters' type from the given iterator. +func ReadAddonParameters(iterator *jsoniter.Iterator) *AddonParameters { + object := &AddonParameters{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "items": + value := ReadAddonParameterList(iterator) + object.items = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_requirement_builder.go b/clientapi/addonsmgmt/v1/addon_requirement_builder.go new file mode 100644 index 00000000..0b6b9cf6 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_requirement_builder.go @@ -0,0 +1,136 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonRequirementBuilder contains the data and logic needed to build 'addon_requirement' objects. +// +// Representation of an addon requirement. +type AddonRequirementBuilder struct { + bitmap_ uint32 + id string + data map[string]interface{} + resource AddonRequirementResource + status *AddonRequirementStatusBuilder + enabled bool +} + +// NewAddonRequirement creates a new builder of 'addon_requirement' objects. +func NewAddonRequirement() *AddonRequirementBuilder { + return &AddonRequirementBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonRequirementBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *AddonRequirementBuilder) ID(value string) *AddonRequirementBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// Data sets the value of the 'data' attribute to the given value. +func (b *AddonRequirementBuilder) Data(value map[string]interface{}) *AddonRequirementBuilder { + b.data = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddonRequirementBuilder) Enabled(value bool) *AddonRequirementBuilder { + b.enabled = value + b.bitmap_ |= 4 + return b +} + +// Resource sets the value of the 'resource' attribute to the given value. +// +// Addon requirement resource type +func (b *AddonRequirementBuilder) Resource(value AddonRequirementResource) *AddonRequirementBuilder { + b.resource = value + b.bitmap_ |= 8 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +// +// Representation of an addon requirement status. +func (b *AddonRequirementBuilder) Status(value *AddonRequirementStatusBuilder) *AddonRequirementBuilder { + b.status = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonRequirementBuilder) Copy(object *AddonRequirement) *AddonRequirementBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + if len(object.data) > 0 { + b.data = map[string]interface{}{} + for k, v := range object.data { + b.data[k] = v + } + } else { + b.data = nil + } + b.enabled = object.enabled + b.resource = object.resource + if object.status != nil { + b.status = NewAddonRequirementStatus().Copy(object.status) + } else { + b.status = nil + } + return b +} + +// Build creates a 'addon_requirement' object using the configuration stored in the builder. +func (b *AddonRequirementBuilder) Build() (object *AddonRequirement, err error) { + object = new(AddonRequirement) + object.bitmap_ = b.bitmap_ + object.id = b.id + if b.data != nil { + object.data = make(map[string]interface{}) + for k, v := range b.data { + object.data[k] = v + } + } + object.enabled = b.enabled + object.resource = b.resource + if b.status != nil { + object.status, err = b.status.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/addonsmgmt/v1/addon_requirement_list_builder.go b/clientapi/addonsmgmt/v1/addon_requirement_list_builder.go new file mode 100644 index 00000000..7bbb4615 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_requirement_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonRequirementListBuilder contains the data and logic needed to build +// 'addon_requirement' objects. +type AddonRequirementListBuilder struct { + items []*AddonRequirementBuilder +} + +// NewAddonRequirementList creates a new builder of 'addon_requirement' objects. +func NewAddonRequirementList() *AddonRequirementListBuilder { + return new(AddonRequirementListBuilder) +} + +// Items sets the items of the list. +func (b *AddonRequirementListBuilder) Items(values ...*AddonRequirementBuilder) *AddonRequirementListBuilder { + b.items = make([]*AddonRequirementBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonRequirementListBuilder) 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 *AddonRequirementListBuilder) Copy(list *AddonRequirementList) *AddonRequirementListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonRequirementBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonRequirement().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_requirement' objects using the +// configuration stored in the builder. +func (b *AddonRequirementListBuilder) Build() (list *AddonRequirementList, err error) { + items := make([]*AddonRequirement, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonRequirementList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_requirement_list_type_json.go b/clientapi/addonsmgmt/v1/addon_requirement_list_type_json.go new file mode 100644 index 00000000..ca9e0b42 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_requirement_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonRequirementList writes a list of values of the 'addon_requirement' type to +// the given writer. +func MarshalAddonRequirementList(list []*AddonRequirement, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonRequirementList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonRequirementList writes a list of value of the 'addon_requirement' type to +// the given stream. +func WriteAddonRequirementList(list []*AddonRequirement, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonRequirement(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonRequirementList reads a list of values of the 'addon_requirement' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonRequirementList(source interface{}) (items []*AddonRequirement, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonRequirementList(iterator) + err = iterator.Error + return +} + +// ReadAddonRequirementList reads list of values of the ”addon_requirement' type from +// the given iterator. +func ReadAddonRequirementList(iterator *jsoniter.Iterator) []*AddonRequirement { + list := []*AddonRequirement{} + for iterator.ReadArray() { + item := ReadAddonRequirement(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_requirement_resource_list_type_json.go b/clientapi/addonsmgmt/v1/addon_requirement_resource_list_type_json.go new file mode 100644 index 00000000..4dda056a --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_requirement_resource_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonRequirementResourceList writes a list of values of the 'addon_requirement_resource' type to +// the given writer. +func MarshalAddonRequirementResourceList(list []AddonRequirementResource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonRequirementResourceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonRequirementResourceList writes a list of value of the 'addon_requirement_resource' type to +// the given stream. +func WriteAddonRequirementResourceList(list []AddonRequirementResource, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonRequirementResourceList reads a list of values of the 'addon_requirement_resource' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonRequirementResourceList(source interface{}) (items []AddonRequirementResource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonRequirementResourceList(iterator) + err = iterator.Error + return +} + +// ReadAddonRequirementResourceList reads list of values of the ”addon_requirement_resource' type from +// the given iterator. +func ReadAddonRequirementResourceList(iterator *jsoniter.Iterator) []AddonRequirementResource { + list := []AddonRequirementResource{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := AddonRequirementResource(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_requirement_resource_type.go b/clientapi/addonsmgmt/v1/addon_requirement_resource_type.go new file mode 100644 index 00000000..09aabbd4 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_requirement_resource_type.go @@ -0,0 +1,32 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonRequirementResource represents the values of the 'addon_requirement_resource' enumerated type. +type AddonRequirementResource string + +const ( + // This requirement resource data will be validated and checked against addon installation resources + AddonRequirementResourceAddon AddonRequirementResource = "addon" + // This requirement resource data will be validated and checked against cluster resources + AddonRequirementResourceCluster AddonRequirementResource = "cluster" + // This requirement resource data will be validated and checked against machine pool resources + AddonRequirementResourceMachinePool AddonRequirementResource = "machine_pool" +) diff --git a/clientapi/addonsmgmt/v1/addon_requirement_status_builder.go b/clientapi/addonsmgmt/v1/addon_requirement_status_builder.go new file mode 100644 index 00000000..cf92f551 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_requirement_status_builder.go @@ -0,0 +1,82 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonRequirementStatusBuilder contains the data and logic needed to build 'addon_requirement_status' objects. +// +// Representation of an addon requirement status. +type AddonRequirementStatusBuilder struct { + bitmap_ uint32 + errorMsgs []string + fulfilled bool +} + +// NewAddonRequirementStatus creates a new builder of 'addon_requirement_status' objects. +func NewAddonRequirementStatus() *AddonRequirementStatusBuilder { + return &AddonRequirementStatusBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonRequirementStatusBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ErrorMsgs sets the value of the 'error_msgs' attribute to the given values. +func (b *AddonRequirementStatusBuilder) ErrorMsgs(values ...string) *AddonRequirementStatusBuilder { + b.errorMsgs = make([]string, len(values)) + copy(b.errorMsgs, values) + b.bitmap_ |= 1 + return b +} + +// Fulfilled sets the value of the 'fulfilled' attribute to the given value. +func (b *AddonRequirementStatusBuilder) Fulfilled(value bool) *AddonRequirementStatusBuilder { + b.fulfilled = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonRequirementStatusBuilder) Copy(object *AddonRequirementStatus) *AddonRequirementStatusBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.errorMsgs != nil { + b.errorMsgs = make([]string, len(object.errorMsgs)) + copy(b.errorMsgs, object.errorMsgs) + } else { + b.errorMsgs = nil + } + b.fulfilled = object.fulfilled + return b +} + +// Build creates a 'addon_requirement_status' object using the configuration stored in the builder. +func (b *AddonRequirementStatusBuilder) Build() (object *AddonRequirementStatus, err error) { + object = new(AddonRequirementStatus) + object.bitmap_ = b.bitmap_ + if b.errorMsgs != nil { + object.errorMsgs = make([]string, len(b.errorMsgs)) + copy(object.errorMsgs, b.errorMsgs) + } + object.fulfilled = b.fulfilled + return +} diff --git a/clientapi/addonsmgmt/v1/addon_requirement_status_list_builder.go b/clientapi/addonsmgmt/v1/addon_requirement_status_list_builder.go new file mode 100644 index 00000000..3e2b65e0 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_requirement_status_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonRequirementStatusListBuilder contains the data and logic needed to build +// 'addon_requirement_status' objects. +type AddonRequirementStatusListBuilder struct { + items []*AddonRequirementStatusBuilder +} + +// NewAddonRequirementStatusList creates a new builder of 'addon_requirement_status' objects. +func NewAddonRequirementStatusList() *AddonRequirementStatusListBuilder { + return new(AddonRequirementStatusListBuilder) +} + +// Items sets the items of the list. +func (b *AddonRequirementStatusListBuilder) Items(values ...*AddonRequirementStatusBuilder) *AddonRequirementStatusListBuilder { + b.items = make([]*AddonRequirementStatusBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonRequirementStatusListBuilder) 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 *AddonRequirementStatusListBuilder) Copy(list *AddonRequirementStatusList) *AddonRequirementStatusListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonRequirementStatusBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonRequirementStatus().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_requirement_status' objects using the +// configuration stored in the builder. +func (b *AddonRequirementStatusListBuilder) Build() (list *AddonRequirementStatusList, err error) { + items := make([]*AddonRequirementStatus, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonRequirementStatusList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_requirement_status_list_type_json.go b/clientapi/addonsmgmt/v1/addon_requirement_status_list_type_json.go new file mode 100644 index 00000000..2e481562 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_requirement_status_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonRequirementStatusList writes a list of values of the 'addon_requirement_status' type to +// the given writer. +func MarshalAddonRequirementStatusList(list []*AddonRequirementStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonRequirementStatusList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonRequirementStatusList writes a list of value of the 'addon_requirement_status' type to +// the given stream. +func WriteAddonRequirementStatusList(list []*AddonRequirementStatus, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonRequirementStatus(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonRequirementStatusList reads a list of values of the 'addon_requirement_status' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonRequirementStatusList(source interface{}) (items []*AddonRequirementStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonRequirementStatusList(iterator) + err = iterator.Error + return +} + +// ReadAddonRequirementStatusList reads list of values of the ”addon_requirement_status' type from +// the given iterator. +func ReadAddonRequirementStatusList(iterator *jsoniter.Iterator) []*AddonRequirementStatus { + list := []*AddonRequirementStatus{} + for iterator.ReadArray() { + item := ReadAddonRequirementStatus(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_requirement_status_type.go b/clientapi/addonsmgmt/v1/addon_requirement_status_type.go new file mode 100644 index 00000000..2ad4eeb6 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_requirement_status_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonRequirementStatus represents the values of the 'addon_requirement_status' type. +// +// Representation of an addon requirement status. +type AddonRequirementStatus struct { + bitmap_ uint32 + errorMsgs []string + fulfilled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonRequirementStatus) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ErrorMsgs returns the value of the 'error_msgs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Error messages detailing reasons for unfulfilled requirements. +func (o *AddonRequirementStatus) ErrorMsgs() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.errorMsgs + } + return nil +} + +// GetErrorMsgs returns the value of the 'error_msgs' attribute and +// a flag indicating if the attribute has a value. +// +// Error messages detailing reasons for unfulfilled requirements. +func (o *AddonRequirementStatus) GetErrorMsgs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.errorMsgs + } + return +} + +// Fulfilled returns the value of the 'fulfilled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this requirement is fulfilled. +func (o *AddonRequirementStatus) Fulfilled() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.fulfilled + } + return false +} + +// GetFulfilled returns the value of the 'fulfilled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this requirement is fulfilled. +func (o *AddonRequirementStatus) GetFulfilled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.fulfilled + } + return +} + +// AddonRequirementStatusListKind is the name of the type used to represent list of objects of +// type 'addon_requirement_status'. +const AddonRequirementStatusListKind = "AddonRequirementStatusList" + +// AddonRequirementStatusListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_requirement_status'. +const AddonRequirementStatusListLinkKind = "AddonRequirementStatusListLink" + +// AddonRequirementStatusNilKind is the name of the type used to nil lists of objects of +// type 'addon_requirement_status'. +const AddonRequirementStatusListNilKind = "AddonRequirementStatusListNil" + +// AddonRequirementStatusList is a list of values of the 'addon_requirement_status' type. +type AddonRequirementStatusList struct { + href string + link bool + items []*AddonRequirementStatus +} + +// Len returns the length of the list. +func (l *AddonRequirementStatusList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonRequirementStatusList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonRequirementStatusList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonRequirementStatusList) SetItems(items []*AddonRequirementStatus) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonRequirementStatusList) Items() []*AddonRequirementStatus { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonRequirementStatusList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonRequirementStatusList) Get(i int) *AddonRequirementStatus { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonRequirementStatusList) Slice() []*AddonRequirementStatus { + var slice []*AddonRequirementStatus + if l == nil { + slice = make([]*AddonRequirementStatus, 0) + } else { + slice = make([]*AddonRequirementStatus, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonRequirementStatusList) Each(f func(item *AddonRequirementStatus) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonRequirementStatusList) Range(f func(index int, item *AddonRequirementStatus) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_requirement_status_type_json.go b/clientapi/addonsmgmt/v1/addon_requirement_status_type_json.go new file mode 100644 index 00000000..1a7f1a1c --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_requirement_status_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonRequirementStatus writes a value of the 'addon_requirement_status' type to the given writer. +func MarshalAddonRequirementStatus(object *AddonRequirementStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonRequirementStatus(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonRequirementStatus writes a value of the 'addon_requirement_status' type to the given stream. +func WriteAddonRequirementStatus(object *AddonRequirementStatus, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.errorMsgs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("error_msgs") + WriteStringList(object.errorMsgs, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("fulfilled") + stream.WriteBool(object.fulfilled) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonRequirementStatus reads a value of the 'addon_requirement_status' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonRequirementStatus(source interface{}) (object *AddonRequirementStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonRequirementStatus(iterator) + err = iterator.Error + return +} + +// ReadAddonRequirementStatus reads a value of the 'addon_requirement_status' type from the given iterator. +func ReadAddonRequirementStatus(iterator *jsoniter.Iterator) *AddonRequirementStatus { + object := &AddonRequirementStatus{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "error_msgs": + value := ReadStringList(iterator) + object.errorMsgs = value + object.bitmap_ |= 1 + case "fulfilled": + value := iterator.ReadBool() + object.fulfilled = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_requirement_type.go b/clientapi/addonsmgmt/v1/addon_requirement_type.go new file mode 100644 index 00000000..310711dc --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_requirement_type.go @@ -0,0 +1,261 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonRequirement represents the values of the 'addon_requirement' type. +// +// Representation of an addon requirement. +type AddonRequirement struct { + bitmap_ uint32 + id string + data map[string]interface{} + resource AddonRequirementResource + status *AddonRequirementStatus + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonRequirement) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID of the addon requirement. +func (o *AddonRequirement) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID of the addon requirement. +func (o *AddonRequirement) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// Data returns the value of the 'data' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Data for the addon requirement. +func (o *AddonRequirement) Data() map[string]interface{} { + if o != nil && o.bitmap_&2 != 0 { + return o.data + } + return nil +} + +// GetData returns the value of the 'data' attribute and +// a flag indicating if the attribute has a value. +// +// Data for the addon requirement. +func (o *AddonRequirement) GetData() (value map[string]interface{}, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.data + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this requirement is enabled for the addon. +func (o *AddonRequirement) Enabled() bool { + if o != nil && o.bitmap_&4 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this requirement is enabled for the addon. +func (o *AddonRequirement) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.enabled + } + return +} + +// Resource returns the value of the 'resource' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of resource of the addon requirement. +func (o *AddonRequirement) Resource() AddonRequirementResource { + if o != nil && o.bitmap_&8 != 0 { + return o.resource + } + return AddonRequirementResource("") +} + +// GetResource returns the value of the 'resource' attribute and +// a flag indicating if the attribute has a value. +// +// Type of resource of the addon requirement. +func (o *AddonRequirement) GetResource() (value AddonRequirementResource, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.resource + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional cluster specific status for the addon. +func (o *AddonRequirement) Status() *AddonRequirementStatus { + if o != nil && o.bitmap_&16 != 0 { + return o.status + } + return nil +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// Optional cluster specific status for the addon. +func (o *AddonRequirement) GetStatus() (value *AddonRequirementStatus, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.status + } + return +} + +// AddonRequirementListKind is the name of the type used to represent list of objects of +// type 'addon_requirement'. +const AddonRequirementListKind = "AddonRequirementList" + +// AddonRequirementListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_requirement'. +const AddonRequirementListLinkKind = "AddonRequirementListLink" + +// AddonRequirementNilKind is the name of the type used to nil lists of objects of +// type 'addon_requirement'. +const AddonRequirementListNilKind = "AddonRequirementListNil" + +// AddonRequirementList is a list of values of the 'addon_requirement' type. +type AddonRequirementList struct { + href string + link bool + items []*AddonRequirement +} + +// Len returns the length of the list. +func (l *AddonRequirementList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonRequirementList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonRequirementList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonRequirementList) SetItems(items []*AddonRequirement) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonRequirementList) Items() []*AddonRequirement { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonRequirementList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonRequirementList) Get(i int) *AddonRequirement { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonRequirementList) Slice() []*AddonRequirement { + var slice []*AddonRequirement + if l == nil { + slice = make([]*AddonRequirement, 0) + } else { + slice = make([]*AddonRequirement, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonRequirementList) Each(f func(item *AddonRequirement) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonRequirementList) Range(f func(index int, item *AddonRequirement) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_requirement_type_json.go b/clientapi/addonsmgmt/v1/addon_requirement_type_json.go new file mode 100644 index 00000000..35703adb --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_requirement_type_json.go @@ -0,0 +1,169 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonRequirement writes a value of the 'addon_requirement' type to the given writer. +func MarshalAddonRequirement(object *AddonRequirement, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonRequirement(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonRequirement writes a value of the 'addon_requirement' type to the given stream. +func WriteAddonRequirement(object *AddonRequirement, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 && object.data != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("data") + if object.data != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.data)) + i := 0 + for key := range object.data { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.data[key] + stream.WriteObjectField(key) + stream.WriteVal(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource") + stream.WriteString(string(object.resource)) + count++ + } + present_ = object.bitmap_&16 != 0 && object.status != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + WriteAddonRequirementStatus(object.status, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonRequirement reads a value of the 'addon_requirement' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonRequirement(source interface{}) (object *AddonRequirement, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonRequirement(iterator) + err = iterator.Error + return +} + +// ReadAddonRequirement reads a value of the 'addon_requirement' type from the given iterator. +func ReadAddonRequirement(iterator *jsoniter.Iterator) *AddonRequirement { + object := &AddonRequirement{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "data": + value := map[string]interface{}{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + var item interface{} + iterator.ReadVal(&item) + value[key] = item + } + object.data = value + object.bitmap_ |= 2 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 4 + case "resource": + text := iterator.ReadString() + value := AddonRequirementResource(text) + object.resource = value + object.bitmap_ |= 8 + case "status": + value := ReadAddonRequirementStatus(iterator) + object.status = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_secret_propagation_builder.go b/clientapi/addonsmgmt/v1/addon_secret_propagation_builder.go new file mode 100644 index 00000000..5caf94f9 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_secret_propagation_builder.go @@ -0,0 +1,93 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonSecretPropagationBuilder contains the data and logic needed to build 'addon_secret_propagation' objects. +// +// Representation of an addon secret propagation +type AddonSecretPropagationBuilder struct { + bitmap_ uint32 + id string + destinationSecret string + sourceSecret string + enabled bool +} + +// NewAddonSecretPropagation creates a new builder of 'addon_secret_propagation' objects. +func NewAddonSecretPropagation() *AddonSecretPropagationBuilder { + return &AddonSecretPropagationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonSecretPropagationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *AddonSecretPropagationBuilder) ID(value string) *AddonSecretPropagationBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// DestinationSecret sets the value of the 'destination_secret' attribute to the given value. +func (b *AddonSecretPropagationBuilder) DestinationSecret(value string) *AddonSecretPropagationBuilder { + b.destinationSecret = value + b.bitmap_ |= 2 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddonSecretPropagationBuilder) Enabled(value bool) *AddonSecretPropagationBuilder { + b.enabled = value + b.bitmap_ |= 4 + return b +} + +// SourceSecret sets the value of the 'source_secret' attribute to the given value. +func (b *AddonSecretPropagationBuilder) SourceSecret(value string) *AddonSecretPropagationBuilder { + b.sourceSecret = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonSecretPropagationBuilder) Copy(object *AddonSecretPropagation) *AddonSecretPropagationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.destinationSecret = object.destinationSecret + b.enabled = object.enabled + b.sourceSecret = object.sourceSecret + return b +} + +// Build creates a 'addon_secret_propagation' object using the configuration stored in the builder. +func (b *AddonSecretPropagationBuilder) Build() (object *AddonSecretPropagation, err error) { + object = new(AddonSecretPropagation) + object.bitmap_ = b.bitmap_ + object.id = b.id + object.destinationSecret = b.destinationSecret + object.enabled = b.enabled + object.sourceSecret = b.sourceSecret + return +} diff --git a/clientapi/addonsmgmt/v1/addon_secret_propagation_list_builder.go b/clientapi/addonsmgmt/v1/addon_secret_propagation_list_builder.go new file mode 100644 index 00000000..868f9b62 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_secret_propagation_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonSecretPropagationListBuilder contains the data and logic needed to build +// 'addon_secret_propagation' objects. +type AddonSecretPropagationListBuilder struct { + items []*AddonSecretPropagationBuilder +} + +// NewAddonSecretPropagationList creates a new builder of 'addon_secret_propagation' objects. +func NewAddonSecretPropagationList() *AddonSecretPropagationListBuilder { + return new(AddonSecretPropagationListBuilder) +} + +// Items sets the items of the list. +func (b *AddonSecretPropagationListBuilder) Items(values ...*AddonSecretPropagationBuilder) *AddonSecretPropagationListBuilder { + b.items = make([]*AddonSecretPropagationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonSecretPropagationListBuilder) 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 *AddonSecretPropagationListBuilder) Copy(list *AddonSecretPropagationList) *AddonSecretPropagationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonSecretPropagationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonSecretPropagation().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_secret_propagation' objects using the +// configuration stored in the builder. +func (b *AddonSecretPropagationListBuilder) Build() (list *AddonSecretPropagationList, err error) { + items := make([]*AddonSecretPropagation, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonSecretPropagationList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_secret_propagation_list_type_json.go b/clientapi/addonsmgmt/v1/addon_secret_propagation_list_type_json.go new file mode 100644 index 00000000..60fc5729 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_secret_propagation_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonSecretPropagationList writes a list of values of the 'addon_secret_propagation' type to +// the given writer. +func MarshalAddonSecretPropagationList(list []*AddonSecretPropagation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonSecretPropagationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonSecretPropagationList writes a list of value of the 'addon_secret_propagation' type to +// the given stream. +func WriteAddonSecretPropagationList(list []*AddonSecretPropagation, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonSecretPropagation(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonSecretPropagationList reads a list of values of the 'addon_secret_propagation' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonSecretPropagationList(source interface{}) (items []*AddonSecretPropagation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonSecretPropagationList(iterator) + err = iterator.Error + return +} + +// ReadAddonSecretPropagationList reads list of values of the ”addon_secret_propagation' type from +// the given iterator. +func ReadAddonSecretPropagationList(iterator *jsoniter.Iterator) []*AddonSecretPropagation { + list := []*AddonSecretPropagation{} + for iterator.ReadArray() { + item := ReadAddonSecretPropagation(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_secret_propagation_type.go b/clientapi/addonsmgmt/v1/addon_secret_propagation_type.go new file mode 100644 index 00000000..ef3b8e1f --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_secret_propagation_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonSecretPropagation represents the values of the 'addon_secret_propagation' type. +// +// Representation of an addon secret propagation +type AddonSecretPropagation struct { + bitmap_ uint32 + id string + destinationSecret string + sourceSecret string + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonSecretPropagation) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID of the secret propagation +func (o *AddonSecretPropagation) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID of the secret propagation +func (o *AddonSecretPropagation) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// DestinationSecret returns the value of the 'destination_secret' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DestinationSecret is location of the secret to be added +func (o *AddonSecretPropagation) DestinationSecret() string { + if o != nil && o.bitmap_&2 != 0 { + return o.destinationSecret + } + return "" +} + +// GetDestinationSecret returns the value of the 'destination_secret' attribute and +// a flag indicating if the attribute has a value. +// +// DestinationSecret is location of the secret to be added +func (o *AddonSecretPropagation) GetDestinationSecret() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.destinationSecret + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates is this secret propagation is enabled for the addon +func (o *AddonSecretPropagation) Enabled() bool { + if o != nil && o.bitmap_&4 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates is this secret propagation is enabled for the addon +func (o *AddonSecretPropagation) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.enabled + } + return +} + +// SourceSecret returns the value of the 'source_secret' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// SourceSecret is location of the source secret +func (o *AddonSecretPropagation) SourceSecret() string { + if o != nil && o.bitmap_&8 != 0 { + return o.sourceSecret + } + return "" +} + +// GetSourceSecret returns the value of the 'source_secret' attribute and +// a flag indicating if the attribute has a value. +// +// SourceSecret is location of the source secret +func (o *AddonSecretPropagation) GetSourceSecret() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.sourceSecret + } + return +} + +// AddonSecretPropagationListKind is the name of the type used to represent list of objects of +// type 'addon_secret_propagation'. +const AddonSecretPropagationListKind = "AddonSecretPropagationList" + +// AddonSecretPropagationListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_secret_propagation'. +const AddonSecretPropagationListLinkKind = "AddonSecretPropagationListLink" + +// AddonSecretPropagationNilKind is the name of the type used to nil lists of objects of +// type 'addon_secret_propagation'. +const AddonSecretPropagationListNilKind = "AddonSecretPropagationListNil" + +// AddonSecretPropagationList is a list of values of the 'addon_secret_propagation' type. +type AddonSecretPropagationList struct { + href string + link bool + items []*AddonSecretPropagation +} + +// Len returns the length of the list. +func (l *AddonSecretPropagationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonSecretPropagationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonSecretPropagationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonSecretPropagationList) SetItems(items []*AddonSecretPropagation) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonSecretPropagationList) Items() []*AddonSecretPropagation { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonSecretPropagationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonSecretPropagationList) Get(i int) *AddonSecretPropagation { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonSecretPropagationList) Slice() []*AddonSecretPropagation { + var slice []*AddonSecretPropagation + if l == nil { + slice = make([]*AddonSecretPropagation, 0) + } else { + slice = make([]*AddonSecretPropagation, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonSecretPropagationList) Each(f func(item *AddonSecretPropagation) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonSecretPropagationList) Range(f func(index int, item *AddonSecretPropagation) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_secret_propagation_type_json.go b/clientapi/addonsmgmt/v1/addon_secret_propagation_type_json.go new file mode 100644 index 00000000..19092c45 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_secret_propagation_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonSecretPropagation writes a value of the 'addon_secret_propagation' type to the given writer. +func MarshalAddonSecretPropagation(object *AddonSecretPropagation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonSecretPropagation(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonSecretPropagation writes a value of the 'addon_secret_propagation' type to the given stream. +func WriteAddonSecretPropagation(object *AddonSecretPropagation, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("destination_secret") + stream.WriteString(object.destinationSecret) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("source_secret") + stream.WriteString(object.sourceSecret) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonSecretPropagation reads a value of the 'addon_secret_propagation' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonSecretPropagation(source interface{}) (object *AddonSecretPropagation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonSecretPropagation(iterator) + err = iterator.Error + return +} + +// ReadAddonSecretPropagation reads a value of the 'addon_secret_propagation' type from the given iterator. +func ReadAddonSecretPropagation(iterator *jsoniter.Iterator) *AddonSecretPropagation { + object := &AddonSecretPropagation{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "destination_secret": + value := iterator.ReadString() + object.destinationSecret = value + object.bitmap_ |= 2 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 4 + case "source_secret": + value := iterator.ReadString() + object.sourceSecret = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_status_builder.go b/clientapi/addonsmgmt/v1/addon_status_builder.go new file mode 100644 index 00000000..1008adc8 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_builder.go @@ -0,0 +1,135 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonStatusBuilder contains the data and logic needed to build 'addon_status' objects. +// +// Representation of an addon status. +type AddonStatusBuilder struct { + bitmap_ uint32 + id string + href string + addonId string + correlationID string + statusConditions []*AddonStatusConditionBuilder + version string +} + +// NewAddonStatus creates a new builder of 'addon_status' objects. +func NewAddonStatus() *AddonStatusBuilder { + return &AddonStatusBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddonStatusBuilder) Link(value bool) *AddonStatusBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddonStatusBuilder) ID(value string) *AddonStatusBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddonStatusBuilder) HREF(value string) *AddonStatusBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonStatusBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AddonId sets the value of the 'addon_id' attribute to the given value. +func (b *AddonStatusBuilder) AddonId(value string) *AddonStatusBuilder { + b.addonId = value + b.bitmap_ |= 8 + return b +} + +// CorrelationID sets the value of the 'correlation_ID' attribute to the given value. +func (b *AddonStatusBuilder) CorrelationID(value string) *AddonStatusBuilder { + b.correlationID = value + b.bitmap_ |= 16 + return b +} + +// StatusConditions sets the value of the 'status_conditions' attribute to the given values. +func (b *AddonStatusBuilder) StatusConditions(values ...*AddonStatusConditionBuilder) *AddonStatusBuilder { + b.statusConditions = make([]*AddonStatusConditionBuilder, len(values)) + copy(b.statusConditions, values) + b.bitmap_ |= 32 + return b +} + +// Version sets the value of the 'version' attribute to the given value. +func (b *AddonStatusBuilder) Version(value string) *AddonStatusBuilder { + b.version = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonStatusBuilder) Copy(object *AddonStatus) *AddonStatusBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.addonId = object.addonId + b.correlationID = object.correlationID + if object.statusConditions != nil { + b.statusConditions = make([]*AddonStatusConditionBuilder, len(object.statusConditions)) + for i, v := range object.statusConditions { + b.statusConditions[i] = NewAddonStatusCondition().Copy(v) + } + } else { + b.statusConditions = nil + } + b.version = object.version + return b +} + +// Build creates a 'addon_status' object using the configuration stored in the builder. +func (b *AddonStatusBuilder) Build() (object *AddonStatus, err error) { + object = new(AddonStatus) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.addonId = b.addonId + object.correlationID = b.correlationID + if b.statusConditions != nil { + object.statusConditions = make([]*AddonStatusCondition, len(b.statusConditions)) + for i, v := range b.statusConditions { + object.statusConditions[i], err = v.Build() + if err != nil { + return + } + } + } + object.version = b.version + return +} diff --git a/clientapi/addonsmgmt/v1/addon_status_condition_builder.go b/clientapi/addonsmgmt/v1/addon_status_condition_builder.go new file mode 100644 index 00000000..5d783829 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_condition_builder.go @@ -0,0 +1,97 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonStatusConditionBuilder contains the data and logic needed to build 'addon_status_condition' objects. +// +// Representation of an addon status condition type. +type AddonStatusConditionBuilder struct { + bitmap_ uint32 + message string + reason string + statusType AddonStatusConditionType + statusValue AddonStatusConditionValue +} + +// NewAddonStatusCondition creates a new builder of 'addon_status_condition' objects. +func NewAddonStatusCondition() *AddonStatusConditionBuilder { + return &AddonStatusConditionBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonStatusConditionBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Message sets the value of the 'message' attribute to the given value. +func (b *AddonStatusConditionBuilder) Message(value string) *AddonStatusConditionBuilder { + b.message = value + b.bitmap_ |= 1 + return b +} + +// Reason sets the value of the 'reason' attribute to the given value. +func (b *AddonStatusConditionBuilder) Reason(value string) *AddonStatusConditionBuilder { + b.reason = value + b.bitmap_ |= 2 + return b +} + +// StatusType sets the value of the 'status_type' attribute to the given value. +// +// Representation of an addon status condition type field. +func (b *AddonStatusConditionBuilder) StatusType(value AddonStatusConditionType) *AddonStatusConditionBuilder { + b.statusType = value + b.bitmap_ |= 4 + return b +} + +// StatusValue sets the value of the 'status_value' attribute to the given value. +// +// Representation of an addon status condition value field. +func (b *AddonStatusConditionBuilder) StatusValue(value AddonStatusConditionValue) *AddonStatusConditionBuilder { + b.statusValue = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonStatusConditionBuilder) Copy(object *AddonStatusCondition) *AddonStatusConditionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.message = object.message + b.reason = object.reason + b.statusType = object.statusType + b.statusValue = object.statusValue + return b +} + +// Build creates a 'addon_status_condition' object using the configuration stored in the builder. +func (b *AddonStatusConditionBuilder) Build() (object *AddonStatusCondition, err error) { + object = new(AddonStatusCondition) + object.bitmap_ = b.bitmap_ + object.message = b.message + object.reason = b.reason + object.statusType = b.statusType + object.statusValue = b.statusValue + return +} diff --git a/clientapi/addonsmgmt/v1/addon_status_condition_list_builder.go b/clientapi/addonsmgmt/v1/addon_status_condition_list_builder.go new file mode 100644 index 00000000..f17366f9 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_condition_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonStatusConditionListBuilder contains the data and logic needed to build +// 'addon_status_condition' objects. +type AddonStatusConditionListBuilder struct { + items []*AddonStatusConditionBuilder +} + +// NewAddonStatusConditionList creates a new builder of 'addon_status_condition' objects. +func NewAddonStatusConditionList() *AddonStatusConditionListBuilder { + return new(AddonStatusConditionListBuilder) +} + +// Items sets the items of the list. +func (b *AddonStatusConditionListBuilder) Items(values ...*AddonStatusConditionBuilder) *AddonStatusConditionListBuilder { + b.items = make([]*AddonStatusConditionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonStatusConditionListBuilder) 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 *AddonStatusConditionListBuilder) Copy(list *AddonStatusConditionList) *AddonStatusConditionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonStatusConditionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonStatusCondition().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_status_condition' objects using the +// configuration stored in the builder. +func (b *AddonStatusConditionListBuilder) Build() (list *AddonStatusConditionList, err error) { + items := make([]*AddonStatusCondition, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonStatusConditionList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_status_condition_list_type_json.go b/clientapi/addonsmgmt/v1/addon_status_condition_list_type_json.go new file mode 100644 index 00000000..14be10e3 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_condition_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonStatusConditionList writes a list of values of the 'addon_status_condition' type to +// the given writer. +func MarshalAddonStatusConditionList(list []*AddonStatusCondition, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonStatusConditionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonStatusConditionList writes a list of value of the 'addon_status_condition' type to +// the given stream. +func WriteAddonStatusConditionList(list []*AddonStatusCondition, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonStatusCondition(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonStatusConditionList reads a list of values of the 'addon_status_condition' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonStatusConditionList(source interface{}) (items []*AddonStatusCondition, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonStatusConditionList(iterator) + err = iterator.Error + return +} + +// ReadAddonStatusConditionList reads list of values of the ”addon_status_condition' type from +// the given iterator. +func ReadAddonStatusConditionList(iterator *jsoniter.Iterator) []*AddonStatusCondition { + list := []*AddonStatusCondition{} + for iterator.ReadArray() { + item := ReadAddonStatusCondition(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_status_condition_type.go b/clientapi/addonsmgmt/v1/addon_status_condition_type.go new file mode 100644 index 00000000..f4b77a63 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_condition_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonStatusCondition represents the values of the 'addon_status_condition' type. +// +// Representation of an addon status condition type. +type AddonStatusCondition struct { + bitmap_ uint32 + message string + reason string + statusType AddonStatusConditionType + statusValue AddonStatusConditionValue +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonStatusCondition) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Message returns the value of the 'message' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Message for the condition +func (o *AddonStatusCondition) Message() string { + if o != nil && o.bitmap_&1 != 0 { + return o.message + } + return "" +} + +// GetMessage returns the value of the 'message' attribute and +// a flag indicating if the attribute has a value. +// +// Message for the condition +func (o *AddonStatusCondition) GetMessage() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.message + } + return +} + +// Reason returns the value of the 'reason' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Reason for the condition +func (o *AddonStatusCondition) Reason() string { + if o != nil && o.bitmap_&2 != 0 { + return o.reason + } + return "" +} + +// GetReason returns the value of the 'reason' attribute and +// a flag indicating if the attribute has a value. +// +// Reason for the condition +func (o *AddonStatusCondition) GetReason() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.reason + } + return +} + +// StatusType returns the value of the 'status_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of the reported addon status condition +func (o *AddonStatusCondition) StatusType() AddonStatusConditionType { + if o != nil && o.bitmap_&4 != 0 { + return o.statusType + } + return AddonStatusConditionType("") +} + +// GetStatusType returns the value of the 'status_type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of the reported addon status condition +func (o *AddonStatusCondition) GetStatusType() (value AddonStatusConditionType, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.statusType + } + return +} + +// StatusValue returns the value of the 'status_value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Value of the reported addon status condition +func (o *AddonStatusCondition) StatusValue() AddonStatusConditionValue { + if o != nil && o.bitmap_&8 != 0 { + return o.statusValue + } + return AddonStatusConditionValue("") +} + +// GetStatusValue returns the value of the 'status_value' attribute and +// a flag indicating if the attribute has a value. +// +// Value of the reported addon status condition +func (o *AddonStatusCondition) GetStatusValue() (value AddonStatusConditionValue, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.statusValue + } + return +} + +// AddonStatusConditionListKind is the name of the type used to represent list of objects of +// type 'addon_status_condition'. +const AddonStatusConditionListKind = "AddonStatusConditionList" + +// AddonStatusConditionListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_status_condition'. +const AddonStatusConditionListLinkKind = "AddonStatusConditionListLink" + +// AddonStatusConditionNilKind is the name of the type used to nil lists of objects of +// type 'addon_status_condition'. +const AddonStatusConditionListNilKind = "AddonStatusConditionListNil" + +// AddonStatusConditionList is a list of values of the 'addon_status_condition' type. +type AddonStatusConditionList struct { + href string + link bool + items []*AddonStatusCondition +} + +// Len returns the length of the list. +func (l *AddonStatusConditionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonStatusConditionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonStatusConditionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonStatusConditionList) SetItems(items []*AddonStatusCondition) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonStatusConditionList) Items() []*AddonStatusCondition { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonStatusConditionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonStatusConditionList) Get(i int) *AddonStatusCondition { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonStatusConditionList) Slice() []*AddonStatusCondition { + var slice []*AddonStatusCondition + if l == nil { + slice = make([]*AddonStatusCondition, 0) + } else { + slice = make([]*AddonStatusCondition, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonStatusConditionList) Each(f func(item *AddonStatusCondition) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonStatusConditionList) Range(f func(index int, item *AddonStatusCondition) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_status_condition_type_json.go b/clientapi/addonsmgmt/v1/addon_status_condition_type_json.go new file mode 100644 index 00000000..b8b458d3 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_condition_type_json.go @@ -0,0 +1,127 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonStatusCondition writes a value of the 'addon_status_condition' type to the given writer. +func MarshalAddonStatusCondition(object *AddonStatusCondition, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonStatusCondition(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonStatusCondition writes a value of the 'addon_status_condition' type to the given stream. +func WriteAddonStatusCondition(object *AddonStatusCondition, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("message") + stream.WriteString(object.message) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("reason") + stream.WriteString(object.reason) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status_type") + stream.WriteString(string(object.statusType)) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status_value") + stream.WriteString(string(object.statusValue)) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonStatusCondition reads a value of the 'addon_status_condition' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonStatusCondition(source interface{}) (object *AddonStatusCondition, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonStatusCondition(iterator) + err = iterator.Error + return +} + +// ReadAddonStatusCondition reads a value of the 'addon_status_condition' type from the given iterator. +func ReadAddonStatusCondition(iterator *jsoniter.Iterator) *AddonStatusCondition { + object := &AddonStatusCondition{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "message": + value := iterator.ReadString() + object.message = value + object.bitmap_ |= 1 + case "reason": + value := iterator.ReadString() + object.reason = value + object.bitmap_ |= 2 + case "status_type": + text := iterator.ReadString() + value := AddonStatusConditionType(text) + object.statusType = value + object.bitmap_ |= 4 + case "status_value": + text := iterator.ReadString() + value := AddonStatusConditionValue(text) + object.statusValue = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_status_condition_type_list_type_json.go b/clientapi/addonsmgmt/v1/addon_status_condition_type_list_type_json.go new file mode 100644 index 00000000..44880a88 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_condition_type_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonStatusConditionTypeList writes a list of values of the 'addon_status_condition_type' type to +// the given writer. +func MarshalAddonStatusConditionTypeList(list []AddonStatusConditionType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonStatusConditionTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonStatusConditionTypeList writes a list of value of the 'addon_status_condition_type' type to +// the given stream. +func WriteAddonStatusConditionTypeList(list []AddonStatusConditionType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonStatusConditionTypeList reads a list of values of the 'addon_status_condition_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonStatusConditionTypeList(source interface{}) (items []AddonStatusConditionType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonStatusConditionTypeList(iterator) + err = iterator.Error + return +} + +// ReadAddonStatusConditionTypeList reads list of values of the ”addon_status_condition_type' type from +// the given iterator. +func ReadAddonStatusConditionTypeList(iterator *jsoniter.Iterator) []AddonStatusConditionType { + list := []AddonStatusConditionType{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := AddonStatusConditionType(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_status_condition_type_type.go b/clientapi/addonsmgmt/v1/addon_status_condition_type_type.go new file mode 100644 index 00000000..44aee179 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_condition_type_type.go @@ -0,0 +1,44 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonStatusConditionType represents the values of the 'addon_status_condition_type' enumerated type. +type AddonStatusConditionType string + +const ( + // + AddonStatusConditionTypeAvailable AddonStatusConditionType = "Available" + // + AddonStatusConditionTypeDegraded AddonStatusConditionType = "Degraded" + // + AddonStatusConditionTypeDeleteTimeout AddonStatusConditionType = "DeleteTimeout" + // + AddonStatusConditionTypeHealthy AddonStatusConditionType = "Healthy" + // + AddonStatusConditionTypeInstalled AddonStatusConditionType = "Installed" + // + AddonStatusConditionTypePaused AddonStatusConditionType = "Paused" + // + AddonStatusConditionTypeReadyToBeDeleted AddonStatusConditionType = "ReadyToBeDeleted" + // + AddonStatusConditionTypeUpgradeStarted AddonStatusConditionType = "UpgradeStarted" + // + AddonStatusConditionTypeUpgradeSucceeded AddonStatusConditionType = "UpgradeSucceeded" +) diff --git a/clientapi/addonsmgmt/v1/addon_status_condition_value_list_type_json.go b/clientapi/addonsmgmt/v1/addon_status_condition_value_list_type_json.go new file mode 100644 index 00000000..dce4d04f --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_condition_value_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonStatusConditionValueList writes a list of values of the 'addon_status_condition_value' type to +// the given writer. +func MarshalAddonStatusConditionValueList(list []AddonStatusConditionValue, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonStatusConditionValueList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonStatusConditionValueList writes a list of value of the 'addon_status_condition_value' type to +// the given stream. +func WriteAddonStatusConditionValueList(list []AddonStatusConditionValue, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonStatusConditionValueList reads a list of values of the 'addon_status_condition_value' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonStatusConditionValueList(source interface{}) (items []AddonStatusConditionValue, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonStatusConditionValueList(iterator) + err = iterator.Error + return +} + +// ReadAddonStatusConditionValueList reads list of values of the ”addon_status_condition_value' type from +// the given iterator. +func ReadAddonStatusConditionValueList(iterator *jsoniter.Iterator) []AddonStatusConditionValue { + list := []AddonStatusConditionValue{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := AddonStatusConditionValue(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_status_condition_value_type.go b/clientapi/addonsmgmt/v1/addon_status_condition_value_type.go new file mode 100644 index 00000000..6a3231fa --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_condition_value_type.go @@ -0,0 +1,32 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonStatusConditionValue represents the values of the 'addon_status_condition_value' enumerated type. +type AddonStatusConditionValue string + +const ( + // + AddonStatusConditionValueFalse AddonStatusConditionValue = "False" + // + AddonStatusConditionValueTrue AddonStatusConditionValue = "True" + // + AddonStatusConditionValueUnknown AddonStatusConditionValue = "Unknown" +) diff --git a/clientapi/addonsmgmt/v1/addon_status_list_builder.go b/clientapi/addonsmgmt/v1/addon_status_list_builder.go new file mode 100644 index 00000000..5808a13f --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonStatusListBuilder contains the data and logic needed to build +// 'addon_status' objects. +type AddonStatusListBuilder struct { + items []*AddonStatusBuilder +} + +// NewAddonStatusList creates a new builder of 'addon_status' objects. +func NewAddonStatusList() *AddonStatusListBuilder { + return new(AddonStatusListBuilder) +} + +// Items sets the items of the list. +func (b *AddonStatusListBuilder) Items(values ...*AddonStatusBuilder) *AddonStatusListBuilder { + b.items = make([]*AddonStatusBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonStatusListBuilder) 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 *AddonStatusListBuilder) Copy(list *AddonStatusList) *AddonStatusListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonStatusBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonStatus().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_status' objects using the +// configuration stored in the builder. +func (b *AddonStatusListBuilder) Build() (list *AddonStatusList, err error) { + items := make([]*AddonStatus, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonStatusList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_status_list_type_json.go b/clientapi/addonsmgmt/v1/addon_status_list_type_json.go new file mode 100644 index 00000000..c7dd7962 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonStatusList writes a list of values of the 'addon_status' type to +// the given writer. +func MarshalAddonStatusList(list []*AddonStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonStatusList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonStatusList writes a list of value of the 'addon_status' type to +// the given stream. +func WriteAddonStatusList(list []*AddonStatus, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonStatus(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonStatusList reads a list of values of the 'addon_status' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonStatusList(source interface{}) (items []*AddonStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonStatusList(iterator) + err = iterator.Error + return +} + +// ReadAddonStatusList reads list of values of the ”addon_status' type from +// the given iterator. +func ReadAddonStatusList(iterator *jsoniter.Iterator) []*AddonStatus { + list := []*AddonStatus{} + for iterator.ReadArray() { + item := ReadAddonStatus(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_status_type.go b/clientapi/addonsmgmt/v1/addon_status_type.go new file mode 100644 index 00000000..370f22e6 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_type.go @@ -0,0 +1,337 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonStatusKind is the name of the type used to represent objects +// of type 'addon_status'. +const AddonStatusKind = "AddonStatus" + +// AddonStatusLinkKind is the name of the type used to represent links +// to objects of type 'addon_status'. +const AddonStatusLinkKind = "AddonStatusLink" + +// AddonStatusNilKind is the name of the type used to nil references +// to objects of type 'addon_status'. +const AddonStatusNilKind = "AddonStatusNil" + +// AddonStatus represents the values of the 'addon_status' type. +// +// Representation of an addon status. +type AddonStatus struct { + bitmap_ uint32 + id string + href string + addonId string + correlationID string + statusConditions []*AddonStatusCondition + version string +} + +// Kind returns the name of the type of the object. +func (o *AddonStatus) Kind() string { + if o == nil { + return AddonStatusNilKind + } + if o.bitmap_&1 != 0 { + return AddonStatusLinkKind + } + return AddonStatusKind +} + +// Link returns true if this is a link. +func (o *AddonStatus) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddonStatus) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddonStatus) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddonStatus) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddonStatus) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonStatus) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AddonId returns the value of the 'addon_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID of the addon whose status belongs to. +func (o *AddonStatus) AddonId() string { + if o != nil && o.bitmap_&8 != 0 { + return o.addonId + } + return "" +} + +// GetAddonId returns the value of the 'addon_id' attribute and +// a flag indicating if the attribute has a value. +// +// ID of the addon whose status belongs to. +func (o *AddonStatus) GetAddonId() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.addonId + } + return +} + +// CorrelationID returns the value of the 'correlation_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Identifier for co-relating current AddonCR revision and reported status. +func (o *AddonStatus) CorrelationID() string { + if o != nil && o.bitmap_&16 != 0 { + return o.correlationID + } + return "" +} + +// GetCorrelationID returns the value of the 'correlation_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Identifier for co-relating current AddonCR revision and reported status. +func (o *AddonStatus) GetCorrelationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.correlationID + } + return +} + +// StatusConditions returns the value of the 'status_conditions' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of reported addon status conditions +func (o *AddonStatus) StatusConditions() []*AddonStatusCondition { + if o != nil && o.bitmap_&32 != 0 { + return o.statusConditions + } + return nil +} + +// GetStatusConditions returns the value of the 'status_conditions' attribute and +// a flag indicating if the attribute has a value. +// +// List of reported addon status conditions +func (o *AddonStatus) GetStatusConditions() (value []*AddonStatusCondition, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.statusConditions + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Version of the addon reporting the status +func (o *AddonStatus) Version() string { + if o != nil && o.bitmap_&64 != 0 { + return o.version + } + return "" +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +// +// Version of the addon reporting the status +func (o *AddonStatus) GetVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.version + } + return +} + +// AddonStatusListKind is the name of the type used to represent list of objects of +// type 'addon_status'. +const AddonStatusListKind = "AddonStatusList" + +// AddonStatusListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_status'. +const AddonStatusListLinkKind = "AddonStatusListLink" + +// AddonStatusNilKind is the name of the type used to nil lists of objects of +// type 'addon_status'. +const AddonStatusListNilKind = "AddonStatusListNil" + +// AddonStatusList is a list of values of the 'addon_status' type. +type AddonStatusList struct { + href string + link bool + items []*AddonStatus +} + +// Kind returns the name of the type of the object. +func (l *AddonStatusList) Kind() string { + if l == nil { + return AddonStatusListNilKind + } + if l.link { + return AddonStatusListLinkKind + } + return AddonStatusListKind +} + +// Link returns true iif this is a link. +func (l *AddonStatusList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddonStatusList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddonStatusList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddonStatusList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonStatusList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonStatusList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonStatusList) SetItems(items []*AddonStatus) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonStatusList) Items() []*AddonStatus { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonStatusList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonStatusList) Get(i int) *AddonStatus { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonStatusList) Slice() []*AddonStatus { + var slice []*AddonStatus + if l == nil { + slice = make([]*AddonStatus, 0) + } else { + slice = make([]*AddonStatus, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonStatusList) Each(f func(item *AddonStatus) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonStatusList) Range(f func(index int, item *AddonStatus) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_status_type_json.go b/clientapi/addonsmgmt/v1/addon_status_type_json.go new file mode 100644 index 00000000..eeac2c65 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_status_type_json.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonStatus writes a value of the 'addon_status' type to the given writer. +func MarshalAddonStatus(object *AddonStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonStatus(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonStatus writes a value of the 'addon_status' type to the given stream. +func WriteAddonStatus(object *AddonStatus, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddonStatusLinkKind) + } else { + stream.WriteString(AddonStatusKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("addon_id") + stream.WriteString(object.addonId) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("correlation_id") + stream.WriteString(object.correlationID) + count++ + } + present_ = object.bitmap_&32 != 0 && object.statusConditions != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status_conditions") + WriteAddonStatusConditionList(object.statusConditions, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + stream.WriteString(object.version) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonStatus reads a value of the 'addon_status' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonStatus(source interface{}) (object *AddonStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonStatus(iterator) + err = iterator.Error + return +} + +// ReadAddonStatus reads a value of the 'addon_status' type from the given iterator. +func ReadAddonStatus(iterator *jsoniter.Iterator) *AddonStatus { + object := &AddonStatus{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddonStatusLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "addon_id": + value := iterator.ReadString() + object.addonId = value + object.bitmap_ |= 8 + case "correlation_id": + value := iterator.ReadString() + object.correlationID = value + object.bitmap_ |= 16 + case "status_conditions": + value := ReadAddonStatusConditionList(iterator) + object.statusConditions = value + object.bitmap_ |= 32 + case "version": + value := iterator.ReadString() + object.version = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_sub_operator_builder.go b/clientapi/addonsmgmt/v1/addon_sub_operator_builder.go new file mode 100644 index 00000000..2073c89e --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_sub_operator_builder.go @@ -0,0 +1,109 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonSubOperatorBuilder contains the data and logic needed to build 'addon_sub_operator' objects. +// +// Representation of an addon sub operator. A sub operator is an operator +// who's life cycle is controlled by the addon umbrella operator. +type AddonSubOperatorBuilder struct { + bitmap_ uint32 + addon *AddonBuilder + operatorName string + operatorNamespace string + enabled bool +} + +// NewAddonSubOperator creates a new builder of 'addon_sub_operator' objects. +func NewAddonSubOperator() *AddonSubOperatorBuilder { + return &AddonSubOperatorBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonSubOperatorBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Addon sets the value of the 'addon' attribute to the given value. +// +// Representation of an addon that can be installed in a cluster. +func (b *AddonSubOperatorBuilder) Addon(value *AddonBuilder) *AddonSubOperatorBuilder { + b.addon = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddonSubOperatorBuilder) Enabled(value bool) *AddonSubOperatorBuilder { + b.enabled = value + b.bitmap_ |= 2 + return b +} + +// OperatorName sets the value of the 'operator_name' attribute to the given value. +func (b *AddonSubOperatorBuilder) OperatorName(value string) *AddonSubOperatorBuilder { + b.operatorName = value + b.bitmap_ |= 4 + return b +} + +// OperatorNamespace sets the value of the 'operator_namespace' attribute to the given value. +func (b *AddonSubOperatorBuilder) OperatorNamespace(value string) *AddonSubOperatorBuilder { + b.operatorNamespace = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonSubOperatorBuilder) Copy(object *AddonSubOperator) *AddonSubOperatorBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.addon != nil { + b.addon = NewAddon().Copy(object.addon) + } else { + b.addon = nil + } + b.enabled = object.enabled + b.operatorName = object.operatorName + b.operatorNamespace = object.operatorNamespace + return b +} + +// Build creates a 'addon_sub_operator' object using the configuration stored in the builder. +func (b *AddonSubOperatorBuilder) Build() (object *AddonSubOperator, err error) { + object = new(AddonSubOperator) + object.bitmap_ = b.bitmap_ + if b.addon != nil { + object.addon, err = b.addon.Build() + if err != nil { + return + } + } + object.enabled = b.enabled + object.operatorName = b.operatorName + object.operatorNamespace = b.operatorNamespace + return +} diff --git a/clientapi/addonsmgmt/v1/addon_sub_operator_list_builder.go b/clientapi/addonsmgmt/v1/addon_sub_operator_list_builder.go new file mode 100644 index 00000000..b0ab353d --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_sub_operator_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonSubOperatorListBuilder contains the data and logic needed to build +// 'addon_sub_operator' objects. +type AddonSubOperatorListBuilder struct { + items []*AddonSubOperatorBuilder +} + +// NewAddonSubOperatorList creates a new builder of 'addon_sub_operator' objects. +func NewAddonSubOperatorList() *AddonSubOperatorListBuilder { + return new(AddonSubOperatorListBuilder) +} + +// Items sets the items of the list. +func (b *AddonSubOperatorListBuilder) Items(values ...*AddonSubOperatorBuilder) *AddonSubOperatorListBuilder { + b.items = make([]*AddonSubOperatorBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonSubOperatorListBuilder) 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 *AddonSubOperatorListBuilder) Copy(list *AddonSubOperatorList) *AddonSubOperatorListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonSubOperatorBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonSubOperator().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_sub_operator' objects using the +// configuration stored in the builder. +func (b *AddonSubOperatorListBuilder) Build() (list *AddonSubOperatorList, err error) { + items := make([]*AddonSubOperator, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonSubOperatorList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_sub_operator_list_type_json.go b/clientapi/addonsmgmt/v1/addon_sub_operator_list_type_json.go new file mode 100644 index 00000000..d8621742 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_sub_operator_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonSubOperatorList writes a list of values of the 'addon_sub_operator' type to +// the given writer. +func MarshalAddonSubOperatorList(list []*AddonSubOperator, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonSubOperatorList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonSubOperatorList writes a list of value of the 'addon_sub_operator' type to +// the given stream. +func WriteAddonSubOperatorList(list []*AddonSubOperator, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonSubOperator(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonSubOperatorList reads a list of values of the 'addon_sub_operator' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonSubOperatorList(source interface{}) (items []*AddonSubOperator, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonSubOperatorList(iterator) + err = iterator.Error + return +} + +// ReadAddonSubOperatorList reads list of values of the ”addon_sub_operator' type from +// the given iterator. +func ReadAddonSubOperatorList(iterator *jsoniter.Iterator) []*AddonSubOperator { + list := []*AddonSubOperator{} + for iterator.ReadArray() { + item := ReadAddonSubOperator(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_sub_operator_type.go b/clientapi/addonsmgmt/v1/addon_sub_operator_type.go new file mode 100644 index 00000000..269356a2 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_sub_operator_type.go @@ -0,0 +1,234 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonSubOperator represents the values of the 'addon_sub_operator' type. +// +// Representation of an addon sub operator. A sub operator is an operator +// who's life cycle is controlled by the addon umbrella operator. +type AddonSubOperator struct { + bitmap_ uint32 + addon *Addon + operatorName string + operatorNamespace string + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonSubOperator) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Addon returns the value of the 'addon' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *AddonSubOperator) Addon() *Addon { + if o != nil && o.bitmap_&1 != 0 { + return o.addon + } + return nil +} + +// GetAddon returns the value of the 'addon' attribute and +// a flag indicating if the attribute has a value. +func (o *AddonSubOperator) GetAddon() (value *Addon, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.addon + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if the sub operator is enabled for the addon +func (o *AddonSubOperator) Enabled() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if the sub operator is enabled for the addon +func (o *AddonSubOperator) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.enabled + } + return +} + +// OperatorName returns the value of the 'operator_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the addon sub operator +func (o *AddonSubOperator) OperatorName() string { + if o != nil && o.bitmap_&4 != 0 { + return o.operatorName + } + return "" +} + +// GetOperatorName returns the value of the 'operator_name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the addon sub operator +func (o *AddonSubOperator) GetOperatorName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.operatorName + } + return +} + +// OperatorNamespace returns the value of the 'operator_namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Namespace of the addon sub operator +func (o *AddonSubOperator) OperatorNamespace() string { + if o != nil && o.bitmap_&8 != 0 { + return o.operatorNamespace + } + return "" +} + +// GetOperatorNamespace returns the value of the 'operator_namespace' attribute and +// a flag indicating if the attribute has a value. +// +// Namespace of the addon sub operator +func (o *AddonSubOperator) GetOperatorNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.operatorNamespace + } + return +} + +// AddonSubOperatorListKind is the name of the type used to represent list of objects of +// type 'addon_sub_operator'. +const AddonSubOperatorListKind = "AddonSubOperatorList" + +// AddonSubOperatorListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_sub_operator'. +const AddonSubOperatorListLinkKind = "AddonSubOperatorListLink" + +// AddonSubOperatorNilKind is the name of the type used to nil lists of objects of +// type 'addon_sub_operator'. +const AddonSubOperatorListNilKind = "AddonSubOperatorListNil" + +// AddonSubOperatorList is a list of values of the 'addon_sub_operator' type. +type AddonSubOperatorList struct { + href string + link bool + items []*AddonSubOperator +} + +// Len returns the length of the list. +func (l *AddonSubOperatorList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonSubOperatorList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonSubOperatorList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonSubOperatorList) SetItems(items []*AddonSubOperator) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonSubOperatorList) Items() []*AddonSubOperator { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonSubOperatorList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonSubOperatorList) Get(i int) *AddonSubOperator { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonSubOperatorList) Slice() []*AddonSubOperator { + var slice []*AddonSubOperator + if l == nil { + slice = make([]*AddonSubOperator, 0) + } else { + slice = make([]*AddonSubOperator, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonSubOperatorList) Each(f func(item *AddonSubOperator) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonSubOperatorList) Range(f func(index int, item *AddonSubOperator) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_sub_operator_type_json.go b/clientapi/addonsmgmt/v1/addon_sub_operator_type_json.go new file mode 100644 index 00000000..71dbbe53 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_sub_operator_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonSubOperator writes a value of the 'addon_sub_operator' type to the given writer. +func MarshalAddonSubOperator(object *AddonSubOperator, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonSubOperator(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonSubOperator writes a value of the 'addon_sub_operator' type to the given stream. +func WriteAddonSubOperator(object *AddonSubOperator, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.addon != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("addon") + WriteAddon(object.addon, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_name") + stream.WriteString(object.operatorName) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_namespace") + stream.WriteString(object.operatorNamespace) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonSubOperator reads a value of the 'addon_sub_operator' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonSubOperator(source interface{}) (object *AddonSubOperator, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonSubOperator(iterator) + err = iterator.Error + return +} + +// ReadAddonSubOperator reads a value of the 'addon_sub_operator' type from the given iterator. +func ReadAddonSubOperator(iterator *jsoniter.Iterator) *AddonSubOperator { + object := &AddonSubOperator{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "addon": + value := ReadAddon(iterator) + object.addon = value + object.bitmap_ |= 1 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 2 + case "operator_name": + value := iterator.ReadString() + object.operatorName = value + object.bitmap_ |= 4 + case "operator_namespace": + value := iterator.ReadString() + object.operatorNamespace = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_type.go b/clientapi/addonsmgmt/v1/addon_type.go new file mode 100644 index 00000000..9258eb39 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_type.go @@ -0,0 +1,793 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonKind is the name of the type used to represent objects +// of type 'addon'. +const AddonKind = "Addon" + +// AddonLinkKind is the name of the type used to represent links +// to objects of type 'addon'. +const AddonLinkKind = "AddonLink" + +// AddonNilKind is the name of the type used to nil references +// to objects of type 'addon'. +const AddonNilKind = "AddonNil" + +// Addon represents the values of the 'addon' type. +// +// Representation of an addon that can be installed in a cluster. +type Addon struct { + bitmap_ uint32 + id string + href string + commonAnnotations map[string]string + commonLabels map[string]string + config *AddonConfig + credentialsRequests []*CredentialRequest + description string + docsLink string + icon string + installMode AddonInstallMode + label string + name string + namespaces []*AddonNamespace + operatorName string + parameters *AddonParameterList + requirements []*AddonRequirement + resourceCost float64 + resourceName string + subOperators []*AddonSubOperator + targetNamespace string + version *AddonVersion + enabled bool + hasExternalResources bool + hidden bool + managedService bool +} + +// Kind returns the name of the type of the object. +func (o *Addon) Kind() string { + if o == nil { + return AddonNilKind + } + if o.bitmap_&1 != 0 { + return AddonLinkKind + } + return AddonKind +} + +// Link returns true if this is a link. +func (o *Addon) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Addon) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Addon) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Addon) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Addon) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Addon) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CommonAnnotations returns the value of the 'common_annotations' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Common Annotations for this addon. +func (o *Addon) CommonAnnotations() map[string]string { + if o != nil && o.bitmap_&8 != 0 { + return o.commonAnnotations + } + return nil +} + +// GetCommonAnnotations returns the value of the 'common_annotations' attribute and +// a flag indicating if the attribute has a value. +// +// Common Annotations for this addon. +func (o *Addon) GetCommonAnnotations() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.commonAnnotations + } + return +} + +// CommonLabels returns the value of the 'common_labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Common Labels for this addon. +func (o *Addon) CommonLabels() map[string]string { + if o != nil && o.bitmap_&16 != 0 { + return o.commonLabels + } + return nil +} + +// GetCommonLabels returns the value of the 'common_labels' attribute and +// a flag indicating if the attribute has a value. +// +// Common Labels for this addon. +func (o *Addon) GetCommonLabels() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.commonLabels + } + return +} + +// Config returns the value of the 'config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional configs to be used by the addon once its installed in the cluster. +func (o *Addon) Config() *AddonConfig { + if o != nil && o.bitmap_&32 != 0 { + return o.config + } + return nil +} + +// GetConfig returns the value of the 'config' attribute and +// a flag indicating if the attribute has a value. +// +// Additional configs to be used by the addon once its installed in the cluster. +func (o *Addon) GetConfig() (value *AddonConfig, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.config + } + return +} + +// CredentialsRequests returns the value of the 'credentials_requests' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of credentials requests to authenticate operators to access cloud resources. +func (o *Addon) CredentialsRequests() []*CredentialRequest { + if o != nil && o.bitmap_&64 != 0 { + return o.credentialsRequests + } + return nil +} + +// GetCredentialsRequests returns the value of the 'credentials_requests' attribute and +// a flag indicating if the attribute has a value. +// +// List of credentials requests to authenticate operators to access cloud resources. +func (o *Addon) GetCredentialsRequests() (value []*CredentialRequest, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.credentialsRequests + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Description of the addon. +func (o *Addon) Description() string { + if o != nil && o.bitmap_&128 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Description of the addon. +func (o *Addon) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.description + } + return +} + +// DocsLink returns the value of the 'docs_link' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to documentation about the addon. +func (o *Addon) DocsLink() string { + if o != nil && o.bitmap_&256 != 0 { + return o.docsLink + } + return "" +} + +// GetDocsLink returns the value of the 'docs_link' attribute and +// a flag indicating if the attribute has a value. +// +// Link to documentation about the addon. +func (o *Addon) GetDocsLink() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.docsLink + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this addon can be added to clusters. +func (o *Addon) Enabled() bool { + if o != nil && o.bitmap_&512 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this addon can be added to clusters. +func (o *Addon) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.enabled + } + return +} + +// HasExternalResources returns the value of the 'has_external_resources' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this addon has external resources associated with it +func (o *Addon) HasExternalResources() bool { + if o != nil && o.bitmap_&1024 != 0 { + return o.hasExternalResources + } + return false +} + +// GetHasExternalResources returns the value of the 'has_external_resources' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this addon has external resources associated with it +func (o *Addon) GetHasExternalResources() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.hasExternalResources + } + return +} + +// Hidden returns the value of the 'hidden' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this addon is hidden. +func (o *Addon) Hidden() bool { + if o != nil && o.bitmap_&2048 != 0 { + return o.hidden + } + return false +} + +// GetHidden returns the value of the 'hidden' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this addon is hidden. +func (o *Addon) GetHidden() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.hidden + } + return +} + +// Icon returns the value of the 'icon' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Base64-encoded icon representing an addon. The icon should be in PNG format. +func (o *Addon) Icon() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.icon + } + return "" +} + +// GetIcon returns the value of the 'icon' attribute and +// a flag indicating if the attribute has a value. +// +// Base64-encoded icon representing an addon. The icon should be in PNG format. +func (o *Addon) GetIcon() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.icon + } + return +} + +// InstallMode returns the value of the 'install_mode' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The mode in which the addon is deployed. +func (o *Addon) InstallMode() AddonInstallMode { + if o != nil && o.bitmap_&8192 != 0 { + return o.installMode + } + return AddonInstallMode("") +} + +// GetInstallMode returns the value of the 'install_mode' attribute and +// a flag indicating if the attribute has a value. +// +// The mode in which the addon is deployed. +func (o *Addon) GetInstallMode() (value AddonInstallMode, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.installMode + } + return +} + +// Label returns the value of the 'label' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Label used to attach to a cluster deployment when addon is installed. +func (o *Addon) Label() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.label + } + return "" +} + +// GetLabel returns the value of the 'label' attribute and +// a flag indicating if the attribute has a value. +// +// Label used to attach to a cluster deployment when addon is installed. +func (o *Addon) GetLabel() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.label + } + return +} + +// ManagedService returns the value of the 'managed_service' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if addon is part of a managed service +func (o *Addon) ManagedService() bool { + if o != nil && o.bitmap_&32768 != 0 { + return o.managedService + } + return false +} + +// GetManagedService returns the value of the 'managed_service' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if addon is part of a managed service +func (o *Addon) GetManagedService() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.managedService + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the addon. +func (o *Addon) Name() string { + if o != nil && o.bitmap_&65536 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the addon. +func (o *Addon) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.name + } + return +} + +// Namespaces returns the value of the 'namespaces' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of namespaces associated with this addon. +func (o *Addon) Namespaces() []*AddonNamespace { + if o != nil && o.bitmap_&131072 != 0 { + return o.namespaces + } + return nil +} + +// GetNamespaces returns the value of the 'namespaces' attribute and +// a flag indicating if the attribute has a value. +// +// List of namespaces associated with this addon. +func (o *Addon) GetNamespaces() (value []*AddonNamespace, ok bool) { + ok = o != nil && o.bitmap_&131072 != 0 + if ok { + value = o.namespaces + } + return +} + +// OperatorName returns the value of the 'operator_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the operator installed by this addon. +func (o *Addon) OperatorName() string { + if o != nil && o.bitmap_&262144 != 0 { + return o.operatorName + } + return "" +} + +// GetOperatorName returns the value of the 'operator_name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the operator installed by this addon. +func (o *Addon) GetOperatorName() (value string, ok bool) { + ok = o != nil && o.bitmap_&262144 != 0 + if ok { + value = o.operatorName + } + 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 addon. +func (o *Addon) Parameters() *AddonParameterList { + if o != nil && o.bitmap_&524288 != 0 { + return o.parameters + } + return nil +} + +// GetParameters returns the value of the 'parameters' attribute and +// a flag indicating if the attribute has a value. +// +// List of parameters for this addon. +func (o *Addon) GetParameters() (value *AddonParameterList, ok bool) { + ok = o != nil && o.bitmap_&524288 != 0 + if ok { + value = o.parameters + } + return +} + +// Requirements returns the value of the 'requirements' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of requirements for this addon. +func (o *Addon) Requirements() []*AddonRequirement { + if o != nil && o.bitmap_&1048576 != 0 { + return o.requirements + } + return nil +} + +// GetRequirements returns the value of the 'requirements' attribute and +// a flag indicating if the attribute has a value. +// +// List of requirements for this addon. +func (o *Addon) GetRequirements() (value []*AddonRequirement, ok bool) { + ok = o != nil && o.bitmap_&1048576 != 0 + if ok { + value = o.requirements + } + return +} + +// ResourceCost returns the value of the 'resource_cost' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Used to determine how many units of quota an addon consumes per resource name. +func (o *Addon) ResourceCost() float64 { + if o != nil && o.bitmap_&2097152 != 0 { + return o.resourceCost + } + return 0.0 +} + +// GetResourceCost returns the value of the 'resource_cost' attribute and +// a flag indicating if the attribute has a value. +// +// Used to determine how many units of quota an addon consumes per resource name. +func (o *Addon) GetResourceCost() (value float64, ok bool) { + ok = o != nil && o.bitmap_&2097152 != 0 + if ok { + value = o.resourceCost + } + return +} + +// ResourceName returns the value of the 'resource_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Used to determine from where to reserve quota for this addon. +func (o *Addon) ResourceName() string { + if o != nil && o.bitmap_&4194304 != 0 { + return o.resourceName + } + return "" +} + +// GetResourceName returns the value of the 'resource_name' attribute and +// a flag indicating if the attribute has a value. +// +// Used to determine from where to reserve quota for this addon. +func (o *Addon) GetResourceName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4194304 != 0 + if ok { + value = o.resourceName + } + return +} + +// SubOperators returns the value of the 'sub_operators' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of sub operators for this addon. +func (o *Addon) SubOperators() []*AddonSubOperator { + if o != nil && o.bitmap_&8388608 != 0 { + return o.subOperators + } + return nil +} + +// GetSubOperators returns the value of the 'sub_operators' attribute and +// a flag indicating if the attribute has a value. +// +// List of sub operators for this addon. +func (o *Addon) GetSubOperators() (value []*AddonSubOperator, ok bool) { + ok = o != nil && o.bitmap_&8388608 != 0 + if ok { + value = o.subOperators + } + return +} + +// TargetNamespace returns the value of the 'target_namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The namespace in which the addon CRD exists. +func (o *Addon) TargetNamespace() string { + if o != nil && o.bitmap_&16777216 != 0 { + return o.targetNamespace + } + return "" +} + +// GetTargetNamespace returns the value of the 'target_namespace' attribute and +// a flag indicating if the attribute has a value. +// +// The namespace in which the addon CRD exists. +func (o *Addon) GetTargetNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&16777216 != 0 + if ok { + value = o.targetNamespace + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the current default version of this addon. +func (o *Addon) Version() *AddonVersion { + if o != nil && o.bitmap_&33554432 != 0 { + return o.version + } + return nil +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the current default version of this addon. +func (o *Addon) GetVersion() (value *AddonVersion, ok bool) { + ok = o != nil && o.bitmap_&33554432 != 0 + if ok { + value = o.version + } + return +} + +// AddonListKind is the name of the type used to represent list of objects of +// type 'addon'. +const AddonListKind = "AddonList" + +// AddonListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon'. +const AddonListLinkKind = "AddonListLink" + +// AddonNilKind is the name of the type used to nil lists of objects of +// type 'addon'. +const AddonListNilKind = "AddonListNil" + +// AddonList is a list of values of the 'addon' type. +type AddonList struct { + href string + link bool + items []*Addon +} + +// Kind returns the name of the type of the object. +func (l *AddonList) Kind() string { + if l == nil { + return AddonListNilKind + } + if l.link { + return AddonListLinkKind + } + return AddonListKind +} + +// Link returns true iif this is a link. +func (l *AddonList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddonList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddonList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddonList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonList) SetItems(items []*Addon) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonList) Items() []*Addon { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonList) Get(i int) *Addon { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonList) Slice() []*Addon { + var slice []*Addon + if l == nil { + slice = make([]*Addon, 0) + } else { + slice = make([]*Addon, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonList) Each(f func(item *Addon) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonList) Range(f func(index int, item *Addon) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_type_json.go b/clientapi/addonsmgmt/v1/addon_type_json.go new file mode 100644 index 00000000..e51b9671 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_type_json.go @@ -0,0 +1,484 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddon writes a value of the 'addon' type to the given writer. +func MarshalAddon(object *Addon, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddon(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddon writes a value of the 'addon' type to the given stream. +func WriteAddon(object *Addon, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddonLinkKind) + } else { + stream.WriteString(AddonKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.commonAnnotations != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("common_annotations") + if object.commonAnnotations != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.commonAnnotations)) + i := 0 + for key := range object.commonAnnotations { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.commonAnnotations[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&16 != 0 && object.commonLabels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("common_labels") + if object.commonLabels != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.commonLabels)) + i := 0 + for key := range object.commonLabels { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.commonLabels[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&32 != 0 && object.config != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("config") + WriteAddonConfig(object.config, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.credentialsRequests != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("credentials_requests") + WriteCredentialRequestList(object.credentialsRequests, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("docs_link") + stream.WriteString(object.docsLink) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("has_external_resources") + stream.WriteBool(object.hasExternalResources) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hidden") + stream.WriteBool(object.hidden) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("icon") + stream.WriteString(object.icon) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("install_mode") + stream.WriteString(string(object.installMode)) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("label") + stream.WriteString(object.label) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_service") + stream.WriteBool(object.managedService) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&131072 != 0 && object.namespaces != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("namespaces") + WriteAddonNamespaceList(object.namespaces, stream) + count++ + } + present_ = object.bitmap_&262144 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_name") + stream.WriteString(object.operatorName) + count++ + } + present_ = object.bitmap_&524288 != 0 && object.parameters != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("parameters") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteAddonParameterList(object.parameters.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&1048576 != 0 && object.requirements != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("requirements") + WriteAddonRequirementList(object.requirements, stream) + count++ + } + present_ = object.bitmap_&2097152 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_cost") + stream.WriteFloat64(object.resourceCost) + count++ + } + present_ = object.bitmap_&4194304 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_name") + stream.WriteString(object.resourceName) + count++ + } + present_ = object.bitmap_&8388608 != 0 && object.subOperators != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sub_operators") + WriteAddonSubOperatorList(object.subOperators, stream) + count++ + } + present_ = object.bitmap_&16777216 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("target_namespace") + stream.WriteString(object.targetNamespace) + count++ + } + present_ = object.bitmap_&33554432 != 0 && object.version != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + WriteAddonVersion(object.version, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddon reads a value of the 'addon' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddon(source interface{}) (object *Addon, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddon(iterator) + err = iterator.Error + return +} + +// ReadAddon reads a value of the 'addon' type from the given iterator. +func ReadAddon(iterator *jsoniter.Iterator) *Addon { + object := &Addon{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddonLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "common_annotations": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.commonAnnotations = value + object.bitmap_ |= 8 + case "common_labels": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.commonLabels = value + object.bitmap_ |= 16 + case "config": + value := ReadAddonConfig(iterator) + object.config = value + object.bitmap_ |= 32 + case "credentials_requests": + value := ReadCredentialRequestList(iterator) + object.credentialsRequests = value + object.bitmap_ |= 64 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 128 + case "docs_link": + value := iterator.ReadString() + object.docsLink = value + object.bitmap_ |= 256 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 512 + case "has_external_resources": + value := iterator.ReadBool() + object.hasExternalResources = value + object.bitmap_ |= 1024 + case "hidden": + value := iterator.ReadBool() + object.hidden = value + object.bitmap_ |= 2048 + case "icon": + value := iterator.ReadString() + object.icon = value + object.bitmap_ |= 4096 + case "install_mode": + text := iterator.ReadString() + value := AddonInstallMode(text) + object.installMode = value + object.bitmap_ |= 8192 + case "label": + value := iterator.ReadString() + object.label = value + object.bitmap_ |= 16384 + case "managed_service": + value := iterator.ReadBool() + object.managedService = value + object.bitmap_ |= 32768 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 65536 + case "namespaces": + value := ReadAddonNamespaceList(iterator) + object.namespaces = value + object.bitmap_ |= 131072 + case "operator_name": + value := iterator.ReadString() + object.operatorName = value + object.bitmap_ |= 262144 + case "parameters": + value := &AddonParameterList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == AddonParameterListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadAddonParameterList(iterator)) + default: + iterator.ReadAny() + } + } + object.parameters = value + object.bitmap_ |= 524288 + case "requirements": + value := ReadAddonRequirementList(iterator) + object.requirements = value + object.bitmap_ |= 1048576 + case "resource_cost": + value := iterator.ReadFloat64() + object.resourceCost = value + object.bitmap_ |= 2097152 + case "resource_name": + value := iterator.ReadString() + object.resourceName = value + object.bitmap_ |= 4194304 + case "sub_operators": + value := ReadAddonSubOperatorList(iterator) + object.subOperators = value + object.bitmap_ |= 8388608 + case "target_namespace": + value := iterator.ReadString() + object.targetNamespace = value + object.bitmap_ |= 16777216 + case "version": + value := ReadAddonVersion(iterator) + object.version = value + object.bitmap_ |= 33554432 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/addon_version_builder.go b/clientapi/addonsmgmt/v1/addon_version_builder.go new file mode 100644 index 00000000..0859caf1 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_version_builder.go @@ -0,0 +1,337 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonVersionBuilder contains the data and logic needed to build 'addon_version' objects. +// +// Representation of an addon version. +type AddonVersionBuilder struct { + bitmap_ uint32 + id string + href string + additionalCatalogSources []*AdditionalCatalogSourceBuilder + availableUpgrades []string + channel string + config *AddonConfigBuilder + metricsFederation *MetricsFederationBuilder + monitoringStack *MonitoringStackBuilder + packageImage string + parameters *AddonParametersBuilder + pullSecretName string + requirements []*AddonRequirementBuilder + sourceImage string + subOperators []*AddonSubOperatorBuilder + enabled bool + upgradePlansCreated bool +} + +// NewAddonVersion creates a new builder of 'addon_version' objects. +func NewAddonVersion() *AddonVersionBuilder { + return &AddonVersionBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddonVersionBuilder) Link(value bool) *AddonVersionBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddonVersionBuilder) ID(value string) *AddonVersionBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddonVersionBuilder) HREF(value string) *AddonVersionBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonVersionBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AdditionalCatalogSources sets the value of the 'additional_catalog_sources' attribute to the given values. +func (b *AddonVersionBuilder) AdditionalCatalogSources(values ...*AdditionalCatalogSourceBuilder) *AddonVersionBuilder { + b.additionalCatalogSources = make([]*AdditionalCatalogSourceBuilder, len(values)) + copy(b.additionalCatalogSources, values) + b.bitmap_ |= 8 + return b +} + +// AvailableUpgrades sets the value of the 'available_upgrades' attribute to the given values. +func (b *AddonVersionBuilder) AvailableUpgrades(values ...string) *AddonVersionBuilder { + b.availableUpgrades = make([]string, len(values)) + copy(b.availableUpgrades, values) + b.bitmap_ |= 16 + return b +} + +// Channel sets the value of the 'channel' attribute to the given value. +func (b *AddonVersionBuilder) Channel(value string) *AddonVersionBuilder { + b.channel = value + b.bitmap_ |= 32 + return b +} + +// Config sets the value of the 'config' attribute to the given value. +// +// Representation of an addon config. +// The attributes under it are to be used by the addon once its installed in the cluster. +func (b *AddonVersionBuilder) Config(value *AddonConfigBuilder) *AddonVersionBuilder { + b.config = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddonVersionBuilder) Enabled(value bool) *AddonVersionBuilder { + b.enabled = value + b.bitmap_ |= 128 + return b +} + +// MetricsFederation sets the value of the 'metrics_federation' attribute to the given value. +// +// Representation of Metrics Federation +func (b *AddonVersionBuilder) MetricsFederation(value *MetricsFederationBuilder) *AddonVersionBuilder { + b.metricsFederation = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// MonitoringStack sets the value of the 'monitoring_stack' attribute to the given value. +// +// Representation of Monitoring Stack +func (b *AddonVersionBuilder) MonitoringStack(value *MonitoringStackBuilder) *AddonVersionBuilder { + b.monitoringStack = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + 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_ |= 1024 + return b +} + +// Parameters sets the value of the 'parameters' attribute to the given value. +// +// Representation of AddonParameters +func (b *AddonVersionBuilder) Parameters(value *AddonParametersBuilder) *AddonVersionBuilder { + b.parameters = value + if value != nil { + b.bitmap_ |= 2048 + } else { + b.bitmap_ &^= 2048 + } + 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_ |= 4096 + 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_ |= 8192 + 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_ |= 16384 + 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_ |= 32768 + return b +} + +// UpgradePlansCreated sets the value of the 'upgrade_plans_created' attribute to the given value. +func (b *AddonVersionBuilder) UpgradePlansCreated(value bool) *AddonVersionBuilder { + b.upgradePlansCreated = value + b.bitmap_ |= 65536 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonVersionBuilder) Copy(object *AddonVersion) *AddonVersionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.additionalCatalogSources != nil { + b.additionalCatalogSources = make([]*AdditionalCatalogSourceBuilder, len(object.additionalCatalogSources)) + for i, v := range object.additionalCatalogSources { + b.additionalCatalogSources[i] = NewAdditionalCatalogSource().Copy(v) + } + } else { + b.additionalCatalogSources = nil + } + if object.availableUpgrades != nil { + b.availableUpgrades = make([]string, len(object.availableUpgrades)) + copy(b.availableUpgrades, object.availableUpgrades) + } else { + b.availableUpgrades = nil + } + b.channel = object.channel + if object.config != nil { + b.config = NewAddonConfig().Copy(object.config) + } else { + b.config = nil + } + b.enabled = object.enabled + if object.metricsFederation != nil { + b.metricsFederation = NewMetricsFederation().Copy(object.metricsFederation) + } else { + b.metricsFederation = nil + } + if object.monitoringStack != nil { + b.monitoringStack = NewMonitoringStack().Copy(object.monitoringStack) + } else { + b.monitoringStack = nil + } + b.packageImage = object.packageImage + if object.parameters != nil { + b.parameters = NewAddonParameters().Copy(object.parameters) + } else { + b.parameters = nil + } + b.pullSecretName = object.pullSecretName + if object.requirements != nil { + b.requirements = make([]*AddonRequirementBuilder, len(object.requirements)) + for i, v := range object.requirements { + b.requirements[i] = NewAddonRequirement().Copy(v) + } + } else { + b.requirements = nil + } + b.sourceImage = object.sourceImage + if object.subOperators != nil { + b.subOperators = make([]*AddonSubOperatorBuilder, len(object.subOperators)) + for i, v := range object.subOperators { + b.subOperators[i] = NewAddonSubOperator().Copy(v) + } + } else { + b.subOperators = nil + } + b.upgradePlansCreated = object.upgradePlansCreated + return b +} + +// Build creates a 'addon_version' object using the configuration stored in the builder. +func (b *AddonVersionBuilder) Build() (object *AddonVersion, err error) { + object = new(AddonVersion) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.additionalCatalogSources != nil { + object.additionalCatalogSources = make([]*AdditionalCatalogSource, len(b.additionalCatalogSources)) + for i, v := range b.additionalCatalogSources { + object.additionalCatalogSources[i], err = v.Build() + if err != nil { + return + } + } + } + if b.availableUpgrades != nil { + object.availableUpgrades = make([]string, len(b.availableUpgrades)) + copy(object.availableUpgrades, b.availableUpgrades) + } + object.channel = b.channel + if b.config != nil { + object.config, err = b.config.Build() + if err != nil { + return + } + } + object.enabled = b.enabled + if b.metricsFederation != nil { + object.metricsFederation, err = b.metricsFederation.Build() + if err != nil { + return + } + } + if b.monitoringStack != nil { + object.monitoringStack, err = b.monitoringStack.Build() + if err != nil { + return + } + } + object.packageImage = b.packageImage + if b.parameters != nil { + object.parameters, err = b.parameters.Build() + if err != nil { + return + } + } + object.pullSecretName = b.pullSecretName + if b.requirements != nil { + object.requirements = make([]*AddonRequirement, len(b.requirements)) + for i, v := range b.requirements { + object.requirements[i], err = v.Build() + if err != nil { + return + } + } + } + object.sourceImage = b.sourceImage + if b.subOperators != nil { + object.subOperators = make([]*AddonSubOperator, len(b.subOperators)) + for i, v := range b.subOperators { + object.subOperators[i], err = v.Build() + if err != nil { + return + } + } + } + object.upgradePlansCreated = b.upgradePlansCreated + return +} diff --git a/clientapi/addonsmgmt/v1/addon_version_list_builder.go b/clientapi/addonsmgmt/v1/addon_version_list_builder.go new file mode 100644 index 00000000..48429f98 --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_version_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonVersionListBuilder contains the data and logic needed to build +// 'addon_version' objects. +type AddonVersionListBuilder struct { + items []*AddonVersionBuilder +} + +// NewAddonVersionList creates a new builder of 'addon_version' objects. +func NewAddonVersionList() *AddonVersionListBuilder { + return new(AddonVersionListBuilder) +} + +// Items sets the items of the list. +func (b *AddonVersionListBuilder) Items(values ...*AddonVersionBuilder) *AddonVersionListBuilder { + b.items = make([]*AddonVersionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonVersionListBuilder) 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 *AddonVersionListBuilder) Copy(list *AddonVersionList) *AddonVersionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonVersionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonVersion().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_version' objects using the +// configuration stored in the builder. +func (b *AddonVersionListBuilder) Build() (list *AddonVersionList, err error) { + items := make([]*AddonVersion, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonVersionList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/addon_version_list_type_json.go b/clientapi/addonsmgmt/v1/addon_version_list_type_json.go new file mode 100644 index 00000000..cc911ddf --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_version_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonVersionList writes a list of values of the 'addon_version' type to +// the given writer. +func MarshalAddonVersionList(list []*AddonVersion, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonVersionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonVersionList writes a list of value of the 'addon_version' type to +// the given stream. +func WriteAddonVersionList(list []*AddonVersion, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonVersion(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonVersionList reads a list of values of the 'addon_version' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonVersionList(source interface{}) (items []*AddonVersion, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonVersionList(iterator) + err = iterator.Error + return +} + +// ReadAddonVersionList reads list of values of the ”addon_version' type from +// the given iterator. +func ReadAddonVersionList(iterator *jsoniter.Iterator) []*AddonVersion { + list := []*AddonVersion{} + for iterator.ReadArray() { + item := ReadAddonVersion(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/addon_version_type.go b/clientapi/addonsmgmt/v1/addon_version_type.go new file mode 100644 index 00000000..72dbe5ce --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_version_type.go @@ -0,0 +1,577 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// AddonVersionKind is the name of the type used to represent objects +// of type 'addon_version'. +const AddonVersionKind = "AddonVersion" + +// AddonVersionLinkKind is the name of the type used to represent links +// to objects of type 'addon_version'. +const AddonVersionLinkKind = "AddonVersionLink" + +// AddonVersionNilKind is the name of the type used to nil references +// to objects of type 'addon_version'. +const AddonVersionNilKind = "AddonVersionNil" + +// AddonVersion represents the values of the 'addon_version' type. +// +// Representation of an addon version. +type AddonVersion struct { + bitmap_ uint32 + id string + href string + additionalCatalogSources []*AdditionalCatalogSource + availableUpgrades []string + channel string + config *AddonConfig + metricsFederation *MetricsFederation + monitoringStack *MonitoringStack + packageImage string + parameters *AddonParameters + pullSecretName string + requirements []*AddonRequirement + sourceImage string + subOperators []*AddonSubOperator + enabled bool + upgradePlansCreated bool +} + +// Kind returns the name of the type of the object. +func (o *AddonVersion) Kind() string { + if o == nil { + return AddonVersionNilKind + } + if o.bitmap_&1 != 0 { + return AddonVersionLinkKind + } + return AddonVersionKind +} + +// Link returns true if this is a link. +func (o *AddonVersion) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddonVersion) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddonVersion) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddonVersion) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddonVersion) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonVersion) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AdditionalCatalogSources returns the value of the 'additional_catalog_sources' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional catalog sources associated with this addon version +func (o *AddonVersion) AdditionalCatalogSources() []*AdditionalCatalogSource { + if o != nil && o.bitmap_&8 != 0 { + return o.additionalCatalogSources + } + return nil +} + +// GetAdditionalCatalogSources returns the value of the 'additional_catalog_sources' attribute and +// a flag indicating if the attribute has a value. +// +// Additional catalog sources associated with this addon version +func (o *AddonVersion) GetAdditionalCatalogSources() (value []*AdditionalCatalogSource, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.additionalCatalogSources + } + return +} + +// AvailableUpgrades returns the value of the 'available_upgrades' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AvailableUpgrades is the list of versions this version can be upgraded to. +func (o *AddonVersion) AvailableUpgrades() []string { + if o != nil && o.bitmap_&16 != 0 { + return o.availableUpgrades + } + return nil +} + +// GetAvailableUpgrades returns the value of the 'available_upgrades' attribute and +// a flag indicating if the attribute has a value. +// +// AvailableUpgrades is the list of versions this version can be upgraded to. +func (o *AddonVersion) GetAvailableUpgrades() (value []string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.availableUpgrades + } + return +} + +// Channel returns the value of the 'channel' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The specific addon catalog source channel of packages +func (o *AddonVersion) Channel() string { + if o != nil && o.bitmap_&32 != 0 { + return o.channel + } + return "" +} + +// GetChannel returns the value of the 'channel' attribute and +// a flag indicating if the attribute has a value. +// +// The specific addon catalog source channel of packages +func (o *AddonVersion) GetChannel() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.channel + } + return +} + +// Config returns the value of the 'config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional configs to be used by the addon once its installed in the cluster. +func (o *AddonVersion) Config() *AddonConfig { + if o != nil && o.bitmap_&64 != 0 { + return o.config + } + return nil +} + +// GetConfig returns the value of the 'config' attribute and +// a flag indicating if the attribute has a value. +// +// Additional configs to be used by the addon once its installed in the cluster. +func (o *AddonVersion) GetConfig() (value *AddonConfig, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.config + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this addon version can be added to clusters. +func (o *AddonVersion) Enabled() bool { + if o != nil && o.bitmap_&128 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this addon version can be added to clusters. +func (o *AddonVersion) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.enabled + } + return +} + +// MetricsFederation returns the value of the 'metrics_federation' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Configuration parameters to be injected in the ServiceMonitor used for federation. +func (o *AddonVersion) MetricsFederation() *MetricsFederation { + if o != nil && o.bitmap_&256 != 0 { + return o.metricsFederation + } + return nil +} + +// GetMetricsFederation returns the value of the 'metrics_federation' attribute and +// a flag indicating if the attribute has a value. +// +// Configuration parameters to be injected in the ServiceMonitor used for federation. +func (o *AddonVersion) GetMetricsFederation() (value *MetricsFederation, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.metricsFederation + } + return +} + +// MonitoringStack returns the value of the 'monitoring_stack' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Configuration parameters which will determine the underlying configuration of the MonitoringStack CR. +func (o *AddonVersion) MonitoringStack() *MonitoringStack { + if o != nil && o.bitmap_&512 != 0 { + return o.monitoringStack + } + return nil +} + +// GetMonitoringStack returns the value of the 'monitoring_stack' attribute and +// a flag indicating if the attribute has a value. +// +// Configuration parameters which will determine the underlying configuration of the MonitoringStack CR. +func (o *AddonVersion) GetMonitoringStack() (value *MonitoringStack, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.monitoringStack + } + 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 url for the package image +func (o *AddonVersion) PackageImage() string { + if o != nil && o.bitmap_&1024 != 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 url for the package image +func (o *AddonVersion) GetPackageImage() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 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 addon version. +func (o *AddonVersion) Parameters() *AddonParameters { + if o != nil && o.bitmap_&2048 != 0 { + return o.parameters + } + return nil +} + +// GetParameters returns the value of the 'parameters' attribute and +// a flag indicating if the attribute has a value. +// +// List of parameters for this addon version. +func (o *AddonVersion) GetParameters() (value *AddonParameters, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.parameters + } + return +} + +// PullSecretName returns the value of the 'pull_secret_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The pull secret name used for this addon version. +func (o *AddonVersion) PullSecretName() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.pullSecretName + } + return "" +} + +// GetPullSecretName returns the value of the 'pull_secret_name' attribute and +// a flag indicating if the attribute has a value. +// +// The pull secret name used for this addon version. +func (o *AddonVersion) GetPullSecretName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.pullSecretName + } + return +} + +// Requirements returns the value of the 'requirements' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of requirements for this addon version. +func (o *AddonVersion) Requirements() []*AddonRequirement { + if o != nil && o.bitmap_&8192 != 0 { + return o.requirements + } + return nil +} + +// GetRequirements returns the value of the 'requirements' attribute and +// a flag indicating if the attribute has a value. +// +// List of requirements for this addon version. +func (o *AddonVersion) GetRequirements() (value []*AddonRequirement, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.requirements + } + return +} + +// SourceImage returns the value of the 'source_image' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The catalog source image for this addon version. +func (o *AddonVersion) SourceImage() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.sourceImage + } + return "" +} + +// GetSourceImage returns the value of the 'source_image' attribute and +// a flag indicating if the attribute has a value. +// +// The catalog source image for this addon version. +func (o *AddonVersion) GetSourceImage() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.sourceImage + } + return +} + +// SubOperators returns the value of the 'sub_operators' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of sub operators for this addon version. +func (o *AddonVersion) SubOperators() []*AddonSubOperator { + if o != nil && o.bitmap_&32768 != 0 { + return o.subOperators + } + return nil +} + +// GetSubOperators returns the value of the 'sub_operators' attribute and +// a flag indicating if the attribute has a value. +// +// List of sub operators for this addon version. +func (o *AddonVersion) GetSubOperators() (value []*AddonSubOperator, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.subOperators + } + return +} + +// UpgradePlansCreated returns the value of the 'upgrade_plans_created' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if upgrade plans have been created for this addon version +func (o *AddonVersion) UpgradePlansCreated() bool { + if o != nil && o.bitmap_&65536 != 0 { + return o.upgradePlansCreated + } + return false +} + +// GetUpgradePlansCreated returns the value of the 'upgrade_plans_created' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if upgrade plans have been created for this addon version +func (o *AddonVersion) GetUpgradePlansCreated() (value bool, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.upgradePlansCreated + } + return +} + +// AddonVersionListKind is the name of the type used to represent list of objects of +// type 'addon_version'. +const AddonVersionListKind = "AddonVersionList" + +// AddonVersionListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_version'. +const AddonVersionListLinkKind = "AddonVersionListLink" + +// AddonVersionNilKind is the name of the type used to nil lists of objects of +// type 'addon_version'. +const AddonVersionListNilKind = "AddonVersionListNil" + +// AddonVersionList is a list of values of the 'addon_version' type. +type AddonVersionList struct { + href string + link bool + items []*AddonVersion +} + +// Kind returns the name of the type of the object. +func (l *AddonVersionList) Kind() string { + if l == nil { + return AddonVersionListNilKind + } + if l.link { + return AddonVersionListLinkKind + } + return AddonVersionListKind +} + +// Link returns true iif this is a link. +func (l *AddonVersionList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddonVersionList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddonVersionList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddonVersionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonVersionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonVersionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonVersionList) SetItems(items []*AddonVersion) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonVersionList) Items() []*AddonVersion { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonVersionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonVersionList) Get(i int) *AddonVersion { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonVersionList) Slice() []*AddonVersion { + var slice []*AddonVersion + if l == nil { + slice = make([]*AddonVersion, 0) + } else { + slice = make([]*AddonVersion, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonVersionList) Each(f func(item *AddonVersion) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonVersionList) Range(f func(index int, item *AddonVersion) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/addon_version_type_json.go b/clientapi/addonsmgmt/v1/addon_version_type_json.go new file mode 100644 index 00000000..aba9007d --- /dev/null +++ b/clientapi/addonsmgmt/v1/addon_version_type_json.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonVersion writes a value of the 'addon_version' type to the given writer. +func MarshalAddonVersion(object *AddonVersion, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonVersion(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonVersion writes a value of the 'addon_version' type to the given stream. +func WriteAddonVersion(object *AddonVersion, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddonVersionLinkKind) + } else { + stream.WriteString(AddonVersionKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.additionalCatalogSources != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_catalog_sources") + WriteAdditionalCatalogSourceList(object.additionalCatalogSources, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.availableUpgrades != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("available_upgrades") + WriteStringList(object.availableUpgrades, stream) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("channel") + stream.WriteString(object.channel) + count++ + } + present_ = object.bitmap_&64 != 0 && object.config != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("config") + WriteAddonConfig(object.config, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&256 != 0 && object.metricsFederation != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("metrics_federation") + WriteMetricsFederation(object.metricsFederation, stream) + count++ + } + present_ = object.bitmap_&512 != 0 && object.monitoringStack != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("monitoring_stack") + WriteMonitoringStack(object.monitoringStack, stream) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("package_image") + stream.WriteString(object.packageImage) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.parameters != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("parameters") + WriteAddonParameters(object.parameters, stream) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("pull_secret_name") + stream.WriteString(object.pullSecretName) + count++ + } + present_ = object.bitmap_&8192 != 0 && object.requirements != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("requirements") + WriteAddonRequirementList(object.requirements, stream) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("source_image") + stream.WriteString(object.sourceImage) + count++ + } + present_ = object.bitmap_&32768 != 0 && object.subOperators != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sub_operators") + WriteAddonSubOperatorList(object.subOperators, stream) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("upgrade_plans_created") + stream.WriteBool(object.upgradePlansCreated) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonVersion reads a value of the 'addon_version' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonVersion(source interface{}) (object *AddonVersion, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonVersion(iterator) + err = iterator.Error + return +} + +// ReadAddonVersion reads a value of the 'addon_version' type from the given iterator. +func ReadAddonVersion(iterator *jsoniter.Iterator) *AddonVersion { + object := &AddonVersion{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddonVersionLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "additional_catalog_sources": + value := ReadAdditionalCatalogSourceList(iterator) + object.additionalCatalogSources = value + object.bitmap_ |= 8 + case "available_upgrades": + value := ReadStringList(iterator) + object.availableUpgrades = value + object.bitmap_ |= 16 + case "channel": + value := iterator.ReadString() + object.channel = value + object.bitmap_ |= 32 + case "config": + value := ReadAddonConfig(iterator) + object.config = value + object.bitmap_ |= 64 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 128 + case "metrics_federation": + value := ReadMetricsFederation(iterator) + object.metricsFederation = value + object.bitmap_ |= 256 + case "monitoring_stack": + value := ReadMonitoringStack(iterator) + object.monitoringStack = value + object.bitmap_ |= 512 + case "package_image": + value := iterator.ReadString() + object.packageImage = value + object.bitmap_ |= 1024 + case "parameters": + value := ReadAddonParameters(iterator) + object.parameters = value + object.bitmap_ |= 2048 + case "pull_secret_name": + value := iterator.ReadString() + object.pullSecretName = value + object.bitmap_ |= 4096 + case "requirements": + value := ReadAddonRequirementList(iterator) + object.requirements = value + object.bitmap_ |= 8192 + case "source_image": + value := iterator.ReadString() + object.sourceImage = value + object.bitmap_ |= 16384 + case "sub_operators": + value := ReadAddonSubOperatorList(iterator) + object.subOperators = value + object.bitmap_ |= 32768 + case "upgrade_plans_created": + value := iterator.ReadBool() + object.upgradePlansCreated = value + object.bitmap_ |= 65536 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/billing_model_list_type_json.go b/clientapi/addonsmgmt/v1/billing_model_list_type_json.go new file mode 100644 index 00000000..584daf05 --- /dev/null +++ b/clientapi/addonsmgmt/v1/billing_model_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBillingModelList writes a list of values of the 'billing_model' type to +// the given writer. +func MarshalBillingModelList(list []BillingModel, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBillingModelList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBillingModelList writes a list of value of the 'billing_model' type to +// the given stream. +func WriteBillingModelList(list []BillingModel, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalBillingModelList reads a list of values of the 'billing_model' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBillingModelList(source interface{}) (items []BillingModel, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBillingModelList(iterator) + err = iterator.Error + return +} + +// ReadBillingModelList reads list of values of the ”billing_model' type from +// the given iterator. +func ReadBillingModelList(iterator *jsoniter.Iterator) []BillingModel { + list := []BillingModel{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := BillingModel(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/billing_model_type.go b/clientapi/addonsmgmt/v1/billing_model_type.go new file mode 100644 index 00000000..446452e1 --- /dev/null +++ b/clientapi/addonsmgmt/v1/billing_model_type.go @@ -0,0 +1,36 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// BillingModel represents the values of the 'billing_model' enumerated type. +type BillingModel string + +const ( + // + BillingModelMarketplace BillingModel = "marketplace" + // + BillingModelMarketplaceAws BillingModel = "marketplace-aws" + // + BillingModelMarketplaceAzure BillingModel = "marketplace-azure" + // + BillingModelMarketplaceRhm BillingModel = "marketplace-rhm" + // + BillingModelStandard BillingModel = "standard" +) diff --git a/clientapi/addonsmgmt/v1/boolean_list_type_json.go b/clientapi/addonsmgmt/v1/boolean_list_type_json.go new file mode 100644 index 00000000..5149c23b --- /dev/null +++ b/clientapi/addonsmgmt/v1/boolean_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBooleanList writes a list of values of the 'boolean' type to +// the given writer. +func MarshalBooleanList(list []bool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBooleanList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBooleanList writes a list of value of the 'boolean' type to +// the given stream. +func WriteBooleanList(list []bool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteBool(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalBooleanList reads a list of values of the 'boolean' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBooleanList(source interface{}) (items []bool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBooleanList(iterator) + err = iterator.Error + return +} + +// ReadBooleanList reads list of values of the ”boolean' type from +// the given iterator. +func ReadBooleanList(iterator *jsoniter.Iterator) []bool { + list := []bool{} + for iterator.ReadArray() { + item := iterator.ReadBool() + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/credential_request_builder.go b/clientapi/addonsmgmt/v1/credential_request_builder.go new file mode 100644 index 00000000..7767bcff --- /dev/null +++ b/clientapi/addonsmgmt/v1/credential_request_builder.go @@ -0,0 +1,102 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// CredentialRequestBuilder contains the data and logic needed to build 'credential_request' objects. +// +// Contains the necessary attributes to allow each operator to access the necessary AWS resources +type CredentialRequestBuilder struct { + bitmap_ uint32 + name string + namespace string + policyPermissions []string + serviceAccount string +} + +// NewCredentialRequest creates a new builder of 'credential_request' objects. +func NewCredentialRequest() *CredentialRequestBuilder { + return &CredentialRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CredentialRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *CredentialRequestBuilder) Name(value string) *CredentialRequestBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Namespace sets the value of the 'namespace' attribute to the given value. +func (b *CredentialRequestBuilder) Namespace(value string) *CredentialRequestBuilder { + b.namespace = value + b.bitmap_ |= 2 + return b +} + +// PolicyPermissions sets the value of the 'policy_permissions' attribute to the given values. +func (b *CredentialRequestBuilder) PolicyPermissions(values ...string) *CredentialRequestBuilder { + b.policyPermissions = make([]string, len(values)) + copy(b.policyPermissions, values) + b.bitmap_ |= 4 + return b +} + +// ServiceAccount sets the value of the 'service_account' attribute to the given value. +func (b *CredentialRequestBuilder) ServiceAccount(value string) *CredentialRequestBuilder { + b.serviceAccount = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CredentialRequestBuilder) Copy(object *CredentialRequest) *CredentialRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + b.namespace = object.namespace + if object.policyPermissions != nil { + b.policyPermissions = make([]string, len(object.policyPermissions)) + copy(b.policyPermissions, object.policyPermissions) + } else { + b.policyPermissions = nil + } + b.serviceAccount = object.serviceAccount + return b +} + +// Build creates a 'credential_request' object using the configuration stored in the builder. +func (b *CredentialRequestBuilder) Build() (object *CredentialRequest, err error) { + object = new(CredentialRequest) + object.bitmap_ = b.bitmap_ + object.name = b.name + object.namespace = b.namespace + if b.policyPermissions != nil { + object.policyPermissions = make([]string, len(b.policyPermissions)) + copy(object.policyPermissions, b.policyPermissions) + } + object.serviceAccount = b.serviceAccount + return +} diff --git a/clientapi/addonsmgmt/v1/credential_request_list_builder.go b/clientapi/addonsmgmt/v1/credential_request_list_builder.go new file mode 100644 index 00000000..dea8bbfc --- /dev/null +++ b/clientapi/addonsmgmt/v1/credential_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// CredentialRequestListBuilder contains the data and logic needed to build +// 'credential_request' objects. +type CredentialRequestListBuilder struct { + items []*CredentialRequestBuilder +} + +// NewCredentialRequestList creates a new builder of 'credential_request' objects. +func NewCredentialRequestList() *CredentialRequestListBuilder { + return new(CredentialRequestListBuilder) +} + +// Items sets the items of the list. +func (b *CredentialRequestListBuilder) Items(values ...*CredentialRequestBuilder) *CredentialRequestListBuilder { + b.items = make([]*CredentialRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CredentialRequestListBuilder) 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 *CredentialRequestListBuilder) Copy(list *CredentialRequestList) *CredentialRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CredentialRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCredentialRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'credential_request' objects using the +// configuration stored in the builder. +func (b *CredentialRequestListBuilder) Build() (list *CredentialRequestList, err error) { + items := make([]*CredentialRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CredentialRequestList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/credential_request_list_type_json.go b/clientapi/addonsmgmt/v1/credential_request_list_type_json.go new file mode 100644 index 00000000..4a5e32cb --- /dev/null +++ b/clientapi/addonsmgmt/v1/credential_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCredentialRequestList writes a list of values of the 'credential_request' type to +// the given writer. +func MarshalCredentialRequestList(list []*CredentialRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCredentialRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCredentialRequestList writes a list of value of the 'credential_request' type to +// the given stream. +func WriteCredentialRequestList(list []*CredentialRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCredentialRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCredentialRequestList reads a list of values of the 'credential_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCredentialRequestList(source interface{}) (items []*CredentialRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCredentialRequestList(iterator) + err = iterator.Error + return +} + +// ReadCredentialRequestList reads list of values of the ”credential_request' type from +// the given iterator. +func ReadCredentialRequestList(iterator *jsoniter.Iterator) []*CredentialRequest { + list := []*CredentialRequest{} + for iterator.ReadArray() { + item := ReadCredentialRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/credential_request_type.go b/clientapi/addonsmgmt/v1/credential_request_type.go new file mode 100644 index 00000000..494c4550 --- /dev/null +++ b/clientapi/addonsmgmt/v1/credential_request_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// CredentialRequest represents the values of the 'credential_request' type. +// +// Contains the necessary attributes to allow each operator to access the necessary AWS resources +type CredentialRequest struct { + bitmap_ uint32 + name string + namespace string + policyPermissions []string + serviceAccount string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CredentialRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the credentials secret used to access cloud resources +func (o *CredentialRequest) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the credentials secret used to access cloud resources +func (o *CredentialRequest) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Namespace returns the value of the 'namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Namespace where the credentials secret lives in the cluster +func (o *CredentialRequest) Namespace() string { + if o != nil && o.bitmap_&2 != 0 { + return o.namespace + } + return "" +} + +// GetNamespace returns the value of the 'namespace' attribute and +// a flag indicating if the attribute has a value. +// +// Namespace where the credentials secret lives in the cluster +func (o *CredentialRequest) GetNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.namespace + } + return +} + +// PolicyPermissions returns the value of the 'policy_permissions' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of policy permissions needed to access cloud resources +func (o *CredentialRequest) PolicyPermissions() []string { + if o != nil && o.bitmap_&4 != 0 { + return o.policyPermissions + } + return nil +} + +// GetPolicyPermissions returns the value of the 'policy_permissions' attribute and +// a flag indicating if the attribute has a value. +// +// List of policy permissions needed to access cloud resources +func (o *CredentialRequest) GetPolicyPermissions() (value []string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.policyPermissions + } + return +} + +// ServiceAccount returns the value of the 'service_account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Service account name to use when authenticating +func (o *CredentialRequest) ServiceAccount() string { + if o != nil && o.bitmap_&8 != 0 { + return o.serviceAccount + } + return "" +} + +// GetServiceAccount returns the value of the 'service_account' attribute and +// a flag indicating if the attribute has a value. +// +// Service account name to use when authenticating +func (o *CredentialRequest) GetServiceAccount() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.serviceAccount + } + return +} + +// CredentialRequestListKind is the name of the type used to represent list of objects of +// type 'credential_request'. +const CredentialRequestListKind = "CredentialRequestList" + +// CredentialRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'credential_request'. +const CredentialRequestListLinkKind = "CredentialRequestListLink" + +// CredentialRequestNilKind is the name of the type used to nil lists of objects of +// type 'credential_request'. +const CredentialRequestListNilKind = "CredentialRequestListNil" + +// CredentialRequestList is a list of values of the 'credential_request' type. +type CredentialRequestList struct { + href string + link bool + items []*CredentialRequest +} + +// Len returns the length of the list. +func (l *CredentialRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CredentialRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CredentialRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CredentialRequestList) SetItems(items []*CredentialRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *CredentialRequestList) Items() []*CredentialRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CredentialRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CredentialRequestList) Get(i int) *CredentialRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CredentialRequestList) Slice() []*CredentialRequest { + var slice []*CredentialRequest + if l == nil { + slice = make([]*CredentialRequest, 0) + } else { + slice = make([]*CredentialRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CredentialRequestList) Each(f func(item *CredentialRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CredentialRequestList) Range(f func(index int, item *CredentialRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/credential_request_type_json.go b/clientapi/addonsmgmt/v1/credential_request_type_json.go new file mode 100644 index 00000000..9413ffda --- /dev/null +++ b/clientapi/addonsmgmt/v1/credential_request_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCredentialRequest writes a value of the 'credential_request' type to the given writer. +func MarshalCredentialRequest(object *CredentialRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCredentialRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCredentialRequest writes a value of the 'credential_request' type to the given stream. +func WriteCredentialRequest(object *CredentialRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("namespace") + stream.WriteString(object.namespace) + count++ + } + present_ = object.bitmap_&4 != 0 && object.policyPermissions != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("policy_permissions") + WriteStringList(object.policyPermissions, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_account") + stream.WriteString(object.serviceAccount) + } + stream.WriteObjectEnd() +} + +// UnmarshalCredentialRequest reads a value of the 'credential_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCredentialRequest(source interface{}) (object *CredentialRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCredentialRequest(iterator) + err = iterator.Error + return +} + +// ReadCredentialRequest reads a value of the 'credential_request' type from the given iterator. +func ReadCredentialRequest(iterator *jsoniter.Iterator) *CredentialRequest { + object := &CredentialRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "namespace": + value := iterator.ReadString() + object.namespace = value + object.bitmap_ |= 2 + case "policy_permissions": + value := ReadStringList(iterator) + object.policyPermissions = value + object.bitmap_ |= 4 + case "service_account": + value := iterator.ReadString() + object.serviceAccount = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/date_list_type_json.go b/clientapi/addonsmgmt/v1/date_list_type_json.go new file mode 100644 index 00000000..26ee11f9 --- /dev/null +++ b/clientapi/addonsmgmt/v1/date_list_type_json.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDateList writes a list of values of the 'date' type to +// the given writer. +func MarshalDateList(list []time.Time, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDateList writes a list of value of the 'date' type to +// the given stream. +func WriteDateList(list []time.Time, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString((value).Format(time.RFC3339)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDateList reads a list of values of the 'date' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDateList(source interface{}) (items []time.Time, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDateList(iterator) + err = iterator.Error + return +} + +// ReadDateList reads list of values of the ”date' type from +// the given iterator. +func ReadDateList(iterator *jsoniter.Iterator) []time.Time { + list := []time.Time{} + for iterator.ReadArray() { + text := iterator.ReadString() + item, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/float_list_type_json.go b/clientapi/addonsmgmt/v1/float_list_type_json.go new file mode 100644 index 00000000..4043469e --- /dev/null +++ b/clientapi/addonsmgmt/v1/float_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFloatList writes a list of values of the 'float' type to +// the given writer. +func MarshalFloatList(list []float64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFloatList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFloatList writes a list of value of the 'float' type to +// the given stream. +func WriteFloatList(list []float64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteFloat64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalFloatList reads a list of values of the 'float' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFloatList(source interface{}) (items []float64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFloatList(iterator) + err = iterator.Error + return +} + +// ReadFloatList reads list of values of the ”float' type from +// the given iterator. +func ReadFloatList(iterator *jsoniter.Iterator) []float64 { + list := []float64{} + for iterator.ReadArray() { + item := iterator.ReadFloat64() + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/integer_list_type_json.go b/clientapi/addonsmgmt/v1/integer_list_type_json.go new file mode 100644 index 00000000..f29f997e --- /dev/null +++ b/clientapi/addonsmgmt/v1/integer_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIntegerList writes a list of values of the 'integer' type to +// the given writer. +func MarshalIntegerList(list []int, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIntegerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIntegerList writes a list of value of the 'integer' type to +// the given stream. +func WriteIntegerList(list []int, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalIntegerList reads a list of values of the 'integer' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIntegerList(source interface{}) (items []int, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIntegerList(iterator) + err = iterator.Error + return +} + +// ReadIntegerList reads list of values of the ”integer' type from +// the given iterator. +func ReadIntegerList(iterator *jsoniter.Iterator) []int { + list := []int{} + for iterator.ReadArray() { + item := iterator.ReadInt() + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/interface_list_type_json.go b/clientapi/addonsmgmt/v1/interface_list_type_json.go new file mode 100644 index 00000000..00451490 --- /dev/null +++ b/clientapi/addonsmgmt/v1/interface_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInterfaceList writes a list of values of the 'interface' type to +// the given writer. +func MarshalInterfaceList(list []interface{}, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInterfaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInterfaceList writes a list of value of the 'interface' type to +// the given stream. +func WriteInterfaceList(list []interface{}, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteVal(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalInterfaceList reads a list of values of the 'interface' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInterfaceList(source interface{}) (items []interface{}, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInterfaceList(iterator) + err = iterator.Error + return +} + +// ReadInterfaceList reads list of values of the ”interface' type from +// the given iterator. +func ReadInterfaceList(iterator *jsoniter.Iterator) []interface{} { + list := []interface{}{} + for iterator.ReadArray() { + var item interface{} + iterator.ReadVal(&item) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/long_list_type_json.go b/clientapi/addonsmgmt/v1/long_list_type_json.go new file mode 100644 index 00000000..6b95a1bb --- /dev/null +++ b/clientapi/addonsmgmt/v1/long_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLongList writes a list of values of the 'long' type to +// the given writer. +func MarshalLongList(list []int64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLongList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLongList writes a list of value of the 'long' type to +// the given stream. +func WriteLongList(list []int64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalLongList reads a list of values of the 'long' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLongList(source interface{}) (items []int64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLongList(iterator) + err = iterator.Error + return +} + +// ReadLongList reads list of values of the ”long' type from +// the given iterator. +func ReadLongList(iterator *jsoniter.Iterator) []int64 { + list := []int64{} + for iterator.ReadArray() { + item := iterator.ReadInt64() + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/metadata_reader.go b/clientapi/addonsmgmt/v1/metadata_reader.go new file mode 100644 index 00000000..6950c7a8 --- /dev/null +++ b/clientapi/addonsmgmt/v1/metadata_reader.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMetadata writes a value of the metadata type to the given target, which +// can be a writer or a JSON encoder. +func MarshalMetadata(object *Metadata, writer io.Writer) error { + stream := helpers.NewStream(writer) + writeMetadata(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} +func writeMetadata(object *Metadata, stream *jsoniter.Stream) { + stream.WriteObjectStart() + if object.bitmap_&1 != 0 { + stream.WriteObjectField("server_version") + stream.WriteString(object.serverVersion) + } + stream.WriteObjectEnd() +} + +// UnmarshalMetadata reads a value of the metadata type from the given source, which +// which can be a reader, a slice of byte or a string. +func UnmarshalMetadata(source interface{}) (object *Metadata, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = readMetadata(iterator) + err = iterator.Error + return +} +func readMetadata(iterator *jsoniter.Iterator) *Metadata { + object := &Metadata{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "server_version": + object.serverVersion = iterator.ReadString() + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/metadata_type.go b/clientapi/addonsmgmt/v1/metadata_type.go new file mode 100644 index 00000000..3ed47da1 --- /dev/null +++ b/clientapi/addonsmgmt/v1/metadata_type.go @@ -0,0 +1,44 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// Metadata contains the version metadata. +type Metadata struct { + bitmap_ uint32 + serverVersion string +} + +// ServerVersion returns the version of the server. +func (m *Metadata) ServerVersion() string { + if m != nil && m.bitmap_&1 != 0 { + return m.serverVersion + } + return "" +} + +// GetServerVersion returns the value of the server version and a flag indicating if +// the attribute has a value. +func (m *Metadata) GetServerVersion() (value string, ok bool) { + ok = m != nil && m.bitmap_&1 != 0 + if ok { + value = m.serverVersion + } + return +} diff --git a/clientapi/addonsmgmt/v1/metrics_federation_builder.go b/clientapi/addonsmgmt/v1/metrics_federation_builder.go new file mode 100644 index 00000000..9f1bc424 --- /dev/null +++ b/clientapi/addonsmgmt/v1/metrics_federation_builder.go @@ -0,0 +1,118 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// MetricsFederationBuilder contains the data and logic needed to build 'metrics_federation' objects. +// +// Representation of Metrics Federation +type MetricsFederationBuilder struct { + bitmap_ uint32 + matchLabels map[string]string + matchNames []string + namespace string + portName string +} + +// NewMetricsFederation creates a new builder of 'metrics_federation' objects. +func NewMetricsFederation() *MetricsFederationBuilder { + return &MetricsFederationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *MetricsFederationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// MatchLabels sets the value of the 'match_labels' attribute to the given value. +func (b *MetricsFederationBuilder) MatchLabels(value map[string]string) *MetricsFederationBuilder { + b.matchLabels = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// MatchNames sets the value of the 'match_names' attribute to the given values. +func (b *MetricsFederationBuilder) MatchNames(values ...string) *MetricsFederationBuilder { + b.matchNames = make([]string, len(values)) + copy(b.matchNames, values) + b.bitmap_ |= 2 + return b +} + +// Namespace sets the value of the 'namespace' attribute to the given value. +func (b *MetricsFederationBuilder) Namespace(value string) *MetricsFederationBuilder { + b.namespace = value + b.bitmap_ |= 4 + return b +} + +// PortName sets the value of the 'port_name' attribute to the given value. +func (b *MetricsFederationBuilder) PortName(value string) *MetricsFederationBuilder { + b.portName = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *MetricsFederationBuilder) Copy(object *MetricsFederation) *MetricsFederationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if len(object.matchLabels) > 0 { + b.matchLabels = map[string]string{} + for k, v := range object.matchLabels { + b.matchLabels[k] = v + } + } else { + b.matchLabels = nil + } + if object.matchNames != nil { + b.matchNames = make([]string, len(object.matchNames)) + copy(b.matchNames, object.matchNames) + } else { + b.matchNames = nil + } + b.namespace = object.namespace + b.portName = object.portName + return b +} + +// Build creates a 'metrics_federation' object using the configuration stored in the builder. +func (b *MetricsFederationBuilder) Build() (object *MetricsFederation, err error) { + object = new(MetricsFederation) + object.bitmap_ = b.bitmap_ + if b.matchLabels != nil { + object.matchLabels = make(map[string]string) + for k, v := range b.matchLabels { + object.matchLabels[k] = v + } + } + if b.matchNames != nil { + object.matchNames = make([]string, len(b.matchNames)) + copy(object.matchNames, b.matchNames) + } + object.namespace = b.namespace + object.portName = b.portName + return +} diff --git a/clientapi/addonsmgmt/v1/metrics_federation_list_builder.go b/clientapi/addonsmgmt/v1/metrics_federation_list_builder.go new file mode 100644 index 00000000..b905779a --- /dev/null +++ b/clientapi/addonsmgmt/v1/metrics_federation_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// MetricsFederationListBuilder contains the data and logic needed to build +// 'metrics_federation' objects. +type MetricsFederationListBuilder struct { + items []*MetricsFederationBuilder +} + +// NewMetricsFederationList creates a new builder of 'metrics_federation' objects. +func NewMetricsFederationList() *MetricsFederationListBuilder { + return new(MetricsFederationListBuilder) +} + +// Items sets the items of the list. +func (b *MetricsFederationListBuilder) Items(values ...*MetricsFederationBuilder) *MetricsFederationListBuilder { + b.items = make([]*MetricsFederationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *MetricsFederationListBuilder) 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 *MetricsFederationListBuilder) Copy(list *MetricsFederationList) *MetricsFederationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*MetricsFederationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewMetricsFederation().Copy(v) + } + } + return b +} + +// Build creates a list of 'metrics_federation' objects using the +// configuration stored in the builder. +func (b *MetricsFederationListBuilder) Build() (list *MetricsFederationList, err error) { + items := make([]*MetricsFederation, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(MetricsFederationList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/metrics_federation_list_type_json.go b/clientapi/addonsmgmt/v1/metrics_federation_list_type_json.go new file mode 100644 index 00000000..d62e332b --- /dev/null +++ b/clientapi/addonsmgmt/v1/metrics_federation_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMetricsFederationList writes a list of values of the 'metrics_federation' type to +// the given writer. +func MarshalMetricsFederationList(list []*MetricsFederation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMetricsFederationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMetricsFederationList writes a list of value of the 'metrics_federation' type to +// the given stream. +func WriteMetricsFederationList(list []*MetricsFederation, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteMetricsFederation(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalMetricsFederationList reads a list of values of the 'metrics_federation' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMetricsFederationList(source interface{}) (items []*MetricsFederation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMetricsFederationList(iterator) + err = iterator.Error + return +} + +// ReadMetricsFederationList reads list of values of the ”metrics_federation' type from +// the given iterator. +func ReadMetricsFederationList(iterator *jsoniter.Iterator) []*MetricsFederation { + list := []*MetricsFederation{} + for iterator.ReadArray() { + item := ReadMetricsFederation(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/metrics_federation_type.go b/clientapi/addonsmgmt/v1/metrics_federation_type.go new file mode 100644 index 00000000..65c676e7 --- /dev/null +++ b/clientapi/addonsmgmt/v1/metrics_federation_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// MetricsFederation represents the values of the 'metrics_federation' type. +// +// Representation of Metrics Federation +type MetricsFederation struct { + bitmap_ uint32 + matchLabels map[string]string + matchNames []string + namespace string + portName string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *MetricsFederation) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// MatchLabels returns the value of the 'match_labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of labels used to discover the prometheus server(s) to be federated. +func (o *MetricsFederation) MatchLabels() map[string]string { + if o != nil && o.bitmap_&1 != 0 { + return o.matchLabels + } + return nil +} + +// GetMatchLabels returns the value of the 'match_labels' attribute and +// a flag indicating if the attribute has a value. +// +// List of labels used to discover the prometheus server(s) to be federated. +func (o *MetricsFederation) GetMatchLabels() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.matchLabels + } + return +} + +// MatchNames returns the value of the 'match_names' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of series names to federate from the prometheus server. +func (o *MetricsFederation) MatchNames() []string { + if o != nil && o.bitmap_&2 != 0 { + return o.matchNames + } + return nil +} + +// GetMatchNames returns the value of the 'match_names' attribute and +// a flag indicating if the attribute has a value. +// +// List of series names to federate from the prometheus server. +func (o *MetricsFederation) GetMatchNames() (value []string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.matchNames + } + return +} + +// Namespace returns the value of the 'namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Namespace where the prometheus server is running. +func (o *MetricsFederation) Namespace() string { + if o != nil && o.bitmap_&4 != 0 { + return o.namespace + } + return "" +} + +// GetNamespace returns the value of the 'namespace' attribute and +// a flag indicating if the attribute has a value. +// +// Namespace where the prometheus server is running. +func (o *MetricsFederation) GetNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.namespace + } + return +} + +// PortName returns the value of the 'port_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the name of the service port fronting the prometheus server. +func (o *MetricsFederation) PortName() string { + if o != nil && o.bitmap_&8 != 0 { + return o.portName + } + return "" +} + +// GetPortName returns the value of the 'port_name' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the name of the service port fronting the prometheus server. +func (o *MetricsFederation) GetPortName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.portName + } + return +} + +// MetricsFederationListKind is the name of the type used to represent list of objects of +// type 'metrics_federation'. +const MetricsFederationListKind = "MetricsFederationList" + +// MetricsFederationListLinkKind is the name of the type used to represent links to list +// of objects of type 'metrics_federation'. +const MetricsFederationListLinkKind = "MetricsFederationListLink" + +// MetricsFederationNilKind is the name of the type used to nil lists of objects of +// type 'metrics_federation'. +const MetricsFederationListNilKind = "MetricsFederationListNil" + +// MetricsFederationList is a list of values of the 'metrics_federation' type. +type MetricsFederationList struct { + href string + link bool + items []*MetricsFederation +} + +// Len returns the length of the list. +func (l *MetricsFederationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *MetricsFederationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *MetricsFederationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *MetricsFederationList) SetItems(items []*MetricsFederation) { + l.items = items +} + +// Items returns the items of the list. +func (l *MetricsFederationList) Items() []*MetricsFederation { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *MetricsFederationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *MetricsFederationList) Get(i int) *MetricsFederation { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *MetricsFederationList) Slice() []*MetricsFederation { + var slice []*MetricsFederation + if l == nil { + slice = make([]*MetricsFederation, 0) + } else { + slice = make([]*MetricsFederation, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *MetricsFederationList) Each(f func(item *MetricsFederation) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *MetricsFederationList) Range(f func(index int, item *MetricsFederation) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/metrics_federation_type_json.go b/clientapi/addonsmgmt/v1/metrics_federation_type_json.go new file mode 100644 index 00000000..faa13385 --- /dev/null +++ b/clientapi/addonsmgmt/v1/metrics_federation_type_json.go @@ -0,0 +1,154 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMetricsFederation writes a value of the 'metrics_federation' type to the given writer. +func MarshalMetricsFederation(object *MetricsFederation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMetricsFederation(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMetricsFederation writes a value of the 'metrics_federation' type to the given stream. +func WriteMetricsFederation(object *MetricsFederation, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.matchLabels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("match_labels") + if object.matchLabels != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.matchLabels)) + i := 0 + for key := range object.matchLabels { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.matchLabels[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&2 != 0 && object.matchNames != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("match_names") + WriteStringList(object.matchNames, stream) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("namespace") + stream.WriteString(object.namespace) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("port_name") + stream.WriteString(object.portName) + } + stream.WriteObjectEnd() +} + +// UnmarshalMetricsFederation reads a value of the 'metrics_federation' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalMetricsFederation(source interface{}) (object *MetricsFederation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadMetricsFederation(iterator) + err = iterator.Error + return +} + +// ReadMetricsFederation reads a value of the 'metrics_federation' type from the given iterator. +func ReadMetricsFederation(iterator *jsoniter.Iterator) *MetricsFederation { + object := &MetricsFederation{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "match_labels": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.matchLabels = value + object.bitmap_ |= 1 + case "match_names": + value := ReadStringList(iterator) + object.matchNames = value + object.bitmap_ |= 2 + case "namespace": + value := iterator.ReadString() + object.namespace = value + object.bitmap_ |= 4 + case "port_name": + value := iterator.ReadString() + object.portName = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_builder.go b/clientapi/addonsmgmt/v1/monitoring_stack_builder.go new file mode 100644 index 00000000..b091373d --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_builder.go @@ -0,0 +1,88 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// MonitoringStackBuilder contains the data and logic needed to build 'monitoring_stack' objects. +// +// Representation of Monitoring Stack +type MonitoringStackBuilder struct { + bitmap_ uint32 + resources *MonitoringStackResourcesBuilder + enabled bool +} + +// NewMonitoringStack creates a new builder of 'monitoring_stack' objects. +func NewMonitoringStack() *MonitoringStackBuilder { + return &MonitoringStackBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *MonitoringStackBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *MonitoringStackBuilder) Enabled(value bool) *MonitoringStackBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// Resources sets the value of the 'resources' attribute to the given value. +// +// Representation of Monitoring Stack Resources +func (b *MonitoringStackBuilder) Resources(value *MonitoringStackResourcesBuilder) *MonitoringStackBuilder { + b.resources = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *MonitoringStackBuilder) Copy(object *MonitoringStack) *MonitoringStackBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + if object.resources != nil { + b.resources = NewMonitoringStackResources().Copy(object.resources) + } else { + b.resources = nil + } + return b +} + +// Build creates a 'monitoring_stack' object using the configuration stored in the builder. +func (b *MonitoringStackBuilder) Build() (object *MonitoringStack, err error) { + object = new(MonitoringStack) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + if b.resources != nil { + object.resources, err = b.resources.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_list_builder.go b/clientapi/addonsmgmt/v1/monitoring_stack_list_builder.go new file mode 100644 index 00000000..545ea7fb --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// MonitoringStackListBuilder contains the data and logic needed to build +// 'monitoring_stack' objects. +type MonitoringStackListBuilder struct { + items []*MonitoringStackBuilder +} + +// NewMonitoringStackList creates a new builder of 'monitoring_stack' objects. +func NewMonitoringStackList() *MonitoringStackListBuilder { + return new(MonitoringStackListBuilder) +} + +// Items sets the items of the list. +func (b *MonitoringStackListBuilder) Items(values ...*MonitoringStackBuilder) *MonitoringStackListBuilder { + b.items = make([]*MonitoringStackBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *MonitoringStackListBuilder) 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 *MonitoringStackListBuilder) Copy(list *MonitoringStackList) *MonitoringStackListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*MonitoringStackBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewMonitoringStack().Copy(v) + } + } + return b +} + +// Build creates a list of 'monitoring_stack' objects using the +// configuration stored in the builder. +func (b *MonitoringStackListBuilder) Build() (list *MonitoringStackList, err error) { + items := make([]*MonitoringStack, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(MonitoringStackList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_list_type_json.go b/clientapi/addonsmgmt/v1/monitoring_stack_list_type_json.go new file mode 100644 index 00000000..77c01aa9 --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMonitoringStackList writes a list of values of the 'monitoring_stack' type to +// the given writer. +func MarshalMonitoringStackList(list []*MonitoringStack, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMonitoringStackList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMonitoringStackList writes a list of value of the 'monitoring_stack' type to +// the given stream. +func WriteMonitoringStackList(list []*MonitoringStack, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteMonitoringStack(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalMonitoringStackList reads a list of values of the 'monitoring_stack' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMonitoringStackList(source interface{}) (items []*MonitoringStack, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMonitoringStackList(iterator) + err = iterator.Error + return +} + +// ReadMonitoringStackList reads list of values of the ”monitoring_stack' type from +// the given iterator. +func ReadMonitoringStackList(iterator *jsoniter.Iterator) []*MonitoringStack { + list := []*MonitoringStack{} + for iterator.ReadArray() { + item := ReadMonitoringStack(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_resource_builder.go b/clientapi/addonsmgmt/v1/monitoring_stack_resource_builder.go new file mode 100644 index 00000000..6e6130b4 --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_resource_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// MonitoringStackResourceBuilder contains the data and logic needed to build 'monitoring_stack_resource' objects. +// +// Representation of Monitoring Stack Resource +type MonitoringStackResourceBuilder struct { + bitmap_ uint32 + cpu string + memory string +} + +// NewMonitoringStackResource creates a new builder of 'monitoring_stack_resource' objects. +func NewMonitoringStackResource() *MonitoringStackResourceBuilder { + return &MonitoringStackResourceBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *MonitoringStackResourceBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Cpu sets the value of the 'cpu' attribute to the given value. +func (b *MonitoringStackResourceBuilder) Cpu(value string) *MonitoringStackResourceBuilder { + b.cpu = value + b.bitmap_ |= 1 + return b +} + +// Memory sets the value of the 'memory' attribute to the given value. +func (b *MonitoringStackResourceBuilder) Memory(value string) *MonitoringStackResourceBuilder { + b.memory = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *MonitoringStackResourceBuilder) Copy(object *MonitoringStackResource) *MonitoringStackResourceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.cpu = object.cpu + b.memory = object.memory + return b +} + +// Build creates a 'monitoring_stack_resource' object using the configuration stored in the builder. +func (b *MonitoringStackResourceBuilder) Build() (object *MonitoringStackResource, err error) { + object = new(MonitoringStackResource) + object.bitmap_ = b.bitmap_ + object.cpu = b.cpu + object.memory = b.memory + return +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_resource_list_builder.go b/clientapi/addonsmgmt/v1/monitoring_stack_resource_list_builder.go new file mode 100644 index 00000000..756eaaef --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_resource_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// MonitoringStackResourceListBuilder contains the data and logic needed to build +// 'monitoring_stack_resource' objects. +type MonitoringStackResourceListBuilder struct { + items []*MonitoringStackResourceBuilder +} + +// NewMonitoringStackResourceList creates a new builder of 'monitoring_stack_resource' objects. +func NewMonitoringStackResourceList() *MonitoringStackResourceListBuilder { + return new(MonitoringStackResourceListBuilder) +} + +// Items sets the items of the list. +func (b *MonitoringStackResourceListBuilder) Items(values ...*MonitoringStackResourceBuilder) *MonitoringStackResourceListBuilder { + b.items = make([]*MonitoringStackResourceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *MonitoringStackResourceListBuilder) 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 *MonitoringStackResourceListBuilder) Copy(list *MonitoringStackResourceList) *MonitoringStackResourceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*MonitoringStackResourceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewMonitoringStackResource().Copy(v) + } + } + return b +} + +// Build creates a list of 'monitoring_stack_resource' objects using the +// configuration stored in the builder. +func (b *MonitoringStackResourceListBuilder) Build() (list *MonitoringStackResourceList, err error) { + items := make([]*MonitoringStackResource, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(MonitoringStackResourceList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_resource_list_type_json.go b/clientapi/addonsmgmt/v1/monitoring_stack_resource_list_type_json.go new file mode 100644 index 00000000..2d4f50e0 --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_resource_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMonitoringStackResourceList writes a list of values of the 'monitoring_stack_resource' type to +// the given writer. +func MarshalMonitoringStackResourceList(list []*MonitoringStackResource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMonitoringStackResourceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMonitoringStackResourceList writes a list of value of the 'monitoring_stack_resource' type to +// the given stream. +func WriteMonitoringStackResourceList(list []*MonitoringStackResource, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteMonitoringStackResource(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalMonitoringStackResourceList reads a list of values of the 'monitoring_stack_resource' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMonitoringStackResourceList(source interface{}) (items []*MonitoringStackResource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMonitoringStackResourceList(iterator) + err = iterator.Error + return +} + +// ReadMonitoringStackResourceList reads list of values of the ”monitoring_stack_resource' type from +// the given iterator. +func ReadMonitoringStackResourceList(iterator *jsoniter.Iterator) []*MonitoringStackResource { + list := []*MonitoringStackResource{} + for iterator.ReadArray() { + item := ReadMonitoringStackResource(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_resource_type.go b/clientapi/addonsmgmt/v1/monitoring_stack_resource_type.go new file mode 100644 index 00000000..9fbc2476 --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_resource_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// MonitoringStackResource represents the values of the 'monitoring_stack_resource' type. +// +// Representation of Monitoring Stack Resource +type MonitoringStackResource struct { + bitmap_ uint32 + cpu string + memory string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *MonitoringStackResource) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Cpu returns the value of the 'cpu' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the CPU resource for monitoring stack. +func (o *MonitoringStackResource) Cpu() string { + if o != nil && o.bitmap_&1 != 0 { + return o.cpu + } + return "" +} + +// GetCpu returns the value of the 'cpu' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the CPU resource for monitoring stack. +func (o *MonitoringStackResource) GetCpu() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.cpu + } + return +} + +// Memory returns the value of the 'memory' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the memory resource for monitoring stack. +func (o *MonitoringStackResource) Memory() string { + if o != nil && o.bitmap_&2 != 0 { + return o.memory + } + return "" +} + +// GetMemory returns the value of the 'memory' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the memory resource for monitoring stack. +func (o *MonitoringStackResource) GetMemory() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.memory + } + return +} + +// MonitoringStackResourceListKind is the name of the type used to represent list of objects of +// type 'monitoring_stack_resource'. +const MonitoringStackResourceListKind = "MonitoringStackResourceList" + +// MonitoringStackResourceListLinkKind is the name of the type used to represent links to list +// of objects of type 'monitoring_stack_resource'. +const MonitoringStackResourceListLinkKind = "MonitoringStackResourceListLink" + +// MonitoringStackResourceNilKind is the name of the type used to nil lists of objects of +// type 'monitoring_stack_resource'. +const MonitoringStackResourceListNilKind = "MonitoringStackResourceListNil" + +// MonitoringStackResourceList is a list of values of the 'monitoring_stack_resource' type. +type MonitoringStackResourceList struct { + href string + link bool + items []*MonitoringStackResource +} + +// Len returns the length of the list. +func (l *MonitoringStackResourceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *MonitoringStackResourceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *MonitoringStackResourceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *MonitoringStackResourceList) SetItems(items []*MonitoringStackResource) { + l.items = items +} + +// Items returns the items of the list. +func (l *MonitoringStackResourceList) Items() []*MonitoringStackResource { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *MonitoringStackResourceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *MonitoringStackResourceList) Get(i int) *MonitoringStackResource { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *MonitoringStackResourceList) Slice() []*MonitoringStackResource { + var slice []*MonitoringStackResource + if l == nil { + slice = make([]*MonitoringStackResource, 0) + } else { + slice = make([]*MonitoringStackResource, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *MonitoringStackResourceList) Each(f func(item *MonitoringStackResource) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *MonitoringStackResourceList) Range(f func(index int, item *MonitoringStackResource) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_resource_type_json.go b/clientapi/addonsmgmt/v1/monitoring_stack_resource_type_json.go new file mode 100644 index 00000000..de664395 --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_resource_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMonitoringStackResource writes a value of the 'monitoring_stack_resource' type to the given writer. +func MarshalMonitoringStackResource(object *MonitoringStackResource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMonitoringStackResource(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMonitoringStackResource writes a value of the 'monitoring_stack_resource' type to the given stream. +func WriteMonitoringStackResource(object *MonitoringStackResource, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cpu") + stream.WriteString(object.cpu) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("memory") + stream.WriteString(object.memory) + } + stream.WriteObjectEnd() +} + +// UnmarshalMonitoringStackResource reads a value of the 'monitoring_stack_resource' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalMonitoringStackResource(source interface{}) (object *MonitoringStackResource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadMonitoringStackResource(iterator) + err = iterator.Error + return +} + +// ReadMonitoringStackResource reads a value of the 'monitoring_stack_resource' type from the given iterator. +func ReadMonitoringStackResource(iterator *jsoniter.Iterator) *MonitoringStackResource { + object := &MonitoringStackResource{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "cpu": + value := iterator.ReadString() + object.cpu = value + object.bitmap_ |= 1 + case "memory": + value := iterator.ReadString() + object.memory = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_resources_builder.go b/clientapi/addonsmgmt/v1/monitoring_stack_resources_builder.go new file mode 100644 index 00000000..89bec560 --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_resources_builder.go @@ -0,0 +1,103 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// MonitoringStackResourcesBuilder contains the data and logic needed to build 'monitoring_stack_resources' objects. +// +// Representation of Monitoring Stack Resources +type MonitoringStackResourcesBuilder struct { + bitmap_ uint32 + limits *MonitoringStackResourceBuilder + requests *MonitoringStackResourceBuilder +} + +// NewMonitoringStackResources creates a new builder of 'monitoring_stack_resources' objects. +func NewMonitoringStackResources() *MonitoringStackResourcesBuilder { + return &MonitoringStackResourcesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *MonitoringStackResourcesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Limits sets the value of the 'limits' attribute to the given value. +// +// Representation of Monitoring Stack Resource +func (b *MonitoringStackResourcesBuilder) Limits(value *MonitoringStackResourceBuilder) *MonitoringStackResourcesBuilder { + b.limits = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// Requests sets the value of the 'requests' attribute to the given value. +// +// Representation of Monitoring Stack Resource +func (b *MonitoringStackResourcesBuilder) Requests(value *MonitoringStackResourceBuilder) *MonitoringStackResourcesBuilder { + b.requests = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *MonitoringStackResourcesBuilder) Copy(object *MonitoringStackResources) *MonitoringStackResourcesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.limits != nil { + b.limits = NewMonitoringStackResource().Copy(object.limits) + } else { + b.limits = nil + } + if object.requests != nil { + b.requests = NewMonitoringStackResource().Copy(object.requests) + } else { + b.requests = nil + } + return b +} + +// Build creates a 'monitoring_stack_resources' object using the configuration stored in the builder. +func (b *MonitoringStackResourcesBuilder) Build() (object *MonitoringStackResources, err error) { + object = new(MonitoringStackResources) + object.bitmap_ = b.bitmap_ + if b.limits != nil { + object.limits, err = b.limits.Build() + if err != nil { + return + } + } + if b.requests != nil { + object.requests, err = b.requests.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_resources_list_builder.go b/clientapi/addonsmgmt/v1/monitoring_stack_resources_list_builder.go new file mode 100644 index 00000000..9c7b8266 --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_resources_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// MonitoringStackResourcesListBuilder contains the data and logic needed to build +// 'monitoring_stack_resources' objects. +type MonitoringStackResourcesListBuilder struct { + items []*MonitoringStackResourcesBuilder +} + +// NewMonitoringStackResourcesList creates a new builder of 'monitoring_stack_resources' objects. +func NewMonitoringStackResourcesList() *MonitoringStackResourcesListBuilder { + return new(MonitoringStackResourcesListBuilder) +} + +// Items sets the items of the list. +func (b *MonitoringStackResourcesListBuilder) Items(values ...*MonitoringStackResourcesBuilder) *MonitoringStackResourcesListBuilder { + b.items = make([]*MonitoringStackResourcesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *MonitoringStackResourcesListBuilder) 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 *MonitoringStackResourcesListBuilder) Copy(list *MonitoringStackResourcesList) *MonitoringStackResourcesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*MonitoringStackResourcesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewMonitoringStackResources().Copy(v) + } + } + return b +} + +// Build creates a list of 'monitoring_stack_resources' objects using the +// configuration stored in the builder. +func (b *MonitoringStackResourcesListBuilder) Build() (list *MonitoringStackResourcesList, err error) { + items := make([]*MonitoringStackResources, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(MonitoringStackResourcesList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_resources_list_type_json.go b/clientapi/addonsmgmt/v1/monitoring_stack_resources_list_type_json.go new file mode 100644 index 00000000..519e1c57 --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_resources_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMonitoringStackResourcesList writes a list of values of the 'monitoring_stack_resources' type to +// the given writer. +func MarshalMonitoringStackResourcesList(list []*MonitoringStackResources, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMonitoringStackResourcesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMonitoringStackResourcesList writes a list of value of the 'monitoring_stack_resources' type to +// the given stream. +func WriteMonitoringStackResourcesList(list []*MonitoringStackResources, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteMonitoringStackResources(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalMonitoringStackResourcesList reads a list of values of the 'monitoring_stack_resources' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMonitoringStackResourcesList(source interface{}) (items []*MonitoringStackResources, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMonitoringStackResourcesList(iterator) + err = iterator.Error + return +} + +// ReadMonitoringStackResourcesList reads list of values of the ”monitoring_stack_resources' type from +// the given iterator. +func ReadMonitoringStackResourcesList(iterator *jsoniter.Iterator) []*MonitoringStackResources { + list := []*MonitoringStackResources{} + for iterator.ReadArray() { + item := ReadMonitoringStackResources(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_resources_type.go b/clientapi/addonsmgmt/v1/monitoring_stack_resources_type.go new file mode 100644 index 00000000..31c07b29 --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_resources_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// MonitoringStackResources represents the values of the 'monitoring_stack_resources' type. +// +// Representation of Monitoring Stack Resources +type MonitoringStackResources struct { + bitmap_ uint32 + limits *MonitoringStackResource + requests *MonitoringStackResource +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *MonitoringStackResources) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Limits returns the value of the 'limits' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the limit of resource for monitoring stack. +func (o *MonitoringStackResources) Limits() *MonitoringStackResource { + if o != nil && o.bitmap_&1 != 0 { + return o.limits + } + return nil +} + +// GetLimits returns the value of the 'limits' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the limit of resource for monitoring stack. +func (o *MonitoringStackResources) GetLimits() (value *MonitoringStackResource, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.limits + } + return +} + +// Requests returns the value of the 'requests' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the requested amount of resource for monitoring stack. +func (o *MonitoringStackResources) Requests() *MonitoringStackResource { + if o != nil && o.bitmap_&2 != 0 { + return o.requests + } + return nil +} + +// GetRequests returns the value of the 'requests' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the requested amount of resource for monitoring stack. +func (o *MonitoringStackResources) GetRequests() (value *MonitoringStackResource, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.requests + } + return +} + +// MonitoringStackResourcesListKind is the name of the type used to represent list of objects of +// type 'monitoring_stack_resources'. +const MonitoringStackResourcesListKind = "MonitoringStackResourcesList" + +// MonitoringStackResourcesListLinkKind is the name of the type used to represent links to list +// of objects of type 'monitoring_stack_resources'. +const MonitoringStackResourcesListLinkKind = "MonitoringStackResourcesListLink" + +// MonitoringStackResourcesNilKind is the name of the type used to nil lists of objects of +// type 'monitoring_stack_resources'. +const MonitoringStackResourcesListNilKind = "MonitoringStackResourcesListNil" + +// MonitoringStackResourcesList is a list of values of the 'monitoring_stack_resources' type. +type MonitoringStackResourcesList struct { + href string + link bool + items []*MonitoringStackResources +} + +// Len returns the length of the list. +func (l *MonitoringStackResourcesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *MonitoringStackResourcesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *MonitoringStackResourcesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *MonitoringStackResourcesList) SetItems(items []*MonitoringStackResources) { + l.items = items +} + +// Items returns the items of the list. +func (l *MonitoringStackResourcesList) Items() []*MonitoringStackResources { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *MonitoringStackResourcesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *MonitoringStackResourcesList) Get(i int) *MonitoringStackResources { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *MonitoringStackResourcesList) Slice() []*MonitoringStackResources { + var slice []*MonitoringStackResources + if l == nil { + slice = make([]*MonitoringStackResources, 0) + } else { + slice = make([]*MonitoringStackResources, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *MonitoringStackResourcesList) Each(f func(item *MonitoringStackResources) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *MonitoringStackResourcesList) Range(f func(index int, item *MonitoringStackResources) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_resources_type_json.go b/clientapi/addonsmgmt/v1/monitoring_stack_resources_type_json.go new file mode 100644 index 00000000..20b2ca18 --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_resources_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMonitoringStackResources writes a value of the 'monitoring_stack_resources' type to the given writer. +func MarshalMonitoringStackResources(object *MonitoringStackResources, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMonitoringStackResources(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMonitoringStackResources writes a value of the 'monitoring_stack_resources' type to the given stream. +func WriteMonitoringStackResources(object *MonitoringStackResources, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.limits != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("limits") + WriteMonitoringStackResource(object.limits, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.requests != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("requests") + WriteMonitoringStackResource(object.requests, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalMonitoringStackResources reads a value of the 'monitoring_stack_resources' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalMonitoringStackResources(source interface{}) (object *MonitoringStackResources, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadMonitoringStackResources(iterator) + err = iterator.Error + return +} + +// ReadMonitoringStackResources reads a value of the 'monitoring_stack_resources' type from the given iterator. +func ReadMonitoringStackResources(iterator *jsoniter.Iterator) *MonitoringStackResources { + object := &MonitoringStackResources{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "limits": + value := ReadMonitoringStackResource(iterator) + object.limits = value + object.bitmap_ |= 1 + case "requests": + value := ReadMonitoringStackResource(iterator) + object.requests = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_type.go b/clientapi/addonsmgmt/v1/monitoring_stack_type.go new file mode 100644 index 00000000..7a01ce00 --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// MonitoringStack represents the values of the 'monitoring_stack' type. +// +// Representation of Monitoring Stack +type MonitoringStack struct { + bitmap_ uint32 + resources *MonitoringStackResources + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *MonitoringStack) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if the monitoring stack can be added to clusters for the addon. +func (o *MonitoringStack) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if the monitoring stack can be added to clusters for the addon. +func (o *MonitoringStack) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// Resources returns the value of the 'resources' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the resources for the monitoring stack +func (o *MonitoringStack) Resources() *MonitoringStackResources { + if o != nil && o.bitmap_&2 != 0 { + return o.resources + } + return nil +} + +// GetResources returns the value of the 'resources' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the resources for the monitoring stack +func (o *MonitoringStack) GetResources() (value *MonitoringStackResources, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.resources + } + return +} + +// MonitoringStackListKind is the name of the type used to represent list of objects of +// type 'monitoring_stack'. +const MonitoringStackListKind = "MonitoringStackList" + +// MonitoringStackListLinkKind is the name of the type used to represent links to list +// of objects of type 'monitoring_stack'. +const MonitoringStackListLinkKind = "MonitoringStackListLink" + +// MonitoringStackNilKind is the name of the type used to nil lists of objects of +// type 'monitoring_stack'. +const MonitoringStackListNilKind = "MonitoringStackListNil" + +// MonitoringStackList is a list of values of the 'monitoring_stack' type. +type MonitoringStackList struct { + href string + link bool + items []*MonitoringStack +} + +// Len returns the length of the list. +func (l *MonitoringStackList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *MonitoringStackList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *MonitoringStackList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *MonitoringStackList) SetItems(items []*MonitoringStack) { + l.items = items +} + +// Items returns the items of the list. +func (l *MonitoringStackList) Items() []*MonitoringStack { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *MonitoringStackList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *MonitoringStackList) Get(i int) *MonitoringStack { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *MonitoringStackList) Slice() []*MonitoringStack { + var slice []*MonitoringStack + if l == nil { + slice = make([]*MonitoringStack, 0) + } else { + slice = make([]*MonitoringStack, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *MonitoringStackList) Each(f func(item *MonitoringStack) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *MonitoringStackList) Range(f func(index int, item *MonitoringStack) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/monitoring_stack_type_json.go b/clientapi/addonsmgmt/v1/monitoring_stack_type_json.go new file mode 100644 index 00000000..a99007dc --- /dev/null +++ b/clientapi/addonsmgmt/v1/monitoring_stack_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMonitoringStack writes a value of the 'monitoring_stack' type to the given writer. +func MarshalMonitoringStack(object *MonitoringStack, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMonitoringStack(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMonitoringStack writes a value of the 'monitoring_stack' type to the given stream. +func WriteMonitoringStack(object *MonitoringStack, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&2 != 0 && object.resources != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resources") + WriteMonitoringStackResources(object.resources, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalMonitoringStack reads a value of the 'monitoring_stack' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalMonitoringStack(source interface{}) (object *MonitoringStack, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadMonitoringStack(iterator) + err = iterator.Error + return +} + +// ReadMonitoringStack reads a value of the 'monitoring_stack' type from the given iterator. +func ReadMonitoringStack(iterator *jsoniter.Iterator) *MonitoringStack { + object := &MonitoringStack{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + case "resources": + value := ReadMonitoringStackResources(iterator) + object.resources = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/object_reference_builder.go b/clientapi/addonsmgmt/v1/object_reference_builder.go new file mode 100644 index 00000000..c0df9528 --- /dev/null +++ b/clientapi/addonsmgmt/v1/object_reference_builder.go @@ -0,0 +1,83 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// ObjectReferenceBuilder contains the data and logic needed to build 'object_reference' objects. +// +// representation of object reference/subscription +type ObjectReferenceBuilder struct { + bitmap_ uint32 + href string + id string + kind string +} + +// NewObjectReference creates a new builder of 'object_reference' objects. +func NewObjectReference() *ObjectReferenceBuilder { + return &ObjectReferenceBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ObjectReferenceBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Href sets the value of the 'href' attribute to the given value. +func (b *ObjectReferenceBuilder) Href(value string) *ObjectReferenceBuilder { + b.href = value + b.bitmap_ |= 1 + return b +} + +// Id sets the value of the 'id' attribute to the given value. +func (b *ObjectReferenceBuilder) Id(value string) *ObjectReferenceBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// Kind sets the value of the 'kind' attribute to the given value. +func (b *ObjectReferenceBuilder) Kind(value string) *ObjectReferenceBuilder { + b.kind = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ObjectReferenceBuilder) Copy(object *ObjectReference) *ObjectReferenceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.href = object.href + b.id = object.id + b.kind = object.kind + return b +} + +// Build creates a 'object_reference' object using the configuration stored in the builder. +func (b *ObjectReferenceBuilder) Build() (object *ObjectReference, err error) { + object = new(ObjectReference) + object.bitmap_ = b.bitmap_ + object.href = b.href + object.id = b.id + object.kind = b.kind + return +} diff --git a/clientapi/addonsmgmt/v1/object_reference_list_builder.go b/clientapi/addonsmgmt/v1/object_reference_list_builder.go new file mode 100644 index 00000000..2c2ef6f0 --- /dev/null +++ b/clientapi/addonsmgmt/v1/object_reference_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// ObjectReferenceListBuilder contains the data and logic needed to build +// 'object_reference' objects. +type ObjectReferenceListBuilder struct { + items []*ObjectReferenceBuilder +} + +// NewObjectReferenceList creates a new builder of 'object_reference' objects. +func NewObjectReferenceList() *ObjectReferenceListBuilder { + return new(ObjectReferenceListBuilder) +} + +// Items sets the items of the list. +func (b *ObjectReferenceListBuilder) Items(values ...*ObjectReferenceBuilder) *ObjectReferenceListBuilder { + b.items = make([]*ObjectReferenceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ObjectReferenceListBuilder) 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 *ObjectReferenceListBuilder) Copy(list *ObjectReferenceList) *ObjectReferenceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ObjectReferenceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewObjectReference().Copy(v) + } + } + return b +} + +// Build creates a list of 'object_reference' objects using the +// configuration stored in the builder. +func (b *ObjectReferenceListBuilder) Build() (list *ObjectReferenceList, err error) { + items := make([]*ObjectReference, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ObjectReferenceList) + list.items = items + return +} diff --git a/clientapi/addonsmgmt/v1/object_reference_list_type_json.go b/clientapi/addonsmgmt/v1/object_reference_list_type_json.go new file mode 100644 index 00000000..0a741b29 --- /dev/null +++ b/clientapi/addonsmgmt/v1/object_reference_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalObjectReferenceList writes a list of values of the 'object_reference' type to +// the given writer. +func MarshalObjectReferenceList(list []*ObjectReference, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteObjectReferenceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteObjectReferenceList writes a list of value of the 'object_reference' type to +// the given stream. +func WriteObjectReferenceList(list []*ObjectReference, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteObjectReference(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalObjectReferenceList reads a list of values of the 'object_reference' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalObjectReferenceList(source interface{}) (items []*ObjectReference, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadObjectReferenceList(iterator) + err = iterator.Error + return +} + +// ReadObjectReferenceList reads list of values of the ”object_reference' type from +// the given iterator. +func ReadObjectReferenceList(iterator *jsoniter.Iterator) []*ObjectReference { + list := []*ObjectReference{} + for iterator.ReadArray() { + item := ReadObjectReference(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/addonsmgmt/v1/object_reference_type.go b/clientapi/addonsmgmt/v1/object_reference_type.go new file mode 100644 index 00000000..00def4a2 --- /dev/null +++ b/clientapi/addonsmgmt/v1/object_reference_type.go @@ -0,0 +1,213 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +// ObjectReference represents the values of the 'object_reference' type. +// +// representation of object reference/subscription +type ObjectReference struct { + bitmap_ uint32 + href string + id string + kind string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ObjectReference) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Href returns the value of the 'href' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Self Link +func (o *ObjectReference) Href() string { + if o != nil && o.bitmap_&1 != 0 { + return o.href + } + return "" +} + +// GetHref returns the value of the 'href' attribute and +// a flag indicating if the attribute has a value. +// +// Self Link +func (o *ObjectReference) GetHref() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.href + } + return +} + +// Id returns the value of the 'id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Unique identifier of the object. +func (o *ObjectReference) Id() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetId returns the value of the 'id' attribute and +// a flag indicating if the attribute has a value. +// +// Unique identifier of the object. +func (o *ObjectReference) GetId() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// Kind returns the value of the 'kind' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the type of this object. +func (o *ObjectReference) Kind() string { + if o != nil && o.bitmap_&4 != 0 { + return o.kind + } + return "" +} + +// GetKind returns the value of the 'kind' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the type of this object. +func (o *ObjectReference) GetKind() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.kind + } + return +} + +// ObjectReferenceListKind is the name of the type used to represent list of objects of +// type 'object_reference'. +const ObjectReferenceListKind = "ObjectReferenceList" + +// ObjectReferenceListLinkKind is the name of the type used to represent links to list +// of objects of type 'object_reference'. +const ObjectReferenceListLinkKind = "ObjectReferenceListLink" + +// ObjectReferenceNilKind is the name of the type used to nil lists of objects of +// type 'object_reference'. +const ObjectReferenceListNilKind = "ObjectReferenceListNil" + +// ObjectReferenceList is a list of values of the 'object_reference' type. +type ObjectReferenceList struct { + href string + link bool + items []*ObjectReference +} + +// Len returns the length of the list. +func (l *ObjectReferenceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ObjectReferenceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ObjectReferenceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ObjectReferenceList) SetItems(items []*ObjectReference) { + l.items = items +} + +// Items returns the items of the list. +func (l *ObjectReferenceList) Items() []*ObjectReference { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ObjectReferenceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ObjectReferenceList) Get(i int) *ObjectReference { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ObjectReferenceList) Slice() []*ObjectReference { + var slice []*ObjectReference + if l == nil { + slice = make([]*ObjectReference, 0) + } else { + slice = make([]*ObjectReference, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ObjectReferenceList) Each(f func(item *ObjectReference) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ObjectReferenceList) Range(f func(index int, item *ObjectReference) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/addonsmgmt/v1/object_reference_type_json.go b/clientapi/addonsmgmt/v1/object_reference_type_json.go new file mode 100644 index 00000000..6e040e70 --- /dev/null +++ b/clientapi/addonsmgmt/v1/object_reference_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalObjectReference writes a value of the 'object_reference' type to the given writer. +func MarshalObjectReference(object *ObjectReference, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteObjectReference(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteObjectReference writes a value of the 'object_reference' type to the given stream. +func WriteObjectReference(object *ObjectReference, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kind") + stream.WriteString(object.kind) + } + stream.WriteObjectEnd() +} + +// UnmarshalObjectReference reads a value of the 'object_reference' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalObjectReference(source interface{}) (object *ObjectReference, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadObjectReference(iterator) + err = iterator.Error + return +} + +// ReadObjectReference reads a value of the 'object_reference' type from the given iterator. +func ReadObjectReference(iterator *jsoniter.Iterator) *ObjectReference { + object := &ObjectReference{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 1 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 2 + case "kind": + value := iterator.ReadString() + object.kind = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/addonsmgmt/v1/string_list_type_json.go b/clientapi/addonsmgmt/v1/string_list_type_json.go new file mode 100644 index 00000000..675c08f7 --- /dev/null +++ b/clientapi/addonsmgmt/v1/string_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/addonsmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStringList writes a list of values of the 'string' type to +// the given writer. +func MarshalStringList(list []string, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStringList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStringList writes a list of value of the 'string' type to +// the given stream. +func WriteStringList(list []string, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalStringList reads a list of values of the 'string' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStringList(source interface{}) (items []string, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStringList(iterator) + err = iterator.Error + return +} + +// ReadStringList reads list of values of the ”string' type from +// the given iterator. +func ReadStringList(iterator *jsoniter.Iterator) []string { + list := []string{} + for iterator.ReadArray() { + item := iterator.ReadString() + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/ami_override_builder.go b/clientapi/arohcp/v1alpha1/ami_override_builder.go new file mode 100644 index 00000000..dbc9b072 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ami_override_builder.go @@ -0,0 +1,143 @@ +/* +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 ( + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// AMIOverrideBuilder contains the data and logic needed to build 'AMI_override' objects. +// +// AMIOverride specifies what Amazon Machine Image should be used for a particular product and region. +type AMIOverrideBuilder struct { + bitmap_ uint32 + id string + href string + ami string + product *v1.ProductBuilder + region *v1.CloudRegionBuilder +} + +// NewAMIOverride creates a new builder of 'AMI_override' objects. +func NewAMIOverride() *AMIOverrideBuilder { + return &AMIOverrideBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AMIOverrideBuilder) Link(value bool) *AMIOverrideBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AMIOverrideBuilder) ID(value string) *AMIOverrideBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AMIOverrideBuilder) HREF(value string) *AMIOverrideBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AMIOverrideBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AMI sets the value of the 'AMI' attribute to the given value. +func (b *AMIOverrideBuilder) AMI(value string) *AMIOverrideBuilder { + b.ami = value + b.bitmap_ |= 8 + return b +} + +// Product sets the value of the 'product' attribute to the given value. +// +// Representation of an product that can be selected as a cluster type. +func (b *AMIOverrideBuilder) Product(value *v1.ProductBuilder) *AMIOverrideBuilder { + b.product = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Region sets the value of the 'region' attribute to the given value. +// +// Description of a region of a cloud provider. +func (b *AMIOverrideBuilder) Region(value *v1.CloudRegionBuilder) *AMIOverrideBuilder { + b.region = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AMIOverrideBuilder) Copy(object *AMIOverride) *AMIOverrideBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.ami = object.ami + if object.product != nil { + b.product = v1.NewProduct().Copy(object.product) + } else { + b.product = nil + } + if object.region != nil { + b.region = v1.NewCloudRegion().Copy(object.region) + } else { + b.region = nil + } + return b +} + +// Build creates a 'AMI_override' object using the configuration stored in the builder. +func (b *AMIOverrideBuilder) Build() (object *AMIOverride, err error) { + object = new(AMIOverride) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.ami = b.ami + if b.product != nil { + object.product, err = b.product.Build() + if err != nil { + return + } + } + if b.region != nil { + object.region, err = b.region.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/ami_override_list_builder.go b/clientapi/arohcp/v1alpha1/ami_override_list_builder.go new file mode 100644 index 00000000..89af31dd --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ami_override_list_builder.go @@ -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 + +// AMIOverrideListBuilder contains the data and logic needed to build +// 'AMI_override' objects. +type AMIOverrideListBuilder struct { + items []*AMIOverrideBuilder +} + +// NewAMIOverrideList creates a new builder of 'AMI_override' objects. +func NewAMIOverrideList() *AMIOverrideListBuilder { + return new(AMIOverrideListBuilder) +} + +// Items sets the items of the list. +func (b *AMIOverrideListBuilder) Items(values ...*AMIOverrideBuilder) *AMIOverrideListBuilder { + b.items = make([]*AMIOverrideBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AMIOverrideListBuilder) 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 *AMIOverrideListBuilder) Copy(list *AMIOverrideList) *AMIOverrideListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AMIOverrideBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAMIOverride().Copy(v) + } + } + return b +} + +// Build creates a list of 'AMI_override' objects using the +// configuration stored in the builder. +func (b *AMIOverrideListBuilder) Build() (list *AMIOverrideList, err error) { + items := make([]*AMIOverride, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AMIOverrideList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/ami_override_list_type_json.go b/clientapi/arohcp/v1alpha1/ami_override_list_type_json.go new file mode 100644 index 00000000..1e3dd23a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ami_override_list_type_json.go @@ -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" +) + +// MarshalAMIOverrideList writes a list of values of the 'AMI_override' type to +// the given writer. +func MarshalAMIOverrideList(list []*AMIOverride, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAMIOverrideList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAMIOverrideList writes a list of value of the 'AMI_override' type to +// the given stream. +func WriteAMIOverrideList(list []*AMIOverride, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAMIOverride(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAMIOverrideList reads a list of values of the 'AMI_override' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAMIOverrideList(source interface{}) (items []*AMIOverride, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAMIOverrideList(iterator) + err = iterator.Error + return +} + +// ReadAMIOverrideList reads list of values of the ”AMI_override' type from +// the given iterator. +func ReadAMIOverrideList(iterator *jsoniter.Iterator) []*AMIOverride { + list := []*AMIOverride{} + for iterator.ReadArray() { + item := ReadAMIOverride(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/ami_override_type.go b/clientapi/arohcp/v1alpha1/ami_override_type.go new file mode 100644 index 00000000..f41e5fac --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ami_override_type.go @@ -0,0 +1,317 @@ +/* +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 ( + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// AMIOverrideKind is the name of the type used to represent objects +// of type 'AMI_override'. +const AMIOverrideKind = "AMIOverride" + +// AMIOverrideLinkKind is the name of the type used to represent links +// to objects of type 'AMI_override'. +const AMIOverrideLinkKind = "AMIOverrideLink" + +// AMIOverrideNilKind is the name of the type used to nil references +// to objects of type 'AMI_override'. +const AMIOverrideNilKind = "AMIOverrideNil" + +// AMIOverride represents the values of the 'AMI_override' type. +// +// AMIOverride specifies what Amazon Machine Image should be used for a particular product and region. +type AMIOverride struct { + bitmap_ uint32 + id string + href string + ami string + product *v1.Product + region *v1.CloudRegion +} + +// Kind returns the name of the type of the object. +func (o *AMIOverride) Kind() string { + if o == nil { + return AMIOverrideNilKind + } + if o.bitmap_&1 != 0 { + return AMIOverrideLinkKind + } + return AMIOverrideKind +} + +// Link returns true if this is a link. +func (o *AMIOverride) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AMIOverride) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AMIOverride) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AMIOverride) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AMIOverride) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AMIOverride) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AMI returns the value of the 'AMI' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AMI is the id of the Amazon Machine Image. +func (o *AMIOverride) AMI() string { + if o != nil && o.bitmap_&8 != 0 { + return o.ami + } + return "" +} + +// GetAMI returns the value of the 'AMI' attribute and +// a flag indicating if the attribute has a value. +// +// AMI is the id of the Amazon Machine Image. +func (o *AMIOverride) GetAMI() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.ami + } + return +} + +// Product returns the value of the 'product' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the product type. +func (o *AMIOverride) Product() *v1.Product { + if o != nil && o.bitmap_&16 != 0 { + return o.product + } + return nil +} + +// GetProduct returns the value of the 'product' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the product type. +func (o *AMIOverride) GetProduct() (value *v1.Product, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.product + } + return +} + +// Region returns the value of the 'region' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the cloud provider region. +func (o *AMIOverride) Region() *v1.CloudRegion { + if o != nil && o.bitmap_&32 != 0 { + return o.region + } + return nil +} + +// GetRegion returns the value of the 'region' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the cloud provider region. +func (o *AMIOverride) GetRegion() (value *v1.CloudRegion, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.region + } + return +} + +// AMIOverrideListKind is the name of the type used to represent list of objects of +// type 'AMI_override'. +const AMIOverrideListKind = "AMIOverrideList" + +// AMIOverrideListLinkKind is the name of the type used to represent links to list +// of objects of type 'AMI_override'. +const AMIOverrideListLinkKind = "AMIOverrideListLink" + +// AMIOverrideNilKind is the name of the type used to nil lists of objects of +// type 'AMI_override'. +const AMIOverrideListNilKind = "AMIOverrideListNil" + +// AMIOverrideList is a list of values of the 'AMI_override' type. +type AMIOverrideList struct { + href string + link bool + items []*AMIOverride +} + +// Kind returns the name of the type of the object. +func (l *AMIOverrideList) Kind() string { + if l == nil { + return AMIOverrideListNilKind + } + if l.link { + return AMIOverrideListLinkKind + } + return AMIOverrideListKind +} + +// Link returns true iif this is a link. +func (l *AMIOverrideList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AMIOverrideList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AMIOverrideList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AMIOverrideList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AMIOverrideList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AMIOverrideList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AMIOverrideList) SetItems(items []*AMIOverride) { + l.items = items +} + +// Items returns the items of the list. +func (l *AMIOverrideList) Items() []*AMIOverride { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AMIOverrideList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AMIOverrideList) Get(i int) *AMIOverride { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AMIOverrideList) Slice() []*AMIOverride { + var slice []*AMIOverride + if l == nil { + slice = make([]*AMIOverride, 0) + } else { + slice = make([]*AMIOverride, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AMIOverrideList) Each(f func(item *AMIOverride) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AMIOverrideList) Range(f func(index int, item *AMIOverride) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/ami_override_type_json.go b/clientapi/arohcp/v1alpha1/ami_override_type_json.go new file mode 100644 index 00000000..be025f41 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ami_override_type_json.go @@ -0,0 +1,147 @@ +/* +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" + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAMIOverride writes a value of the 'AMI_override' type to the given writer. +func MarshalAMIOverride(object *AMIOverride, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAMIOverride(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAMIOverride writes a value of the 'AMI_override' type to the given stream. +func WriteAMIOverride(object *AMIOverride, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AMIOverrideLinkKind) + } else { + stream.WriteString(AMIOverrideKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ami") + stream.WriteString(object.ami) + count++ + } + present_ = object.bitmap_&16 != 0 && object.product != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product") + v1.WriteProduct(object.product, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.region != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region") + v1.WriteCloudRegion(object.region, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAMIOverride reads a value of the 'AMI_override' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAMIOverride(source interface{}) (object *AMIOverride, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAMIOverride(iterator) + err = iterator.Error + return +} + +// ReadAMIOverride reads a value of the 'AMI_override' type from the given iterator. +func ReadAMIOverride(iterator *jsoniter.Iterator) *AMIOverride { + object := &AMIOverride{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AMIOverrideLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "ami": + value := iterator.ReadString() + object.ami = value + object.bitmap_ |= 8 + case "product": + value := v1.ReadProduct(iterator) + object.product = value + object.bitmap_ |= 16 + case "region": + value := v1.ReadCloudRegion(iterator) + object.region = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/audit_log_builder.go b/clientapi/arohcp/v1alpha1/audit_log_builder.go new file mode 100644 index 00000000..29ec3a2c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/audit_log_builder.go @@ -0,0 +1,63 @@ +/* +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 + +// AuditLogBuilder contains the data and logic needed to build 'audit_log' objects. +// +// Contains the necessary attributes to support audit log forwarding +type AuditLogBuilder struct { + bitmap_ uint32 + roleArn string +} + +// NewAuditLog creates a new builder of 'audit_log' objects. +func NewAuditLog() *AuditLogBuilder { + return &AuditLogBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AuditLogBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// RoleArn sets the value of the 'role_arn' attribute to the given value. +func (b *AuditLogBuilder) RoleArn(value string) *AuditLogBuilder { + b.roleArn = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AuditLogBuilder) Copy(object *AuditLog) *AuditLogBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.roleArn = object.roleArn + return b +} + +// Build creates a 'audit_log' object using the configuration stored in the builder. +func (b *AuditLogBuilder) Build() (object *AuditLog, err error) { + object = new(AuditLog) + object.bitmap_ = b.bitmap_ + object.roleArn = b.roleArn + return +} diff --git a/clientapi/arohcp/v1alpha1/audit_log_list_builder.go b/clientapi/arohcp/v1alpha1/audit_log_list_builder.go new file mode 100644 index 00000000..ccf1099c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/audit_log_list_builder.go @@ -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 + +// AuditLogListBuilder contains the data and logic needed to build +// 'audit_log' objects. +type AuditLogListBuilder struct { + items []*AuditLogBuilder +} + +// NewAuditLogList creates a new builder of 'audit_log' objects. +func NewAuditLogList() *AuditLogListBuilder { + return new(AuditLogListBuilder) +} + +// Items sets the items of the list. +func (b *AuditLogListBuilder) Items(values ...*AuditLogBuilder) *AuditLogListBuilder { + b.items = make([]*AuditLogBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AuditLogListBuilder) 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 *AuditLogListBuilder) Copy(list *AuditLogList) *AuditLogListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AuditLogBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAuditLog().Copy(v) + } + } + return b +} + +// Build creates a list of 'audit_log' objects using the +// configuration stored in the builder. +func (b *AuditLogListBuilder) Build() (list *AuditLogList, err error) { + items := make([]*AuditLog, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AuditLogList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/audit_log_list_type_json.go b/clientapi/arohcp/v1alpha1/audit_log_list_type_json.go new file mode 100644 index 00000000..dcdf8512 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/audit_log_list_type_json.go @@ -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" +) + +// MarshalAuditLogList writes a list of values of the 'audit_log' type to +// the given writer. +func MarshalAuditLogList(list []*AuditLog, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAuditLogList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAuditLogList writes a list of value of the 'audit_log' type to +// the given stream. +func WriteAuditLogList(list []*AuditLog, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAuditLog(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAuditLogList reads a list of values of the 'audit_log' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAuditLogList(source interface{}) (items []*AuditLog, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAuditLogList(iterator) + err = iterator.Error + return +} + +// ReadAuditLogList reads list of values of the ”audit_log' type from +// the given iterator. +func ReadAuditLogList(iterator *jsoniter.Iterator) []*AuditLog { + list := []*AuditLog{} + for iterator.ReadArray() { + item := ReadAuditLog(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/audit_log_type.go b/clientapi/arohcp/v1alpha1/audit_log_type.go new file mode 100644 index 00000000..241b6101 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/audit_log_type.go @@ -0,0 +1,165 @@ +/* +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 + +// AuditLog represents the values of the 'audit_log' type. +// +// Contains the necessary attributes to support audit log forwarding +type AuditLog struct { + bitmap_ uint32 + roleArn string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AuditLog) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// RoleArn returns the value of the 'role_arn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN of the CloudWatch audit log forwarding role +func (o *AuditLog) RoleArn() string { + if o != nil && o.bitmap_&1 != 0 { + return o.roleArn + } + return "" +} + +// GetRoleArn returns the value of the 'role_arn' attribute and +// a flag indicating if the attribute has a value. +// +// ARN of the CloudWatch audit log forwarding role +func (o *AuditLog) GetRoleArn() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.roleArn + } + return +} + +// AuditLogListKind is the name of the type used to represent list of objects of +// type 'audit_log'. +const AuditLogListKind = "AuditLogList" + +// AuditLogListLinkKind is the name of the type used to represent links to list +// of objects of type 'audit_log'. +const AuditLogListLinkKind = "AuditLogListLink" + +// AuditLogNilKind is the name of the type used to nil lists of objects of +// type 'audit_log'. +const AuditLogListNilKind = "AuditLogListNil" + +// AuditLogList is a list of values of the 'audit_log' type. +type AuditLogList struct { + href string + link bool + items []*AuditLog +} + +// Len returns the length of the list. +func (l *AuditLogList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AuditLogList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AuditLogList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AuditLogList) SetItems(items []*AuditLog) { + l.items = items +} + +// Items returns the items of the list. +func (l *AuditLogList) Items() []*AuditLog { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AuditLogList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AuditLogList) Get(i int) *AuditLog { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AuditLogList) Slice() []*AuditLog { + var slice []*AuditLog + if l == nil { + slice = make([]*AuditLog, 0) + } else { + slice = make([]*AuditLog, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AuditLogList) Each(f func(item *AuditLog) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AuditLogList) Range(f func(index int, item *AuditLog) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/audit_log_type_json.go b/clientapi/arohcp/v1alpha1/audit_log_type_json.go new file mode 100644 index 00000000..90ba9826 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/audit_log_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalAuditLog writes a value of the 'audit_log' type to the given writer. +func MarshalAuditLog(object *AuditLog, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAuditLog(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAuditLog writes a value of the 'audit_log' type to the given stream. +func WriteAuditLog(object *AuditLog, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role_arn") + stream.WriteString(object.roleArn) + } + stream.WriteObjectEnd() +} + +// UnmarshalAuditLog reads a value of the 'audit_log' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAuditLog(source interface{}) (object *AuditLog, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAuditLog(iterator) + err = iterator.Error + return +} + +// ReadAuditLog reads a value of the 'audit_log' type from the given iterator. +func ReadAuditLog(iterator *jsoniter.Iterator) *AuditLog { + object := &AuditLog{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "role_arn": + value := iterator.ReadString() + object.roleArn = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/aws_builder.go b/clientapi/arohcp/v1alpha1/aws_builder.go new file mode 100644 index 00000000..177f5312 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_builder.go @@ -0,0 +1,386 @@ +/* +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 + +// AWSBuilder contains the data and logic needed to build 'AWS' objects. +// +// _Amazon Web Services_ specific settings of a cluster. +type AWSBuilder struct { + bitmap_ uint32 + kmsKeyArn string + sts *STSBuilder + accessKeyID string + accountID string + additionalAllowedPrincipals []string + additionalComputeSecurityGroupIds []string + additionalControlPlaneSecurityGroupIds []string + additionalInfraSecurityGroupIds []string + auditLog *AuditLogBuilder + billingAccountID string + ec2MetadataHttpTokens Ec2MetadataHttpTokens + etcdEncryption *AwsEtcdEncryptionBuilder + hcpInternalCommunicationHostedZoneId string + privateHostedZoneID string + privateHostedZoneRoleARN string + privateLinkConfiguration *PrivateLinkClusterConfigurationBuilder + secretAccessKey string + subnetIDs []string + tags map[string]string + vpcEndpointRoleArn string + privateLink bool +} + +// NewAWS creates a new builder of 'AWS' objects. +func NewAWS() *AWSBuilder { + return &AWSBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// KMSKeyArn sets the value of the 'KMS_key_arn' attribute to the given value. +func (b *AWSBuilder) KMSKeyArn(value string) *AWSBuilder { + b.kmsKeyArn = value + b.bitmap_ |= 1 + return b +} + +// STS sets the value of the 'STS' attribute to the given value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (b *AWSBuilder) STS(value *STSBuilder) *AWSBuilder { + b.sts = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// AccessKeyID sets the value of the 'access_key_ID' attribute to the given value. +func (b *AWSBuilder) AccessKeyID(value string) *AWSBuilder { + b.accessKeyID = value + b.bitmap_ |= 4 + return b +} + +// AccountID sets the value of the 'account_ID' attribute to the given value. +func (b *AWSBuilder) AccountID(value string) *AWSBuilder { + b.accountID = value + b.bitmap_ |= 8 + return b +} + +// AdditionalAllowedPrincipals sets the value of the 'additional_allowed_principals' attribute to the given values. +func (b *AWSBuilder) AdditionalAllowedPrincipals(values ...string) *AWSBuilder { + b.additionalAllowedPrincipals = make([]string, len(values)) + copy(b.additionalAllowedPrincipals, values) + b.bitmap_ |= 16 + return b +} + +// AdditionalComputeSecurityGroupIds sets the value of the 'additional_compute_security_group_ids' attribute to the given values. +func (b *AWSBuilder) AdditionalComputeSecurityGroupIds(values ...string) *AWSBuilder { + b.additionalComputeSecurityGroupIds = make([]string, len(values)) + copy(b.additionalComputeSecurityGroupIds, values) + b.bitmap_ |= 32 + return b +} + +// AdditionalControlPlaneSecurityGroupIds sets the value of the 'additional_control_plane_security_group_ids' attribute to the given values. +func (b *AWSBuilder) AdditionalControlPlaneSecurityGroupIds(values ...string) *AWSBuilder { + b.additionalControlPlaneSecurityGroupIds = make([]string, len(values)) + copy(b.additionalControlPlaneSecurityGroupIds, values) + b.bitmap_ |= 64 + return b +} + +// AdditionalInfraSecurityGroupIds sets the value of the 'additional_infra_security_group_ids' attribute to the given values. +func (b *AWSBuilder) AdditionalInfraSecurityGroupIds(values ...string) *AWSBuilder { + b.additionalInfraSecurityGroupIds = make([]string, len(values)) + copy(b.additionalInfraSecurityGroupIds, values) + b.bitmap_ |= 128 + return b +} + +// AuditLog sets the value of the 'audit_log' attribute to the given value. +// +// Contains the necessary attributes to support audit log forwarding +func (b *AWSBuilder) AuditLog(value *AuditLogBuilder) *AWSBuilder { + b.auditLog = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// BillingAccountID sets the value of the 'billing_account_ID' attribute to the given value. +func (b *AWSBuilder) BillingAccountID(value string) *AWSBuilder { + b.billingAccountID = value + b.bitmap_ |= 512 + return b +} + +// Ec2MetadataHttpTokens sets the value of the 'ec_2_metadata_http_tokens' attribute to the given value. +// +// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances +func (b *AWSBuilder) Ec2MetadataHttpTokens(value Ec2MetadataHttpTokens) *AWSBuilder { + b.ec2MetadataHttpTokens = value + b.bitmap_ |= 1024 + return b +} + +// EtcdEncryption sets the value of the 'etcd_encryption' attribute to the given value. +// +// Contains the necessary attributes to support etcd encryption for AWS based clusters. +func (b *AWSBuilder) EtcdEncryption(value *AwsEtcdEncryptionBuilder) *AWSBuilder { + b.etcdEncryption = value + if value != nil { + b.bitmap_ |= 2048 + } else { + b.bitmap_ &^= 2048 + } + return b +} + +// HcpInternalCommunicationHostedZoneId sets the value of the 'hcp_internal_communication_hosted_zone_id' attribute to the given value. +func (b *AWSBuilder) HcpInternalCommunicationHostedZoneId(value string) *AWSBuilder { + b.hcpInternalCommunicationHostedZoneId = value + b.bitmap_ |= 4096 + return b +} + +// PrivateHostedZoneID sets the value of the 'private_hosted_zone_ID' attribute to the given value. +func (b *AWSBuilder) PrivateHostedZoneID(value string) *AWSBuilder { + b.privateHostedZoneID = value + b.bitmap_ |= 8192 + return b +} + +// PrivateHostedZoneRoleARN sets the value of the 'private_hosted_zone_role_ARN' attribute to the given value. +func (b *AWSBuilder) PrivateHostedZoneRoleARN(value string) *AWSBuilder { + b.privateHostedZoneRoleARN = value + b.bitmap_ |= 16384 + return b +} + +// PrivateLink sets the value of the 'private_link' attribute to the given value. +func (b *AWSBuilder) PrivateLink(value bool) *AWSBuilder { + b.privateLink = value + b.bitmap_ |= 32768 + return b +} + +// PrivateLinkConfiguration sets the value of the 'private_link_configuration' attribute to the given value. +// +// Manages the configuration for the Private Links. +func (b *AWSBuilder) PrivateLinkConfiguration(value *PrivateLinkClusterConfigurationBuilder) *AWSBuilder { + b.privateLinkConfiguration = value + if value != nil { + b.bitmap_ |= 65536 + } else { + b.bitmap_ &^= 65536 + } + return b +} + +// SecretAccessKey sets the value of the 'secret_access_key' attribute to the given value. +func (b *AWSBuilder) SecretAccessKey(value string) *AWSBuilder { + b.secretAccessKey = value + b.bitmap_ |= 131072 + return b +} + +// SubnetIDs sets the value of the 'subnet_IDs' attribute to the given values. +func (b *AWSBuilder) SubnetIDs(values ...string) *AWSBuilder { + b.subnetIDs = make([]string, len(values)) + copy(b.subnetIDs, values) + b.bitmap_ |= 262144 + return b +} + +// Tags sets the value of the 'tags' attribute to the given value. +func (b *AWSBuilder) Tags(value map[string]string) *AWSBuilder { + b.tags = value + if value != nil { + b.bitmap_ |= 524288 + } else { + b.bitmap_ &^= 524288 + } + return b +} + +// VpcEndpointRoleArn sets the value of the 'vpc_endpoint_role_arn' attribute to the given value. +func (b *AWSBuilder) VpcEndpointRoleArn(value string) *AWSBuilder { + b.vpcEndpointRoleArn = value + b.bitmap_ |= 1048576 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSBuilder) Copy(object *AWS) *AWSBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.kmsKeyArn = object.kmsKeyArn + if object.sts != nil { + b.sts = NewSTS().Copy(object.sts) + } else { + b.sts = nil + } + b.accessKeyID = object.accessKeyID + b.accountID = object.accountID + if object.additionalAllowedPrincipals != nil { + b.additionalAllowedPrincipals = make([]string, len(object.additionalAllowedPrincipals)) + copy(b.additionalAllowedPrincipals, object.additionalAllowedPrincipals) + } else { + b.additionalAllowedPrincipals = nil + } + if object.additionalComputeSecurityGroupIds != nil { + b.additionalComputeSecurityGroupIds = make([]string, len(object.additionalComputeSecurityGroupIds)) + copy(b.additionalComputeSecurityGroupIds, object.additionalComputeSecurityGroupIds) + } else { + b.additionalComputeSecurityGroupIds = nil + } + if object.additionalControlPlaneSecurityGroupIds != nil { + b.additionalControlPlaneSecurityGroupIds = make([]string, len(object.additionalControlPlaneSecurityGroupIds)) + copy(b.additionalControlPlaneSecurityGroupIds, object.additionalControlPlaneSecurityGroupIds) + } else { + b.additionalControlPlaneSecurityGroupIds = nil + } + if object.additionalInfraSecurityGroupIds != nil { + b.additionalInfraSecurityGroupIds = make([]string, len(object.additionalInfraSecurityGroupIds)) + copy(b.additionalInfraSecurityGroupIds, object.additionalInfraSecurityGroupIds) + } else { + b.additionalInfraSecurityGroupIds = nil + } + if object.auditLog != nil { + b.auditLog = NewAuditLog().Copy(object.auditLog) + } else { + b.auditLog = nil + } + b.billingAccountID = object.billingAccountID + b.ec2MetadataHttpTokens = object.ec2MetadataHttpTokens + if object.etcdEncryption != nil { + b.etcdEncryption = NewAwsEtcdEncryption().Copy(object.etcdEncryption) + } else { + b.etcdEncryption = nil + } + b.hcpInternalCommunicationHostedZoneId = object.hcpInternalCommunicationHostedZoneId + b.privateHostedZoneID = object.privateHostedZoneID + b.privateHostedZoneRoleARN = object.privateHostedZoneRoleARN + b.privateLink = object.privateLink + if object.privateLinkConfiguration != nil { + b.privateLinkConfiguration = NewPrivateLinkClusterConfiguration().Copy(object.privateLinkConfiguration) + } else { + b.privateLinkConfiguration = nil + } + b.secretAccessKey = object.secretAccessKey + if object.subnetIDs != nil { + b.subnetIDs = make([]string, len(object.subnetIDs)) + copy(b.subnetIDs, object.subnetIDs) + } else { + b.subnetIDs = nil + } + if len(object.tags) > 0 { + b.tags = map[string]string{} + for k, v := range object.tags { + b.tags[k] = v + } + } else { + b.tags = nil + } + b.vpcEndpointRoleArn = object.vpcEndpointRoleArn + return b +} + +// Build creates a 'AWS' object using the configuration stored in the builder. +func (b *AWSBuilder) Build() (object *AWS, err error) { + object = new(AWS) + object.bitmap_ = b.bitmap_ + object.kmsKeyArn = b.kmsKeyArn + if b.sts != nil { + object.sts, err = b.sts.Build() + if err != nil { + return + } + } + object.accessKeyID = b.accessKeyID + object.accountID = b.accountID + if b.additionalAllowedPrincipals != nil { + object.additionalAllowedPrincipals = make([]string, len(b.additionalAllowedPrincipals)) + copy(object.additionalAllowedPrincipals, b.additionalAllowedPrincipals) + } + if b.additionalComputeSecurityGroupIds != nil { + object.additionalComputeSecurityGroupIds = make([]string, len(b.additionalComputeSecurityGroupIds)) + copy(object.additionalComputeSecurityGroupIds, b.additionalComputeSecurityGroupIds) + } + if b.additionalControlPlaneSecurityGroupIds != nil { + object.additionalControlPlaneSecurityGroupIds = make([]string, len(b.additionalControlPlaneSecurityGroupIds)) + copy(object.additionalControlPlaneSecurityGroupIds, b.additionalControlPlaneSecurityGroupIds) + } + if b.additionalInfraSecurityGroupIds != nil { + object.additionalInfraSecurityGroupIds = make([]string, len(b.additionalInfraSecurityGroupIds)) + copy(object.additionalInfraSecurityGroupIds, b.additionalInfraSecurityGroupIds) + } + if b.auditLog != nil { + object.auditLog, err = b.auditLog.Build() + if err != nil { + return + } + } + object.billingAccountID = b.billingAccountID + object.ec2MetadataHttpTokens = b.ec2MetadataHttpTokens + if b.etcdEncryption != nil { + object.etcdEncryption, err = b.etcdEncryption.Build() + if err != nil { + return + } + } + object.hcpInternalCommunicationHostedZoneId = b.hcpInternalCommunicationHostedZoneId + object.privateHostedZoneID = b.privateHostedZoneID + object.privateHostedZoneRoleARN = b.privateHostedZoneRoleARN + object.privateLink = b.privateLink + if b.privateLinkConfiguration != nil { + object.privateLinkConfiguration, err = b.privateLinkConfiguration.Build() + if err != nil { + return + } + } + object.secretAccessKey = b.secretAccessKey + if b.subnetIDs != nil { + object.subnetIDs = make([]string, len(b.subnetIDs)) + copy(object.subnetIDs, b.subnetIDs) + } + if b.tags != nil { + object.tags = make(map[string]string) + for k, v := range b.tags { + object.tags[k] = v + } + } + object.vpcEndpointRoleArn = b.vpcEndpointRoleArn + return +} diff --git a/clientapi/arohcp/v1alpha1/aws_etcd_encryption_builder.go b/clientapi/arohcp/v1alpha1/aws_etcd_encryption_builder.go new file mode 100644 index 00000000..d7469e6e --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_etcd_encryption_builder.go @@ -0,0 +1,63 @@ +/* +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 + +// AwsEtcdEncryptionBuilder contains the data and logic needed to build 'aws_etcd_encryption' objects. +// +// Contains the necessary attributes to support etcd encryption for AWS based clusters. +type AwsEtcdEncryptionBuilder struct { + bitmap_ uint32 + kmsKeyARN string +} + +// NewAwsEtcdEncryption creates a new builder of 'aws_etcd_encryption' objects. +func NewAwsEtcdEncryption() *AwsEtcdEncryptionBuilder { + return &AwsEtcdEncryptionBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AwsEtcdEncryptionBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// KMSKeyARN sets the value of the 'KMS_key_ARN' attribute to the given value. +func (b *AwsEtcdEncryptionBuilder) KMSKeyARN(value string) *AwsEtcdEncryptionBuilder { + b.kmsKeyARN = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AwsEtcdEncryptionBuilder) Copy(object *AwsEtcdEncryption) *AwsEtcdEncryptionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.kmsKeyARN = object.kmsKeyARN + return b +} + +// Build creates a 'aws_etcd_encryption' object using the configuration stored in the builder. +func (b *AwsEtcdEncryptionBuilder) Build() (object *AwsEtcdEncryption, err error) { + object = new(AwsEtcdEncryption) + object.bitmap_ = b.bitmap_ + object.kmsKeyARN = b.kmsKeyARN + return +} diff --git a/clientapi/arohcp/v1alpha1/aws_etcd_encryption_list_builder.go b/clientapi/arohcp/v1alpha1/aws_etcd_encryption_list_builder.go new file mode 100644 index 00000000..0dd71f30 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_etcd_encryption_list_builder.go @@ -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 + +// AwsEtcdEncryptionListBuilder contains the data and logic needed to build +// 'aws_etcd_encryption' objects. +type AwsEtcdEncryptionListBuilder struct { + items []*AwsEtcdEncryptionBuilder +} + +// NewAwsEtcdEncryptionList creates a new builder of 'aws_etcd_encryption' objects. +func NewAwsEtcdEncryptionList() *AwsEtcdEncryptionListBuilder { + return new(AwsEtcdEncryptionListBuilder) +} + +// Items sets the items of the list. +func (b *AwsEtcdEncryptionListBuilder) Items(values ...*AwsEtcdEncryptionBuilder) *AwsEtcdEncryptionListBuilder { + b.items = make([]*AwsEtcdEncryptionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AwsEtcdEncryptionListBuilder) 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 *AwsEtcdEncryptionListBuilder) Copy(list *AwsEtcdEncryptionList) *AwsEtcdEncryptionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AwsEtcdEncryptionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAwsEtcdEncryption().Copy(v) + } + } + return b +} + +// Build creates a list of 'aws_etcd_encryption' objects using the +// configuration stored in the builder. +func (b *AwsEtcdEncryptionListBuilder) Build() (list *AwsEtcdEncryptionList, err error) { + items := make([]*AwsEtcdEncryption, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AwsEtcdEncryptionList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/aws_etcd_encryption_list_type_json.go b/clientapi/arohcp/v1alpha1/aws_etcd_encryption_list_type_json.go new file mode 100644 index 00000000..efc1e630 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_etcd_encryption_list_type_json.go @@ -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" +) + +// MarshalAwsEtcdEncryptionList writes a list of values of the 'aws_etcd_encryption' type to +// the given writer. +func MarshalAwsEtcdEncryptionList(list []*AwsEtcdEncryption, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAwsEtcdEncryptionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAwsEtcdEncryptionList writes a list of value of the 'aws_etcd_encryption' type to +// the given stream. +func WriteAwsEtcdEncryptionList(list []*AwsEtcdEncryption, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAwsEtcdEncryption(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAwsEtcdEncryptionList reads a list of values of the 'aws_etcd_encryption' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAwsEtcdEncryptionList(source interface{}) (items []*AwsEtcdEncryption, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAwsEtcdEncryptionList(iterator) + err = iterator.Error + return +} + +// ReadAwsEtcdEncryptionList reads list of values of the ”aws_etcd_encryption' type from +// the given iterator. +func ReadAwsEtcdEncryptionList(iterator *jsoniter.Iterator) []*AwsEtcdEncryption { + list := []*AwsEtcdEncryption{} + for iterator.ReadArray() { + item := ReadAwsEtcdEncryption(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/aws_etcd_encryption_type.go b/clientapi/arohcp/v1alpha1/aws_etcd_encryption_type.go new file mode 100644 index 00000000..b367339f --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_etcd_encryption_type.go @@ -0,0 +1,165 @@ +/* +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 + +// AwsEtcdEncryption represents the values of the 'aws_etcd_encryption' type. +// +// Contains the necessary attributes to support etcd encryption for AWS based clusters. +type AwsEtcdEncryption struct { + bitmap_ uint32 + kmsKeyARN string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AwsEtcdEncryption) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// KMSKeyARN returns the value of the 'KMS_key_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN of the KMS to be used for the etcd encryption +func (o *AwsEtcdEncryption) KMSKeyARN() string { + if o != nil && o.bitmap_&1 != 0 { + return o.kmsKeyARN + } + return "" +} + +// GetKMSKeyARN returns the value of the 'KMS_key_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// ARN of the KMS to be used for the etcd encryption +func (o *AwsEtcdEncryption) GetKMSKeyARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.kmsKeyARN + } + return +} + +// AwsEtcdEncryptionListKind is the name of the type used to represent list of objects of +// type 'aws_etcd_encryption'. +const AwsEtcdEncryptionListKind = "AwsEtcdEncryptionList" + +// AwsEtcdEncryptionListLinkKind is the name of the type used to represent links to list +// of objects of type 'aws_etcd_encryption'. +const AwsEtcdEncryptionListLinkKind = "AwsEtcdEncryptionListLink" + +// AwsEtcdEncryptionNilKind is the name of the type used to nil lists of objects of +// type 'aws_etcd_encryption'. +const AwsEtcdEncryptionListNilKind = "AwsEtcdEncryptionListNil" + +// AwsEtcdEncryptionList is a list of values of the 'aws_etcd_encryption' type. +type AwsEtcdEncryptionList struct { + href string + link bool + items []*AwsEtcdEncryption +} + +// Len returns the length of the list. +func (l *AwsEtcdEncryptionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AwsEtcdEncryptionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AwsEtcdEncryptionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AwsEtcdEncryptionList) SetItems(items []*AwsEtcdEncryption) { + l.items = items +} + +// Items returns the items of the list. +func (l *AwsEtcdEncryptionList) Items() []*AwsEtcdEncryption { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AwsEtcdEncryptionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AwsEtcdEncryptionList) Get(i int) *AwsEtcdEncryption { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AwsEtcdEncryptionList) Slice() []*AwsEtcdEncryption { + var slice []*AwsEtcdEncryption + if l == nil { + slice = make([]*AwsEtcdEncryption, 0) + } else { + slice = make([]*AwsEtcdEncryption, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AwsEtcdEncryptionList) Each(f func(item *AwsEtcdEncryption) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AwsEtcdEncryptionList) Range(f func(index int, item *AwsEtcdEncryption) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/aws_etcd_encryption_type_json.go b/clientapi/arohcp/v1alpha1/aws_etcd_encryption_type_json.go new file mode 100644 index 00000000..243345e7 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_etcd_encryption_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalAwsEtcdEncryption writes a value of the 'aws_etcd_encryption' type to the given writer. +func MarshalAwsEtcdEncryption(object *AwsEtcdEncryption, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAwsEtcdEncryption(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAwsEtcdEncryption writes a value of the 'aws_etcd_encryption' type to the given stream. +func WriteAwsEtcdEncryption(object *AwsEtcdEncryption, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kms_key_arn") + stream.WriteString(object.kmsKeyARN) + } + stream.WriteObjectEnd() +} + +// UnmarshalAwsEtcdEncryption reads a value of the 'aws_etcd_encryption' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAwsEtcdEncryption(source interface{}) (object *AwsEtcdEncryption, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAwsEtcdEncryption(iterator) + err = iterator.Error + return +} + +// ReadAwsEtcdEncryption reads a value of the 'aws_etcd_encryption' type from the given iterator. +func ReadAwsEtcdEncryption(iterator *jsoniter.Iterator) *AwsEtcdEncryption { + object := &AwsEtcdEncryption{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kms_key_arn": + value := iterator.ReadString() + object.kmsKeyARN = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/aws_list_builder.go b/clientapi/arohcp/v1alpha1/aws_list_builder.go new file mode 100644 index 00000000..147d829e --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_list_builder.go @@ -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 + +// AWSListBuilder contains the data and logic needed to build +// 'AWS' objects. +type AWSListBuilder struct { + items []*AWSBuilder +} + +// NewAWSList creates a new builder of 'AWS' objects. +func NewAWSList() *AWSListBuilder { + return new(AWSListBuilder) +} + +// Items sets the items of the list. +func (b *AWSListBuilder) Items(values ...*AWSBuilder) *AWSListBuilder { + b.items = make([]*AWSBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSListBuilder) 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 *AWSListBuilder) Copy(list *AWSList) *AWSListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWS().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS' objects using the +// configuration stored in the builder. +func (b *AWSListBuilder) Build() (list *AWSList, err error) { + items := make([]*AWS, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/aws_list_type_json.go b/clientapi/arohcp/v1alpha1/aws_list_type_json.go new file mode 100644 index 00000000..93f72053 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_list_type_json.go @@ -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" +) + +// MarshalAWSList writes a list of values of the 'AWS' type to +// the given writer. +func MarshalAWSList(list []*AWS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSList writes a list of value of the 'AWS' type to +// the given stream. +func WriteAWSList(list []*AWS, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWS(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSList reads a list of values of the 'AWS' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSList(source interface{}) (items []*AWS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSList(iterator) + err = iterator.Error + return +} + +// ReadAWSList reads list of values of the ”AWS' type from +// the given iterator. +func ReadAWSList(iterator *jsoniter.Iterator) []*AWS { + list := []*AWS{} + for iterator.ReadArray() { + item := ReadAWS(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/aws_node_pool_builder.go b/clientapi/arohcp/v1alpha1/aws_node_pool_builder.go new file mode 100644 index 00000000..ec28a202 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_node_pool_builder.go @@ -0,0 +1,233 @@ +/* +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 + +// AWSNodePoolBuilder contains the data and logic needed to build 'AWS_node_pool' objects. +// +// Representation of aws node pool specific parameters. +type AWSNodePoolBuilder struct { + bitmap_ uint32 + id string + href string + additionalSecurityGroupIds []string + availabilityZoneTypes map[string]string + ec2MetadataHttpTokens Ec2MetadataHttpTokens + instanceProfile string + instanceType string + rootVolume *AWSVolumeBuilder + subnetOutposts map[string]string + tags map[string]string +} + +// NewAWSNodePool creates a new builder of 'AWS_node_pool' objects. +func NewAWSNodePool() *AWSNodePoolBuilder { + return &AWSNodePoolBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AWSNodePoolBuilder) Link(value bool) *AWSNodePoolBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AWSNodePoolBuilder) ID(value string) *AWSNodePoolBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AWSNodePoolBuilder) HREF(value string) *AWSNodePoolBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSNodePoolBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AdditionalSecurityGroupIds sets the value of the 'additional_security_group_ids' attribute to the given values. +func (b *AWSNodePoolBuilder) AdditionalSecurityGroupIds(values ...string) *AWSNodePoolBuilder { + b.additionalSecurityGroupIds = make([]string, len(values)) + copy(b.additionalSecurityGroupIds, values) + b.bitmap_ |= 8 + return b +} + +// AvailabilityZoneTypes sets the value of the 'availability_zone_types' attribute to the given value. +func (b *AWSNodePoolBuilder) AvailabilityZoneTypes(value map[string]string) *AWSNodePoolBuilder { + b.availabilityZoneTypes = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Ec2MetadataHttpTokens sets the value of the 'ec_2_metadata_http_tokens' attribute to the given value. +// +// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances +func (b *AWSNodePoolBuilder) Ec2MetadataHttpTokens(value Ec2MetadataHttpTokens) *AWSNodePoolBuilder { + b.ec2MetadataHttpTokens = value + b.bitmap_ |= 32 + return b +} + +// InstanceProfile sets the value of the 'instance_profile' attribute to the given value. +func (b *AWSNodePoolBuilder) InstanceProfile(value string) *AWSNodePoolBuilder { + b.instanceProfile = value + b.bitmap_ |= 64 + return b +} + +// InstanceType sets the value of the 'instance_type' attribute to the given value. +func (b *AWSNodePoolBuilder) InstanceType(value string) *AWSNodePoolBuilder { + b.instanceType = value + b.bitmap_ |= 128 + return b +} + +// RootVolume sets the value of the 'root_volume' attribute to the given value. +// +// Holds settings for an AWS storage volume. +func (b *AWSNodePoolBuilder) RootVolume(value *AWSVolumeBuilder) *AWSNodePoolBuilder { + b.rootVolume = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// SubnetOutposts sets the value of the 'subnet_outposts' attribute to the given value. +func (b *AWSNodePoolBuilder) SubnetOutposts(value map[string]string) *AWSNodePoolBuilder { + b.subnetOutposts = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// Tags sets the value of the 'tags' attribute to the given value. +func (b *AWSNodePoolBuilder) Tags(value map[string]string) *AWSNodePoolBuilder { + b.tags = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSNodePoolBuilder) Copy(object *AWSNodePool) *AWSNodePoolBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.additionalSecurityGroupIds != nil { + b.additionalSecurityGroupIds = make([]string, len(object.additionalSecurityGroupIds)) + copy(b.additionalSecurityGroupIds, object.additionalSecurityGroupIds) + } else { + b.additionalSecurityGroupIds = nil + } + if len(object.availabilityZoneTypes) > 0 { + b.availabilityZoneTypes = map[string]string{} + for k, v := range object.availabilityZoneTypes { + b.availabilityZoneTypes[k] = v + } + } else { + b.availabilityZoneTypes = nil + } + b.ec2MetadataHttpTokens = object.ec2MetadataHttpTokens + b.instanceProfile = object.instanceProfile + b.instanceType = object.instanceType + if object.rootVolume != nil { + b.rootVolume = NewAWSVolume().Copy(object.rootVolume) + } else { + b.rootVolume = nil + } + if len(object.subnetOutposts) > 0 { + b.subnetOutposts = map[string]string{} + for k, v := range object.subnetOutposts { + b.subnetOutposts[k] = v + } + } else { + b.subnetOutposts = nil + } + if len(object.tags) > 0 { + b.tags = map[string]string{} + for k, v := range object.tags { + b.tags[k] = v + } + } else { + b.tags = nil + } + return b +} + +// Build creates a 'AWS_node_pool' object using the configuration stored in the builder. +func (b *AWSNodePoolBuilder) Build() (object *AWSNodePool, err error) { + object = new(AWSNodePool) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.additionalSecurityGroupIds != nil { + object.additionalSecurityGroupIds = make([]string, len(b.additionalSecurityGroupIds)) + copy(object.additionalSecurityGroupIds, b.additionalSecurityGroupIds) + } + if b.availabilityZoneTypes != nil { + object.availabilityZoneTypes = make(map[string]string) + for k, v := range b.availabilityZoneTypes { + object.availabilityZoneTypes[k] = v + } + } + object.ec2MetadataHttpTokens = b.ec2MetadataHttpTokens + object.instanceProfile = b.instanceProfile + object.instanceType = b.instanceType + if b.rootVolume != nil { + object.rootVolume, err = b.rootVolume.Build() + if err != nil { + return + } + } + if b.subnetOutposts != nil { + object.subnetOutposts = make(map[string]string) + for k, v := range b.subnetOutposts { + object.subnetOutposts[k] = v + } + } + if b.tags != nil { + object.tags = make(map[string]string) + for k, v := range b.tags { + object.tags[k] = v + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/aws_node_pool_list_builder.go b/clientapi/arohcp/v1alpha1/aws_node_pool_list_builder.go new file mode 100644 index 00000000..93c4a5df --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_node_pool_list_builder.go @@ -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 + +// AWSNodePoolListBuilder contains the data and logic needed to build +// 'AWS_node_pool' objects. +type AWSNodePoolListBuilder struct { + items []*AWSNodePoolBuilder +} + +// NewAWSNodePoolList creates a new builder of 'AWS_node_pool' objects. +func NewAWSNodePoolList() *AWSNodePoolListBuilder { + return new(AWSNodePoolListBuilder) +} + +// Items sets the items of the list. +func (b *AWSNodePoolListBuilder) Items(values ...*AWSNodePoolBuilder) *AWSNodePoolListBuilder { + b.items = make([]*AWSNodePoolBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSNodePoolListBuilder) 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 *AWSNodePoolListBuilder) Copy(list *AWSNodePoolList) *AWSNodePoolListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSNodePoolBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSNodePool().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS_node_pool' objects using the +// configuration stored in the builder. +func (b *AWSNodePoolListBuilder) Build() (list *AWSNodePoolList, err error) { + items := make([]*AWSNodePool, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSNodePoolList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/aws_node_pool_list_type_json.go b/clientapi/arohcp/v1alpha1/aws_node_pool_list_type_json.go new file mode 100644 index 00000000..f27fc7f6 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_node_pool_list_type_json.go @@ -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" +) + +// MarshalAWSNodePoolList writes a list of values of the 'AWS_node_pool' type to +// the given writer. +func MarshalAWSNodePoolList(list []*AWSNodePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSNodePoolList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSNodePoolList writes a list of value of the 'AWS_node_pool' type to +// the given stream. +func WriteAWSNodePoolList(list []*AWSNodePool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSNodePool(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSNodePoolList reads a list of values of the 'AWS_node_pool' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSNodePoolList(source interface{}) (items []*AWSNodePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSNodePoolList(iterator) + err = iterator.Error + return +} + +// ReadAWSNodePoolList reads list of values of the ”AWS_node_pool' type from +// the given iterator. +func ReadAWSNodePoolList(iterator *jsoniter.Iterator) []*AWSNodePool { + list := []*AWSNodePool{} + for iterator.ReadArray() { + item := ReadAWSNodePool(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/aws_node_pool_type.go b/clientapi/arohcp/v1alpha1/aws_node_pool_type.go new file mode 100644 index 00000000..a61d4076 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_node_pool_type.go @@ -0,0 +1,447 @@ +/* +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 + +// AWSNodePoolKind is the name of the type used to represent objects +// of type 'AWS_node_pool'. +const AWSNodePoolKind = "AWSNodePool" + +// AWSNodePoolLinkKind is the name of the type used to represent links +// to objects of type 'AWS_node_pool'. +const AWSNodePoolLinkKind = "AWSNodePoolLink" + +// AWSNodePoolNilKind is the name of the type used to nil references +// to objects of type 'AWS_node_pool'. +const AWSNodePoolNilKind = "AWSNodePoolNil" + +// AWSNodePool represents the values of the 'AWS_node_pool' type. +// +// Representation of aws node pool specific parameters. +type AWSNodePool struct { + bitmap_ uint32 + id string + href string + additionalSecurityGroupIds []string + availabilityZoneTypes map[string]string + ec2MetadataHttpTokens Ec2MetadataHttpTokens + instanceProfile string + instanceType string + rootVolume *AWSVolume + subnetOutposts map[string]string + tags map[string]string +} + +// Kind returns the name of the type of the object. +func (o *AWSNodePool) Kind() string { + if o == nil { + return AWSNodePoolNilKind + } + if o.bitmap_&1 != 0 { + return AWSNodePoolLinkKind + } + return AWSNodePoolKind +} + +// Link returns true if this is a link. +func (o *AWSNodePool) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AWSNodePool) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AWSNodePool) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AWSNodePool) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AWSNodePool) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSNodePool) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AdditionalSecurityGroupIds returns the value of the 'additional_security_group_ids' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional AWS Security Groups to be added node pool. +func (o *AWSNodePool) AdditionalSecurityGroupIds() []string { + if o != nil && o.bitmap_&8 != 0 { + return o.additionalSecurityGroupIds + } + return nil +} + +// GetAdditionalSecurityGroupIds returns the value of the 'additional_security_group_ids' attribute and +// a flag indicating if the attribute has a value. +// +// Additional AWS Security Groups to be added node pool. +func (o *AWSNodePool) GetAdditionalSecurityGroupIds() (value []string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.additionalSecurityGroupIds + } + return +} + +// AvailabilityZoneTypes returns the value of the 'availability_zone_types' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Associates nodepool availability zones with zone types (e.g. wavelength, local). +func (o *AWSNodePool) AvailabilityZoneTypes() map[string]string { + if o != nil && o.bitmap_&16 != 0 { + return o.availabilityZoneTypes + } + return nil +} + +// GetAvailabilityZoneTypes returns the value of the 'availability_zone_types' attribute and +// a flag indicating if the attribute has a value. +// +// Associates nodepool availability zones with zone types (e.g. wavelength, local). +func (o *AWSNodePool) GetAvailabilityZoneTypes() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.availabilityZoneTypes + } + return +} + +// Ec2MetadataHttpTokens returns the value of the 'ec_2_metadata_http_tokens' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances +func (o *AWSNodePool) Ec2MetadataHttpTokens() Ec2MetadataHttpTokens { + if o != nil && o.bitmap_&32 != 0 { + return o.ec2MetadataHttpTokens + } + return Ec2MetadataHttpTokens("") +} + +// GetEc2MetadataHttpTokens returns the value of the 'ec_2_metadata_http_tokens' attribute and +// a flag indicating if the attribute has a value. +// +// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances +func (o *AWSNodePool) GetEc2MetadataHttpTokens() (value Ec2MetadataHttpTokens, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.ec2MetadataHttpTokens + } + return +} + +// InstanceProfile returns the value of the 'instance_profile' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// InstanceProfile is the AWS EC2 instance profile, which is a container for an IAM role that the EC2 instance uses. +func (o *AWSNodePool) InstanceProfile() string { + if o != nil && o.bitmap_&64 != 0 { + return o.instanceProfile + } + return "" +} + +// GetInstanceProfile returns the value of the 'instance_profile' attribute and +// a flag indicating if the attribute has a value. +// +// InstanceProfile is the AWS EC2 instance profile, which is a container for an IAM role that the EC2 instance uses. +func (o *AWSNodePool) GetInstanceProfile() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.instanceProfile + } + return +} + +// InstanceType returns the value of the 'instance_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// InstanceType is an ec2 instance type for node instances (e.g. m5.large). +func (o *AWSNodePool) InstanceType() string { + if o != nil && o.bitmap_&128 != 0 { + return o.instanceType + } + return "" +} + +// GetInstanceType returns the value of the 'instance_type' attribute and +// a flag indicating if the attribute has a value. +// +// InstanceType is an ec2 instance type for node instances (e.g. m5.large). +func (o *AWSNodePool) GetInstanceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.instanceType + } + return +} + +// RootVolume returns the value of the 'root_volume' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS Volume specification to be used to set custom worker disk size +func (o *AWSNodePool) RootVolume() *AWSVolume { + if o != nil && o.bitmap_&256 != 0 { + return o.rootVolume + } + return nil +} + +// GetRootVolume returns the value of the 'root_volume' attribute and +// a flag indicating if the attribute has a value. +// +// AWS Volume specification to be used to set custom worker disk size +func (o *AWSNodePool) GetRootVolume() (value *AWSVolume, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.rootVolume + } + return +} + +// SubnetOutposts returns the value of the 'subnet_outposts' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Associates nodepool subnets with AWS Outposts. +func (o *AWSNodePool) SubnetOutposts() map[string]string { + if o != nil && o.bitmap_&512 != 0 { + return o.subnetOutposts + } + return nil +} + +// GetSubnetOutposts returns the value of the 'subnet_outposts' attribute and +// a flag indicating if the attribute has a value. +// +// Associates nodepool subnets with AWS Outposts. +func (o *AWSNodePool) GetSubnetOutposts() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.subnetOutposts + } + return +} + +// Tags returns the value of the 'tags' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional keys and values that the installer will add as tags to all AWS resources it creates. +// +// AWS tags must conform to the following standards: +// - Each resource may have a maximum of 25 tags +// - Tags beginning with "aws:" are reserved for system use and may not be set +// - Tag keys may be between 1 and 128 characters in length +// - Tag values may be between 0 and 256 characters in length +// - Tags may only contain letters, numbers, spaces, and the following characters: [_ . : / = + - @] +func (o *AWSNodePool) Tags() map[string]string { + if o != nil && o.bitmap_&1024 != 0 { + return o.tags + } + return nil +} + +// GetTags returns the value of the 'tags' attribute and +// a flag indicating if the attribute has a value. +// +// Optional keys and values that the installer will add as tags to all AWS resources it creates. +// +// AWS tags must conform to the following standards: +// - Each resource may have a maximum of 25 tags +// - Tags beginning with "aws:" are reserved for system use and may not be set +// - Tag keys may be between 1 and 128 characters in length +// - Tag values may be between 0 and 256 characters in length +// - Tags may only contain letters, numbers, spaces, and the following characters: [_ . : / = + - @] +func (o *AWSNodePool) GetTags() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.tags + } + return +} + +// AWSNodePoolListKind is the name of the type used to represent list of objects of +// type 'AWS_node_pool'. +const AWSNodePoolListKind = "AWSNodePoolList" + +// AWSNodePoolListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS_node_pool'. +const AWSNodePoolListLinkKind = "AWSNodePoolListLink" + +// AWSNodePoolNilKind is the name of the type used to nil lists of objects of +// type 'AWS_node_pool'. +const AWSNodePoolListNilKind = "AWSNodePoolListNil" + +// AWSNodePoolList is a list of values of the 'AWS_node_pool' type. +type AWSNodePoolList struct { + href string + link bool + items []*AWSNodePool +} + +// Kind returns the name of the type of the object. +func (l *AWSNodePoolList) Kind() string { + if l == nil { + return AWSNodePoolListNilKind + } + if l.link { + return AWSNodePoolListLinkKind + } + return AWSNodePoolListKind +} + +// Link returns true iif this is a link. +func (l *AWSNodePoolList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AWSNodePoolList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AWSNodePoolList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AWSNodePoolList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSNodePoolList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSNodePoolList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSNodePoolList) SetItems(items []*AWSNodePool) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSNodePoolList) Items() []*AWSNodePool { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSNodePoolList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSNodePoolList) Get(i int) *AWSNodePool { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSNodePoolList) Slice() []*AWSNodePool { + var slice []*AWSNodePool + if l == nil { + slice = make([]*AWSNodePool, 0) + } else { + slice = make([]*AWSNodePool, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSNodePoolList) Each(f func(item *AWSNodePool) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSNodePoolList) Range(f func(index int, item *AWSNodePool) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/aws_node_pool_type_json.go b/clientapi/arohcp/v1alpha1/aws_node_pool_type_json.go new file mode 100644 index 00000000..dc55e296 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_node_pool_type_json.go @@ -0,0 +1,297 @@ +/* +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" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSNodePool writes a value of the 'AWS_node_pool' type to the given writer. +func MarshalAWSNodePool(object *AWSNodePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSNodePool(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSNodePool writes a value of the 'AWS_node_pool' type to the given stream. +func WriteAWSNodePool(object *AWSNodePool, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AWSNodePoolLinkKind) + } else { + stream.WriteString(AWSNodePoolKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.additionalSecurityGroupIds != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_security_group_ids") + WriteStringList(object.additionalSecurityGroupIds, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.availabilityZoneTypes != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zone_types") + if object.availabilityZoneTypes != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.availabilityZoneTypes)) + i := 0 + for key := range object.availabilityZoneTypes { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.availabilityZoneTypes[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ec2_metadata_http_tokens") + stream.WriteString(string(object.ec2MetadataHttpTokens)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("instance_profile") + stream.WriteString(object.instanceProfile) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("instance_type") + stream.WriteString(object.instanceType) + count++ + } + present_ = object.bitmap_&256 != 0 && object.rootVolume != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("root_volume") + WriteAWSVolume(object.rootVolume, stream) + count++ + } + present_ = object.bitmap_&512 != 0 && object.subnetOutposts != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnet_outposts") + if object.subnetOutposts != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.subnetOutposts)) + i := 0 + for key := range object.subnetOutposts { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.subnetOutposts[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&1024 != 0 && object.tags != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("tags") + if object.tags != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.tags)) + i := 0 + for key := range object.tags { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.tags[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSNodePool reads a value of the 'AWS_node_pool' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSNodePool(source interface{}) (object *AWSNodePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSNodePool(iterator) + err = iterator.Error + return +} + +// ReadAWSNodePool reads a value of the 'AWS_node_pool' type from the given iterator. +func ReadAWSNodePool(iterator *jsoniter.Iterator) *AWSNodePool { + object := &AWSNodePool{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AWSNodePoolLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "additional_security_group_ids": + value := ReadStringList(iterator) + object.additionalSecurityGroupIds = value + object.bitmap_ |= 8 + case "availability_zone_types": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.availabilityZoneTypes = value + object.bitmap_ |= 16 + case "ec2_metadata_http_tokens": + text := iterator.ReadString() + value := Ec2MetadataHttpTokens(text) + object.ec2MetadataHttpTokens = value + object.bitmap_ |= 32 + case "instance_profile": + value := iterator.ReadString() + object.instanceProfile = value + object.bitmap_ |= 64 + case "instance_type": + value := iterator.ReadString() + object.instanceType = value + object.bitmap_ |= 128 + case "root_volume": + value := ReadAWSVolume(iterator) + object.rootVolume = value + object.bitmap_ |= 256 + case "subnet_outposts": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.subnetOutposts = value + object.bitmap_ |= 512 + case "tags": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.tags = value + object.bitmap_ |= 1024 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/aws_shard_builder.go b/clientapi/arohcp/v1alpha1/aws_shard_builder.go new file mode 100644 index 00000000..cc351ea8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_shard_builder.go @@ -0,0 +1,72 @@ +/* +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 + +// AWSShardBuilder contains the data and logic needed to build 'AWS_shard' objects. +// +// Config for AWS provision shards +type AWSShardBuilder struct { + bitmap_ uint32 + ecrRepositoryURLs []string +} + +// NewAWSShard creates a new builder of 'AWS_shard' objects. +func NewAWSShard() *AWSShardBuilder { + return &AWSShardBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSShardBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ECRRepositoryURLs sets the value of the 'ECR_repository_URLs' attribute to the given values. +func (b *AWSShardBuilder) ECRRepositoryURLs(values ...string) *AWSShardBuilder { + b.ecrRepositoryURLs = make([]string, len(values)) + copy(b.ecrRepositoryURLs, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSShardBuilder) Copy(object *AWSShard) *AWSShardBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.ecrRepositoryURLs != nil { + b.ecrRepositoryURLs = make([]string, len(object.ecrRepositoryURLs)) + copy(b.ecrRepositoryURLs, object.ecrRepositoryURLs) + } else { + b.ecrRepositoryURLs = nil + } + return b +} + +// Build creates a 'AWS_shard' object using the configuration stored in the builder. +func (b *AWSShardBuilder) Build() (object *AWSShard, err error) { + object = new(AWSShard) + object.bitmap_ = b.bitmap_ + if b.ecrRepositoryURLs != nil { + object.ecrRepositoryURLs = make([]string, len(b.ecrRepositoryURLs)) + copy(object.ecrRepositoryURLs, b.ecrRepositoryURLs) + } + return +} diff --git a/clientapi/arohcp/v1alpha1/aws_shard_list_builder.go b/clientapi/arohcp/v1alpha1/aws_shard_list_builder.go new file mode 100644 index 00000000..51c6fb6f --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_shard_list_builder.go @@ -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 + +// AWSShardListBuilder contains the data and logic needed to build +// 'AWS_shard' objects. +type AWSShardListBuilder struct { + items []*AWSShardBuilder +} + +// NewAWSShardList creates a new builder of 'AWS_shard' objects. +func NewAWSShardList() *AWSShardListBuilder { + return new(AWSShardListBuilder) +} + +// Items sets the items of the list. +func (b *AWSShardListBuilder) Items(values ...*AWSShardBuilder) *AWSShardListBuilder { + b.items = make([]*AWSShardBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSShardListBuilder) 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 *AWSShardListBuilder) Copy(list *AWSShardList) *AWSShardListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSShardBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSShard().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS_shard' objects using the +// configuration stored in the builder. +func (b *AWSShardListBuilder) Build() (list *AWSShardList, err error) { + items := make([]*AWSShard, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSShardList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/aws_shard_list_type_json.go b/clientapi/arohcp/v1alpha1/aws_shard_list_type_json.go new file mode 100644 index 00000000..f73ebfc8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_shard_list_type_json.go @@ -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" +) + +// MarshalAWSShardList writes a list of values of the 'AWS_shard' type to +// the given writer. +func MarshalAWSShardList(list []*AWSShard, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSShardList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSShardList writes a list of value of the 'AWS_shard' type to +// the given stream. +func WriteAWSShardList(list []*AWSShard, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSShard(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSShardList reads a list of values of the 'AWS_shard' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSShardList(source interface{}) (items []*AWSShard, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSShardList(iterator) + err = iterator.Error + return +} + +// ReadAWSShardList reads list of values of the ”AWS_shard' type from +// the given iterator. +func ReadAWSShardList(iterator *jsoniter.Iterator) []*AWSShard { + list := []*AWSShard{} + for iterator.ReadArray() { + item := ReadAWSShard(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/aws_shard_type.go b/clientapi/arohcp/v1alpha1/aws_shard_type.go new file mode 100644 index 00000000..5427cdd7 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_shard_type.go @@ -0,0 +1,165 @@ +/* +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 + +// AWSShard represents the values of the 'AWS_shard' type. +// +// Config for AWS provision shards +type AWSShard struct { + bitmap_ uint32 + ecrRepositoryURLs []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSShard) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ECRRepositoryURLs returns the value of the 'ECR_repository_URLs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ECR repository URLs of the provision shard +func (o *AWSShard) ECRRepositoryURLs() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.ecrRepositoryURLs + } + return nil +} + +// GetECRRepositoryURLs returns the value of the 'ECR_repository_URLs' attribute and +// a flag indicating if the attribute has a value. +// +// ECR repository URLs of the provision shard +func (o *AWSShard) GetECRRepositoryURLs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.ecrRepositoryURLs + } + return +} + +// AWSShardListKind is the name of the type used to represent list of objects of +// type 'AWS_shard'. +const AWSShardListKind = "AWSShardList" + +// AWSShardListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS_shard'. +const AWSShardListLinkKind = "AWSShardListLink" + +// AWSShardNilKind is the name of the type used to nil lists of objects of +// type 'AWS_shard'. +const AWSShardListNilKind = "AWSShardListNil" + +// AWSShardList is a list of values of the 'AWS_shard' type. +type AWSShardList struct { + href string + link bool + items []*AWSShard +} + +// Len returns the length of the list. +func (l *AWSShardList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSShardList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSShardList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSShardList) SetItems(items []*AWSShard) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSShardList) Items() []*AWSShard { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSShardList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSShardList) Get(i int) *AWSShard { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSShardList) Slice() []*AWSShard { + var slice []*AWSShard + if l == nil { + slice = make([]*AWSShard, 0) + } else { + slice = make([]*AWSShard, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSShardList) Each(f func(item *AWSShard) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSShardList) Range(f func(index int, item *AWSShard) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/aws_shard_type_json.go b/clientapi/arohcp/v1alpha1/aws_shard_type_json.go new file mode 100644 index 00000000..5496c468 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_shard_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalAWSShard writes a value of the 'AWS_shard' type to the given writer. +func MarshalAWSShard(object *AWSShard, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSShard(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSShard writes a value of the 'AWS_shard' type to the given stream. +func WriteAWSShard(object *AWSShard, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.ecrRepositoryURLs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ecr_repository_urls") + WriteStringList(object.ecrRepositoryURLs, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSShard reads a value of the 'AWS_shard' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSShard(source interface{}) (object *AWSShard, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSShard(iterator) + err = iterator.Error + return +} + +// ReadAWSShard reads a value of the 'AWS_shard' type from the given iterator. +func ReadAWSShard(iterator *jsoniter.Iterator) *AWSShard { + object := &AWSShard{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "ecr_repository_urls": + value := ReadStringList(iterator) + object.ecrRepositoryURLs = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/aws_type.go b/clientapi/arohcp/v1alpha1/aws_type.go new file mode 100644 index 00000000..e32c1395 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_type.go @@ -0,0 +1,645 @@ +/* +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 + +// AWS represents the values of the 'AWS' type. +// +// _Amazon Web Services_ specific settings of a cluster. +type AWS struct { + bitmap_ uint32 + kmsKeyArn string + sts *STS + accessKeyID string + accountID string + additionalAllowedPrincipals []string + additionalComputeSecurityGroupIds []string + additionalControlPlaneSecurityGroupIds []string + additionalInfraSecurityGroupIds []string + auditLog *AuditLog + billingAccountID string + ec2MetadataHttpTokens Ec2MetadataHttpTokens + etcdEncryption *AwsEtcdEncryption + hcpInternalCommunicationHostedZoneId string + privateHostedZoneID string + privateHostedZoneRoleARN string + privateLinkConfiguration *PrivateLinkClusterConfiguration + secretAccessKey string + subnetIDs []string + tags map[string]string + vpcEndpointRoleArn string + privateLink bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWS) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// KMSKeyArn returns the value of the 'KMS_key_arn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Customer Managed Key to encrypt EBS Volume +func (o *AWS) KMSKeyArn() string { + if o != nil && o.bitmap_&1 != 0 { + return o.kmsKeyArn + } + return "" +} + +// GetKMSKeyArn returns the value of the 'KMS_key_arn' attribute and +// a flag indicating if the attribute has a value. +// +// Customer Managed Key to encrypt EBS Volume +func (o *AWS) GetKMSKeyArn() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.kmsKeyArn + } + return +} + +// STS returns the value of the 'STS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (o *AWS) STS() *STS { + if o != nil && o.bitmap_&2 != 0 { + return o.sts + } + return nil +} + +// GetSTS returns the value of the 'STS' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (o *AWS) GetSTS() (value *STS, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.sts + } + return +} + +// AccessKeyID returns the value of the 'access_key_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS access key identifier. +func (o *AWS) AccessKeyID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.accessKeyID + } + return "" +} + +// GetAccessKeyID returns the value of the 'access_key_ID' attribute and +// a flag indicating if the attribute has a value. +// +// AWS access key identifier. +func (o *AWS) GetAccessKeyID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.accessKeyID + } + return +} + +// AccountID returns the value of the 'account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS account identifier. +func (o *AWS) AccountID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.accountID + } + return "" +} + +// GetAccountID returns the value of the 'account_ID' attribute and +// a flag indicating if the attribute has a value. +// +// AWS account identifier. +func (o *AWS) GetAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.accountID + } + return +} + +// AdditionalAllowedPrincipals returns the value of the 'additional_allowed_principals' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional allowed principal ARNs to be added to the hosted control plane's VPC Endpoint Service. +func (o *AWS) AdditionalAllowedPrincipals() []string { + if o != nil && o.bitmap_&16 != 0 { + return o.additionalAllowedPrincipals + } + return nil +} + +// GetAdditionalAllowedPrincipals returns the value of the 'additional_allowed_principals' attribute and +// a flag indicating if the attribute has a value. +// +// Additional allowed principal ARNs to be added to the hosted control plane's VPC Endpoint Service. +func (o *AWS) GetAdditionalAllowedPrincipals() (value []string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.additionalAllowedPrincipals + } + return +} + +// AdditionalComputeSecurityGroupIds returns the value of the 'additional_compute_security_group_ids' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional AWS Security Groups to be added to default worker (compute) machine pool. +func (o *AWS) AdditionalComputeSecurityGroupIds() []string { + if o != nil && o.bitmap_&32 != 0 { + return o.additionalComputeSecurityGroupIds + } + return nil +} + +// GetAdditionalComputeSecurityGroupIds returns the value of the 'additional_compute_security_group_ids' attribute and +// a flag indicating if the attribute has a value. +// +// Additional AWS Security Groups to be added to default worker (compute) machine pool. +func (o *AWS) GetAdditionalComputeSecurityGroupIds() (value []string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.additionalComputeSecurityGroupIds + } + return +} + +// AdditionalControlPlaneSecurityGroupIds returns the value of the 'additional_control_plane_security_group_ids' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional AWS Security Groups to be added to default control plane machine pool. +func (o *AWS) AdditionalControlPlaneSecurityGroupIds() []string { + if o != nil && o.bitmap_&64 != 0 { + return o.additionalControlPlaneSecurityGroupIds + } + return nil +} + +// GetAdditionalControlPlaneSecurityGroupIds returns the value of the 'additional_control_plane_security_group_ids' attribute and +// a flag indicating if the attribute has a value. +// +// Additional AWS Security Groups to be added to default control plane machine pool. +func (o *AWS) GetAdditionalControlPlaneSecurityGroupIds() (value []string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.additionalControlPlaneSecurityGroupIds + } + return +} + +// AdditionalInfraSecurityGroupIds returns the value of the 'additional_infra_security_group_ids' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional AWS Security Groups to be added to default infra machine pool. +func (o *AWS) AdditionalInfraSecurityGroupIds() []string { + if o != nil && o.bitmap_&128 != 0 { + return o.additionalInfraSecurityGroupIds + } + return nil +} + +// GetAdditionalInfraSecurityGroupIds returns the value of the 'additional_infra_security_group_ids' attribute and +// a flag indicating if the attribute has a value. +// +// Additional AWS Security Groups to be added to default infra machine pool. +func (o *AWS) GetAdditionalInfraSecurityGroupIds() (value []string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.additionalInfraSecurityGroupIds + } + return +} + +// AuditLog returns the value of the 'audit_log' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Audit log forwarding configuration +func (o *AWS) AuditLog() *AuditLog { + if o != nil && o.bitmap_&256 != 0 { + return o.auditLog + } + return nil +} + +// GetAuditLog returns the value of the 'audit_log' attribute and +// a flag indicating if the attribute has a value. +// +// Audit log forwarding configuration +func (o *AWS) GetAuditLog() (value *AuditLog, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.auditLog + } + return +} + +// BillingAccountID returns the value of the 'billing_account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// BillingAccountID is the account used for billing subscriptions purchased via the marketplace +func (o *AWS) BillingAccountID() string { + if o != nil && o.bitmap_&512 != 0 { + return o.billingAccountID + } + return "" +} + +// GetBillingAccountID returns the value of the 'billing_account_ID' attribute and +// a flag indicating if the attribute has a value. +// +// BillingAccountID is the account used for billing subscriptions purchased via the marketplace +func (o *AWS) GetBillingAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.billingAccountID + } + return +} + +// Ec2MetadataHttpTokens returns the value of the 'ec_2_metadata_http_tokens' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances +func (o *AWS) Ec2MetadataHttpTokens() Ec2MetadataHttpTokens { + if o != nil && o.bitmap_&1024 != 0 { + return o.ec2MetadataHttpTokens + } + return Ec2MetadataHttpTokens("") +} + +// GetEc2MetadataHttpTokens returns the value of the 'ec_2_metadata_http_tokens' attribute and +// a flag indicating if the attribute has a value. +// +// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances +func (o *AWS) GetEc2MetadataHttpTokens() (value Ec2MetadataHttpTokens, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.ec2MetadataHttpTokens + } + return +} + +// EtcdEncryption returns the value of the 'etcd_encryption' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Related etcd encryption configuration +func (o *AWS) EtcdEncryption() *AwsEtcdEncryption { + if o != nil && o.bitmap_&2048 != 0 { + return o.etcdEncryption + } + return nil +} + +// GetEtcdEncryption returns the value of the 'etcd_encryption' attribute and +// a flag indicating if the attribute has a value. +// +// Related etcd encryption configuration +func (o *AWS) GetEtcdEncryption() (value *AwsEtcdEncryption, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.etcdEncryption + } + return +} + +// HcpInternalCommunicationHostedZoneId returns the value of the 'hcp_internal_communication_hosted_zone_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID of local private hosted zone for hypershift internal communication. +func (o *AWS) HcpInternalCommunicationHostedZoneId() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.hcpInternalCommunicationHostedZoneId + } + return "" +} + +// GetHcpInternalCommunicationHostedZoneId returns the value of the 'hcp_internal_communication_hosted_zone_id' attribute and +// a flag indicating if the attribute has a value. +// +// ID of local private hosted zone for hypershift internal communication. +func (o *AWS) GetHcpInternalCommunicationHostedZoneId() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.hcpInternalCommunicationHostedZoneId + } + return +} + +// PrivateHostedZoneID returns the value of the 'private_hosted_zone_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID of private hosted zone. +func (o *AWS) PrivateHostedZoneID() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.privateHostedZoneID + } + return "" +} + +// GetPrivateHostedZoneID returns the value of the 'private_hosted_zone_ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID of private hosted zone. +func (o *AWS) GetPrivateHostedZoneID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.privateHostedZoneID + } + return +} + +// PrivateHostedZoneRoleARN returns the value of the 'private_hosted_zone_role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Role ARN for private hosted zone. +func (o *AWS) PrivateHostedZoneRoleARN() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.privateHostedZoneRoleARN + } + return "" +} + +// GetPrivateHostedZoneRoleARN returns the value of the 'private_hosted_zone_role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// Role ARN for private hosted zone. +func (o *AWS) GetPrivateHostedZoneRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.privateHostedZoneRoleARN + } + return +} + +// PrivateLink returns the value of the 'private_link' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Sets cluster to be inaccessible externally. +func (o *AWS) PrivateLink() bool { + if o != nil && o.bitmap_&32768 != 0 { + return o.privateLink + } + return false +} + +// GetPrivateLink returns the value of the 'private_link' attribute and +// a flag indicating if the attribute has a value. +// +// Sets cluster to be inaccessible externally. +func (o *AWS) GetPrivateLink() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.privateLink + } + return +} + +// PrivateLinkConfiguration returns the value of the 'private_link_configuration' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Manages additional configuration for Private Links. +func (o *AWS) PrivateLinkConfiguration() *PrivateLinkClusterConfiguration { + if o != nil && o.bitmap_&65536 != 0 { + return o.privateLinkConfiguration + } + return nil +} + +// GetPrivateLinkConfiguration returns the value of the 'private_link_configuration' attribute and +// a flag indicating if the attribute has a value. +// +// Manages additional configuration for Private Links. +func (o *AWS) GetPrivateLinkConfiguration() (value *PrivateLinkClusterConfiguration, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.privateLinkConfiguration + } + return +} + +// SecretAccessKey returns the value of the 'secret_access_key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS secret access key. +func (o *AWS) SecretAccessKey() string { + if o != nil && o.bitmap_&131072 != 0 { + return o.secretAccessKey + } + return "" +} + +// GetSecretAccessKey returns the value of the 'secret_access_key' attribute and +// a flag indicating if the attribute has a value. +// +// AWS secret access key. +func (o *AWS) GetSecretAccessKey() (value string, ok bool) { + ok = o != nil && o.bitmap_&131072 != 0 + if ok { + value = o.secretAccessKey + } + return +} + +// SubnetIDs returns the value of the 'subnet_IDs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The subnet ids to be used when installing the cluster. +func (o *AWS) SubnetIDs() []string { + if o != nil && o.bitmap_&262144 != 0 { + return o.subnetIDs + } + return nil +} + +// GetSubnetIDs returns the value of the 'subnet_IDs' attribute and +// a flag indicating if the attribute has a value. +// +// The subnet ids to be used when installing the cluster. +func (o *AWS) GetSubnetIDs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&262144 != 0 + if ok { + value = o.subnetIDs + } + return +} + +// Tags returns the value of the 'tags' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional keys and values that the installer will add as tags to all AWS resources it creates +func (o *AWS) Tags() map[string]string { + if o != nil && o.bitmap_&524288 != 0 { + return o.tags + } + return nil +} + +// GetTags returns the value of the 'tags' attribute and +// a flag indicating if the attribute has a value. +// +// Optional keys and values that the installer will add as tags to all AWS resources it creates +func (o *AWS) GetTags() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&524288 != 0 + if ok { + value = o.tags + } + return +} + +// VpcEndpointRoleArn returns the value of the 'vpc_endpoint_role_arn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Role ARN for VPC Endpoint Service cross account role. +func (o *AWS) VpcEndpointRoleArn() string { + if o != nil && o.bitmap_&1048576 != 0 { + return o.vpcEndpointRoleArn + } + return "" +} + +// GetVpcEndpointRoleArn returns the value of the 'vpc_endpoint_role_arn' attribute and +// a flag indicating if the attribute has a value. +// +// Role ARN for VPC Endpoint Service cross account role. +func (o *AWS) GetVpcEndpointRoleArn() (value string, ok bool) { + ok = o != nil && o.bitmap_&1048576 != 0 + if ok { + value = o.vpcEndpointRoleArn + } + return +} + +// AWSListKind is the name of the type used to represent list of objects of +// type 'AWS'. +const AWSListKind = "AWSList" + +// AWSListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS'. +const AWSListLinkKind = "AWSListLink" + +// AWSNilKind is the name of the type used to nil lists of objects of +// type 'AWS'. +const AWSListNilKind = "AWSListNil" + +// AWSList is a list of values of the 'AWS' type. +type AWSList struct { + href string + link bool + items []*AWS +} + +// Len returns the length of the list. +func (l *AWSList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSList) SetItems(items []*AWS) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSList) Items() []*AWS { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSList) Get(i int) *AWS { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSList) Slice() []*AWS { + var slice []*AWS + if l == nil { + slice = make([]*AWS, 0) + } else { + slice = make([]*AWS, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSList) Each(f func(item *AWS) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSList) Range(f func(index int, item *AWS) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/aws_type_json.go b/clientapi/arohcp/v1alpha1/aws_type_json.go new file mode 100644 index 00000000..0531a1c5 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_type_json.go @@ -0,0 +1,376 @@ +/* +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" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWS writes a value of the 'AWS' type to the given writer. +func MarshalAWS(object *AWS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWS(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWS writes a value of the 'AWS' type to the given stream. +func WriteAWS(object *AWS, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kms_key_arn") + stream.WriteString(object.kmsKeyArn) + count++ + } + present_ = object.bitmap_&2 != 0 && object.sts != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sts") + WriteSTS(object.sts, stream) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("access_key_id") + stream.WriteString(object.accessKeyID) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_id") + stream.WriteString(object.accountID) + count++ + } + present_ = object.bitmap_&16 != 0 && object.additionalAllowedPrincipals != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_allowed_principals") + WriteStringList(object.additionalAllowedPrincipals, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.additionalComputeSecurityGroupIds != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_compute_security_group_ids") + WriteStringList(object.additionalComputeSecurityGroupIds, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.additionalControlPlaneSecurityGroupIds != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_control_plane_security_group_ids") + WriteStringList(object.additionalControlPlaneSecurityGroupIds, stream) + count++ + } + present_ = object.bitmap_&128 != 0 && object.additionalInfraSecurityGroupIds != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_infra_security_group_ids") + WriteStringList(object.additionalInfraSecurityGroupIds, stream) + count++ + } + present_ = object.bitmap_&256 != 0 && object.auditLog != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("audit_log") + WriteAuditLog(object.auditLog, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_account_id") + stream.WriteString(object.billingAccountID) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ec2_metadata_http_tokens") + stream.WriteString(string(object.ec2MetadataHttpTokens)) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.etcdEncryption != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("etcd_encryption") + WriteAwsEtcdEncryption(object.etcdEncryption, stream) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hcp_internal_communication_hosted_zone_id") + stream.WriteString(object.hcpInternalCommunicationHostedZoneId) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_hosted_zone_id") + stream.WriteString(object.privateHostedZoneID) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_hosted_zone_role_arn") + stream.WriteString(object.privateHostedZoneRoleARN) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_link") + stream.WriteBool(object.privateLink) + count++ + } + present_ = object.bitmap_&65536 != 0 && object.privateLinkConfiguration != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_link_configuration") + WritePrivateLinkClusterConfiguration(object.privateLinkConfiguration, stream) + count++ + } + present_ = object.bitmap_&131072 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("secret_access_key") + stream.WriteString(object.secretAccessKey) + count++ + } + present_ = object.bitmap_&262144 != 0 && object.subnetIDs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnet_ids") + WriteStringList(object.subnetIDs, stream) + count++ + } + present_ = object.bitmap_&524288 != 0 && object.tags != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("tags") + if object.tags != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.tags)) + i := 0 + for key := range object.tags { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.tags[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&1048576 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("vpc_endpoint_role_arn") + stream.WriteString(object.vpcEndpointRoleArn) + } + stream.WriteObjectEnd() +} + +// UnmarshalAWS reads a value of the 'AWS' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWS(source interface{}) (object *AWS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWS(iterator) + err = iterator.Error + return +} + +// ReadAWS reads a value of the 'AWS' type from the given iterator. +func ReadAWS(iterator *jsoniter.Iterator) *AWS { + object := &AWS{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kms_key_arn": + value := iterator.ReadString() + object.kmsKeyArn = value + object.bitmap_ |= 1 + case "sts": + value := ReadSTS(iterator) + object.sts = value + object.bitmap_ |= 2 + case "access_key_id": + value := iterator.ReadString() + object.accessKeyID = value + object.bitmap_ |= 4 + case "account_id": + value := iterator.ReadString() + object.accountID = value + object.bitmap_ |= 8 + case "additional_allowed_principals": + value := ReadStringList(iterator) + object.additionalAllowedPrincipals = value + object.bitmap_ |= 16 + case "additional_compute_security_group_ids": + value := ReadStringList(iterator) + object.additionalComputeSecurityGroupIds = value + object.bitmap_ |= 32 + case "additional_control_plane_security_group_ids": + value := ReadStringList(iterator) + object.additionalControlPlaneSecurityGroupIds = value + object.bitmap_ |= 64 + case "additional_infra_security_group_ids": + value := ReadStringList(iterator) + object.additionalInfraSecurityGroupIds = value + object.bitmap_ |= 128 + case "audit_log": + value := ReadAuditLog(iterator) + object.auditLog = value + object.bitmap_ |= 256 + case "billing_account_id": + value := iterator.ReadString() + object.billingAccountID = value + object.bitmap_ |= 512 + case "ec2_metadata_http_tokens": + text := iterator.ReadString() + value := Ec2MetadataHttpTokens(text) + object.ec2MetadataHttpTokens = value + object.bitmap_ |= 1024 + case "etcd_encryption": + value := ReadAwsEtcdEncryption(iterator) + object.etcdEncryption = value + object.bitmap_ |= 2048 + case "hcp_internal_communication_hosted_zone_id": + value := iterator.ReadString() + object.hcpInternalCommunicationHostedZoneId = value + object.bitmap_ |= 4096 + case "private_hosted_zone_id": + value := iterator.ReadString() + object.privateHostedZoneID = value + object.bitmap_ |= 8192 + case "private_hosted_zone_role_arn": + value := iterator.ReadString() + object.privateHostedZoneRoleARN = value + object.bitmap_ |= 16384 + case "private_link": + value := iterator.ReadBool() + object.privateLink = value + object.bitmap_ |= 32768 + case "private_link_configuration": + value := ReadPrivateLinkClusterConfiguration(iterator) + object.privateLinkConfiguration = value + object.bitmap_ |= 65536 + case "secret_access_key": + value := iterator.ReadString() + object.secretAccessKey = value + object.bitmap_ |= 131072 + case "subnet_ids": + value := ReadStringList(iterator) + object.subnetIDs = value + object.bitmap_ |= 262144 + case "tags": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.tags = value + object.bitmap_ |= 524288 + case "vpc_endpoint_role_arn": + value := iterator.ReadString() + object.vpcEndpointRoleArn = value + object.bitmap_ |= 1048576 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/aws_volume_builder.go b/clientapi/arohcp/v1alpha1/aws_volume_builder.go new file mode 100644 index 00000000..f1a912cd --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_volume_builder.go @@ -0,0 +1,73 @@ +/* +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 + +// AWSVolumeBuilder contains the data and logic needed to build 'AWS_volume' objects. +// +// Holds settings for an AWS storage volume. +type AWSVolumeBuilder struct { + bitmap_ uint32 + iops int + size int +} + +// NewAWSVolume creates a new builder of 'AWS_volume' objects. +func NewAWSVolume() *AWSVolumeBuilder { + return &AWSVolumeBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSVolumeBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// IOPS sets the value of the 'IOPS' attribute to the given value. +func (b *AWSVolumeBuilder) IOPS(value int) *AWSVolumeBuilder { + b.iops = value + b.bitmap_ |= 1 + return b +} + +// Size sets the value of the 'size' attribute to the given value. +func (b *AWSVolumeBuilder) Size(value int) *AWSVolumeBuilder { + b.size = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSVolumeBuilder) Copy(object *AWSVolume) *AWSVolumeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.iops = object.iops + b.size = object.size + return b +} + +// Build creates a 'AWS_volume' object using the configuration stored in the builder. +func (b *AWSVolumeBuilder) Build() (object *AWSVolume, err error) { + object = new(AWSVolume) + object.bitmap_ = b.bitmap_ + object.iops = b.iops + object.size = b.size + return +} diff --git a/clientapi/arohcp/v1alpha1/aws_volume_list_builder.go b/clientapi/arohcp/v1alpha1/aws_volume_list_builder.go new file mode 100644 index 00000000..1b9c1f69 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_volume_list_builder.go @@ -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 + +// AWSVolumeListBuilder contains the data and logic needed to build +// 'AWS_volume' objects. +type AWSVolumeListBuilder struct { + items []*AWSVolumeBuilder +} + +// NewAWSVolumeList creates a new builder of 'AWS_volume' objects. +func NewAWSVolumeList() *AWSVolumeListBuilder { + return new(AWSVolumeListBuilder) +} + +// Items sets the items of the list. +func (b *AWSVolumeListBuilder) Items(values ...*AWSVolumeBuilder) *AWSVolumeListBuilder { + b.items = make([]*AWSVolumeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSVolumeListBuilder) 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 *AWSVolumeListBuilder) Copy(list *AWSVolumeList) *AWSVolumeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSVolumeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSVolume().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS_volume' objects using the +// configuration stored in the builder. +func (b *AWSVolumeListBuilder) Build() (list *AWSVolumeList, err error) { + items := make([]*AWSVolume, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSVolumeList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/aws_volume_list_type_json.go b/clientapi/arohcp/v1alpha1/aws_volume_list_type_json.go new file mode 100644 index 00000000..18a6e267 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_volume_list_type_json.go @@ -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" +) + +// MarshalAWSVolumeList writes a list of values of the 'AWS_volume' type to +// the given writer. +func MarshalAWSVolumeList(list []*AWSVolume, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSVolumeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSVolumeList writes a list of value of the 'AWS_volume' type to +// the given stream. +func WriteAWSVolumeList(list []*AWSVolume, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSVolume(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSVolumeList reads a list of values of the 'AWS_volume' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSVolumeList(source interface{}) (items []*AWSVolume, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSVolumeList(iterator) + err = iterator.Error + return +} + +// ReadAWSVolumeList reads list of values of the ”AWS_volume' type from +// the given iterator. +func ReadAWSVolumeList(iterator *jsoniter.Iterator) []*AWSVolume { + list := []*AWSVolume{} + for iterator.ReadArray() { + item := ReadAWSVolume(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/aws_volume_type.go b/clientapi/arohcp/v1alpha1/aws_volume_type.go new file mode 100644 index 00000000..d8a2afd4 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_volume_type.go @@ -0,0 +1,189 @@ +/* +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 + +// AWSVolume represents the values of the 'AWS_volume' type. +// +// Holds settings for an AWS storage volume. +type AWSVolume struct { + bitmap_ uint32 + iops int + size int +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSVolume) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// IOPS returns the value of the 'IOPS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Volume provisioned IOPS. +func (o *AWSVolume) IOPS() int { + if o != nil && o.bitmap_&1 != 0 { + return o.iops + } + return 0 +} + +// GetIOPS returns the value of the 'IOPS' attribute and +// a flag indicating if the attribute has a value. +// +// Volume provisioned IOPS. +func (o *AWSVolume) GetIOPS() (value int, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.iops + } + return +} + +// Size returns the value of the 'size' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Volume size in Gib. +func (o *AWSVolume) Size() int { + if o != nil && o.bitmap_&2 != 0 { + return o.size + } + return 0 +} + +// GetSize returns the value of the 'size' attribute and +// a flag indicating if the attribute has a value. +// +// Volume size in Gib. +func (o *AWSVolume) GetSize() (value int, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.size + } + return +} + +// AWSVolumeListKind is the name of the type used to represent list of objects of +// type 'AWS_volume'. +const AWSVolumeListKind = "AWSVolumeList" + +// AWSVolumeListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS_volume'. +const AWSVolumeListLinkKind = "AWSVolumeListLink" + +// AWSVolumeNilKind is the name of the type used to nil lists of objects of +// type 'AWS_volume'. +const AWSVolumeListNilKind = "AWSVolumeListNil" + +// AWSVolumeList is a list of values of the 'AWS_volume' type. +type AWSVolumeList struct { + href string + link bool + items []*AWSVolume +} + +// Len returns the length of the list. +func (l *AWSVolumeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSVolumeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSVolumeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSVolumeList) SetItems(items []*AWSVolume) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSVolumeList) Items() []*AWSVolume { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSVolumeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSVolumeList) Get(i int) *AWSVolume { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSVolumeList) Slice() []*AWSVolume { + var slice []*AWSVolume + if l == nil { + slice = make([]*AWSVolume, 0) + } else { + slice = make([]*AWSVolume, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSVolumeList) Each(f func(item *AWSVolume) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSVolumeList) Range(f func(index int, item *AWSVolume) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/aws_volume_type_json.go b/clientapi/arohcp/v1alpha1/aws_volume_type_json.go new file mode 100644 index 00000000..ee197173 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/aws_volume_type_json.go @@ -0,0 +1,99 @@ +/* +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" +) + +// MarshalAWSVolume writes a value of the 'AWS_volume' type to the given writer. +func MarshalAWSVolume(object *AWSVolume, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSVolume(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSVolume writes a value of the 'AWS_volume' type to the given stream. +func WriteAWSVolume(object *AWSVolume, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("iops") + stream.WriteInt(object.iops) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("size") + stream.WriteInt(object.size) + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSVolume reads a value of the 'AWS_volume' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSVolume(source interface{}) (object *AWSVolume, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSVolume(iterator) + err = iterator.Error + return +} + +// ReadAWSVolume reads a value of the 'AWS_volume' type from the given iterator. +func ReadAWSVolume(iterator *jsoniter.Iterator) *AWSVolume { + object := &AWSVolume{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "iops": + value := iterator.ReadInt() + object.iops = value + object.bitmap_ |= 1 + case "size": + value := iterator.ReadInt() + object.size = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/azure_builder.go b/clientapi/arohcp/v1alpha1/azure_builder.go new file mode 100644 index 00000000..8dbc9920 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_builder.go @@ -0,0 +1,174 @@ +/* +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 + +// AzureBuilder contains the data and logic needed to build 'azure' objects. +// +// Microsoft Azure settings of a cluster. +type AzureBuilder struct { + bitmap_ uint32 + managedResourceGroupName string + networkSecurityGroupResourceID string + nodesOutboundConnectivity *AzureNodesOutboundConnectivityBuilder + operatorsAuthentication *AzureOperatorsAuthenticationBuilder + resourceGroupName string + resourceName string + subnetResourceID string + subscriptionID string + tenantID string +} + +// NewAzure creates a new builder of 'azure' objects. +func NewAzure() *AzureBuilder { + return &AzureBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ManagedResourceGroupName sets the value of the 'managed_resource_group_name' attribute to the given value. +func (b *AzureBuilder) ManagedResourceGroupName(value string) *AzureBuilder { + b.managedResourceGroupName = value + b.bitmap_ |= 1 + return b +} + +// NetworkSecurityGroupResourceID sets the value of the 'network_security_group_resource_ID' attribute to the given value. +func (b *AzureBuilder) NetworkSecurityGroupResourceID(value string) *AzureBuilder { + b.networkSecurityGroupResourceID = value + b.bitmap_ |= 2 + return b +} + +// NodesOutboundConnectivity sets the value of the 'nodes_outbound_connectivity' attribute to the given value. +// +// The configuration of the node outbound connectivity +func (b *AzureBuilder) NodesOutboundConnectivity(value *AzureNodesOutboundConnectivityBuilder) *AzureBuilder { + b.nodesOutboundConnectivity = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// OperatorsAuthentication sets the value of the 'operators_authentication' attribute to the given value. +// +// The configuration that the operators of the +// cluster have to authenticate to Azure. +func (b *AzureBuilder) OperatorsAuthentication(value *AzureOperatorsAuthenticationBuilder) *AzureBuilder { + b.operatorsAuthentication = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// ResourceGroupName sets the value of the 'resource_group_name' attribute to the given value. +func (b *AzureBuilder) ResourceGroupName(value string) *AzureBuilder { + b.resourceGroupName = value + b.bitmap_ |= 16 + return b +} + +// ResourceName sets the value of the 'resource_name' attribute to the given value. +func (b *AzureBuilder) ResourceName(value string) *AzureBuilder { + b.resourceName = value + b.bitmap_ |= 32 + return b +} + +// SubnetResourceID sets the value of the 'subnet_resource_ID' attribute to the given value. +func (b *AzureBuilder) SubnetResourceID(value string) *AzureBuilder { + b.subnetResourceID = value + b.bitmap_ |= 64 + return b +} + +// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value. +func (b *AzureBuilder) SubscriptionID(value string) *AzureBuilder { + b.subscriptionID = value + b.bitmap_ |= 128 + return b +} + +// TenantID sets the value of the 'tenant_ID' attribute to the given value. +func (b *AzureBuilder) TenantID(value string) *AzureBuilder { + b.tenantID = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureBuilder) Copy(object *Azure) *AzureBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.managedResourceGroupName = object.managedResourceGroupName + b.networkSecurityGroupResourceID = object.networkSecurityGroupResourceID + if object.nodesOutboundConnectivity != nil { + b.nodesOutboundConnectivity = NewAzureNodesOutboundConnectivity().Copy(object.nodesOutboundConnectivity) + } else { + b.nodesOutboundConnectivity = nil + } + if object.operatorsAuthentication != nil { + b.operatorsAuthentication = NewAzureOperatorsAuthentication().Copy(object.operatorsAuthentication) + } else { + b.operatorsAuthentication = nil + } + b.resourceGroupName = object.resourceGroupName + b.resourceName = object.resourceName + b.subnetResourceID = object.subnetResourceID + b.subscriptionID = object.subscriptionID + b.tenantID = object.tenantID + return b +} + +// Build creates a 'azure' object using the configuration stored in the builder. +func (b *AzureBuilder) Build() (object *Azure, err error) { + object = new(Azure) + object.bitmap_ = b.bitmap_ + object.managedResourceGroupName = b.managedResourceGroupName + object.networkSecurityGroupResourceID = b.networkSecurityGroupResourceID + if b.nodesOutboundConnectivity != nil { + object.nodesOutboundConnectivity, err = b.nodesOutboundConnectivity.Build() + if err != nil { + return + } + } + if b.operatorsAuthentication != nil { + object.operatorsAuthentication, err = b.operatorsAuthentication.Build() + if err != nil { + return + } + } + object.resourceGroupName = b.resourceGroupName + object.resourceName = b.resourceName + object.subnetResourceID = b.subnetResourceID + object.subscriptionID = b.subscriptionID + object.tenantID = b.tenantID + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_builder.go b/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_builder.go new file mode 100644 index 00000000..f5428278 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_builder.go @@ -0,0 +1,84 @@ +/* +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 + +// AzureControlPlaneManagedIdentityBuilder contains the data and logic needed to build 'azure_control_plane_managed_identity' objects. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity belonging to the Control Plane of the cluster. +type AzureControlPlaneManagedIdentityBuilder struct { + bitmap_ uint32 + clientID string + principalID string + resourceID string +} + +// NewAzureControlPlaneManagedIdentity creates a new builder of 'azure_control_plane_managed_identity' objects. +func NewAzureControlPlaneManagedIdentity() *AzureControlPlaneManagedIdentityBuilder { + return &AzureControlPlaneManagedIdentityBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureControlPlaneManagedIdentityBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ClientID sets the value of the 'client_ID' attribute to the given value. +func (b *AzureControlPlaneManagedIdentityBuilder) ClientID(value string) *AzureControlPlaneManagedIdentityBuilder { + b.clientID = value + b.bitmap_ |= 1 + return b +} + +// PrincipalID sets the value of the 'principal_ID' attribute to the given value. +func (b *AzureControlPlaneManagedIdentityBuilder) PrincipalID(value string) *AzureControlPlaneManagedIdentityBuilder { + b.principalID = value + b.bitmap_ |= 2 + return b +} + +// ResourceID sets the value of the 'resource_ID' attribute to the given value. +func (b *AzureControlPlaneManagedIdentityBuilder) ResourceID(value string) *AzureControlPlaneManagedIdentityBuilder { + b.resourceID = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureControlPlaneManagedIdentityBuilder) Copy(object *AzureControlPlaneManagedIdentity) *AzureControlPlaneManagedIdentityBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.clientID = object.clientID + b.principalID = object.principalID + b.resourceID = object.resourceID + return b +} + +// Build creates a 'azure_control_plane_managed_identity' object using the configuration stored in the builder. +func (b *AzureControlPlaneManagedIdentityBuilder) Build() (object *AzureControlPlaneManagedIdentity, err error) { + object = new(AzureControlPlaneManagedIdentity) + object.bitmap_ = b.bitmap_ + object.clientID = b.clientID + object.principalID = b.principalID + object.resourceID = b.resourceID + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_list_builder.go b/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_list_builder.go new file mode 100644 index 00000000..256222d9 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_list_builder.go @@ -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 + +// AzureControlPlaneManagedIdentityListBuilder contains the data and logic needed to build +// 'azure_control_plane_managed_identity' objects. +type AzureControlPlaneManagedIdentityListBuilder struct { + items []*AzureControlPlaneManagedIdentityBuilder +} + +// NewAzureControlPlaneManagedIdentityList creates a new builder of 'azure_control_plane_managed_identity' objects. +func NewAzureControlPlaneManagedIdentityList() *AzureControlPlaneManagedIdentityListBuilder { + return new(AzureControlPlaneManagedIdentityListBuilder) +} + +// Items sets the items of the list. +func (b *AzureControlPlaneManagedIdentityListBuilder) Items(values ...*AzureControlPlaneManagedIdentityBuilder) *AzureControlPlaneManagedIdentityListBuilder { + b.items = make([]*AzureControlPlaneManagedIdentityBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureControlPlaneManagedIdentityListBuilder) 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 *AzureControlPlaneManagedIdentityListBuilder) Copy(list *AzureControlPlaneManagedIdentityList) *AzureControlPlaneManagedIdentityListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureControlPlaneManagedIdentityBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureControlPlaneManagedIdentity().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_control_plane_managed_identity' objects using the +// configuration stored in the builder. +func (b *AzureControlPlaneManagedIdentityListBuilder) Build() (list *AzureControlPlaneManagedIdentityList, err error) { + items := make([]*AzureControlPlaneManagedIdentity, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureControlPlaneManagedIdentityList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_list_type_json.go b/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_list_type_json.go new file mode 100644 index 00000000..a0f46754 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_list_type_json.go @@ -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" +) + +// MarshalAzureControlPlaneManagedIdentityList writes a list of values of the 'azure_control_plane_managed_identity' type to +// the given writer. +func MarshalAzureControlPlaneManagedIdentityList(list []*AzureControlPlaneManagedIdentity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureControlPlaneManagedIdentityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureControlPlaneManagedIdentityList writes a list of value of the 'azure_control_plane_managed_identity' type to +// the given stream. +func WriteAzureControlPlaneManagedIdentityList(list []*AzureControlPlaneManagedIdentity, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureControlPlaneManagedIdentity(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureControlPlaneManagedIdentityList reads a list of values of the 'azure_control_plane_managed_identity' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureControlPlaneManagedIdentityList(source interface{}) (items []*AzureControlPlaneManagedIdentity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureControlPlaneManagedIdentityList(iterator) + err = iterator.Error + return +} + +// ReadAzureControlPlaneManagedIdentityList reads list of values of the ”azure_control_plane_managed_identity' type from +// the given iterator. +func ReadAzureControlPlaneManagedIdentityList(iterator *jsoniter.Iterator) []*AzureControlPlaneManagedIdentity { + list := []*AzureControlPlaneManagedIdentity{} + for iterator.ReadArray() { + item := ReadAzureControlPlaneManagedIdentity(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_type.go b/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_type.go new file mode 100644 index 00000000..8fb0c36f --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_type.go @@ -0,0 +1,244 @@ +/* +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 + +// AzureControlPlaneManagedIdentity represents the values of the 'azure_control_plane_managed_identity' type. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity belonging to the Control Plane of the cluster. +type AzureControlPlaneManagedIdentity struct { + bitmap_ uint32 + clientID string + principalID string + resourceID string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureControlPlaneManagedIdentity) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ClientID returns the value of the 'client_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Client ID associated to the Azure User-Assigned Managed Identity. +// Readonly. +func (o *AzureControlPlaneManagedIdentity) ClientID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.clientID + } + return "" +} + +// GetClientID returns the value of the 'client_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Client ID associated to the Azure User-Assigned Managed Identity. +// Readonly. +func (o *AzureControlPlaneManagedIdentity) GetClientID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.clientID + } + return +} + +// PrincipalID returns the value of the 'principal_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Principal ID associated to the Azure User-Assigned Identity. +// Readonly. +func (o *AzureControlPlaneManagedIdentity) PrincipalID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.principalID + } + return "" +} + +// GetPrincipalID returns the value of the 'principal_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Principal ID associated to the Azure User-Assigned Identity. +// Readonly. +func (o *AzureControlPlaneManagedIdentity) GetPrincipalID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.principalID + } + return +} + +// ResourceID returns the value of the 'resource_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource ID of the Azure User-Assigned Managed +// Identity. The managed identity represented must exist before +// creating the cluster. +// The Azure Resource Group Name specified as part of the Resource ID +// must belong to the Azure Subscription specified in `.azure.subscription_id`, +// and in the same Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of the Resource ID +// must be a different Resource Group Name than the one specified in +// `.azure.managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the Resource ID +// can be the same, or a different one than the one specified in +// `.azure.resource_group_name`. +// Required during creation. +// Immutable. +func (o *AzureControlPlaneManagedIdentity) ResourceID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.resourceID + } + return "" +} + +// GetResourceID returns the value of the 'resource_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource ID of the Azure User-Assigned Managed +// Identity. The managed identity represented must exist before +// creating the cluster. +// The Azure Resource Group Name specified as part of the Resource ID +// must belong to the Azure Subscription specified in `.azure.subscription_id`, +// and in the same Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of the Resource ID +// must be a different Resource Group Name than the one specified in +// `.azure.managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the Resource ID +// can be the same, or a different one than the one specified in +// `.azure.resource_group_name`. +// Required during creation. +// Immutable. +func (o *AzureControlPlaneManagedIdentity) GetResourceID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.resourceID + } + return +} + +// AzureControlPlaneManagedIdentityListKind is the name of the type used to represent list of objects of +// type 'azure_control_plane_managed_identity'. +const AzureControlPlaneManagedIdentityListKind = "AzureControlPlaneManagedIdentityList" + +// AzureControlPlaneManagedIdentityListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_control_plane_managed_identity'. +const AzureControlPlaneManagedIdentityListLinkKind = "AzureControlPlaneManagedIdentityListLink" + +// AzureControlPlaneManagedIdentityNilKind is the name of the type used to nil lists of objects of +// type 'azure_control_plane_managed_identity'. +const AzureControlPlaneManagedIdentityListNilKind = "AzureControlPlaneManagedIdentityListNil" + +// AzureControlPlaneManagedIdentityList is a list of values of the 'azure_control_plane_managed_identity' type. +type AzureControlPlaneManagedIdentityList struct { + href string + link bool + items []*AzureControlPlaneManagedIdentity +} + +// Len returns the length of the list. +func (l *AzureControlPlaneManagedIdentityList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureControlPlaneManagedIdentityList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureControlPlaneManagedIdentityList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureControlPlaneManagedIdentityList) SetItems(items []*AzureControlPlaneManagedIdentity) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureControlPlaneManagedIdentityList) Items() []*AzureControlPlaneManagedIdentity { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureControlPlaneManagedIdentityList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureControlPlaneManagedIdentityList) Get(i int) *AzureControlPlaneManagedIdentity { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureControlPlaneManagedIdentityList) Slice() []*AzureControlPlaneManagedIdentity { + var slice []*AzureControlPlaneManagedIdentity + if l == nil { + slice = make([]*AzureControlPlaneManagedIdentity, 0) + } else { + slice = make([]*AzureControlPlaneManagedIdentity, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureControlPlaneManagedIdentityList) Each(f func(item *AzureControlPlaneManagedIdentity) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureControlPlaneManagedIdentityList) Range(f func(index int, item *AzureControlPlaneManagedIdentity) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_type_json.go b/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_type_json.go new file mode 100644 index 00000000..f0016c00 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_control_plane_managed_identity_type_json.go @@ -0,0 +1,112 @@ +/* +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" +) + +// MarshalAzureControlPlaneManagedIdentity writes a value of the 'azure_control_plane_managed_identity' type to the given writer. +func MarshalAzureControlPlaneManagedIdentity(object *AzureControlPlaneManagedIdentity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureControlPlaneManagedIdentity(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureControlPlaneManagedIdentity writes a value of the 'azure_control_plane_managed_identity' type to the given stream. +func WriteAzureControlPlaneManagedIdentity(object *AzureControlPlaneManagedIdentity, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_id") + stream.WriteString(object.clientID) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("principal_id") + stream.WriteString(object.principalID) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_id") + stream.WriteString(object.resourceID) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureControlPlaneManagedIdentity reads a value of the 'azure_control_plane_managed_identity' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureControlPlaneManagedIdentity(source interface{}) (object *AzureControlPlaneManagedIdentity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureControlPlaneManagedIdentity(iterator) + err = iterator.Error + return +} + +// ReadAzureControlPlaneManagedIdentity reads a value of the 'azure_control_plane_managed_identity' type from the given iterator. +func ReadAzureControlPlaneManagedIdentity(iterator *jsoniter.Iterator) *AzureControlPlaneManagedIdentity { + object := &AzureControlPlaneManagedIdentity{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "client_id": + value := iterator.ReadString() + object.clientID = value + object.bitmap_ |= 1 + case "principal_id": + value := iterator.ReadString() + object.principalID = value + object.bitmap_ |= 2 + case "resource_id": + value := iterator.ReadString() + object.resourceID = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_builder.go b/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_builder.go new file mode 100644 index 00000000..edae2986 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_builder.go @@ -0,0 +1,64 @@ +/* +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 + +// AzureDataPlaneManagedIdentityBuilder contains the data and logic needed to build 'azure_data_plane_managed_identity' objects. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity belonging to the Data Plane of the cluster. +type AzureDataPlaneManagedIdentityBuilder struct { + bitmap_ uint32 + resourceID string +} + +// NewAzureDataPlaneManagedIdentity creates a new builder of 'azure_data_plane_managed_identity' objects. +func NewAzureDataPlaneManagedIdentity() *AzureDataPlaneManagedIdentityBuilder { + return &AzureDataPlaneManagedIdentityBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureDataPlaneManagedIdentityBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ResourceID sets the value of the 'resource_ID' attribute to the given value. +func (b *AzureDataPlaneManagedIdentityBuilder) ResourceID(value string) *AzureDataPlaneManagedIdentityBuilder { + b.resourceID = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureDataPlaneManagedIdentityBuilder) Copy(object *AzureDataPlaneManagedIdentity) *AzureDataPlaneManagedIdentityBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.resourceID = object.resourceID + return b +} + +// Build creates a 'azure_data_plane_managed_identity' object using the configuration stored in the builder. +func (b *AzureDataPlaneManagedIdentityBuilder) Build() (object *AzureDataPlaneManagedIdentity, err error) { + object = new(AzureDataPlaneManagedIdentity) + object.bitmap_ = b.bitmap_ + object.resourceID = b.resourceID + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_list_builder.go b/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_list_builder.go new file mode 100644 index 00000000..2afe06be --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_list_builder.go @@ -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 + +// AzureDataPlaneManagedIdentityListBuilder contains the data and logic needed to build +// 'azure_data_plane_managed_identity' objects. +type AzureDataPlaneManagedIdentityListBuilder struct { + items []*AzureDataPlaneManagedIdentityBuilder +} + +// NewAzureDataPlaneManagedIdentityList creates a new builder of 'azure_data_plane_managed_identity' objects. +func NewAzureDataPlaneManagedIdentityList() *AzureDataPlaneManagedIdentityListBuilder { + return new(AzureDataPlaneManagedIdentityListBuilder) +} + +// Items sets the items of the list. +func (b *AzureDataPlaneManagedIdentityListBuilder) Items(values ...*AzureDataPlaneManagedIdentityBuilder) *AzureDataPlaneManagedIdentityListBuilder { + b.items = make([]*AzureDataPlaneManagedIdentityBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureDataPlaneManagedIdentityListBuilder) 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 *AzureDataPlaneManagedIdentityListBuilder) Copy(list *AzureDataPlaneManagedIdentityList) *AzureDataPlaneManagedIdentityListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureDataPlaneManagedIdentityBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureDataPlaneManagedIdentity().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_data_plane_managed_identity' objects using the +// configuration stored in the builder. +func (b *AzureDataPlaneManagedIdentityListBuilder) Build() (list *AzureDataPlaneManagedIdentityList, err error) { + items := make([]*AzureDataPlaneManagedIdentity, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureDataPlaneManagedIdentityList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_list_type_json.go b/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_list_type_json.go new file mode 100644 index 00000000..ae3d8e6a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_list_type_json.go @@ -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" +) + +// MarshalAzureDataPlaneManagedIdentityList writes a list of values of the 'azure_data_plane_managed_identity' type to +// the given writer. +func MarshalAzureDataPlaneManagedIdentityList(list []*AzureDataPlaneManagedIdentity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureDataPlaneManagedIdentityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureDataPlaneManagedIdentityList writes a list of value of the 'azure_data_plane_managed_identity' type to +// the given stream. +func WriteAzureDataPlaneManagedIdentityList(list []*AzureDataPlaneManagedIdentity, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureDataPlaneManagedIdentity(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureDataPlaneManagedIdentityList reads a list of values of the 'azure_data_plane_managed_identity' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureDataPlaneManagedIdentityList(source interface{}) (items []*AzureDataPlaneManagedIdentity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureDataPlaneManagedIdentityList(iterator) + err = iterator.Error + return +} + +// ReadAzureDataPlaneManagedIdentityList reads list of values of the ”azure_data_plane_managed_identity' type from +// the given iterator. +func ReadAzureDataPlaneManagedIdentityList(iterator *jsoniter.Iterator) []*AzureDataPlaneManagedIdentity { + list := []*AzureDataPlaneManagedIdentity{} + for iterator.ReadArray() { + item := ReadAzureDataPlaneManagedIdentity(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_type.go b/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_type.go new file mode 100644 index 00000000..6496fbc6 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_type.go @@ -0,0 +1,192 @@ +/* +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 + +// AzureDataPlaneManagedIdentity represents the values of the 'azure_data_plane_managed_identity' type. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity belonging to the Data Plane of the cluster. +type AzureDataPlaneManagedIdentity struct { + bitmap_ uint32 + resourceID string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureDataPlaneManagedIdentity) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ResourceID returns the value of the 'resource_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource ID of the Azure User-Assigned Managed +// Identity. The managed identity represented must exist before +// creating the cluster. +// The Azure Resource Group Name specified as part of the Resource ID +// must belong to the Azure Subscription specified in `.azure.subscription_id`, +// and in the same Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of the Resource ID +// must be a different Resource Group Name than the one specified in +// `.azure.managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the Resource ID +// can be the same, or a different one than the one specified in +// `.azure.resource_group_name`. +// Required during creation. +// Immutable. +func (o *AzureDataPlaneManagedIdentity) ResourceID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.resourceID + } + return "" +} + +// GetResourceID returns the value of the 'resource_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource ID of the Azure User-Assigned Managed +// Identity. The managed identity represented must exist before +// creating the cluster. +// The Azure Resource Group Name specified as part of the Resource ID +// must belong to the Azure Subscription specified in `.azure.subscription_id`, +// and in the same Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of the Resource ID +// must be a different Resource Group Name than the one specified in +// `.azure.managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the Resource ID +// can be the same, or a different one than the one specified in +// `.azure.resource_group_name`. +// Required during creation. +// Immutable. +func (o *AzureDataPlaneManagedIdentity) GetResourceID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.resourceID + } + return +} + +// AzureDataPlaneManagedIdentityListKind is the name of the type used to represent list of objects of +// type 'azure_data_plane_managed_identity'. +const AzureDataPlaneManagedIdentityListKind = "AzureDataPlaneManagedIdentityList" + +// AzureDataPlaneManagedIdentityListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_data_plane_managed_identity'. +const AzureDataPlaneManagedIdentityListLinkKind = "AzureDataPlaneManagedIdentityListLink" + +// AzureDataPlaneManagedIdentityNilKind is the name of the type used to nil lists of objects of +// type 'azure_data_plane_managed_identity'. +const AzureDataPlaneManagedIdentityListNilKind = "AzureDataPlaneManagedIdentityListNil" + +// AzureDataPlaneManagedIdentityList is a list of values of the 'azure_data_plane_managed_identity' type. +type AzureDataPlaneManagedIdentityList struct { + href string + link bool + items []*AzureDataPlaneManagedIdentity +} + +// Len returns the length of the list. +func (l *AzureDataPlaneManagedIdentityList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureDataPlaneManagedIdentityList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureDataPlaneManagedIdentityList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureDataPlaneManagedIdentityList) SetItems(items []*AzureDataPlaneManagedIdentity) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureDataPlaneManagedIdentityList) Items() []*AzureDataPlaneManagedIdentity { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureDataPlaneManagedIdentityList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureDataPlaneManagedIdentityList) Get(i int) *AzureDataPlaneManagedIdentity { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureDataPlaneManagedIdentityList) Slice() []*AzureDataPlaneManagedIdentity { + var slice []*AzureDataPlaneManagedIdentity + if l == nil { + slice = make([]*AzureDataPlaneManagedIdentity, 0) + } else { + slice = make([]*AzureDataPlaneManagedIdentity, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureDataPlaneManagedIdentityList) Each(f func(item *AzureDataPlaneManagedIdentity) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureDataPlaneManagedIdentityList) Range(f func(index int, item *AzureDataPlaneManagedIdentity) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_type_json.go b/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_type_json.go new file mode 100644 index 00000000..738eeae7 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_data_plane_managed_identity_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalAzureDataPlaneManagedIdentity writes a value of the 'azure_data_plane_managed_identity' type to the given writer. +func MarshalAzureDataPlaneManagedIdentity(object *AzureDataPlaneManagedIdentity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureDataPlaneManagedIdentity(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureDataPlaneManagedIdentity writes a value of the 'azure_data_plane_managed_identity' type to the given stream. +func WriteAzureDataPlaneManagedIdentity(object *AzureDataPlaneManagedIdentity, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_id") + stream.WriteString(object.resourceID) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureDataPlaneManagedIdentity reads a value of the 'azure_data_plane_managed_identity' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureDataPlaneManagedIdentity(source interface{}) (object *AzureDataPlaneManagedIdentity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureDataPlaneManagedIdentity(iterator) + err = iterator.Error + return +} + +// ReadAzureDataPlaneManagedIdentity reads a value of the 'azure_data_plane_managed_identity' type from the given iterator. +func ReadAzureDataPlaneManagedIdentity(iterator *jsoniter.Iterator) *AzureDataPlaneManagedIdentity { + object := &AzureDataPlaneManagedIdentity{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "resource_id": + value := iterator.ReadString() + object.resourceID = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/azure_list_builder.go b/clientapi/arohcp/v1alpha1/azure_list_builder.go new file mode 100644 index 00000000..87fccb27 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_list_builder.go @@ -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 + +// AzureListBuilder contains the data and logic needed to build +// 'azure' objects. +type AzureListBuilder struct { + items []*AzureBuilder +} + +// NewAzureList creates a new builder of 'azure' objects. +func NewAzureList() *AzureListBuilder { + return new(AzureListBuilder) +} + +// Items sets the items of the list. +func (b *AzureListBuilder) Items(values ...*AzureBuilder) *AzureListBuilder { + b.items = make([]*AzureBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureListBuilder) 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 *AzureListBuilder) Copy(list *AzureList) *AzureListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzure().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure' objects using the +// configuration stored in the builder. +func (b *AzureListBuilder) Build() (list *AzureList, err error) { + items := make([]*Azure, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_list_type_json.go b/clientapi/arohcp/v1alpha1/azure_list_type_json.go new file mode 100644 index 00000000..1d92f068 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_list_type_json.go @@ -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" +) + +// MarshalAzureList writes a list of values of the 'azure' type to +// the given writer. +func MarshalAzureList(list []*Azure, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureList writes a list of value of the 'azure' type to +// the given stream. +func WriteAzureList(list []*Azure, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzure(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureList reads a list of values of the 'azure' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureList(source interface{}) (items []*Azure, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureList(iterator) + err = iterator.Error + return +} + +// ReadAzureList reads list of values of the ”azure' type from +// the given iterator. +func ReadAzureList(iterator *jsoniter.Iterator) []*Azure { + list := []*Azure{} + for iterator.ReadArray() { + item := ReadAzure(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/azure_node_pool_builder.go b/clientapi/arohcp/v1alpha1/azure_node_pool_builder.go new file mode 100644 index 00000000..26f27543 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_node_pool_builder.go @@ -0,0 +1,103 @@ +/* +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 + +// AzureNodePoolBuilder contains the data and logic needed to build 'azure_node_pool' objects. +// +// Representation of azure node pool specific parameters. +type AzureNodePoolBuilder struct { + bitmap_ uint32 + osDiskSizeGibibytes int + osDiskStorageAccountType string + vmSize string + resourceName string + ephemeralOSDiskEnabled bool +} + +// NewAzureNodePool creates a new builder of 'azure_node_pool' objects. +func NewAzureNodePool() *AzureNodePoolBuilder { + return &AzureNodePoolBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureNodePoolBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// OSDiskSizeGibibytes sets the value of the 'OS_disk_size_gibibytes' attribute to the given value. +func (b *AzureNodePoolBuilder) OSDiskSizeGibibytes(value int) *AzureNodePoolBuilder { + b.osDiskSizeGibibytes = value + b.bitmap_ |= 1 + return b +} + +// OSDiskStorageAccountType sets the value of the 'OS_disk_storage_account_type' attribute to the given value. +func (b *AzureNodePoolBuilder) OSDiskStorageAccountType(value string) *AzureNodePoolBuilder { + b.osDiskStorageAccountType = value + b.bitmap_ |= 2 + return b +} + +// VMSize sets the value of the 'VM_size' attribute to the given value. +func (b *AzureNodePoolBuilder) VMSize(value string) *AzureNodePoolBuilder { + b.vmSize = value + b.bitmap_ |= 4 + return b +} + +// EphemeralOSDiskEnabled sets the value of the 'ephemeral_OS_disk_enabled' attribute to the given value. +func (b *AzureNodePoolBuilder) EphemeralOSDiskEnabled(value bool) *AzureNodePoolBuilder { + b.ephemeralOSDiskEnabled = value + b.bitmap_ |= 8 + return b +} + +// ResourceName sets the value of the 'resource_name' attribute to the given value. +func (b *AzureNodePoolBuilder) ResourceName(value string) *AzureNodePoolBuilder { + b.resourceName = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureNodePoolBuilder) Copy(object *AzureNodePool) *AzureNodePoolBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.osDiskSizeGibibytes = object.osDiskSizeGibibytes + b.osDiskStorageAccountType = object.osDiskStorageAccountType + b.vmSize = object.vmSize + b.ephemeralOSDiskEnabled = object.ephemeralOSDiskEnabled + b.resourceName = object.resourceName + return b +} + +// Build creates a 'azure_node_pool' object using the configuration stored in the builder. +func (b *AzureNodePoolBuilder) Build() (object *AzureNodePool, err error) { + object = new(AzureNodePool) + object.bitmap_ = b.bitmap_ + object.osDiskSizeGibibytes = b.osDiskSizeGibibytes + object.osDiskStorageAccountType = b.osDiskStorageAccountType + object.vmSize = b.vmSize + object.ephemeralOSDiskEnabled = b.ephemeralOSDiskEnabled + object.resourceName = b.resourceName + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_node_pool_list_builder.go b/clientapi/arohcp/v1alpha1/azure_node_pool_list_builder.go new file mode 100644 index 00000000..3b389c09 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_node_pool_list_builder.go @@ -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 + +// AzureNodePoolListBuilder contains the data and logic needed to build +// 'azure_node_pool' objects. +type AzureNodePoolListBuilder struct { + items []*AzureNodePoolBuilder +} + +// NewAzureNodePoolList creates a new builder of 'azure_node_pool' objects. +func NewAzureNodePoolList() *AzureNodePoolListBuilder { + return new(AzureNodePoolListBuilder) +} + +// Items sets the items of the list. +func (b *AzureNodePoolListBuilder) Items(values ...*AzureNodePoolBuilder) *AzureNodePoolListBuilder { + b.items = make([]*AzureNodePoolBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureNodePoolListBuilder) 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 *AzureNodePoolListBuilder) Copy(list *AzureNodePoolList) *AzureNodePoolListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureNodePoolBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureNodePool().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_node_pool' objects using the +// configuration stored in the builder. +func (b *AzureNodePoolListBuilder) Build() (list *AzureNodePoolList, err error) { + items := make([]*AzureNodePool, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureNodePoolList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_node_pool_list_type_json.go b/clientapi/arohcp/v1alpha1/azure_node_pool_list_type_json.go new file mode 100644 index 00000000..6f06384a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_node_pool_list_type_json.go @@ -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" +) + +// MarshalAzureNodePoolList writes a list of values of the 'azure_node_pool' type to +// the given writer. +func MarshalAzureNodePoolList(list []*AzureNodePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureNodePoolList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureNodePoolList writes a list of value of the 'azure_node_pool' type to +// the given stream. +func WriteAzureNodePoolList(list []*AzureNodePool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureNodePool(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureNodePoolList reads a list of values of the 'azure_node_pool' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureNodePoolList(source interface{}) (items []*AzureNodePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureNodePoolList(iterator) + err = iterator.Error + return +} + +// ReadAzureNodePoolList reads list of values of the ”azure_node_pool' type from +// the given iterator. +func ReadAzureNodePoolList(iterator *jsoniter.Iterator) []*AzureNodePool { + list := []*AzureNodePool{} + for iterator.ReadArray() { + item := ReadAzureNodePool(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/azure_node_pool_type.go b/clientapi/arohcp/v1alpha1/azure_node_pool_type.go new file mode 100644 index 00000000..600fd928 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_node_pool_type.go @@ -0,0 +1,311 @@ +/* +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 + +// AzureNodePool represents the values of the 'azure_node_pool' type. +// +// Representation of azure node pool specific parameters. +type AzureNodePool struct { + bitmap_ uint32 + osDiskSizeGibibytes int + osDiskStorageAccountType string + vmSize string + resourceName string + ephemeralOSDiskEnabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureNodePool) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// OSDiskSizeGibibytes returns the value of the 'OS_disk_size_gibibytes' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The size in GiB to assign to the OS disks of the +// Nodes in the Node Pool. The property +// is the number of bytes x 1024^3. +// If not specified, OS disk size is 30 GiB. +func (o *AzureNodePool) OSDiskSizeGibibytes() int { + if o != nil && o.bitmap_&1 != 0 { + return o.osDiskSizeGibibytes + } + return 0 +} + +// GetOSDiskSizeGibibytes returns the value of the 'OS_disk_size_gibibytes' attribute and +// a flag indicating if the attribute has a value. +// +// The size in GiB to assign to the OS disks of the +// Nodes in the Node Pool. The property +// is the number of bytes x 1024^3. +// If not specified, OS disk size is 30 GiB. +func (o *AzureNodePool) GetOSDiskSizeGibibytes() (value int, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.osDiskSizeGibibytes + } + return +} + +// OSDiskStorageAccountType returns the value of the 'OS_disk_storage_account_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The disk storage account type to use for the OS disks of the Nodes in the +// Node Pool. Valid values are: +// * Standard_LRS: HDD +// * StandardSSD_LRS: Standard SSD +// * Premium_LRS: Premium SDD +// * UltraSSD_LRS: Ultra SDD +// +// If not specified, `Premium_LRS` is used. +func (o *AzureNodePool) OSDiskStorageAccountType() string { + if o != nil && o.bitmap_&2 != 0 { + return o.osDiskStorageAccountType + } + return "" +} + +// GetOSDiskStorageAccountType returns the value of the 'OS_disk_storage_account_type' attribute and +// a flag indicating if the attribute has a value. +// +// The disk storage account type to use for the OS disks of the Nodes in the +// Node Pool. Valid values are: +// * Standard_LRS: HDD +// * StandardSSD_LRS: Standard SSD +// * Premium_LRS: Premium SDD +// * UltraSSD_LRS: Ultra SDD +// +// If not specified, `Premium_LRS` is used. +func (o *AzureNodePool) GetOSDiskStorageAccountType() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.osDiskStorageAccountType + } + return +} + +// VMSize returns the value of the 'VM_size' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Virtual Machine size identifier used for the +// Nodes of the Node Pool. +// Availability of VM sizes are dependent on the Azure Location +// of the parent Cluster. +// Required during creation. +func (o *AzureNodePool) VMSize() string { + if o != nil && o.bitmap_&4 != 0 { + return o.vmSize + } + return "" +} + +// GetVMSize returns the value of the 'VM_size' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Virtual Machine size identifier used for the +// Nodes of the Node Pool. +// Availability of VM sizes are dependent on the Azure Location +// of the parent Cluster. +// Required during creation. +func (o *AzureNodePool) GetVMSize() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.vmSize + } + return +} + +// EphemeralOSDiskEnabled returns the value of the 'ephemeral_OS_disk_enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Enables Ephemeral OS Disks for the Nodes in the Node Pool. +// If not specified, no Ephemeral OS Disks are used. +func (o *AzureNodePool) EphemeralOSDiskEnabled() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.ephemeralOSDiskEnabled + } + return false +} + +// GetEphemeralOSDiskEnabled returns the value of the 'ephemeral_OS_disk_enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Enables Ephemeral OS Disks for the Nodes in the Node Pool. +// If not specified, no Ephemeral OS Disks are used. +func (o *AzureNodePool) GetEphemeralOSDiskEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.ephemeralOSDiskEnabled + } + return +} + +// ResourceName returns the value of the 'resource_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ResourceName is the Azure Resource Name of the NodePool. +// ResourceName must be within the Azure Resource Group Name of the parent +// Cluster it belongs to. +// ResourceName must be located in the same Azure Location as the parent +// Cluster it belongs to. +// ResourceName must be located in the same Azure Subscription as the parent +// Cluster it belongs to. +// ResourceName must belong to the same Microsoft Entra Tenant ID as the parent +// Cluster it belongs to. +// Required during creation. +// Immutable. +func (o *AzureNodePool) ResourceName() string { + if o != nil && o.bitmap_&16 != 0 { + return o.resourceName + } + return "" +} + +// GetResourceName returns the value of the 'resource_name' attribute and +// a flag indicating if the attribute has a value. +// +// ResourceName is the Azure Resource Name of the NodePool. +// ResourceName must be within the Azure Resource Group Name of the parent +// Cluster it belongs to. +// ResourceName must be located in the same Azure Location as the parent +// Cluster it belongs to. +// ResourceName must be located in the same Azure Subscription as the parent +// Cluster it belongs to. +// ResourceName must belong to the same Microsoft Entra Tenant ID as the parent +// Cluster it belongs to. +// Required during creation. +// Immutable. +func (o *AzureNodePool) GetResourceName() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.resourceName + } + return +} + +// AzureNodePoolListKind is the name of the type used to represent list of objects of +// type 'azure_node_pool'. +const AzureNodePoolListKind = "AzureNodePoolList" + +// AzureNodePoolListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_node_pool'. +const AzureNodePoolListLinkKind = "AzureNodePoolListLink" + +// AzureNodePoolNilKind is the name of the type used to nil lists of objects of +// type 'azure_node_pool'. +const AzureNodePoolListNilKind = "AzureNodePoolListNil" + +// AzureNodePoolList is a list of values of the 'azure_node_pool' type. +type AzureNodePoolList struct { + href string + link bool + items []*AzureNodePool +} + +// Len returns the length of the list. +func (l *AzureNodePoolList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureNodePoolList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureNodePoolList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureNodePoolList) SetItems(items []*AzureNodePool) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureNodePoolList) Items() []*AzureNodePool { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureNodePoolList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureNodePoolList) Get(i int) *AzureNodePool { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureNodePoolList) Slice() []*AzureNodePool { + var slice []*AzureNodePool + if l == nil { + slice = make([]*AzureNodePool, 0) + } else { + slice = make([]*AzureNodePool, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureNodePoolList) Each(f func(item *AzureNodePool) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureNodePoolList) Range(f func(index int, item *AzureNodePool) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/azure_node_pool_type_json.go b/clientapi/arohcp/v1alpha1/azure_node_pool_type_json.go new file mode 100644 index 00000000..08effcdd --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_node_pool_type_json.go @@ -0,0 +1,138 @@ +/* +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" +) + +// MarshalAzureNodePool writes a value of the 'azure_node_pool' type to the given writer. +func MarshalAzureNodePool(object *AzureNodePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureNodePool(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureNodePool writes a value of the 'azure_node_pool' type to the given stream. +func WriteAzureNodePool(object *AzureNodePool, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("os_disk_size_gibibytes") + stream.WriteInt(object.osDiskSizeGibibytes) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("os_disk_storage_account_type") + stream.WriteString(object.osDiskStorageAccountType) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("vm_size") + stream.WriteString(object.vmSize) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ephemeral_os_disk_enabled") + stream.WriteBool(object.ephemeralOSDiskEnabled) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_name") + stream.WriteString(object.resourceName) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureNodePool reads a value of the 'azure_node_pool' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureNodePool(source interface{}) (object *AzureNodePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureNodePool(iterator) + err = iterator.Error + return +} + +// ReadAzureNodePool reads a value of the 'azure_node_pool' type from the given iterator. +func ReadAzureNodePool(iterator *jsoniter.Iterator) *AzureNodePool { + object := &AzureNodePool{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "os_disk_size_gibibytes": + value := iterator.ReadInt() + object.osDiskSizeGibibytes = value + object.bitmap_ |= 1 + case "os_disk_storage_account_type": + value := iterator.ReadString() + object.osDiskStorageAccountType = value + object.bitmap_ |= 2 + case "vm_size": + value := iterator.ReadString() + object.vmSize = value + object.bitmap_ |= 4 + case "ephemeral_os_disk_enabled": + value := iterator.ReadBool() + object.ephemeralOSDiskEnabled = value + object.bitmap_ |= 8 + case "resource_name": + value := iterator.ReadString() + object.resourceName = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_builder.go b/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_builder.go new file mode 100644 index 00000000..33ff5246 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_builder.go @@ -0,0 +1,63 @@ +/* +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 + +// AzureNodesOutboundConnectivityBuilder contains the data and logic needed to build 'azure_nodes_outbound_connectivity' objects. +// +// The configuration of the node outbound connectivity +type AzureNodesOutboundConnectivityBuilder struct { + bitmap_ uint32 + outboundType string +} + +// NewAzureNodesOutboundConnectivity creates a new builder of 'azure_nodes_outbound_connectivity' objects. +func NewAzureNodesOutboundConnectivity() *AzureNodesOutboundConnectivityBuilder { + return &AzureNodesOutboundConnectivityBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureNodesOutboundConnectivityBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// OutboundType sets the value of the 'outbound_type' attribute to the given value. +func (b *AzureNodesOutboundConnectivityBuilder) OutboundType(value string) *AzureNodesOutboundConnectivityBuilder { + b.outboundType = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureNodesOutboundConnectivityBuilder) Copy(object *AzureNodesOutboundConnectivity) *AzureNodesOutboundConnectivityBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.outboundType = object.outboundType + return b +} + +// Build creates a 'azure_nodes_outbound_connectivity' object using the configuration stored in the builder. +func (b *AzureNodesOutboundConnectivityBuilder) Build() (object *AzureNodesOutboundConnectivity, err error) { + object = new(AzureNodesOutboundConnectivity) + object.bitmap_ = b.bitmap_ + object.outboundType = b.outboundType + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_list_builder.go b/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_list_builder.go new file mode 100644 index 00000000..257a4b3e --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_list_builder.go @@ -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 + +// AzureNodesOutboundConnectivityListBuilder contains the data and logic needed to build +// 'azure_nodes_outbound_connectivity' objects. +type AzureNodesOutboundConnectivityListBuilder struct { + items []*AzureNodesOutboundConnectivityBuilder +} + +// NewAzureNodesOutboundConnectivityList creates a new builder of 'azure_nodes_outbound_connectivity' objects. +func NewAzureNodesOutboundConnectivityList() *AzureNodesOutboundConnectivityListBuilder { + return new(AzureNodesOutboundConnectivityListBuilder) +} + +// Items sets the items of the list. +func (b *AzureNodesOutboundConnectivityListBuilder) Items(values ...*AzureNodesOutboundConnectivityBuilder) *AzureNodesOutboundConnectivityListBuilder { + b.items = make([]*AzureNodesOutboundConnectivityBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureNodesOutboundConnectivityListBuilder) 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 *AzureNodesOutboundConnectivityListBuilder) Copy(list *AzureNodesOutboundConnectivityList) *AzureNodesOutboundConnectivityListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureNodesOutboundConnectivityBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureNodesOutboundConnectivity().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_nodes_outbound_connectivity' objects using the +// configuration stored in the builder. +func (b *AzureNodesOutboundConnectivityListBuilder) Build() (list *AzureNodesOutboundConnectivityList, err error) { + items := make([]*AzureNodesOutboundConnectivity, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureNodesOutboundConnectivityList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_list_type_json.go b/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_list_type_json.go new file mode 100644 index 00000000..bc76c921 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_list_type_json.go @@ -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" +) + +// MarshalAzureNodesOutboundConnectivityList writes a list of values of the 'azure_nodes_outbound_connectivity' type to +// the given writer. +func MarshalAzureNodesOutboundConnectivityList(list []*AzureNodesOutboundConnectivity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureNodesOutboundConnectivityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureNodesOutboundConnectivityList writes a list of value of the 'azure_nodes_outbound_connectivity' type to +// the given stream. +func WriteAzureNodesOutboundConnectivityList(list []*AzureNodesOutboundConnectivity, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureNodesOutboundConnectivity(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureNodesOutboundConnectivityList reads a list of values of the 'azure_nodes_outbound_connectivity' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureNodesOutboundConnectivityList(source interface{}) (items []*AzureNodesOutboundConnectivity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureNodesOutboundConnectivityList(iterator) + err = iterator.Error + return +} + +// ReadAzureNodesOutboundConnectivityList reads list of values of the ”azure_nodes_outbound_connectivity' type from +// the given iterator. +func ReadAzureNodesOutboundConnectivityList(iterator *jsoniter.Iterator) []*AzureNodesOutboundConnectivity { + list := []*AzureNodesOutboundConnectivity{} + for iterator.ReadArray() { + item := ReadAzureNodesOutboundConnectivity(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_type.go b/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_type.go new file mode 100644 index 00000000..71ae2c4d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_type.go @@ -0,0 +1,169 @@ +/* +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 + +// AzureNodesOutboundConnectivity represents the values of the 'azure_nodes_outbound_connectivity' type. +// +// The configuration of the node outbound connectivity +type AzureNodesOutboundConnectivity struct { + bitmap_ uint32 + outboundType string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureNodesOutboundConnectivity) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// OutboundType returns the value of the 'outbound_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// OutboundType is the type of network outbound configuration. +// The default and only accepted value is 'load_balancer'. +// This value is immutable. +func (o *AzureNodesOutboundConnectivity) OutboundType() string { + if o != nil && o.bitmap_&1 != 0 { + return o.outboundType + } + return "" +} + +// GetOutboundType returns the value of the 'outbound_type' attribute and +// a flag indicating if the attribute has a value. +// +// OutboundType is the type of network outbound configuration. +// The default and only accepted value is 'load_balancer'. +// This value is immutable. +func (o *AzureNodesOutboundConnectivity) GetOutboundType() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.outboundType + } + return +} + +// AzureNodesOutboundConnectivityListKind is the name of the type used to represent list of objects of +// type 'azure_nodes_outbound_connectivity'. +const AzureNodesOutboundConnectivityListKind = "AzureNodesOutboundConnectivityList" + +// AzureNodesOutboundConnectivityListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_nodes_outbound_connectivity'. +const AzureNodesOutboundConnectivityListLinkKind = "AzureNodesOutboundConnectivityListLink" + +// AzureNodesOutboundConnectivityNilKind is the name of the type used to nil lists of objects of +// type 'azure_nodes_outbound_connectivity'. +const AzureNodesOutboundConnectivityListNilKind = "AzureNodesOutboundConnectivityListNil" + +// AzureNodesOutboundConnectivityList is a list of values of the 'azure_nodes_outbound_connectivity' type. +type AzureNodesOutboundConnectivityList struct { + href string + link bool + items []*AzureNodesOutboundConnectivity +} + +// Len returns the length of the list. +func (l *AzureNodesOutboundConnectivityList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureNodesOutboundConnectivityList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureNodesOutboundConnectivityList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureNodesOutboundConnectivityList) SetItems(items []*AzureNodesOutboundConnectivity) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureNodesOutboundConnectivityList) Items() []*AzureNodesOutboundConnectivity { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureNodesOutboundConnectivityList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureNodesOutboundConnectivityList) Get(i int) *AzureNodesOutboundConnectivity { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureNodesOutboundConnectivityList) Slice() []*AzureNodesOutboundConnectivity { + var slice []*AzureNodesOutboundConnectivity + if l == nil { + slice = make([]*AzureNodesOutboundConnectivity, 0) + } else { + slice = make([]*AzureNodesOutboundConnectivity, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureNodesOutboundConnectivityList) Each(f func(item *AzureNodesOutboundConnectivity) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureNodesOutboundConnectivityList) Range(f func(index int, item *AzureNodesOutboundConnectivity) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_type_json.go b/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_type_json.go new file mode 100644 index 00000000..ff4421ef --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_nodes_outbound_connectivity_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalAzureNodesOutboundConnectivity writes a value of the 'azure_nodes_outbound_connectivity' type to the given writer. +func MarshalAzureNodesOutboundConnectivity(object *AzureNodesOutboundConnectivity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureNodesOutboundConnectivity(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureNodesOutboundConnectivity writes a value of the 'azure_nodes_outbound_connectivity' type to the given stream. +func WriteAzureNodesOutboundConnectivity(object *AzureNodesOutboundConnectivity, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("outbound_type") + stream.WriteString(object.outboundType) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureNodesOutboundConnectivity reads a value of the 'azure_nodes_outbound_connectivity' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureNodesOutboundConnectivity(source interface{}) (object *AzureNodesOutboundConnectivity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureNodesOutboundConnectivity(iterator) + err = iterator.Error + return +} + +// ReadAzureNodesOutboundConnectivity reads a value of the 'azure_nodes_outbound_connectivity' type from the given iterator. +func ReadAzureNodesOutboundConnectivity(iterator *jsoniter.Iterator) *AzureNodesOutboundConnectivity { + object := &AzureNodesOutboundConnectivity{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "outbound_type": + value := iterator.ReadString() + object.outboundType = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/azure_operators_authentication_builder.go b/clientapi/arohcp/v1alpha1/azure_operators_authentication_builder.go new file mode 100644 index 00000000..2cfed2a1 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_operators_authentication_builder.go @@ -0,0 +1,81 @@ +/* +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 + +// AzureOperatorsAuthenticationBuilder contains the data and logic needed to build 'azure_operators_authentication' objects. +// +// The configuration that the operators of the +// cluster have to authenticate to Azure. +type AzureOperatorsAuthenticationBuilder struct { + bitmap_ uint32 + managedIdentities *AzureOperatorsAuthenticationManagedIdentitiesBuilder +} + +// NewAzureOperatorsAuthentication creates a new builder of 'azure_operators_authentication' objects. +func NewAzureOperatorsAuthentication() *AzureOperatorsAuthenticationBuilder { + return &AzureOperatorsAuthenticationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureOperatorsAuthenticationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ManagedIdentities sets the value of the 'managed_identities' attribute to the given value. +// +// Represents the information related to Azure User-Assigned managed identities +// needed to perform Operators authentication based on Azure User-Assigned +// Managed Identities +func (b *AzureOperatorsAuthenticationBuilder) ManagedIdentities(value *AzureOperatorsAuthenticationManagedIdentitiesBuilder) *AzureOperatorsAuthenticationBuilder { + b.managedIdentities = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureOperatorsAuthenticationBuilder) Copy(object *AzureOperatorsAuthentication) *AzureOperatorsAuthenticationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.managedIdentities != nil { + b.managedIdentities = NewAzureOperatorsAuthenticationManagedIdentities().Copy(object.managedIdentities) + } else { + b.managedIdentities = nil + } + return b +} + +// Build creates a 'azure_operators_authentication' object using the configuration stored in the builder. +func (b *AzureOperatorsAuthenticationBuilder) Build() (object *AzureOperatorsAuthentication, err error) { + object = new(AzureOperatorsAuthentication) + object.bitmap_ = b.bitmap_ + if b.managedIdentities != nil { + object.managedIdentities, err = b.managedIdentities.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_operators_authentication_list_builder.go b/clientapi/arohcp/v1alpha1/azure_operators_authentication_list_builder.go new file mode 100644 index 00000000..2f9da2c0 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_operators_authentication_list_builder.go @@ -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 + +// AzureOperatorsAuthenticationListBuilder contains the data and logic needed to build +// 'azure_operators_authentication' objects. +type AzureOperatorsAuthenticationListBuilder struct { + items []*AzureOperatorsAuthenticationBuilder +} + +// NewAzureOperatorsAuthenticationList creates a new builder of 'azure_operators_authentication' objects. +func NewAzureOperatorsAuthenticationList() *AzureOperatorsAuthenticationListBuilder { + return new(AzureOperatorsAuthenticationListBuilder) +} + +// Items sets the items of the list. +func (b *AzureOperatorsAuthenticationListBuilder) Items(values ...*AzureOperatorsAuthenticationBuilder) *AzureOperatorsAuthenticationListBuilder { + b.items = make([]*AzureOperatorsAuthenticationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureOperatorsAuthenticationListBuilder) 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 *AzureOperatorsAuthenticationListBuilder) Copy(list *AzureOperatorsAuthenticationList) *AzureOperatorsAuthenticationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureOperatorsAuthenticationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureOperatorsAuthentication().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_operators_authentication' objects using the +// configuration stored in the builder. +func (b *AzureOperatorsAuthenticationListBuilder) Build() (list *AzureOperatorsAuthenticationList, err error) { + items := make([]*AzureOperatorsAuthentication, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureOperatorsAuthenticationList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_operators_authentication_list_type_json.go b/clientapi/arohcp/v1alpha1/azure_operators_authentication_list_type_json.go new file mode 100644 index 00000000..f3a5dd46 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_operators_authentication_list_type_json.go @@ -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" +) + +// MarshalAzureOperatorsAuthenticationList writes a list of values of the 'azure_operators_authentication' type to +// the given writer. +func MarshalAzureOperatorsAuthenticationList(list []*AzureOperatorsAuthentication, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureOperatorsAuthenticationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureOperatorsAuthenticationList writes a list of value of the 'azure_operators_authentication' type to +// the given stream. +func WriteAzureOperatorsAuthenticationList(list []*AzureOperatorsAuthentication, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureOperatorsAuthentication(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureOperatorsAuthenticationList reads a list of values of the 'azure_operators_authentication' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureOperatorsAuthenticationList(source interface{}) (items []*AzureOperatorsAuthentication, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureOperatorsAuthenticationList(iterator) + err = iterator.Error + return +} + +// ReadAzureOperatorsAuthenticationList reads list of values of the ”azure_operators_authentication' type from +// the given iterator. +func ReadAzureOperatorsAuthenticationList(iterator *jsoniter.Iterator) []*AzureOperatorsAuthentication { + list := []*AzureOperatorsAuthentication{} + for iterator.ReadArray() { + item := ReadAzureOperatorsAuthentication(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_builder.go b/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_builder.go new file mode 100644 index 00000000..13ff067c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_builder.go @@ -0,0 +1,149 @@ +/* +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 + +// AzureOperatorsAuthenticationManagedIdentitiesBuilder contains the data and logic needed to build 'azure_operators_authentication_managed_identities' objects. +// +// Represents the information related to Azure User-Assigned managed identities +// needed to perform Operators authentication based on Azure User-Assigned +// Managed Identities +type AzureOperatorsAuthenticationManagedIdentitiesBuilder struct { + bitmap_ uint32 + controlPlaneOperatorsManagedIdentities map[string]*AzureControlPlaneManagedIdentityBuilder + dataPlaneOperatorsManagedIdentities map[string]*AzureDataPlaneManagedIdentityBuilder + managedIdentitiesDataPlaneIdentityUrl string + serviceManagedIdentity *AzureServiceManagedIdentityBuilder +} + +// NewAzureOperatorsAuthenticationManagedIdentities creates a new builder of 'azure_operators_authentication_managed_identities' objects. +func NewAzureOperatorsAuthenticationManagedIdentities() *AzureOperatorsAuthenticationManagedIdentitiesBuilder { + return &AzureOperatorsAuthenticationManagedIdentitiesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ControlPlaneOperatorsManagedIdentities sets the value of the 'control_plane_operators_managed_identities' attribute to the given value. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) ControlPlaneOperatorsManagedIdentities(value map[string]*AzureControlPlaneManagedIdentityBuilder) *AzureOperatorsAuthenticationManagedIdentitiesBuilder { + b.controlPlaneOperatorsManagedIdentities = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// DataPlaneOperatorsManagedIdentities sets the value of the 'data_plane_operators_managed_identities' attribute to the given value. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) DataPlaneOperatorsManagedIdentities(value map[string]*AzureDataPlaneManagedIdentityBuilder) *AzureOperatorsAuthenticationManagedIdentitiesBuilder { + b.dataPlaneOperatorsManagedIdentities = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// ManagedIdentitiesDataPlaneIdentityUrl sets the value of the 'managed_identities_data_plane_identity_url' attribute to the given value. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) ManagedIdentitiesDataPlaneIdentityUrl(value string) *AzureOperatorsAuthenticationManagedIdentitiesBuilder { + b.managedIdentitiesDataPlaneIdentityUrl = value + b.bitmap_ |= 4 + return b +} + +// ServiceManagedIdentity sets the value of the 'service_managed_identity' attribute to the given value. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity whose purpose is to perform service level actions. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) ServiceManagedIdentity(value *AzureServiceManagedIdentityBuilder) *AzureOperatorsAuthenticationManagedIdentitiesBuilder { + b.serviceManagedIdentity = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) Copy(object *AzureOperatorsAuthenticationManagedIdentities) *AzureOperatorsAuthenticationManagedIdentitiesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if len(object.controlPlaneOperatorsManagedIdentities) > 0 { + b.controlPlaneOperatorsManagedIdentities = map[string]*AzureControlPlaneManagedIdentityBuilder{} + for k, v := range object.controlPlaneOperatorsManagedIdentities { + b.controlPlaneOperatorsManagedIdentities[k] = NewAzureControlPlaneManagedIdentity().Copy(v) + } + } else { + b.controlPlaneOperatorsManagedIdentities = nil + } + if len(object.dataPlaneOperatorsManagedIdentities) > 0 { + b.dataPlaneOperatorsManagedIdentities = map[string]*AzureDataPlaneManagedIdentityBuilder{} + for k, v := range object.dataPlaneOperatorsManagedIdentities { + b.dataPlaneOperatorsManagedIdentities[k] = NewAzureDataPlaneManagedIdentity().Copy(v) + } + } else { + b.dataPlaneOperatorsManagedIdentities = nil + } + b.managedIdentitiesDataPlaneIdentityUrl = object.managedIdentitiesDataPlaneIdentityUrl + if object.serviceManagedIdentity != nil { + b.serviceManagedIdentity = NewAzureServiceManagedIdentity().Copy(object.serviceManagedIdentity) + } else { + b.serviceManagedIdentity = nil + } + return b +} + +// Build creates a 'azure_operators_authentication_managed_identities' object using the configuration stored in the builder. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) Build() (object *AzureOperatorsAuthenticationManagedIdentities, err error) { + object = new(AzureOperatorsAuthenticationManagedIdentities) + object.bitmap_ = b.bitmap_ + if b.controlPlaneOperatorsManagedIdentities != nil { + object.controlPlaneOperatorsManagedIdentities = make(map[string]*AzureControlPlaneManagedIdentity) + for k, v := range b.controlPlaneOperatorsManagedIdentities { + object.controlPlaneOperatorsManagedIdentities[k], err = v.Build() + if err != nil { + return + } + } + } + if b.dataPlaneOperatorsManagedIdentities != nil { + object.dataPlaneOperatorsManagedIdentities = make(map[string]*AzureDataPlaneManagedIdentity) + for k, v := range b.dataPlaneOperatorsManagedIdentities { + object.dataPlaneOperatorsManagedIdentities[k], err = v.Build() + if err != nil { + return + } + } + } + object.managedIdentitiesDataPlaneIdentityUrl = b.managedIdentitiesDataPlaneIdentityUrl + if b.serviceManagedIdentity != nil { + object.serviceManagedIdentity, err = b.serviceManagedIdentity.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_list_builder.go b/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_list_builder.go new file mode 100644 index 00000000..832d3bfd --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_list_builder.go @@ -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 + +// AzureOperatorsAuthenticationManagedIdentitiesListBuilder contains the data and logic needed to build +// 'azure_operators_authentication_managed_identities' objects. +type AzureOperatorsAuthenticationManagedIdentitiesListBuilder struct { + items []*AzureOperatorsAuthenticationManagedIdentitiesBuilder +} + +// NewAzureOperatorsAuthenticationManagedIdentitiesList creates a new builder of 'azure_operators_authentication_managed_identities' objects. +func NewAzureOperatorsAuthenticationManagedIdentitiesList() *AzureOperatorsAuthenticationManagedIdentitiesListBuilder { + return new(AzureOperatorsAuthenticationManagedIdentitiesListBuilder) +} + +// Items sets the items of the list. +func (b *AzureOperatorsAuthenticationManagedIdentitiesListBuilder) Items(values ...*AzureOperatorsAuthenticationManagedIdentitiesBuilder) *AzureOperatorsAuthenticationManagedIdentitiesListBuilder { + b.items = make([]*AzureOperatorsAuthenticationManagedIdentitiesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureOperatorsAuthenticationManagedIdentitiesListBuilder) 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 *AzureOperatorsAuthenticationManagedIdentitiesListBuilder) Copy(list *AzureOperatorsAuthenticationManagedIdentitiesList) *AzureOperatorsAuthenticationManagedIdentitiesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureOperatorsAuthenticationManagedIdentitiesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureOperatorsAuthenticationManagedIdentities().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_operators_authentication_managed_identities' objects using the +// configuration stored in the builder. +func (b *AzureOperatorsAuthenticationManagedIdentitiesListBuilder) Build() (list *AzureOperatorsAuthenticationManagedIdentitiesList, err error) { + items := make([]*AzureOperatorsAuthenticationManagedIdentities, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureOperatorsAuthenticationManagedIdentitiesList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_list_type_json.go b/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_list_type_json.go new file mode 100644 index 00000000..84791f2d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_list_type_json.go @@ -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" +) + +// MarshalAzureOperatorsAuthenticationManagedIdentitiesList writes a list of values of the 'azure_operators_authentication_managed_identities' type to +// the given writer. +func MarshalAzureOperatorsAuthenticationManagedIdentitiesList(list []*AzureOperatorsAuthenticationManagedIdentities, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureOperatorsAuthenticationManagedIdentitiesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureOperatorsAuthenticationManagedIdentitiesList writes a list of value of the 'azure_operators_authentication_managed_identities' type to +// the given stream. +func WriteAzureOperatorsAuthenticationManagedIdentitiesList(list []*AzureOperatorsAuthenticationManagedIdentities, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureOperatorsAuthenticationManagedIdentities(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureOperatorsAuthenticationManagedIdentitiesList reads a list of values of the 'azure_operators_authentication_managed_identities' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureOperatorsAuthenticationManagedIdentitiesList(source interface{}) (items []*AzureOperatorsAuthenticationManagedIdentities, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureOperatorsAuthenticationManagedIdentitiesList(iterator) + err = iterator.Error + return +} + +// ReadAzureOperatorsAuthenticationManagedIdentitiesList reads list of values of the ”azure_operators_authentication_managed_identities' type from +// the given iterator. +func ReadAzureOperatorsAuthenticationManagedIdentitiesList(iterator *jsoniter.Iterator) []*AzureOperatorsAuthenticationManagedIdentities { + list := []*AzureOperatorsAuthenticationManagedIdentities{} + for iterator.ReadArray() { + item := ReadAzureOperatorsAuthenticationManagedIdentities(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_type.go b/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_type.go new file mode 100644 index 00000000..08c993a8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_type.go @@ -0,0 +1,277 @@ +/* +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 + +// AzureOperatorsAuthenticationManagedIdentities represents the values of the 'azure_operators_authentication_managed_identities' type. +// +// Represents the information related to Azure User-Assigned managed identities +// needed to perform Operators authentication based on Azure User-Assigned +// Managed Identities +type AzureOperatorsAuthenticationManagedIdentities struct { + bitmap_ uint32 + controlPlaneOperatorsManagedIdentities map[string]*AzureControlPlaneManagedIdentity + dataPlaneOperatorsManagedIdentities map[string]*AzureDataPlaneManagedIdentity + managedIdentitiesDataPlaneIdentityUrl string + serviceManagedIdentity *AzureServiceManagedIdentity +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureOperatorsAuthenticationManagedIdentities) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ControlPlaneOperatorsManagedIdentities returns the value of the 'control_plane_operators_managed_identities' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The set of Azure User-Assigned Managed Identities leveraged for the +// Control Plane operators of the cluster. The set of required managed +// identities is dependent on the Cluster's OpenShift version. +// Immutable +func (o *AzureOperatorsAuthenticationManagedIdentities) ControlPlaneOperatorsManagedIdentities() map[string]*AzureControlPlaneManagedIdentity { + if o != nil && o.bitmap_&1 != 0 { + return o.controlPlaneOperatorsManagedIdentities + } + return nil +} + +// GetControlPlaneOperatorsManagedIdentities returns the value of the 'control_plane_operators_managed_identities' attribute and +// a flag indicating if the attribute has a value. +// +// The set of Azure User-Assigned Managed Identities leveraged for the +// Control Plane operators of the cluster. The set of required managed +// identities is dependent on the Cluster's OpenShift version. +// Immutable +func (o *AzureOperatorsAuthenticationManagedIdentities) GetControlPlaneOperatorsManagedIdentities() (value map[string]*AzureControlPlaneManagedIdentity, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.controlPlaneOperatorsManagedIdentities + } + return +} + +// DataPlaneOperatorsManagedIdentities returns the value of the 'data_plane_operators_managed_identities' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The set of Azure User-Assigned Managed Identities leveraged for the +// Data Plane operators of the cluster. The set of required managed +// identities is dependent on the Cluster's OpenShift version. +// Immutable. +func (o *AzureOperatorsAuthenticationManagedIdentities) DataPlaneOperatorsManagedIdentities() map[string]*AzureDataPlaneManagedIdentity { + if o != nil && o.bitmap_&2 != 0 { + return o.dataPlaneOperatorsManagedIdentities + } + return nil +} + +// GetDataPlaneOperatorsManagedIdentities returns the value of the 'data_plane_operators_managed_identities' attribute and +// a flag indicating if the attribute has a value. +// +// The set of Azure User-Assigned Managed Identities leveraged for the +// Data Plane operators of the cluster. The set of required managed +// identities is dependent on the Cluster's OpenShift version. +// Immutable. +func (o *AzureOperatorsAuthenticationManagedIdentities) GetDataPlaneOperatorsManagedIdentities() (value map[string]*AzureDataPlaneManagedIdentity, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.dataPlaneOperatorsManagedIdentities + } + return +} + +// ManagedIdentitiesDataPlaneIdentityUrl returns the value of the 'managed_identities_data_plane_identity_url' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Managed Identities Data Plane Identity URL associated with the +// cluster. It is the URL that will be used to communicate with the +// Managed Identities Resource Provider (MI RP). +// Required during creation. +// Immutable. +func (o *AzureOperatorsAuthenticationManagedIdentities) ManagedIdentitiesDataPlaneIdentityUrl() string { + if o != nil && o.bitmap_&4 != 0 { + return o.managedIdentitiesDataPlaneIdentityUrl + } + return "" +} + +// GetManagedIdentitiesDataPlaneIdentityUrl returns the value of the 'managed_identities_data_plane_identity_url' attribute and +// a flag indicating if the attribute has a value. +// +// The Managed Identities Data Plane Identity URL associated with the +// cluster. It is the URL that will be used to communicate with the +// Managed Identities Resource Provider (MI RP). +// Required during creation. +// Immutable. +func (o *AzureOperatorsAuthenticationManagedIdentities) GetManagedIdentitiesDataPlaneIdentityUrl() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.managedIdentitiesDataPlaneIdentityUrl + } + return +} + +// ServiceManagedIdentity returns the value of the 'service_managed_identity' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure User-Assigned Managed Identity used to perform service +// level actions. Specifically: +// - Add Federated Identity Credentials to the identities in +// `data_plane_operators_managed_identities` that belong to Data +// Plane Cluster Operators +// - Perform permissions validation for the BYOVNet related resources +// associated to the Cluster +// +// Required during creation. +// Immutable. +func (o *AzureOperatorsAuthenticationManagedIdentities) ServiceManagedIdentity() *AzureServiceManagedIdentity { + if o != nil && o.bitmap_&8 != 0 { + return o.serviceManagedIdentity + } + return nil +} + +// GetServiceManagedIdentity returns the value of the 'service_managed_identity' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure User-Assigned Managed Identity used to perform service +// level actions. Specifically: +// - Add Federated Identity Credentials to the identities in +// `data_plane_operators_managed_identities` that belong to Data +// Plane Cluster Operators +// - Perform permissions validation for the BYOVNet related resources +// associated to the Cluster +// +// Required during creation. +// Immutable. +func (o *AzureOperatorsAuthenticationManagedIdentities) GetServiceManagedIdentity() (value *AzureServiceManagedIdentity, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.serviceManagedIdentity + } + return +} + +// AzureOperatorsAuthenticationManagedIdentitiesListKind is the name of the type used to represent list of objects of +// type 'azure_operators_authentication_managed_identities'. +const AzureOperatorsAuthenticationManagedIdentitiesListKind = "AzureOperatorsAuthenticationManagedIdentitiesList" + +// AzureOperatorsAuthenticationManagedIdentitiesListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_operators_authentication_managed_identities'. +const AzureOperatorsAuthenticationManagedIdentitiesListLinkKind = "AzureOperatorsAuthenticationManagedIdentitiesListLink" + +// AzureOperatorsAuthenticationManagedIdentitiesNilKind is the name of the type used to nil lists of objects of +// type 'azure_operators_authentication_managed_identities'. +const AzureOperatorsAuthenticationManagedIdentitiesListNilKind = "AzureOperatorsAuthenticationManagedIdentitiesListNil" + +// AzureOperatorsAuthenticationManagedIdentitiesList is a list of values of the 'azure_operators_authentication_managed_identities' type. +type AzureOperatorsAuthenticationManagedIdentitiesList struct { + href string + link bool + items []*AzureOperatorsAuthenticationManagedIdentities +} + +// Len returns the length of the list. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) SetItems(items []*AzureOperatorsAuthenticationManagedIdentities) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Items() []*AzureOperatorsAuthenticationManagedIdentities { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Get(i int) *AzureOperatorsAuthenticationManagedIdentities { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Slice() []*AzureOperatorsAuthenticationManagedIdentities { + var slice []*AzureOperatorsAuthenticationManagedIdentities + if l == nil { + slice = make([]*AzureOperatorsAuthenticationManagedIdentities, 0) + } else { + slice = make([]*AzureOperatorsAuthenticationManagedIdentities, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Each(f func(item *AzureOperatorsAuthenticationManagedIdentities) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Range(f func(index int, item *AzureOperatorsAuthenticationManagedIdentities) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_type_json.go b/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_type_json.go new file mode 100644 index 00000000..f9193c70 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_operators_authentication_managed_identities_type_json.go @@ -0,0 +1,182 @@ +/* +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" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureOperatorsAuthenticationManagedIdentities writes a value of the 'azure_operators_authentication_managed_identities' type to the given writer. +func MarshalAzureOperatorsAuthenticationManagedIdentities(object *AzureOperatorsAuthenticationManagedIdentities, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureOperatorsAuthenticationManagedIdentities(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureOperatorsAuthenticationManagedIdentities writes a value of the 'azure_operators_authentication_managed_identities' type to the given stream. +func WriteAzureOperatorsAuthenticationManagedIdentities(object *AzureOperatorsAuthenticationManagedIdentities, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.controlPlaneOperatorsManagedIdentities != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("control_plane_operators_managed_identities") + if object.controlPlaneOperatorsManagedIdentities != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.controlPlaneOperatorsManagedIdentities)) + i := 0 + for key := range object.controlPlaneOperatorsManagedIdentities { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.controlPlaneOperatorsManagedIdentities[key] + stream.WriteObjectField(key) + WriteAzureControlPlaneManagedIdentity(item, stream) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&2 != 0 && object.dataPlaneOperatorsManagedIdentities != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("data_plane_operators_managed_identities") + if object.dataPlaneOperatorsManagedIdentities != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.dataPlaneOperatorsManagedIdentities)) + i := 0 + for key := range object.dataPlaneOperatorsManagedIdentities { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.dataPlaneOperatorsManagedIdentities[key] + stream.WriteObjectField(key) + WriteAzureDataPlaneManagedIdentity(item, stream) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_identities_data_plane_identity_url") + stream.WriteString(object.managedIdentitiesDataPlaneIdentityUrl) + count++ + } + present_ = object.bitmap_&8 != 0 && object.serviceManagedIdentity != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_managed_identity") + WriteAzureServiceManagedIdentity(object.serviceManagedIdentity, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureOperatorsAuthenticationManagedIdentities reads a value of the 'azure_operators_authentication_managed_identities' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureOperatorsAuthenticationManagedIdentities(source interface{}) (object *AzureOperatorsAuthenticationManagedIdentities, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureOperatorsAuthenticationManagedIdentities(iterator) + err = iterator.Error + return +} + +// ReadAzureOperatorsAuthenticationManagedIdentities reads a value of the 'azure_operators_authentication_managed_identities' type from the given iterator. +func ReadAzureOperatorsAuthenticationManagedIdentities(iterator *jsoniter.Iterator) *AzureOperatorsAuthenticationManagedIdentities { + object := &AzureOperatorsAuthenticationManagedIdentities{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "control_plane_operators_managed_identities": + value := map[string]*AzureControlPlaneManagedIdentity{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := ReadAzureControlPlaneManagedIdentity(iterator) + value[key] = item + } + object.controlPlaneOperatorsManagedIdentities = value + object.bitmap_ |= 1 + case "data_plane_operators_managed_identities": + value := map[string]*AzureDataPlaneManagedIdentity{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := ReadAzureDataPlaneManagedIdentity(iterator) + value[key] = item + } + object.dataPlaneOperatorsManagedIdentities = value + object.bitmap_ |= 2 + case "managed_identities_data_plane_identity_url": + value := iterator.ReadString() + object.managedIdentitiesDataPlaneIdentityUrl = value + object.bitmap_ |= 4 + case "service_managed_identity": + value := ReadAzureServiceManagedIdentity(iterator) + object.serviceManagedIdentity = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/azure_operators_authentication_type.go b/clientapi/arohcp/v1alpha1/azure_operators_authentication_type.go new file mode 100644 index 00000000..62e101e4 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_operators_authentication_type.go @@ -0,0 +1,170 @@ +/* +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 + +// AzureOperatorsAuthentication represents the values of the 'azure_operators_authentication' type. +// +// The configuration that the operators of the +// cluster have to authenticate to Azure. +type AzureOperatorsAuthentication struct { + bitmap_ uint32 + managedIdentities *AzureOperatorsAuthenticationManagedIdentities +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureOperatorsAuthentication) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ManagedIdentities returns the value of the 'managed_identities' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The authentication configuration to authenticate +// to Azure using Azure User-Assigned Managed Identities. +// Required during creation. +func (o *AzureOperatorsAuthentication) ManagedIdentities() *AzureOperatorsAuthenticationManagedIdentities { + if o != nil && o.bitmap_&1 != 0 { + return o.managedIdentities + } + return nil +} + +// GetManagedIdentities returns the value of the 'managed_identities' attribute and +// a flag indicating if the attribute has a value. +// +// The authentication configuration to authenticate +// to Azure using Azure User-Assigned Managed Identities. +// Required during creation. +func (o *AzureOperatorsAuthentication) GetManagedIdentities() (value *AzureOperatorsAuthenticationManagedIdentities, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.managedIdentities + } + return +} + +// AzureOperatorsAuthenticationListKind is the name of the type used to represent list of objects of +// type 'azure_operators_authentication'. +const AzureOperatorsAuthenticationListKind = "AzureOperatorsAuthenticationList" + +// AzureOperatorsAuthenticationListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_operators_authentication'. +const AzureOperatorsAuthenticationListLinkKind = "AzureOperatorsAuthenticationListLink" + +// AzureOperatorsAuthenticationNilKind is the name of the type used to nil lists of objects of +// type 'azure_operators_authentication'. +const AzureOperatorsAuthenticationListNilKind = "AzureOperatorsAuthenticationListNil" + +// AzureOperatorsAuthenticationList is a list of values of the 'azure_operators_authentication' type. +type AzureOperatorsAuthenticationList struct { + href string + link bool + items []*AzureOperatorsAuthentication +} + +// Len returns the length of the list. +func (l *AzureOperatorsAuthenticationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureOperatorsAuthenticationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureOperatorsAuthenticationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureOperatorsAuthenticationList) SetItems(items []*AzureOperatorsAuthentication) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureOperatorsAuthenticationList) Items() []*AzureOperatorsAuthentication { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureOperatorsAuthenticationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureOperatorsAuthenticationList) Get(i int) *AzureOperatorsAuthentication { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureOperatorsAuthenticationList) Slice() []*AzureOperatorsAuthentication { + var slice []*AzureOperatorsAuthentication + if l == nil { + slice = make([]*AzureOperatorsAuthentication, 0) + } else { + slice = make([]*AzureOperatorsAuthentication, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureOperatorsAuthenticationList) Each(f func(item *AzureOperatorsAuthentication) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureOperatorsAuthenticationList) Range(f func(index int, item *AzureOperatorsAuthentication) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/azure_operators_authentication_type_json.go b/clientapi/arohcp/v1alpha1/azure_operators_authentication_type_json.go new file mode 100644 index 00000000..337106a0 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_operators_authentication_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalAzureOperatorsAuthentication writes a value of the 'azure_operators_authentication' type to the given writer. +func MarshalAzureOperatorsAuthentication(object *AzureOperatorsAuthentication, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureOperatorsAuthentication(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureOperatorsAuthentication writes a value of the 'azure_operators_authentication' type to the given stream. +func WriteAzureOperatorsAuthentication(object *AzureOperatorsAuthentication, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.managedIdentities != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_identities") + WriteAzureOperatorsAuthenticationManagedIdentities(object.managedIdentities, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureOperatorsAuthentication reads a value of the 'azure_operators_authentication' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureOperatorsAuthentication(source interface{}) (object *AzureOperatorsAuthentication, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureOperatorsAuthentication(iterator) + err = iterator.Error + return +} + +// ReadAzureOperatorsAuthentication reads a value of the 'azure_operators_authentication' type from the given iterator. +func ReadAzureOperatorsAuthentication(iterator *jsoniter.Iterator) *AzureOperatorsAuthentication { + object := &AzureOperatorsAuthentication{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "managed_identities": + value := ReadAzureOperatorsAuthenticationManagedIdentities(iterator) + object.managedIdentities = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/azure_service_managed_identity_builder.go b/clientapi/arohcp/v1alpha1/azure_service_managed_identity_builder.go new file mode 100644 index 00000000..9c9984b9 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_service_managed_identity_builder.go @@ -0,0 +1,84 @@ +/* +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 + +// AzureServiceManagedIdentityBuilder contains the data and logic needed to build 'azure_service_managed_identity' objects. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity whose purpose is to perform service level actions. +type AzureServiceManagedIdentityBuilder struct { + bitmap_ uint32 + clientID string + principalID string + resourceID string +} + +// NewAzureServiceManagedIdentity creates a new builder of 'azure_service_managed_identity' objects. +func NewAzureServiceManagedIdentity() *AzureServiceManagedIdentityBuilder { + return &AzureServiceManagedIdentityBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureServiceManagedIdentityBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ClientID sets the value of the 'client_ID' attribute to the given value. +func (b *AzureServiceManagedIdentityBuilder) ClientID(value string) *AzureServiceManagedIdentityBuilder { + b.clientID = value + b.bitmap_ |= 1 + return b +} + +// PrincipalID sets the value of the 'principal_ID' attribute to the given value. +func (b *AzureServiceManagedIdentityBuilder) PrincipalID(value string) *AzureServiceManagedIdentityBuilder { + b.principalID = value + b.bitmap_ |= 2 + return b +} + +// ResourceID sets the value of the 'resource_ID' attribute to the given value. +func (b *AzureServiceManagedIdentityBuilder) ResourceID(value string) *AzureServiceManagedIdentityBuilder { + b.resourceID = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureServiceManagedIdentityBuilder) Copy(object *AzureServiceManagedIdentity) *AzureServiceManagedIdentityBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.clientID = object.clientID + b.principalID = object.principalID + b.resourceID = object.resourceID + return b +} + +// Build creates a 'azure_service_managed_identity' object using the configuration stored in the builder. +func (b *AzureServiceManagedIdentityBuilder) Build() (object *AzureServiceManagedIdentity, err error) { + object = new(AzureServiceManagedIdentity) + object.bitmap_ = b.bitmap_ + object.clientID = b.clientID + object.principalID = b.principalID + object.resourceID = b.resourceID + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_service_managed_identity_list_builder.go b/clientapi/arohcp/v1alpha1/azure_service_managed_identity_list_builder.go new file mode 100644 index 00000000..cb2f4808 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_service_managed_identity_list_builder.go @@ -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 + +// AzureServiceManagedIdentityListBuilder contains the data and logic needed to build +// 'azure_service_managed_identity' objects. +type AzureServiceManagedIdentityListBuilder struct { + items []*AzureServiceManagedIdentityBuilder +} + +// NewAzureServiceManagedIdentityList creates a new builder of 'azure_service_managed_identity' objects. +func NewAzureServiceManagedIdentityList() *AzureServiceManagedIdentityListBuilder { + return new(AzureServiceManagedIdentityListBuilder) +} + +// Items sets the items of the list. +func (b *AzureServiceManagedIdentityListBuilder) Items(values ...*AzureServiceManagedIdentityBuilder) *AzureServiceManagedIdentityListBuilder { + b.items = make([]*AzureServiceManagedIdentityBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureServiceManagedIdentityListBuilder) 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 *AzureServiceManagedIdentityListBuilder) Copy(list *AzureServiceManagedIdentityList) *AzureServiceManagedIdentityListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureServiceManagedIdentityBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureServiceManagedIdentity().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_service_managed_identity' objects using the +// configuration stored in the builder. +func (b *AzureServiceManagedIdentityListBuilder) Build() (list *AzureServiceManagedIdentityList, err error) { + items := make([]*AzureServiceManagedIdentity, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureServiceManagedIdentityList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/azure_service_managed_identity_list_type_json.go b/clientapi/arohcp/v1alpha1/azure_service_managed_identity_list_type_json.go new file mode 100644 index 00000000..0e6dd756 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_service_managed_identity_list_type_json.go @@ -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" +) + +// MarshalAzureServiceManagedIdentityList writes a list of values of the 'azure_service_managed_identity' type to +// the given writer. +func MarshalAzureServiceManagedIdentityList(list []*AzureServiceManagedIdentity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureServiceManagedIdentityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureServiceManagedIdentityList writes a list of value of the 'azure_service_managed_identity' type to +// the given stream. +func WriteAzureServiceManagedIdentityList(list []*AzureServiceManagedIdentity, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureServiceManagedIdentity(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureServiceManagedIdentityList reads a list of values of the 'azure_service_managed_identity' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureServiceManagedIdentityList(source interface{}) (items []*AzureServiceManagedIdentity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureServiceManagedIdentityList(iterator) + err = iterator.Error + return +} + +// ReadAzureServiceManagedIdentityList reads list of values of the ”azure_service_managed_identity' type from +// the given iterator. +func ReadAzureServiceManagedIdentityList(iterator *jsoniter.Iterator) []*AzureServiceManagedIdentity { + list := []*AzureServiceManagedIdentity{} + for iterator.ReadArray() { + item := ReadAzureServiceManagedIdentity(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/azure_service_managed_identity_type.go b/clientapi/arohcp/v1alpha1/azure_service_managed_identity_type.go new file mode 100644 index 00000000..7869d0ab --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_service_managed_identity_type.go @@ -0,0 +1,244 @@ +/* +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 + +// AzureServiceManagedIdentity represents the values of the 'azure_service_managed_identity' type. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity whose purpose is to perform service level actions. +type AzureServiceManagedIdentity struct { + bitmap_ uint32 + clientID string + principalID string + resourceID string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureServiceManagedIdentity) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ClientID returns the value of the 'client_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Client ID associated to the Azure User-Assigned Managed Identity. +// Readonly. +func (o *AzureServiceManagedIdentity) ClientID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.clientID + } + return "" +} + +// GetClientID returns the value of the 'client_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Client ID associated to the Azure User-Assigned Managed Identity. +// Readonly. +func (o *AzureServiceManagedIdentity) GetClientID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.clientID + } + return +} + +// PrincipalID returns the value of the 'principal_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Principal ID associated to the Azure User-Assigned Managed Identity. +// Readonly. +func (o *AzureServiceManagedIdentity) PrincipalID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.principalID + } + return "" +} + +// GetPrincipalID returns the value of the 'principal_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Principal ID associated to the Azure User-Assigned Managed Identity. +// Readonly. +func (o *AzureServiceManagedIdentity) GetPrincipalID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.principalID + } + return +} + +// ResourceID returns the value of the 'resource_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource ID of the Azure User-Assigned Managed +// Identity. The managed identity represented must exist before +// creating the cluster. +// The Azure Resource Group Name specified as part of the Resource ID +// must belong to the Azure Subscription specified in `.azure.subscription_id`, +// and in the same Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of the Resource ID +// must be a different Resource Group Name than the one specified in +// `.azure.managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the Resource ID +// can be the same, or a different one than the one specified in +// `.azure.resource_group_name`. +// Required during creation. +// Immutable. +func (o *AzureServiceManagedIdentity) ResourceID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.resourceID + } + return "" +} + +// GetResourceID returns the value of the 'resource_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource ID of the Azure User-Assigned Managed +// Identity. The managed identity represented must exist before +// creating the cluster. +// The Azure Resource Group Name specified as part of the Resource ID +// must belong to the Azure Subscription specified in `.azure.subscription_id`, +// and in the same Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of the Resource ID +// must be a different Resource Group Name than the one specified in +// `.azure.managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the Resource ID +// can be the same, or a different one than the one specified in +// `.azure.resource_group_name`. +// Required during creation. +// Immutable. +func (o *AzureServiceManagedIdentity) GetResourceID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.resourceID + } + return +} + +// AzureServiceManagedIdentityListKind is the name of the type used to represent list of objects of +// type 'azure_service_managed_identity'. +const AzureServiceManagedIdentityListKind = "AzureServiceManagedIdentityList" + +// AzureServiceManagedIdentityListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_service_managed_identity'. +const AzureServiceManagedIdentityListLinkKind = "AzureServiceManagedIdentityListLink" + +// AzureServiceManagedIdentityNilKind is the name of the type used to nil lists of objects of +// type 'azure_service_managed_identity'. +const AzureServiceManagedIdentityListNilKind = "AzureServiceManagedIdentityListNil" + +// AzureServiceManagedIdentityList is a list of values of the 'azure_service_managed_identity' type. +type AzureServiceManagedIdentityList struct { + href string + link bool + items []*AzureServiceManagedIdentity +} + +// Len returns the length of the list. +func (l *AzureServiceManagedIdentityList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureServiceManagedIdentityList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureServiceManagedIdentityList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureServiceManagedIdentityList) SetItems(items []*AzureServiceManagedIdentity) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureServiceManagedIdentityList) Items() []*AzureServiceManagedIdentity { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureServiceManagedIdentityList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureServiceManagedIdentityList) Get(i int) *AzureServiceManagedIdentity { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureServiceManagedIdentityList) Slice() []*AzureServiceManagedIdentity { + var slice []*AzureServiceManagedIdentity + if l == nil { + slice = make([]*AzureServiceManagedIdentity, 0) + } else { + slice = make([]*AzureServiceManagedIdentity, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureServiceManagedIdentityList) Each(f func(item *AzureServiceManagedIdentity) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureServiceManagedIdentityList) Range(f func(index int, item *AzureServiceManagedIdentity) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/azure_service_managed_identity_type_json.go b/clientapi/arohcp/v1alpha1/azure_service_managed_identity_type_json.go new file mode 100644 index 00000000..7d393572 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_service_managed_identity_type_json.go @@ -0,0 +1,112 @@ +/* +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" +) + +// MarshalAzureServiceManagedIdentity writes a value of the 'azure_service_managed_identity' type to the given writer. +func MarshalAzureServiceManagedIdentity(object *AzureServiceManagedIdentity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureServiceManagedIdentity(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureServiceManagedIdentity writes a value of the 'azure_service_managed_identity' type to the given stream. +func WriteAzureServiceManagedIdentity(object *AzureServiceManagedIdentity, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_id") + stream.WriteString(object.clientID) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("principal_id") + stream.WriteString(object.principalID) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_id") + stream.WriteString(object.resourceID) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureServiceManagedIdentity reads a value of the 'azure_service_managed_identity' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureServiceManagedIdentity(source interface{}) (object *AzureServiceManagedIdentity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureServiceManagedIdentity(iterator) + err = iterator.Error + return +} + +// ReadAzureServiceManagedIdentity reads a value of the 'azure_service_managed_identity' type from the given iterator. +func ReadAzureServiceManagedIdentity(iterator *jsoniter.Iterator) *AzureServiceManagedIdentity { + object := &AzureServiceManagedIdentity{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "client_id": + value := iterator.ReadString() + object.clientID = value + object.bitmap_ |= 1 + case "principal_id": + value := iterator.ReadString() + object.principalID = value + object.bitmap_ |= 2 + case "resource_id": + value := iterator.ReadString() + object.resourceID = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/azure_type.go b/clientapi/arohcp/v1alpha1/azure_type.go new file mode 100644 index 00000000..7a813e71 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_type.go @@ -0,0 +1,485 @@ +/* +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 + +// Azure represents the values of the 'azure' type. +// +// Microsoft Azure settings of a cluster. +type Azure struct { + bitmap_ uint32 + managedResourceGroupName string + networkSecurityGroupResourceID string + nodesOutboundConnectivity *AzureNodesOutboundConnectivity + operatorsAuthentication *AzureOperatorsAuthentication + resourceGroupName string + resourceName string + subnetResourceID string + subscriptionID string + tenantID string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Azure) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ManagedResourceGroupName returns the value of the 'managed_resource_group_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The desired name of the Azure Resource Group where the Azure Resources related +// to the cluster are created. It must not previously exist. The Azure Resource +// Group is created with the given value, within the Azure Subscription +// `subscription_id` of the cluster. +// `managed_resource_group_name` cannot be equal to the value of `managed_resource_group`. +// `managed_resource_group_name` is located in the same Azure location as the +// cluster's region. +// Not to be confused with `resource_group_name`, which is the Azure Resource Group Name +// where the own Azure Resource associated to the cluster resides. +// Required during creation. +// Immutable. +func (o *Azure) ManagedResourceGroupName() string { + if o != nil && o.bitmap_&1 != 0 { + return o.managedResourceGroupName + } + return "" +} + +// GetManagedResourceGroupName returns the value of the 'managed_resource_group_name' attribute and +// a flag indicating if the attribute has a value. +// +// The desired name of the Azure Resource Group where the Azure Resources related +// to the cluster are created. It must not previously exist. The Azure Resource +// Group is created with the given value, within the Azure Subscription +// `subscription_id` of the cluster. +// `managed_resource_group_name` cannot be equal to the value of `managed_resource_group`. +// `managed_resource_group_name` is located in the same Azure location as the +// cluster's region. +// Not to be confused with `resource_group_name`, which is the Azure Resource Group Name +// where the own Azure Resource associated to the cluster resides. +// Required during creation. +// Immutable. +func (o *Azure) GetManagedResourceGroupName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.managedResourceGroupName + } + return +} + +// NetworkSecurityGroupResourceID returns the value of the 'network_security_group_resource_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource ID of a pre-existing Azure Network Security Group. +// The Network Security Group specified in network_security_group_resource_id +// must already be associated to the Azure Subnet `subnet_resource_id`. +// It is the Azure Network Security Group associated to the cluster's subnet +// specified in `subnet_resource_id`. +// `network_security_group_resource_id` must be located in the same Azure +// location as the cluster's region. +// The Azure Subscription specified as part of +// `network_security_group_resource_id` must be located in the same Azure +// Subscription as `subscription_id`. +// The Azure Resource Group Name specified as part of `network_security_group_resource_id` +// must belong to the Azure Subscription `subscription_id`, and in the same +// Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of `network_security_group_resource_id` +// must be a different Resource Group Name than the one specified in +// `managed_resource_group_name`. +// The Azure Resource Group Name specified as part of `network_security_group_resource_id` +// can be the same, or a different one than the one specified in +// `resource_group_name`. +// Required during creation. +// Immutable. +func (o *Azure) NetworkSecurityGroupResourceID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.networkSecurityGroupResourceID + } + return "" +} + +// GetNetworkSecurityGroupResourceID returns the value of the 'network_security_group_resource_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource ID of a pre-existing Azure Network Security Group. +// The Network Security Group specified in network_security_group_resource_id +// must already be associated to the Azure Subnet `subnet_resource_id`. +// It is the Azure Network Security Group associated to the cluster's subnet +// specified in `subnet_resource_id`. +// `network_security_group_resource_id` must be located in the same Azure +// location as the cluster's region. +// The Azure Subscription specified as part of +// `network_security_group_resource_id` must be located in the same Azure +// Subscription as `subscription_id`. +// The Azure Resource Group Name specified as part of `network_security_group_resource_id` +// must belong to the Azure Subscription `subscription_id`, and in the same +// Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of `network_security_group_resource_id` +// must be a different Resource Group Name than the one specified in +// `managed_resource_group_name`. +// The Azure Resource Group Name specified as part of `network_security_group_resource_id` +// can be the same, or a different one than the one specified in +// `resource_group_name`. +// Required during creation. +// Immutable. +func (o *Azure) GetNetworkSecurityGroupResourceID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.networkSecurityGroupResourceID + } + return +} + +// NodesOutboundConnectivity returns the value of the 'nodes_outbound_connectivity' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// NodesOutboundConnectivity defines how the network outbound +// configuration of the Cluster's Node Pool's Nodes is performed. +// By default this is configured as Azure Load Balancer. This value is immutable. +func (o *Azure) NodesOutboundConnectivity() *AzureNodesOutboundConnectivity { + if o != nil && o.bitmap_&4 != 0 { + return o.nodesOutboundConnectivity + } + return nil +} + +// GetNodesOutboundConnectivity returns the value of the 'nodes_outbound_connectivity' attribute and +// a flag indicating if the attribute has a value. +// +// NodesOutboundConnectivity defines how the network outbound +// configuration of the Cluster's Node Pool's Nodes is performed. +// By default this is configured as Azure Load Balancer. This value is immutable. +func (o *Azure) GetNodesOutboundConnectivity() (value *AzureNodesOutboundConnectivity, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.nodesOutboundConnectivity + } + return +} + +// OperatorsAuthentication returns the value of the 'operators_authentication' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines how the operators of the cluster authenticate to Azure. +// Required during creation. +// Immutable. +func (o *Azure) OperatorsAuthentication() *AzureOperatorsAuthentication { + if o != nil && o.bitmap_&8 != 0 { + return o.operatorsAuthentication + } + return nil +} + +// GetOperatorsAuthentication returns the value of the 'operators_authentication' attribute and +// a flag indicating if the attribute has a value. +// +// Defines how the operators of the cluster authenticate to Azure. +// Required during creation. +// Immutable. +func (o *Azure) GetOperatorsAuthentication() (value *AzureOperatorsAuthentication, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.operatorsAuthentication + } + return +} + +// ResourceGroupName returns the value of the 'resource_group_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource Group Name of the cluster. It must be a pre-existing +// Azure Resource Group and it must exist within the Azure Subscription +// `subscription_id` of the cluster. +// `resource_group_name` is located in the same Azure location as the +// cluster's region. +// Required during creation. +// Immutable. +func (o *Azure) ResourceGroupName() string { + if o != nil && o.bitmap_&16 != 0 { + return o.resourceGroupName + } + return "" +} + +// GetResourceGroupName returns the value of the 'resource_group_name' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource Group Name of the cluster. It must be a pre-existing +// Azure Resource Group and it must exist within the Azure Subscription +// `subscription_id` of the cluster. +// `resource_group_name` is located in the same Azure location as the +// cluster's region. +// Required during creation. +// Immutable. +func (o *Azure) GetResourceGroupName() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.resourceGroupName + } + return +} + +// ResourceName returns the value of the 'resource_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource Name of the cluster. It must be within the +// Azure Resource Group Name `resource_group_name`. +// `resource_name` is located in the same Azure location as the cluster's region. +// Required during creation. +// Immutable. +func (o *Azure) ResourceName() string { + if o != nil && o.bitmap_&32 != 0 { + return o.resourceName + } + return "" +} + +// GetResourceName returns the value of the 'resource_name' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource Name of the cluster. It must be within the +// Azure Resource Group Name `resource_group_name`. +// `resource_name` is located in the same Azure location as the cluster's region. +// Required during creation. +// Immutable. +func (o *Azure) GetResourceName() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.resourceName + } + return +} + +// SubnetResourceID returns the value of the 'subnet_resource_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource ID of a pre-existing Azure Subnet. It is an Azure +// Subnet used for the Data Plane of the cluster. `subnet_resource_id` +// must be located in the same Azure location as the cluster's region. +// The Azure Subscription specified as part of the `subnet_resource_id` +// must be located in the same Azure Subscription as `subscription_id`. +// The Azure Resource Group Name specified as part of `subnet_resource_id` +// must belong to the Azure Subscription `subscription_id`, and in the same +// Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of `subnet_resource_id` +// must be a different Resource Group Name than the one specified in +// `managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the `subnet_resource_id` +// can be the same, or a different one than the one specified in +// `resource_group_name`. +// Required during creation. +// Immutable. +func (o *Azure) SubnetResourceID() string { + if o != nil && o.bitmap_&64 != 0 { + return o.subnetResourceID + } + return "" +} + +// GetSubnetResourceID returns the value of the 'subnet_resource_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource ID of a pre-existing Azure Subnet. It is an Azure +// Subnet used for the Data Plane of the cluster. `subnet_resource_id` +// must be located in the same Azure location as the cluster's region. +// The Azure Subscription specified as part of the `subnet_resource_id` +// must be located in the same Azure Subscription as `subscription_id`. +// The Azure Resource Group Name specified as part of `subnet_resource_id` +// must belong to the Azure Subscription `subscription_id`, and in the same +// Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of `subnet_resource_id` +// must be a different Resource Group Name than the one specified in +// `managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the `subnet_resource_id` +// can be the same, or a different one than the one specified in +// `resource_group_name`. +// Required during creation. +// Immutable. +func (o *Azure) GetSubnetResourceID() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.subnetResourceID + } + return +} + +// SubscriptionID returns the value of the 'subscription_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Subscription ID associated with the cluster. It must belong to +// the Microsoft Entra Tenant ID `tenant_id`. +// Required during creation. +// Immutable. +func (o *Azure) SubscriptionID() string { + if o != nil && o.bitmap_&128 != 0 { + return o.subscriptionID + } + return "" +} + +// GetSubscriptionID returns the value of the 'subscription_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Subscription ID associated with the cluster. It must belong to +// the Microsoft Entra Tenant ID `tenant_id`. +// Required during creation. +// Immutable. +func (o *Azure) GetSubscriptionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.subscriptionID + } + return +} + +// TenantID returns the value of the 'tenant_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Microsoft Entra Tenant ID where the cluster belongs. +// Required during creation. +// Immutable. +func (o *Azure) TenantID() string { + if o != nil && o.bitmap_&256 != 0 { + return o.tenantID + } + return "" +} + +// GetTenantID returns the value of the 'tenant_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Microsoft Entra Tenant ID where the cluster belongs. +// Required during creation. +// Immutable. +func (o *Azure) GetTenantID() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.tenantID + } + return +} + +// AzureListKind is the name of the type used to represent list of objects of +// type 'azure'. +const AzureListKind = "AzureList" + +// AzureListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure'. +const AzureListLinkKind = "AzureListLink" + +// AzureNilKind is the name of the type used to nil lists of objects of +// type 'azure'. +const AzureListNilKind = "AzureListNil" + +// AzureList is a list of values of the 'azure' type. +type AzureList struct { + href string + link bool + items []*Azure +} + +// Len returns the length of the list. +func (l *AzureList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureList) SetItems(items []*Azure) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureList) Items() []*Azure { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureList) Get(i int) *Azure { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureList) Slice() []*Azure { + var slice []*Azure + if l == nil { + slice = make([]*Azure, 0) + } else { + slice = make([]*Azure, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureList) Each(f func(item *Azure) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureList) Range(f func(index int, item *Azure) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/azure_type_json.go b/clientapi/arohcp/v1alpha1/azure_type_json.go new file mode 100644 index 00000000..da554a28 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/azure_type_json.go @@ -0,0 +1,190 @@ +/* +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" +) + +// MarshalAzure writes a value of the 'azure' type to the given writer. +func MarshalAzure(object *Azure, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzure(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzure writes a value of the 'azure' type to the given stream. +func WriteAzure(object *Azure, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_resource_group_name") + stream.WriteString(object.managedResourceGroupName) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("network_security_group_resource_id") + stream.WriteString(object.networkSecurityGroupResourceID) + count++ + } + present_ = object.bitmap_&4 != 0 && object.nodesOutboundConnectivity != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("nodes_outbound_connectivity") + WriteAzureNodesOutboundConnectivity(object.nodesOutboundConnectivity, stream) + count++ + } + present_ = object.bitmap_&8 != 0 && object.operatorsAuthentication != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operators_authentication") + WriteAzureOperatorsAuthentication(object.operatorsAuthentication, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_group_name") + stream.WriteString(object.resourceGroupName) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_name") + stream.WriteString(object.resourceName) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnet_resource_id") + stream.WriteString(object.subnetResourceID) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionID) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("tenant_id") + stream.WriteString(object.tenantID) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzure reads a value of the 'azure' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzure(source interface{}) (object *Azure, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzure(iterator) + err = iterator.Error + return +} + +// ReadAzure reads a value of the 'azure' type from the given iterator. +func ReadAzure(iterator *jsoniter.Iterator) *Azure { + object := &Azure{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "managed_resource_group_name": + value := iterator.ReadString() + object.managedResourceGroupName = value + object.bitmap_ |= 1 + case "network_security_group_resource_id": + value := iterator.ReadString() + object.networkSecurityGroupResourceID = value + object.bitmap_ |= 2 + case "nodes_outbound_connectivity": + value := ReadAzureNodesOutboundConnectivity(iterator) + object.nodesOutboundConnectivity = value + object.bitmap_ |= 4 + case "operators_authentication": + value := ReadAzureOperatorsAuthentication(iterator) + object.operatorsAuthentication = value + object.bitmap_ |= 8 + case "resource_group_name": + value := iterator.ReadString() + object.resourceGroupName = value + object.bitmap_ |= 16 + case "resource_name": + value := iterator.ReadString() + object.resourceName = value + object.bitmap_ |= 32 + case "subnet_resource_id": + value := iterator.ReadString() + object.subnetResourceID = value + object.bitmap_ |= 64 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionID = value + object.bitmap_ |= 128 + case "tenant_id": + value := iterator.ReadString() + object.tenantID = value + object.bitmap_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/billing_model_list_type_json.go b/clientapi/arohcp/v1alpha1/billing_model_list_type_json.go new file mode 100644 index 00000000..80a19451 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/billing_model_list_type_json.go @@ -0,0 +1,76 @@ +/* +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" +) + +// MarshalBillingModelList writes a list of values of the 'billing_model' type to +// the given writer. +func MarshalBillingModelList(list []BillingModel, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBillingModelList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBillingModelList writes a list of value of the 'billing_model' type to +// the given stream. +func WriteBillingModelList(list []BillingModel, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalBillingModelList reads a list of values of the 'billing_model' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBillingModelList(source interface{}) (items []BillingModel, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBillingModelList(iterator) + err = iterator.Error + return +} + +// ReadBillingModelList reads list of values of the ”billing_model' type from +// the given iterator. +func ReadBillingModelList(iterator *jsoniter.Iterator) []BillingModel { + list := []BillingModel{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := BillingModel(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/billing_model_type.go b/clientapi/arohcp/v1alpha1/billing_model_type.go new file mode 100644 index 00000000..85581095 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/billing_model_type.go @@ -0,0 +1,38 @@ +/* +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 + +// BillingModel represents the values of the 'billing_model' enumerated type. +type BillingModel string + +const ( + // BillingModel Marketplace Legacy Marketplace billing model. Currently only used for tests. Use cloud-provider specific billing models instead. + BillingModelMarketplace BillingModel = "marketplace" + // AWS Marketplace billing model. + BillingModelMarketplaceAWS BillingModel = "marketplace-aws" + // GCP Marketplace billing model. + BillingModelMarketplaceGCP BillingModel = "marketplace-gcp" + // RH Marketplace billing model. + BillingModelMarketplaceRHM BillingModel = "marketplace-rhm" + // Azure Marketplace billing model. + BillingModelMarketplaceAzure BillingModel = "marketplace-azure" + // Standard. This is the default billing model + BillingModelStandard BillingModel = "standard" +) diff --git a/clientapi/arohcp/v1alpha1/boolean_list_type_json.go b/clientapi/arohcp/v1alpha1/boolean_list_type_json.go new file mode 100644 index 00000000..8363fe57 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/boolean_list_type_json.go @@ -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" +) + +// MarshalBooleanList writes a list of values of the 'boolean' type to +// the given writer. +func MarshalBooleanList(list []bool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBooleanList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBooleanList writes a list of value of the 'boolean' type to +// the given stream. +func WriteBooleanList(list []bool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteBool(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalBooleanList reads a list of values of the 'boolean' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBooleanList(source interface{}) (items []bool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBooleanList(iterator) + err = iterator.Error + return +} + +// ReadBooleanList reads list of values of the ”boolean' type from +// the given iterator. +func ReadBooleanList(iterator *jsoniter.Iterator) []bool { + list := []bool{} + for iterator.ReadArray() { + item := iterator.ReadBool() + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/byo_oidc_builder.go b/clientapi/arohcp/v1alpha1/byo_oidc_builder.go new file mode 100644 index 00000000..c2a93738 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/byo_oidc_builder.go @@ -0,0 +1,63 @@ +/* +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 + +// ByoOidcBuilder contains the data and logic needed to build 'byo_oidc' objects. +// +// ByoOidc configuration. +type ByoOidcBuilder struct { + bitmap_ uint32 + enabled bool +} + +// NewByoOidc creates a new builder of 'byo_oidc' objects. +func NewByoOidc() *ByoOidcBuilder { + return &ByoOidcBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ByoOidcBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *ByoOidcBuilder) Enabled(value bool) *ByoOidcBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ByoOidcBuilder) Copy(object *ByoOidc) *ByoOidcBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + return b +} + +// Build creates a 'byo_oidc' object using the configuration stored in the builder. +func (b *ByoOidcBuilder) Build() (object *ByoOidc, err error) { + object = new(ByoOidc) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + return +} diff --git a/clientapi/arohcp/v1alpha1/byo_oidc_list_builder.go b/clientapi/arohcp/v1alpha1/byo_oidc_list_builder.go new file mode 100644 index 00000000..5a8e81d2 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/byo_oidc_list_builder.go @@ -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 + +// ByoOidcListBuilder contains the data and logic needed to build +// 'byo_oidc' objects. +type ByoOidcListBuilder struct { + items []*ByoOidcBuilder +} + +// NewByoOidcList creates a new builder of 'byo_oidc' objects. +func NewByoOidcList() *ByoOidcListBuilder { + return new(ByoOidcListBuilder) +} + +// Items sets the items of the list. +func (b *ByoOidcListBuilder) Items(values ...*ByoOidcBuilder) *ByoOidcListBuilder { + b.items = make([]*ByoOidcBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ByoOidcListBuilder) 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 *ByoOidcListBuilder) Copy(list *ByoOidcList) *ByoOidcListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ByoOidcBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewByoOidc().Copy(v) + } + } + return b +} + +// Build creates a list of 'byo_oidc' objects using the +// configuration stored in the builder. +func (b *ByoOidcListBuilder) Build() (list *ByoOidcList, err error) { + items := make([]*ByoOidc, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ByoOidcList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/byo_oidc_list_type_json.go b/clientapi/arohcp/v1alpha1/byo_oidc_list_type_json.go new file mode 100644 index 00000000..239d8680 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/byo_oidc_list_type_json.go @@ -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" +) + +// MarshalByoOidcList writes a list of values of the 'byo_oidc' type to +// the given writer. +func MarshalByoOidcList(list []*ByoOidc, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteByoOidcList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteByoOidcList writes a list of value of the 'byo_oidc' type to +// the given stream. +func WriteByoOidcList(list []*ByoOidc, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteByoOidc(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalByoOidcList reads a list of values of the 'byo_oidc' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalByoOidcList(source interface{}) (items []*ByoOidc, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadByoOidcList(iterator) + err = iterator.Error + return +} + +// ReadByoOidcList reads list of values of the ”byo_oidc' type from +// the given iterator. +func ReadByoOidcList(iterator *jsoniter.Iterator) []*ByoOidc { + list := []*ByoOidc{} + for iterator.ReadArray() { + item := ReadByoOidc(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/byo_oidc_type.go b/clientapi/arohcp/v1alpha1/byo_oidc_type.go new file mode 100644 index 00000000..7b369e28 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/byo_oidc_type.go @@ -0,0 +1,175 @@ +/* +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 + +// ByoOidc represents the values of the 'byo_oidc' type. +// +// ByoOidc configuration. +type ByoOidc struct { + bitmap_ uint32 + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ByoOidc) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Boolean flag indicating if the cluster should be creating using _ByoOidc_. +// +// By default this is `false`. +// +// To enable it the cluster needs to be ROSA cluster and the organization of the user needs +// to have the `byo-oidc` feature toggle enabled. +func (o *ByoOidc) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Boolean flag indicating if the cluster should be creating using _ByoOidc_. +// +// By default this is `false`. +// +// To enable it the cluster needs to be ROSA cluster and the organization of the user needs +// to have the `byo-oidc` feature toggle enabled. +func (o *ByoOidc) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// ByoOidcListKind is the name of the type used to represent list of objects of +// type 'byo_oidc'. +const ByoOidcListKind = "ByoOidcList" + +// ByoOidcListLinkKind is the name of the type used to represent links to list +// of objects of type 'byo_oidc'. +const ByoOidcListLinkKind = "ByoOidcListLink" + +// ByoOidcNilKind is the name of the type used to nil lists of objects of +// type 'byo_oidc'. +const ByoOidcListNilKind = "ByoOidcListNil" + +// ByoOidcList is a list of values of the 'byo_oidc' type. +type ByoOidcList struct { + href string + link bool + items []*ByoOidc +} + +// Len returns the length of the list. +func (l *ByoOidcList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ByoOidcList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ByoOidcList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ByoOidcList) SetItems(items []*ByoOidc) { + l.items = items +} + +// Items returns the items of the list. +func (l *ByoOidcList) Items() []*ByoOidc { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ByoOidcList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ByoOidcList) Get(i int) *ByoOidc { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ByoOidcList) Slice() []*ByoOidc { + var slice []*ByoOidc + if l == nil { + slice = make([]*ByoOidc, 0) + } else { + slice = make([]*ByoOidc, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ByoOidcList) Each(f func(item *ByoOidc) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ByoOidcList) Range(f func(index int, item *ByoOidc) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/byo_oidc_type_json.go b/clientapi/arohcp/v1alpha1/byo_oidc_type_json.go new file mode 100644 index 00000000..092d3efb --- /dev/null +++ b/clientapi/arohcp/v1alpha1/byo_oidc_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalByoOidc writes a value of the 'byo_oidc' type to the given writer. +func MarshalByoOidc(object *ByoOidc, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteByoOidc(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteByoOidc writes a value of the 'byo_oidc' type to the given stream. +func WriteByoOidc(object *ByoOidc, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalByoOidc reads a value of the 'byo_oidc' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalByoOidc(source interface{}) (object *ByoOidc, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadByoOidc(iterator) + err = iterator.Error + return +} + +// ReadByoOidc reads a value of the 'byo_oidc' type from the given iterator. +func ReadByoOidc(iterator *jsoniter.Iterator) *ByoOidc { + object := &ByoOidc{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/ccs_builder.go b/clientapi/arohcp/v1alpha1/ccs_builder.go new file mode 100644 index 00000000..c61f5ddb --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ccs_builder.go @@ -0,0 +1,97 @@ +/* +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 + +// CCSBuilder contains the data and logic needed to build 'CCS' objects. +type CCSBuilder struct { + bitmap_ uint32 + id string + href string + disableSCPChecks bool + enabled bool +} + +// NewCCS creates a new builder of 'CCS' objects. +func NewCCS() *CCSBuilder { + return &CCSBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *CCSBuilder) Link(value bool) *CCSBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *CCSBuilder) ID(value string) *CCSBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *CCSBuilder) HREF(value string) *CCSBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CCSBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// DisableSCPChecks sets the value of the 'disable_SCP_checks' attribute to the given value. +func (b *CCSBuilder) DisableSCPChecks(value bool) *CCSBuilder { + b.disableSCPChecks = value + b.bitmap_ |= 8 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *CCSBuilder) Enabled(value bool) *CCSBuilder { + b.enabled = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CCSBuilder) Copy(object *CCS) *CCSBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.disableSCPChecks = object.disableSCPChecks + b.enabled = object.enabled + return b +} + +// Build creates a 'CCS' object using the configuration stored in the builder. +func (b *CCSBuilder) Build() (object *CCS, err error) { + object = new(CCS) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.disableSCPChecks = b.disableSCPChecks + object.enabled = b.enabled + return +} diff --git a/clientapi/arohcp/v1alpha1/ccs_list_builder.go b/clientapi/arohcp/v1alpha1/ccs_list_builder.go new file mode 100644 index 00000000..e162eef8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ccs_list_builder.go @@ -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 + +// CCSListBuilder contains the data and logic needed to build +// 'CCS' objects. +type CCSListBuilder struct { + items []*CCSBuilder +} + +// NewCCSList creates a new builder of 'CCS' objects. +func NewCCSList() *CCSListBuilder { + return new(CCSListBuilder) +} + +// Items sets the items of the list. +func (b *CCSListBuilder) Items(values ...*CCSBuilder) *CCSListBuilder { + b.items = make([]*CCSBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CCSListBuilder) 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 *CCSListBuilder) Copy(list *CCSList) *CCSListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CCSBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCCS().Copy(v) + } + } + return b +} + +// Build creates a list of 'CCS' objects using the +// configuration stored in the builder. +func (b *CCSListBuilder) Build() (list *CCSList, err error) { + items := make([]*CCS, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CCSList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/ccs_list_type_json.go b/clientapi/arohcp/v1alpha1/ccs_list_type_json.go new file mode 100644 index 00000000..dca75cef --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ccs_list_type_json.go @@ -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" +) + +// MarshalCCSList writes a list of values of the 'CCS' type to +// the given writer. +func MarshalCCSList(list []*CCS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCCSList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCCSList writes a list of value of the 'CCS' type to +// the given stream. +func WriteCCSList(list []*CCS, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCCS(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCCSList reads a list of values of the 'CCS' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCCSList(source interface{}) (items []*CCS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCCSList(iterator) + err = iterator.Error + return +} + +// ReadCCSList reads list of values of the ”CCS' type from +// the given iterator. +func ReadCCSList(iterator *jsoniter.Iterator) []*CCS { + list := []*CCS{} + for iterator.ReadArray() { + item := ReadCCS(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/ccs_type.go b/clientapi/arohcp/v1alpha1/ccs_type.go new file mode 100644 index 00000000..7733a1bb --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ccs_type.go @@ -0,0 +1,289 @@ +/* +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 + +// CCSKind is the name of the type used to represent objects +// of type 'CCS'. +const CCSKind = "CCS" + +// CCSLinkKind is the name of the type used to represent links +// to objects of type 'CCS'. +const CCSLinkKind = "CCSLink" + +// CCSNilKind is the name of the type used to nil references +// to objects of type 'CCS'. +const CCSNilKind = "CCSNil" + +// CCS represents the values of the 'CCS' type. +type CCS struct { + bitmap_ uint32 + id string + href string + disableSCPChecks bool + enabled bool +} + +// Kind returns the name of the type of the object. +func (o *CCS) Kind() string { + if o == nil { + return CCSNilKind + } + if o.bitmap_&1 != 0 { + return CCSLinkKind + } + return CCSKind +} + +// Link returns true if this is a link. +func (o *CCS) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *CCS) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *CCS) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *CCS) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *CCS) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CCS) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// DisableSCPChecks returns the value of the 'disable_SCP_checks' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if cloud permissions checks are disabled, +// when attempting installation of the cluster. +func (o *CCS) DisableSCPChecks() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.disableSCPChecks + } + return false +} + +// GetDisableSCPChecks returns the value of the 'disable_SCP_checks' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if cloud permissions checks are disabled, +// when attempting installation of the cluster. +func (o *CCS) GetDisableSCPChecks() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.disableSCPChecks + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if Customer Cloud Subscription is enabled on the cluster. +func (o *CCS) Enabled() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if Customer Cloud Subscription is enabled on the cluster. +func (o *CCS) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.enabled + } + return +} + +// CCSListKind is the name of the type used to represent list of objects of +// type 'CCS'. +const CCSListKind = "CCSList" + +// CCSListLinkKind is the name of the type used to represent links to list +// of objects of type 'CCS'. +const CCSListLinkKind = "CCSListLink" + +// CCSNilKind is the name of the type used to nil lists of objects of +// type 'CCS'. +const CCSListNilKind = "CCSListNil" + +// CCSList is a list of values of the 'CCS' type. +type CCSList struct { + href string + link bool + items []*CCS +} + +// Kind returns the name of the type of the object. +func (l *CCSList) Kind() string { + if l == nil { + return CCSListNilKind + } + if l.link { + return CCSListLinkKind + } + return CCSListKind +} + +// Link returns true iif this is a link. +func (l *CCSList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *CCSList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *CCSList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *CCSList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CCSList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CCSList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CCSList) SetItems(items []*CCS) { + l.items = items +} + +// Items returns the items of the list. +func (l *CCSList) Items() []*CCS { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CCSList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CCSList) Get(i int) *CCS { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CCSList) Slice() []*CCS { + var slice []*CCS + if l == nil { + slice = make([]*CCS, 0) + } else { + slice = make([]*CCS, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CCSList) Each(f func(item *CCS) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CCSList) Range(f func(index int, item *CCS) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/ccs_type_json.go b/clientapi/arohcp/v1alpha1/ccs_type_json.go new file mode 100644 index 00000000..7e64fdf1 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ccs_type_json.go @@ -0,0 +1,133 @@ +/* +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" +) + +// MarshalCCS writes a value of the 'CCS' type to the given writer. +func MarshalCCS(object *CCS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCCS(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCCS writes a value of the 'CCS' type to the given stream. +func WriteCCS(object *CCS, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(CCSLinkKind) + } else { + stream.WriteString(CCSKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("disable_scp_checks") + stream.WriteBool(object.disableSCPChecks) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalCCS reads a value of the 'CCS' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCCS(source interface{}) (object *CCS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCCS(iterator) + err = iterator.Error + return +} + +// ReadCCS reads a value of the 'CCS' type from the given iterator. +func ReadCCS(iterator *jsoniter.Iterator) *CCS { + object := &CCS{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == CCSLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "disable_scp_checks": + value := iterator.ReadBool() + object.disableSCPChecks = value + object.bitmap_ |= 8 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/cloud_provider_builder.go b/clientapi/arohcp/v1alpha1/cloud_provider_builder.go new file mode 100644 index 00000000..0181bd8c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cloud_provider_builder.go @@ -0,0 +1,125 @@ +/* +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 + +// CloudProviderBuilder contains the data and logic needed to build 'cloud_provider' objects. +// +// Cloud provider. +type CloudProviderBuilder struct { + bitmap_ uint32 + id string + href string + displayName string + name string + regions []*CloudRegionBuilder +} + +// NewCloudProvider creates a new builder of 'cloud_provider' objects. +func NewCloudProvider() *CloudProviderBuilder { + return &CloudProviderBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *CloudProviderBuilder) Link(value bool) *CloudProviderBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *CloudProviderBuilder) ID(value string) *CloudProviderBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *CloudProviderBuilder) HREF(value string) *CloudProviderBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CloudProviderBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *CloudProviderBuilder) DisplayName(value string) *CloudProviderBuilder { + b.displayName = value + b.bitmap_ |= 8 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *CloudProviderBuilder) Name(value string) *CloudProviderBuilder { + b.name = value + b.bitmap_ |= 16 + return b +} + +// Regions sets the value of the 'regions' attribute to the given values. +func (b *CloudProviderBuilder) Regions(values ...*CloudRegionBuilder) *CloudProviderBuilder { + b.regions = make([]*CloudRegionBuilder, len(values)) + copy(b.regions, values) + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CloudProviderBuilder) Copy(object *CloudProvider) *CloudProviderBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.displayName = object.displayName + b.name = object.name + if object.regions != nil { + b.regions = make([]*CloudRegionBuilder, len(object.regions)) + for i, v := range object.regions { + b.regions[i] = NewCloudRegion().Copy(v) + } + } else { + b.regions = nil + } + return b +} + +// Build creates a 'cloud_provider' object using the configuration stored in the builder. +func (b *CloudProviderBuilder) Build() (object *CloudProvider, err error) { + object = new(CloudProvider) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.displayName = b.displayName + object.name = b.name + if b.regions != nil { + object.regions = make([]*CloudRegion, len(b.regions)) + for i, v := range b.regions { + object.regions[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/cloud_provider_list_builder.go b/clientapi/arohcp/v1alpha1/cloud_provider_list_builder.go new file mode 100644 index 00000000..512b69e2 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cloud_provider_list_builder.go @@ -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 + +// CloudProviderListBuilder contains the data and logic needed to build +// 'cloud_provider' objects. +type CloudProviderListBuilder struct { + items []*CloudProviderBuilder +} + +// NewCloudProviderList creates a new builder of 'cloud_provider' objects. +func NewCloudProviderList() *CloudProviderListBuilder { + return new(CloudProviderListBuilder) +} + +// Items sets the items of the list. +func (b *CloudProviderListBuilder) Items(values ...*CloudProviderBuilder) *CloudProviderListBuilder { + b.items = make([]*CloudProviderBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CloudProviderListBuilder) 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 *CloudProviderListBuilder) Copy(list *CloudProviderList) *CloudProviderListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CloudProviderBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCloudProvider().Copy(v) + } + } + return b +} + +// Build creates a list of 'cloud_provider' objects using the +// configuration stored in the builder. +func (b *CloudProviderListBuilder) Build() (list *CloudProviderList, err error) { + items := make([]*CloudProvider, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CloudProviderList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/cloud_provider_list_type_json.go b/clientapi/arohcp/v1alpha1/cloud_provider_list_type_json.go new file mode 100644 index 00000000..9970059b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cloud_provider_list_type_json.go @@ -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" +) + +// MarshalCloudProviderList writes a list of values of the 'cloud_provider' type to +// the given writer. +func MarshalCloudProviderList(list []*CloudProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudProviderList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudProviderList writes a list of value of the 'cloud_provider' type to +// the given stream. +func WriteCloudProviderList(list []*CloudProvider, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCloudProvider(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCloudProviderList reads a list of values of the 'cloud_provider' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCloudProviderList(source interface{}) (items []*CloudProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCloudProviderList(iterator) + err = iterator.Error + return +} + +// ReadCloudProviderList reads list of values of the ”cloud_provider' type from +// the given iterator. +func ReadCloudProviderList(iterator *jsoniter.Iterator) []*CloudProvider { + list := []*CloudProvider{} + for iterator.ReadArray() { + item := ReadCloudProvider(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/cloud_provider_type.go b/clientapi/arohcp/v1alpha1/cloud_provider_type.go new file mode 100644 index 00000000..513c7370 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cloud_provider_type.go @@ -0,0 +1,315 @@ +/* +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 + +// CloudProviderKind is the name of the type used to represent objects +// of type 'cloud_provider'. +const CloudProviderKind = "CloudProvider" + +// CloudProviderLinkKind is the name of the type used to represent links +// to objects of type 'cloud_provider'. +const CloudProviderLinkKind = "CloudProviderLink" + +// CloudProviderNilKind is the name of the type used to nil references +// to objects of type 'cloud_provider'. +const CloudProviderNilKind = "CloudProviderNil" + +// CloudProvider represents the values of the 'cloud_provider' type. +// +// Cloud provider. +type CloudProvider struct { + bitmap_ uint32 + id string + href string + displayName string + name string + regions []*CloudRegion +} + +// Kind returns the name of the type of the object. +func (o *CloudProvider) Kind() string { + if o == nil { + return CloudProviderNilKind + } + if o.bitmap_&1 != 0 { + return CloudProviderLinkKind + } + return CloudProviderKind +} + +// Link returns true if this is a link. +func (o *CloudProvider) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *CloudProvider) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *CloudProvider) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *CloudProvider) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *CloudProvider) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CloudProvider) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the cloud provider for display purposes. It can contain any characters, +// including spaces. +func (o *CloudProvider) DisplayName() string { + if o != nil && o.bitmap_&8 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the cloud provider for display purposes. It can contain any characters, +// including spaces. +func (o *CloudProvider) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.displayName + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Human friendly identifier of the cloud provider, for example `aws`. +func (o *CloudProvider) Name() string { + if o != nil && o.bitmap_&16 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Human friendly identifier of the cloud provider, for example `aws`. +func (o *CloudProvider) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.name + } + return +} + +// Regions returns the value of the 'regions' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// (optional) Provider's regions - only included when listing providers with `fetchRegions=true`. +func (o *CloudProvider) Regions() []*CloudRegion { + if o != nil && o.bitmap_&32 != 0 { + return o.regions + } + return nil +} + +// GetRegions returns the value of the 'regions' attribute and +// a flag indicating if the attribute has a value. +// +// (optional) Provider's regions - only included when listing providers with `fetchRegions=true`. +func (o *CloudProvider) GetRegions() (value []*CloudRegion, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.regions + } + return +} + +// CloudProviderListKind is the name of the type used to represent list of objects of +// type 'cloud_provider'. +const CloudProviderListKind = "CloudProviderList" + +// CloudProviderListLinkKind is the name of the type used to represent links to list +// of objects of type 'cloud_provider'. +const CloudProviderListLinkKind = "CloudProviderListLink" + +// CloudProviderNilKind is the name of the type used to nil lists of objects of +// type 'cloud_provider'. +const CloudProviderListNilKind = "CloudProviderListNil" + +// CloudProviderList is a list of values of the 'cloud_provider' type. +type CloudProviderList struct { + href string + link bool + items []*CloudProvider +} + +// Kind returns the name of the type of the object. +func (l *CloudProviderList) Kind() string { + if l == nil { + return CloudProviderListNilKind + } + if l.link { + return CloudProviderListLinkKind + } + return CloudProviderListKind +} + +// Link returns true iif this is a link. +func (l *CloudProviderList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *CloudProviderList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *CloudProviderList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *CloudProviderList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CloudProviderList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CloudProviderList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CloudProviderList) SetItems(items []*CloudProvider) { + l.items = items +} + +// Items returns the items of the list. +func (l *CloudProviderList) Items() []*CloudProvider { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CloudProviderList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CloudProviderList) Get(i int) *CloudProvider { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CloudProviderList) Slice() []*CloudProvider { + var slice []*CloudProvider + if l == nil { + slice = make([]*CloudProvider, 0) + } else { + slice = make([]*CloudProvider, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CloudProviderList) Each(f func(item *CloudProvider) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CloudProviderList) Range(f func(index int, item *CloudProvider) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/cloud_provider_type_json.go b/clientapi/arohcp/v1alpha1/cloud_provider_type_json.go new file mode 100644 index 00000000..999f1bfd --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cloud_provider_type_json.go @@ -0,0 +1,146 @@ +/* +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" +) + +// MarshalCloudProvider writes a value of the 'cloud_provider' type to the given writer. +func MarshalCloudProvider(object *CloudProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudProvider(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudProvider writes a value of the 'cloud_provider' type to the given stream. +func WriteCloudProvider(object *CloudProvider, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(CloudProviderLinkKind) + } else { + stream.WriteString(CloudProviderKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&32 != 0 && object.regions != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("regions") + WriteCloudRegionList(object.regions, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalCloudProvider reads a value of the 'cloud_provider' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCloudProvider(source interface{}) (object *CloudProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCloudProvider(iterator) + err = iterator.Error + return +} + +// ReadCloudProvider reads a value of the 'cloud_provider' type from the given iterator. +func ReadCloudProvider(iterator *jsoniter.Iterator) *CloudProvider { + object := &CloudProvider{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == CloudProviderLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 8 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 16 + case "regions": + value := ReadCloudRegionList(iterator) + object.regions = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/cloud_region_builder.go b/clientapi/arohcp/v1alpha1/cloud_region_builder.go new file mode 100644 index 00000000..6d6c358c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cloud_region_builder.go @@ -0,0 +1,193 @@ +/* +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 v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" // CloudRegionBuilder contains the data and logic needed to build 'cloud_region' objects. +// Description of a region of a cloud provider. +type CloudRegionBuilder struct { + bitmap_ uint32 + id string + href string + kmsLocationID string + kmsLocationName string + cloudProvider *v1.CloudProviderBuilder + displayName string + name string + ccsOnly bool + enabled bool + govCloud bool + supportsHypershift bool + supportsMultiAZ bool +} + +// NewCloudRegion creates a new builder of 'cloud_region' objects. +func NewCloudRegion() *CloudRegionBuilder { + return &CloudRegionBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *CloudRegionBuilder) Link(value bool) *CloudRegionBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *CloudRegionBuilder) ID(value string) *CloudRegionBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *CloudRegionBuilder) HREF(value string) *CloudRegionBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CloudRegionBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CCSOnly sets the value of the 'CCS_only' attribute to the given value. +func (b *CloudRegionBuilder) CCSOnly(value bool) *CloudRegionBuilder { + b.ccsOnly = value + b.bitmap_ |= 8 + return b +} + +// KMSLocationID sets the value of the 'KMS_location_ID' attribute to the given value. +func (b *CloudRegionBuilder) KMSLocationID(value string) *CloudRegionBuilder { + b.kmsLocationID = value + b.bitmap_ |= 16 + return b +} + +// KMSLocationName sets the value of the 'KMS_location_name' attribute to the given value. +func (b *CloudRegionBuilder) KMSLocationName(value string) *CloudRegionBuilder { + b.kmsLocationName = value + b.bitmap_ |= 32 + return b +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +// +// Cloud provider. +func (b *CloudRegionBuilder) CloudProvider(value *v1.CloudProviderBuilder) *CloudRegionBuilder { + b.cloudProvider = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *CloudRegionBuilder) DisplayName(value string) *CloudRegionBuilder { + b.displayName = value + b.bitmap_ |= 128 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *CloudRegionBuilder) Enabled(value bool) *CloudRegionBuilder { + b.enabled = value + b.bitmap_ |= 256 + return b +} + +// GovCloud sets the value of the 'gov_cloud' attribute to the given value. +func (b *CloudRegionBuilder) GovCloud(value bool) *CloudRegionBuilder { + b.govCloud = value + b.bitmap_ |= 512 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *CloudRegionBuilder) Name(value string) *CloudRegionBuilder { + b.name = value + b.bitmap_ |= 1024 + return b +} + +// SupportsHypershift sets the value of the 'supports_hypershift' attribute to the given value. +func (b *CloudRegionBuilder) SupportsHypershift(value bool) *CloudRegionBuilder { + b.supportsHypershift = value + b.bitmap_ |= 2048 + return b +} + +// SupportsMultiAZ sets the value of the 'supports_multi_AZ' attribute to the given value. +func (b *CloudRegionBuilder) SupportsMultiAZ(value bool) *CloudRegionBuilder { + b.supportsMultiAZ = value + b.bitmap_ |= 4096 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CloudRegionBuilder) Copy(object *CloudRegion) *CloudRegionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.ccsOnly = object.ccsOnly + b.kmsLocationID = object.kmsLocationID + b.kmsLocationName = object.kmsLocationName + if object.cloudProvider != nil { + b.cloudProvider = v1.NewCloudProvider().Copy(object.cloudProvider) + } else { + b.cloudProvider = nil + } + b.displayName = object.displayName + b.enabled = object.enabled + b.govCloud = object.govCloud + b.name = object.name + b.supportsHypershift = object.supportsHypershift + b.supportsMultiAZ = object.supportsMultiAZ + return b +} + +// Build creates a 'cloud_region' object using the configuration stored in the builder. +func (b *CloudRegionBuilder) Build() (object *CloudRegion, err error) { + object = new(CloudRegion) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.ccsOnly = b.ccsOnly + object.kmsLocationID = b.kmsLocationID + object.kmsLocationName = b.kmsLocationName + if b.cloudProvider != nil { + object.cloudProvider, err = b.cloudProvider.Build() + if err != nil { + return + } + } + object.displayName = b.displayName + object.enabled = b.enabled + object.govCloud = b.govCloud + object.name = b.name + object.supportsHypershift = b.supportsHypershift + object.supportsMultiAZ = b.supportsMultiAZ + return +} diff --git a/clientapi/arohcp/v1alpha1/cloud_region_list_builder.go b/clientapi/arohcp/v1alpha1/cloud_region_list_builder.go new file mode 100644 index 00000000..fb2493e2 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cloud_region_list_builder.go @@ -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 + +// CloudRegionListBuilder contains the data and logic needed to build +// 'cloud_region' objects. +type CloudRegionListBuilder struct { + items []*CloudRegionBuilder +} + +// NewCloudRegionList creates a new builder of 'cloud_region' objects. +func NewCloudRegionList() *CloudRegionListBuilder { + return new(CloudRegionListBuilder) +} + +// Items sets the items of the list. +func (b *CloudRegionListBuilder) Items(values ...*CloudRegionBuilder) *CloudRegionListBuilder { + b.items = make([]*CloudRegionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CloudRegionListBuilder) 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 *CloudRegionListBuilder) Copy(list *CloudRegionList) *CloudRegionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CloudRegionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCloudRegion().Copy(v) + } + } + return b +} + +// Build creates a list of 'cloud_region' objects using the +// configuration stored in the builder. +func (b *CloudRegionListBuilder) Build() (list *CloudRegionList, err error) { + items := make([]*CloudRegion, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CloudRegionList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/cloud_region_list_type_json.go b/clientapi/arohcp/v1alpha1/cloud_region_list_type_json.go new file mode 100644 index 00000000..fec363ad --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cloud_region_list_type_json.go @@ -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" +) + +// MarshalCloudRegionList writes a list of values of the 'cloud_region' type to +// the given writer. +func MarshalCloudRegionList(list []*CloudRegion, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudRegionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudRegionList writes a list of value of the 'cloud_region' type to +// the given stream. +func WriteCloudRegionList(list []*CloudRegion, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCloudRegion(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCloudRegionList reads a list of values of the 'cloud_region' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCloudRegionList(source interface{}) (items []*CloudRegion, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCloudRegionList(iterator) + err = iterator.Error + return +} + +// ReadCloudRegionList reads list of values of the ”cloud_region' type from +// the given iterator. +func ReadCloudRegionList(iterator *jsoniter.Iterator) []*CloudRegion { + list := []*CloudRegion{} + for iterator.ReadArray() { + item := ReadCloudRegion(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/cloud_region_type.go b/clientapi/arohcp/v1alpha1/cloud_region_type.go new file mode 100644 index 00000000..a74177f1 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cloud_region_type.go @@ -0,0 +1,495 @@ +/* +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 v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" + +// CloudRegionKind is the name of the type used to represent objects +// of type 'cloud_region'. +const CloudRegionKind = "CloudRegion" + +// CloudRegionLinkKind is the name of the type used to represent links +// to objects of type 'cloud_region'. +const CloudRegionLinkKind = "CloudRegionLink" + +// CloudRegionNilKind is the name of the type used to nil references +// to objects of type 'cloud_region'. +const CloudRegionNilKind = "CloudRegionNil" + +// CloudRegion represents the values of the 'cloud_region' type. +// +// Description of a region of a cloud provider. +type CloudRegion struct { + bitmap_ uint32 + id string + href string + kmsLocationID string + kmsLocationName string + cloudProvider *v1.CloudProvider + displayName string + name string + ccsOnly bool + enabled bool + govCloud bool + supportsHypershift bool + supportsMultiAZ bool +} + +// Kind returns the name of the type of the object. +func (o *CloudRegion) Kind() string { + if o == nil { + return CloudRegionNilKind + } + if o.bitmap_&1 != 0 { + return CloudRegionLinkKind + } + return CloudRegionKind +} + +// Link returns true if this is a link. +func (o *CloudRegion) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *CloudRegion) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *CloudRegion) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *CloudRegion) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *CloudRegion) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CloudRegion) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CCSOnly returns the value of the 'CCS_only' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// 'true' if the region is supported only for CCS clusters, 'false' otherwise. +func (o *CloudRegion) CCSOnly() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.ccsOnly + } + return false +} + +// GetCCSOnly returns the value of the 'CCS_only' attribute and +// a flag indicating if the attribute has a value. +// +// 'true' if the region is supported only for CCS clusters, 'false' otherwise. +func (o *CloudRegion) GetCCSOnly() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.ccsOnly + } + return +} + +// KMSLocationID returns the value of the 'KMS_location_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// (GCP only) Comma-separated list of KMS location IDs that can be used with this region. +// E.g. "global,nam4,us". Order is not guaranteed. +func (o *CloudRegion) KMSLocationID() string { + if o != nil && o.bitmap_&16 != 0 { + return o.kmsLocationID + } + return "" +} + +// GetKMSLocationID returns the value of the 'KMS_location_ID' attribute and +// a flag indicating if the attribute has a value. +// +// (GCP only) Comma-separated list of KMS location IDs that can be used with this region. +// E.g. "global,nam4,us". Order is not guaranteed. +func (o *CloudRegion) GetKMSLocationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.kmsLocationID + } + return +} + +// KMSLocationName returns the value of the 'KMS_location_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// (GCP only) Comma-separated list of display names corresponding to KMSLocationID. +// E.g. "Global,nam4 (Iowa, South Carolina, and Oklahoma),US". Order is not guaranteed but will match KMSLocationID. +// Unfortunately, this API doesn't allow robust splitting - Contact ocm-feedback@redhat.com if you want to rely on this. +func (o *CloudRegion) KMSLocationName() string { + if o != nil && o.bitmap_&32 != 0 { + return o.kmsLocationName + } + return "" +} + +// GetKMSLocationName returns the value of the 'KMS_location_name' attribute and +// a flag indicating if the attribute has a value. +// +// (GCP only) Comma-separated list of display names corresponding to KMSLocationID. +// E.g. "Global,nam4 (Iowa, South Carolina, and Oklahoma),US". Order is not guaranteed but will match KMSLocationID. +// Unfortunately, this API doesn't allow robust splitting - Contact ocm-feedback@redhat.com if you want to rely on this. +func (o *CloudRegion) GetKMSLocationName() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.kmsLocationName + } + return +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the cloud provider that the region belongs to. +func (o *CloudRegion) CloudProvider() *v1.CloudProvider { + if o != nil && o.bitmap_&64 != 0 { + return o.cloudProvider + } + return nil +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the cloud provider that the region belongs to. +func (o *CloudRegion) GetCloudProvider() (value *v1.CloudProvider, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the region for display purposes, for example `N. Virginia`. +func (o *CloudRegion) DisplayName() string { + if o != nil && o.bitmap_&128 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the region for display purposes, for example `N. Virginia`. +func (o *CloudRegion) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.displayName + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Whether the region is enabled for deploying a managed cluster. +func (o *CloudRegion) Enabled() bool { + if o != nil && o.bitmap_&256 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Whether the region is enabled for deploying a managed cluster. +func (o *CloudRegion) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.enabled + } + return +} + +// GovCloud returns the value of the 'gov_cloud' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Whether the region is an AWS GovCloud region. +func (o *CloudRegion) GovCloud() bool { + if o != nil && o.bitmap_&512 != 0 { + return o.govCloud + } + return false +} + +// GetGovCloud returns the value of the 'gov_cloud' attribute and +// a flag indicating if the attribute has a value. +// +// Whether the region is an AWS GovCloud region. +func (o *CloudRegion) GetGovCloud() (value bool, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.govCloud + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Human friendly identifier of the region, for example `us-east-1`. +// +// NOTE: Currently for all cloud providers and all regions `id` and `name` have exactly +// the same values. +func (o *CloudRegion) Name() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Human friendly identifier of the region, for example `us-east-1`. +// +// NOTE: Currently for all cloud providers and all regions `id` and `name` have exactly +// the same values. +func (o *CloudRegion) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.name + } + return +} + +// SupportsHypershift returns the value of the 'supports_hypershift' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// 'true' if the region is supported for Hypershift deployments, 'false' otherwise. +func (o *CloudRegion) SupportsHypershift() bool { + if o != nil && o.bitmap_&2048 != 0 { + return o.supportsHypershift + } + return false +} + +// GetSupportsHypershift returns the value of the 'supports_hypershift' attribute and +// a flag indicating if the attribute has a value. +// +// 'true' if the region is supported for Hypershift deployments, 'false' otherwise. +func (o *CloudRegion) GetSupportsHypershift() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.supportsHypershift + } + return +} + +// SupportsMultiAZ returns the value of the 'supports_multi_AZ' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Whether the region supports multiple availability zones. +func (o *CloudRegion) SupportsMultiAZ() bool { + if o != nil && o.bitmap_&4096 != 0 { + return o.supportsMultiAZ + } + return false +} + +// GetSupportsMultiAZ returns the value of the 'supports_multi_AZ' attribute and +// a flag indicating if the attribute has a value. +// +// Whether the region supports multiple availability zones. +func (o *CloudRegion) GetSupportsMultiAZ() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.supportsMultiAZ + } + return +} + +// CloudRegionListKind is the name of the type used to represent list of objects of +// type 'cloud_region'. +const CloudRegionListKind = "CloudRegionList" + +// CloudRegionListLinkKind is the name of the type used to represent links to list +// of objects of type 'cloud_region'. +const CloudRegionListLinkKind = "CloudRegionListLink" + +// CloudRegionNilKind is the name of the type used to nil lists of objects of +// type 'cloud_region'. +const CloudRegionListNilKind = "CloudRegionListNil" + +// CloudRegionList is a list of values of the 'cloud_region' type. +type CloudRegionList struct { + href string + link bool + items []*CloudRegion +} + +// Kind returns the name of the type of the object. +func (l *CloudRegionList) Kind() string { + if l == nil { + return CloudRegionListNilKind + } + if l.link { + return CloudRegionListLinkKind + } + return CloudRegionListKind +} + +// Link returns true iif this is a link. +func (l *CloudRegionList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *CloudRegionList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *CloudRegionList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *CloudRegionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CloudRegionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CloudRegionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CloudRegionList) SetItems(items []*CloudRegion) { + l.items = items +} + +// Items returns the items of the list. +func (l *CloudRegionList) Items() []*CloudRegion { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CloudRegionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CloudRegionList) Get(i int) *CloudRegion { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CloudRegionList) Slice() []*CloudRegion { + var slice []*CloudRegion + if l == nil { + slice = make([]*CloudRegion, 0) + } else { + slice = make([]*CloudRegion, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CloudRegionList) Each(f func(item *CloudRegion) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CloudRegionList) Range(f func(index int, item *CloudRegion) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/cloud_region_type_json.go b/clientapi/arohcp/v1alpha1/cloud_region_type_json.go new file mode 100644 index 00000000..68db69f5 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cloud_region_type_json.go @@ -0,0 +1,238 @@ +/* +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" + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudRegion writes a value of the 'cloud_region' type to the given writer. +func MarshalCloudRegion(object *CloudRegion, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudRegion(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudRegion writes a value of the 'cloud_region' type to the given stream. +func WriteCloudRegion(object *CloudRegion, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(CloudRegionLinkKind) + } else { + stream.WriteString(CloudRegionKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ccs_only") + stream.WriteBool(object.ccsOnly) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kms_location_id") + stream.WriteString(object.kmsLocationID) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kms_location_name") + stream.WriteString(object.kmsLocationName) + count++ + } + present_ = object.bitmap_&64 != 0 && object.cloudProvider != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + v1.WriteCloudProvider(object.cloudProvider, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("govcloud") + stream.WriteBool(object.govCloud) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("supports_hypershift") + stream.WriteBool(object.supportsHypershift) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("supports_multi_az") + stream.WriteBool(object.supportsMultiAZ) + } + stream.WriteObjectEnd() +} + +// UnmarshalCloudRegion reads a value of the 'cloud_region' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCloudRegion(source interface{}) (object *CloudRegion, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCloudRegion(iterator) + err = iterator.Error + return +} + +// ReadCloudRegion reads a value of the 'cloud_region' type from the given iterator. +func ReadCloudRegion(iterator *jsoniter.Iterator) *CloudRegion { + object := &CloudRegion{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == CloudRegionLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "ccs_only": + value := iterator.ReadBool() + object.ccsOnly = value + object.bitmap_ |= 8 + case "kms_location_id": + value := iterator.ReadString() + object.kmsLocationID = value + object.bitmap_ |= 16 + case "kms_location_name": + value := iterator.ReadString() + object.kmsLocationName = value + object.bitmap_ |= 32 + case "cloud_provider": + value := v1.ReadCloudProvider(iterator) + object.cloudProvider = value + object.bitmap_ |= 64 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 128 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 256 + case "govcloud": + value := iterator.ReadBool() + object.govCloud = value + object.bitmap_ |= 512 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1024 + case "supports_hypershift": + value := iterator.ReadBool() + object.supportsHypershift = value + object.bitmap_ |= 2048 + case "supports_multi_az": + value := iterator.ReadBool() + object.supportsMultiAZ = value + object.bitmap_ |= 4096 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/cluster_api_builder.go b/clientapi/arohcp/v1alpha1/cluster_api_builder.go new file mode 100644 index 00000000..a256d555 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_api_builder.go @@ -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 + +// ClusterAPIBuilder contains the data and logic needed to build 'cluster_API' objects. +// +// Information about the API of a cluster. +type ClusterAPIBuilder struct { + bitmap_ uint32 + url string + listening ListeningMethod +} + +// NewClusterAPI creates a new builder of 'cluster_API' objects. +func NewClusterAPI() *ClusterAPIBuilder { + return &ClusterAPIBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterAPIBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// URL sets the value of the 'URL' attribute to the given value. +func (b *ClusterAPIBuilder) URL(value string) *ClusterAPIBuilder { + b.url = value + b.bitmap_ |= 1 + return b +} + +// Listening sets the value of the 'listening' attribute to the given value. +// +// Cluster components listening method. +func (b *ClusterAPIBuilder) Listening(value ListeningMethod) *ClusterAPIBuilder { + b.listening = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterAPIBuilder) Copy(object *ClusterAPI) *ClusterAPIBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.url = object.url + b.listening = object.listening + return b +} + +// Build creates a 'cluster_API' object using the configuration stored in the builder. +func (b *ClusterAPIBuilder) Build() (object *ClusterAPI, err error) { + object = new(ClusterAPI) + object.bitmap_ = b.bitmap_ + object.url = b.url + object.listening = b.listening + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_api_list_builder.go b/clientapi/arohcp/v1alpha1/cluster_api_list_builder.go new file mode 100644 index 00000000..6a49c871 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_api_list_builder.go @@ -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 + +// ClusterAPIListBuilder contains the data and logic needed to build +// 'cluster_API' objects. +type ClusterAPIListBuilder struct { + items []*ClusterAPIBuilder +} + +// NewClusterAPIList creates a new builder of 'cluster_API' objects. +func NewClusterAPIList() *ClusterAPIListBuilder { + return new(ClusterAPIListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterAPIListBuilder) Items(values ...*ClusterAPIBuilder) *ClusterAPIListBuilder { + b.items = make([]*ClusterAPIBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterAPIListBuilder) 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 *ClusterAPIListBuilder) Copy(list *ClusterAPIList) *ClusterAPIListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterAPIBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterAPI().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_API' objects using the +// configuration stored in the builder. +func (b *ClusterAPIListBuilder) Build() (list *ClusterAPIList, err error) { + items := make([]*ClusterAPI, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterAPIList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_api_list_type_json.go b/clientapi/arohcp/v1alpha1/cluster_api_list_type_json.go new file mode 100644 index 00000000..6a93386a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_api_list_type_json.go @@ -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" +) + +// MarshalClusterAPIList writes a list of values of the 'cluster_API' type to +// the given writer. +func MarshalClusterAPIList(list []*ClusterAPI, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterAPIList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterAPIList writes a list of value of the 'cluster_API' type to +// the given stream. +func WriteClusterAPIList(list []*ClusterAPI, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterAPI(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterAPIList reads a list of values of the 'cluster_API' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterAPIList(source interface{}) (items []*ClusterAPI, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterAPIList(iterator) + err = iterator.Error + return +} + +// ReadClusterAPIList reads list of values of the ”cluster_API' type from +// the given iterator. +func ReadClusterAPIList(iterator *jsoniter.Iterator) []*ClusterAPI { + list := []*ClusterAPI{} + for iterator.ReadArray() { + item := ReadClusterAPI(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/cluster_api_type.go b/clientapi/arohcp/v1alpha1/cluster_api_type.go new file mode 100644 index 00000000..32e04362 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_api_type.go @@ -0,0 +1,189 @@ +/* +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 + +// ClusterAPI represents the values of the 'cluster_API' type. +// +// Information about the API of a cluster. +type ClusterAPI struct { + bitmap_ uint32 + url string + listening ListeningMethod +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterAPI) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// URL returns the value of the 'URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The URL of the API server of the cluster. +func (o *ClusterAPI) URL() string { + if o != nil && o.bitmap_&1 != 0 { + return o.url + } + return "" +} + +// GetURL returns the value of the 'URL' attribute and +// a flag indicating if the attribute has a value. +// +// The URL of the API server of the cluster. +func (o *ClusterAPI) GetURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.url + } + return +} + +// Listening returns the value of the 'listening' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The listening method of the API server. +func (o *ClusterAPI) Listening() ListeningMethod { + if o != nil && o.bitmap_&2 != 0 { + return o.listening + } + return ListeningMethod("") +} + +// GetListening returns the value of the 'listening' attribute and +// a flag indicating if the attribute has a value. +// +// The listening method of the API server. +func (o *ClusterAPI) GetListening() (value ListeningMethod, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.listening + } + return +} + +// ClusterAPIListKind is the name of the type used to represent list of objects of +// type 'cluster_API'. +const ClusterAPIListKind = "ClusterAPIList" + +// ClusterAPIListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_API'. +const ClusterAPIListLinkKind = "ClusterAPIListLink" + +// ClusterAPINilKind is the name of the type used to nil lists of objects of +// type 'cluster_API'. +const ClusterAPIListNilKind = "ClusterAPIListNil" + +// ClusterAPIList is a list of values of the 'cluster_API' type. +type ClusterAPIList struct { + href string + link bool + items []*ClusterAPI +} + +// Len returns the length of the list. +func (l *ClusterAPIList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterAPIList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterAPIList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterAPIList) SetItems(items []*ClusterAPI) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterAPIList) Items() []*ClusterAPI { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterAPIList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterAPIList) Get(i int) *ClusterAPI { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterAPIList) Slice() []*ClusterAPI { + var slice []*ClusterAPI + if l == nil { + slice = make([]*ClusterAPI, 0) + } else { + slice = make([]*ClusterAPI, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterAPIList) Each(f func(item *ClusterAPI) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterAPIList) Range(f func(index int, item *ClusterAPI) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/cluster_api_type_json.go b/clientapi/arohcp/v1alpha1/cluster_api_type_json.go new file mode 100644 index 00000000..bd0aeda8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_api_type_json.go @@ -0,0 +1,100 @@ +/* +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" +) + +// MarshalClusterAPI writes a value of the 'cluster_API' type to the given writer. +func MarshalClusterAPI(object *ClusterAPI, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterAPI(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterAPI writes a value of the 'cluster_API' type to the given stream. +func WriteClusterAPI(object *ClusterAPI, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("url") + stream.WriteString(object.url) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("listening") + stream.WriteString(string(object.listening)) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterAPI reads a value of the 'cluster_API' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterAPI(source interface{}) (object *ClusterAPI, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterAPI(iterator) + err = iterator.Error + return +} + +// ReadClusterAPI reads a value of the 'cluster_API' type from the given iterator. +func ReadClusterAPI(iterator *jsoniter.Iterator) *ClusterAPI { + object := &ClusterAPI{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "url": + value := iterator.ReadString() + object.url = value + object.bitmap_ |= 1 + case "listening": + text := iterator.ReadString() + value := ListeningMethod(text) + object.listening = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/cluster_builder.go b/clientapi/arohcp/v1alpha1/cluster_builder.go new file mode 100644 index 00000000..62c25205 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_builder.go @@ -0,0 +1,1360 @@ +/* +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 ( + time "time" + + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// ClusterBuilder contains the data and logic needed to build 'cluster' objects. +// +// Definition of an _OpenShift_ cluster. +// +// The `cloud_provider` attribute is a reference to the cloud provider. When a +// cluster is retrieved it will be a link to the cloud provider, containing only +// the kind, id and href attributes: +// +// ```json +// +// { +// "cloud_provider": { +// "kind": "CloudProviderLink", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/cloud_providers/123" +// } +// } +// +// ``` +// +// When a cluster is created this is optional, and if used it should contain the +// identifier of the cloud provider to use: +// +// ```json +// +// { +// "cloud_provider": { +// "id": "123", +// } +// } +// +// ``` +// +// If not included, then the cluster will be created using the default cloud +// provider, which is currently Amazon Web Services. +// +// The region attribute is mandatory when a cluster is created. +// +// The `aws.access_key_id`, `aws.secret_access_key` and `dns.base_domain` +// attributes are mandatory when creation a cluster with your own Amazon Web +// Services account. +type ClusterBuilder struct { + bitmap_ uint64 + id string + href string + api *ClusterAPIBuilder + aws *AWSBuilder + awsInfrastructureAccessRoleGrants *v1.AWSInfrastructureAccessRoleGrantListBuilder + ccs *CCSBuilder + dns *DNSBuilder + gcp *GCPBuilder + gcpEncryptionKey *GCPEncryptionKeyBuilder + gcpNetwork *GCPNetworkBuilder + additionalTrustBundle string + addons *v1.AddOnInstallationListBuilder + autoscaler *v1.ClusterAutoscalerBuilder + azure *AzureBuilder + billingModel BillingModel + byoOidc *ByoOidcBuilder + capabilities *ClusterCapabilitiesBuilder + cloudProvider *v1.CloudProviderBuilder + console *ClusterConsoleBuilder + creationTimestamp time.Time + deleteProtection *DeleteProtectionBuilder + domainPrefix string + expirationTimestamp time.Time + externalID string + externalAuthConfig *ExternalAuthConfigBuilder + externalConfiguration *ExternalConfigurationBuilder + flavour *v1.FlavourBuilder + groups *v1.GroupListBuilder + healthState ClusterHealthState + htpasswd *HTPasswdIdentityProviderBuilder + hypershift *HypershiftBuilder + identityProviders *v1.IdentityProviderListBuilder + inflightChecks *InflightCheckListBuilder + infraID string + ingresses *v1.IngressListBuilder + kubeletConfig *KubeletConfigBuilder + loadBalancerQuota int + machinePools *v1.MachinePoolListBuilder + managedService *ManagedServiceBuilder + name string + network *NetworkBuilder + nodeDrainGracePeriod *ValueBuilder + nodePools *NodePoolListBuilder + nodes *ClusterNodesBuilder + openshiftVersion string + product *v1.ProductBuilder + properties map[string]string + provisionShard *ProvisionShardBuilder + proxy *ProxyBuilder + region *v1.CloudRegionBuilder + registryConfig *ClusterRegistryConfigBuilder + state ClusterState + status *ClusterStatusBuilder + storageQuota *ValueBuilder + subscription *v1.SubscriptionBuilder + version *v1.VersionBuilder + fips bool + disableUserWorkloadMonitoring bool + etcdEncryption bool + managed bool + multiAZ bool + multiArchEnabled bool +} + +// NewCluster creates a new builder of 'cluster' objects. +func NewCluster() *ClusterBuilder { + return &ClusterBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ClusterBuilder) Link(value bool) *ClusterBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ClusterBuilder) ID(value string) *ClusterBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ClusterBuilder) HREF(value string) *ClusterBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// API sets the value of the 'API' attribute to the given value. +// +// Information about the API of a cluster. +func (b *ClusterBuilder) API(value *ClusterAPIBuilder) *ClusterBuilder { + b.api = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// AWS sets the value of the 'AWS' attribute to the given value. +// +// _Amazon Web Services_ specific settings of a cluster. +func (b *ClusterBuilder) AWS(value *AWSBuilder) *ClusterBuilder { + b.aws = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// AWSInfrastructureAccessRoleGrants sets the value of the 'AWS_infrastructure_access_role_grants' attribute to the given values. +func (b *ClusterBuilder) AWSInfrastructureAccessRoleGrants(value *v1.AWSInfrastructureAccessRoleGrantListBuilder) *ClusterBuilder { + b.awsInfrastructureAccessRoleGrants = value + b.bitmap_ |= 32 + return b +} + +// CCS sets the value of the 'CCS' attribute to the given value. +func (b *ClusterBuilder) CCS(value *CCSBuilder) *ClusterBuilder { + b.ccs = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// DNS sets the value of the 'DNS' attribute to the given value. +// +// DNS settings of the cluster. +func (b *ClusterBuilder) DNS(value *DNSBuilder) *ClusterBuilder { + b.dns = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// FIPS sets the value of the 'FIPS' attribute to the given value. +func (b *ClusterBuilder) FIPS(value bool) *ClusterBuilder { + b.fips = value + b.bitmap_ |= 256 + return b +} + +// GCP sets the value of the 'GCP' attribute to the given value. +// +// Google cloud platform settings of a cluster. +func (b *ClusterBuilder) GCP(value *GCPBuilder) *ClusterBuilder { + b.gcp = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// GCPEncryptionKey sets the value of the 'GCP_encryption_key' attribute to the given value. +// +// GCP Encryption Key for CCS clusters. +func (b *ClusterBuilder) GCPEncryptionKey(value *GCPEncryptionKeyBuilder) *ClusterBuilder { + b.gcpEncryptionKey = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// GCPNetwork sets the value of the 'GCP_network' attribute to the given value. +// +// GCP Network configuration of a cluster. +func (b *ClusterBuilder) GCPNetwork(value *GCPNetworkBuilder) *ClusterBuilder { + b.gcpNetwork = value + if value != nil { + b.bitmap_ |= 2048 + } else { + b.bitmap_ &^= 2048 + } + return b +} + +// AdditionalTrustBundle sets the value of the 'additional_trust_bundle' attribute to the given value. +func (b *ClusterBuilder) AdditionalTrustBundle(value string) *ClusterBuilder { + b.additionalTrustBundle = value + b.bitmap_ |= 4096 + return b +} + +// Addons sets the value of the 'addons' attribute to the given values. +func (b *ClusterBuilder) Addons(value *v1.AddOnInstallationListBuilder) *ClusterBuilder { + b.addons = value + b.bitmap_ |= 8192 + return b +} + +// Autoscaler sets the value of the 'autoscaler' attribute to the given value. +// +// Cluster-wide autoscaling configuration. +func (b *ClusterBuilder) Autoscaler(value *v1.ClusterAutoscalerBuilder) *ClusterBuilder { + b.autoscaler = value + if value != nil { + b.bitmap_ |= 16384 + } else { + b.bitmap_ &^= 16384 + } + return b +} + +// Azure sets the value of the 'azure' attribute to the given value. +// +// Microsoft Azure settings of a cluster. +func (b *ClusterBuilder) Azure(value *AzureBuilder) *ClusterBuilder { + b.azure = value + if value != nil { + b.bitmap_ |= 32768 + } else { + b.bitmap_ &^= 32768 + } + return b +} + +// BillingModel sets the value of the 'billing_model' attribute to the given value. +// +// Billing model for cluster resources. +func (b *ClusterBuilder) BillingModel(value BillingModel) *ClusterBuilder { + b.billingModel = value + b.bitmap_ |= 65536 + return b +} + +// ByoOidc sets the value of the 'byo_oidc' attribute to the given value. +// +// ByoOidc configuration. +func (b *ClusterBuilder) ByoOidc(value *ByoOidcBuilder) *ClusterBuilder { + b.byoOidc = value + if value != nil { + b.bitmap_ |= 131072 + } else { + b.bitmap_ &^= 131072 + } + return b +} + +// Capabilities sets the value of the 'capabilities' attribute to the given value. +func (b *ClusterBuilder) Capabilities(value *ClusterCapabilitiesBuilder) *ClusterBuilder { + b.capabilities = value + if value != nil { + b.bitmap_ |= 262144 + } else { + b.bitmap_ &^= 262144 + } + return b +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +// +// Cloud provider. +func (b *ClusterBuilder) CloudProvider(value *v1.CloudProviderBuilder) *ClusterBuilder { + b.cloudProvider = value + if value != nil { + b.bitmap_ |= 524288 + } else { + b.bitmap_ &^= 524288 + } + return b +} + +// Console sets the value of the 'console' attribute to the given value. +// +// Information about the console of a cluster. +func (b *ClusterBuilder) Console(value *ClusterConsoleBuilder) *ClusterBuilder { + b.console = value + if value != nil { + b.bitmap_ |= 1048576 + } else { + b.bitmap_ &^= 1048576 + } + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *ClusterBuilder) CreationTimestamp(value time.Time) *ClusterBuilder { + b.creationTimestamp = value + b.bitmap_ |= 2097152 + return b +} + +// DeleteProtection sets the value of the 'delete_protection' attribute to the given value. +// +// DeleteProtection configuration. +func (b *ClusterBuilder) DeleteProtection(value *DeleteProtectionBuilder) *ClusterBuilder { + b.deleteProtection = value + if value != nil { + b.bitmap_ |= 4194304 + } else { + b.bitmap_ &^= 4194304 + } + return b +} + +// DisableUserWorkloadMonitoring sets the value of the 'disable_user_workload_monitoring' attribute to the given value. +func (b *ClusterBuilder) DisableUserWorkloadMonitoring(value bool) *ClusterBuilder { + b.disableUserWorkloadMonitoring = value + b.bitmap_ |= 8388608 + return b +} + +// DomainPrefix sets the value of the 'domain_prefix' attribute to the given value. +func (b *ClusterBuilder) DomainPrefix(value string) *ClusterBuilder { + b.domainPrefix = value + b.bitmap_ |= 16777216 + return b +} + +// EtcdEncryption sets the value of the 'etcd_encryption' attribute to the given value. +func (b *ClusterBuilder) EtcdEncryption(value bool) *ClusterBuilder { + b.etcdEncryption = value + b.bitmap_ |= 33554432 + return b +} + +// ExpirationTimestamp sets the value of the 'expiration_timestamp' attribute to the given value. +func (b *ClusterBuilder) ExpirationTimestamp(value time.Time) *ClusterBuilder { + b.expirationTimestamp = value + b.bitmap_ |= 67108864 + return b +} + +// ExternalID sets the value of the 'external_ID' attribute to the given value. +func (b *ClusterBuilder) ExternalID(value string) *ClusterBuilder { + b.externalID = value + b.bitmap_ |= 134217728 + return b +} + +// ExternalAuthConfig sets the value of the 'external_auth_config' attribute to the given value. +// +// ExternalAuthConfig configuration +func (b *ClusterBuilder) ExternalAuthConfig(value *ExternalAuthConfigBuilder) *ClusterBuilder { + b.externalAuthConfig = value + if value != nil { + b.bitmap_ |= 268435456 + } else { + b.bitmap_ &^= 268435456 + } + return b +} + +// ExternalConfiguration sets the value of the 'external_configuration' attribute to the given value. +// +// Representation of cluster external configuration. +func (b *ClusterBuilder) ExternalConfiguration(value *ExternalConfigurationBuilder) *ClusterBuilder { + b.externalConfiguration = value + if value != nil { + b.bitmap_ |= 536870912 + } else { + b.bitmap_ &^= 536870912 + } + return b +} + +// Flavour sets the value of the 'flavour' attribute to the given value. +// +// Set of predefined properties of a cluster. For example, a _huge_ flavour can be a cluster +// with 10 infra nodes and 1000 compute nodes. +func (b *ClusterBuilder) Flavour(value *v1.FlavourBuilder) *ClusterBuilder { + b.flavour = value + if value != nil { + b.bitmap_ |= 1073741824 + } else { + b.bitmap_ &^= 1073741824 + } + return b +} + +// Groups sets the value of the 'groups' attribute to the given values. +func (b *ClusterBuilder) Groups(value *v1.GroupListBuilder) *ClusterBuilder { + b.groups = value + b.bitmap_ |= 2147483648 + return b +} + +// HealthState sets the value of the 'health_state' attribute to the given value. +// +// ClusterHealthState indicates the health of a cluster. +func (b *ClusterBuilder) HealthState(value ClusterHealthState) *ClusterBuilder { + b.healthState = value + b.bitmap_ |= 4294967296 + return b +} + +// Htpasswd sets the value of the 'htpasswd' attribute to the given value. +// +// Details for `htpasswd` identity providers. +func (b *ClusterBuilder) Htpasswd(value *HTPasswdIdentityProviderBuilder) *ClusterBuilder { + b.htpasswd = value + if value != nil { + b.bitmap_ |= 8589934592 + } else { + b.bitmap_ &^= 8589934592 + } + return b +} + +// Hypershift sets the value of the 'hypershift' attribute to the given value. +// +// Hypershift configuration. +func (b *ClusterBuilder) Hypershift(value *HypershiftBuilder) *ClusterBuilder { + b.hypershift = value + if value != nil { + b.bitmap_ |= 17179869184 + } else { + b.bitmap_ &^= 17179869184 + } + return b +} + +// IdentityProviders sets the value of the 'identity_providers' attribute to the given values. +func (b *ClusterBuilder) IdentityProviders(value *v1.IdentityProviderListBuilder) *ClusterBuilder { + b.identityProviders = value + b.bitmap_ |= 34359738368 + return b +} + +// InflightChecks sets the value of the 'inflight_checks' attribute to the given values. +func (b *ClusterBuilder) InflightChecks(value *InflightCheckListBuilder) *ClusterBuilder { + b.inflightChecks = value + b.bitmap_ |= 68719476736 + return b +} + +// InfraID sets the value of the 'infra_ID' attribute to the given value. +func (b *ClusterBuilder) InfraID(value string) *ClusterBuilder { + b.infraID = value + b.bitmap_ |= 137438953472 + return b +} + +// Ingresses sets the value of the 'ingresses' attribute to the given values. +func (b *ClusterBuilder) Ingresses(value *v1.IngressListBuilder) *ClusterBuilder { + b.ingresses = value + b.bitmap_ |= 274877906944 + return b +} + +// KubeletConfig sets the value of the 'kubelet_config' attribute to the given value. +// +// OCM representation of KubeletConfig, exposing the fields of Kubernetes +// KubeletConfig that can be managed by users +func (b *ClusterBuilder) KubeletConfig(value *KubeletConfigBuilder) *ClusterBuilder { + b.kubeletConfig = value + if value != nil { + b.bitmap_ |= 549755813888 + } else { + b.bitmap_ &^= 549755813888 + } + return b +} + +// LoadBalancerQuota sets the value of the 'load_balancer_quota' attribute to the given value. +func (b *ClusterBuilder) LoadBalancerQuota(value int) *ClusterBuilder { + b.loadBalancerQuota = value + b.bitmap_ |= 1099511627776 + return b +} + +// MachinePools sets the value of the 'machine_pools' attribute to the given values. +func (b *ClusterBuilder) MachinePools(value *v1.MachinePoolListBuilder) *ClusterBuilder { + b.machinePools = value + b.bitmap_ |= 2199023255552 + return b +} + +// Managed sets the value of the 'managed' attribute to the given value. +func (b *ClusterBuilder) Managed(value bool) *ClusterBuilder { + b.managed = value + b.bitmap_ |= 4398046511104 + return b +} + +// ManagedService sets the value of the 'managed_service' attribute to the given value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (b *ClusterBuilder) ManagedService(value *ManagedServiceBuilder) *ClusterBuilder { + b.managedService = value + if value != nil { + b.bitmap_ |= 8796093022208 + } else { + b.bitmap_ &^= 8796093022208 + } + return b +} + +// MultiAZ sets the value of the 'multi_AZ' attribute to the given value. +func (b *ClusterBuilder) MultiAZ(value bool) *ClusterBuilder { + b.multiAZ = value + b.bitmap_ |= 17592186044416 + return b +} + +// MultiArchEnabled sets the value of the 'multi_arch_enabled' attribute to the given value. +func (b *ClusterBuilder) MultiArchEnabled(value bool) *ClusterBuilder { + b.multiArchEnabled = value + b.bitmap_ |= 35184372088832 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ClusterBuilder) Name(value string) *ClusterBuilder { + b.name = value + b.bitmap_ |= 70368744177664 + return b +} + +// Network sets the value of the 'network' attribute to the given value. +// +// Network configuration of a cluster. +func (b *ClusterBuilder) Network(value *NetworkBuilder) *ClusterBuilder { + b.network = value + if value != nil { + b.bitmap_ |= 140737488355328 + } else { + b.bitmap_ &^= 140737488355328 + } + return b +} + +// NodeDrainGracePeriod sets the value of the 'node_drain_grace_period' attribute to the given value. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +func (b *ClusterBuilder) NodeDrainGracePeriod(value *ValueBuilder) *ClusterBuilder { + b.nodeDrainGracePeriod = value + if value != nil { + b.bitmap_ |= 281474976710656 + } else { + b.bitmap_ &^= 281474976710656 + } + return b +} + +// NodePools sets the value of the 'node_pools' attribute to the given values. +func (b *ClusterBuilder) NodePools(value *NodePoolListBuilder) *ClusterBuilder { + b.nodePools = value + b.bitmap_ |= 562949953421312 + return b +} + +// Nodes sets the value of the 'nodes' attribute to the given value. +// +// Counts of different classes of nodes inside a cluster. +func (b *ClusterBuilder) Nodes(value *ClusterNodesBuilder) *ClusterBuilder { + b.nodes = value + if value != nil { + b.bitmap_ |= 1125899906842624 + } else { + b.bitmap_ &^= 1125899906842624 + } + return b +} + +// OpenshiftVersion sets the value of the 'openshift_version' attribute to the given value. +func (b *ClusterBuilder) OpenshiftVersion(value string) *ClusterBuilder { + b.openshiftVersion = value + b.bitmap_ |= 2251799813685248 + return b +} + +// Product sets the value of the 'product' attribute to the given value. +// +// Representation of an product that can be selected as a cluster type. +func (b *ClusterBuilder) Product(value *v1.ProductBuilder) *ClusterBuilder { + b.product = value + if value != nil { + b.bitmap_ |= 4503599627370496 + } else { + b.bitmap_ &^= 4503599627370496 + } + return b +} + +// Properties sets the value of the 'properties' attribute to the given value. +func (b *ClusterBuilder) Properties(value map[string]string) *ClusterBuilder { + b.properties = value + if value != nil { + b.bitmap_ |= 9007199254740992 + } else { + b.bitmap_ &^= 9007199254740992 + } + return b +} + +// ProvisionShard sets the value of the 'provision_shard' attribute to the given value. +// +// Contains the properties of the provision shard, including AWS and GCP related configurations +func (b *ClusterBuilder) ProvisionShard(value *ProvisionShardBuilder) *ClusterBuilder { + b.provisionShard = value + if value != nil { + b.bitmap_ |= 18014398509481984 + } else { + b.bitmap_ &^= 18014398509481984 + } + return b +} + +// Proxy sets the value of the 'proxy' attribute to the given value. +// +// Proxy configuration of a cluster. +func (b *ClusterBuilder) Proxy(value *ProxyBuilder) *ClusterBuilder { + b.proxy = value + if value != nil { + b.bitmap_ |= 36028797018963968 + } else { + b.bitmap_ &^= 36028797018963968 + } + return b +} + +// Region sets the value of the 'region' attribute to the given value. +// +// Description of a region of a cloud provider. +func (b *ClusterBuilder) Region(value *v1.CloudRegionBuilder) *ClusterBuilder { + b.region = value + if value != nil { + b.bitmap_ |= 72057594037927936 + } else { + b.bitmap_ &^= 72057594037927936 + } + return b +} + +// RegistryConfig sets the value of the 'registry_config' attribute to the given value. +// +// ClusterRegistryConfig describes the configuration of registries for the cluster. +// Its format reflects the OpenShift Image Configuration, for which docs are available on +// [docs.openshift.com](https://docs.openshift.com/container-platform/4.16/openshift_images/image-configuration.html) +// ```json +// +// { +// "registry_config": { +// "registry_sources": { +// "blocked_registries": [ +// "badregistry.io", +// "badregistry8.io" +// ] +// } +// } +// } +// +// ``` +func (b *ClusterBuilder) RegistryConfig(value *ClusterRegistryConfigBuilder) *ClusterBuilder { + b.registryConfig = value + if value != nil { + b.bitmap_ |= 144115188075855872 + } else { + b.bitmap_ &^= 144115188075855872 + } + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// Overall state of a cluster. +func (b *ClusterBuilder) State(value ClusterState) *ClusterBuilder { + b.state = value + b.bitmap_ |= 288230376151711744 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +// +// Detailed status of a cluster. +func (b *ClusterBuilder) Status(value *ClusterStatusBuilder) *ClusterBuilder { + b.status = value + if value != nil { + b.bitmap_ |= 576460752303423488 + } else { + b.bitmap_ &^= 576460752303423488 + } + return b +} + +// StorageQuota sets the value of the 'storage_quota' attribute to the given value. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +func (b *ClusterBuilder) StorageQuota(value *ValueBuilder) *ClusterBuilder { + b.storageQuota = value + if value != nil { + b.bitmap_ |= 1152921504606846976 + } else { + b.bitmap_ &^= 1152921504606846976 + } + return b +} + +// Subscription sets the value of the 'subscription' attribute to the given value. +// +// Definition of a subscription. +func (b *ClusterBuilder) Subscription(value *v1.SubscriptionBuilder) *ClusterBuilder { + b.subscription = value + if value != nil { + b.bitmap_ |= 2305843009213693952 + } else { + b.bitmap_ &^= 2305843009213693952 + } + return b +} + +// Version sets the value of the 'version' attribute to the given value. +// +// Representation of an _OpenShift_ version. +func (b *ClusterBuilder) Version(value *v1.VersionBuilder) *ClusterBuilder { + b.version = value + if value != nil { + b.bitmap_ |= 4611686018427387904 + } else { + b.bitmap_ &^= 4611686018427387904 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterBuilder) Copy(object *Cluster) *ClusterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.api != nil { + b.api = NewClusterAPI().Copy(object.api) + } else { + b.api = nil + } + if object.aws != nil { + b.aws = NewAWS().Copy(object.aws) + } else { + b.aws = nil + } + if object.awsInfrastructureAccessRoleGrants != nil { + b.awsInfrastructureAccessRoleGrants = v1.NewAWSInfrastructureAccessRoleGrantList().Copy(object.awsInfrastructureAccessRoleGrants) + } else { + b.awsInfrastructureAccessRoleGrants = nil + } + if object.ccs != nil { + b.ccs = NewCCS().Copy(object.ccs) + } else { + b.ccs = nil + } + if object.dns != nil { + b.dns = NewDNS().Copy(object.dns) + } else { + b.dns = nil + } + b.fips = object.fips + if object.gcp != nil { + b.gcp = NewGCP().Copy(object.gcp) + } else { + b.gcp = nil + } + if object.gcpEncryptionKey != nil { + b.gcpEncryptionKey = NewGCPEncryptionKey().Copy(object.gcpEncryptionKey) + } else { + b.gcpEncryptionKey = nil + } + if object.gcpNetwork != nil { + b.gcpNetwork = NewGCPNetwork().Copy(object.gcpNetwork) + } else { + b.gcpNetwork = nil + } + b.additionalTrustBundle = object.additionalTrustBundle + if object.addons != nil { + b.addons = v1.NewAddOnInstallationList().Copy(object.addons) + } else { + b.addons = nil + } + if object.autoscaler != nil { + b.autoscaler = v1.NewClusterAutoscaler().Copy(object.autoscaler) + } else { + b.autoscaler = nil + } + if object.azure != nil { + b.azure = NewAzure().Copy(object.azure) + } else { + b.azure = nil + } + b.billingModel = object.billingModel + if object.byoOidc != nil { + b.byoOidc = NewByoOidc().Copy(object.byoOidc) + } else { + b.byoOidc = nil + } + if object.capabilities != nil { + b.capabilities = NewClusterCapabilities().Copy(object.capabilities) + } else { + b.capabilities = nil + } + if object.cloudProvider != nil { + b.cloudProvider = v1.NewCloudProvider().Copy(object.cloudProvider) + } else { + b.cloudProvider = nil + } + if object.console != nil { + b.console = NewClusterConsole().Copy(object.console) + } else { + b.console = nil + } + b.creationTimestamp = object.creationTimestamp + if object.deleteProtection != nil { + b.deleteProtection = NewDeleteProtection().Copy(object.deleteProtection) + } else { + b.deleteProtection = nil + } + b.disableUserWorkloadMonitoring = object.disableUserWorkloadMonitoring + b.domainPrefix = object.domainPrefix + b.etcdEncryption = object.etcdEncryption + b.expirationTimestamp = object.expirationTimestamp + b.externalID = object.externalID + if object.externalAuthConfig != nil { + b.externalAuthConfig = NewExternalAuthConfig().Copy(object.externalAuthConfig) + } else { + b.externalAuthConfig = nil + } + if object.externalConfiguration != nil { + b.externalConfiguration = NewExternalConfiguration().Copy(object.externalConfiguration) + } else { + b.externalConfiguration = nil + } + if object.flavour != nil { + b.flavour = v1.NewFlavour().Copy(object.flavour) + } else { + b.flavour = nil + } + if object.groups != nil { + b.groups = v1.NewGroupList().Copy(object.groups) + } else { + b.groups = nil + } + b.healthState = object.healthState + if object.htpasswd != nil { + b.htpasswd = NewHTPasswdIdentityProvider().Copy(object.htpasswd) + } else { + b.htpasswd = nil + } + if object.hypershift != nil { + b.hypershift = NewHypershift().Copy(object.hypershift) + } else { + b.hypershift = nil + } + if object.identityProviders != nil { + b.identityProviders = v1.NewIdentityProviderList().Copy(object.identityProviders) + } else { + b.identityProviders = nil + } + if object.inflightChecks != nil { + b.inflightChecks = NewInflightCheckList().Copy(object.inflightChecks) + } else { + b.inflightChecks = nil + } + b.infraID = object.infraID + if object.ingresses != nil { + b.ingresses = v1.NewIngressList().Copy(object.ingresses) + } else { + b.ingresses = nil + } + if object.kubeletConfig != nil { + b.kubeletConfig = NewKubeletConfig().Copy(object.kubeletConfig) + } else { + b.kubeletConfig = nil + } + b.loadBalancerQuota = object.loadBalancerQuota + if object.machinePools != nil { + b.machinePools = v1.NewMachinePoolList().Copy(object.machinePools) + } else { + b.machinePools = nil + } + b.managed = object.managed + if object.managedService != nil { + b.managedService = NewManagedService().Copy(object.managedService) + } else { + b.managedService = nil + } + b.multiAZ = object.multiAZ + b.multiArchEnabled = object.multiArchEnabled + b.name = object.name + if object.network != nil { + b.network = NewNetwork().Copy(object.network) + } else { + b.network = nil + } + if object.nodeDrainGracePeriod != nil { + b.nodeDrainGracePeriod = NewValue().Copy(object.nodeDrainGracePeriod) + } else { + b.nodeDrainGracePeriod = nil + } + if object.nodePools != nil { + b.nodePools = NewNodePoolList().Copy(object.nodePools) + } else { + b.nodePools = nil + } + if object.nodes != nil { + b.nodes = NewClusterNodes().Copy(object.nodes) + } else { + b.nodes = nil + } + b.openshiftVersion = object.openshiftVersion + if object.product != nil { + b.product = v1.NewProduct().Copy(object.product) + } else { + b.product = nil + } + if len(object.properties) > 0 { + b.properties = map[string]string{} + for k, v := range object.properties { + b.properties[k] = v + } + } else { + b.properties = nil + } + if object.provisionShard != nil { + b.provisionShard = NewProvisionShard().Copy(object.provisionShard) + } else { + b.provisionShard = nil + } + if object.proxy != nil { + b.proxy = NewProxy().Copy(object.proxy) + } else { + b.proxy = nil + } + if object.region != nil { + b.region = v1.NewCloudRegion().Copy(object.region) + } else { + b.region = nil + } + if object.registryConfig != nil { + b.registryConfig = NewClusterRegistryConfig().Copy(object.registryConfig) + } else { + b.registryConfig = nil + } + b.state = object.state + if object.status != nil { + b.status = NewClusterStatus().Copy(object.status) + } else { + b.status = nil + } + if object.storageQuota != nil { + b.storageQuota = NewValue().Copy(object.storageQuota) + } else { + b.storageQuota = nil + } + if object.subscription != nil { + b.subscription = v1.NewSubscription().Copy(object.subscription) + } else { + b.subscription = nil + } + if object.version != nil { + b.version = v1.NewVersion().Copy(object.version) + } else { + b.version = nil + } + return b +} + +// Build creates a 'cluster' object using the configuration stored in the builder. +func (b *ClusterBuilder) Build() (object *Cluster, err error) { + object = new(Cluster) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.api != nil { + object.api, err = b.api.Build() + if err != nil { + return + } + } + if b.aws != nil { + object.aws, err = b.aws.Build() + if err != nil { + return + } + } + if b.awsInfrastructureAccessRoleGrants != nil { + object.awsInfrastructureAccessRoleGrants, err = b.awsInfrastructureAccessRoleGrants.Build() + if err != nil { + return + } + } + if b.ccs != nil { + object.ccs, err = b.ccs.Build() + if err != nil { + return + } + } + if b.dns != nil { + object.dns, err = b.dns.Build() + if err != nil { + return + } + } + object.fips = b.fips + if b.gcp != nil { + object.gcp, err = b.gcp.Build() + if err != nil { + return + } + } + if b.gcpEncryptionKey != nil { + object.gcpEncryptionKey, err = b.gcpEncryptionKey.Build() + if err != nil { + return + } + } + if b.gcpNetwork != nil { + object.gcpNetwork, err = b.gcpNetwork.Build() + if err != nil { + return + } + } + object.additionalTrustBundle = b.additionalTrustBundle + if b.addons != nil { + object.addons, err = b.addons.Build() + if err != nil { + return + } + } + if b.autoscaler != nil { + object.autoscaler, err = b.autoscaler.Build() + if err != nil { + return + } + } + if b.azure != nil { + object.azure, err = b.azure.Build() + if err != nil { + return + } + } + object.billingModel = b.billingModel + if b.byoOidc != nil { + object.byoOidc, err = b.byoOidc.Build() + if err != nil { + return + } + } + if b.capabilities != nil { + object.capabilities, err = b.capabilities.Build() + if err != nil { + return + } + } + if b.cloudProvider != nil { + object.cloudProvider, err = b.cloudProvider.Build() + if err != nil { + return + } + } + if b.console != nil { + object.console, err = b.console.Build() + if err != nil { + return + } + } + object.creationTimestamp = b.creationTimestamp + if b.deleteProtection != nil { + object.deleteProtection, err = b.deleteProtection.Build() + if err != nil { + return + } + } + object.disableUserWorkloadMonitoring = b.disableUserWorkloadMonitoring + object.domainPrefix = b.domainPrefix + object.etcdEncryption = b.etcdEncryption + object.expirationTimestamp = b.expirationTimestamp + object.externalID = b.externalID + if b.externalAuthConfig != nil { + object.externalAuthConfig, err = b.externalAuthConfig.Build() + if err != nil { + return + } + } + if b.externalConfiguration != nil { + object.externalConfiguration, err = b.externalConfiguration.Build() + if err != nil { + return + } + } + if b.flavour != nil { + object.flavour, err = b.flavour.Build() + if err != nil { + return + } + } + if b.groups != nil { + object.groups, err = b.groups.Build() + if err != nil { + return + } + } + object.healthState = b.healthState + if b.htpasswd != nil { + object.htpasswd, err = b.htpasswd.Build() + if err != nil { + return + } + } + if b.hypershift != nil { + object.hypershift, err = b.hypershift.Build() + if err != nil { + return + } + } + if b.identityProviders != nil { + object.identityProviders, err = b.identityProviders.Build() + if err != nil { + return + } + } + if b.inflightChecks != nil { + object.inflightChecks, err = b.inflightChecks.Build() + if err != nil { + return + } + } + object.infraID = b.infraID + if b.ingresses != nil { + object.ingresses, err = b.ingresses.Build() + if err != nil { + return + } + } + if b.kubeletConfig != nil { + object.kubeletConfig, err = b.kubeletConfig.Build() + if err != nil { + return + } + } + object.loadBalancerQuota = b.loadBalancerQuota + if b.machinePools != nil { + object.machinePools, err = b.machinePools.Build() + if err != nil { + return + } + } + object.managed = b.managed + if b.managedService != nil { + object.managedService, err = b.managedService.Build() + if err != nil { + return + } + } + object.multiAZ = b.multiAZ + object.multiArchEnabled = b.multiArchEnabled + object.name = b.name + if b.network != nil { + object.network, err = b.network.Build() + if err != nil { + return + } + } + if b.nodeDrainGracePeriod != nil { + object.nodeDrainGracePeriod, err = b.nodeDrainGracePeriod.Build() + if err != nil { + return + } + } + if b.nodePools != nil { + object.nodePools, err = b.nodePools.Build() + if err != nil { + return + } + } + if b.nodes != nil { + object.nodes, err = b.nodes.Build() + if err != nil { + return + } + } + object.openshiftVersion = b.openshiftVersion + if b.product != nil { + object.product, err = b.product.Build() + if err != nil { + return + } + } + if b.properties != nil { + object.properties = make(map[string]string) + for k, v := range b.properties { + object.properties[k] = v + } + } + if b.provisionShard != nil { + object.provisionShard, err = b.provisionShard.Build() + if err != nil { + return + } + } + if b.proxy != nil { + object.proxy, err = b.proxy.Build() + if err != nil { + return + } + } + if b.region != nil { + object.region, err = b.region.Build() + if err != nil { + return + } + } + if b.registryConfig != nil { + object.registryConfig, err = b.registryConfig.Build() + if err != nil { + return + } + } + object.state = b.state + if b.status != nil { + object.status, err = b.status.Build() + if err != nil { + return + } + } + if b.storageQuota != nil { + object.storageQuota, err = b.storageQuota.Build() + if err != nil { + return + } + } + if b.subscription != nil { + object.subscription, err = b.subscription.Build() + if err != nil { + return + } + } + if b.version != nil { + object.version, err = b.version.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_capabilities_builder.go b/clientapi/arohcp/v1alpha1/cluster_capabilities_builder.go new file mode 100644 index 00000000..4c763e32 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_capabilities_builder.go @@ -0,0 +1,70 @@ +/* +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 + +// ClusterCapabilitiesBuilder contains the data and logic needed to build 'cluster_capabilities' objects. +type ClusterCapabilitiesBuilder struct { + bitmap_ uint32 + disabled []string +} + +// NewClusterCapabilities creates a new builder of 'cluster_capabilities' objects. +func NewClusterCapabilities() *ClusterCapabilitiesBuilder { + return &ClusterCapabilitiesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterCapabilitiesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Disabled sets the value of the 'disabled' attribute to the given values. +func (b *ClusterCapabilitiesBuilder) Disabled(values ...string) *ClusterCapabilitiesBuilder { + b.disabled = make([]string, len(values)) + copy(b.disabled, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterCapabilitiesBuilder) Copy(object *ClusterCapabilities) *ClusterCapabilitiesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.disabled != nil { + b.disabled = make([]string, len(object.disabled)) + copy(b.disabled, object.disabled) + } else { + b.disabled = nil + } + return b +} + +// Build creates a 'cluster_capabilities' object using the configuration stored in the builder. +func (b *ClusterCapabilitiesBuilder) Build() (object *ClusterCapabilities, err error) { + object = new(ClusterCapabilities) + object.bitmap_ = b.bitmap_ + if b.disabled != nil { + object.disabled = make([]string, len(b.disabled)) + copy(object.disabled, b.disabled) + } + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_capabilities_list_builder.go b/clientapi/arohcp/v1alpha1/cluster_capabilities_list_builder.go new file mode 100644 index 00000000..880f7d01 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_capabilities_list_builder.go @@ -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 + +// ClusterCapabilitiesListBuilder contains the data and logic needed to build +// 'cluster_capabilities' objects. +type ClusterCapabilitiesListBuilder struct { + items []*ClusterCapabilitiesBuilder +} + +// NewClusterCapabilitiesList creates a new builder of 'cluster_capabilities' objects. +func NewClusterCapabilitiesList() *ClusterCapabilitiesListBuilder { + return new(ClusterCapabilitiesListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterCapabilitiesListBuilder) Items(values ...*ClusterCapabilitiesBuilder) *ClusterCapabilitiesListBuilder { + b.items = make([]*ClusterCapabilitiesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterCapabilitiesListBuilder) 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 *ClusterCapabilitiesListBuilder) Copy(list *ClusterCapabilitiesList) *ClusterCapabilitiesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterCapabilitiesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterCapabilities().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_capabilities' objects using the +// configuration stored in the builder. +func (b *ClusterCapabilitiesListBuilder) Build() (list *ClusterCapabilitiesList, err error) { + items := make([]*ClusterCapabilities, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterCapabilitiesList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_capabilities_list_type_json.go b/clientapi/arohcp/v1alpha1/cluster_capabilities_list_type_json.go new file mode 100644 index 00000000..2e905e65 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_capabilities_list_type_json.go @@ -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" +) + +// MarshalClusterCapabilitiesList writes a list of values of the 'cluster_capabilities' type to +// the given writer. +func MarshalClusterCapabilitiesList(list []*ClusterCapabilities, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterCapabilitiesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterCapabilitiesList writes a list of value of the 'cluster_capabilities' type to +// the given stream. +func WriteClusterCapabilitiesList(list []*ClusterCapabilities, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterCapabilities(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterCapabilitiesList reads a list of values of the 'cluster_capabilities' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterCapabilitiesList(source interface{}) (items []*ClusterCapabilities, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterCapabilitiesList(iterator) + err = iterator.Error + return +} + +// ReadClusterCapabilitiesList reads list of values of the ”cluster_capabilities' type from +// the given iterator. +func ReadClusterCapabilitiesList(iterator *jsoniter.Iterator) []*ClusterCapabilities { + list := []*ClusterCapabilities{} + for iterator.ReadArray() { + item := ReadClusterCapabilities(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/cluster_capabilities_type.go b/clientapi/arohcp/v1alpha1/cluster_capabilities_type.go new file mode 100644 index 00000000..d11c7424 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_capabilities_type.go @@ -0,0 +1,167 @@ +/* +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 + +// ClusterCapabilities represents the values of the 'cluster_capabilities' type. +type ClusterCapabilities struct { + bitmap_ uint32 + disabled []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterCapabilities) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Disabled returns the value of the 'disabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Immutable list of disabled capabilities. May only contain "ImageRegistry" at +// this time. Additional capabilities may be available in the future. Clients +// should expect to handle additional values. +func (o *ClusterCapabilities) Disabled() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.disabled + } + return nil +} + +// GetDisabled returns the value of the 'disabled' attribute and +// a flag indicating if the attribute has a value. +// +// Immutable list of disabled capabilities. May only contain "ImageRegistry" at +// this time. Additional capabilities may be available in the future. Clients +// should expect to handle additional values. +func (o *ClusterCapabilities) GetDisabled() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.disabled + } + return +} + +// ClusterCapabilitiesListKind is the name of the type used to represent list of objects of +// type 'cluster_capabilities'. +const ClusterCapabilitiesListKind = "ClusterCapabilitiesList" + +// ClusterCapabilitiesListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_capabilities'. +const ClusterCapabilitiesListLinkKind = "ClusterCapabilitiesListLink" + +// ClusterCapabilitiesNilKind is the name of the type used to nil lists of objects of +// type 'cluster_capabilities'. +const ClusterCapabilitiesListNilKind = "ClusterCapabilitiesListNil" + +// ClusterCapabilitiesList is a list of values of the 'cluster_capabilities' type. +type ClusterCapabilitiesList struct { + href string + link bool + items []*ClusterCapabilities +} + +// Len returns the length of the list. +func (l *ClusterCapabilitiesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterCapabilitiesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterCapabilitiesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterCapabilitiesList) SetItems(items []*ClusterCapabilities) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterCapabilitiesList) Items() []*ClusterCapabilities { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterCapabilitiesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterCapabilitiesList) Get(i int) *ClusterCapabilities { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterCapabilitiesList) Slice() []*ClusterCapabilities { + var slice []*ClusterCapabilities + if l == nil { + slice = make([]*ClusterCapabilities, 0) + } else { + slice = make([]*ClusterCapabilities, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterCapabilitiesList) Each(f func(item *ClusterCapabilities) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterCapabilitiesList) Range(f func(index int, item *ClusterCapabilities) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/cluster_capabilities_type_json.go b/clientapi/arohcp/v1alpha1/cluster_capabilities_type_json.go new file mode 100644 index 00000000..5c4e277c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_capabilities_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalClusterCapabilities writes a value of the 'cluster_capabilities' type to the given writer. +func MarshalClusterCapabilities(object *ClusterCapabilities, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterCapabilities(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterCapabilities writes a value of the 'cluster_capabilities' type to the given stream. +func WriteClusterCapabilities(object *ClusterCapabilities, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.disabled != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("disabled") + WriteStringList(object.disabled, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterCapabilities reads a value of the 'cluster_capabilities' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterCapabilities(source interface{}) (object *ClusterCapabilities, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterCapabilities(iterator) + err = iterator.Error + return +} + +// ReadClusterCapabilities reads a value of the 'cluster_capabilities' type from the given iterator. +func ReadClusterCapabilities(iterator *jsoniter.Iterator) *ClusterCapabilities { + object := &ClusterCapabilities{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "disabled": + value := ReadStringList(iterator) + object.disabled = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/cluster_configuration_mode_list_type_json.go b/clientapi/arohcp/v1alpha1/cluster_configuration_mode_list_type_json.go new file mode 100644 index 00000000..097e31ed --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_configuration_mode_list_type_json.go @@ -0,0 +1,76 @@ +/* +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" +) + +// MarshalClusterConfigurationModeList writes a list of values of the 'cluster_configuration_mode' type to +// the given writer. +func MarshalClusterConfigurationModeList(list []ClusterConfigurationMode, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterConfigurationModeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterConfigurationModeList writes a list of value of the 'cluster_configuration_mode' type to +// the given stream. +func WriteClusterConfigurationModeList(list []ClusterConfigurationMode, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterConfigurationModeList reads a list of values of the 'cluster_configuration_mode' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterConfigurationModeList(source interface{}) (items []ClusterConfigurationMode, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterConfigurationModeList(iterator) + err = iterator.Error + return +} + +// ReadClusterConfigurationModeList reads list of values of the ”cluster_configuration_mode' type from +// the given iterator. +func ReadClusterConfigurationModeList(iterator *jsoniter.Iterator) []ClusterConfigurationMode { + list := []ClusterConfigurationMode{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ClusterConfigurationMode(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/cluster_configuration_mode_type.go b/clientapi/arohcp/v1alpha1/cluster_configuration_mode_type.go new file mode 100644 index 00000000..cf1f9910 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_configuration_mode_type.go @@ -0,0 +1,31 @@ +/* +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 + +// ClusterConfigurationMode represents the values of the 'cluster_configuration_mode' enumerated type. +type ClusterConfigurationMode string + +const ( + // Full configuration (default). + ClusterConfigurationModeFull ClusterConfigurationMode = "full" + // Only read configuration operations are supported. + // The cluster can't be deleted, reshaped, configure IDPs, add/remove users, etc. + ClusterConfigurationModeReadOnly ClusterConfigurationMode = "read_only" +) diff --git a/clientapi/arohcp/v1alpha1/cluster_console_builder.go b/clientapi/arohcp/v1alpha1/cluster_console_builder.go new file mode 100644 index 00000000..21abf7a4 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_console_builder.go @@ -0,0 +1,63 @@ +/* +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 + +// ClusterConsoleBuilder contains the data and logic needed to build 'cluster_console' objects. +// +// Information about the console of a cluster. +type ClusterConsoleBuilder struct { + bitmap_ uint32 + url string +} + +// NewClusterConsole creates a new builder of 'cluster_console' objects. +func NewClusterConsole() *ClusterConsoleBuilder { + return &ClusterConsoleBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterConsoleBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// URL sets the value of the 'URL' attribute to the given value. +func (b *ClusterConsoleBuilder) URL(value string) *ClusterConsoleBuilder { + b.url = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterConsoleBuilder) Copy(object *ClusterConsole) *ClusterConsoleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.url = object.url + return b +} + +// Build creates a 'cluster_console' object using the configuration stored in the builder. +func (b *ClusterConsoleBuilder) Build() (object *ClusterConsole, err error) { + object = new(ClusterConsole) + object.bitmap_ = b.bitmap_ + object.url = b.url + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_console_list_builder.go b/clientapi/arohcp/v1alpha1/cluster_console_list_builder.go new file mode 100644 index 00000000..dfeca3bd --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_console_list_builder.go @@ -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 + +// ClusterConsoleListBuilder contains the data and logic needed to build +// 'cluster_console' objects. +type ClusterConsoleListBuilder struct { + items []*ClusterConsoleBuilder +} + +// NewClusterConsoleList creates a new builder of 'cluster_console' objects. +func NewClusterConsoleList() *ClusterConsoleListBuilder { + return new(ClusterConsoleListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterConsoleListBuilder) Items(values ...*ClusterConsoleBuilder) *ClusterConsoleListBuilder { + b.items = make([]*ClusterConsoleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterConsoleListBuilder) 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 *ClusterConsoleListBuilder) Copy(list *ClusterConsoleList) *ClusterConsoleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterConsoleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterConsole().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_console' objects using the +// configuration stored in the builder. +func (b *ClusterConsoleListBuilder) Build() (list *ClusterConsoleList, err error) { + items := make([]*ClusterConsole, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterConsoleList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_console_list_type_json.go b/clientapi/arohcp/v1alpha1/cluster_console_list_type_json.go new file mode 100644 index 00000000..5dd007fb --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_console_list_type_json.go @@ -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" +) + +// MarshalClusterConsoleList writes a list of values of the 'cluster_console' type to +// the given writer. +func MarshalClusterConsoleList(list []*ClusterConsole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterConsoleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterConsoleList writes a list of value of the 'cluster_console' type to +// the given stream. +func WriteClusterConsoleList(list []*ClusterConsole, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterConsole(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterConsoleList reads a list of values of the 'cluster_console' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterConsoleList(source interface{}) (items []*ClusterConsole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterConsoleList(iterator) + err = iterator.Error + return +} + +// ReadClusterConsoleList reads list of values of the ”cluster_console' type from +// the given iterator. +func ReadClusterConsoleList(iterator *jsoniter.Iterator) []*ClusterConsole { + list := []*ClusterConsole{} + for iterator.ReadArray() { + item := ReadClusterConsole(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/cluster_console_type.go b/clientapi/arohcp/v1alpha1/cluster_console_type.go new file mode 100644 index 00000000..cc83bf46 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_console_type.go @@ -0,0 +1,165 @@ +/* +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 + +// ClusterConsole represents the values of the 'cluster_console' type. +// +// Information about the console of a cluster. +type ClusterConsole struct { + bitmap_ uint32 + url string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterConsole) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// URL returns the value of the 'URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The URL of the console of the cluster. +func (o *ClusterConsole) URL() string { + if o != nil && o.bitmap_&1 != 0 { + return o.url + } + return "" +} + +// GetURL returns the value of the 'URL' attribute and +// a flag indicating if the attribute has a value. +// +// The URL of the console of the cluster. +func (o *ClusterConsole) GetURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.url + } + return +} + +// ClusterConsoleListKind is the name of the type used to represent list of objects of +// type 'cluster_console'. +const ClusterConsoleListKind = "ClusterConsoleList" + +// ClusterConsoleListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_console'. +const ClusterConsoleListLinkKind = "ClusterConsoleListLink" + +// ClusterConsoleNilKind is the name of the type used to nil lists of objects of +// type 'cluster_console'. +const ClusterConsoleListNilKind = "ClusterConsoleListNil" + +// ClusterConsoleList is a list of values of the 'cluster_console' type. +type ClusterConsoleList struct { + href string + link bool + items []*ClusterConsole +} + +// Len returns the length of the list. +func (l *ClusterConsoleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterConsoleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterConsoleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterConsoleList) SetItems(items []*ClusterConsole) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterConsoleList) Items() []*ClusterConsole { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterConsoleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterConsoleList) Get(i int) *ClusterConsole { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterConsoleList) Slice() []*ClusterConsole { + var slice []*ClusterConsole + if l == nil { + slice = make([]*ClusterConsole, 0) + } else { + slice = make([]*ClusterConsole, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterConsoleList) Each(f func(item *ClusterConsole) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterConsoleList) Range(f func(index int, item *ClusterConsole) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/cluster_console_type_json.go b/clientapi/arohcp/v1alpha1/cluster_console_type_json.go new file mode 100644 index 00000000..67940788 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_console_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalClusterConsole writes a value of the 'cluster_console' type to the given writer. +func MarshalClusterConsole(object *ClusterConsole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterConsole(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterConsole writes a value of the 'cluster_console' type to the given stream. +func WriteClusterConsole(object *ClusterConsole, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("url") + stream.WriteString(object.url) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterConsole reads a value of the 'cluster_console' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterConsole(source interface{}) (object *ClusterConsole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterConsole(iterator) + err = iterator.Error + return +} + +// ReadClusterConsole reads a value of the 'cluster_console' type from the given iterator. +func ReadClusterConsole(iterator *jsoniter.Iterator) *ClusterConsole { + object := &ClusterConsole{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "url": + value := iterator.ReadString() + object.url = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/cluster_health_state_list_type_json.go b/clientapi/arohcp/v1alpha1/cluster_health_state_list_type_json.go new file mode 100644 index 00000000..828bc88e --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_health_state_list_type_json.go @@ -0,0 +1,76 @@ +/* +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" +) + +// MarshalClusterHealthStateList writes a list of values of the 'cluster_health_state' type to +// the given writer. +func MarshalClusterHealthStateList(list []ClusterHealthState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterHealthStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterHealthStateList writes a list of value of the 'cluster_health_state' type to +// the given stream. +func WriteClusterHealthStateList(list []ClusterHealthState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterHealthStateList reads a list of values of the 'cluster_health_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterHealthStateList(source interface{}) (items []ClusterHealthState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterHealthStateList(iterator) + err = iterator.Error + return +} + +// ReadClusterHealthStateList reads list of values of the ”cluster_health_state' type from +// the given iterator. +func ReadClusterHealthStateList(iterator *jsoniter.Iterator) []ClusterHealthState { + list := []ClusterHealthState{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ClusterHealthState(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/cluster_health_state_type.go b/clientapi/arohcp/v1alpha1/cluster_health_state_type.go new file mode 100644 index 00000000..d5205e81 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_health_state_type.go @@ -0,0 +1,32 @@ +/* +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 + +// ClusterHealthState represents the values of the 'cluster_health_state' enumerated type. +type ClusterHealthState string + +const ( + // Cluster is Ready and healthy. + ClusterHealthStateHealthy ClusterHealthState = "healthy" + // Cluster is Ready and unhealthy. + ClusterHealthStateUnhealthy ClusterHealthState = "unhealthy" + // Cluster health is unknown. + ClusterHealthStateUnknown ClusterHealthState = "unknown" +) diff --git a/clientapi/arohcp/v1alpha1/cluster_list_builder.go b/clientapi/arohcp/v1alpha1/cluster_list_builder.go new file mode 100644 index 00000000..273003b2 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_list_builder.go @@ -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 + +// ClusterListBuilder contains the data and logic needed to build +// 'cluster' objects. +type ClusterListBuilder struct { + items []*ClusterBuilder +} + +// NewClusterList creates a new builder of 'cluster' objects. +func NewClusterList() *ClusterListBuilder { + return new(ClusterListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterListBuilder) Items(values ...*ClusterBuilder) *ClusterListBuilder { + b.items = make([]*ClusterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterListBuilder) 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 *ClusterListBuilder) Copy(list *ClusterList) *ClusterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCluster().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster' objects using the +// configuration stored in the builder. +func (b *ClusterListBuilder) Build() (list *ClusterList, err error) { + items := make([]*Cluster, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_list_type_json.go b/clientapi/arohcp/v1alpha1/cluster_list_type_json.go new file mode 100644 index 00000000..17cedfe9 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_list_type_json.go @@ -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" +) + +// MarshalClusterList writes a list of values of the 'cluster' type to +// the given writer. +func MarshalClusterList(list []*Cluster, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterList writes a list of value of the 'cluster' type to +// the given stream. +func WriteClusterList(list []*Cluster, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCluster(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterList reads a list of values of the 'cluster' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterList(source interface{}) (items []*Cluster, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterList(iterator) + err = iterator.Error + return +} + +// ReadClusterList reads list of values of the ”cluster' type from +// the given iterator. +func ReadClusterList(iterator *jsoniter.Iterator) []*Cluster { + list := []*Cluster{} + for iterator.ReadArray() { + item := ReadCluster(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/cluster_nodes_builder.go b/clientapi/arohcp/v1alpha1/cluster_nodes_builder.go new file mode 100644 index 00000000..033384f2 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_nodes_builder.go @@ -0,0 +1,289 @@ +/* +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 + +// ClusterNodesBuilder contains the data and logic needed to build 'cluster_nodes' objects. +// +// Counts of different classes of nodes inside a cluster. +type ClusterNodesBuilder struct { + bitmap_ uint32 + autoscaleCompute *MachinePoolAutoscalingBuilder + availabilityZones []string + compute int + computeLabels map[string]string + computeMachineType *MachineTypeBuilder + computeRootVolume *RootVolumeBuilder + infra int + infraMachineType *MachineTypeBuilder + master int + masterMachineType *MachineTypeBuilder + securityGroupFilters []*MachinePoolSecurityGroupFilterBuilder + total int +} + +// NewClusterNodes creates a new builder of 'cluster_nodes' objects. +func NewClusterNodes() *ClusterNodesBuilder { + return &ClusterNodesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterNodesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AutoscaleCompute sets the value of the 'autoscale_compute' attribute to the given value. +// +// Representation of a autoscaling in a machine pool. +func (b *ClusterNodesBuilder) AutoscaleCompute(value *MachinePoolAutoscalingBuilder) *ClusterNodesBuilder { + b.autoscaleCompute = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// AvailabilityZones sets the value of the 'availability_zones' attribute to the given values. +func (b *ClusterNodesBuilder) AvailabilityZones(values ...string) *ClusterNodesBuilder { + b.availabilityZones = make([]string, len(values)) + copy(b.availabilityZones, values) + b.bitmap_ |= 2 + return b +} + +// Compute sets the value of the 'compute' attribute to the given value. +func (b *ClusterNodesBuilder) Compute(value int) *ClusterNodesBuilder { + b.compute = value + b.bitmap_ |= 4 + return b +} + +// ComputeLabels sets the value of the 'compute_labels' attribute to the given value. +func (b *ClusterNodesBuilder) ComputeLabels(value map[string]string) *ClusterNodesBuilder { + b.computeLabels = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// ComputeMachineType sets the value of the 'compute_machine_type' attribute to the given value. +// +// Machine type. +func (b *ClusterNodesBuilder) ComputeMachineType(value *MachineTypeBuilder) *ClusterNodesBuilder { + b.computeMachineType = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// ComputeRootVolume sets the value of the 'compute_root_volume' attribute to the given value. +// +// Root volume capabilities. +func (b *ClusterNodesBuilder) ComputeRootVolume(value *RootVolumeBuilder) *ClusterNodesBuilder { + b.computeRootVolume = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Infra sets the value of the 'infra' attribute to the given value. +func (b *ClusterNodesBuilder) Infra(value int) *ClusterNodesBuilder { + b.infra = value + b.bitmap_ |= 64 + return b +} + +// InfraMachineType sets the value of the 'infra_machine_type' attribute to the given value. +// +// Machine type. +func (b *ClusterNodesBuilder) InfraMachineType(value *MachineTypeBuilder) *ClusterNodesBuilder { + b.infraMachineType = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// Master sets the value of the 'master' attribute to the given value. +func (b *ClusterNodesBuilder) Master(value int) *ClusterNodesBuilder { + b.master = value + b.bitmap_ |= 256 + return b +} + +// MasterMachineType sets the value of the 'master_machine_type' attribute to the given value. +// +// Machine type. +func (b *ClusterNodesBuilder) MasterMachineType(value *MachineTypeBuilder) *ClusterNodesBuilder { + b.masterMachineType = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// SecurityGroupFilters sets the value of the 'security_group_filters' attribute to the given values. +func (b *ClusterNodesBuilder) SecurityGroupFilters(values ...*MachinePoolSecurityGroupFilterBuilder) *ClusterNodesBuilder { + b.securityGroupFilters = make([]*MachinePoolSecurityGroupFilterBuilder, len(values)) + copy(b.securityGroupFilters, values) + b.bitmap_ |= 1024 + return b +} + +// Total sets the value of the 'total' attribute to the given value. +func (b *ClusterNodesBuilder) Total(value int) *ClusterNodesBuilder { + b.total = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterNodesBuilder) Copy(object *ClusterNodes) *ClusterNodesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.autoscaleCompute != nil { + b.autoscaleCompute = NewMachinePoolAutoscaling().Copy(object.autoscaleCompute) + } else { + b.autoscaleCompute = nil + } + if object.availabilityZones != nil { + b.availabilityZones = make([]string, len(object.availabilityZones)) + copy(b.availabilityZones, object.availabilityZones) + } else { + b.availabilityZones = nil + } + b.compute = object.compute + if len(object.computeLabels) > 0 { + b.computeLabels = map[string]string{} + for k, v := range object.computeLabels { + b.computeLabels[k] = v + } + } else { + b.computeLabels = nil + } + if object.computeMachineType != nil { + b.computeMachineType = NewMachineType().Copy(object.computeMachineType) + } else { + b.computeMachineType = nil + } + if object.computeRootVolume != nil { + b.computeRootVolume = NewRootVolume().Copy(object.computeRootVolume) + } else { + b.computeRootVolume = nil + } + b.infra = object.infra + if object.infraMachineType != nil { + b.infraMachineType = NewMachineType().Copy(object.infraMachineType) + } else { + b.infraMachineType = nil + } + b.master = object.master + if object.masterMachineType != nil { + b.masterMachineType = NewMachineType().Copy(object.masterMachineType) + } else { + b.masterMachineType = nil + } + if object.securityGroupFilters != nil { + b.securityGroupFilters = make([]*MachinePoolSecurityGroupFilterBuilder, len(object.securityGroupFilters)) + for i, v := range object.securityGroupFilters { + b.securityGroupFilters[i] = NewMachinePoolSecurityGroupFilter().Copy(v) + } + } else { + b.securityGroupFilters = nil + } + b.total = object.total + return b +} + +// Build creates a 'cluster_nodes' object using the configuration stored in the builder. +func (b *ClusterNodesBuilder) Build() (object *ClusterNodes, err error) { + object = new(ClusterNodes) + object.bitmap_ = b.bitmap_ + if b.autoscaleCompute != nil { + object.autoscaleCompute, err = b.autoscaleCompute.Build() + if err != nil { + return + } + } + if b.availabilityZones != nil { + object.availabilityZones = make([]string, len(b.availabilityZones)) + copy(object.availabilityZones, b.availabilityZones) + } + object.compute = b.compute + if b.computeLabels != nil { + object.computeLabels = make(map[string]string) + for k, v := range b.computeLabels { + object.computeLabels[k] = v + } + } + if b.computeMachineType != nil { + object.computeMachineType, err = b.computeMachineType.Build() + if err != nil { + return + } + } + if b.computeRootVolume != nil { + object.computeRootVolume, err = b.computeRootVolume.Build() + if err != nil { + return + } + } + object.infra = b.infra + if b.infraMachineType != nil { + object.infraMachineType, err = b.infraMachineType.Build() + if err != nil { + return + } + } + object.master = b.master + if b.masterMachineType != nil { + object.masterMachineType, err = b.masterMachineType.Build() + if err != nil { + return + } + } + if b.securityGroupFilters != nil { + object.securityGroupFilters = make([]*MachinePoolSecurityGroupFilter, len(b.securityGroupFilters)) + for i, v := range b.securityGroupFilters { + object.securityGroupFilters[i], err = v.Build() + if err != nil { + return + } + } + } + object.total = b.total + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_nodes_list_builder.go b/clientapi/arohcp/v1alpha1/cluster_nodes_list_builder.go new file mode 100644 index 00000000..5fb62eda --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_nodes_list_builder.go @@ -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 + +// ClusterNodesListBuilder contains the data and logic needed to build +// 'cluster_nodes' objects. +type ClusterNodesListBuilder struct { + items []*ClusterNodesBuilder +} + +// NewClusterNodesList creates a new builder of 'cluster_nodes' objects. +func NewClusterNodesList() *ClusterNodesListBuilder { + return new(ClusterNodesListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterNodesListBuilder) Items(values ...*ClusterNodesBuilder) *ClusterNodesListBuilder { + b.items = make([]*ClusterNodesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterNodesListBuilder) 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 *ClusterNodesListBuilder) Copy(list *ClusterNodesList) *ClusterNodesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterNodesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterNodes().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_nodes' objects using the +// configuration stored in the builder. +func (b *ClusterNodesListBuilder) Build() (list *ClusterNodesList, err error) { + items := make([]*ClusterNodes, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterNodesList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_nodes_list_type_json.go b/clientapi/arohcp/v1alpha1/cluster_nodes_list_type_json.go new file mode 100644 index 00000000..10e05153 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_nodes_list_type_json.go @@ -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" +) + +// MarshalClusterNodesList writes a list of values of the 'cluster_nodes' type to +// the given writer. +func MarshalClusterNodesList(list []*ClusterNodes, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterNodesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterNodesList writes a list of value of the 'cluster_nodes' type to +// the given stream. +func WriteClusterNodesList(list []*ClusterNodes, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterNodes(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterNodesList reads a list of values of the 'cluster_nodes' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterNodesList(source interface{}) (items []*ClusterNodes, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterNodesList(iterator) + err = iterator.Error + return +} + +// ReadClusterNodesList reads list of values of the ”cluster_nodes' type from +// the given iterator. +func ReadClusterNodesList(iterator *jsoniter.Iterator) []*ClusterNodes { + list := []*ClusterNodes{} + for iterator.ReadArray() { + item := ReadClusterNodes(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/cluster_nodes_type.go b/clientapi/arohcp/v1alpha1/cluster_nodes_type.go new file mode 100644 index 00000000..190d1c53 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_nodes_type.go @@ -0,0 +1,433 @@ +/* +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 + +// ClusterNodes represents the values of the 'cluster_nodes' type. +// +// Counts of different classes of nodes inside a cluster. +type ClusterNodes struct { + bitmap_ uint32 + autoscaleCompute *MachinePoolAutoscaling + availabilityZones []string + compute int + computeLabels map[string]string + computeMachineType *MachineType + computeRootVolume *RootVolume + infra int + infraMachineType *MachineType + master int + masterMachineType *MachineType + securityGroupFilters []*MachinePoolSecurityGroupFilter + total int +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterNodes) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AutoscaleCompute returns the value of the 'autoscale_compute' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for auto-scaling the compute machine pool. +// Compute and AutoscaleCompute cannot be used together. +func (o *ClusterNodes) AutoscaleCompute() *MachinePoolAutoscaling { + if o != nil && o.bitmap_&1 != 0 { + return o.autoscaleCompute + } + return nil +} + +// GetAutoscaleCompute returns the value of the 'autoscale_compute' attribute and +// a flag indicating if the attribute has a value. +// +// Details for auto-scaling the compute machine pool. +// Compute and AutoscaleCompute cannot be used together. +func (o *ClusterNodes) GetAutoscaleCompute() (value *MachinePoolAutoscaling, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.autoscaleCompute + } + return +} + +// AvailabilityZones returns the value of the 'availability_zones' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The availability zones upon which the nodes are created. +func (o *ClusterNodes) AvailabilityZones() []string { + if o != nil && o.bitmap_&2 != 0 { + return o.availabilityZones + } + return nil +} + +// GetAvailabilityZones returns the value of the 'availability_zones' attribute and +// a flag indicating if the attribute has a value. +// +// The availability zones upon which the nodes are created. +func (o *ClusterNodes) GetAvailabilityZones() (value []string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.availabilityZones + } + return +} + +// Compute returns the value of the 'compute' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Number of compute nodes of the cluster. +// Compute and AutoscaleCompute cannot be used together. +func (o *ClusterNodes) Compute() int { + if o != nil && o.bitmap_&4 != 0 { + return o.compute + } + return 0 +} + +// GetCompute returns the value of the 'compute' attribute and +// a flag indicating if the attribute has a value. +// +// Number of compute nodes of the cluster. +// Compute and AutoscaleCompute cannot be used together. +func (o *ClusterNodes) GetCompute() (value int, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.compute + } + return +} + +// ComputeLabels returns the value of the 'compute_labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The labels set on the "default" compute machine pool. +func (o *ClusterNodes) ComputeLabels() map[string]string { + if o != nil && o.bitmap_&8 != 0 { + return o.computeLabels + } + return nil +} + +// GetComputeLabels returns the value of the 'compute_labels' attribute and +// a flag indicating if the attribute has a value. +// +// The labels set on the "default" compute machine pool. +func (o *ClusterNodes) GetComputeLabels() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.computeLabels + } + return +} + +// ComputeMachineType returns the value of the 'compute_machine_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The compute machine type to use, for example `r5.xlarge`. +func (o *ClusterNodes) ComputeMachineType() *MachineType { + if o != nil && o.bitmap_&16 != 0 { + return o.computeMachineType + } + return nil +} + +// GetComputeMachineType returns the value of the 'compute_machine_type' attribute and +// a flag indicating if the attribute has a value. +// +// The compute machine type to use, for example `r5.xlarge`. +func (o *ClusterNodes) GetComputeMachineType() (value *MachineType, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.computeMachineType + } + return +} + +// ComputeRootVolume returns the value of the 'compute_root_volume' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The compute machine root volume capabilities. +func (o *ClusterNodes) ComputeRootVolume() *RootVolume { + if o != nil && o.bitmap_&32 != 0 { + return o.computeRootVolume + } + return nil +} + +// GetComputeRootVolume returns the value of the 'compute_root_volume' attribute and +// a flag indicating if the attribute has a value. +// +// The compute machine root volume capabilities. +func (o *ClusterNodes) GetComputeRootVolume() (value *RootVolume, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.computeRootVolume + } + return +} + +// Infra returns the value of the 'infra' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Number of infrastructure nodes of the cluster. +func (o *ClusterNodes) Infra() int { + if o != nil && o.bitmap_&64 != 0 { + return o.infra + } + return 0 +} + +// GetInfra returns the value of the 'infra' attribute and +// a flag indicating if the attribute has a value. +// +// Number of infrastructure nodes of the cluster. +func (o *ClusterNodes) GetInfra() (value int, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.infra + } + return +} + +// InfraMachineType returns the value of the 'infra_machine_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The infra machine type to use, for example `r5.xlarge` (Optional). +func (o *ClusterNodes) InfraMachineType() *MachineType { + if o != nil && o.bitmap_&128 != 0 { + return o.infraMachineType + } + return nil +} + +// GetInfraMachineType returns the value of the 'infra_machine_type' attribute and +// a flag indicating if the attribute has a value. +// +// The infra machine type to use, for example `r5.xlarge` (Optional). +func (o *ClusterNodes) GetInfraMachineType() (value *MachineType, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.infraMachineType + } + return +} + +// Master returns the value of the 'master' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Number of master nodes of the cluster. +func (o *ClusterNodes) Master() int { + if o != nil && o.bitmap_&256 != 0 { + return o.master + } + return 0 +} + +// GetMaster returns the value of the 'master' attribute and +// a flag indicating if the attribute has a value. +// +// Number of master nodes of the cluster. +func (o *ClusterNodes) GetMaster() (value int, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.master + } + return +} + +// MasterMachineType returns the value of the 'master_machine_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The master machine type to use, for example `r5.xlarge` (Optional). +func (o *ClusterNodes) MasterMachineType() *MachineType { + if o != nil && o.bitmap_&512 != 0 { + return o.masterMachineType + } + return nil +} + +// GetMasterMachineType returns the value of the 'master_machine_type' attribute and +// a flag indicating if the attribute has a value. +// +// The master machine type to use, for example `r5.xlarge` (Optional). +func (o *ClusterNodes) GetMasterMachineType() (value *MachineType, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.masterMachineType + } + return +} + +// SecurityGroupFilters returns the value of the 'security_group_filters' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of security groups to be applied to nodes (Optional). +func (o *ClusterNodes) SecurityGroupFilters() []*MachinePoolSecurityGroupFilter { + if o != nil && o.bitmap_&1024 != 0 { + return o.securityGroupFilters + } + return nil +} + +// GetSecurityGroupFilters returns the value of the 'security_group_filters' attribute and +// a flag indicating if the attribute has a value. +// +// List of security groups to be applied to nodes (Optional). +func (o *ClusterNodes) GetSecurityGroupFilters() (value []*MachinePoolSecurityGroupFilter, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.securityGroupFilters + } + return +} + +// Total returns the value of the 'total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Total number of nodes of the cluster. +func (o *ClusterNodes) Total() int { + if o != nil && o.bitmap_&2048 != 0 { + return o.total + } + return 0 +} + +// GetTotal returns the value of the 'total' attribute and +// a flag indicating if the attribute has a value. +// +// Total number of nodes of the cluster. +func (o *ClusterNodes) GetTotal() (value int, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.total + } + return +} + +// ClusterNodesListKind is the name of the type used to represent list of objects of +// type 'cluster_nodes'. +const ClusterNodesListKind = "ClusterNodesList" + +// ClusterNodesListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_nodes'. +const ClusterNodesListLinkKind = "ClusterNodesListLink" + +// ClusterNodesNilKind is the name of the type used to nil lists of objects of +// type 'cluster_nodes'. +const ClusterNodesListNilKind = "ClusterNodesListNil" + +// ClusterNodesList is a list of values of the 'cluster_nodes' type. +type ClusterNodesList struct { + href string + link bool + items []*ClusterNodes +} + +// Len returns the length of the list. +func (l *ClusterNodesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterNodesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterNodesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterNodesList) SetItems(items []*ClusterNodes) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterNodesList) Items() []*ClusterNodes { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterNodesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterNodesList) Get(i int) *ClusterNodes { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterNodesList) Slice() []*ClusterNodes { + var slice []*ClusterNodes + if l == nil { + slice = make([]*ClusterNodes, 0) + } else { + slice = make([]*ClusterNodes, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterNodesList) Each(f func(item *ClusterNodes) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterNodesList) Range(f func(index int, item *ClusterNodes) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/cluster_nodes_type_json.go b/clientapi/arohcp/v1alpha1/cluster_nodes_type_json.go new file mode 100644 index 00000000..ba5df82c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_nodes_type_json.go @@ -0,0 +1,258 @@ +/* +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" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterNodes writes a value of the 'cluster_nodes' type to the given writer. +func MarshalClusterNodes(object *ClusterNodes, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterNodes(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterNodes writes a value of the 'cluster_nodes' type to the given stream. +func WriteClusterNodes(object *ClusterNodes, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.autoscaleCompute != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("autoscale_compute") + WriteMachinePoolAutoscaling(object.autoscaleCompute, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.availabilityZones != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zones") + WriteStringList(object.availabilityZones, stream) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute") + stream.WriteInt(object.compute) + count++ + } + present_ = object.bitmap_&8 != 0 && object.computeLabels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute_labels") + if object.computeLabels != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.computeLabels)) + i := 0 + for key := range object.computeLabels { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.computeLabels[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&16 != 0 && object.computeMachineType != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute_machine_type") + WriteMachineType(object.computeMachineType, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.computeRootVolume != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute_root_volume") + WriteRootVolume(object.computeRootVolume, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("infra") + stream.WriteInt(object.infra) + count++ + } + present_ = object.bitmap_&128 != 0 && object.infraMachineType != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("infra_machine_type") + WriteMachineType(object.infraMachineType, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("master") + stream.WriteInt(object.master) + count++ + } + present_ = object.bitmap_&512 != 0 && object.masterMachineType != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("master_machine_type") + WriteMachineType(object.masterMachineType, stream) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.securityGroupFilters != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("security_group_filters") + WriteMachinePoolSecurityGroupFilterList(object.securityGroupFilters, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("total") + stream.WriteInt(object.total) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterNodes reads a value of the 'cluster_nodes' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterNodes(source interface{}) (object *ClusterNodes, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterNodes(iterator) + err = iterator.Error + return +} + +// ReadClusterNodes reads a value of the 'cluster_nodes' type from the given iterator. +func ReadClusterNodes(iterator *jsoniter.Iterator) *ClusterNodes { + object := &ClusterNodes{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "autoscale_compute": + value := ReadMachinePoolAutoscaling(iterator) + object.autoscaleCompute = value + object.bitmap_ |= 1 + case "availability_zones": + value := ReadStringList(iterator) + object.availabilityZones = value + object.bitmap_ |= 2 + case "compute": + value := iterator.ReadInt() + object.compute = value + object.bitmap_ |= 4 + case "compute_labels": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.computeLabels = value + object.bitmap_ |= 8 + case "compute_machine_type": + value := ReadMachineType(iterator) + object.computeMachineType = value + object.bitmap_ |= 16 + case "compute_root_volume": + value := ReadRootVolume(iterator) + object.computeRootVolume = value + object.bitmap_ |= 32 + case "infra": + value := iterator.ReadInt() + object.infra = value + object.bitmap_ |= 64 + case "infra_machine_type": + value := ReadMachineType(iterator) + object.infraMachineType = value + object.bitmap_ |= 128 + case "master": + value := iterator.ReadInt() + object.master = value + object.bitmap_ |= 256 + case "master_machine_type": + value := ReadMachineType(iterator) + object.masterMachineType = value + object.bitmap_ |= 512 + case "security_group_filters": + value := ReadMachinePoolSecurityGroupFilterList(iterator) + object.securityGroupFilters = value + object.bitmap_ |= 1024 + case "total": + value := iterator.ReadInt() + object.total = value + object.bitmap_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/cluster_registry_config_builder.go b/clientapi/arohcp/v1alpha1/cluster_registry_config_builder.go new file mode 100644 index 00000000..ad069406 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_registry_config_builder.go @@ -0,0 +1,173 @@ +/* +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 + +// ClusterRegistryConfigBuilder contains the data and logic needed to build 'cluster_registry_config' objects. +// +// ClusterRegistryConfig describes the configuration of registries for the cluster. +// Its format reflects the OpenShift Image Configuration, for which docs are available on +// [docs.openshift.com](https://docs.openshift.com/container-platform/4.16/openshift_images/image-configuration.html) +// ```json +// +// { +// "registry_config": { +// "registry_sources": { +// "blocked_registries": [ +// "badregistry.io", +// "badregistry8.io" +// ] +// } +// } +// } +// +// ``` +type ClusterRegistryConfigBuilder struct { + bitmap_ uint32 + additionalTrustedCa map[string]string + allowedRegistriesForImport []*RegistryLocationBuilder + platformAllowlist *RegistryAllowlistBuilder + registrySources *RegistrySourcesBuilder +} + +// NewClusterRegistryConfig creates a new builder of 'cluster_registry_config' objects. +func NewClusterRegistryConfig() *ClusterRegistryConfigBuilder { + return &ClusterRegistryConfigBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterRegistryConfigBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AdditionalTrustedCa sets the value of the 'additional_trusted_ca' attribute to the given value. +func (b *ClusterRegistryConfigBuilder) AdditionalTrustedCa(value map[string]string) *ClusterRegistryConfigBuilder { + b.additionalTrustedCa = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// AllowedRegistriesForImport sets the value of the 'allowed_registries_for_import' attribute to the given values. +func (b *ClusterRegistryConfigBuilder) AllowedRegistriesForImport(values ...*RegistryLocationBuilder) *ClusterRegistryConfigBuilder { + b.allowedRegistriesForImport = make([]*RegistryLocationBuilder, len(values)) + copy(b.allowedRegistriesForImport, values) + b.bitmap_ |= 2 + return b +} + +// PlatformAllowlist sets the value of the 'platform_allowlist' attribute to the given value. +// +// RegistryAllowlist represents a single registry allowlist. +func (b *ClusterRegistryConfigBuilder) PlatformAllowlist(value *RegistryAllowlistBuilder) *ClusterRegistryConfigBuilder { + b.platformAllowlist = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// RegistrySources sets the value of the 'registry_sources' attribute to the given value. +// +// RegistrySources contains configuration that determines how the container runtime should treat individual +// registries when accessing images for builds and pods. For instance, whether or not to allow insecure access. +// It does not contain configuration for the internal cluster registry. +func (b *ClusterRegistryConfigBuilder) RegistrySources(value *RegistrySourcesBuilder) *ClusterRegistryConfigBuilder { + b.registrySources = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterRegistryConfigBuilder) Copy(object *ClusterRegistryConfig) *ClusterRegistryConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if len(object.additionalTrustedCa) > 0 { + b.additionalTrustedCa = map[string]string{} + for k, v := range object.additionalTrustedCa { + b.additionalTrustedCa[k] = v + } + } else { + b.additionalTrustedCa = nil + } + if object.allowedRegistriesForImport != nil { + b.allowedRegistriesForImport = make([]*RegistryLocationBuilder, len(object.allowedRegistriesForImport)) + for i, v := range object.allowedRegistriesForImport { + b.allowedRegistriesForImport[i] = NewRegistryLocation().Copy(v) + } + } else { + b.allowedRegistriesForImport = nil + } + if object.platformAllowlist != nil { + b.platformAllowlist = NewRegistryAllowlist().Copy(object.platformAllowlist) + } else { + b.platformAllowlist = nil + } + if object.registrySources != nil { + b.registrySources = NewRegistrySources().Copy(object.registrySources) + } else { + b.registrySources = nil + } + return b +} + +// Build creates a 'cluster_registry_config' object using the configuration stored in the builder. +func (b *ClusterRegistryConfigBuilder) Build() (object *ClusterRegistryConfig, err error) { + object = new(ClusterRegistryConfig) + object.bitmap_ = b.bitmap_ + if b.additionalTrustedCa != nil { + object.additionalTrustedCa = make(map[string]string) + for k, v := range b.additionalTrustedCa { + object.additionalTrustedCa[k] = v + } + } + if b.allowedRegistriesForImport != nil { + object.allowedRegistriesForImport = make([]*RegistryLocation, len(b.allowedRegistriesForImport)) + for i, v := range b.allowedRegistriesForImport { + object.allowedRegistriesForImport[i], err = v.Build() + if err != nil { + return + } + } + } + if b.platformAllowlist != nil { + object.platformAllowlist, err = b.platformAllowlist.Build() + if err != nil { + return + } + } + if b.registrySources != nil { + object.registrySources, err = b.registrySources.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_registry_config_list_builder.go b/clientapi/arohcp/v1alpha1/cluster_registry_config_list_builder.go new file mode 100644 index 00000000..fe657e70 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_registry_config_list_builder.go @@ -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 + +// ClusterRegistryConfigListBuilder contains the data and logic needed to build +// 'cluster_registry_config' objects. +type ClusterRegistryConfigListBuilder struct { + items []*ClusterRegistryConfigBuilder +} + +// NewClusterRegistryConfigList creates a new builder of 'cluster_registry_config' objects. +func NewClusterRegistryConfigList() *ClusterRegistryConfigListBuilder { + return new(ClusterRegistryConfigListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterRegistryConfigListBuilder) Items(values ...*ClusterRegistryConfigBuilder) *ClusterRegistryConfigListBuilder { + b.items = make([]*ClusterRegistryConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterRegistryConfigListBuilder) 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 *ClusterRegistryConfigListBuilder) Copy(list *ClusterRegistryConfigList) *ClusterRegistryConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterRegistryConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterRegistryConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_registry_config' objects using the +// configuration stored in the builder. +func (b *ClusterRegistryConfigListBuilder) Build() (list *ClusterRegistryConfigList, err error) { + items := make([]*ClusterRegistryConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterRegistryConfigList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_registry_config_list_type_json.go b/clientapi/arohcp/v1alpha1/cluster_registry_config_list_type_json.go new file mode 100644 index 00000000..90d914db --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_registry_config_list_type_json.go @@ -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" +) + +// MarshalClusterRegistryConfigList writes a list of values of the 'cluster_registry_config' type to +// the given writer. +func MarshalClusterRegistryConfigList(list []*ClusterRegistryConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterRegistryConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterRegistryConfigList writes a list of value of the 'cluster_registry_config' type to +// the given stream. +func WriteClusterRegistryConfigList(list []*ClusterRegistryConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterRegistryConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterRegistryConfigList reads a list of values of the 'cluster_registry_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterRegistryConfigList(source interface{}) (items []*ClusterRegistryConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterRegistryConfigList(iterator) + err = iterator.Error + return +} + +// ReadClusterRegistryConfigList reads list of values of the ”cluster_registry_config' type from +// the given iterator. +func ReadClusterRegistryConfigList(iterator *jsoniter.Iterator) []*ClusterRegistryConfig { + list := []*ClusterRegistryConfig{} + for iterator.ReadArray() { + item := ReadClusterRegistryConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/cluster_registry_config_type.go b/clientapi/arohcp/v1alpha1/cluster_registry_config_type.go new file mode 100644 index 00000000..2cb902ec --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_registry_config_type.go @@ -0,0 +1,275 @@ +/* +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 + +// ClusterRegistryConfig represents the values of the 'cluster_registry_config' type. +// +// ClusterRegistryConfig describes the configuration of registries for the cluster. +// Its format reflects the OpenShift Image Configuration, for which docs are available on +// [docs.openshift.com](https://docs.openshift.com/container-platform/4.16/openshift_images/image-configuration.html) +// ```json +// +// { +// "registry_config": { +// "registry_sources": { +// "blocked_registries": [ +// "badregistry.io", +// "badregistry8.io" +// ] +// } +// } +// } +// +// ``` +type ClusterRegistryConfig struct { + bitmap_ uint32 + additionalTrustedCa map[string]string + allowedRegistriesForImport []*RegistryLocation + platformAllowlist *RegistryAllowlist + registrySources *RegistrySources +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterRegistryConfig) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AdditionalTrustedCa returns the value of the 'additional_trusted_ca' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// A map containing the registry hostname as the key, and the PEM-encoded certificate as the value, +// for each additional registry CA to trust. +func (o *ClusterRegistryConfig) AdditionalTrustedCa() map[string]string { + if o != nil && o.bitmap_&1 != 0 { + return o.additionalTrustedCa + } + return nil +} + +// GetAdditionalTrustedCa returns the value of the 'additional_trusted_ca' attribute and +// a flag indicating if the attribute has a value. +// +// A map containing the registry hostname as the key, and the PEM-encoded certificate as the value, +// for each additional registry CA to trust. +func (o *ClusterRegistryConfig) GetAdditionalTrustedCa() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.additionalTrustedCa + } + return +} + +// AllowedRegistriesForImport returns the value of the 'allowed_registries_for_import' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AllowedRegistriesForImport limits the container image registries that normal users may import +// images from. Set this list to the registries that you trust to contain valid Docker +// images and that you want applications to be able to import from. Users with +// permission to create Images or ImageStreamMappings via the API are not affected by +// this policy - typically only administrators or system integrations will have those +// permissions. +func (o *ClusterRegistryConfig) AllowedRegistriesForImport() []*RegistryLocation { + if o != nil && o.bitmap_&2 != 0 { + return o.allowedRegistriesForImport + } + return nil +} + +// GetAllowedRegistriesForImport returns the value of the 'allowed_registries_for_import' attribute and +// a flag indicating if the attribute has a value. +// +// AllowedRegistriesForImport limits the container image registries that normal users may import +// images from. Set this list to the registries that you trust to contain valid Docker +// images and that you want applications to be able to import from. Users with +// permission to create Images or ImageStreamMappings via the API are not affected by +// this policy - typically only administrators or system integrations will have those +// permissions. +func (o *ClusterRegistryConfig) GetAllowedRegistriesForImport() (value []*RegistryLocation, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.allowedRegistriesForImport + } + return +} + +// PlatformAllowlist returns the value of the 'platform_allowlist' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// PlatformAllowlist contains a reference to a RegistryAllowlist which is a list of internal registries +// which needs to be whitelisted for the platform to work. It can be omitted at creation and +// updating and its lifecycle can be managed separately if needed. +func (o *ClusterRegistryConfig) PlatformAllowlist() *RegistryAllowlist { + if o != nil && o.bitmap_&4 != 0 { + return o.platformAllowlist + } + return nil +} + +// GetPlatformAllowlist returns the value of the 'platform_allowlist' attribute and +// a flag indicating if the attribute has a value. +// +// PlatformAllowlist contains a reference to a RegistryAllowlist which is a list of internal registries +// which needs to be whitelisted for the platform to work. It can be omitted at creation and +// updating and its lifecycle can be managed separately if needed. +func (o *ClusterRegistryConfig) GetPlatformAllowlist() (value *RegistryAllowlist, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.platformAllowlist + } + return +} + +// RegistrySources returns the value of the 'registry_sources' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// RegistrySources contains configuration that determines how the container runtime +// should treat individual registries when accessing images for builds+pods. (e.g. +// whether or not to allow insecure access). It does not contain configuration for the +// internal cluster registry. +func (o *ClusterRegistryConfig) RegistrySources() *RegistrySources { + if o != nil && o.bitmap_&8 != 0 { + return o.registrySources + } + return nil +} + +// GetRegistrySources returns the value of the 'registry_sources' attribute and +// a flag indicating if the attribute has a value. +// +// RegistrySources contains configuration that determines how the container runtime +// should treat individual registries when accessing images for builds+pods. (e.g. +// whether or not to allow insecure access). It does not contain configuration for the +// internal cluster registry. +func (o *ClusterRegistryConfig) GetRegistrySources() (value *RegistrySources, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.registrySources + } + return +} + +// ClusterRegistryConfigListKind is the name of the type used to represent list of objects of +// type 'cluster_registry_config'. +const ClusterRegistryConfigListKind = "ClusterRegistryConfigList" + +// ClusterRegistryConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_registry_config'. +const ClusterRegistryConfigListLinkKind = "ClusterRegistryConfigListLink" + +// ClusterRegistryConfigNilKind is the name of the type used to nil lists of objects of +// type 'cluster_registry_config'. +const ClusterRegistryConfigListNilKind = "ClusterRegistryConfigListNil" + +// ClusterRegistryConfigList is a list of values of the 'cluster_registry_config' type. +type ClusterRegistryConfigList struct { + href string + link bool + items []*ClusterRegistryConfig +} + +// Len returns the length of the list. +func (l *ClusterRegistryConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterRegistryConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterRegistryConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterRegistryConfigList) SetItems(items []*ClusterRegistryConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterRegistryConfigList) Items() []*ClusterRegistryConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterRegistryConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterRegistryConfigList) Get(i int) *ClusterRegistryConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterRegistryConfigList) Slice() []*ClusterRegistryConfig { + var slice []*ClusterRegistryConfig + if l == nil { + slice = make([]*ClusterRegistryConfig, 0) + } else { + slice = make([]*ClusterRegistryConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterRegistryConfigList) Each(f func(item *ClusterRegistryConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterRegistryConfigList) Range(f func(index int, item *ClusterRegistryConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/cluster_registry_config_type_json.go b/clientapi/arohcp/v1alpha1/cluster_registry_config_type_json.go new file mode 100644 index 00000000..f1ac94d1 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_registry_config_type_json.go @@ -0,0 +1,154 @@ +/* +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" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterRegistryConfig writes a value of the 'cluster_registry_config' type to the given writer. +func MarshalClusterRegistryConfig(object *ClusterRegistryConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterRegistryConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterRegistryConfig writes a value of the 'cluster_registry_config' type to the given stream. +func WriteClusterRegistryConfig(object *ClusterRegistryConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.additionalTrustedCa != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_trusted_ca") + if object.additionalTrustedCa != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.additionalTrustedCa)) + i := 0 + for key := range object.additionalTrustedCa { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.additionalTrustedCa[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&2 != 0 && object.allowedRegistriesForImport != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("allowed_registries_for_import") + WriteRegistryLocationList(object.allowedRegistriesForImport, stream) + count++ + } + present_ = object.bitmap_&4 != 0 && object.platformAllowlist != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("platform_allowlist") + WriteRegistryAllowlist(object.platformAllowlist, stream) + count++ + } + present_ = object.bitmap_&8 != 0 && object.registrySources != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("registry_sources") + WriteRegistrySources(object.registrySources, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterRegistryConfig reads a value of the 'cluster_registry_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterRegistryConfig(source interface{}) (object *ClusterRegistryConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterRegistryConfig(iterator) + err = iterator.Error + return +} + +// ReadClusterRegistryConfig reads a value of the 'cluster_registry_config' type from the given iterator. +func ReadClusterRegistryConfig(iterator *jsoniter.Iterator) *ClusterRegistryConfig { + object := &ClusterRegistryConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "additional_trusted_ca": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.additionalTrustedCa = value + object.bitmap_ |= 1 + case "allowed_registries_for_import": + value := ReadRegistryLocationList(iterator) + object.allowedRegistriesForImport = value + object.bitmap_ |= 2 + case "platform_allowlist": + value := ReadRegistryAllowlist(iterator) + object.platformAllowlist = value + object.bitmap_ |= 4 + case "registry_sources": + value := ReadRegistrySources(iterator) + object.registrySources = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/cluster_state_list_type_json.go b/clientapi/arohcp/v1alpha1/cluster_state_list_type_json.go new file mode 100644 index 00000000..e05182aa --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_state_list_type_json.go @@ -0,0 +1,76 @@ +/* +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" +) + +// MarshalClusterStateList writes a list of values of the 'cluster_state' type to +// the given writer. +func MarshalClusterStateList(list []ClusterState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterStateList writes a list of value of the 'cluster_state' type to +// the given stream. +func WriteClusterStateList(list []ClusterState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterStateList reads a list of values of the 'cluster_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterStateList(source interface{}) (items []ClusterState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterStateList(iterator) + err = iterator.Error + return +} + +// ReadClusterStateList reads list of values of the ”cluster_state' type from +// the given iterator. +func ReadClusterStateList(iterator *jsoniter.Iterator) []ClusterState { + list := []ClusterState{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ClusterState(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/cluster_state_type.go b/clientapi/arohcp/v1alpha1/cluster_state_type.go new file mode 100644 index 00000000..7f8cf628 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_state_type.go @@ -0,0 +1,48 @@ +/* +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 + +// ClusterState represents the values of the 'cluster_state' enumerated type. +type ClusterState string + +const ( + // Error during installation. + ClusterStateError ClusterState = "error" + // The cluster will consume marginal cloud provider infrastructure but will be counted for quota. + ClusterStateHibernating ClusterState = "hibernating" + // The cluster is still being installed. + ClusterStateInstalling ClusterState = "installing" + // The cluster is pending resources before being provisioned. + ClusterStatePending ClusterState = "pending" + // The cluster is moving from 'Ready' state to 'Hibernating'. + ClusterStatePoweringDown ClusterState = "powering_down" + // The cluster is ready to use. + ClusterStateReady ClusterState = "ready" + // The cluster is moving from 'Hibernating' state to 'Ready'. + ClusterStateResuming ClusterState = "resuming" + // The cluster is being uninstalled. + ClusterStateUninstalling ClusterState = "uninstalling" + // The state of the cluster is unknown. + ClusterStateUnknown ClusterState = "unknown" + // The cluster is validating user input. + ClusterStateValidating ClusterState = "validating" + // The cluster is waiting for user action. + ClusterStateWaiting ClusterState = "waiting" +) diff --git a/clientapi/arohcp/v1alpha1/cluster_status_builder.go b/clientapi/arohcp/v1alpha1/cluster_status_builder.go new file mode 100644 index 00000000..5f5049e4 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_status_builder.go @@ -0,0 +1,173 @@ +/* +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 + +// ClusterStatusBuilder contains the data and logic needed to build 'cluster_status' objects. +// +// Detailed status of a cluster. +type ClusterStatusBuilder struct { + bitmap_ uint32 + id string + href string + configurationMode ClusterConfigurationMode + currentCompute int + description string + limitedSupportReasonCount int + provisionErrorCode string + provisionErrorMessage string + state ClusterState + dnsReady bool + oidcReady bool +} + +// NewClusterStatus creates a new builder of 'cluster_status' objects. +func NewClusterStatus() *ClusterStatusBuilder { + return &ClusterStatusBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ClusterStatusBuilder) Link(value bool) *ClusterStatusBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ClusterStatusBuilder) ID(value string) *ClusterStatusBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ClusterStatusBuilder) HREF(value string) *ClusterStatusBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterStatusBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// DNSReady sets the value of the 'DNS_ready' attribute to the given value. +func (b *ClusterStatusBuilder) DNSReady(value bool) *ClusterStatusBuilder { + b.dnsReady = value + b.bitmap_ |= 8 + return b +} + +// OIDCReady sets the value of the 'OIDC_ready' attribute to the given value. +func (b *ClusterStatusBuilder) OIDCReady(value bool) *ClusterStatusBuilder { + b.oidcReady = value + b.bitmap_ |= 16 + return b +} + +// ConfigurationMode sets the value of the 'configuration_mode' attribute to the given value. +// +// Configuration mode of a cluster. +func (b *ClusterStatusBuilder) ConfigurationMode(value ClusterConfigurationMode) *ClusterStatusBuilder { + b.configurationMode = value + b.bitmap_ |= 32 + return b +} + +// CurrentCompute sets the value of the 'current_compute' attribute to the given value. +func (b *ClusterStatusBuilder) CurrentCompute(value int) *ClusterStatusBuilder { + b.currentCompute = value + b.bitmap_ |= 64 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *ClusterStatusBuilder) Description(value string) *ClusterStatusBuilder { + b.description = value + b.bitmap_ |= 128 + return b +} + +// LimitedSupportReasonCount sets the value of the 'limited_support_reason_count' attribute to the given value. +func (b *ClusterStatusBuilder) LimitedSupportReasonCount(value int) *ClusterStatusBuilder { + b.limitedSupportReasonCount = value + b.bitmap_ |= 256 + return b +} + +// ProvisionErrorCode sets the value of the 'provision_error_code' attribute to the given value. +func (b *ClusterStatusBuilder) ProvisionErrorCode(value string) *ClusterStatusBuilder { + b.provisionErrorCode = value + b.bitmap_ |= 512 + return b +} + +// ProvisionErrorMessage sets the value of the 'provision_error_message' attribute to the given value. +func (b *ClusterStatusBuilder) ProvisionErrorMessage(value string) *ClusterStatusBuilder { + b.provisionErrorMessage = value + b.bitmap_ |= 1024 + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// Overall state of a cluster. +func (b *ClusterStatusBuilder) State(value ClusterState) *ClusterStatusBuilder { + b.state = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterStatusBuilder) Copy(object *ClusterStatus) *ClusterStatusBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.dnsReady = object.dnsReady + b.oidcReady = object.oidcReady + b.configurationMode = object.configurationMode + b.currentCompute = object.currentCompute + b.description = object.description + b.limitedSupportReasonCount = object.limitedSupportReasonCount + b.provisionErrorCode = object.provisionErrorCode + b.provisionErrorMessage = object.provisionErrorMessage + b.state = object.state + return b +} + +// Build creates a 'cluster_status' object using the configuration stored in the builder. +func (b *ClusterStatusBuilder) Build() (object *ClusterStatus, err error) { + object = new(ClusterStatus) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.dnsReady = b.dnsReady + object.oidcReady = b.oidcReady + object.configurationMode = b.configurationMode + object.currentCompute = b.currentCompute + object.description = b.description + object.limitedSupportReasonCount = b.limitedSupportReasonCount + object.provisionErrorCode = b.provisionErrorCode + object.provisionErrorMessage = b.provisionErrorMessage + object.state = b.state + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_status_list_builder.go b/clientapi/arohcp/v1alpha1/cluster_status_list_builder.go new file mode 100644 index 00000000..d488564b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_status_list_builder.go @@ -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 + +// ClusterStatusListBuilder contains the data and logic needed to build +// 'cluster_status' objects. +type ClusterStatusListBuilder struct { + items []*ClusterStatusBuilder +} + +// NewClusterStatusList creates a new builder of 'cluster_status' objects. +func NewClusterStatusList() *ClusterStatusListBuilder { + return new(ClusterStatusListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterStatusListBuilder) Items(values ...*ClusterStatusBuilder) *ClusterStatusListBuilder { + b.items = make([]*ClusterStatusBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterStatusListBuilder) 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 *ClusterStatusListBuilder) Copy(list *ClusterStatusList) *ClusterStatusListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterStatusBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterStatus().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_status' objects using the +// configuration stored in the builder. +func (b *ClusterStatusListBuilder) Build() (list *ClusterStatusList, err error) { + items := make([]*ClusterStatus, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterStatusList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/cluster_status_list_type_json.go b/clientapi/arohcp/v1alpha1/cluster_status_list_type_json.go new file mode 100644 index 00000000..1c9db851 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_status_list_type_json.go @@ -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" +) + +// MarshalClusterStatusList writes a list of values of the 'cluster_status' type to +// the given writer. +func MarshalClusterStatusList(list []*ClusterStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterStatusList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterStatusList writes a list of value of the 'cluster_status' type to +// the given stream. +func WriteClusterStatusList(list []*ClusterStatus, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterStatus(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterStatusList reads a list of values of the 'cluster_status' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterStatusList(source interface{}) (items []*ClusterStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterStatusList(iterator) + err = iterator.Error + return +} + +// ReadClusterStatusList reads list of values of the ”cluster_status' type from +// the given iterator. +func ReadClusterStatusList(iterator *jsoniter.Iterator) []*ClusterStatus { + list := []*ClusterStatus{} + for iterator.ReadArray() { + item := ReadClusterStatus(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/cluster_status_type.go b/clientapi/arohcp/v1alpha1/cluster_status_type.go new file mode 100644 index 00000000..f30b040d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_status_type.go @@ -0,0 +1,457 @@ +/* +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 + +// ClusterStatusKind is the name of the type used to represent objects +// of type 'cluster_status'. +const ClusterStatusKind = "ClusterStatus" + +// ClusterStatusLinkKind is the name of the type used to represent links +// to objects of type 'cluster_status'. +const ClusterStatusLinkKind = "ClusterStatusLink" + +// ClusterStatusNilKind is the name of the type used to nil references +// to objects of type 'cluster_status'. +const ClusterStatusNilKind = "ClusterStatusNil" + +// ClusterStatus represents the values of the 'cluster_status' type. +// +// Detailed status of a cluster. +type ClusterStatus struct { + bitmap_ uint32 + id string + href string + configurationMode ClusterConfigurationMode + currentCompute int + description string + limitedSupportReasonCount int + provisionErrorCode string + provisionErrorMessage string + state ClusterState + dnsReady bool + oidcReady bool +} + +// Kind returns the name of the type of the object. +func (o *ClusterStatus) Kind() string { + if o == nil { + return ClusterStatusNilKind + } + if o.bitmap_&1 != 0 { + return ClusterStatusLinkKind + } + return ClusterStatusKind +} + +// Link returns true if this is a link. +func (o *ClusterStatus) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ClusterStatus) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ClusterStatus) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ClusterStatus) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ClusterStatus) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterStatus) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// DNSReady returns the value of the 'DNS_ready' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DNSReady from Provisioner +func (o *ClusterStatus) DNSReady() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.dnsReady + } + return false +} + +// GetDNSReady returns the value of the 'DNS_ready' attribute and +// a flag indicating if the attribute has a value. +// +// DNSReady from Provisioner +func (o *ClusterStatus) GetDNSReady() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.dnsReady + } + return +} + +// OIDCReady returns the value of the 'OIDC_ready' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// OIDCReady from user configuration. +func (o *ClusterStatus) OIDCReady() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.oidcReady + } + return false +} + +// GetOIDCReady returns the value of the 'OIDC_ready' attribute and +// a flag indicating if the attribute has a value. +// +// OIDCReady from user configuration. +func (o *ClusterStatus) GetOIDCReady() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.oidcReady + } + return +} + +// ConfigurationMode returns the value of the 'configuration_mode' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Configuration mode +func (o *ClusterStatus) ConfigurationMode() ClusterConfigurationMode { + if o != nil && o.bitmap_&32 != 0 { + return o.configurationMode + } + return ClusterConfigurationMode("") +} + +// GetConfigurationMode returns the value of the 'configuration_mode' attribute and +// a flag indicating if the attribute has a value. +// +// Configuration mode +func (o *ClusterStatus) GetConfigurationMode() (value ClusterConfigurationMode, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.configurationMode + } + return +} + +// CurrentCompute returns the value of the 'current_compute' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Current Replicas available for a Hosted Cluster +func (o *ClusterStatus) CurrentCompute() int { + if o != nil && o.bitmap_&64 != 0 { + return o.currentCompute + } + return 0 +} + +// GetCurrentCompute returns the value of the 'current_compute' attribute and +// a flag indicating if the attribute has a value. +// +// Current Replicas available for a Hosted Cluster +func (o *ClusterStatus) GetCurrentCompute() (value int, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.currentCompute + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Detailed description of the cluster status. +func (o *ClusterStatus) Description() string { + if o != nil && o.bitmap_&128 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Detailed description of the cluster status. +func (o *ClusterStatus) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.description + } + return +} + +// LimitedSupportReasonCount returns the value of the 'limited_support_reason_count' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Limited Support Reason Count +func (o *ClusterStatus) LimitedSupportReasonCount() int { + if o != nil && o.bitmap_&256 != 0 { + return o.limitedSupportReasonCount + } + return 0 +} + +// GetLimitedSupportReasonCount returns the value of the 'limited_support_reason_count' attribute and +// a flag indicating if the attribute has a value. +// +// Limited Support Reason Count +func (o *ClusterStatus) GetLimitedSupportReasonCount() (value int, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.limitedSupportReasonCount + } + return +} + +// ProvisionErrorCode returns the value of the 'provision_error_code' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Provisioning Error Code +func (o *ClusterStatus) ProvisionErrorCode() string { + if o != nil && o.bitmap_&512 != 0 { + return o.provisionErrorCode + } + return "" +} + +// GetProvisionErrorCode returns the value of the 'provision_error_code' attribute and +// a flag indicating if the attribute has a value. +// +// Provisioning Error Code +func (o *ClusterStatus) GetProvisionErrorCode() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.provisionErrorCode + } + return +} + +// ProvisionErrorMessage returns the value of the 'provision_error_message' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Provisioning Error Message +func (o *ClusterStatus) ProvisionErrorMessage() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.provisionErrorMessage + } + return "" +} + +// GetProvisionErrorMessage returns the value of the 'provision_error_message' attribute and +// a flag indicating if the attribute has a value. +// +// Provisioning Error Message +func (o *ClusterStatus) GetProvisionErrorMessage() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.provisionErrorMessage + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The overall state of the cluster. +func (o *ClusterStatus) State() ClusterState { + if o != nil && o.bitmap_&2048 != 0 { + return o.state + } + return ClusterState("") +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// The overall state of the cluster. +func (o *ClusterStatus) GetState() (value ClusterState, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.state + } + return +} + +// ClusterStatusListKind is the name of the type used to represent list of objects of +// type 'cluster_status'. +const ClusterStatusListKind = "ClusterStatusList" + +// ClusterStatusListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_status'. +const ClusterStatusListLinkKind = "ClusterStatusListLink" + +// ClusterStatusNilKind is the name of the type used to nil lists of objects of +// type 'cluster_status'. +const ClusterStatusListNilKind = "ClusterStatusListNil" + +// ClusterStatusList is a list of values of the 'cluster_status' type. +type ClusterStatusList struct { + href string + link bool + items []*ClusterStatus +} + +// Kind returns the name of the type of the object. +func (l *ClusterStatusList) Kind() string { + if l == nil { + return ClusterStatusListNilKind + } + if l.link { + return ClusterStatusListLinkKind + } + return ClusterStatusListKind +} + +// Link returns true iif this is a link. +func (l *ClusterStatusList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ClusterStatusList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ClusterStatusList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ClusterStatusList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterStatusList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterStatusList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterStatusList) SetItems(items []*ClusterStatus) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterStatusList) Items() []*ClusterStatus { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterStatusList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterStatusList) Get(i int) *ClusterStatus { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterStatusList) Slice() []*ClusterStatus { + var slice []*ClusterStatus + if l == nil { + slice = make([]*ClusterStatus, 0) + } else { + slice = make([]*ClusterStatus, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterStatusList) Each(f func(item *ClusterStatus) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterStatusList) Range(f func(index int, item *ClusterStatus) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/cluster_status_type_json.go b/clientapi/arohcp/v1alpha1/cluster_status_type_json.go new file mode 100644 index 00000000..bb9406b8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_status_type_json.go @@ -0,0 +1,226 @@ +/* +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" +) + +// MarshalClusterStatus writes a value of the 'cluster_status' type to the given writer. +func MarshalClusterStatus(object *ClusterStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterStatus(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterStatus writes a value of the 'cluster_status' type to the given stream. +func WriteClusterStatus(object *ClusterStatus, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ClusterStatusLinkKind) + } else { + stream.WriteString(ClusterStatusKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("dns_ready") + stream.WriteBool(object.dnsReady) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("oidc_ready") + stream.WriteBool(object.oidcReady) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("configuration_mode") + stream.WriteString(string(object.configurationMode)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("current_compute") + stream.WriteInt(object.currentCompute) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("limited_support_reason_count") + stream.WriteInt(object.limitedSupportReasonCount) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("provision_error_code") + stream.WriteString(object.provisionErrorCode) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("provision_error_message") + stream.WriteString(object.provisionErrorMessage) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(string(object.state)) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterStatus reads a value of the 'cluster_status' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterStatus(source interface{}) (object *ClusterStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterStatus(iterator) + err = iterator.Error + return +} + +// ReadClusterStatus reads a value of the 'cluster_status' type from the given iterator. +func ReadClusterStatus(iterator *jsoniter.Iterator) *ClusterStatus { + object := &ClusterStatus{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ClusterStatusLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "dns_ready": + value := iterator.ReadBool() + object.dnsReady = value + object.bitmap_ |= 8 + case "oidc_ready": + value := iterator.ReadBool() + object.oidcReady = value + object.bitmap_ |= 16 + case "configuration_mode": + text := iterator.ReadString() + value := ClusterConfigurationMode(text) + object.configurationMode = value + object.bitmap_ |= 32 + case "current_compute": + value := iterator.ReadInt() + object.currentCompute = value + object.bitmap_ |= 64 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 128 + case "limited_support_reason_count": + value := iterator.ReadInt() + object.limitedSupportReasonCount = value + object.bitmap_ |= 256 + case "provision_error_code": + value := iterator.ReadString() + object.provisionErrorCode = value + object.bitmap_ |= 512 + case "provision_error_message": + value := iterator.ReadString() + object.provisionErrorMessage = value + object.bitmap_ |= 1024 + case "state": + text := iterator.ReadString() + value := ClusterState(text) + object.state = value + object.bitmap_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/cluster_type.go b/clientapi/arohcp/v1alpha1/cluster_type.go new file mode 100644 index 00000000..7d513d3d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_type.go @@ -0,0 +1,1763 @@ +/* +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 ( + time "time" + + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// ClusterKind is the name of the type used to represent objects +// of type 'cluster'. +const ClusterKind = "Cluster" + +// ClusterLinkKind is the name of the type used to represent links +// to objects of type 'cluster'. +const ClusterLinkKind = "ClusterLink" + +// ClusterNilKind is the name of the type used to nil references +// to objects of type 'cluster'. +const ClusterNilKind = "ClusterNil" + +// Cluster represents the values of the 'cluster' type. +// +// Definition of an _OpenShift_ cluster. +// +// The `cloud_provider` attribute is a reference to the cloud provider. When a +// cluster is retrieved it will be a link to the cloud provider, containing only +// the kind, id and href attributes: +// +// ```json +// +// { +// "cloud_provider": { +// "kind": "CloudProviderLink", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/cloud_providers/123" +// } +// } +// +// ``` +// +// When a cluster is created this is optional, and if used it should contain the +// identifier of the cloud provider to use: +// +// ```json +// +// { +// "cloud_provider": { +// "id": "123", +// } +// } +// +// ``` +// +// If not included, then the cluster will be created using the default cloud +// provider, which is currently Amazon Web Services. +// +// The region attribute is mandatory when a cluster is created. +// +// The `aws.access_key_id`, `aws.secret_access_key` and `dns.base_domain` +// attributes are mandatory when creation a cluster with your own Amazon Web +// Services account. +type Cluster struct { + bitmap_ uint64 + id string + href string + api *ClusterAPI + aws *AWS + awsInfrastructureAccessRoleGrants *v1.AWSInfrastructureAccessRoleGrantList + ccs *CCS + dns *DNS + gcp *GCP + gcpEncryptionKey *GCPEncryptionKey + gcpNetwork *GCPNetwork + additionalTrustBundle string + addons *v1.AddOnInstallationList + autoscaler *v1.ClusterAutoscaler + azure *Azure + billingModel BillingModel + byoOidc *ByoOidc + capabilities *ClusterCapabilities + cloudProvider *v1.CloudProvider + console *ClusterConsole + creationTimestamp time.Time + deleteProtection *DeleteProtection + domainPrefix string + expirationTimestamp time.Time + externalID string + externalAuthConfig *ExternalAuthConfig + externalConfiguration *ExternalConfiguration + flavour *v1.Flavour + groups *v1.GroupList + healthState ClusterHealthState + htpasswd *HTPasswdIdentityProvider + hypershift *Hypershift + identityProviders *v1.IdentityProviderList + inflightChecks *InflightCheckList + infraID string + ingresses *v1.IngressList + kubeletConfig *KubeletConfig + loadBalancerQuota int + machinePools *v1.MachinePoolList + managedService *ManagedService + name string + network *Network + nodeDrainGracePeriod *Value + nodePools *NodePoolList + nodes *ClusterNodes + openshiftVersion string + product *v1.Product + properties map[string]string + provisionShard *ProvisionShard + proxy *Proxy + region *v1.CloudRegion + registryConfig *ClusterRegistryConfig + state ClusterState + status *ClusterStatus + storageQuota *Value + subscription *v1.Subscription + version *v1.Version + fips bool + disableUserWorkloadMonitoring bool + etcdEncryption bool + managed bool + multiAZ bool + multiArchEnabled bool +} + +// Kind returns the name of the type of the object. +func (o *Cluster) Kind() string { + if o == nil { + return ClusterNilKind + } + if o.bitmap_&1 != 0 { + return ClusterLinkKind + } + return ClusterKind +} + +// Link returns true if this is a link. +func (o *Cluster) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Cluster) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Cluster) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Cluster) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Cluster) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Cluster) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// API returns the value of the 'API' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Information about the API of the cluster. +func (o *Cluster) API() *ClusterAPI { + if o != nil && o.bitmap_&8 != 0 { + return o.api + } + return nil +} + +// GetAPI returns the value of the 'API' attribute and +// a flag indicating if the attribute has a value. +// +// Information about the API of the cluster. +func (o *Cluster) GetAPI() (value *ClusterAPI, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.api + } + return +} + +// AWS returns the value of the 'AWS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Amazon Web Services settings of the cluster. +func (o *Cluster) AWS() *AWS { + if o != nil && o.bitmap_&16 != 0 { + return o.aws + } + return nil +} + +// GetAWS returns the value of the 'AWS' attribute and +// a flag indicating if the attribute has a value. +// +// Amazon Web Services settings of the cluster. +func (o *Cluster) GetAWS() (value *AWS, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.aws + } + return +} + +// AWSInfrastructureAccessRoleGrants returns the value of the 'AWS_infrastructure_access_role_grants' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of AWS infrastructure access role grants on this cluster. +func (o *Cluster) AWSInfrastructureAccessRoleGrants() *v1.AWSInfrastructureAccessRoleGrantList { + if o != nil && o.bitmap_&32 != 0 { + return o.awsInfrastructureAccessRoleGrants + } + return nil +} + +// GetAWSInfrastructureAccessRoleGrants returns the value of the 'AWS_infrastructure_access_role_grants' attribute and +// a flag indicating if the attribute has a value. +// +// List of AWS infrastructure access role grants on this cluster. +func (o *Cluster) GetAWSInfrastructureAccessRoleGrants() (value *v1.AWSInfrastructureAccessRoleGrantList, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.awsInfrastructureAccessRoleGrants + } + return +} + +// CCS returns the value of the 'CCS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains configuration of a Customer Cloud Subscription cluster. +func (o *Cluster) CCS() *CCS { + if o != nil && o.bitmap_&64 != 0 { + return o.ccs + } + return nil +} + +// GetCCS returns the value of the 'CCS' attribute and +// a flag indicating if the attribute has a value. +// +// Contains configuration of a Customer Cloud Subscription cluster. +func (o *Cluster) GetCCS() (value *CCS, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.ccs + } + return +} + +// DNS returns the value of the 'DNS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DNS settings of the cluster. +func (o *Cluster) DNS() *DNS { + if o != nil && o.bitmap_&128 != 0 { + return o.dns + } + return nil +} + +// GetDNS returns the value of the 'DNS' attribute and +// a flag indicating if the attribute has a value. +// +// DNS settings of the cluster. +func (o *Cluster) GetDNS() (value *DNS, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.dns + } + return +} + +// FIPS returns the value of the 'FIPS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Create cluster that uses FIPS Validated / Modules in Process cryptographic libraries. +func (o *Cluster) FIPS() bool { + if o != nil && o.bitmap_&256 != 0 { + return o.fips + } + return false +} + +// GetFIPS returns the value of the 'FIPS' attribute and +// a flag indicating if the attribute has a value. +// +// Create cluster that uses FIPS Validated / Modules in Process cryptographic libraries. +func (o *Cluster) GetFIPS() (value bool, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.fips + } + return +} + +// GCP returns the value of the 'GCP' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Google cloud platform settings of the cluster. +func (o *Cluster) GCP() *GCP { + if o != nil && o.bitmap_&512 != 0 { + return o.gcp + } + return nil +} + +// GetGCP returns the value of the 'GCP' attribute and +// a flag indicating if the attribute has a value. +// +// Google cloud platform settings of the cluster. +func (o *Cluster) GetGCP() (value *GCP, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.gcp + } + return +} + +// GCPEncryptionKey returns the value of the 'GCP_encryption_key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Key used for encryption of GCP cluster nodes. +func (o *Cluster) GCPEncryptionKey() *GCPEncryptionKey { + if o != nil && o.bitmap_&1024 != 0 { + return o.gcpEncryptionKey + } + return nil +} + +// GetGCPEncryptionKey returns the value of the 'GCP_encryption_key' attribute and +// a flag indicating if the attribute has a value. +// +// Key used for encryption of GCP cluster nodes. +func (o *Cluster) GetGCPEncryptionKey() (value *GCPEncryptionKey, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.gcpEncryptionKey + } + return +} + +// GCPNetwork returns the value of the 'GCP_network' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP Network. +func (o *Cluster) GCPNetwork() *GCPNetwork { + if o != nil && o.bitmap_&2048 != 0 { + return o.gcpNetwork + } + return nil +} + +// GetGCPNetwork returns the value of the 'GCP_network' attribute and +// a flag indicating if the attribute has a value. +// +// GCP Network. +func (o *Cluster) GetGCPNetwork() (value *GCPNetwork, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.gcpNetwork + } + return +} + +// AdditionalTrustBundle returns the value of the 'additional_trust_bundle' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional trust bundle. +func (o *Cluster) AdditionalTrustBundle() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.additionalTrustBundle + } + return "" +} + +// GetAdditionalTrustBundle returns the value of the 'additional_trust_bundle' attribute and +// a flag indicating if the attribute has a value. +// +// Additional trust bundle. +func (o *Cluster) GetAdditionalTrustBundle() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.additionalTrustBundle + } + return +} + +// Addons returns the value of the 'addons' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of add-ons on this cluster. +func (o *Cluster) Addons() *v1.AddOnInstallationList { + if o != nil && o.bitmap_&8192 != 0 { + return o.addons + } + return nil +} + +// GetAddons returns the value of the 'addons' attribute and +// a flag indicating if the attribute has a value. +// +// List of add-ons on this cluster. +func (o *Cluster) GetAddons() (value *v1.AddOnInstallationList, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.addons + } + return +} + +// Autoscaler returns the value of the 'autoscaler' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to an optional _ClusterAutoscaler_ that is coupled with the cluster. +func (o *Cluster) Autoscaler() *v1.ClusterAutoscaler { + if o != nil && o.bitmap_&16384 != 0 { + return o.autoscaler + } + return nil +} + +// GetAutoscaler returns the value of the 'autoscaler' attribute and +// a flag indicating if the attribute has a value. +// +// Link to an optional _ClusterAutoscaler_ that is coupled with the cluster. +func (o *Cluster) GetAutoscaler() (value *v1.ClusterAutoscaler, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.autoscaler + } + return +} + +// Azure returns the value of the 'azure' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Microsoft Azure settings of the cluster. +func (o *Cluster) Azure() *Azure { + if o != nil && o.bitmap_&32768 != 0 { + return o.azure + } + return nil +} + +// GetAzure returns the value of the 'azure' attribute and +// a flag indicating if the attribute has a value. +// +// Microsoft Azure settings of the cluster. +func (o *Cluster) GetAzure() (value *Azure, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.azure + } + return +} + +// BillingModel returns the value of the 'billing_model' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Billing model for cluster resources. +func (o *Cluster) BillingModel() BillingModel { + if o != nil && o.bitmap_&65536 != 0 { + return o.billingModel + } + return BillingModel("") +} + +// GetBillingModel returns the value of the 'billing_model' attribute and +// a flag indicating if the attribute has a value. +// +// Billing model for cluster resources. +func (o *Cluster) GetBillingModel() (value BillingModel, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.billingModel + } + return +} + +// ByoOidc returns the value of the 'byo_oidc' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains information about BYO OIDC. +func (o *Cluster) ByoOidc() *ByoOidc { + if o != nil && o.bitmap_&131072 != 0 { + return o.byoOidc + } + return nil +} + +// GetByoOidc returns the value of the 'byo_oidc' attribute and +// a flag indicating if the attribute has a value. +// +// Contains information about BYO OIDC. +func (o *Cluster) GetByoOidc() (value *ByoOidc, ok bool) { + ok = o != nil && o.bitmap_&131072 != 0 + if ok { + value = o.byoOidc + } + return +} + +// Capabilities returns the value of the 'capabilities' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// OpenShift Cluster Capabilities configuration +func (o *Cluster) Capabilities() *ClusterCapabilities { + if o != nil && o.bitmap_&262144 != 0 { + return o.capabilities + } + return nil +} + +// GetCapabilities returns the value of the 'capabilities' attribute and +// a flag indicating if the attribute has a value. +// +// OpenShift Cluster Capabilities configuration +func (o *Cluster) GetCapabilities() (value *ClusterCapabilities, ok bool) { + ok = o != nil && o.bitmap_&262144 != 0 + if ok { + value = o.capabilities + } + return +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the cloud provider where the cluster is installed. +func (o *Cluster) CloudProvider() *v1.CloudProvider { + if o != nil && o.bitmap_&524288 != 0 { + return o.cloudProvider + } + return nil +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the cloud provider where the cluster is installed. +func (o *Cluster) GetCloudProvider() (value *v1.CloudProvider, ok bool) { + ok = o != nil && o.bitmap_&524288 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// Console returns the value of the 'console' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Information about the console of the cluster. +func (o *Cluster) Console() *ClusterConsole { + if o != nil && o.bitmap_&1048576 != 0 { + return o.console + } + return nil +} + +// GetConsole returns the value of the 'console' attribute and +// a flag indicating if the attribute has a value. +// +// Information about the console of the cluster. +func (o *Cluster) GetConsole() (value *ClusterConsole, ok bool) { + ok = o != nil && o.bitmap_&1048576 != 0 + if ok { + value = o.console + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the cluster was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *Cluster) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&2097152 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the cluster was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *Cluster) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&2097152 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// DeleteProtection returns the value of the 'delete_protection' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Delete protection +func (o *Cluster) DeleteProtection() *DeleteProtection { + if o != nil && o.bitmap_&4194304 != 0 { + return o.deleteProtection + } + return nil +} + +// GetDeleteProtection returns the value of the 'delete_protection' attribute and +// a flag indicating if the attribute has a value. +// +// Delete protection +func (o *Cluster) GetDeleteProtection() (value *DeleteProtection, ok bool) { + ok = o != nil && o.bitmap_&4194304 != 0 + if ok { + value = o.deleteProtection + } + return +} + +// DisableUserWorkloadMonitoring returns the value of the 'disable_user_workload_monitoring' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates whether the User workload monitoring is enabled or not +// It is enabled by default +func (o *Cluster) DisableUserWorkloadMonitoring() bool { + if o != nil && o.bitmap_&8388608 != 0 { + return o.disableUserWorkloadMonitoring + } + return false +} + +// GetDisableUserWorkloadMonitoring returns the value of the 'disable_user_workload_monitoring' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates whether the User workload monitoring is enabled or not +// It is enabled by default +func (o *Cluster) GetDisableUserWorkloadMonitoring() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8388608 != 0 + if ok { + value = o.disableUserWorkloadMonitoring + } + return +} + +// DomainPrefix returns the value of the 'domain_prefix' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DomainPrefix of the cluster. This prefix is optionally assigned by the user when the +// cluster is created. It will appear in the Cluster's domain when the cluster is provisioned. +func (o *Cluster) DomainPrefix() string { + if o != nil && o.bitmap_&16777216 != 0 { + return o.domainPrefix + } + return "" +} + +// GetDomainPrefix returns the value of the 'domain_prefix' attribute and +// a flag indicating if the attribute has a value. +// +// DomainPrefix of the cluster. This prefix is optionally assigned by the user when the +// cluster is created. It will appear in the Cluster's domain when the cluster is provisioned. +func (o *Cluster) GetDomainPrefix() (value string, ok bool) { + ok = o != nil && o.bitmap_&16777216 != 0 + if ok { + value = o.domainPrefix + } + return +} + +// EtcdEncryption returns the value of the 'etcd_encryption' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates whether that etcd is encrypted or not. +// This is set only during cluster creation. +func (o *Cluster) EtcdEncryption() bool { + if o != nil && o.bitmap_&33554432 != 0 { + return o.etcdEncryption + } + return false +} + +// GetEtcdEncryption returns the value of the 'etcd_encryption' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates whether that etcd is encrypted or not. +// This is set only during cluster creation. +func (o *Cluster) GetEtcdEncryption() (value bool, ok bool) { + ok = o != nil && o.bitmap_&33554432 != 0 + if ok { + value = o.etcdEncryption + } + return +} + +// ExpirationTimestamp returns the value of the 'expiration_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the cluster will be automatically deleted, using the format defined in +// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). If no timestamp is provided, the cluster +// will never expire. +// +// This option is unsupported. +func (o *Cluster) ExpirationTimestamp() time.Time { + if o != nil && o.bitmap_&67108864 != 0 { + return o.expirationTimestamp + } + return time.Time{} +} + +// GetExpirationTimestamp returns the value of the 'expiration_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the cluster will be automatically deleted, using the format defined in +// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). If no timestamp is provided, the cluster +// will never expire. +// +// This option is unsupported. +func (o *Cluster) GetExpirationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&67108864 != 0 + if ok { + value = o.expirationTimestamp + } + return +} + +// ExternalID returns the value of the 'external_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// External identifier of the cluster, generated by the installer. +func (o *Cluster) ExternalID() string { + if o != nil && o.bitmap_&134217728 != 0 { + return o.externalID + } + return "" +} + +// GetExternalID returns the value of the 'external_ID' attribute and +// a flag indicating if the attribute has a value. +// +// External identifier of the cluster, generated by the installer. +func (o *Cluster) GetExternalID() (value string, ok bool) { + ok = o != nil && o.bitmap_&134217728 != 0 + if ok { + value = o.externalID + } + return +} + +// ExternalAuthConfig returns the value of the 'external_auth_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// External authentication configuration +func (o *Cluster) ExternalAuthConfig() *ExternalAuthConfig { + if o != nil && o.bitmap_&268435456 != 0 { + return o.externalAuthConfig + } + return nil +} + +// GetExternalAuthConfig returns the value of the 'external_auth_config' attribute and +// a flag indicating if the attribute has a value. +// +// External authentication configuration +func (o *Cluster) GetExternalAuthConfig() (value *ExternalAuthConfig, ok bool) { + ok = o != nil && o.bitmap_&268435456 != 0 + if ok { + value = o.externalAuthConfig + } + return +} + +// ExternalConfiguration returns the value of the 'external_configuration' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ExternalConfiguration shows external configuration on the cluster. +func (o *Cluster) ExternalConfiguration() *ExternalConfiguration { + if o != nil && o.bitmap_&536870912 != 0 { + return o.externalConfiguration + } + return nil +} + +// GetExternalConfiguration returns the value of the 'external_configuration' attribute and +// a flag indicating if the attribute has a value. +// +// ExternalConfiguration shows external configuration on the cluster. +func (o *Cluster) GetExternalConfiguration() (value *ExternalConfiguration, ok bool) { + ok = o != nil && o.bitmap_&536870912 != 0 + if ok { + value = o.externalConfiguration + } + return +} + +// Flavour returns the value of the 'flavour' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the _flavour_ that was used to create the cluster. +func (o *Cluster) Flavour() *v1.Flavour { + if o != nil && o.bitmap_&1073741824 != 0 { + return o.flavour + } + return nil +} + +// GetFlavour returns the value of the 'flavour' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the _flavour_ that was used to create the cluster. +func (o *Cluster) GetFlavour() (value *v1.Flavour, ok bool) { + ok = o != nil && o.bitmap_&1073741824 != 0 + if ok { + value = o.flavour + } + return +} + +// Groups returns the value of the 'groups' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the collection of groups of user of the cluster. +func (o *Cluster) Groups() *v1.GroupList { + if o != nil && o.bitmap_&2147483648 != 0 { + return o.groups + } + return nil +} + +// GetGroups returns the value of the 'groups' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the collection of groups of user of the cluster. +func (o *Cluster) GetGroups() (value *v1.GroupList, ok bool) { + ok = o != nil && o.bitmap_&2147483648 != 0 + if ok { + value = o.groups + } + return +} + +// HealthState returns the value of the 'health_state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HealthState indicates the overall health state of the cluster. +func (o *Cluster) HealthState() ClusterHealthState { + if o != nil && o.bitmap_&4294967296 != 0 { + return o.healthState + } + return ClusterHealthState("") +} + +// GetHealthState returns the value of the 'health_state' attribute and +// a flag indicating if the attribute has a value. +// +// HealthState indicates the overall health state of the cluster. +func (o *Cluster) GetHealthState() (value ClusterHealthState, ok bool) { + ok = o != nil && o.bitmap_&4294967296 != 0 + if ok { + value = o.healthState + } + return +} + +// Htpasswd returns the value of the 'htpasswd' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for `htpasswd` identity provider. +func (o *Cluster) Htpasswd() *HTPasswdIdentityProvider { + if o != nil && o.bitmap_&8589934592 != 0 { + return o.htpasswd + } + return nil +} + +// GetHtpasswd returns the value of the 'htpasswd' attribute and +// a flag indicating if the attribute has a value. +// +// Details for `htpasswd` identity provider. +func (o *Cluster) GetHtpasswd() (value *HTPasswdIdentityProvider, ok bool) { + ok = o != nil && o.bitmap_&8589934592 != 0 + if ok { + value = o.htpasswd + } + return +} + +// Hypershift returns the value of the 'hypershift' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Hypershift configuration. +func (o *Cluster) Hypershift() *Hypershift { + if o != nil && o.bitmap_&17179869184 != 0 { + return o.hypershift + } + return nil +} + +// GetHypershift returns the value of the 'hypershift' attribute and +// a flag indicating if the attribute has a value. +// +// Hypershift configuration. +func (o *Cluster) GetHypershift() (value *Hypershift, ok bool) { + ok = o != nil && o.bitmap_&17179869184 != 0 + if ok { + value = o.hypershift + } + return +} + +// IdentityProviders returns the value of the 'identity_providers' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the collection of identity providers of the cluster. +func (o *Cluster) IdentityProviders() *v1.IdentityProviderList { + if o != nil && o.bitmap_&34359738368 != 0 { + return o.identityProviders + } + return nil +} + +// GetIdentityProviders returns the value of the 'identity_providers' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the collection of identity providers of the cluster. +func (o *Cluster) GetIdentityProviders() (value *v1.IdentityProviderList, ok bool) { + ok = o != nil && o.bitmap_&34359738368 != 0 + if ok { + value = o.identityProviders + } + return +} + +// InflightChecks returns the value of the 'inflight_checks' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of inflight checks on this cluster. +func (o *Cluster) InflightChecks() *InflightCheckList { + if o != nil && o.bitmap_&68719476736 != 0 { + return o.inflightChecks + } + return nil +} + +// GetInflightChecks returns the value of the 'inflight_checks' attribute and +// a flag indicating if the attribute has a value. +// +// List of inflight checks on this cluster. +func (o *Cluster) GetInflightChecks() (value *InflightCheckList, ok bool) { + ok = o != nil && o.bitmap_&68719476736 != 0 + if ok { + value = o.inflightChecks + } + return +} + +// InfraID returns the value of the 'infra_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// InfraID is used for example to name the VPCs. +func (o *Cluster) InfraID() string { + if o != nil && o.bitmap_&137438953472 != 0 { + return o.infraID + } + return "" +} + +// GetInfraID returns the value of the 'infra_ID' attribute and +// a flag indicating if the attribute has a value. +// +// InfraID is used for example to name the VPCs. +func (o *Cluster) GetInfraID() (value string, ok bool) { + ok = o != nil && o.bitmap_&137438953472 != 0 + if ok { + value = o.infraID + } + return +} + +// Ingresses returns the value of the 'ingresses' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of ingresses on this cluster. +func (o *Cluster) Ingresses() *v1.IngressList { + if o != nil && o.bitmap_&274877906944 != 0 { + return o.ingresses + } + return nil +} + +// GetIngresses returns the value of the 'ingresses' attribute and +// a flag indicating if the attribute has a value. +// +// List of ingresses on this cluster. +func (o *Cluster) GetIngresses() (value *v1.IngressList, ok bool) { + ok = o != nil && o.bitmap_&274877906944 != 0 + if ok { + value = o.ingresses + } + return +} + +// KubeletConfig returns the value of the 'kubelet_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details of cluster-wide KubeletConfig +func (o *Cluster) KubeletConfig() *KubeletConfig { + if o != nil && o.bitmap_&549755813888 != 0 { + return o.kubeletConfig + } + return nil +} + +// GetKubeletConfig returns the value of the 'kubelet_config' attribute and +// a flag indicating if the attribute has a value. +// +// Details of cluster-wide KubeletConfig +func (o *Cluster) GetKubeletConfig() (value *KubeletConfig, ok bool) { + ok = o != nil && o.bitmap_&549755813888 != 0 + if ok { + value = o.kubeletConfig + } + return +} + +// LoadBalancerQuota returns the value of the 'load_balancer_quota' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Load Balancer quota to be assigned to the cluster. +func (o *Cluster) LoadBalancerQuota() int { + if o != nil && o.bitmap_&1099511627776 != 0 { + return o.loadBalancerQuota + } + return 0 +} + +// GetLoadBalancerQuota returns the value of the 'load_balancer_quota' attribute and +// a flag indicating if the attribute has a value. +// +// Load Balancer quota to be assigned to the cluster. +func (o *Cluster) GetLoadBalancerQuota() (value int, ok bool) { + ok = o != nil && o.bitmap_&1099511627776 != 0 + if ok { + value = o.loadBalancerQuota + } + return +} + +// MachinePools returns the value of the 'machine_pools' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of machine pools on this cluster. +func (o *Cluster) MachinePools() *v1.MachinePoolList { + if o != nil && o.bitmap_&2199023255552 != 0 { + return o.machinePools + } + return nil +} + +// GetMachinePools returns the value of the 'machine_pools' attribute and +// a flag indicating if the attribute has a value. +// +// List of machine pools on this cluster. +func (o *Cluster) GetMachinePools() (value *v1.MachinePoolList, ok bool) { + ok = o != nil && o.bitmap_&2199023255552 != 0 + if ok { + value = o.machinePools + } + return +} + +// Managed returns the value of the 'managed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Flag indicating if the cluster is managed (by Red Hat) or +// self-managed by the user. +func (o *Cluster) Managed() bool { + if o != nil && o.bitmap_&4398046511104 != 0 { + return o.managed + } + return false +} + +// GetManaged returns the value of the 'managed' attribute and +// a flag indicating if the attribute has a value. +// +// Flag indicating if the cluster is managed (by Red Hat) or +// self-managed by the user. +func (o *Cluster) GetManaged() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4398046511104 != 0 + if ok { + value = o.managed + } + return +} + +// ManagedService returns the value of the 'managed_service' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains information about Managed Service +func (o *Cluster) ManagedService() *ManagedService { + if o != nil && o.bitmap_&8796093022208 != 0 { + return o.managedService + } + return nil +} + +// GetManagedService returns the value of the 'managed_service' attribute and +// a flag indicating if the attribute has a value. +// +// Contains information about Managed Service +func (o *Cluster) GetManagedService() (value *ManagedService, ok bool) { + ok = o != nil && o.bitmap_&8796093022208 != 0 + if ok { + value = o.managedService + } + return +} + +// MultiAZ returns the value of the 'multi_AZ' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Flag indicating if the cluster should be created with nodes in +// different availability zones or all the nodes in a single one +// randomly selected. +func (o *Cluster) MultiAZ() bool { + if o != nil && o.bitmap_&17592186044416 != 0 { + return o.multiAZ + } + return false +} + +// GetMultiAZ returns the value of the 'multi_AZ' attribute and +// a flag indicating if the attribute has a value. +// +// Flag indicating if the cluster should be created with nodes in +// different availability zones or all the nodes in a single one +// randomly selected. +func (o *Cluster) GetMultiAZ() (value bool, ok bool) { + ok = o != nil && o.bitmap_&17592186044416 != 0 + if ok { + value = o.multiAZ + } + return +} + +// MultiArchEnabled returns the value of the 'multi_arch_enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicate whether the cluster is enabled for multi arch workers +func (o *Cluster) MultiArchEnabled() bool { + if o != nil && o.bitmap_&35184372088832 != 0 { + return o.multiArchEnabled + } + return false +} + +// GetMultiArchEnabled returns the value of the 'multi_arch_enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicate whether the cluster is enabled for multi arch workers +func (o *Cluster) GetMultiArchEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&35184372088832 != 0 + if ok { + value = o.multiArchEnabled + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the cluster. This name is assigned by the user when the +// cluster is created. This is used to uniquely identify the cluster +func (o *Cluster) Name() string { + if o != nil && o.bitmap_&70368744177664 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the cluster. This name is assigned by the user when the +// cluster is created. This is used to uniquely identify the cluster +func (o *Cluster) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&70368744177664 != 0 + if ok { + value = o.name + } + return +} + +// Network returns the value of the 'network' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Network settings of the cluster. +func (o *Cluster) Network() *Network { + if o != nil && o.bitmap_&140737488355328 != 0 { + return o.network + } + return nil +} + +// GetNetwork returns the value of the 'network' attribute and +// a flag indicating if the attribute has a value. +// +// Network settings of the cluster. +func (o *Cluster) GetNetwork() (value *Network, ok bool) { + ok = o != nil && o.bitmap_&140737488355328 != 0 + if ok { + value = o.network + } + return +} + +// NodeDrainGracePeriod returns the value of the 'node_drain_grace_period' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Node drain grace period. +func (o *Cluster) NodeDrainGracePeriod() *Value { + if o != nil && o.bitmap_&281474976710656 != 0 { + return o.nodeDrainGracePeriod + } + return nil +} + +// GetNodeDrainGracePeriod returns the value of the 'node_drain_grace_period' attribute and +// a flag indicating if the attribute has a value. +// +// Node drain grace period. +func (o *Cluster) GetNodeDrainGracePeriod() (value *Value, ok bool) { + ok = o != nil && o.bitmap_&281474976710656 != 0 + if ok { + value = o.nodeDrainGracePeriod + } + return +} + +// NodePools returns the value of the 'node_pools' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of node pools on this cluster. +// NodePool is a scalable set of worker nodes attached to a hosted cluster. +func (o *Cluster) NodePools() *NodePoolList { + if o != nil && o.bitmap_&562949953421312 != 0 { + return o.nodePools + } + return nil +} + +// GetNodePools returns the value of the 'node_pools' attribute and +// a flag indicating if the attribute has a value. +// +// List of node pools on this cluster. +// NodePool is a scalable set of worker nodes attached to a hosted cluster. +func (o *Cluster) GetNodePools() (value *NodePoolList, ok bool) { + ok = o != nil && o.bitmap_&562949953421312 != 0 + if ok { + value = o.nodePools + } + return +} + +// Nodes returns the value of the 'nodes' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Information about the nodes of the cluster. +func (o *Cluster) Nodes() *ClusterNodes { + if o != nil && o.bitmap_&1125899906842624 != 0 { + return o.nodes + } + return nil +} + +// GetNodes returns the value of the 'nodes' attribute and +// a flag indicating if the attribute has a value. +// +// Information about the nodes of the cluster. +func (o *Cluster) GetNodes() (value *ClusterNodes, ok bool) { + ok = o != nil && o.bitmap_&1125899906842624 != 0 + if ok { + value = o.nodes + } + return +} + +// OpenshiftVersion returns the value of the 'openshift_version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Version of _OpenShift_ installed in the cluster, for example `4.0.0-0.2`. +// +// When retrieving a cluster this will always be reported. +// +// When provisioning a cluster this will be ignored, as the version to +// deploy will be determined internally. +func (o *Cluster) OpenshiftVersion() string { + if o != nil && o.bitmap_&2251799813685248 != 0 { + return o.openshiftVersion + } + return "" +} + +// GetOpenshiftVersion returns the value of the 'openshift_version' attribute and +// a flag indicating if the attribute has a value. +// +// Version of _OpenShift_ installed in the cluster, for example `4.0.0-0.2`. +// +// When retrieving a cluster this will always be reported. +// +// When provisioning a cluster this will be ignored, as the version to +// deploy will be determined internally. +func (o *Cluster) GetOpenshiftVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&2251799813685248 != 0 + if ok { + value = o.openshiftVersion + } + return +} + +// Product returns the value of the 'product' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the product type of this cluster. +func (o *Cluster) Product() *v1.Product { + if o != nil && o.bitmap_&4503599627370496 != 0 { + return o.product + } + return nil +} + +// GetProduct returns the value of the 'product' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the product type of this cluster. +func (o *Cluster) GetProduct() (value *v1.Product, ok bool) { + ok = o != nil && o.bitmap_&4503599627370496 != 0 + if ok { + value = o.product + } + return +} + +// Properties returns the value of the 'properties' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// User defined properties for tagging and querying. +func (o *Cluster) Properties() map[string]string { + if o != nil && o.bitmap_&9007199254740992 != 0 { + return o.properties + } + return nil +} + +// GetProperties returns the value of the 'properties' attribute and +// a flag indicating if the attribute has a value. +// +// User defined properties for tagging and querying. +func (o *Cluster) GetProperties() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&9007199254740992 != 0 + if ok { + value = o.properties + } + return +} + +// ProvisionShard returns the value of the 'provision_shard' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ProvisionShard contains the properties of the provision shard, including AWS and GCP related configurations +func (o *Cluster) ProvisionShard() *ProvisionShard { + if o != nil && o.bitmap_&18014398509481984 != 0 { + return o.provisionShard + } + return nil +} + +// GetProvisionShard returns the value of the 'provision_shard' attribute and +// a flag indicating if the attribute has a value. +// +// ProvisionShard contains the properties of the provision shard, including AWS and GCP related configurations +func (o *Cluster) GetProvisionShard() (value *ProvisionShard, ok bool) { + ok = o != nil && o.bitmap_&18014398509481984 != 0 + if ok { + value = o.provisionShard + } + return +} + +// Proxy returns the value of the 'proxy' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Proxy. +func (o *Cluster) Proxy() *Proxy { + if o != nil && o.bitmap_&36028797018963968 != 0 { + return o.proxy + } + return nil +} + +// GetProxy returns the value of the 'proxy' attribute and +// a flag indicating if the attribute has a value. +// +// Proxy. +func (o *Cluster) GetProxy() (value *Proxy, ok bool) { + ok = o != nil && o.bitmap_&36028797018963968 != 0 + if ok { + value = o.proxy + } + return +} + +// Region returns the value of the 'region' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the cloud provider region where the cluster is installed. +func (o *Cluster) Region() *v1.CloudRegion { + if o != nil && o.bitmap_&72057594037927936 != 0 { + return o.region + } + return nil +} + +// GetRegion returns the value of the 'region' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the cloud provider region where the cluster is installed. +func (o *Cluster) GetRegion() (value *v1.CloudRegion, ok bool) { + ok = o != nil && o.bitmap_&72057594037927936 != 0 + if ok { + value = o.region + } + return +} + +// RegistryConfig returns the value of the 'registry_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Registry configuration for the cluster +func (o *Cluster) RegistryConfig() *ClusterRegistryConfig { + if o != nil && o.bitmap_&144115188075855872 != 0 { + return o.registryConfig + } + return nil +} + +// GetRegistryConfig returns the value of the 'registry_config' attribute and +// a flag indicating if the attribute has a value. +// +// Registry configuration for the cluster +func (o *Cluster) GetRegistryConfig() (value *ClusterRegistryConfig, ok bool) { + ok = o != nil && o.bitmap_&144115188075855872 != 0 + if ok { + value = o.registryConfig + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Overall state of the cluster. +func (o *Cluster) State() ClusterState { + if o != nil && o.bitmap_&288230376151711744 != 0 { + return o.state + } + return ClusterState("") +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// Overall state of the cluster. +func (o *Cluster) GetState() (value ClusterState, ok bool) { + ok = o != nil && o.bitmap_&288230376151711744 != 0 + if ok { + value = o.state + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Status of cluster +func (o *Cluster) Status() *ClusterStatus { + if o != nil && o.bitmap_&576460752303423488 != 0 { + return o.status + } + return nil +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// Status of cluster +func (o *Cluster) GetStatus() (value *ClusterStatus, ok bool) { + ok = o != nil && o.bitmap_&576460752303423488 != 0 + if ok { + value = o.status + } + return +} + +// StorageQuota returns the value of the 'storage_quota' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Storage quota to be assigned to the cluster. +func (o *Cluster) StorageQuota() *Value { + if o != nil && o.bitmap_&1152921504606846976 != 0 { + return o.storageQuota + } + return nil +} + +// GetStorageQuota returns the value of the 'storage_quota' attribute and +// a flag indicating if the attribute has a value. +// +// Storage quota to be assigned to the cluster. +func (o *Cluster) GetStorageQuota() (value *Value, ok bool) { + ok = o != nil && o.bitmap_&1152921504606846976 != 0 + if ok { + value = o.storageQuota + } + return +} + +// Subscription returns the value of the 'subscription' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the subscription that comes from the account management service when the cluster +// is registered. +func (o *Cluster) Subscription() *v1.Subscription { + if o != nil && o.bitmap_&2305843009213693952 != 0 { + return o.subscription + } + return nil +} + +// GetSubscription returns the value of the 'subscription' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the subscription that comes from the account management service when the cluster +// is registered. +func (o *Cluster) GetSubscription() (value *v1.Subscription, ok bool) { + ok = o != nil && o.bitmap_&2305843009213693952 != 0 + if ok { + value = o.subscription + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the version of _OpenShift_ that will be used to install the cluster. +func (o *Cluster) Version() *v1.Version { + if o != nil && o.bitmap_&4611686018427387904 != 0 { + return o.version + } + return nil +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the version of _OpenShift_ that will be used to install the cluster. +func (o *Cluster) GetVersion() (value *v1.Version, ok bool) { + ok = o != nil && o.bitmap_&4611686018427387904 != 0 + if ok { + value = o.version + } + return +} + +// ClusterListKind is the name of the type used to represent list of objects of +// type 'cluster'. +const ClusterListKind = "ClusterList" + +// ClusterListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster'. +const ClusterListLinkKind = "ClusterListLink" + +// ClusterNilKind is the name of the type used to nil lists of objects of +// type 'cluster'. +const ClusterListNilKind = "ClusterListNil" + +// ClusterList is a list of values of the 'cluster' type. +type ClusterList struct { + href string + link bool + items []*Cluster +} + +// Kind returns the name of the type of the object. +func (l *ClusterList) Kind() string { + if l == nil { + return ClusterListNilKind + } + if l.link { + return ClusterListLinkKind + } + return ClusterListKind +} + +// Link returns true iif this is a link. +func (l *ClusterList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ClusterList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ClusterList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ClusterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterList) SetItems(items []*Cluster) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterList) Items() []*Cluster { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterList) Get(i int) *Cluster { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterList) Slice() []*Cluster { + var slice []*Cluster + if l == nil { + slice = make([]*Cluster, 0) + } else { + slice = make([]*Cluster, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterList) Each(f func(item *Cluster) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterList) Range(f func(index int, item *Cluster) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/cluster_type_json.go b/clientapi/arohcp/v1alpha1/cluster_type_json.go new file mode 100644 index 00000000..1cb08376 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/cluster_type_json.go @@ -0,0 +1,1089 @@ +/* +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" + "sort" + "time" + + jsoniter "github.com/json-iterator/go" + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCluster writes a value of the 'cluster' type to the given writer. +func MarshalCluster(object *Cluster, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCluster(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCluster writes a value of the 'cluster' type to the given stream. +func WriteCluster(object *Cluster, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ClusterLinkKind) + } else { + stream.WriteString(ClusterKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.api != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("api") + WriteClusterAPI(object.api, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.aws != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws") + WriteAWS(object.aws, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.awsInfrastructureAccessRoleGrants != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws_infrastructure_access_role_grants") + stream.WriteObjectStart() + stream.WriteObjectField("items") + v1.WriteAWSInfrastructureAccessRoleGrantList(object.awsInfrastructureAccessRoleGrants.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&64 != 0 && object.ccs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ccs") + WriteCCS(object.ccs, stream) + count++ + } + present_ = object.bitmap_&128 != 0 && object.dns != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("dns") + WriteDNS(object.dns, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("fips") + stream.WriteBool(object.fips) + count++ + } + present_ = object.bitmap_&512 != 0 && object.gcp != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp") + WriteGCP(object.gcp, stream) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.gcpEncryptionKey != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp_encryption_key") + WriteGCPEncryptionKey(object.gcpEncryptionKey, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.gcpNetwork != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp_network") + WriteGCPNetwork(object.gcpNetwork, stream) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_trust_bundle") + stream.WriteString(object.additionalTrustBundle) + count++ + } + present_ = object.bitmap_&8192 != 0 && object.addons != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("addons") + stream.WriteObjectStart() + stream.WriteObjectField("items") + v1.WriteAddOnInstallationList(object.addons.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&16384 != 0 && object.autoscaler != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("autoscaler") + v1.WriteClusterAutoscaler(object.autoscaler, stream) + count++ + } + present_ = object.bitmap_&32768 != 0 && object.azure != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("azure") + WriteAzure(object.azure, stream) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_model") + stream.WriteString(string(object.billingModel)) + count++ + } + present_ = object.bitmap_&131072 != 0 && object.byoOidc != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("byo_oidc") + WriteByoOidc(object.byoOidc, stream) + count++ + } + present_ = object.bitmap_&262144 != 0 && object.capabilities != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("capabilities") + WriteClusterCapabilities(object.capabilities, stream) + count++ + } + present_ = object.bitmap_&524288 != 0 && object.cloudProvider != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + v1.WriteCloudProvider(object.cloudProvider, stream) + count++ + } + present_ = object.bitmap_&1048576 != 0 && object.console != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("console") + WriteClusterConsole(object.console, stream) + count++ + } + present_ = object.bitmap_&2097152 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&4194304 != 0 && object.deleteProtection != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("delete_protection") + WriteDeleteProtection(object.deleteProtection, stream) + count++ + } + present_ = object.bitmap_&8388608 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("disable_user_workload_monitoring") + stream.WriteBool(object.disableUserWorkloadMonitoring) + count++ + } + present_ = object.bitmap_&16777216 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("domain_prefix") + stream.WriteString(object.domainPrefix) + count++ + } + present_ = object.bitmap_&33554432 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("etcd_encryption") + stream.WriteBool(object.etcdEncryption) + count++ + } + present_ = object.bitmap_&67108864 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("expiration_timestamp") + stream.WriteString((object.expirationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&134217728 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_id") + stream.WriteString(object.externalID) + count++ + } + present_ = object.bitmap_&268435456 != 0 && object.externalAuthConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_auth_config") + WriteExternalAuthConfig(object.externalAuthConfig, stream) + count++ + } + present_ = object.bitmap_&536870912 != 0 && object.externalConfiguration != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_configuration") + WriteExternalConfiguration(object.externalConfiguration, stream) + count++ + } + present_ = object.bitmap_&1073741824 != 0 && object.flavour != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("flavour") + v1.WriteFlavour(object.flavour, stream) + count++ + } + present_ = object.bitmap_&2147483648 != 0 && object.groups != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("groups") + stream.WriteObjectStart() + stream.WriteObjectField("items") + v1.WriteGroupList(object.groups.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&4294967296 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("health_state") + stream.WriteString(string(object.healthState)) + count++ + } + present_ = object.bitmap_&8589934592 != 0 && object.htpasswd != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("htpasswd") + WriteHTPasswdIdentityProvider(object.htpasswd, stream) + count++ + } + present_ = object.bitmap_&17179869184 != 0 && object.hypershift != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hypershift") + WriteHypershift(object.hypershift, stream) + count++ + } + present_ = object.bitmap_&34359738368 != 0 && object.identityProviders != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("identity_providers") + stream.WriteObjectStart() + stream.WriteObjectField("items") + v1.WriteIdentityProviderList(object.identityProviders.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&68719476736 != 0 && object.inflightChecks != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("inflight_checks") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteInflightCheckList(object.inflightChecks.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&137438953472 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("infra_id") + stream.WriteString(object.infraID) + count++ + } + present_ = object.bitmap_&274877906944 != 0 && object.ingresses != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ingresses") + stream.WriteObjectStart() + stream.WriteObjectField("items") + v1.WriteIngressList(object.ingresses.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&549755813888 != 0 && object.kubeletConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kubelet_config") + WriteKubeletConfig(object.kubeletConfig, stream) + count++ + } + present_ = object.bitmap_&1099511627776 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("load_balancer_quota") + stream.WriteInt(object.loadBalancerQuota) + count++ + } + present_ = object.bitmap_&2199023255552 != 0 && object.machinePools != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("machine_pools") + stream.WriteObjectStart() + stream.WriteObjectField("items") + v1.WriteMachinePoolList(object.machinePools.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&4398046511104 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed") + stream.WriteBool(object.managed) + count++ + } + present_ = object.bitmap_&8796093022208 != 0 && object.managedService != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_service") + WriteManagedService(object.managedService, stream) + count++ + } + present_ = object.bitmap_&17592186044416 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("multi_az") + stream.WriteBool(object.multiAZ) + count++ + } + present_ = object.bitmap_&35184372088832 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("multi_arch_enabled") + stream.WriteBool(object.multiArchEnabled) + count++ + } + present_ = object.bitmap_&70368744177664 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&140737488355328 != 0 && object.network != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("network") + WriteNetwork(object.network, stream) + count++ + } + present_ = object.bitmap_&281474976710656 != 0 && object.nodeDrainGracePeriod != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("node_drain_grace_period") + WriteValue(object.nodeDrainGracePeriod, stream) + count++ + } + present_ = object.bitmap_&562949953421312 != 0 && object.nodePools != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("node_pools") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteNodePoolList(object.nodePools.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&1125899906842624 != 0 && object.nodes != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("nodes") + WriteClusterNodes(object.nodes, stream) + count++ + } + present_ = object.bitmap_&2251799813685248 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("openshift_version") + stream.WriteString(object.openshiftVersion) + count++ + } + present_ = object.bitmap_&4503599627370496 != 0 && object.product != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product") + v1.WriteProduct(object.product, stream) + count++ + } + present_ = object.bitmap_&9007199254740992 != 0 && object.properties != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("properties") + if object.properties != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.properties)) + i := 0 + for key := range object.properties { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.properties[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&18014398509481984 != 0 && object.provisionShard != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("provision_shard") + WriteProvisionShard(object.provisionShard, stream) + count++ + } + present_ = object.bitmap_&36028797018963968 != 0 && object.proxy != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("proxy") + WriteProxy(object.proxy, stream) + count++ + } + present_ = object.bitmap_&72057594037927936 != 0 && object.region != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region") + v1.WriteCloudRegion(object.region, stream) + count++ + } + present_ = object.bitmap_&144115188075855872 != 0 && object.registryConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("registry_config") + WriteClusterRegistryConfig(object.registryConfig, stream) + count++ + } + present_ = object.bitmap_&288230376151711744 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(string(object.state)) + count++ + } + present_ = object.bitmap_&576460752303423488 != 0 && object.status != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + WriteClusterStatus(object.status, stream) + count++ + } + present_ = object.bitmap_&1152921504606846976 != 0 && object.storageQuota != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("storage_quota") + WriteValue(object.storageQuota, stream) + count++ + } + present_ = object.bitmap_&2305843009213693952 != 0 && object.subscription != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription") + v1.WriteSubscription(object.subscription, stream) + count++ + } + present_ = object.bitmap_&4611686018427387904 != 0 && object.version != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + v1.WriteVersion(object.version, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalCluster reads a value of the 'cluster' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCluster(source interface{}) (object *Cluster, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCluster(iterator) + err = iterator.Error + return +} + +// ReadCluster reads a value of the 'cluster' type from the given iterator. +func ReadCluster(iterator *jsoniter.Iterator) *Cluster { + object := &Cluster{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ClusterLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "api": + value := ReadClusterAPI(iterator) + object.api = value + object.bitmap_ |= 8 + case "aws": + value := ReadAWS(iterator) + object.aws = value + object.bitmap_ |= 16 + case "aws_infrastructure_access_role_grants": + value := &v1.AWSInfrastructureAccessRoleGrantList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == v1.AWSInfrastructureAccessRoleGrantListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(v1.ReadAWSInfrastructureAccessRoleGrantList(iterator)) + default: + iterator.ReadAny() + } + } + object.awsInfrastructureAccessRoleGrants = value + object.bitmap_ |= 32 + case "ccs": + value := ReadCCS(iterator) + object.ccs = value + object.bitmap_ |= 64 + case "dns": + value := ReadDNS(iterator) + object.dns = value + object.bitmap_ |= 128 + case "fips": + value := iterator.ReadBool() + object.fips = value + object.bitmap_ |= 256 + case "gcp": + value := ReadGCP(iterator) + object.gcp = value + object.bitmap_ |= 512 + case "gcp_encryption_key": + value := ReadGCPEncryptionKey(iterator) + object.gcpEncryptionKey = value + object.bitmap_ |= 1024 + case "gcp_network": + value := ReadGCPNetwork(iterator) + object.gcpNetwork = value + object.bitmap_ |= 2048 + case "additional_trust_bundle": + value := iterator.ReadString() + object.additionalTrustBundle = value + object.bitmap_ |= 4096 + case "addons": + value := &v1.AddOnInstallationList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == v1.AddOnInstallationListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(v1.ReadAddOnInstallationList(iterator)) + default: + iterator.ReadAny() + } + } + object.addons = value + object.bitmap_ |= 8192 + case "autoscaler": + value := v1.ReadClusterAutoscaler(iterator) + object.autoscaler = value + object.bitmap_ |= 16384 + case "azure": + value := ReadAzure(iterator) + object.azure = value + object.bitmap_ |= 32768 + case "billing_model": + text := iterator.ReadString() + value := BillingModel(text) + object.billingModel = value + object.bitmap_ |= 65536 + case "byo_oidc": + value := ReadByoOidc(iterator) + object.byoOidc = value + object.bitmap_ |= 131072 + case "capabilities": + value := ReadClusterCapabilities(iterator) + object.capabilities = value + object.bitmap_ |= 262144 + case "cloud_provider": + value := v1.ReadCloudProvider(iterator) + object.cloudProvider = value + object.bitmap_ |= 524288 + case "console": + value := ReadClusterConsole(iterator) + object.console = value + object.bitmap_ |= 1048576 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 2097152 + case "delete_protection": + value := ReadDeleteProtection(iterator) + object.deleteProtection = value + object.bitmap_ |= 4194304 + case "disable_user_workload_monitoring": + value := iterator.ReadBool() + object.disableUserWorkloadMonitoring = value + object.bitmap_ |= 8388608 + case "domain_prefix": + value := iterator.ReadString() + object.domainPrefix = value + object.bitmap_ |= 16777216 + case "etcd_encryption": + value := iterator.ReadBool() + object.etcdEncryption = value + object.bitmap_ |= 33554432 + case "expiration_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.expirationTimestamp = value + object.bitmap_ |= 67108864 + case "external_id": + value := iterator.ReadString() + object.externalID = value + object.bitmap_ |= 134217728 + case "external_auth_config": + value := ReadExternalAuthConfig(iterator) + object.externalAuthConfig = value + object.bitmap_ |= 268435456 + case "external_configuration": + value := ReadExternalConfiguration(iterator) + object.externalConfiguration = value + object.bitmap_ |= 536870912 + case "flavour": + value := v1.ReadFlavour(iterator) + object.flavour = value + object.bitmap_ |= 1073741824 + case "groups": + value := &v1.GroupList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == v1.GroupListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(v1.ReadGroupList(iterator)) + default: + iterator.ReadAny() + } + } + object.groups = value + object.bitmap_ |= 2147483648 + case "health_state": + text := iterator.ReadString() + value := ClusterHealthState(text) + object.healthState = value + object.bitmap_ |= 4294967296 + case "htpasswd": + value := ReadHTPasswdIdentityProvider(iterator) + object.htpasswd = value + object.bitmap_ |= 8589934592 + case "hypershift": + value := ReadHypershift(iterator) + object.hypershift = value + object.bitmap_ |= 17179869184 + case "identity_providers": + value := &v1.IdentityProviderList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == v1.IdentityProviderListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(v1.ReadIdentityProviderList(iterator)) + default: + iterator.ReadAny() + } + } + object.identityProviders = value + object.bitmap_ |= 34359738368 + case "inflight_checks": + value := &InflightCheckList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == InflightCheckListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadInflightCheckList(iterator)) + default: + iterator.ReadAny() + } + } + object.inflightChecks = value + object.bitmap_ |= 68719476736 + case "infra_id": + value := iterator.ReadString() + object.infraID = value + object.bitmap_ |= 137438953472 + case "ingresses": + value := &v1.IngressList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == v1.IngressListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(v1.ReadIngressList(iterator)) + default: + iterator.ReadAny() + } + } + object.ingresses = value + object.bitmap_ |= 274877906944 + case "kubelet_config": + value := ReadKubeletConfig(iterator) + object.kubeletConfig = value + object.bitmap_ |= 549755813888 + case "load_balancer_quota": + value := iterator.ReadInt() + object.loadBalancerQuota = value + object.bitmap_ |= 1099511627776 + case "machine_pools": + value := &v1.MachinePoolList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == v1.MachinePoolListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(v1.ReadMachinePoolList(iterator)) + default: + iterator.ReadAny() + } + } + object.machinePools = value + object.bitmap_ |= 2199023255552 + case "managed": + value := iterator.ReadBool() + object.managed = value + object.bitmap_ |= 4398046511104 + case "managed_service": + value := ReadManagedService(iterator) + object.managedService = value + object.bitmap_ |= 8796093022208 + case "multi_az": + value := iterator.ReadBool() + object.multiAZ = value + object.bitmap_ |= 17592186044416 + case "multi_arch_enabled": + value := iterator.ReadBool() + object.multiArchEnabled = value + object.bitmap_ |= 35184372088832 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 70368744177664 + case "network": + value := ReadNetwork(iterator) + object.network = value + object.bitmap_ |= 140737488355328 + case "node_drain_grace_period": + value := ReadValue(iterator) + object.nodeDrainGracePeriod = value + object.bitmap_ |= 281474976710656 + case "node_pools": + value := &NodePoolList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == NodePoolListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadNodePoolList(iterator)) + default: + iterator.ReadAny() + } + } + object.nodePools = value + object.bitmap_ |= 562949953421312 + case "nodes": + value := ReadClusterNodes(iterator) + object.nodes = value + object.bitmap_ |= 1125899906842624 + case "openshift_version": + value := iterator.ReadString() + object.openshiftVersion = value + object.bitmap_ |= 2251799813685248 + case "product": + value := v1.ReadProduct(iterator) + object.product = value + object.bitmap_ |= 4503599627370496 + case "properties": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.properties = value + object.bitmap_ |= 9007199254740992 + case "provision_shard": + value := ReadProvisionShard(iterator) + object.provisionShard = value + object.bitmap_ |= 18014398509481984 + case "proxy": + value := ReadProxy(iterator) + object.proxy = value + object.bitmap_ |= 36028797018963968 + case "region": + value := v1.ReadCloudRegion(iterator) + object.region = value + object.bitmap_ |= 72057594037927936 + case "registry_config": + value := ReadClusterRegistryConfig(iterator) + object.registryConfig = value + object.bitmap_ |= 144115188075855872 + case "state": + text := iterator.ReadString() + value := ClusterState(text) + object.state = value + object.bitmap_ |= 288230376151711744 + case "status": + value := ReadClusterStatus(iterator) + object.status = value + object.bitmap_ |= 576460752303423488 + case "storage_quota": + value := ReadValue(iterator) + object.storageQuota = value + object.bitmap_ |= 1152921504606846976 + case "subscription": + value := v1.ReadSubscription(iterator) + object.subscription = value + object.bitmap_ |= 2305843009213693952 + case "version": + value := v1.ReadVersion(iterator) + object.version = value + object.bitmap_ |= 4611686018427387904 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/date_list_type_json.go b/clientapi/arohcp/v1alpha1/date_list_type_json.go new file mode 100644 index 00000000..89ce2804 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/date_list_type_json.go @@ -0,0 +1,80 @@ +/* +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" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDateList writes a list of values of the 'date' type to +// the given writer. +func MarshalDateList(list []time.Time, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDateList writes a list of value of the 'date' type to +// the given stream. +func WriteDateList(list []time.Time, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString((value).Format(time.RFC3339)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDateList reads a list of values of the 'date' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDateList(source interface{}) (items []time.Time, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDateList(iterator) + err = iterator.Error + return +} + +// ReadDateList reads list of values of the ”date' type from +// the given iterator. +func ReadDateList(iterator *jsoniter.Iterator) []time.Time { + list := []time.Time{} + for iterator.ReadArray() { + text := iterator.ReadString() + item, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/delete_protection_builder.go b/clientapi/arohcp/v1alpha1/delete_protection_builder.go new file mode 100644 index 00000000..c4af3f9d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/delete_protection_builder.go @@ -0,0 +1,63 @@ +/* +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 + +// DeleteProtectionBuilder contains the data and logic needed to build 'delete_protection' objects. +// +// DeleteProtection configuration. +type DeleteProtectionBuilder struct { + bitmap_ uint32 + enabled bool +} + +// NewDeleteProtection creates a new builder of 'delete_protection' objects. +func NewDeleteProtection() *DeleteProtectionBuilder { + return &DeleteProtectionBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *DeleteProtectionBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *DeleteProtectionBuilder) Enabled(value bool) *DeleteProtectionBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *DeleteProtectionBuilder) Copy(object *DeleteProtection) *DeleteProtectionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + return b +} + +// Build creates a 'delete_protection' object using the configuration stored in the builder. +func (b *DeleteProtectionBuilder) Build() (object *DeleteProtection, err error) { + object = new(DeleteProtection) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + return +} diff --git a/clientapi/arohcp/v1alpha1/delete_protection_list_builder.go b/clientapi/arohcp/v1alpha1/delete_protection_list_builder.go new file mode 100644 index 00000000..b37669ba --- /dev/null +++ b/clientapi/arohcp/v1alpha1/delete_protection_list_builder.go @@ -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 + +// DeleteProtectionListBuilder contains the data and logic needed to build +// 'delete_protection' objects. +type DeleteProtectionListBuilder struct { + items []*DeleteProtectionBuilder +} + +// NewDeleteProtectionList creates a new builder of 'delete_protection' objects. +func NewDeleteProtectionList() *DeleteProtectionListBuilder { + return new(DeleteProtectionListBuilder) +} + +// Items sets the items of the list. +func (b *DeleteProtectionListBuilder) Items(values ...*DeleteProtectionBuilder) *DeleteProtectionListBuilder { + b.items = make([]*DeleteProtectionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *DeleteProtectionListBuilder) 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 *DeleteProtectionListBuilder) Copy(list *DeleteProtectionList) *DeleteProtectionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*DeleteProtectionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewDeleteProtection().Copy(v) + } + } + return b +} + +// Build creates a list of 'delete_protection' objects using the +// configuration stored in the builder. +func (b *DeleteProtectionListBuilder) Build() (list *DeleteProtectionList, err error) { + items := make([]*DeleteProtection, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(DeleteProtectionList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/delete_protection_list_type_json.go b/clientapi/arohcp/v1alpha1/delete_protection_list_type_json.go new file mode 100644 index 00000000..351de28a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/delete_protection_list_type_json.go @@ -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" +) + +// MarshalDeleteProtectionList writes a list of values of the 'delete_protection' type to +// the given writer. +func MarshalDeleteProtectionList(list []*DeleteProtection, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDeleteProtectionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDeleteProtectionList writes a list of value of the 'delete_protection' type to +// the given stream. +func WriteDeleteProtectionList(list []*DeleteProtection, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteDeleteProtection(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalDeleteProtectionList reads a list of values of the 'delete_protection' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDeleteProtectionList(source interface{}) (items []*DeleteProtection, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDeleteProtectionList(iterator) + err = iterator.Error + return +} + +// ReadDeleteProtectionList reads list of values of the ”delete_protection' type from +// the given iterator. +func ReadDeleteProtectionList(iterator *jsoniter.Iterator) []*DeleteProtection { + list := []*DeleteProtection{} + for iterator.ReadArray() { + item := ReadDeleteProtection(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/delete_protection_type.go b/clientapi/arohcp/v1alpha1/delete_protection_type.go new file mode 100644 index 00000000..6b000a44 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/delete_protection_type.go @@ -0,0 +1,173 @@ +/* +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 + +// DeleteProtection represents the values of the 'delete_protection' type. +// +// DeleteProtection configuration. +type DeleteProtection struct { + bitmap_ uint32 + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *DeleteProtection) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Boolean flag indicating if the cluster should be be using _DeleteProtection_. +// +// By default this is `false`. +// +// To enable it a SREP needs to patch the value through OCM API +func (o *DeleteProtection) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Boolean flag indicating if the cluster should be be using _DeleteProtection_. +// +// By default this is `false`. +// +// To enable it a SREP needs to patch the value through OCM API +func (o *DeleteProtection) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// DeleteProtectionListKind is the name of the type used to represent list of objects of +// type 'delete_protection'. +const DeleteProtectionListKind = "DeleteProtectionList" + +// DeleteProtectionListLinkKind is the name of the type used to represent links to list +// of objects of type 'delete_protection'. +const DeleteProtectionListLinkKind = "DeleteProtectionListLink" + +// DeleteProtectionNilKind is the name of the type used to nil lists of objects of +// type 'delete_protection'. +const DeleteProtectionListNilKind = "DeleteProtectionListNil" + +// DeleteProtectionList is a list of values of the 'delete_protection' type. +type DeleteProtectionList struct { + href string + link bool + items []*DeleteProtection +} + +// Len returns the length of the list. +func (l *DeleteProtectionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *DeleteProtectionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *DeleteProtectionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *DeleteProtectionList) SetItems(items []*DeleteProtection) { + l.items = items +} + +// Items returns the items of the list. +func (l *DeleteProtectionList) Items() []*DeleteProtection { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *DeleteProtectionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *DeleteProtectionList) Get(i int) *DeleteProtection { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *DeleteProtectionList) Slice() []*DeleteProtection { + var slice []*DeleteProtection + if l == nil { + slice = make([]*DeleteProtection, 0) + } else { + slice = make([]*DeleteProtection, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *DeleteProtectionList) Each(f func(item *DeleteProtection) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *DeleteProtectionList) Range(f func(index int, item *DeleteProtection) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/delete_protection_type_json.go b/clientapi/arohcp/v1alpha1/delete_protection_type_json.go new file mode 100644 index 00000000..0242e25a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/delete_protection_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalDeleteProtection writes a value of the 'delete_protection' type to the given writer. +func MarshalDeleteProtection(object *DeleteProtection, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDeleteProtection(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDeleteProtection writes a value of the 'delete_protection' type to the given stream. +func WriteDeleteProtection(object *DeleteProtection, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalDeleteProtection reads a value of the 'delete_protection' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalDeleteProtection(source interface{}) (object *DeleteProtection, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadDeleteProtection(iterator) + err = iterator.Error + return +} + +// ReadDeleteProtection reads a value of the 'delete_protection' type from the given iterator. +func ReadDeleteProtection(iterator *jsoniter.Iterator) *DeleteProtection { + object := &DeleteProtection{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/dns_builder.go b/clientapi/arohcp/v1alpha1/dns_builder.go new file mode 100644 index 00000000..2acf03cd --- /dev/null +++ b/clientapi/arohcp/v1alpha1/dns_builder.go @@ -0,0 +1,63 @@ +/* +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 + +// DNSBuilder contains the data and logic needed to build 'DNS' objects. +// +// DNS settings of the cluster. +type DNSBuilder struct { + bitmap_ uint32 + baseDomain string +} + +// NewDNS creates a new builder of 'DNS' objects. +func NewDNS() *DNSBuilder { + return &DNSBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *DNSBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// BaseDomain sets the value of the 'base_domain' attribute to the given value. +func (b *DNSBuilder) BaseDomain(value string) *DNSBuilder { + b.baseDomain = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *DNSBuilder) Copy(object *DNS) *DNSBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.baseDomain = object.baseDomain + return b +} + +// Build creates a 'DNS' object using the configuration stored in the builder. +func (b *DNSBuilder) Build() (object *DNS, err error) { + object = new(DNS) + object.bitmap_ = b.bitmap_ + object.baseDomain = b.baseDomain + return +} diff --git a/clientapi/arohcp/v1alpha1/dns_list_builder.go b/clientapi/arohcp/v1alpha1/dns_list_builder.go new file mode 100644 index 00000000..bbc758f0 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/dns_list_builder.go @@ -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 + +// DNSListBuilder contains the data and logic needed to build +// 'DNS' objects. +type DNSListBuilder struct { + items []*DNSBuilder +} + +// NewDNSList creates a new builder of 'DNS' objects. +func NewDNSList() *DNSListBuilder { + return new(DNSListBuilder) +} + +// Items sets the items of the list. +func (b *DNSListBuilder) Items(values ...*DNSBuilder) *DNSListBuilder { + b.items = make([]*DNSBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *DNSListBuilder) 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 *DNSListBuilder) Copy(list *DNSList) *DNSListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*DNSBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewDNS().Copy(v) + } + } + return b +} + +// Build creates a list of 'DNS' objects using the +// configuration stored in the builder. +func (b *DNSListBuilder) Build() (list *DNSList, err error) { + items := make([]*DNS, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(DNSList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/dns_list_type_json.go b/clientapi/arohcp/v1alpha1/dns_list_type_json.go new file mode 100644 index 00000000..c91804b0 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/dns_list_type_json.go @@ -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" +) + +// MarshalDNSList writes a list of values of the 'DNS' type to +// the given writer. +func MarshalDNSList(list []*DNS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDNSList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDNSList writes a list of value of the 'DNS' type to +// the given stream. +func WriteDNSList(list []*DNS, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteDNS(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalDNSList reads a list of values of the 'DNS' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDNSList(source interface{}) (items []*DNS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDNSList(iterator) + err = iterator.Error + return +} + +// ReadDNSList reads list of values of the ”DNS' type from +// the given iterator. +func ReadDNSList(iterator *jsoniter.Iterator) []*DNS { + list := []*DNS{} + for iterator.ReadArray() { + item := ReadDNS(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/dns_type.go b/clientapi/arohcp/v1alpha1/dns_type.go new file mode 100644 index 00000000..d4114648 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/dns_type.go @@ -0,0 +1,251 @@ +/* +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 + +// DNS represents the values of the 'DNS' type. +// +// DNS settings of the cluster. +type DNS struct { + bitmap_ uint32 + baseDomain string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *DNS) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// BaseDomain returns the value of the 'base_domain' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Base DNS domain of the cluster. +// +// During the installation of the cluster it is necessary to create multiple DNS records. +// They will be created as sub-domains of this domain. For example, if the domain_prefix of the +// cluster is `mycluster` and the base domain is `example.com` then the following DNS +// records will be created: +// +// ``` +// mycluster-api.example.com +// mycluster-etcd-0.example.com +// mycluster-etcd-1.example.com +// mycluster-etcd-3.example.com +// ``` +// +// The exact number, type and names of the created DNS record depends on the characteristics +// of the cluster, and may be different for different versions of _OpenShift_. Please don't +// rely on them. For example, to find what is the URL of the Kubernetes API server of the +// cluster don't assume that it will be `mycluster-api.example.com`. Instead of that use +// this API to retrieve the description of the cluster, and get it from the `api.url` +// attribute. For example, if the identifier of the cluster is `123` send a request like +// this: +// +// ```http +// GET /api/clusters_mgmt/v1/clusters/123 HTTP/1.1 +// ``` +// +// That will return a response like this, including the `api.url` attribute: +// +// ```json +// +// { +// "kind": "Cluster", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/clusters/123", +// "api": { +// "url": "https://mycluster-api.example.com:6443" +// }, +// ... +// } +// +// ``` +// +// When the cluster is created in Amazon Web Services it is necessary to create this base +// DNS domain in advance, using AWS Route53 (https://console.aws.amazon.com/route53). +func (o *DNS) BaseDomain() string { + if o != nil && o.bitmap_&1 != 0 { + return o.baseDomain + } + return "" +} + +// GetBaseDomain returns the value of the 'base_domain' attribute and +// a flag indicating if the attribute has a value. +// +// Base DNS domain of the cluster. +// +// During the installation of the cluster it is necessary to create multiple DNS records. +// They will be created as sub-domains of this domain. For example, if the domain_prefix of the +// cluster is `mycluster` and the base domain is `example.com` then the following DNS +// records will be created: +// +// ``` +// mycluster-api.example.com +// mycluster-etcd-0.example.com +// mycluster-etcd-1.example.com +// mycluster-etcd-3.example.com +// ``` +// +// The exact number, type and names of the created DNS record depends on the characteristics +// of the cluster, and may be different for different versions of _OpenShift_. Please don't +// rely on them. For example, to find what is the URL of the Kubernetes API server of the +// cluster don't assume that it will be `mycluster-api.example.com`. Instead of that use +// this API to retrieve the description of the cluster, and get it from the `api.url` +// attribute. For example, if the identifier of the cluster is `123` send a request like +// this: +// +// ```http +// GET /api/clusters_mgmt/v1/clusters/123 HTTP/1.1 +// ``` +// +// That will return a response like this, including the `api.url` attribute: +// +// ```json +// +// { +// "kind": "Cluster", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/clusters/123", +// "api": { +// "url": "https://mycluster-api.example.com:6443" +// }, +// ... +// } +// +// ``` +// +// When the cluster is created in Amazon Web Services it is necessary to create this base +// DNS domain in advance, using AWS Route53 (https://console.aws.amazon.com/route53). +func (o *DNS) GetBaseDomain() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.baseDomain + } + return +} + +// DNSListKind is the name of the type used to represent list of objects of +// type 'DNS'. +const DNSListKind = "DNSList" + +// DNSListLinkKind is the name of the type used to represent links to list +// of objects of type 'DNS'. +const DNSListLinkKind = "DNSListLink" + +// DNSNilKind is the name of the type used to nil lists of objects of +// type 'DNS'. +const DNSListNilKind = "DNSListNil" + +// DNSList is a list of values of the 'DNS' type. +type DNSList struct { + href string + link bool + items []*DNS +} + +// Len returns the length of the list. +func (l *DNSList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *DNSList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *DNSList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *DNSList) SetItems(items []*DNS) { + l.items = items +} + +// Items returns the items of the list. +func (l *DNSList) Items() []*DNS { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *DNSList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *DNSList) Get(i int) *DNS { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *DNSList) Slice() []*DNS { + var slice []*DNS + if l == nil { + slice = make([]*DNS, 0) + } else { + slice = make([]*DNS, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *DNSList) Each(f func(item *DNS) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *DNSList) Range(f func(index int, item *DNS) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/dns_type_json.go b/clientapi/arohcp/v1alpha1/dns_type_json.go new file mode 100644 index 00000000..c317533e --- /dev/null +++ b/clientapi/arohcp/v1alpha1/dns_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalDNS writes a value of the 'DNS' type to the given writer. +func MarshalDNS(object *DNS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDNS(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDNS writes a value of the 'DNS' type to the given stream. +func WriteDNS(object *DNS, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("base_domain") + stream.WriteString(object.baseDomain) + } + stream.WriteObjectEnd() +} + +// UnmarshalDNS reads a value of the 'DNS' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalDNS(source interface{}) (object *DNS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadDNS(iterator) + err = iterator.Error + return +} + +// ReadDNS reads a value of the 'DNS' type from the given iterator. +func ReadDNS(iterator *jsoniter.Iterator) *DNS { + object := &DNS{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "base_domain": + value := iterator.ReadString() + object.baseDomain = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/ec_2_metadata_http_tokens_list_type_json.go b/clientapi/arohcp/v1alpha1/ec_2_metadata_http_tokens_list_type_json.go new file mode 100644 index 00000000..98cfb909 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ec_2_metadata_http_tokens_list_type_json.go @@ -0,0 +1,76 @@ +/* +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" +) + +// MarshalEc2MetadataHttpTokensList writes a list of values of the 'ec_2_metadata_http_tokens' type to +// the given writer. +func MarshalEc2MetadataHttpTokensList(list []Ec2MetadataHttpTokens, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteEc2MetadataHttpTokensList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteEc2MetadataHttpTokensList writes a list of value of the 'ec_2_metadata_http_tokens' type to +// the given stream. +func WriteEc2MetadataHttpTokensList(list []Ec2MetadataHttpTokens, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalEc2MetadataHttpTokensList reads a list of values of the 'ec_2_metadata_http_tokens' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalEc2MetadataHttpTokensList(source interface{}) (items []Ec2MetadataHttpTokens, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadEc2MetadataHttpTokensList(iterator) + err = iterator.Error + return +} + +// ReadEc2MetadataHttpTokensList reads list of values of the ”ec_2_metadata_http_tokens' type from +// the given iterator. +func ReadEc2MetadataHttpTokensList(iterator *jsoniter.Iterator) []Ec2MetadataHttpTokens { + list := []Ec2MetadataHttpTokens{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := Ec2MetadataHttpTokens(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/ec_2_metadata_http_tokens_type.go b/clientapi/arohcp/v1alpha1/ec_2_metadata_http_tokens_type.go new file mode 100644 index 00000000..77ba966e --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ec_2_metadata_http_tokens_type.go @@ -0,0 +1,30 @@ +/* +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 + +// Ec2MetadataHttpTokens represents the values of the 'ec_2_metadata_http_tokens' enumerated type. +type Ec2MetadataHttpTokens string + +const ( + // imdsv2 is optional + Ec2MetadataHttpTokensOptional Ec2MetadataHttpTokens = "optional" + // imdsv2 is required + Ec2MetadataHttpTokensRequired Ec2MetadataHttpTokens = "required" +) diff --git a/clientapi/arohcp/v1alpha1/external_auth_config_builder.go b/clientapi/arohcp/v1alpha1/external_auth_config_builder.go new file mode 100644 index 00000000..3b0c8e5f --- /dev/null +++ b/clientapi/arohcp/v1alpha1/external_auth_config_builder.go @@ -0,0 +1,86 @@ +/* +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 ( + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// ExternalAuthConfigBuilder contains the data and logic needed to build 'external_auth_config' objects. +// +// ExternalAuthConfig configuration +type ExternalAuthConfigBuilder struct { + bitmap_ uint32 + externalAuths *v1.ExternalAuthListBuilder + enabled bool +} + +// NewExternalAuthConfig creates a new builder of 'external_auth_config' objects. +func NewExternalAuthConfig() *ExternalAuthConfigBuilder { + return &ExternalAuthConfigBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ExternalAuthConfigBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *ExternalAuthConfigBuilder) Enabled(value bool) *ExternalAuthConfigBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// ExternalAuths sets the value of the 'external_auths' attribute to the given values. +func (b *ExternalAuthConfigBuilder) ExternalAuths(value *v1.ExternalAuthListBuilder) *ExternalAuthConfigBuilder { + b.externalAuths = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ExternalAuthConfigBuilder) Copy(object *ExternalAuthConfig) *ExternalAuthConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + if object.externalAuths != nil { + b.externalAuths = v1.NewExternalAuthList().Copy(object.externalAuths) + } else { + b.externalAuths = nil + } + return b +} + +// Build creates a 'external_auth_config' object using the configuration stored in the builder. +func (b *ExternalAuthConfigBuilder) Build() (object *ExternalAuthConfig, err error) { + object = new(ExternalAuthConfig) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + if b.externalAuths != nil { + object.externalAuths, err = b.externalAuths.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/external_auth_config_list_builder.go b/clientapi/arohcp/v1alpha1/external_auth_config_list_builder.go new file mode 100644 index 00000000..068f9bdc --- /dev/null +++ b/clientapi/arohcp/v1alpha1/external_auth_config_list_builder.go @@ -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 + +// ExternalAuthConfigListBuilder contains the data and logic needed to build +// 'external_auth_config' objects. +type ExternalAuthConfigListBuilder struct { + items []*ExternalAuthConfigBuilder +} + +// NewExternalAuthConfigList creates a new builder of 'external_auth_config' objects. +func NewExternalAuthConfigList() *ExternalAuthConfigListBuilder { + return new(ExternalAuthConfigListBuilder) +} + +// Items sets the items of the list. +func (b *ExternalAuthConfigListBuilder) Items(values ...*ExternalAuthConfigBuilder) *ExternalAuthConfigListBuilder { + b.items = make([]*ExternalAuthConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ExternalAuthConfigListBuilder) 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 *ExternalAuthConfigListBuilder) Copy(list *ExternalAuthConfigList) *ExternalAuthConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ExternalAuthConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewExternalAuthConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'external_auth_config' objects using the +// configuration stored in the builder. +func (b *ExternalAuthConfigListBuilder) Build() (list *ExternalAuthConfigList, err error) { + items := make([]*ExternalAuthConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ExternalAuthConfigList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/external_auth_config_list_type_json.go b/clientapi/arohcp/v1alpha1/external_auth_config_list_type_json.go new file mode 100644 index 00000000..9497ab95 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/external_auth_config_list_type_json.go @@ -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" +) + +// MarshalExternalAuthConfigList writes a list of values of the 'external_auth_config' type to +// the given writer. +func MarshalExternalAuthConfigList(list []*ExternalAuthConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalAuthConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalAuthConfigList writes a list of value of the 'external_auth_config' type to +// the given stream. +func WriteExternalAuthConfigList(list []*ExternalAuthConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteExternalAuthConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalExternalAuthConfigList reads a list of values of the 'external_auth_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalExternalAuthConfigList(source interface{}) (items []*ExternalAuthConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadExternalAuthConfigList(iterator) + err = iterator.Error + return +} + +// ReadExternalAuthConfigList reads list of values of the ”external_auth_config' type from +// the given iterator. +func ReadExternalAuthConfigList(iterator *jsoniter.Iterator) []*ExternalAuthConfig { + list := []*ExternalAuthConfig{} + for iterator.ReadArray() { + item := ReadExternalAuthConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/external_auth_config_type.go b/clientapi/arohcp/v1alpha1/external_auth_config_type.go new file mode 100644 index 00000000..d8d20252 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/external_auth_config_type.go @@ -0,0 +1,199 @@ +/* +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 ( + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// ExternalAuthConfig represents the values of the 'external_auth_config' type. +// +// ExternalAuthConfig configuration +type ExternalAuthConfig struct { + bitmap_ uint32 + externalAuths *v1.ExternalAuthList + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ExternalAuthConfig) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Boolean flag indicating if the cluster should use an external authentication configuration. +// +// By default this is false. +// +// To enable it the cluster needs to be ROSA HCP cluster and the organization of the user needs +// to have the `external-authentication` feature toggle enabled. +func (o *ExternalAuthConfig) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Boolean flag indicating if the cluster should use an external authentication configuration. +// +// By default this is false. +// +// To enable it the cluster needs to be ROSA HCP cluster and the organization of the user needs +// to have the `external-authentication` feature toggle enabled. +func (o *ExternalAuthConfig) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// ExternalAuths returns the value of the 'external_auths' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ExternalAuthConfig) ExternalAuths() *v1.ExternalAuthList { + if o != nil && o.bitmap_&2 != 0 { + return o.externalAuths + } + return nil +} + +// GetExternalAuths returns the value of the 'external_auths' attribute and +// a flag indicating if the attribute has a value. +func (o *ExternalAuthConfig) GetExternalAuths() (value *v1.ExternalAuthList, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.externalAuths + } + return +} + +// ExternalAuthConfigListKind is the name of the type used to represent list of objects of +// type 'external_auth_config'. +const ExternalAuthConfigListKind = "ExternalAuthConfigList" + +// ExternalAuthConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'external_auth_config'. +const ExternalAuthConfigListLinkKind = "ExternalAuthConfigListLink" + +// ExternalAuthConfigNilKind is the name of the type used to nil lists of objects of +// type 'external_auth_config'. +const ExternalAuthConfigListNilKind = "ExternalAuthConfigListNil" + +// ExternalAuthConfigList is a list of values of the 'external_auth_config' type. +type ExternalAuthConfigList struct { + href string + link bool + items []*ExternalAuthConfig +} + +// Len returns the length of the list. +func (l *ExternalAuthConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ExternalAuthConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ExternalAuthConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ExternalAuthConfigList) SetItems(items []*ExternalAuthConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *ExternalAuthConfigList) Items() []*ExternalAuthConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ExternalAuthConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ExternalAuthConfigList) Get(i int) *ExternalAuthConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ExternalAuthConfigList) Slice() []*ExternalAuthConfig { + var slice []*ExternalAuthConfig + if l == nil { + slice = make([]*ExternalAuthConfig, 0) + } else { + slice = make([]*ExternalAuthConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ExternalAuthConfigList) Each(f func(item *ExternalAuthConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ExternalAuthConfigList) Range(f func(index int, item *ExternalAuthConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/external_auth_config_type_json.go b/clientapi/arohcp/v1alpha1/external_auth_config_type_json.go new file mode 100644 index 00000000..e90d8b6b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/external_auth_config_type_json.go @@ -0,0 +1,120 @@ +/* +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" + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExternalAuthConfig writes a value of the 'external_auth_config' type to the given writer. +func MarshalExternalAuthConfig(object *ExternalAuthConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalAuthConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalAuthConfig writes a value of the 'external_auth_config' type to the given stream. +func WriteExternalAuthConfig(object *ExternalAuthConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&2 != 0 && object.externalAuths != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_auths") + stream.WriteObjectStart() + stream.WriteObjectField("items") + v1.WriteExternalAuthList(object.externalAuths.Items(), stream) + stream.WriteObjectEnd() + } + stream.WriteObjectEnd() +} + +// UnmarshalExternalAuthConfig reads a value of the 'external_auth_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalExternalAuthConfig(source interface{}) (object *ExternalAuthConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadExternalAuthConfig(iterator) + err = iterator.Error + return +} + +// ReadExternalAuthConfig reads a value of the 'external_auth_config' type from the given iterator. +func ReadExternalAuthConfig(iterator *jsoniter.Iterator) *ExternalAuthConfig { + object := &ExternalAuthConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + case "external_auths": + value := &v1.ExternalAuthList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == v1.ExternalAuthListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(v1.ReadExternalAuthList(iterator)) + default: + iterator.ReadAny() + } + } + object.externalAuths = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/external_configuration_builder.go b/clientapi/arohcp/v1alpha1/external_configuration_builder.go new file mode 100644 index 00000000..78af14e6 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/external_configuration_builder.go @@ -0,0 +1,114 @@ +/* +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 ( + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// ExternalConfigurationBuilder contains the data and logic needed to build 'external_configuration' objects. +// +// Representation of cluster external configuration. +type ExternalConfigurationBuilder struct { + bitmap_ uint32 + labels *v1.LabelListBuilder + manifests *v1.ManifestListBuilder + syncsets *v1.SyncsetListBuilder +} + +// NewExternalConfiguration creates a new builder of 'external_configuration' objects. +func NewExternalConfiguration() *ExternalConfigurationBuilder { + return &ExternalConfigurationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ExternalConfigurationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Labels sets the value of the 'labels' attribute to the given values. +func (b *ExternalConfigurationBuilder) Labels(value *v1.LabelListBuilder) *ExternalConfigurationBuilder { + b.labels = value + b.bitmap_ |= 1 + return b +} + +// Manifests sets the value of the 'manifests' attribute to the given values. +func (b *ExternalConfigurationBuilder) Manifests(value *v1.ManifestListBuilder) *ExternalConfigurationBuilder { + b.manifests = value + b.bitmap_ |= 2 + return b +} + +// Syncsets sets the value of the 'syncsets' attribute to the given values. +func (b *ExternalConfigurationBuilder) Syncsets(value *v1.SyncsetListBuilder) *ExternalConfigurationBuilder { + b.syncsets = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ExternalConfigurationBuilder) Copy(object *ExternalConfiguration) *ExternalConfigurationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.labels != nil { + b.labels = v1.NewLabelList().Copy(object.labels) + } else { + b.labels = nil + } + if object.manifests != nil { + b.manifests = v1.NewManifestList().Copy(object.manifests) + } else { + b.manifests = nil + } + if object.syncsets != nil { + b.syncsets = v1.NewSyncsetList().Copy(object.syncsets) + } else { + b.syncsets = nil + } + return b +} + +// Build creates a 'external_configuration' object using the configuration stored in the builder. +func (b *ExternalConfigurationBuilder) Build() (object *ExternalConfiguration, err error) { + object = new(ExternalConfiguration) + object.bitmap_ = b.bitmap_ + if b.labels != nil { + object.labels, err = b.labels.Build() + if err != nil { + return + } + } + if b.manifests != nil { + object.manifests, err = b.manifests.Build() + if err != nil { + return + } + } + if b.syncsets != nil { + object.syncsets, err = b.syncsets.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/external_configuration_list_builder.go b/clientapi/arohcp/v1alpha1/external_configuration_list_builder.go new file mode 100644 index 00000000..d15472ff --- /dev/null +++ b/clientapi/arohcp/v1alpha1/external_configuration_list_builder.go @@ -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 + +// ExternalConfigurationListBuilder contains the data and logic needed to build +// 'external_configuration' objects. +type ExternalConfigurationListBuilder struct { + items []*ExternalConfigurationBuilder +} + +// NewExternalConfigurationList creates a new builder of 'external_configuration' objects. +func NewExternalConfigurationList() *ExternalConfigurationListBuilder { + return new(ExternalConfigurationListBuilder) +} + +// Items sets the items of the list. +func (b *ExternalConfigurationListBuilder) Items(values ...*ExternalConfigurationBuilder) *ExternalConfigurationListBuilder { + b.items = make([]*ExternalConfigurationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ExternalConfigurationListBuilder) 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 *ExternalConfigurationListBuilder) Copy(list *ExternalConfigurationList) *ExternalConfigurationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ExternalConfigurationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewExternalConfiguration().Copy(v) + } + } + return b +} + +// Build creates a list of 'external_configuration' objects using the +// configuration stored in the builder. +func (b *ExternalConfigurationListBuilder) Build() (list *ExternalConfigurationList, err error) { + items := make([]*ExternalConfiguration, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ExternalConfigurationList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/external_configuration_list_type_json.go b/clientapi/arohcp/v1alpha1/external_configuration_list_type_json.go new file mode 100644 index 00000000..b278aab1 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/external_configuration_list_type_json.go @@ -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" +) + +// MarshalExternalConfigurationList writes a list of values of the 'external_configuration' type to +// the given writer. +func MarshalExternalConfigurationList(list []*ExternalConfiguration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalConfigurationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalConfigurationList writes a list of value of the 'external_configuration' type to +// the given stream. +func WriteExternalConfigurationList(list []*ExternalConfiguration, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteExternalConfiguration(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalExternalConfigurationList reads a list of values of the 'external_configuration' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalExternalConfigurationList(source interface{}) (items []*ExternalConfiguration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadExternalConfigurationList(iterator) + err = iterator.Error + return +} + +// ReadExternalConfigurationList reads list of values of the ”external_configuration' type from +// the given iterator. +func ReadExternalConfigurationList(iterator *jsoniter.Iterator) []*ExternalConfiguration { + list := []*ExternalConfiguration{} + for iterator.ReadArray() { + item := ReadExternalConfiguration(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/external_configuration_type.go b/clientapi/arohcp/v1alpha1/external_configuration_type.go new file mode 100644 index 00000000..17fcecbc --- /dev/null +++ b/clientapi/arohcp/v1alpha1/external_configuration_type.go @@ -0,0 +1,217 @@ +/* +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 ( + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// ExternalConfiguration represents the values of the 'external_configuration' type. +// +// Representation of cluster external configuration. +type ExternalConfiguration struct { + bitmap_ uint32 + labels *v1.LabelList + manifests *v1.ManifestList + syncsets *v1.SyncsetList +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ExternalConfiguration) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Labels returns the value of the 'labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// list of labels externally configured on the clusterdeployment. +func (o *ExternalConfiguration) Labels() *v1.LabelList { + if o != nil && o.bitmap_&1 != 0 { + return o.labels + } + return nil +} + +// GetLabels returns the value of the 'labels' attribute and +// a flag indicating if the attribute has a value. +// +// list of labels externally configured on the clusterdeployment. +func (o *ExternalConfiguration) GetLabels() (value *v1.LabelList, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.labels + } + return +} + +// Manifests returns the value of the 'manifests' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// list of manifest externally configured for a hosted cluster. +func (o *ExternalConfiguration) Manifests() *v1.ManifestList { + if o != nil && o.bitmap_&2 != 0 { + return o.manifests + } + return nil +} + +// GetManifests returns the value of the 'manifests' attribute and +// a flag indicating if the attribute has a value. +// +// list of manifest externally configured for a hosted cluster. +func (o *ExternalConfiguration) GetManifests() (value *v1.ManifestList, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.manifests + } + return +} + +// Syncsets returns the value of the 'syncsets' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// list of syncsets externally configured on the cluster. +func (o *ExternalConfiguration) Syncsets() *v1.SyncsetList { + if o != nil && o.bitmap_&4 != 0 { + return o.syncsets + } + return nil +} + +// GetSyncsets returns the value of the 'syncsets' attribute and +// a flag indicating if the attribute has a value. +// +// list of syncsets externally configured on the cluster. +func (o *ExternalConfiguration) GetSyncsets() (value *v1.SyncsetList, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.syncsets + } + return +} + +// ExternalConfigurationListKind is the name of the type used to represent list of objects of +// type 'external_configuration'. +const ExternalConfigurationListKind = "ExternalConfigurationList" + +// ExternalConfigurationListLinkKind is the name of the type used to represent links to list +// of objects of type 'external_configuration'. +const ExternalConfigurationListLinkKind = "ExternalConfigurationListLink" + +// ExternalConfigurationNilKind is the name of the type used to nil lists of objects of +// type 'external_configuration'. +const ExternalConfigurationListNilKind = "ExternalConfigurationListNil" + +// ExternalConfigurationList is a list of values of the 'external_configuration' type. +type ExternalConfigurationList struct { + href string + link bool + items []*ExternalConfiguration +} + +// Len returns the length of the list. +func (l *ExternalConfigurationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ExternalConfigurationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ExternalConfigurationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ExternalConfigurationList) SetItems(items []*ExternalConfiguration) { + l.items = items +} + +// Items returns the items of the list. +func (l *ExternalConfigurationList) Items() []*ExternalConfiguration { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ExternalConfigurationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ExternalConfigurationList) Get(i int) *ExternalConfiguration { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ExternalConfigurationList) Slice() []*ExternalConfiguration { + var slice []*ExternalConfiguration + if l == nil { + slice = make([]*ExternalConfiguration, 0) + } else { + slice = make([]*ExternalConfiguration, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ExternalConfigurationList) Each(f func(item *ExternalConfiguration) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ExternalConfigurationList) Range(f func(index int, item *ExternalConfiguration) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/external_configuration_type_json.go b/clientapi/arohcp/v1alpha1/external_configuration_type_json.go new file mode 100644 index 00000000..a3a8ccf3 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/external_configuration_type_json.go @@ -0,0 +1,173 @@ +/* +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" + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExternalConfiguration writes a value of the 'external_configuration' type to the given writer. +func MarshalExternalConfiguration(object *ExternalConfiguration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalConfiguration(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalConfiguration writes a value of the 'external_configuration' type to the given stream. +func WriteExternalConfiguration(object *ExternalConfiguration, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.labels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("labels") + stream.WriteObjectStart() + stream.WriteObjectField("items") + v1.WriteLabelList(object.labels.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&2 != 0 && object.manifests != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("manifests") + stream.WriteObjectStart() + stream.WriteObjectField("items") + v1.WriteManifestList(object.manifests.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&4 != 0 && object.syncsets != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("syncsets") + stream.WriteObjectStart() + stream.WriteObjectField("items") + v1.WriteSyncsetList(object.syncsets.Items(), stream) + stream.WriteObjectEnd() + } + stream.WriteObjectEnd() +} + +// UnmarshalExternalConfiguration reads a value of the 'external_configuration' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalExternalConfiguration(source interface{}) (object *ExternalConfiguration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadExternalConfiguration(iterator) + err = iterator.Error + return +} + +// ReadExternalConfiguration reads a value of the 'external_configuration' type from the given iterator. +func ReadExternalConfiguration(iterator *jsoniter.Iterator) *ExternalConfiguration { + object := &ExternalConfiguration{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "labels": + value := &v1.LabelList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == v1.LabelListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(v1.ReadLabelList(iterator)) + default: + iterator.ReadAny() + } + } + object.labels = value + object.bitmap_ |= 1 + case "manifests": + value := &v1.ManifestList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == v1.ManifestListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(v1.ReadManifestList(iterator)) + default: + iterator.ReadAny() + } + } + object.manifests = value + object.bitmap_ |= 2 + case "syncsets": + value := &v1.SyncsetList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == v1.SyncsetListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(v1.ReadSyncsetList(iterator)) + default: + iterator.ReadAny() + } + } + object.syncsets = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/float_list_type_json.go b/clientapi/arohcp/v1alpha1/float_list_type_json.go new file mode 100644 index 00000000..fd7214ca --- /dev/null +++ b/clientapi/arohcp/v1alpha1/float_list_type_json.go @@ -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" +) + +// MarshalFloatList writes a list of values of the 'float' type to +// the given writer. +func MarshalFloatList(list []float64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFloatList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFloatList writes a list of value of the 'float' type to +// the given stream. +func WriteFloatList(list []float64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteFloat64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalFloatList reads a list of values of the 'float' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFloatList(source interface{}) (items []float64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFloatList(iterator) + err = iterator.Error + return +} + +// ReadFloatList reads list of values of the ”float' type from +// the given iterator. +func ReadFloatList(iterator *jsoniter.Iterator) []float64 { + list := []float64{} + for iterator.ReadArray() { + item := iterator.ReadFloat64() + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/gcp_authentication_builder.go b/clientapi/arohcp/v1alpha1/gcp_authentication_builder.go new file mode 100644 index 00000000..51e18cba --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_authentication_builder.go @@ -0,0 +1,83 @@ +/* +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 + +// GcpAuthenticationBuilder contains the data and logic needed to build 'gcp_authentication' objects. +// +// Google cloud platform authentication method of a cluster. +type GcpAuthenticationBuilder struct { + bitmap_ uint32 + href string + id string + kind string +} + +// NewGcpAuthentication creates a new builder of 'gcp_authentication' objects. +func NewGcpAuthentication() *GcpAuthenticationBuilder { + return &GcpAuthenticationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GcpAuthenticationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Href sets the value of the 'href' attribute to the given value. +func (b *GcpAuthenticationBuilder) Href(value string) *GcpAuthenticationBuilder { + b.href = value + b.bitmap_ |= 1 + return b +} + +// Id sets the value of the 'id' attribute to the given value. +func (b *GcpAuthenticationBuilder) Id(value string) *GcpAuthenticationBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// Kind sets the value of the 'kind' attribute to the given value. +func (b *GcpAuthenticationBuilder) Kind(value string) *GcpAuthenticationBuilder { + b.kind = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GcpAuthenticationBuilder) Copy(object *GcpAuthentication) *GcpAuthenticationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.href = object.href + b.id = object.id + b.kind = object.kind + return b +} + +// Build creates a 'gcp_authentication' object using the configuration stored in the builder. +func (b *GcpAuthenticationBuilder) Build() (object *GcpAuthentication, err error) { + object = new(GcpAuthentication) + object.bitmap_ = b.bitmap_ + object.href = b.href + object.id = b.id + object.kind = b.kind + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_authentication_list_builder.go b/clientapi/arohcp/v1alpha1/gcp_authentication_list_builder.go new file mode 100644 index 00000000..83175a77 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_authentication_list_builder.go @@ -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 + +// GcpAuthenticationListBuilder contains the data and logic needed to build +// 'gcp_authentication' objects. +type GcpAuthenticationListBuilder struct { + items []*GcpAuthenticationBuilder +} + +// NewGcpAuthenticationList creates a new builder of 'gcp_authentication' objects. +func NewGcpAuthenticationList() *GcpAuthenticationListBuilder { + return new(GcpAuthenticationListBuilder) +} + +// Items sets the items of the list. +func (b *GcpAuthenticationListBuilder) Items(values ...*GcpAuthenticationBuilder) *GcpAuthenticationListBuilder { + b.items = make([]*GcpAuthenticationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GcpAuthenticationListBuilder) 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 *GcpAuthenticationListBuilder) Copy(list *GcpAuthenticationList) *GcpAuthenticationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GcpAuthenticationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGcpAuthentication().Copy(v) + } + } + return b +} + +// Build creates a list of 'gcp_authentication' objects using the +// configuration stored in the builder. +func (b *GcpAuthenticationListBuilder) Build() (list *GcpAuthenticationList, err error) { + items := make([]*GcpAuthentication, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GcpAuthenticationList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_authentication_list_type_json.go b/clientapi/arohcp/v1alpha1/gcp_authentication_list_type_json.go new file mode 100644 index 00000000..3223e5d7 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_authentication_list_type_json.go @@ -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" +) + +// MarshalGcpAuthenticationList writes a list of values of the 'gcp_authentication' type to +// the given writer. +func MarshalGcpAuthenticationList(list []*GcpAuthentication, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGcpAuthenticationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGcpAuthenticationList writes a list of value of the 'gcp_authentication' type to +// the given stream. +func WriteGcpAuthenticationList(list []*GcpAuthentication, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGcpAuthentication(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGcpAuthenticationList reads a list of values of the 'gcp_authentication' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGcpAuthenticationList(source interface{}) (items []*GcpAuthentication, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGcpAuthenticationList(iterator) + err = iterator.Error + return +} + +// ReadGcpAuthenticationList reads list of values of the ”gcp_authentication' type from +// the given iterator. +func ReadGcpAuthenticationList(iterator *jsoniter.Iterator) []*GcpAuthentication { + list := []*GcpAuthentication{} + for iterator.ReadArray() { + item := ReadGcpAuthentication(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/gcp_authentication_type.go b/clientapi/arohcp/v1alpha1/gcp_authentication_type.go new file mode 100644 index 00000000..e08bd9b3 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_authentication_type.go @@ -0,0 +1,213 @@ +/* +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 + +// GcpAuthentication represents the values of the 'gcp_authentication' type. +// +// Google cloud platform authentication method of a cluster. +type GcpAuthentication struct { + bitmap_ uint32 + href string + id string + kind string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GcpAuthentication) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Href returns the value of the 'href' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Self link +func (o *GcpAuthentication) Href() string { + if o != nil && o.bitmap_&1 != 0 { + return o.href + } + return "" +} + +// GetHref returns the value of the 'href' attribute and +// a flag indicating if the attribute has a value. +// +// Self link +func (o *GcpAuthentication) GetHref() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.href + } + return +} + +// Id returns the value of the 'id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Unique identifier of the object +func (o *GcpAuthentication) Id() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetId returns the value of the 'id' attribute and +// a flag indicating if the attribute has a value. +// +// Unique identifier of the object +func (o *GcpAuthentication) GetId() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// Kind returns the value of the 'kind' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the type of this object +func (o *GcpAuthentication) Kind() string { + if o != nil && o.bitmap_&4 != 0 { + return o.kind + } + return "" +} + +// GetKind returns the value of the 'kind' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the type of this object +func (o *GcpAuthentication) GetKind() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.kind + } + return +} + +// GcpAuthenticationListKind is the name of the type used to represent list of objects of +// type 'gcp_authentication'. +const GcpAuthenticationListKind = "GcpAuthenticationList" + +// GcpAuthenticationListLinkKind is the name of the type used to represent links to list +// of objects of type 'gcp_authentication'. +const GcpAuthenticationListLinkKind = "GcpAuthenticationListLink" + +// GcpAuthenticationNilKind is the name of the type used to nil lists of objects of +// type 'gcp_authentication'. +const GcpAuthenticationListNilKind = "GcpAuthenticationListNil" + +// GcpAuthenticationList is a list of values of the 'gcp_authentication' type. +type GcpAuthenticationList struct { + href string + link bool + items []*GcpAuthentication +} + +// Len returns the length of the list. +func (l *GcpAuthenticationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GcpAuthenticationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GcpAuthenticationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GcpAuthenticationList) SetItems(items []*GcpAuthentication) { + l.items = items +} + +// Items returns the items of the list. +func (l *GcpAuthenticationList) Items() []*GcpAuthentication { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GcpAuthenticationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GcpAuthenticationList) Get(i int) *GcpAuthentication { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GcpAuthenticationList) Slice() []*GcpAuthentication { + var slice []*GcpAuthentication + if l == nil { + slice = make([]*GcpAuthentication, 0) + } else { + slice = make([]*GcpAuthentication, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GcpAuthenticationList) Each(f func(item *GcpAuthentication) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GcpAuthenticationList) Range(f func(index int, item *GcpAuthentication) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/gcp_authentication_type_json.go b/clientapi/arohcp/v1alpha1/gcp_authentication_type_json.go new file mode 100644 index 00000000..5b7f9be4 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_authentication_type_json.go @@ -0,0 +1,112 @@ +/* +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" +) + +// MarshalGcpAuthentication writes a value of the 'gcp_authentication' type to the given writer. +func MarshalGcpAuthentication(object *GcpAuthentication, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGcpAuthentication(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGcpAuthentication writes a value of the 'gcp_authentication' type to the given stream. +func WriteGcpAuthentication(object *GcpAuthentication, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kind") + stream.WriteString(object.kind) + } + stream.WriteObjectEnd() +} + +// UnmarshalGcpAuthentication reads a value of the 'gcp_authentication' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGcpAuthentication(source interface{}) (object *GcpAuthentication, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGcpAuthentication(iterator) + err = iterator.Error + return +} + +// ReadGcpAuthentication reads a value of the 'gcp_authentication' type from the given iterator. +func ReadGcpAuthentication(iterator *jsoniter.Iterator) *GcpAuthentication { + object := &GcpAuthentication{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 1 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 2 + case "kind": + value := iterator.ReadString() + object.kind = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/gcp_builder.go b/clientapi/arohcp/v1alpha1/gcp_builder.go new file mode 100644 index 00000000..7ce8f0a8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_builder.go @@ -0,0 +1,228 @@ +/* +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 + +// GCPBuilder contains the data and logic needed to build 'GCP' objects. +// +// Google cloud platform settings of a cluster. +type GCPBuilder struct { + bitmap_ uint32 + authURI string + authProviderX509CertURL string + authentication *GcpAuthenticationBuilder + clientID string + clientX509CertURL string + clientEmail string + privateKey string + privateKeyID string + privateServiceConnect *GcpPrivateServiceConnectBuilder + projectID string + security *GcpSecurityBuilder + tokenURI string + type_ string +} + +// NewGCP creates a new builder of 'GCP' objects. +func NewGCP() *GCPBuilder { + return &GCPBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GCPBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AuthURI sets the value of the 'auth_URI' attribute to the given value. +func (b *GCPBuilder) AuthURI(value string) *GCPBuilder { + b.authURI = value + b.bitmap_ |= 1 + return b +} + +// AuthProviderX509CertURL sets the value of the 'auth_provider_X509_cert_URL' attribute to the given value. +func (b *GCPBuilder) AuthProviderX509CertURL(value string) *GCPBuilder { + b.authProviderX509CertURL = value + b.bitmap_ |= 2 + return b +} + +// Authentication sets the value of the 'authentication' attribute to the given value. +// +// Google cloud platform authentication method of a cluster. +func (b *GCPBuilder) Authentication(value *GcpAuthenticationBuilder) *GCPBuilder { + b.authentication = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// ClientID sets the value of the 'client_ID' attribute to the given value. +func (b *GCPBuilder) ClientID(value string) *GCPBuilder { + b.clientID = value + b.bitmap_ |= 8 + return b +} + +// ClientX509CertURL sets the value of the 'client_X509_cert_URL' attribute to the given value. +func (b *GCPBuilder) ClientX509CertURL(value string) *GCPBuilder { + b.clientX509CertURL = value + b.bitmap_ |= 16 + return b +} + +// ClientEmail sets the value of the 'client_email' attribute to the given value. +func (b *GCPBuilder) ClientEmail(value string) *GCPBuilder { + b.clientEmail = value + b.bitmap_ |= 32 + return b +} + +// PrivateKey sets the value of the 'private_key' attribute to the given value. +func (b *GCPBuilder) PrivateKey(value string) *GCPBuilder { + b.privateKey = value + b.bitmap_ |= 64 + return b +} + +// PrivateKeyID sets the value of the 'private_key_ID' attribute to the given value. +func (b *GCPBuilder) PrivateKeyID(value string) *GCPBuilder { + b.privateKeyID = value + b.bitmap_ |= 128 + return b +} + +// PrivateServiceConnect sets the value of the 'private_service_connect' attribute to the given value. +// +// Google cloud platform private service connect configuration of a cluster. +func (b *GCPBuilder) PrivateServiceConnect(value *GcpPrivateServiceConnectBuilder) *GCPBuilder { + b.privateServiceConnect = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// ProjectID sets the value of the 'project_ID' attribute to the given value. +func (b *GCPBuilder) ProjectID(value string) *GCPBuilder { + b.projectID = value + b.bitmap_ |= 512 + return b +} + +// Security sets the value of the 'security' attribute to the given value. +// +// Google cloud platform security settings of a cluster. +func (b *GCPBuilder) Security(value *GcpSecurityBuilder) *GCPBuilder { + b.security = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// TokenURI sets the value of the 'token_URI' attribute to the given value. +func (b *GCPBuilder) TokenURI(value string) *GCPBuilder { + b.tokenURI = value + b.bitmap_ |= 2048 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *GCPBuilder) Type(value string) *GCPBuilder { + b.type_ = value + b.bitmap_ |= 4096 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GCPBuilder) Copy(object *GCP) *GCPBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.authURI = object.authURI + b.authProviderX509CertURL = object.authProviderX509CertURL + if object.authentication != nil { + b.authentication = NewGcpAuthentication().Copy(object.authentication) + } else { + b.authentication = nil + } + b.clientID = object.clientID + b.clientX509CertURL = object.clientX509CertURL + b.clientEmail = object.clientEmail + b.privateKey = object.privateKey + b.privateKeyID = object.privateKeyID + if object.privateServiceConnect != nil { + b.privateServiceConnect = NewGcpPrivateServiceConnect().Copy(object.privateServiceConnect) + } else { + b.privateServiceConnect = nil + } + b.projectID = object.projectID + if object.security != nil { + b.security = NewGcpSecurity().Copy(object.security) + } else { + b.security = nil + } + b.tokenURI = object.tokenURI + b.type_ = object.type_ + return b +} + +// Build creates a 'GCP' object using the configuration stored in the builder. +func (b *GCPBuilder) Build() (object *GCP, err error) { + object = new(GCP) + object.bitmap_ = b.bitmap_ + object.authURI = b.authURI + object.authProviderX509CertURL = b.authProviderX509CertURL + if b.authentication != nil { + object.authentication, err = b.authentication.Build() + if err != nil { + return + } + } + object.clientID = b.clientID + object.clientX509CertURL = b.clientX509CertURL + object.clientEmail = b.clientEmail + object.privateKey = b.privateKey + object.privateKeyID = b.privateKeyID + if b.privateServiceConnect != nil { + object.privateServiceConnect, err = b.privateServiceConnect.Build() + if err != nil { + return + } + } + object.projectID = b.projectID + if b.security != nil { + object.security, err = b.security.Build() + if err != nil { + return + } + } + object.tokenURI = b.tokenURI + object.type_ = b.type_ + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_encryption_key_builder.go b/clientapi/arohcp/v1alpha1/gcp_encryption_key_builder.go new file mode 100644 index 00000000..343d7597 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_encryption_key_builder.go @@ -0,0 +1,93 @@ +/* +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 + +// GCPEncryptionKeyBuilder contains the data and logic needed to build 'GCP_encryption_key' objects. +// +// GCP Encryption Key for CCS clusters. +type GCPEncryptionKeyBuilder struct { + bitmap_ uint32 + kmsKeyServiceAccount string + keyLocation string + keyName string + keyRing string +} + +// NewGCPEncryptionKey creates a new builder of 'GCP_encryption_key' objects. +func NewGCPEncryptionKey() *GCPEncryptionKeyBuilder { + return &GCPEncryptionKeyBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GCPEncryptionKeyBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// KMSKeyServiceAccount sets the value of the 'KMS_key_service_account' attribute to the given value. +func (b *GCPEncryptionKeyBuilder) KMSKeyServiceAccount(value string) *GCPEncryptionKeyBuilder { + b.kmsKeyServiceAccount = value + b.bitmap_ |= 1 + return b +} + +// KeyLocation sets the value of the 'key_location' attribute to the given value. +func (b *GCPEncryptionKeyBuilder) KeyLocation(value string) *GCPEncryptionKeyBuilder { + b.keyLocation = value + b.bitmap_ |= 2 + return b +} + +// KeyName sets the value of the 'key_name' attribute to the given value. +func (b *GCPEncryptionKeyBuilder) KeyName(value string) *GCPEncryptionKeyBuilder { + b.keyName = value + b.bitmap_ |= 4 + return b +} + +// KeyRing sets the value of the 'key_ring' attribute to the given value. +func (b *GCPEncryptionKeyBuilder) KeyRing(value string) *GCPEncryptionKeyBuilder { + b.keyRing = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GCPEncryptionKeyBuilder) Copy(object *GCPEncryptionKey) *GCPEncryptionKeyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.kmsKeyServiceAccount = object.kmsKeyServiceAccount + b.keyLocation = object.keyLocation + b.keyName = object.keyName + b.keyRing = object.keyRing + return b +} + +// Build creates a 'GCP_encryption_key' object using the configuration stored in the builder. +func (b *GCPEncryptionKeyBuilder) Build() (object *GCPEncryptionKey, err error) { + object = new(GCPEncryptionKey) + object.bitmap_ = b.bitmap_ + object.kmsKeyServiceAccount = b.kmsKeyServiceAccount + object.keyLocation = b.keyLocation + object.keyName = b.keyName + object.keyRing = b.keyRing + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_encryption_key_list_builder.go b/clientapi/arohcp/v1alpha1/gcp_encryption_key_list_builder.go new file mode 100644 index 00000000..f83f1fce --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_encryption_key_list_builder.go @@ -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 + +// GCPEncryptionKeyListBuilder contains the data and logic needed to build +// 'GCP_encryption_key' objects. +type GCPEncryptionKeyListBuilder struct { + items []*GCPEncryptionKeyBuilder +} + +// NewGCPEncryptionKeyList creates a new builder of 'GCP_encryption_key' objects. +func NewGCPEncryptionKeyList() *GCPEncryptionKeyListBuilder { + return new(GCPEncryptionKeyListBuilder) +} + +// Items sets the items of the list. +func (b *GCPEncryptionKeyListBuilder) Items(values ...*GCPEncryptionKeyBuilder) *GCPEncryptionKeyListBuilder { + b.items = make([]*GCPEncryptionKeyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GCPEncryptionKeyListBuilder) 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 *GCPEncryptionKeyListBuilder) Copy(list *GCPEncryptionKeyList) *GCPEncryptionKeyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GCPEncryptionKeyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGCPEncryptionKey().Copy(v) + } + } + return b +} + +// Build creates a list of 'GCP_encryption_key' objects using the +// configuration stored in the builder. +func (b *GCPEncryptionKeyListBuilder) Build() (list *GCPEncryptionKeyList, err error) { + items := make([]*GCPEncryptionKey, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GCPEncryptionKeyList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_encryption_key_list_type_json.go b/clientapi/arohcp/v1alpha1/gcp_encryption_key_list_type_json.go new file mode 100644 index 00000000..a468dcb3 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_encryption_key_list_type_json.go @@ -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" +) + +// MarshalGCPEncryptionKeyList writes a list of values of the 'GCP_encryption_key' type to +// the given writer. +func MarshalGCPEncryptionKeyList(list []*GCPEncryptionKey, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPEncryptionKeyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPEncryptionKeyList writes a list of value of the 'GCP_encryption_key' type to +// the given stream. +func WriteGCPEncryptionKeyList(list []*GCPEncryptionKey, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGCPEncryptionKey(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGCPEncryptionKeyList reads a list of values of the 'GCP_encryption_key' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGCPEncryptionKeyList(source interface{}) (items []*GCPEncryptionKey, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGCPEncryptionKeyList(iterator) + err = iterator.Error + return +} + +// ReadGCPEncryptionKeyList reads list of values of the ”GCP_encryption_key' type from +// the given iterator. +func ReadGCPEncryptionKeyList(iterator *jsoniter.Iterator) []*GCPEncryptionKey { + list := []*GCPEncryptionKey{} + for iterator.ReadArray() { + item := ReadGCPEncryptionKey(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/gcp_encryption_key_type.go b/clientapi/arohcp/v1alpha1/gcp_encryption_key_type.go new file mode 100644 index 00000000..b2e24691 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_encryption_key_type.go @@ -0,0 +1,237 @@ +/* +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 + +// GCPEncryptionKey represents the values of the 'GCP_encryption_key' type. +// +// GCP Encryption Key for CCS clusters. +type GCPEncryptionKey struct { + bitmap_ uint32 + kmsKeyServiceAccount string + keyLocation string + keyName string + keyRing string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GCPEncryptionKey) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// KMSKeyServiceAccount returns the value of the 'KMS_key_service_account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Service account used to access the KMS key +func (o *GCPEncryptionKey) KMSKeyServiceAccount() string { + if o != nil && o.bitmap_&1 != 0 { + return o.kmsKeyServiceAccount + } + return "" +} + +// GetKMSKeyServiceAccount returns the value of the 'KMS_key_service_account' attribute and +// a flag indicating if the attribute has a value. +// +// Service account used to access the KMS key +func (o *GCPEncryptionKey) GetKMSKeyServiceAccount() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.kmsKeyServiceAccount + } + return +} + +// KeyLocation returns the value of the 'key_location' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Location of the encryption key ring +func (o *GCPEncryptionKey) KeyLocation() string { + if o != nil && o.bitmap_&2 != 0 { + return o.keyLocation + } + return "" +} + +// GetKeyLocation returns the value of the 'key_location' attribute and +// a flag indicating if the attribute has a value. +// +// Location of the encryption key ring +func (o *GCPEncryptionKey) GetKeyLocation() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.keyLocation + } + return +} + +// KeyName returns the value of the 'key_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the encryption key +func (o *GCPEncryptionKey) KeyName() string { + if o != nil && o.bitmap_&4 != 0 { + return o.keyName + } + return "" +} + +// GetKeyName returns the value of the 'key_name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the encryption key +func (o *GCPEncryptionKey) GetKeyName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.keyName + } + return +} + +// KeyRing returns the value of the 'key_ring' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the key ring the encryption key is located on +func (o *GCPEncryptionKey) KeyRing() string { + if o != nil && o.bitmap_&8 != 0 { + return o.keyRing + } + return "" +} + +// GetKeyRing returns the value of the 'key_ring' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the key ring the encryption key is located on +func (o *GCPEncryptionKey) GetKeyRing() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.keyRing + } + return +} + +// GCPEncryptionKeyListKind is the name of the type used to represent list of objects of +// type 'GCP_encryption_key'. +const GCPEncryptionKeyListKind = "GCPEncryptionKeyList" + +// GCPEncryptionKeyListLinkKind is the name of the type used to represent links to list +// of objects of type 'GCP_encryption_key'. +const GCPEncryptionKeyListLinkKind = "GCPEncryptionKeyListLink" + +// GCPEncryptionKeyNilKind is the name of the type used to nil lists of objects of +// type 'GCP_encryption_key'. +const GCPEncryptionKeyListNilKind = "GCPEncryptionKeyListNil" + +// GCPEncryptionKeyList is a list of values of the 'GCP_encryption_key' type. +type GCPEncryptionKeyList struct { + href string + link bool + items []*GCPEncryptionKey +} + +// Len returns the length of the list. +func (l *GCPEncryptionKeyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GCPEncryptionKeyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GCPEncryptionKeyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GCPEncryptionKeyList) SetItems(items []*GCPEncryptionKey) { + l.items = items +} + +// Items returns the items of the list. +func (l *GCPEncryptionKeyList) Items() []*GCPEncryptionKey { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GCPEncryptionKeyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GCPEncryptionKeyList) Get(i int) *GCPEncryptionKey { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GCPEncryptionKeyList) Slice() []*GCPEncryptionKey { + var slice []*GCPEncryptionKey + if l == nil { + slice = make([]*GCPEncryptionKey, 0) + } else { + slice = make([]*GCPEncryptionKey, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GCPEncryptionKeyList) Each(f func(item *GCPEncryptionKey) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GCPEncryptionKeyList) Range(f func(index int, item *GCPEncryptionKey) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/gcp_encryption_key_type_json.go b/clientapi/arohcp/v1alpha1/gcp_encryption_key_type_json.go new file mode 100644 index 00000000..9969f187 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_encryption_key_type_json.go @@ -0,0 +1,125 @@ +/* +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" +) + +// MarshalGCPEncryptionKey writes a value of the 'GCP_encryption_key' type to the given writer. +func MarshalGCPEncryptionKey(object *GCPEncryptionKey, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPEncryptionKey(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPEncryptionKey writes a value of the 'GCP_encryption_key' type to the given stream. +func WriteGCPEncryptionKey(object *GCPEncryptionKey, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kms_key_service_account") + stream.WriteString(object.kmsKeyServiceAccount) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key_location") + stream.WriteString(object.keyLocation) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key_name") + stream.WriteString(object.keyName) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key_ring") + stream.WriteString(object.keyRing) + } + stream.WriteObjectEnd() +} + +// UnmarshalGCPEncryptionKey reads a value of the 'GCP_encryption_key' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGCPEncryptionKey(source interface{}) (object *GCPEncryptionKey, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGCPEncryptionKey(iterator) + err = iterator.Error + return +} + +// ReadGCPEncryptionKey reads a value of the 'GCP_encryption_key' type from the given iterator. +func ReadGCPEncryptionKey(iterator *jsoniter.Iterator) *GCPEncryptionKey { + object := &GCPEncryptionKey{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kms_key_service_account": + value := iterator.ReadString() + object.kmsKeyServiceAccount = value + object.bitmap_ |= 1 + case "key_location": + value := iterator.ReadString() + object.keyLocation = value + object.bitmap_ |= 2 + case "key_name": + value := iterator.ReadString() + object.keyName = value + object.bitmap_ |= 4 + case "key_ring": + value := iterator.ReadString() + object.keyRing = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/gcp_image_override_builder.go b/clientapi/arohcp/v1alpha1/gcp_image_override_builder.go new file mode 100644 index 00000000..efe03918 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_image_override_builder.go @@ -0,0 +1,153 @@ +/* +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 ( + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// GCPImageOverrideBuilder contains the data and logic needed to build 'GCP_image_override' objects. +// +// GcpImageOverride specifies what a GCP VM Image should be used for a particular product and billing model +type GCPImageOverrideBuilder struct { + bitmap_ uint32 + id string + href string + billingModel *v1.BillingModelItemBuilder + imageID string + product *v1.ProductBuilder + projectID string +} + +// NewGCPImageOverride creates a new builder of 'GCP_image_override' objects. +func NewGCPImageOverride() *GCPImageOverrideBuilder { + return &GCPImageOverrideBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *GCPImageOverrideBuilder) Link(value bool) *GCPImageOverrideBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *GCPImageOverrideBuilder) ID(value string) *GCPImageOverrideBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *GCPImageOverrideBuilder) HREF(value string) *GCPImageOverrideBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GCPImageOverrideBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// BillingModel sets the value of the 'billing_model' attribute to the given value. +// +// BillingModelItem represents a billing model +func (b *GCPImageOverrideBuilder) BillingModel(value *v1.BillingModelItemBuilder) *GCPImageOverrideBuilder { + b.billingModel = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// ImageID sets the value of the 'image_ID' attribute to the given value. +func (b *GCPImageOverrideBuilder) ImageID(value string) *GCPImageOverrideBuilder { + b.imageID = value + b.bitmap_ |= 16 + return b +} + +// Product sets the value of the 'product' attribute to the given value. +// +// Representation of an product that can be selected as a cluster type. +func (b *GCPImageOverrideBuilder) Product(value *v1.ProductBuilder) *GCPImageOverrideBuilder { + b.product = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// ProjectID sets the value of the 'project_ID' attribute to the given value. +func (b *GCPImageOverrideBuilder) ProjectID(value string) *GCPImageOverrideBuilder { + b.projectID = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GCPImageOverrideBuilder) Copy(object *GCPImageOverride) *GCPImageOverrideBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.billingModel != nil { + b.billingModel = v1.NewBillingModelItem().Copy(object.billingModel) + } else { + b.billingModel = nil + } + b.imageID = object.imageID + if object.product != nil { + b.product = v1.NewProduct().Copy(object.product) + } else { + b.product = nil + } + b.projectID = object.projectID + return b +} + +// Build creates a 'GCP_image_override' object using the configuration stored in the builder. +func (b *GCPImageOverrideBuilder) Build() (object *GCPImageOverride, err error) { + object = new(GCPImageOverride) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.billingModel != nil { + object.billingModel, err = b.billingModel.Build() + if err != nil { + return + } + } + object.imageID = b.imageID + if b.product != nil { + object.product, err = b.product.Build() + if err != nil { + return + } + } + object.projectID = b.projectID + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_image_override_list_builder.go b/clientapi/arohcp/v1alpha1/gcp_image_override_list_builder.go new file mode 100644 index 00000000..d21666b4 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_image_override_list_builder.go @@ -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 + +// GCPImageOverrideListBuilder contains the data and logic needed to build +// 'GCP_image_override' objects. +type GCPImageOverrideListBuilder struct { + items []*GCPImageOverrideBuilder +} + +// NewGCPImageOverrideList creates a new builder of 'GCP_image_override' objects. +func NewGCPImageOverrideList() *GCPImageOverrideListBuilder { + return new(GCPImageOverrideListBuilder) +} + +// Items sets the items of the list. +func (b *GCPImageOverrideListBuilder) Items(values ...*GCPImageOverrideBuilder) *GCPImageOverrideListBuilder { + b.items = make([]*GCPImageOverrideBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GCPImageOverrideListBuilder) 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 *GCPImageOverrideListBuilder) Copy(list *GCPImageOverrideList) *GCPImageOverrideListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GCPImageOverrideBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGCPImageOverride().Copy(v) + } + } + return b +} + +// Build creates a list of 'GCP_image_override' objects using the +// configuration stored in the builder. +func (b *GCPImageOverrideListBuilder) Build() (list *GCPImageOverrideList, err error) { + items := make([]*GCPImageOverride, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GCPImageOverrideList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_image_override_list_type_json.go b/clientapi/arohcp/v1alpha1/gcp_image_override_list_type_json.go new file mode 100644 index 00000000..81f222ec --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_image_override_list_type_json.go @@ -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" +) + +// MarshalGCPImageOverrideList writes a list of values of the 'GCP_image_override' type to +// the given writer. +func MarshalGCPImageOverrideList(list []*GCPImageOverride, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPImageOverrideList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPImageOverrideList writes a list of value of the 'GCP_image_override' type to +// the given stream. +func WriteGCPImageOverrideList(list []*GCPImageOverride, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGCPImageOverride(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGCPImageOverrideList reads a list of values of the 'GCP_image_override' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGCPImageOverrideList(source interface{}) (items []*GCPImageOverride, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGCPImageOverrideList(iterator) + err = iterator.Error + return +} + +// ReadGCPImageOverrideList reads list of values of the ”GCP_image_override' type from +// the given iterator. +func ReadGCPImageOverrideList(iterator *jsoniter.Iterator) []*GCPImageOverride { + list := []*GCPImageOverride{} + for iterator.ReadArray() { + item := ReadGCPImageOverride(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/gcp_image_override_type.go b/clientapi/arohcp/v1alpha1/gcp_image_override_type.go new file mode 100644 index 00000000..d903bb13 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_image_override_type.go @@ -0,0 +1,341 @@ +/* +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 ( + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// GCPImageOverrideKind is the name of the type used to represent objects +// of type 'GCP_image_override'. +const GCPImageOverrideKind = "GCPImageOverride" + +// GCPImageOverrideLinkKind is the name of the type used to represent links +// to objects of type 'GCP_image_override'. +const GCPImageOverrideLinkKind = "GCPImageOverrideLink" + +// GCPImageOverrideNilKind is the name of the type used to nil references +// to objects of type 'GCP_image_override'. +const GCPImageOverrideNilKind = "GCPImageOverrideNil" + +// GCPImageOverride represents the values of the 'GCP_image_override' type. +// +// GcpImageOverride specifies what a GCP VM Image should be used for a particular product and billing model +type GCPImageOverride struct { + bitmap_ uint32 + id string + href string + billingModel *v1.BillingModelItem + imageID string + product *v1.Product + projectID string +} + +// Kind returns the name of the type of the object. +func (o *GCPImageOverride) Kind() string { + if o == nil { + return GCPImageOverrideNilKind + } + if o.bitmap_&1 != 0 { + return GCPImageOverrideLinkKind + } + return GCPImageOverrideKind +} + +// Link returns true if this is a link. +func (o *GCPImageOverride) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *GCPImageOverride) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *GCPImageOverride) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *GCPImageOverride) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *GCPImageOverride) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GCPImageOverride) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// BillingModel returns the value of the 'billing_model' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the billing model. +func (o *GCPImageOverride) BillingModel() *v1.BillingModelItem { + if o != nil && o.bitmap_&8 != 0 { + return o.billingModel + } + return nil +} + +// GetBillingModel returns the value of the 'billing_model' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the billing model. +func (o *GCPImageOverride) GetBillingModel() (value *v1.BillingModelItem, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.billingModel + } + return +} + +// ImageID returns the value of the 'image_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ImageID is the id of the Google Cloud Platform image. +func (o *GCPImageOverride) ImageID() string { + if o != nil && o.bitmap_&16 != 0 { + return o.imageID + } + return "" +} + +// GetImageID returns the value of the 'image_ID' attribute and +// a flag indicating if the attribute has a value. +// +// ImageID is the id of the Google Cloud Platform image. +func (o *GCPImageOverride) GetImageID() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.imageID + } + return +} + +// Product returns the value of the 'product' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the product type. +func (o *GCPImageOverride) Product() *v1.Product { + if o != nil && o.bitmap_&32 != 0 { + return o.product + } + return nil +} + +// GetProduct returns the value of the 'product' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the product type. +func (o *GCPImageOverride) GetProduct() (value *v1.Product, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.product + } + return +} + +// ProjectID returns the value of the 'project_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ProjectID is the id of the Google Cloud Platform project that hosts the image. +func (o *GCPImageOverride) ProjectID() string { + if o != nil && o.bitmap_&64 != 0 { + return o.projectID + } + return "" +} + +// GetProjectID returns the value of the 'project_ID' attribute and +// a flag indicating if the attribute has a value. +// +// ProjectID is the id of the Google Cloud Platform project that hosts the image. +func (o *GCPImageOverride) GetProjectID() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.projectID + } + return +} + +// GCPImageOverrideListKind is the name of the type used to represent list of objects of +// type 'GCP_image_override'. +const GCPImageOverrideListKind = "GCPImageOverrideList" + +// GCPImageOverrideListLinkKind is the name of the type used to represent links to list +// of objects of type 'GCP_image_override'. +const GCPImageOverrideListLinkKind = "GCPImageOverrideListLink" + +// GCPImageOverrideNilKind is the name of the type used to nil lists of objects of +// type 'GCP_image_override'. +const GCPImageOverrideListNilKind = "GCPImageOverrideListNil" + +// GCPImageOverrideList is a list of values of the 'GCP_image_override' type. +type GCPImageOverrideList struct { + href string + link bool + items []*GCPImageOverride +} + +// Kind returns the name of the type of the object. +func (l *GCPImageOverrideList) Kind() string { + if l == nil { + return GCPImageOverrideListNilKind + } + if l.link { + return GCPImageOverrideListLinkKind + } + return GCPImageOverrideListKind +} + +// Link returns true iif this is a link. +func (l *GCPImageOverrideList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *GCPImageOverrideList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *GCPImageOverrideList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *GCPImageOverrideList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GCPImageOverrideList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GCPImageOverrideList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GCPImageOverrideList) SetItems(items []*GCPImageOverride) { + l.items = items +} + +// Items returns the items of the list. +func (l *GCPImageOverrideList) Items() []*GCPImageOverride { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GCPImageOverrideList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GCPImageOverrideList) Get(i int) *GCPImageOverride { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GCPImageOverrideList) Slice() []*GCPImageOverride { + var slice []*GCPImageOverride + if l == nil { + slice = make([]*GCPImageOverride, 0) + } else { + slice = make([]*GCPImageOverride, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GCPImageOverrideList) Each(f func(item *GCPImageOverride) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GCPImageOverrideList) Range(f func(index int, item *GCPImageOverride) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/gcp_image_override_type_json.go b/clientapi/arohcp/v1alpha1/gcp_image_override_type_json.go new file mode 100644 index 00000000..f579861d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_image_override_type_json.go @@ -0,0 +1,160 @@ +/* +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" + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPImageOverride writes a value of the 'GCP_image_override' type to the given writer. +func MarshalGCPImageOverride(object *GCPImageOverride, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPImageOverride(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPImageOverride writes a value of the 'GCP_image_override' type to the given stream. +func WriteGCPImageOverride(object *GCPImageOverride, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(GCPImageOverrideLinkKind) + } else { + stream.WriteString(GCPImageOverrideKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.billingModel != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_model") + v1.WriteBillingModelItem(object.billingModel, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("image_id") + stream.WriteString(object.imageID) + count++ + } + present_ = object.bitmap_&32 != 0 && object.product != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product") + v1.WriteProduct(object.product, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("project_id") + stream.WriteString(object.projectID) + } + stream.WriteObjectEnd() +} + +// UnmarshalGCPImageOverride reads a value of the 'GCP_image_override' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGCPImageOverride(source interface{}) (object *GCPImageOverride, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGCPImageOverride(iterator) + err = iterator.Error + return +} + +// ReadGCPImageOverride reads a value of the 'GCP_image_override' type from the given iterator. +func ReadGCPImageOverride(iterator *jsoniter.Iterator) *GCPImageOverride { + object := &GCPImageOverride{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == GCPImageOverrideLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "billing_model": + value := v1.ReadBillingModelItem(iterator) + object.billingModel = value + object.bitmap_ |= 8 + case "image_id": + value := iterator.ReadString() + object.imageID = value + object.bitmap_ |= 16 + case "product": + value := v1.ReadProduct(iterator) + object.product = value + object.bitmap_ |= 32 + case "project_id": + value := iterator.ReadString() + object.projectID = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/gcp_list_builder.go b/clientapi/arohcp/v1alpha1/gcp_list_builder.go new file mode 100644 index 00000000..fc9c4d28 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_list_builder.go @@ -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 + +// GCPListBuilder contains the data and logic needed to build +// 'GCP' objects. +type GCPListBuilder struct { + items []*GCPBuilder +} + +// NewGCPList creates a new builder of 'GCP' objects. +func NewGCPList() *GCPListBuilder { + return new(GCPListBuilder) +} + +// Items sets the items of the list. +func (b *GCPListBuilder) Items(values ...*GCPBuilder) *GCPListBuilder { + b.items = make([]*GCPBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GCPListBuilder) 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 *GCPListBuilder) Copy(list *GCPList) *GCPListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GCPBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGCP().Copy(v) + } + } + return b +} + +// Build creates a list of 'GCP' objects using the +// configuration stored in the builder. +func (b *GCPListBuilder) Build() (list *GCPList, err error) { + items := make([]*GCP, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GCPList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_list_type_json.go b/clientapi/arohcp/v1alpha1/gcp_list_type_json.go new file mode 100644 index 00000000..b5507a10 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_list_type_json.go @@ -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" +) + +// MarshalGCPList writes a list of values of the 'GCP' type to +// the given writer. +func MarshalGCPList(list []*GCP, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPList writes a list of value of the 'GCP' type to +// the given stream. +func WriteGCPList(list []*GCP, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGCP(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGCPList reads a list of values of the 'GCP' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGCPList(source interface{}) (items []*GCP, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGCPList(iterator) + err = iterator.Error + return +} + +// ReadGCPList reads list of values of the ”GCP' type from +// the given iterator. +func ReadGCPList(iterator *jsoniter.Iterator) []*GCP { + list := []*GCP{} + for iterator.ReadArray() { + item := ReadGCP(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/gcp_network_builder.go b/clientapi/arohcp/v1alpha1/gcp_network_builder.go new file mode 100644 index 00000000..f1e4f89c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_network_builder.go @@ -0,0 +1,93 @@ +/* +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 + +// GCPNetworkBuilder contains the data and logic needed to build 'GCP_network' objects. +// +// GCP Network configuration of a cluster. +type GCPNetworkBuilder struct { + bitmap_ uint32 + vpcName string + vpcProjectID string + computeSubnet string + controlPlaneSubnet string +} + +// NewGCPNetwork creates a new builder of 'GCP_network' objects. +func NewGCPNetwork() *GCPNetworkBuilder { + return &GCPNetworkBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GCPNetworkBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// VPCName sets the value of the 'VPC_name' attribute to the given value. +func (b *GCPNetworkBuilder) VPCName(value string) *GCPNetworkBuilder { + b.vpcName = value + b.bitmap_ |= 1 + return b +} + +// VPCProjectID sets the value of the 'VPC_project_ID' attribute to the given value. +func (b *GCPNetworkBuilder) VPCProjectID(value string) *GCPNetworkBuilder { + b.vpcProjectID = value + b.bitmap_ |= 2 + return b +} + +// ComputeSubnet sets the value of the 'compute_subnet' attribute to the given value. +func (b *GCPNetworkBuilder) ComputeSubnet(value string) *GCPNetworkBuilder { + b.computeSubnet = value + b.bitmap_ |= 4 + return b +} + +// ControlPlaneSubnet sets the value of the 'control_plane_subnet' attribute to the given value. +func (b *GCPNetworkBuilder) ControlPlaneSubnet(value string) *GCPNetworkBuilder { + b.controlPlaneSubnet = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GCPNetworkBuilder) Copy(object *GCPNetwork) *GCPNetworkBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.vpcName = object.vpcName + b.vpcProjectID = object.vpcProjectID + b.computeSubnet = object.computeSubnet + b.controlPlaneSubnet = object.controlPlaneSubnet + return b +} + +// Build creates a 'GCP_network' object using the configuration stored in the builder. +func (b *GCPNetworkBuilder) Build() (object *GCPNetwork, err error) { + object = new(GCPNetwork) + object.bitmap_ = b.bitmap_ + object.vpcName = b.vpcName + object.vpcProjectID = b.vpcProjectID + object.computeSubnet = b.computeSubnet + object.controlPlaneSubnet = b.controlPlaneSubnet + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_network_list_builder.go b/clientapi/arohcp/v1alpha1/gcp_network_list_builder.go new file mode 100644 index 00000000..3ffbfdde --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_network_list_builder.go @@ -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 + +// GCPNetworkListBuilder contains the data and logic needed to build +// 'GCP_network' objects. +type GCPNetworkListBuilder struct { + items []*GCPNetworkBuilder +} + +// NewGCPNetworkList creates a new builder of 'GCP_network' objects. +func NewGCPNetworkList() *GCPNetworkListBuilder { + return new(GCPNetworkListBuilder) +} + +// Items sets the items of the list. +func (b *GCPNetworkListBuilder) Items(values ...*GCPNetworkBuilder) *GCPNetworkListBuilder { + b.items = make([]*GCPNetworkBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GCPNetworkListBuilder) 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 *GCPNetworkListBuilder) Copy(list *GCPNetworkList) *GCPNetworkListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GCPNetworkBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGCPNetwork().Copy(v) + } + } + return b +} + +// Build creates a list of 'GCP_network' objects using the +// configuration stored in the builder. +func (b *GCPNetworkListBuilder) Build() (list *GCPNetworkList, err error) { + items := make([]*GCPNetwork, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GCPNetworkList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_network_list_type_json.go b/clientapi/arohcp/v1alpha1/gcp_network_list_type_json.go new file mode 100644 index 00000000..e31c7505 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_network_list_type_json.go @@ -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" +) + +// MarshalGCPNetworkList writes a list of values of the 'GCP_network' type to +// the given writer. +func MarshalGCPNetworkList(list []*GCPNetwork, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPNetworkList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPNetworkList writes a list of value of the 'GCP_network' type to +// the given stream. +func WriteGCPNetworkList(list []*GCPNetwork, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGCPNetwork(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGCPNetworkList reads a list of values of the 'GCP_network' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGCPNetworkList(source interface{}) (items []*GCPNetwork, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGCPNetworkList(iterator) + err = iterator.Error + return +} + +// ReadGCPNetworkList reads list of values of the ”GCP_network' type from +// the given iterator. +func ReadGCPNetworkList(iterator *jsoniter.Iterator) []*GCPNetwork { + list := []*GCPNetwork{} + for iterator.ReadArray() { + item := ReadGCPNetwork(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/gcp_network_type.go b/clientapi/arohcp/v1alpha1/gcp_network_type.go new file mode 100644 index 00000000..369ffa6f --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_network_type.go @@ -0,0 +1,237 @@ +/* +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 + +// GCPNetwork represents the values of the 'GCP_network' type. +// +// GCP Network configuration of a cluster. +type GCPNetwork struct { + bitmap_ uint32 + vpcName string + vpcProjectID string + computeSubnet string + controlPlaneSubnet string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GCPNetwork) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// VPCName returns the value of the 'VPC_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// VPC mame used by the cluster. +func (o *GCPNetwork) VPCName() string { + if o != nil && o.bitmap_&1 != 0 { + return o.vpcName + } + return "" +} + +// GetVPCName returns the value of the 'VPC_name' attribute and +// a flag indicating if the attribute has a value. +// +// VPC mame used by the cluster. +func (o *GCPNetwork) GetVPCName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.vpcName + } + return +} + +// VPCProjectID returns the value of the 'VPC_project_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the host project where the shared VPC exists. +func (o *GCPNetwork) VPCProjectID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.vpcProjectID + } + return "" +} + +// GetVPCProjectID returns the value of the 'VPC_project_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the host project where the shared VPC exists. +func (o *GCPNetwork) GetVPCProjectID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.vpcProjectID + } + return +} + +// ComputeSubnet returns the value of the 'compute_subnet' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Compute subnet used by the cluster. +func (o *GCPNetwork) ComputeSubnet() string { + if o != nil && o.bitmap_&4 != 0 { + return o.computeSubnet + } + return "" +} + +// GetComputeSubnet returns the value of the 'compute_subnet' attribute and +// a flag indicating if the attribute has a value. +// +// Compute subnet used by the cluster. +func (o *GCPNetwork) GetComputeSubnet() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.computeSubnet + } + return +} + +// ControlPlaneSubnet returns the value of the 'control_plane_subnet' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Control plane subnet used by the cluster. +func (o *GCPNetwork) ControlPlaneSubnet() string { + if o != nil && o.bitmap_&8 != 0 { + return o.controlPlaneSubnet + } + return "" +} + +// GetControlPlaneSubnet returns the value of the 'control_plane_subnet' attribute and +// a flag indicating if the attribute has a value. +// +// Control plane subnet used by the cluster. +func (o *GCPNetwork) GetControlPlaneSubnet() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.controlPlaneSubnet + } + return +} + +// GCPNetworkListKind is the name of the type used to represent list of objects of +// type 'GCP_network'. +const GCPNetworkListKind = "GCPNetworkList" + +// GCPNetworkListLinkKind is the name of the type used to represent links to list +// of objects of type 'GCP_network'. +const GCPNetworkListLinkKind = "GCPNetworkListLink" + +// GCPNetworkNilKind is the name of the type used to nil lists of objects of +// type 'GCP_network'. +const GCPNetworkListNilKind = "GCPNetworkListNil" + +// GCPNetworkList is a list of values of the 'GCP_network' type. +type GCPNetworkList struct { + href string + link bool + items []*GCPNetwork +} + +// Len returns the length of the list. +func (l *GCPNetworkList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GCPNetworkList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GCPNetworkList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GCPNetworkList) SetItems(items []*GCPNetwork) { + l.items = items +} + +// Items returns the items of the list. +func (l *GCPNetworkList) Items() []*GCPNetwork { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GCPNetworkList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GCPNetworkList) Get(i int) *GCPNetwork { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GCPNetworkList) Slice() []*GCPNetwork { + var slice []*GCPNetwork + if l == nil { + slice = make([]*GCPNetwork, 0) + } else { + slice = make([]*GCPNetwork, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GCPNetworkList) Each(f func(item *GCPNetwork) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GCPNetworkList) Range(f func(index int, item *GCPNetwork) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/gcp_network_type_json.go b/clientapi/arohcp/v1alpha1/gcp_network_type_json.go new file mode 100644 index 00000000..a92ab715 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_network_type_json.go @@ -0,0 +1,125 @@ +/* +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" +) + +// MarshalGCPNetwork writes a value of the 'GCP_network' type to the given writer. +func MarshalGCPNetwork(object *GCPNetwork, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPNetwork(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPNetwork writes a value of the 'GCP_network' type to the given stream. +func WriteGCPNetwork(object *GCPNetwork, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("vpc_name") + stream.WriteString(object.vpcName) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("vpc_project_id") + stream.WriteString(object.vpcProjectID) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute_subnet") + stream.WriteString(object.computeSubnet) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("control_plane_subnet") + stream.WriteString(object.controlPlaneSubnet) + } + stream.WriteObjectEnd() +} + +// UnmarshalGCPNetwork reads a value of the 'GCP_network' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGCPNetwork(source interface{}) (object *GCPNetwork, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGCPNetwork(iterator) + err = iterator.Error + return +} + +// ReadGCPNetwork reads a value of the 'GCP_network' type from the given iterator. +func ReadGCPNetwork(iterator *jsoniter.Iterator) *GCPNetwork { + object := &GCPNetwork{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "vpc_name": + value := iterator.ReadString() + object.vpcName = value + object.bitmap_ |= 1 + case "vpc_project_id": + value := iterator.ReadString() + object.vpcProjectID = value + object.bitmap_ |= 2 + case "compute_subnet": + value := iterator.ReadString() + object.computeSubnet = value + object.bitmap_ |= 4 + case "control_plane_subnet": + value := iterator.ReadString() + object.controlPlaneSubnet = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/gcp_private_service_connect_builder.go b/clientapi/arohcp/v1alpha1/gcp_private_service_connect_builder.go new file mode 100644 index 00000000..a88054af --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_private_service_connect_builder.go @@ -0,0 +1,63 @@ +/* +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 + +// GcpPrivateServiceConnectBuilder contains the data and logic needed to build 'gcp_private_service_connect' objects. +// +// Google cloud platform private service connect configuration of a cluster. +type GcpPrivateServiceConnectBuilder struct { + bitmap_ uint32 + serviceAttachmentSubnet string +} + +// NewGcpPrivateServiceConnect creates a new builder of 'gcp_private_service_connect' objects. +func NewGcpPrivateServiceConnect() *GcpPrivateServiceConnectBuilder { + return &GcpPrivateServiceConnectBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GcpPrivateServiceConnectBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ServiceAttachmentSubnet sets the value of the 'service_attachment_subnet' attribute to the given value. +func (b *GcpPrivateServiceConnectBuilder) ServiceAttachmentSubnet(value string) *GcpPrivateServiceConnectBuilder { + b.serviceAttachmentSubnet = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GcpPrivateServiceConnectBuilder) Copy(object *GcpPrivateServiceConnect) *GcpPrivateServiceConnectBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.serviceAttachmentSubnet = object.serviceAttachmentSubnet + return b +} + +// Build creates a 'gcp_private_service_connect' object using the configuration stored in the builder. +func (b *GcpPrivateServiceConnectBuilder) Build() (object *GcpPrivateServiceConnect, err error) { + object = new(GcpPrivateServiceConnect) + object.bitmap_ = b.bitmap_ + object.serviceAttachmentSubnet = b.serviceAttachmentSubnet + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_private_service_connect_list_builder.go b/clientapi/arohcp/v1alpha1/gcp_private_service_connect_list_builder.go new file mode 100644 index 00000000..37d68e6f --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_private_service_connect_list_builder.go @@ -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 + +// GcpPrivateServiceConnectListBuilder contains the data and logic needed to build +// 'gcp_private_service_connect' objects. +type GcpPrivateServiceConnectListBuilder struct { + items []*GcpPrivateServiceConnectBuilder +} + +// NewGcpPrivateServiceConnectList creates a new builder of 'gcp_private_service_connect' objects. +func NewGcpPrivateServiceConnectList() *GcpPrivateServiceConnectListBuilder { + return new(GcpPrivateServiceConnectListBuilder) +} + +// Items sets the items of the list. +func (b *GcpPrivateServiceConnectListBuilder) Items(values ...*GcpPrivateServiceConnectBuilder) *GcpPrivateServiceConnectListBuilder { + b.items = make([]*GcpPrivateServiceConnectBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GcpPrivateServiceConnectListBuilder) 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 *GcpPrivateServiceConnectListBuilder) Copy(list *GcpPrivateServiceConnectList) *GcpPrivateServiceConnectListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GcpPrivateServiceConnectBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGcpPrivateServiceConnect().Copy(v) + } + } + return b +} + +// Build creates a list of 'gcp_private_service_connect' objects using the +// configuration stored in the builder. +func (b *GcpPrivateServiceConnectListBuilder) Build() (list *GcpPrivateServiceConnectList, err error) { + items := make([]*GcpPrivateServiceConnect, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GcpPrivateServiceConnectList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_private_service_connect_list_type_json.go b/clientapi/arohcp/v1alpha1/gcp_private_service_connect_list_type_json.go new file mode 100644 index 00000000..b0fed29d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_private_service_connect_list_type_json.go @@ -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" +) + +// MarshalGcpPrivateServiceConnectList writes a list of values of the 'gcp_private_service_connect' type to +// the given writer. +func MarshalGcpPrivateServiceConnectList(list []*GcpPrivateServiceConnect, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGcpPrivateServiceConnectList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGcpPrivateServiceConnectList writes a list of value of the 'gcp_private_service_connect' type to +// the given stream. +func WriteGcpPrivateServiceConnectList(list []*GcpPrivateServiceConnect, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGcpPrivateServiceConnect(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGcpPrivateServiceConnectList reads a list of values of the 'gcp_private_service_connect' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGcpPrivateServiceConnectList(source interface{}) (items []*GcpPrivateServiceConnect, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGcpPrivateServiceConnectList(iterator) + err = iterator.Error + return +} + +// ReadGcpPrivateServiceConnectList reads list of values of the ”gcp_private_service_connect' type from +// the given iterator. +func ReadGcpPrivateServiceConnectList(iterator *jsoniter.Iterator) []*GcpPrivateServiceConnect { + list := []*GcpPrivateServiceConnect{} + for iterator.ReadArray() { + item := ReadGcpPrivateServiceConnect(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/gcp_private_service_connect_type.go b/clientapi/arohcp/v1alpha1/gcp_private_service_connect_type.go new file mode 100644 index 00000000..b1477f34 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_private_service_connect_type.go @@ -0,0 +1,165 @@ +/* +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 + +// GcpPrivateServiceConnect represents the values of the 'gcp_private_service_connect' type. +// +// Google cloud platform private service connect configuration of a cluster. +type GcpPrivateServiceConnect struct { + bitmap_ uint32 + serviceAttachmentSubnet string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GcpPrivateServiceConnect) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ServiceAttachmentSubnet returns the value of the 'service_attachment_subnet' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the subnet where the PSC service attachment is created +func (o *GcpPrivateServiceConnect) ServiceAttachmentSubnet() string { + if o != nil && o.bitmap_&1 != 0 { + return o.serviceAttachmentSubnet + } + return "" +} + +// GetServiceAttachmentSubnet returns the value of the 'service_attachment_subnet' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the subnet where the PSC service attachment is created +func (o *GcpPrivateServiceConnect) GetServiceAttachmentSubnet() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.serviceAttachmentSubnet + } + return +} + +// GcpPrivateServiceConnectListKind is the name of the type used to represent list of objects of +// type 'gcp_private_service_connect'. +const GcpPrivateServiceConnectListKind = "GcpPrivateServiceConnectList" + +// GcpPrivateServiceConnectListLinkKind is the name of the type used to represent links to list +// of objects of type 'gcp_private_service_connect'. +const GcpPrivateServiceConnectListLinkKind = "GcpPrivateServiceConnectListLink" + +// GcpPrivateServiceConnectNilKind is the name of the type used to nil lists of objects of +// type 'gcp_private_service_connect'. +const GcpPrivateServiceConnectListNilKind = "GcpPrivateServiceConnectListNil" + +// GcpPrivateServiceConnectList is a list of values of the 'gcp_private_service_connect' type. +type GcpPrivateServiceConnectList struct { + href string + link bool + items []*GcpPrivateServiceConnect +} + +// Len returns the length of the list. +func (l *GcpPrivateServiceConnectList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GcpPrivateServiceConnectList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GcpPrivateServiceConnectList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GcpPrivateServiceConnectList) SetItems(items []*GcpPrivateServiceConnect) { + l.items = items +} + +// Items returns the items of the list. +func (l *GcpPrivateServiceConnectList) Items() []*GcpPrivateServiceConnect { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GcpPrivateServiceConnectList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GcpPrivateServiceConnectList) Get(i int) *GcpPrivateServiceConnect { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GcpPrivateServiceConnectList) Slice() []*GcpPrivateServiceConnect { + var slice []*GcpPrivateServiceConnect + if l == nil { + slice = make([]*GcpPrivateServiceConnect, 0) + } else { + slice = make([]*GcpPrivateServiceConnect, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GcpPrivateServiceConnectList) Each(f func(item *GcpPrivateServiceConnect) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GcpPrivateServiceConnectList) Range(f func(index int, item *GcpPrivateServiceConnect) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/gcp_private_service_connect_type_json.go b/clientapi/arohcp/v1alpha1/gcp_private_service_connect_type_json.go new file mode 100644 index 00000000..9e083791 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_private_service_connect_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalGcpPrivateServiceConnect writes a value of the 'gcp_private_service_connect' type to the given writer. +func MarshalGcpPrivateServiceConnect(object *GcpPrivateServiceConnect, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGcpPrivateServiceConnect(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGcpPrivateServiceConnect writes a value of the 'gcp_private_service_connect' type to the given stream. +func WriteGcpPrivateServiceConnect(object *GcpPrivateServiceConnect, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_attachment_subnet") + stream.WriteString(object.serviceAttachmentSubnet) + } + stream.WriteObjectEnd() +} + +// UnmarshalGcpPrivateServiceConnect reads a value of the 'gcp_private_service_connect' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGcpPrivateServiceConnect(source interface{}) (object *GcpPrivateServiceConnect, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGcpPrivateServiceConnect(iterator) + err = iterator.Error + return +} + +// ReadGcpPrivateServiceConnect reads a value of the 'gcp_private_service_connect' type from the given iterator. +func ReadGcpPrivateServiceConnect(iterator *jsoniter.Iterator) *GcpPrivateServiceConnect { + object := &GcpPrivateServiceConnect{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "service_attachment_subnet": + value := iterator.ReadString() + object.serviceAttachmentSubnet = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/gcp_security_builder.go b/clientapi/arohcp/v1alpha1/gcp_security_builder.go new file mode 100644 index 00000000..9f6df20c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_security_builder.go @@ -0,0 +1,63 @@ +/* +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 + +// GcpSecurityBuilder contains the data and logic needed to build 'gcp_security' objects. +// +// Google cloud platform security settings of a cluster. +type GcpSecurityBuilder struct { + bitmap_ uint32 + secureBoot bool +} + +// NewGcpSecurity creates a new builder of 'gcp_security' objects. +func NewGcpSecurity() *GcpSecurityBuilder { + return &GcpSecurityBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GcpSecurityBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// SecureBoot sets the value of the 'secure_boot' attribute to the given value. +func (b *GcpSecurityBuilder) SecureBoot(value bool) *GcpSecurityBuilder { + b.secureBoot = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GcpSecurityBuilder) Copy(object *GcpSecurity) *GcpSecurityBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.secureBoot = object.secureBoot + return b +} + +// Build creates a 'gcp_security' object using the configuration stored in the builder. +func (b *GcpSecurityBuilder) Build() (object *GcpSecurity, err error) { + object = new(GcpSecurity) + object.bitmap_ = b.bitmap_ + object.secureBoot = b.secureBoot + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_security_list_builder.go b/clientapi/arohcp/v1alpha1/gcp_security_list_builder.go new file mode 100644 index 00000000..8ffdc8f1 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_security_list_builder.go @@ -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 + +// GcpSecurityListBuilder contains the data and logic needed to build +// 'gcp_security' objects. +type GcpSecurityListBuilder struct { + items []*GcpSecurityBuilder +} + +// NewGcpSecurityList creates a new builder of 'gcp_security' objects. +func NewGcpSecurityList() *GcpSecurityListBuilder { + return new(GcpSecurityListBuilder) +} + +// Items sets the items of the list. +func (b *GcpSecurityListBuilder) Items(values ...*GcpSecurityBuilder) *GcpSecurityListBuilder { + b.items = make([]*GcpSecurityBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GcpSecurityListBuilder) 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 *GcpSecurityListBuilder) Copy(list *GcpSecurityList) *GcpSecurityListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GcpSecurityBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGcpSecurity().Copy(v) + } + } + return b +} + +// Build creates a list of 'gcp_security' objects using the +// configuration stored in the builder. +func (b *GcpSecurityListBuilder) Build() (list *GcpSecurityList, err error) { + items := make([]*GcpSecurity, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GcpSecurityList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_security_list_type_json.go b/clientapi/arohcp/v1alpha1/gcp_security_list_type_json.go new file mode 100644 index 00000000..b5fb6725 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_security_list_type_json.go @@ -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" +) + +// MarshalGcpSecurityList writes a list of values of the 'gcp_security' type to +// the given writer. +func MarshalGcpSecurityList(list []*GcpSecurity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGcpSecurityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGcpSecurityList writes a list of value of the 'gcp_security' type to +// the given stream. +func WriteGcpSecurityList(list []*GcpSecurity, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGcpSecurity(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGcpSecurityList reads a list of values of the 'gcp_security' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGcpSecurityList(source interface{}) (items []*GcpSecurity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGcpSecurityList(iterator) + err = iterator.Error + return +} + +// ReadGcpSecurityList reads list of values of the ”gcp_security' type from +// the given iterator. +func ReadGcpSecurityList(iterator *jsoniter.Iterator) []*GcpSecurity { + list := []*GcpSecurity{} + for iterator.ReadArray() { + item := ReadGcpSecurity(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/gcp_security_type.go b/clientapi/arohcp/v1alpha1/gcp_security_type.go new file mode 100644 index 00000000..52d68e7c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_security_type.go @@ -0,0 +1,165 @@ +/* +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 + +// GcpSecurity represents the values of the 'gcp_security' type. +// +// Google cloud platform security settings of a cluster. +type GcpSecurity struct { + bitmap_ uint32 + secureBoot bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GcpSecurity) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// SecureBoot returns the value of the 'secure_boot' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Determines if Shielded VM feature "Secure Boot" should be set for the nodes of the cluster. +func (o *GcpSecurity) SecureBoot() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.secureBoot + } + return false +} + +// GetSecureBoot returns the value of the 'secure_boot' attribute and +// a flag indicating if the attribute has a value. +// +// Determines if Shielded VM feature "Secure Boot" should be set for the nodes of the cluster. +func (o *GcpSecurity) GetSecureBoot() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.secureBoot + } + return +} + +// GcpSecurityListKind is the name of the type used to represent list of objects of +// type 'gcp_security'. +const GcpSecurityListKind = "GcpSecurityList" + +// GcpSecurityListLinkKind is the name of the type used to represent links to list +// of objects of type 'gcp_security'. +const GcpSecurityListLinkKind = "GcpSecurityListLink" + +// GcpSecurityNilKind is the name of the type used to nil lists of objects of +// type 'gcp_security'. +const GcpSecurityListNilKind = "GcpSecurityListNil" + +// GcpSecurityList is a list of values of the 'gcp_security' type. +type GcpSecurityList struct { + href string + link bool + items []*GcpSecurity +} + +// Len returns the length of the list. +func (l *GcpSecurityList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GcpSecurityList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GcpSecurityList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GcpSecurityList) SetItems(items []*GcpSecurity) { + l.items = items +} + +// Items returns the items of the list. +func (l *GcpSecurityList) Items() []*GcpSecurity { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GcpSecurityList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GcpSecurityList) Get(i int) *GcpSecurity { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GcpSecurityList) Slice() []*GcpSecurity { + var slice []*GcpSecurity + if l == nil { + slice = make([]*GcpSecurity, 0) + } else { + slice = make([]*GcpSecurity, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GcpSecurityList) Each(f func(item *GcpSecurity) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GcpSecurityList) Range(f func(index int, item *GcpSecurity) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/gcp_security_type_json.go b/clientapi/arohcp/v1alpha1/gcp_security_type_json.go new file mode 100644 index 00000000..f6f84e21 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_security_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalGcpSecurity writes a value of the 'gcp_security' type to the given writer. +func MarshalGcpSecurity(object *GcpSecurity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGcpSecurity(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGcpSecurity writes a value of the 'gcp_security' type to the given stream. +func WriteGcpSecurity(object *GcpSecurity, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("secure_boot") + stream.WriteBool(object.secureBoot) + } + stream.WriteObjectEnd() +} + +// UnmarshalGcpSecurity reads a value of the 'gcp_security' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGcpSecurity(source interface{}) (object *GcpSecurity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGcpSecurity(iterator) + err = iterator.Error + return +} + +// ReadGcpSecurity reads a value of the 'gcp_security' type from the given iterator. +func ReadGcpSecurity(iterator *jsoniter.Iterator) *GcpSecurity { + object := &GcpSecurity{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "secure_boot": + value := iterator.ReadBool() + object.secureBoot = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/gcp_type.go b/clientapi/arohcp/v1alpha1/gcp_type.go new file mode 100644 index 00000000..e72e8c0f --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_type.go @@ -0,0 +1,453 @@ +/* +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 + +// GCP represents the values of the 'GCP' type. +// +// Google cloud platform settings of a cluster. +type GCP struct { + bitmap_ uint32 + authURI string + authProviderX509CertURL string + authentication *GcpAuthentication + clientID string + clientX509CertURL string + clientEmail string + privateKey string + privateKeyID string + privateServiceConnect *GcpPrivateServiceConnect + projectID string + security *GcpSecurity + tokenURI string + type_ string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GCP) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AuthURI returns the value of the 'auth_URI' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP authentication uri +func (o *GCP) AuthURI() string { + if o != nil && o.bitmap_&1 != 0 { + return o.authURI + } + return "" +} + +// GetAuthURI returns the value of the 'auth_URI' attribute and +// a flag indicating if the attribute has a value. +// +// GCP authentication uri +func (o *GCP) GetAuthURI() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.authURI + } + return +} + +// AuthProviderX509CertURL returns the value of the 'auth_provider_X509_cert_URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP Authentication provider x509 certificate url +func (o *GCP) AuthProviderX509CertURL() string { + if o != nil && o.bitmap_&2 != 0 { + return o.authProviderX509CertURL + } + return "" +} + +// GetAuthProviderX509CertURL returns the value of the 'auth_provider_X509_cert_URL' attribute and +// a flag indicating if the attribute has a value. +// +// GCP Authentication provider x509 certificate url +func (o *GCP) GetAuthProviderX509CertURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.authProviderX509CertURL + } + return +} + +// Authentication returns the value of the 'authentication' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP Authentication Method +func (o *GCP) Authentication() *GcpAuthentication { + if o != nil && o.bitmap_&4 != 0 { + return o.authentication + } + return nil +} + +// GetAuthentication returns the value of the 'authentication' attribute and +// a flag indicating if the attribute has a value. +// +// GCP Authentication Method +func (o *GCP) GetAuthentication() (value *GcpAuthentication, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.authentication + } + return +} + +// ClientID returns the value of the 'client_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP client identifier +func (o *GCP) ClientID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clientID + } + return "" +} + +// GetClientID returns the value of the 'client_ID' attribute and +// a flag indicating if the attribute has a value. +// +// GCP client identifier +func (o *GCP) GetClientID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clientID + } + return +} + +// ClientX509CertURL returns the value of the 'client_X509_cert_URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP client x509 certificate url +func (o *GCP) ClientX509CertURL() string { + if o != nil && o.bitmap_&16 != 0 { + return o.clientX509CertURL + } + return "" +} + +// GetClientX509CertURL returns the value of the 'client_X509_cert_URL' attribute and +// a flag indicating if the attribute has a value. +// +// GCP client x509 certificate url +func (o *GCP) GetClientX509CertURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.clientX509CertURL + } + return +} + +// ClientEmail returns the value of the 'client_email' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP client email +func (o *GCP) ClientEmail() string { + if o != nil && o.bitmap_&32 != 0 { + return o.clientEmail + } + return "" +} + +// GetClientEmail returns the value of the 'client_email' attribute and +// a flag indicating if the attribute has a value. +// +// GCP client email +func (o *GCP) GetClientEmail() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.clientEmail + } + return +} + +// PrivateKey returns the value of the 'private_key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP private key +func (o *GCP) PrivateKey() string { + if o != nil && o.bitmap_&64 != 0 { + return o.privateKey + } + return "" +} + +// GetPrivateKey returns the value of the 'private_key' attribute and +// a flag indicating if the attribute has a value. +// +// GCP private key +func (o *GCP) GetPrivateKey() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.privateKey + } + return +} + +// PrivateKeyID returns the value of the 'private_key_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP private key identifier +func (o *GCP) PrivateKeyID() string { + if o != nil && o.bitmap_&128 != 0 { + return o.privateKeyID + } + return "" +} + +// GetPrivateKeyID returns the value of the 'private_key_ID' attribute and +// a flag indicating if the attribute has a value. +// +// GCP private key identifier +func (o *GCP) GetPrivateKeyID() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.privateKeyID + } + return +} + +// PrivateServiceConnect returns the value of the 'private_service_connect' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP PrivateServiceConnect configuration +func (o *GCP) PrivateServiceConnect() *GcpPrivateServiceConnect { + if o != nil && o.bitmap_&256 != 0 { + return o.privateServiceConnect + } + return nil +} + +// GetPrivateServiceConnect returns the value of the 'private_service_connect' attribute and +// a flag indicating if the attribute has a value. +// +// GCP PrivateServiceConnect configuration +func (o *GCP) GetPrivateServiceConnect() (value *GcpPrivateServiceConnect, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.privateServiceConnect + } + return +} + +// ProjectID returns the value of the 'project_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP project identifier. +func (o *GCP) ProjectID() string { + if o != nil && o.bitmap_&512 != 0 { + return o.projectID + } + return "" +} + +// GetProjectID returns the value of the 'project_ID' attribute and +// a flag indicating if the attribute has a value. +// +// GCP project identifier. +func (o *GCP) GetProjectID() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.projectID + } + return +} + +// Security returns the value of the 'security' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP Security Settings +func (o *GCP) Security() *GcpSecurity { + if o != nil && o.bitmap_&1024 != 0 { + return o.security + } + return nil +} + +// GetSecurity returns the value of the 'security' attribute and +// a flag indicating if the attribute has a value. +// +// GCP Security Settings +func (o *GCP) GetSecurity() (value *GcpSecurity, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.security + } + return +} + +// TokenURI returns the value of the 'token_URI' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP token uri +func (o *GCP) TokenURI() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.tokenURI + } + return "" +} + +// GetTokenURI returns the value of the 'token_URI' attribute and +// a flag indicating if the attribute has a value. +// +// GCP token uri +func (o *GCP) GetTokenURI() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.tokenURI + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP the type of the service the key belongs to +func (o *GCP) Type() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// GCP the type of the service the key belongs to +func (o *GCP) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.type_ + } + return +} + +// GCPListKind is the name of the type used to represent list of objects of +// type 'GCP'. +const GCPListKind = "GCPList" + +// GCPListLinkKind is the name of the type used to represent links to list +// of objects of type 'GCP'. +const GCPListLinkKind = "GCPListLink" + +// GCPNilKind is the name of the type used to nil lists of objects of +// type 'GCP'. +const GCPListNilKind = "GCPListNil" + +// GCPList is a list of values of the 'GCP' type. +type GCPList struct { + href string + link bool + items []*GCP +} + +// Len returns the length of the list. +func (l *GCPList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GCPList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GCPList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GCPList) SetItems(items []*GCP) { + l.items = items +} + +// Items returns the items of the list. +func (l *GCPList) Items() []*GCP { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GCPList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GCPList) Get(i int) *GCP { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GCPList) Slice() []*GCP { + var slice []*GCP + if l == nil { + slice = make([]*GCP, 0) + } else { + slice = make([]*GCP, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GCPList) Each(f func(item *GCP) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GCPList) Range(f func(index int, item *GCP) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/gcp_type_json.go b/clientapi/arohcp/v1alpha1/gcp_type_json.go new file mode 100644 index 00000000..c0e609b1 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_type_json.go @@ -0,0 +1,242 @@ +/* +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" +) + +// MarshalGCP writes a value of the 'GCP' type to the given writer. +func MarshalGCP(object *GCP, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCP(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCP writes a value of the 'GCP' type to the given stream. +func WriteGCP(object *GCP, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("auth_uri") + stream.WriteString(object.authURI) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("auth_provider_x509_cert_url") + stream.WriteString(object.authProviderX509CertURL) + count++ + } + present_ = object.bitmap_&4 != 0 && object.authentication != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("authentication") + WriteGcpAuthentication(object.authentication, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_id") + stream.WriteString(object.clientID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_x509_cert_url") + stream.WriteString(object.clientX509CertURL) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_email") + stream.WriteString(object.clientEmail) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_key") + stream.WriteString(object.privateKey) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_key_id") + stream.WriteString(object.privateKeyID) + count++ + } + present_ = object.bitmap_&256 != 0 && object.privateServiceConnect != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_service_connect") + WriteGcpPrivateServiceConnect(object.privateServiceConnect, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("project_id") + stream.WriteString(object.projectID) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.security != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("security") + WriteGcpSecurity(object.security, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("token_uri") + stream.WriteString(object.tokenURI) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalGCP reads a value of the 'GCP' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGCP(source interface{}) (object *GCP, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGCP(iterator) + err = iterator.Error + return +} + +// ReadGCP reads a value of the 'GCP' type from the given iterator. +func ReadGCP(iterator *jsoniter.Iterator) *GCP { + object := &GCP{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "auth_uri": + value := iterator.ReadString() + object.authURI = value + object.bitmap_ |= 1 + case "auth_provider_x509_cert_url": + value := iterator.ReadString() + object.authProviderX509CertURL = value + object.bitmap_ |= 2 + case "authentication": + value := ReadGcpAuthentication(iterator) + object.authentication = value + object.bitmap_ |= 4 + case "client_id": + value := iterator.ReadString() + object.clientID = value + object.bitmap_ |= 8 + case "client_x509_cert_url": + value := iterator.ReadString() + object.clientX509CertURL = value + object.bitmap_ |= 16 + case "client_email": + value := iterator.ReadString() + object.clientEmail = value + object.bitmap_ |= 32 + case "private_key": + value := iterator.ReadString() + object.privateKey = value + object.bitmap_ |= 64 + case "private_key_id": + value := iterator.ReadString() + object.privateKeyID = value + object.bitmap_ |= 128 + case "private_service_connect": + value := ReadGcpPrivateServiceConnect(iterator) + object.privateServiceConnect = value + object.bitmap_ |= 256 + case "project_id": + value := iterator.ReadString() + object.projectID = value + object.bitmap_ |= 512 + case "security": + value := ReadGcpSecurity(iterator) + object.security = value + object.bitmap_ |= 1024 + case "token_uri": + value := iterator.ReadString() + object.tokenURI = value + object.bitmap_ |= 2048 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 4096 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/gcp_volume_builder.go b/clientapi/arohcp/v1alpha1/gcp_volume_builder.go new file mode 100644 index 00000000..26020e87 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_volume_builder.go @@ -0,0 +1,63 @@ +/* +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 + +// GCPVolumeBuilder contains the data and logic needed to build 'GCP_volume' objects. +// +// Holds settings for an GCP storage volume. +type GCPVolumeBuilder struct { + bitmap_ uint32 + size int +} + +// NewGCPVolume creates a new builder of 'GCP_volume' objects. +func NewGCPVolume() *GCPVolumeBuilder { + return &GCPVolumeBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GCPVolumeBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Size sets the value of the 'size' attribute to the given value. +func (b *GCPVolumeBuilder) Size(value int) *GCPVolumeBuilder { + b.size = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GCPVolumeBuilder) Copy(object *GCPVolume) *GCPVolumeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.size = object.size + return b +} + +// Build creates a 'GCP_volume' object using the configuration stored in the builder. +func (b *GCPVolumeBuilder) Build() (object *GCPVolume, err error) { + object = new(GCPVolume) + object.bitmap_ = b.bitmap_ + object.size = b.size + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_volume_list_builder.go b/clientapi/arohcp/v1alpha1/gcp_volume_list_builder.go new file mode 100644 index 00000000..5f0623c4 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_volume_list_builder.go @@ -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 + +// GCPVolumeListBuilder contains the data and logic needed to build +// 'GCP_volume' objects. +type GCPVolumeListBuilder struct { + items []*GCPVolumeBuilder +} + +// NewGCPVolumeList creates a new builder of 'GCP_volume' objects. +func NewGCPVolumeList() *GCPVolumeListBuilder { + return new(GCPVolumeListBuilder) +} + +// Items sets the items of the list. +func (b *GCPVolumeListBuilder) Items(values ...*GCPVolumeBuilder) *GCPVolumeListBuilder { + b.items = make([]*GCPVolumeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GCPVolumeListBuilder) 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 *GCPVolumeListBuilder) Copy(list *GCPVolumeList) *GCPVolumeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GCPVolumeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGCPVolume().Copy(v) + } + } + return b +} + +// Build creates a list of 'GCP_volume' objects using the +// configuration stored in the builder. +func (b *GCPVolumeListBuilder) Build() (list *GCPVolumeList, err error) { + items := make([]*GCPVolume, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GCPVolumeList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/gcp_volume_list_type_json.go b/clientapi/arohcp/v1alpha1/gcp_volume_list_type_json.go new file mode 100644 index 00000000..01801149 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_volume_list_type_json.go @@ -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" +) + +// MarshalGCPVolumeList writes a list of values of the 'GCP_volume' type to +// the given writer. +func MarshalGCPVolumeList(list []*GCPVolume, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPVolumeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPVolumeList writes a list of value of the 'GCP_volume' type to +// the given stream. +func WriteGCPVolumeList(list []*GCPVolume, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGCPVolume(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGCPVolumeList reads a list of values of the 'GCP_volume' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGCPVolumeList(source interface{}) (items []*GCPVolume, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGCPVolumeList(iterator) + err = iterator.Error + return +} + +// ReadGCPVolumeList reads list of values of the ”GCP_volume' type from +// the given iterator. +func ReadGCPVolumeList(iterator *jsoniter.Iterator) []*GCPVolume { + list := []*GCPVolume{} + for iterator.ReadArray() { + item := ReadGCPVolume(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/gcp_volume_type.go b/clientapi/arohcp/v1alpha1/gcp_volume_type.go new file mode 100644 index 00000000..86b91911 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_volume_type.go @@ -0,0 +1,165 @@ +/* +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 + +// GCPVolume represents the values of the 'GCP_volume' type. +// +// Holds settings for an GCP storage volume. +type GCPVolume struct { + bitmap_ uint32 + size int +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GCPVolume) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Size returns the value of the 'size' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Volume size in Gib. +func (o *GCPVolume) Size() int { + if o != nil && o.bitmap_&1 != 0 { + return o.size + } + return 0 +} + +// GetSize returns the value of the 'size' attribute and +// a flag indicating if the attribute has a value. +// +// Volume size in Gib. +func (o *GCPVolume) GetSize() (value int, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.size + } + return +} + +// GCPVolumeListKind is the name of the type used to represent list of objects of +// type 'GCP_volume'. +const GCPVolumeListKind = "GCPVolumeList" + +// GCPVolumeListLinkKind is the name of the type used to represent links to list +// of objects of type 'GCP_volume'. +const GCPVolumeListLinkKind = "GCPVolumeListLink" + +// GCPVolumeNilKind is the name of the type used to nil lists of objects of +// type 'GCP_volume'. +const GCPVolumeListNilKind = "GCPVolumeListNil" + +// GCPVolumeList is a list of values of the 'GCP_volume' type. +type GCPVolumeList struct { + href string + link bool + items []*GCPVolume +} + +// Len returns the length of the list. +func (l *GCPVolumeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GCPVolumeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GCPVolumeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GCPVolumeList) SetItems(items []*GCPVolume) { + l.items = items +} + +// Items returns the items of the list. +func (l *GCPVolumeList) Items() []*GCPVolume { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GCPVolumeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GCPVolumeList) Get(i int) *GCPVolume { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GCPVolumeList) Slice() []*GCPVolume { + var slice []*GCPVolume + if l == nil { + slice = make([]*GCPVolume, 0) + } else { + slice = make([]*GCPVolume, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GCPVolumeList) Each(f func(item *GCPVolume) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GCPVolumeList) Range(f func(index int, item *GCPVolume) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/gcp_volume_type_json.go b/clientapi/arohcp/v1alpha1/gcp_volume_type_json.go new file mode 100644 index 00000000..8b5342f3 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/gcp_volume_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalGCPVolume writes a value of the 'GCP_volume' type to the given writer. +func MarshalGCPVolume(object *GCPVolume, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPVolume(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPVolume writes a value of the 'GCP_volume' type to the given stream. +func WriteGCPVolume(object *GCPVolume, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("size") + stream.WriteInt(object.size) + } + stream.WriteObjectEnd() +} + +// UnmarshalGCPVolume reads a value of the 'GCP_volume' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGCPVolume(source interface{}) (object *GCPVolume, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGCPVolume(iterator) + err = iterator.Error + return +} + +// ReadGCPVolume reads a value of the 'GCP_volume' type from the given iterator. +func ReadGCPVolume(iterator *jsoniter.Iterator) *GCPVolume { + object := &GCPVolume{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "size": + value := iterator.ReadInt() + object.size = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_builder.go b/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_builder.go new file mode 100644 index 00000000..473b6bf8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_builder.go @@ -0,0 +1,96 @@ +/* +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 ( + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// HTPasswdIdentityProviderBuilder contains the data and logic needed to build 'HT_passwd_identity_provider' objects. +// +// Details for `htpasswd` identity providers. +type HTPasswdIdentityProviderBuilder struct { + bitmap_ uint32 + password string + username string + users *v1.HTPasswdUserListBuilder +} + +// NewHTPasswdIdentityProvider creates a new builder of 'HT_passwd_identity_provider' objects. +func NewHTPasswdIdentityProvider() *HTPasswdIdentityProviderBuilder { + return &HTPasswdIdentityProviderBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *HTPasswdIdentityProviderBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Password sets the value of the 'password' attribute to the given value. +func (b *HTPasswdIdentityProviderBuilder) Password(value string) *HTPasswdIdentityProviderBuilder { + b.password = value + b.bitmap_ |= 1 + return b +} + +// Username sets the value of the 'username' attribute to the given value. +func (b *HTPasswdIdentityProviderBuilder) Username(value string) *HTPasswdIdentityProviderBuilder { + b.username = value + b.bitmap_ |= 2 + return b +} + +// Users sets the value of the 'users' attribute to the given values. +func (b *HTPasswdIdentityProviderBuilder) Users(value *v1.HTPasswdUserListBuilder) *HTPasswdIdentityProviderBuilder { + b.users = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *HTPasswdIdentityProviderBuilder) Copy(object *HTPasswdIdentityProvider) *HTPasswdIdentityProviderBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.password = object.password + b.username = object.username + if object.users != nil { + b.users = v1.NewHTPasswdUserList().Copy(object.users) + } else { + b.users = nil + } + return b +} + +// Build creates a 'HT_passwd_identity_provider' object using the configuration stored in the builder. +func (b *HTPasswdIdentityProviderBuilder) Build() (object *HTPasswdIdentityProvider, err error) { + object = new(HTPasswdIdentityProvider) + object.bitmap_ = b.bitmap_ + object.password = b.password + object.username = b.username + if b.users != nil { + object.users, err = b.users.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_list_builder.go b/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_list_builder.go new file mode 100644 index 00000000..fba22da2 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_list_builder.go @@ -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 + +// HTPasswdIdentityProviderListBuilder contains the data and logic needed to build +// 'HT_passwd_identity_provider' objects. +type HTPasswdIdentityProviderListBuilder struct { + items []*HTPasswdIdentityProviderBuilder +} + +// NewHTPasswdIdentityProviderList creates a new builder of 'HT_passwd_identity_provider' objects. +func NewHTPasswdIdentityProviderList() *HTPasswdIdentityProviderListBuilder { + return new(HTPasswdIdentityProviderListBuilder) +} + +// Items sets the items of the list. +func (b *HTPasswdIdentityProviderListBuilder) Items(values ...*HTPasswdIdentityProviderBuilder) *HTPasswdIdentityProviderListBuilder { + b.items = make([]*HTPasswdIdentityProviderBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *HTPasswdIdentityProviderListBuilder) 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 *HTPasswdIdentityProviderListBuilder) Copy(list *HTPasswdIdentityProviderList) *HTPasswdIdentityProviderListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*HTPasswdIdentityProviderBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewHTPasswdIdentityProvider().Copy(v) + } + } + return b +} + +// Build creates a list of 'HT_passwd_identity_provider' objects using the +// configuration stored in the builder. +func (b *HTPasswdIdentityProviderListBuilder) Build() (list *HTPasswdIdentityProviderList, err error) { + items := make([]*HTPasswdIdentityProvider, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(HTPasswdIdentityProviderList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_list_type_json.go b/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_list_type_json.go new file mode 100644 index 00000000..75e96d2f --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_list_type_json.go @@ -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" +) + +// MarshalHTPasswdIdentityProviderList writes a list of values of the 'HT_passwd_identity_provider' type to +// the given writer. +func MarshalHTPasswdIdentityProviderList(list []*HTPasswdIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHTPasswdIdentityProviderList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHTPasswdIdentityProviderList writes a list of value of the 'HT_passwd_identity_provider' type to +// the given stream. +func WriteHTPasswdIdentityProviderList(list []*HTPasswdIdentityProvider, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteHTPasswdIdentityProvider(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalHTPasswdIdentityProviderList reads a list of values of the 'HT_passwd_identity_provider' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalHTPasswdIdentityProviderList(source interface{}) (items []*HTPasswdIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadHTPasswdIdentityProviderList(iterator) + err = iterator.Error + return +} + +// ReadHTPasswdIdentityProviderList reads list of values of the ”HT_passwd_identity_provider' type from +// the given iterator. +func ReadHTPasswdIdentityProviderList(iterator *jsoniter.Iterator) []*HTPasswdIdentityProvider { + list := []*HTPasswdIdentityProvider{} + for iterator.ReadArray() { + item := ReadHTPasswdIdentityProvider(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_type.go b/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_type.go new file mode 100644 index 00000000..7dbec45e --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_type.go @@ -0,0 +1,217 @@ +/* +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 ( + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// HTPasswdIdentityProvider represents the values of the 'HT_passwd_identity_provider' type. +// +// Details for `htpasswd` identity providers. +type HTPasswdIdentityProvider struct { + bitmap_ uint32 + password string + username string + users *v1.HTPasswdUserList +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *HTPasswdIdentityProvider) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Password returns the value of the 'password' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Password to be used in the _HTPasswd_ data file. +func (o *HTPasswdIdentityProvider) Password() string { + if o != nil && o.bitmap_&1 != 0 { + return o.password + } + return "" +} + +// GetPassword returns the value of the 'password' attribute and +// a flag indicating if the attribute has a value. +// +// Password to be used in the _HTPasswd_ data file. +func (o *HTPasswdIdentityProvider) GetPassword() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.password + } + return +} + +// Username returns the value of the 'username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Username to be used in the _HTPasswd_ data file. +func (o *HTPasswdIdentityProvider) Username() string { + if o != nil && o.bitmap_&2 != 0 { + return o.username + } + return "" +} + +// GetUsername returns the value of the 'username' attribute and +// a flag indicating if the attribute has a value. +// +// Username to be used in the _HTPasswd_ data file. +func (o *HTPasswdIdentityProvider) GetUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.username + } + return +} + +// Users returns the value of the 'users' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the collection of _HTPasswd_ users. +func (o *HTPasswdIdentityProvider) Users() *v1.HTPasswdUserList { + if o != nil && o.bitmap_&4 != 0 { + return o.users + } + return nil +} + +// GetUsers returns the value of the 'users' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the collection of _HTPasswd_ users. +func (o *HTPasswdIdentityProvider) GetUsers() (value *v1.HTPasswdUserList, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.users + } + return +} + +// HTPasswdIdentityProviderListKind is the name of the type used to represent list of objects of +// type 'HT_passwd_identity_provider'. +const HTPasswdIdentityProviderListKind = "HTPasswdIdentityProviderList" + +// HTPasswdIdentityProviderListLinkKind is the name of the type used to represent links to list +// of objects of type 'HT_passwd_identity_provider'. +const HTPasswdIdentityProviderListLinkKind = "HTPasswdIdentityProviderListLink" + +// HTPasswdIdentityProviderNilKind is the name of the type used to nil lists of objects of +// type 'HT_passwd_identity_provider'. +const HTPasswdIdentityProviderListNilKind = "HTPasswdIdentityProviderListNil" + +// HTPasswdIdentityProviderList is a list of values of the 'HT_passwd_identity_provider' type. +type HTPasswdIdentityProviderList struct { + href string + link bool + items []*HTPasswdIdentityProvider +} + +// Len returns the length of the list. +func (l *HTPasswdIdentityProviderList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *HTPasswdIdentityProviderList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *HTPasswdIdentityProviderList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *HTPasswdIdentityProviderList) SetItems(items []*HTPasswdIdentityProvider) { + l.items = items +} + +// Items returns the items of the list. +func (l *HTPasswdIdentityProviderList) Items() []*HTPasswdIdentityProvider { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *HTPasswdIdentityProviderList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *HTPasswdIdentityProviderList) Get(i int) *HTPasswdIdentityProvider { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *HTPasswdIdentityProviderList) Slice() []*HTPasswdIdentityProvider { + var slice []*HTPasswdIdentityProvider + if l == nil { + slice = make([]*HTPasswdIdentityProvider, 0) + } else { + slice = make([]*HTPasswdIdentityProvider, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *HTPasswdIdentityProviderList) Each(f func(item *HTPasswdIdentityProvider) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *HTPasswdIdentityProviderList) Range(f func(index int, item *HTPasswdIdentityProvider) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_type_json.go b/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_type_json.go new file mode 100644 index 00000000..34f0632d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/ht_passwd_identity_provider_type_json.go @@ -0,0 +1,133 @@ +/* +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" + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalHTPasswdIdentityProvider writes a value of the 'HT_passwd_identity_provider' type to the given writer. +func MarshalHTPasswdIdentityProvider(object *HTPasswdIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHTPasswdIdentityProvider(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHTPasswdIdentityProvider writes a value of the 'HT_passwd_identity_provider' type to the given stream. +func WriteHTPasswdIdentityProvider(object *HTPasswdIdentityProvider, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("password") + stream.WriteString(object.password) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("username") + stream.WriteString(object.username) + count++ + } + present_ = object.bitmap_&4 != 0 && object.users != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("users") + stream.WriteObjectStart() + stream.WriteObjectField("items") + v1.WriteHTPasswdUserList(object.users.Items(), stream) + stream.WriteObjectEnd() + } + stream.WriteObjectEnd() +} + +// UnmarshalHTPasswdIdentityProvider reads a value of the 'HT_passwd_identity_provider' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalHTPasswdIdentityProvider(source interface{}) (object *HTPasswdIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadHTPasswdIdentityProvider(iterator) + err = iterator.Error + return +} + +// ReadHTPasswdIdentityProvider reads a value of the 'HT_passwd_identity_provider' type from the given iterator. +func ReadHTPasswdIdentityProvider(iterator *jsoniter.Iterator) *HTPasswdIdentityProvider { + object := &HTPasswdIdentityProvider{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "password": + value := iterator.ReadString() + object.password = value + object.bitmap_ |= 1 + case "username": + value := iterator.ReadString() + object.username = value + object.bitmap_ |= 2 + case "users": + value := &v1.HTPasswdUserList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == v1.HTPasswdUserListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(v1.ReadHTPasswdUserList(iterator)) + default: + iterator.ReadAny() + } + } + object.users = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/hypershift_builder.go b/clientapi/arohcp/v1alpha1/hypershift_builder.go new file mode 100644 index 00000000..f2ed6cd6 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/hypershift_builder.go @@ -0,0 +1,63 @@ +/* +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 + +// HypershiftBuilder contains the data and logic needed to build 'hypershift' objects. +// +// Hypershift configuration. +type HypershiftBuilder struct { + bitmap_ uint32 + enabled bool +} + +// NewHypershift creates a new builder of 'hypershift' objects. +func NewHypershift() *HypershiftBuilder { + return &HypershiftBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *HypershiftBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *HypershiftBuilder) Enabled(value bool) *HypershiftBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *HypershiftBuilder) Copy(object *Hypershift) *HypershiftBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + return b +} + +// Build creates a 'hypershift' object using the configuration stored in the builder. +func (b *HypershiftBuilder) Build() (object *Hypershift, err error) { + object = new(Hypershift) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + return +} diff --git a/clientapi/arohcp/v1alpha1/hypershift_list_builder.go b/clientapi/arohcp/v1alpha1/hypershift_list_builder.go new file mode 100644 index 00000000..d8a1b0eb --- /dev/null +++ b/clientapi/arohcp/v1alpha1/hypershift_list_builder.go @@ -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 + +// HypershiftListBuilder contains the data and logic needed to build +// 'hypershift' objects. +type HypershiftListBuilder struct { + items []*HypershiftBuilder +} + +// NewHypershiftList creates a new builder of 'hypershift' objects. +func NewHypershiftList() *HypershiftListBuilder { + return new(HypershiftListBuilder) +} + +// Items sets the items of the list. +func (b *HypershiftListBuilder) Items(values ...*HypershiftBuilder) *HypershiftListBuilder { + b.items = make([]*HypershiftBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *HypershiftListBuilder) 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 *HypershiftListBuilder) Copy(list *HypershiftList) *HypershiftListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*HypershiftBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewHypershift().Copy(v) + } + } + return b +} + +// Build creates a list of 'hypershift' objects using the +// configuration stored in the builder. +func (b *HypershiftListBuilder) Build() (list *HypershiftList, err error) { + items := make([]*Hypershift, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(HypershiftList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/hypershift_list_type_json.go b/clientapi/arohcp/v1alpha1/hypershift_list_type_json.go new file mode 100644 index 00000000..ab181dcd --- /dev/null +++ b/clientapi/arohcp/v1alpha1/hypershift_list_type_json.go @@ -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" +) + +// MarshalHypershiftList writes a list of values of the 'hypershift' type to +// the given writer. +func MarshalHypershiftList(list []*Hypershift, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHypershiftList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHypershiftList writes a list of value of the 'hypershift' type to +// the given stream. +func WriteHypershiftList(list []*Hypershift, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteHypershift(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalHypershiftList reads a list of values of the 'hypershift' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalHypershiftList(source interface{}) (items []*Hypershift, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadHypershiftList(iterator) + err = iterator.Error + return +} + +// ReadHypershiftList reads list of values of the ”hypershift' type from +// the given iterator. +func ReadHypershiftList(iterator *jsoniter.Iterator) []*Hypershift { + list := []*Hypershift{} + for iterator.ReadArray() { + item := ReadHypershift(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/hypershift_type.go b/clientapi/arohcp/v1alpha1/hypershift_type.go new file mode 100644 index 00000000..d43d146b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/hypershift_type.go @@ -0,0 +1,175 @@ +/* +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 + +// Hypershift represents the values of the 'hypershift' type. +// +// Hypershift configuration. +type Hypershift struct { + bitmap_ uint32 + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Hypershift) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Boolean flag indicating if the cluster should be creating using _Hypershift_. +// +// By default this is `false`. +// +// To enable it the cluster needs to be ROSA cluster and the organization of the user needs +// to have the `hypershift` capability enabled. +func (o *Hypershift) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Boolean flag indicating if the cluster should be creating using _Hypershift_. +// +// By default this is `false`. +// +// To enable it the cluster needs to be ROSA cluster and the organization of the user needs +// to have the `hypershift` capability enabled. +func (o *Hypershift) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// HypershiftListKind is the name of the type used to represent list of objects of +// type 'hypershift'. +const HypershiftListKind = "HypershiftList" + +// HypershiftListLinkKind is the name of the type used to represent links to list +// of objects of type 'hypershift'. +const HypershiftListLinkKind = "HypershiftListLink" + +// HypershiftNilKind is the name of the type used to nil lists of objects of +// type 'hypershift'. +const HypershiftListNilKind = "HypershiftListNil" + +// HypershiftList is a list of values of the 'hypershift' type. +type HypershiftList struct { + href string + link bool + items []*Hypershift +} + +// Len returns the length of the list. +func (l *HypershiftList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *HypershiftList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *HypershiftList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *HypershiftList) SetItems(items []*Hypershift) { + l.items = items +} + +// Items returns the items of the list. +func (l *HypershiftList) Items() []*Hypershift { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *HypershiftList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *HypershiftList) Get(i int) *Hypershift { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *HypershiftList) Slice() []*Hypershift { + var slice []*Hypershift + if l == nil { + slice = make([]*Hypershift, 0) + } else { + slice = make([]*Hypershift, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *HypershiftList) Each(f func(item *Hypershift) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *HypershiftList) Range(f func(index int, item *Hypershift) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/hypershift_type_json.go b/clientapi/arohcp/v1alpha1/hypershift_type_json.go new file mode 100644 index 00000000..bf7b72db --- /dev/null +++ b/clientapi/arohcp/v1alpha1/hypershift_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalHypershift writes a value of the 'hypershift' type to the given writer. +func MarshalHypershift(object *Hypershift, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHypershift(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHypershift writes a value of the 'hypershift' type to the given stream. +func WriteHypershift(object *Hypershift, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalHypershift reads a value of the 'hypershift' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalHypershift(source interface{}) (object *Hypershift, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadHypershift(iterator) + err = iterator.Error + return +} + +// ReadHypershift reads a value of the 'hypershift' type from the given iterator. +func ReadHypershift(iterator *jsoniter.Iterator) *Hypershift { + object := &Hypershift{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/image_overrides_builder.go b/clientapi/arohcp/v1alpha1/image_overrides_builder.go new file mode 100644 index 00000000..743d5ff0 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/image_overrides_builder.go @@ -0,0 +1,131 @@ +/* +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 + +// ImageOverridesBuilder contains the data and logic needed to build 'image_overrides' objects. +// +// ImageOverrides holds the lists of available images per cloud provider. +type ImageOverridesBuilder struct { + bitmap_ uint32 + id string + href string + aws []*AMIOverrideBuilder + gcp []*GCPImageOverrideBuilder +} + +// NewImageOverrides creates a new builder of 'image_overrides' objects. +func NewImageOverrides() *ImageOverridesBuilder { + return &ImageOverridesBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ImageOverridesBuilder) Link(value bool) *ImageOverridesBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ImageOverridesBuilder) ID(value string) *ImageOverridesBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ImageOverridesBuilder) HREF(value string) *ImageOverridesBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ImageOverridesBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AWS sets the value of the 'AWS' attribute to the given values. +func (b *ImageOverridesBuilder) AWS(values ...*AMIOverrideBuilder) *ImageOverridesBuilder { + b.aws = make([]*AMIOverrideBuilder, len(values)) + copy(b.aws, values) + b.bitmap_ |= 8 + return b +} + +// GCP sets the value of the 'GCP' attribute to the given values. +func (b *ImageOverridesBuilder) GCP(values ...*GCPImageOverrideBuilder) *ImageOverridesBuilder { + b.gcp = make([]*GCPImageOverrideBuilder, len(values)) + copy(b.gcp, values) + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ImageOverridesBuilder) Copy(object *ImageOverrides) *ImageOverridesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.aws != nil { + b.aws = make([]*AMIOverrideBuilder, len(object.aws)) + for i, v := range object.aws { + b.aws[i] = NewAMIOverride().Copy(v) + } + } else { + b.aws = nil + } + if object.gcp != nil { + b.gcp = make([]*GCPImageOverrideBuilder, len(object.gcp)) + for i, v := range object.gcp { + b.gcp[i] = NewGCPImageOverride().Copy(v) + } + } else { + b.gcp = nil + } + return b +} + +// Build creates a 'image_overrides' object using the configuration stored in the builder. +func (b *ImageOverridesBuilder) Build() (object *ImageOverrides, err error) { + object = new(ImageOverrides) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.aws != nil { + object.aws = make([]*AMIOverride, len(b.aws)) + for i, v := range b.aws { + object.aws[i], err = v.Build() + if err != nil { + return + } + } + } + if b.gcp != nil { + object.gcp = make([]*GCPImageOverride, len(b.gcp)) + for i, v := range b.gcp { + object.gcp[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/image_overrides_list_builder.go b/clientapi/arohcp/v1alpha1/image_overrides_list_builder.go new file mode 100644 index 00000000..a3759907 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/image_overrides_list_builder.go @@ -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 + +// ImageOverridesListBuilder contains the data and logic needed to build +// 'image_overrides' objects. +type ImageOverridesListBuilder struct { + items []*ImageOverridesBuilder +} + +// NewImageOverridesList creates a new builder of 'image_overrides' objects. +func NewImageOverridesList() *ImageOverridesListBuilder { + return new(ImageOverridesListBuilder) +} + +// Items sets the items of the list. +func (b *ImageOverridesListBuilder) Items(values ...*ImageOverridesBuilder) *ImageOverridesListBuilder { + b.items = make([]*ImageOverridesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ImageOverridesListBuilder) 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 *ImageOverridesListBuilder) Copy(list *ImageOverridesList) *ImageOverridesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ImageOverridesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewImageOverrides().Copy(v) + } + } + return b +} + +// Build creates a list of 'image_overrides' objects using the +// configuration stored in the builder. +func (b *ImageOverridesListBuilder) Build() (list *ImageOverridesList, err error) { + items := make([]*ImageOverrides, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ImageOverridesList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/image_overrides_list_type_json.go b/clientapi/arohcp/v1alpha1/image_overrides_list_type_json.go new file mode 100644 index 00000000..46da1219 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/image_overrides_list_type_json.go @@ -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" +) + +// MarshalImageOverridesList writes a list of values of the 'image_overrides' type to +// the given writer. +func MarshalImageOverridesList(list []*ImageOverrides, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteImageOverridesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteImageOverridesList writes a list of value of the 'image_overrides' type to +// the given stream. +func WriteImageOverridesList(list []*ImageOverrides, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteImageOverrides(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalImageOverridesList reads a list of values of the 'image_overrides' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalImageOverridesList(source interface{}) (items []*ImageOverrides, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadImageOverridesList(iterator) + err = iterator.Error + return +} + +// ReadImageOverridesList reads list of values of the ”image_overrides' type from +// the given iterator. +func ReadImageOverridesList(iterator *jsoniter.Iterator) []*ImageOverrides { + list := []*ImageOverrides{} + for iterator.ReadArray() { + item := ReadImageOverrides(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/image_overrides_type.go b/clientapi/arohcp/v1alpha1/image_overrides_type.go new file mode 100644 index 00000000..c63a9f94 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/image_overrides_type.go @@ -0,0 +1,281 @@ +/* +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 + +// ImageOverridesKind is the name of the type used to represent objects +// of type 'image_overrides'. +const ImageOverridesKind = "ImageOverrides" + +// ImageOverridesLinkKind is the name of the type used to represent links +// to objects of type 'image_overrides'. +const ImageOverridesLinkKind = "ImageOverridesLink" + +// ImageOverridesNilKind is the name of the type used to nil references +// to objects of type 'image_overrides'. +const ImageOverridesNilKind = "ImageOverridesNil" + +// ImageOverrides represents the values of the 'image_overrides' type. +// +// ImageOverrides holds the lists of available images per cloud provider. +type ImageOverrides struct { + bitmap_ uint32 + id string + href string + aws []*AMIOverride + gcp []*GCPImageOverride +} + +// Kind returns the name of the type of the object. +func (o *ImageOverrides) Kind() string { + if o == nil { + return ImageOverridesNilKind + } + if o.bitmap_&1 != 0 { + return ImageOverridesLinkKind + } + return ImageOverridesKind +} + +// Link returns true if this is a link. +func (o *ImageOverrides) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ImageOverrides) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ImageOverrides) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ImageOverrides) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ImageOverrides) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ImageOverrides) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AWS returns the value of the 'AWS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ImageOverrides) AWS() []*AMIOverride { + if o != nil && o.bitmap_&8 != 0 { + return o.aws + } + return nil +} + +// GetAWS returns the value of the 'AWS' attribute and +// a flag indicating if the attribute has a value. +func (o *ImageOverrides) GetAWS() (value []*AMIOverride, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.aws + } + return +} + +// GCP returns the value of the 'GCP' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ImageOverrides) GCP() []*GCPImageOverride { + if o != nil && o.bitmap_&16 != 0 { + return o.gcp + } + return nil +} + +// GetGCP returns the value of the 'GCP' attribute and +// a flag indicating if the attribute has a value. +func (o *ImageOverrides) GetGCP() (value []*GCPImageOverride, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.gcp + } + return +} + +// ImageOverridesListKind is the name of the type used to represent list of objects of +// type 'image_overrides'. +const ImageOverridesListKind = "ImageOverridesList" + +// ImageOverridesListLinkKind is the name of the type used to represent links to list +// of objects of type 'image_overrides'. +const ImageOverridesListLinkKind = "ImageOverridesListLink" + +// ImageOverridesNilKind is the name of the type used to nil lists of objects of +// type 'image_overrides'. +const ImageOverridesListNilKind = "ImageOverridesListNil" + +// ImageOverridesList is a list of values of the 'image_overrides' type. +type ImageOverridesList struct { + href string + link bool + items []*ImageOverrides +} + +// Kind returns the name of the type of the object. +func (l *ImageOverridesList) Kind() string { + if l == nil { + return ImageOverridesListNilKind + } + if l.link { + return ImageOverridesListLinkKind + } + return ImageOverridesListKind +} + +// Link returns true iif this is a link. +func (l *ImageOverridesList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ImageOverridesList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ImageOverridesList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ImageOverridesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ImageOverridesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ImageOverridesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ImageOverridesList) SetItems(items []*ImageOverrides) { + l.items = items +} + +// Items returns the items of the list. +func (l *ImageOverridesList) Items() []*ImageOverrides { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ImageOverridesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ImageOverridesList) Get(i int) *ImageOverrides { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ImageOverridesList) Slice() []*ImageOverrides { + var slice []*ImageOverrides + if l == nil { + slice = make([]*ImageOverrides, 0) + } else { + slice = make([]*ImageOverrides, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ImageOverridesList) Each(f func(item *ImageOverrides) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ImageOverridesList) Range(f func(index int, item *ImageOverrides) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/image_overrides_type_json.go b/clientapi/arohcp/v1alpha1/image_overrides_type_json.go new file mode 100644 index 00000000..4907534d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/image_overrides_type_json.go @@ -0,0 +1,133 @@ +/* +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" +) + +// MarshalImageOverrides writes a value of the 'image_overrides' type to the given writer. +func MarshalImageOverrides(object *ImageOverrides, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteImageOverrides(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteImageOverrides writes a value of the 'image_overrides' type to the given stream. +func WriteImageOverrides(object *ImageOverrides, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ImageOverridesLinkKind) + } else { + stream.WriteString(ImageOverridesKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.aws != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws") + WriteAMIOverrideList(object.aws, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.gcp != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp") + WriteGCPImageOverrideList(object.gcp, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalImageOverrides reads a value of the 'image_overrides' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalImageOverrides(source interface{}) (object *ImageOverrides, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadImageOverrides(iterator) + err = iterator.Error + return +} + +// ReadImageOverrides reads a value of the 'image_overrides' type from the given iterator. +func ReadImageOverrides(iterator *jsoniter.Iterator) *ImageOverrides { + object := &ImageOverrides{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ImageOverridesLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "aws": + value := ReadAMIOverrideList(iterator) + object.aws = value + object.bitmap_ |= 8 + case "gcp": + value := ReadGCPImageOverrideList(iterator) + object.gcp = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/inflight_check_builder.go b/clientapi/arohcp/v1alpha1/inflight_check_builder.go new file mode 100644 index 00000000..b8b71fd4 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/inflight_check_builder.go @@ -0,0 +1,145 @@ +/* +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 ( + time "time" +) + +// InflightCheckBuilder contains the data and logic needed to build 'inflight_check' objects. +// +// Representation of check running before the cluster is provisioned. +type InflightCheckBuilder struct { + bitmap_ uint32 + id string + href string + details interface{} + endedAt time.Time + name string + restarts int + startedAt time.Time + state InflightCheckState +} + +// NewInflightCheck creates a new builder of 'inflight_check' objects. +func NewInflightCheck() *InflightCheckBuilder { + return &InflightCheckBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *InflightCheckBuilder) Link(value bool) *InflightCheckBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *InflightCheckBuilder) ID(value string) *InflightCheckBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *InflightCheckBuilder) HREF(value string) *InflightCheckBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *InflightCheckBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Details sets the value of the 'details' attribute to the given value. +func (b *InflightCheckBuilder) Details(value interface{}) *InflightCheckBuilder { + b.details = value + b.bitmap_ |= 8 + return b +} + +// EndedAt sets the value of the 'ended_at' attribute to the given value. +func (b *InflightCheckBuilder) EndedAt(value time.Time) *InflightCheckBuilder { + b.endedAt = value + b.bitmap_ |= 16 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *InflightCheckBuilder) Name(value string) *InflightCheckBuilder { + b.name = value + b.bitmap_ |= 32 + return b +} + +// Restarts sets the value of the 'restarts' attribute to the given value. +func (b *InflightCheckBuilder) Restarts(value int) *InflightCheckBuilder { + b.restarts = value + b.bitmap_ |= 64 + return b +} + +// StartedAt sets the value of the 'started_at' attribute to the given value. +func (b *InflightCheckBuilder) StartedAt(value time.Time) *InflightCheckBuilder { + b.startedAt = value + b.bitmap_ |= 128 + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// State of an inflight check. +func (b *InflightCheckBuilder) State(value InflightCheckState) *InflightCheckBuilder { + b.state = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *InflightCheckBuilder) Copy(object *InflightCheck) *InflightCheckBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.details = object.details + b.endedAt = object.endedAt + b.name = object.name + b.restarts = object.restarts + b.startedAt = object.startedAt + b.state = object.state + return b +} + +// Build creates a 'inflight_check' object using the configuration stored in the builder. +func (b *InflightCheckBuilder) Build() (object *InflightCheck, err error) { + object = new(InflightCheck) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.details = b.details + object.endedAt = b.endedAt + object.name = b.name + object.restarts = b.restarts + object.startedAt = b.startedAt + object.state = b.state + return +} diff --git a/clientapi/arohcp/v1alpha1/inflight_check_list_builder.go b/clientapi/arohcp/v1alpha1/inflight_check_list_builder.go new file mode 100644 index 00000000..a466dedb --- /dev/null +++ b/clientapi/arohcp/v1alpha1/inflight_check_list_builder.go @@ -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 + +// InflightCheckListBuilder contains the data and logic needed to build +// 'inflight_check' objects. +type InflightCheckListBuilder struct { + items []*InflightCheckBuilder +} + +// NewInflightCheckList creates a new builder of 'inflight_check' objects. +func NewInflightCheckList() *InflightCheckListBuilder { + return new(InflightCheckListBuilder) +} + +// Items sets the items of the list. +func (b *InflightCheckListBuilder) Items(values ...*InflightCheckBuilder) *InflightCheckListBuilder { + b.items = make([]*InflightCheckBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *InflightCheckListBuilder) 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 *InflightCheckListBuilder) Copy(list *InflightCheckList) *InflightCheckListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*InflightCheckBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewInflightCheck().Copy(v) + } + } + return b +} + +// Build creates a list of 'inflight_check' objects using the +// configuration stored in the builder. +func (b *InflightCheckListBuilder) Build() (list *InflightCheckList, err error) { + items := make([]*InflightCheck, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(InflightCheckList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/inflight_check_list_type_json.go b/clientapi/arohcp/v1alpha1/inflight_check_list_type_json.go new file mode 100644 index 00000000..22545f8a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/inflight_check_list_type_json.go @@ -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" +) + +// MarshalInflightCheckList writes a list of values of the 'inflight_check' type to +// the given writer. +func MarshalInflightCheckList(list []*InflightCheck, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInflightCheckList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInflightCheckList writes a list of value of the 'inflight_check' type to +// the given stream. +func WriteInflightCheckList(list []*InflightCheck, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteInflightCheck(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalInflightCheckList reads a list of values of the 'inflight_check' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInflightCheckList(source interface{}) (items []*InflightCheck, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInflightCheckList(iterator) + err = iterator.Error + return +} + +// ReadInflightCheckList reads list of values of the ”inflight_check' type from +// the given iterator. +func ReadInflightCheckList(iterator *jsoniter.Iterator) []*InflightCheck { + list := []*InflightCheck{} + for iterator.ReadArray() { + item := ReadInflightCheck(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/inflight_check_state_list_type_json.go b/clientapi/arohcp/v1alpha1/inflight_check_state_list_type_json.go new file mode 100644 index 00000000..74777f5c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/inflight_check_state_list_type_json.go @@ -0,0 +1,76 @@ +/* +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" +) + +// MarshalInflightCheckStateList writes a list of values of the 'inflight_check_state' type to +// the given writer. +func MarshalInflightCheckStateList(list []InflightCheckState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInflightCheckStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInflightCheckStateList writes a list of value of the 'inflight_check_state' type to +// the given stream. +func WriteInflightCheckStateList(list []InflightCheckState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalInflightCheckStateList reads a list of values of the 'inflight_check_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInflightCheckStateList(source interface{}) (items []InflightCheckState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInflightCheckStateList(iterator) + err = iterator.Error + return +} + +// ReadInflightCheckStateList reads list of values of the ”inflight_check_state' type from +// the given iterator. +func ReadInflightCheckStateList(iterator *jsoniter.Iterator) []InflightCheckState { + list := []InflightCheckState{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := InflightCheckState(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/inflight_check_state_type.go b/clientapi/arohcp/v1alpha1/inflight_check_state_type.go new file mode 100644 index 00000000..dfb5c834 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/inflight_check_state_type.go @@ -0,0 +1,34 @@ +/* +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 + +// InflightCheckState represents the values of the 'inflight_check_state' enumerated type. +type InflightCheckState string + +const ( + // The inflight check failed. + InflightCheckStateFailed InflightCheckState = "failed" + // The inflight check passed. + InflightCheckStatePassed InflightCheckState = "passed" + // The inflight check did not start running yet. + InflightCheckStatePending InflightCheckState = "pending" + // The inflight check is currently running. + InflightCheckStateRunning InflightCheckState = "running" +) diff --git a/clientapi/arohcp/v1alpha1/inflight_check_type.go b/clientapi/arohcp/v1alpha1/inflight_check_type.go new file mode 100644 index 00000000..c9b93b84 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/inflight_check_type.go @@ -0,0 +1,389 @@ +/* +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 ( + time "time" +) + +// InflightCheckKind is the name of the type used to represent objects +// of type 'inflight_check'. +const InflightCheckKind = "InflightCheck" + +// InflightCheckLinkKind is the name of the type used to represent links +// to objects of type 'inflight_check'. +const InflightCheckLinkKind = "InflightCheckLink" + +// InflightCheckNilKind is the name of the type used to nil references +// to objects of type 'inflight_check'. +const InflightCheckNilKind = "InflightCheckNil" + +// InflightCheck represents the values of the 'inflight_check' type. +// +// Representation of check running before the cluster is provisioned. +type InflightCheck struct { + bitmap_ uint32 + id string + href string + details interface{} + endedAt time.Time + name string + restarts int + startedAt time.Time + state InflightCheckState +} + +// Kind returns the name of the type of the object. +func (o *InflightCheck) Kind() string { + if o == nil { + return InflightCheckNilKind + } + if o.bitmap_&1 != 0 { + return InflightCheckLinkKind + } + return InflightCheckKind +} + +// Link returns true if this is a link. +func (o *InflightCheck) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *InflightCheck) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *InflightCheck) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *InflightCheck) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *InflightCheck) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *InflightCheck) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Details returns the value of the 'details' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details regarding the state of the inflight check. +func (o *InflightCheck) Details() interface{} { + if o != nil && o.bitmap_&8 != 0 { + return o.details + } + return nil +} + +// GetDetails returns the value of the 'details' attribute and +// a flag indicating if the attribute has a value. +// +// Details regarding the state of the inflight check. +func (o *InflightCheck) GetDetails() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.details + } + return +} + +// EndedAt returns the value of the 'ended_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The time the check finished running. +func (o *InflightCheck) EndedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.endedAt + } + return time.Time{} +} + +// GetEndedAt returns the value of the 'ended_at' attribute and +// a flag indicating if the attribute has a value. +// +// The time the check finished running. +func (o *InflightCheck) GetEndedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.endedAt + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the inflight check. +func (o *InflightCheck) Name() string { + if o != nil && o.bitmap_&32 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the inflight check. +func (o *InflightCheck) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.name + } + return +} + +// Restarts returns the value of the 'restarts' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The number of times the inflight check restarted. +func (o *InflightCheck) Restarts() int { + if o != nil && o.bitmap_&64 != 0 { + return o.restarts + } + return 0 +} + +// GetRestarts returns the value of the 'restarts' attribute and +// a flag indicating if the attribute has a value. +// +// The number of times the inflight check restarted. +func (o *InflightCheck) GetRestarts() (value int, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.restarts + } + return +} + +// StartedAt returns the value of the 'started_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The time the check started running. +func (o *InflightCheck) StartedAt() time.Time { + if o != nil && o.bitmap_&128 != 0 { + return o.startedAt + } + return time.Time{} +} + +// GetStartedAt returns the value of the 'started_at' attribute and +// a flag indicating if the attribute has a value. +// +// The time the check started running. +func (o *InflightCheck) GetStartedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.startedAt + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// State of the inflight check. +func (o *InflightCheck) State() InflightCheckState { + if o != nil && o.bitmap_&256 != 0 { + return o.state + } + return InflightCheckState("") +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// State of the inflight check. +func (o *InflightCheck) GetState() (value InflightCheckState, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.state + } + return +} + +// InflightCheckListKind is the name of the type used to represent list of objects of +// type 'inflight_check'. +const InflightCheckListKind = "InflightCheckList" + +// InflightCheckListLinkKind is the name of the type used to represent links to list +// of objects of type 'inflight_check'. +const InflightCheckListLinkKind = "InflightCheckListLink" + +// InflightCheckNilKind is the name of the type used to nil lists of objects of +// type 'inflight_check'. +const InflightCheckListNilKind = "InflightCheckListNil" + +// InflightCheckList is a list of values of the 'inflight_check' type. +type InflightCheckList struct { + href string + link bool + items []*InflightCheck +} + +// Kind returns the name of the type of the object. +func (l *InflightCheckList) Kind() string { + if l == nil { + return InflightCheckListNilKind + } + if l.link { + return InflightCheckListLinkKind + } + return InflightCheckListKind +} + +// Link returns true iif this is a link. +func (l *InflightCheckList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *InflightCheckList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *InflightCheckList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *InflightCheckList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *InflightCheckList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *InflightCheckList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *InflightCheckList) SetItems(items []*InflightCheck) { + l.items = items +} + +// Items returns the items of the list. +func (l *InflightCheckList) Items() []*InflightCheck { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *InflightCheckList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *InflightCheckList) Get(i int) *InflightCheck { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *InflightCheckList) Slice() []*InflightCheck { + var slice []*InflightCheck + if l == nil { + slice = make([]*InflightCheck, 0) + } else { + slice = make([]*InflightCheck, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *InflightCheckList) Each(f func(item *InflightCheck) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *InflightCheckList) Range(f func(index int, item *InflightCheck) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/inflight_check_type_json.go b/clientapi/arohcp/v1alpha1/inflight_check_type_json.go new file mode 100644 index 00000000..e63e2182 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/inflight_check_type_json.go @@ -0,0 +1,196 @@ +/* +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" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInflightCheck writes a value of the 'inflight_check' type to the given writer. +func MarshalInflightCheck(object *InflightCheck, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInflightCheck(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInflightCheck writes a value of the 'inflight_check' type to the given stream. +func WriteInflightCheck(object *InflightCheck, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(InflightCheckLinkKind) + } else { + stream.WriteString(InflightCheckKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("details") + stream.WriteVal(object.details) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ended_at") + stream.WriteString((object.endedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("restarts") + stream.WriteInt(object.restarts) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("started_at") + stream.WriteString((object.startedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(string(object.state)) + } + stream.WriteObjectEnd() +} + +// UnmarshalInflightCheck reads a value of the 'inflight_check' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalInflightCheck(source interface{}) (object *InflightCheck, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadInflightCheck(iterator) + err = iterator.Error + return +} + +// ReadInflightCheck reads a value of the 'inflight_check' type from the given iterator. +func ReadInflightCheck(iterator *jsoniter.Iterator) *InflightCheck { + object := &InflightCheck{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == InflightCheckLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "details": + var value interface{} + iterator.ReadVal(&value) + object.details = value + object.bitmap_ |= 8 + case "ended_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.endedAt = value + object.bitmap_ |= 16 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 32 + case "restarts": + value := iterator.ReadInt() + object.restarts = value + object.bitmap_ |= 64 + case "started_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.startedAt = value + object.bitmap_ |= 128 + case "state": + text := iterator.ReadString() + value := InflightCheckState(text) + object.state = value + object.bitmap_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/instance_iam_roles_builder.go b/clientapi/arohcp/v1alpha1/instance_iam_roles_builder.go new file mode 100644 index 00000000..05d8ecf6 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/instance_iam_roles_builder.go @@ -0,0 +1,73 @@ +/* +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 + +// InstanceIAMRolesBuilder contains the data and logic needed to build 'instance_IAM_roles' objects. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type InstanceIAMRolesBuilder struct { + bitmap_ uint32 + masterRoleARN string + workerRoleARN string +} + +// NewInstanceIAMRoles creates a new builder of 'instance_IAM_roles' objects. +func NewInstanceIAMRoles() *InstanceIAMRolesBuilder { + return &InstanceIAMRolesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *InstanceIAMRolesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// MasterRoleARN sets the value of the 'master_role_ARN' attribute to the given value. +func (b *InstanceIAMRolesBuilder) MasterRoleARN(value string) *InstanceIAMRolesBuilder { + b.masterRoleARN = value + b.bitmap_ |= 1 + return b +} + +// WorkerRoleARN sets the value of the 'worker_role_ARN' attribute to the given value. +func (b *InstanceIAMRolesBuilder) WorkerRoleARN(value string) *InstanceIAMRolesBuilder { + b.workerRoleARN = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *InstanceIAMRolesBuilder) Copy(object *InstanceIAMRoles) *InstanceIAMRolesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.masterRoleARN = object.masterRoleARN + b.workerRoleARN = object.workerRoleARN + return b +} + +// Build creates a 'instance_IAM_roles' object using the configuration stored in the builder. +func (b *InstanceIAMRolesBuilder) Build() (object *InstanceIAMRoles, err error) { + object = new(InstanceIAMRoles) + object.bitmap_ = b.bitmap_ + object.masterRoleARN = b.masterRoleARN + object.workerRoleARN = b.workerRoleARN + return +} diff --git a/clientapi/arohcp/v1alpha1/instance_iam_roles_list_builder.go b/clientapi/arohcp/v1alpha1/instance_iam_roles_list_builder.go new file mode 100644 index 00000000..8442e57b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/instance_iam_roles_list_builder.go @@ -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 + +// InstanceIAMRolesListBuilder contains the data and logic needed to build +// 'instance_IAM_roles' objects. +type InstanceIAMRolesListBuilder struct { + items []*InstanceIAMRolesBuilder +} + +// NewInstanceIAMRolesList creates a new builder of 'instance_IAM_roles' objects. +func NewInstanceIAMRolesList() *InstanceIAMRolesListBuilder { + return new(InstanceIAMRolesListBuilder) +} + +// Items sets the items of the list. +func (b *InstanceIAMRolesListBuilder) Items(values ...*InstanceIAMRolesBuilder) *InstanceIAMRolesListBuilder { + b.items = make([]*InstanceIAMRolesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *InstanceIAMRolesListBuilder) 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 *InstanceIAMRolesListBuilder) Copy(list *InstanceIAMRolesList) *InstanceIAMRolesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*InstanceIAMRolesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewInstanceIAMRoles().Copy(v) + } + } + return b +} + +// Build creates a list of 'instance_IAM_roles' objects using the +// configuration stored in the builder. +func (b *InstanceIAMRolesListBuilder) Build() (list *InstanceIAMRolesList, err error) { + items := make([]*InstanceIAMRoles, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(InstanceIAMRolesList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/instance_iam_roles_list_type_json.go b/clientapi/arohcp/v1alpha1/instance_iam_roles_list_type_json.go new file mode 100644 index 00000000..4e18ee53 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/instance_iam_roles_list_type_json.go @@ -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" +) + +// MarshalInstanceIAMRolesList writes a list of values of the 'instance_IAM_roles' type to +// the given writer. +func MarshalInstanceIAMRolesList(list []*InstanceIAMRoles, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInstanceIAMRolesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInstanceIAMRolesList writes a list of value of the 'instance_IAM_roles' type to +// the given stream. +func WriteInstanceIAMRolesList(list []*InstanceIAMRoles, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteInstanceIAMRoles(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalInstanceIAMRolesList reads a list of values of the 'instance_IAM_roles' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInstanceIAMRolesList(source interface{}) (items []*InstanceIAMRoles, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInstanceIAMRolesList(iterator) + err = iterator.Error + return +} + +// ReadInstanceIAMRolesList reads list of values of the ”instance_IAM_roles' type from +// the given iterator. +func ReadInstanceIAMRolesList(iterator *jsoniter.Iterator) []*InstanceIAMRoles { + list := []*InstanceIAMRoles{} + for iterator.ReadArray() { + item := ReadInstanceIAMRoles(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/instance_iam_roles_type.go b/clientapi/arohcp/v1alpha1/instance_iam_roles_type.go new file mode 100644 index 00000000..3448aaf2 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/instance_iam_roles_type.go @@ -0,0 +1,189 @@ +/* +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 + +// InstanceIAMRoles represents the values of the 'instance_IAM_roles' type. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type InstanceIAMRoles struct { + bitmap_ uint32 + masterRoleARN string + workerRoleARN string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *InstanceIAMRoles) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// MasterRoleARN returns the value of the 'master_role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The IAM role ARN that will be attached to master instances +func (o *InstanceIAMRoles) MasterRoleARN() string { + if o != nil && o.bitmap_&1 != 0 { + return o.masterRoleARN + } + return "" +} + +// GetMasterRoleARN returns the value of the 'master_role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// The IAM role ARN that will be attached to master instances +func (o *InstanceIAMRoles) GetMasterRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.masterRoleARN + } + return +} + +// WorkerRoleARN returns the value of the 'worker_role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The IAM role ARN that will be attached to worker instances +func (o *InstanceIAMRoles) WorkerRoleARN() string { + if o != nil && o.bitmap_&2 != 0 { + return o.workerRoleARN + } + return "" +} + +// GetWorkerRoleARN returns the value of the 'worker_role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// The IAM role ARN that will be attached to worker instances +func (o *InstanceIAMRoles) GetWorkerRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.workerRoleARN + } + return +} + +// InstanceIAMRolesListKind is the name of the type used to represent list of objects of +// type 'instance_IAM_roles'. +const InstanceIAMRolesListKind = "InstanceIAMRolesList" + +// InstanceIAMRolesListLinkKind is the name of the type used to represent links to list +// of objects of type 'instance_IAM_roles'. +const InstanceIAMRolesListLinkKind = "InstanceIAMRolesListLink" + +// InstanceIAMRolesNilKind is the name of the type used to nil lists of objects of +// type 'instance_IAM_roles'. +const InstanceIAMRolesListNilKind = "InstanceIAMRolesListNil" + +// InstanceIAMRolesList is a list of values of the 'instance_IAM_roles' type. +type InstanceIAMRolesList struct { + href string + link bool + items []*InstanceIAMRoles +} + +// Len returns the length of the list. +func (l *InstanceIAMRolesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *InstanceIAMRolesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *InstanceIAMRolesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *InstanceIAMRolesList) SetItems(items []*InstanceIAMRoles) { + l.items = items +} + +// Items returns the items of the list. +func (l *InstanceIAMRolesList) Items() []*InstanceIAMRoles { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *InstanceIAMRolesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *InstanceIAMRolesList) Get(i int) *InstanceIAMRoles { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *InstanceIAMRolesList) Slice() []*InstanceIAMRoles { + var slice []*InstanceIAMRoles + if l == nil { + slice = make([]*InstanceIAMRoles, 0) + } else { + slice = make([]*InstanceIAMRoles, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *InstanceIAMRolesList) Each(f func(item *InstanceIAMRoles) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *InstanceIAMRolesList) Range(f func(index int, item *InstanceIAMRoles) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/instance_iam_roles_type_json.go b/clientapi/arohcp/v1alpha1/instance_iam_roles_type_json.go new file mode 100644 index 00000000..976cb82d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/instance_iam_roles_type_json.go @@ -0,0 +1,99 @@ +/* +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" +) + +// MarshalInstanceIAMRoles writes a value of the 'instance_IAM_roles' type to the given writer. +func MarshalInstanceIAMRoles(object *InstanceIAMRoles, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInstanceIAMRoles(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInstanceIAMRoles writes a value of the 'instance_IAM_roles' type to the given stream. +func WriteInstanceIAMRoles(object *InstanceIAMRoles, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("master_role_arn") + stream.WriteString(object.masterRoleARN) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("worker_role_arn") + stream.WriteString(object.workerRoleARN) + } + stream.WriteObjectEnd() +} + +// UnmarshalInstanceIAMRoles reads a value of the 'instance_IAM_roles' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalInstanceIAMRoles(source interface{}) (object *InstanceIAMRoles, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadInstanceIAMRoles(iterator) + err = iterator.Error + return +} + +// ReadInstanceIAMRoles reads a value of the 'instance_IAM_roles' type from the given iterator. +func ReadInstanceIAMRoles(iterator *jsoniter.Iterator) *InstanceIAMRoles { + object := &InstanceIAMRoles{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "master_role_arn": + value := iterator.ReadString() + object.masterRoleARN = value + object.bitmap_ |= 1 + case "worker_role_arn": + value := iterator.ReadString() + object.workerRoleARN = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/integer_list_type_json.go b/clientapi/arohcp/v1alpha1/integer_list_type_json.go new file mode 100644 index 00000000..12bad8de --- /dev/null +++ b/clientapi/arohcp/v1alpha1/integer_list_type_json.go @@ -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" +) + +// MarshalIntegerList writes a list of values of the 'integer' type to +// the given writer. +func MarshalIntegerList(list []int, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIntegerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIntegerList writes a list of value of the 'integer' type to +// the given stream. +func WriteIntegerList(list []int, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalIntegerList reads a list of values of the 'integer' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIntegerList(source interface{}) (items []int, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIntegerList(iterator) + err = iterator.Error + return +} + +// ReadIntegerList reads list of values of the ”integer' type from +// the given iterator. +func ReadIntegerList(iterator *jsoniter.Iterator) []int { + list := []int{} + for iterator.ReadArray() { + item := iterator.ReadInt() + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/interface_list_type_json.go b/clientapi/arohcp/v1alpha1/interface_list_type_json.go new file mode 100644 index 00000000..ee8dfbc1 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/interface_list_type_json.go @@ -0,0 +1,76 @@ +/* +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" +) + +// MarshalInterfaceList writes a list of values of the 'interface' type to +// the given writer. +func MarshalInterfaceList(list []interface{}, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInterfaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInterfaceList writes a list of value of the 'interface' type to +// the given stream. +func WriteInterfaceList(list []interface{}, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteVal(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalInterfaceList reads a list of values of the 'interface' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInterfaceList(source interface{}) (items []interface{}, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInterfaceList(iterator) + err = iterator.Error + return +} + +// ReadInterfaceList reads list of values of the ”interface' type from +// the given iterator. +func ReadInterfaceList(iterator *jsoniter.Iterator) []interface{} { + list := []interface{}{} + for iterator.ReadArray() { + var item interface{} + iterator.ReadVal(&item) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/kubelet_config_builder.go b/clientapi/arohcp/v1alpha1/kubelet_config_builder.go new file mode 100644 index 00000000..5812ed4b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/kubelet_config_builder.go @@ -0,0 +1,100 @@ +/* +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 + +// KubeletConfigBuilder contains the data and logic needed to build 'kubelet_config' objects. +// +// OCM representation of KubeletConfig, exposing the fields of Kubernetes +// KubeletConfig that can be managed by users +type KubeletConfigBuilder struct { + bitmap_ uint32 + id string + href string + name string + podPidsLimit int +} + +// NewKubeletConfig creates a new builder of 'kubelet_config' objects. +func NewKubeletConfig() *KubeletConfigBuilder { + return &KubeletConfigBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *KubeletConfigBuilder) Link(value bool) *KubeletConfigBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *KubeletConfigBuilder) ID(value string) *KubeletConfigBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *KubeletConfigBuilder) HREF(value string) *KubeletConfigBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *KubeletConfigBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *KubeletConfigBuilder) Name(value string) *KubeletConfigBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// PodPidsLimit sets the value of the 'pod_pids_limit' attribute to the given value. +func (b *KubeletConfigBuilder) PodPidsLimit(value int) *KubeletConfigBuilder { + b.podPidsLimit = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *KubeletConfigBuilder) Copy(object *KubeletConfig) *KubeletConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.name = object.name + b.podPidsLimit = object.podPidsLimit + return b +} + +// Build creates a 'kubelet_config' object using the configuration stored in the builder. +func (b *KubeletConfigBuilder) Build() (object *KubeletConfig, err error) { + object = new(KubeletConfig) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.name = b.name + object.podPidsLimit = b.podPidsLimit + return +} diff --git a/clientapi/arohcp/v1alpha1/kubelet_config_list_builder.go b/clientapi/arohcp/v1alpha1/kubelet_config_list_builder.go new file mode 100644 index 00000000..0cfe54b7 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/kubelet_config_list_builder.go @@ -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 + +// KubeletConfigListBuilder contains the data and logic needed to build +// 'kubelet_config' objects. +type KubeletConfigListBuilder struct { + items []*KubeletConfigBuilder +} + +// NewKubeletConfigList creates a new builder of 'kubelet_config' objects. +func NewKubeletConfigList() *KubeletConfigListBuilder { + return new(KubeletConfigListBuilder) +} + +// Items sets the items of the list. +func (b *KubeletConfigListBuilder) Items(values ...*KubeletConfigBuilder) *KubeletConfigListBuilder { + b.items = make([]*KubeletConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *KubeletConfigListBuilder) 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 *KubeletConfigListBuilder) Copy(list *KubeletConfigList) *KubeletConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*KubeletConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewKubeletConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'kubelet_config' objects using the +// configuration stored in the builder. +func (b *KubeletConfigListBuilder) Build() (list *KubeletConfigList, err error) { + items := make([]*KubeletConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(KubeletConfigList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/kubelet_config_list_type_json.go b/clientapi/arohcp/v1alpha1/kubelet_config_list_type_json.go new file mode 100644 index 00000000..3c838a7c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/kubelet_config_list_type_json.go @@ -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" +) + +// MarshalKubeletConfigList writes a list of values of the 'kubelet_config' type to +// the given writer. +func MarshalKubeletConfigList(list []*KubeletConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteKubeletConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteKubeletConfigList writes a list of value of the 'kubelet_config' type to +// the given stream. +func WriteKubeletConfigList(list []*KubeletConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteKubeletConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalKubeletConfigList reads a list of values of the 'kubelet_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalKubeletConfigList(source interface{}) (items []*KubeletConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadKubeletConfigList(iterator) + err = iterator.Error + return +} + +// ReadKubeletConfigList reads list of values of the ”kubelet_config' type from +// the given iterator. +func ReadKubeletConfigList(iterator *jsoniter.Iterator) []*KubeletConfig { + list := []*KubeletConfig{} + for iterator.ReadArray() { + item := ReadKubeletConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/kubelet_config_type.go b/clientapi/arohcp/v1alpha1/kubelet_config_type.go new file mode 100644 index 00000000..1c07778c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/kubelet_config_type.go @@ -0,0 +1,294 @@ +/* +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 + +// KubeletConfigKind is the name of the type used to represent objects +// of type 'kubelet_config'. +const KubeletConfigKind = "KubeletConfig" + +// KubeletConfigLinkKind is the name of the type used to represent links +// to objects of type 'kubelet_config'. +const KubeletConfigLinkKind = "KubeletConfigLink" + +// KubeletConfigNilKind is the name of the type used to nil references +// to objects of type 'kubelet_config'. +const KubeletConfigNilKind = "KubeletConfigNil" + +// KubeletConfig represents the values of the 'kubelet_config' type. +// +// OCM representation of KubeletConfig, exposing the fields of Kubernetes +// KubeletConfig that can be managed by users +type KubeletConfig struct { + bitmap_ uint32 + id string + href string + name string + podPidsLimit int +} + +// Kind returns the name of the type of the object. +func (o *KubeletConfig) Kind() string { + if o == nil { + return KubeletConfigNilKind + } + if o.bitmap_&1 != 0 { + return KubeletConfigLinkKind + } + return KubeletConfigKind +} + +// Link returns true if this is a link. +func (o *KubeletConfig) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *KubeletConfig) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *KubeletConfig) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *KubeletConfig) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *KubeletConfig) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *KubeletConfig) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Allows the user to specify the name to be used to identify this KubeletConfig. +// Optional. A name will be generated if not provided. +func (o *KubeletConfig) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Allows the user to specify the name to be used to identify this KubeletConfig. +// Optional. A name will be generated if not provided. +func (o *KubeletConfig) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// PodPidsLimit returns the value of the 'pod_pids_limit' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Allows the user to specify the podPidsLimit to be applied via KubeletConfig. +// Useful if workloads have greater PIDs limit requirements than the OCP default. +func (o *KubeletConfig) PodPidsLimit() int { + if o != nil && o.bitmap_&16 != 0 { + return o.podPidsLimit + } + return 0 +} + +// GetPodPidsLimit returns the value of the 'pod_pids_limit' attribute and +// a flag indicating if the attribute has a value. +// +// Allows the user to specify the podPidsLimit to be applied via KubeletConfig. +// Useful if workloads have greater PIDs limit requirements than the OCP default. +func (o *KubeletConfig) GetPodPidsLimit() (value int, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.podPidsLimit + } + return +} + +// KubeletConfigListKind is the name of the type used to represent list of objects of +// type 'kubelet_config'. +const KubeletConfigListKind = "KubeletConfigList" + +// KubeletConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'kubelet_config'. +const KubeletConfigListLinkKind = "KubeletConfigListLink" + +// KubeletConfigNilKind is the name of the type used to nil lists of objects of +// type 'kubelet_config'. +const KubeletConfigListNilKind = "KubeletConfigListNil" + +// KubeletConfigList is a list of values of the 'kubelet_config' type. +type KubeletConfigList struct { + href string + link bool + items []*KubeletConfig +} + +// Kind returns the name of the type of the object. +func (l *KubeletConfigList) Kind() string { + if l == nil { + return KubeletConfigListNilKind + } + if l.link { + return KubeletConfigListLinkKind + } + return KubeletConfigListKind +} + +// Link returns true iif this is a link. +func (l *KubeletConfigList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *KubeletConfigList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *KubeletConfigList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *KubeletConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *KubeletConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *KubeletConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *KubeletConfigList) SetItems(items []*KubeletConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *KubeletConfigList) Items() []*KubeletConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *KubeletConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *KubeletConfigList) Get(i int) *KubeletConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *KubeletConfigList) Slice() []*KubeletConfig { + var slice []*KubeletConfig + if l == nil { + slice = make([]*KubeletConfig, 0) + } else { + slice = make([]*KubeletConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *KubeletConfigList) Each(f func(item *KubeletConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *KubeletConfigList) Range(f func(index int, item *KubeletConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/kubelet_config_type_json.go b/clientapi/arohcp/v1alpha1/kubelet_config_type_json.go new file mode 100644 index 00000000..216b6287 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/kubelet_config_type_json.go @@ -0,0 +1,133 @@ +/* +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" +) + +// MarshalKubeletConfig writes a value of the 'kubelet_config' type to the given writer. +func MarshalKubeletConfig(object *KubeletConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteKubeletConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteKubeletConfig writes a value of the 'kubelet_config' type to the given stream. +func WriteKubeletConfig(object *KubeletConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(KubeletConfigLinkKind) + } else { + stream.WriteString(KubeletConfigKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("pod_pids_limit") + stream.WriteInt(object.podPidsLimit) + } + stream.WriteObjectEnd() +} + +// UnmarshalKubeletConfig reads a value of the 'kubelet_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalKubeletConfig(source interface{}) (object *KubeletConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadKubeletConfig(iterator) + err = iterator.Error + return +} + +// ReadKubeletConfig reads a value of the 'kubelet_config' type from the given iterator. +func ReadKubeletConfig(iterator *jsoniter.Iterator) *KubeletConfig { + object := &KubeletConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == KubeletConfigLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + case "pod_pids_limit": + value := iterator.ReadInt() + object.podPidsLimit = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/listening_method_list_type_json.go b/clientapi/arohcp/v1alpha1/listening_method_list_type_json.go new file mode 100644 index 00000000..6853cd34 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/listening_method_list_type_json.go @@ -0,0 +1,76 @@ +/* +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" +) + +// MarshalListeningMethodList writes a list of values of the 'listening_method' type to +// the given writer. +func MarshalListeningMethodList(list []ListeningMethod, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteListeningMethodList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteListeningMethodList writes a list of value of the 'listening_method' type to +// the given stream. +func WriteListeningMethodList(list []ListeningMethod, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalListeningMethodList reads a list of values of the 'listening_method' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalListeningMethodList(source interface{}) (items []ListeningMethod, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadListeningMethodList(iterator) + err = iterator.Error + return +} + +// ReadListeningMethodList reads list of values of the ”listening_method' type from +// the given iterator. +func ReadListeningMethodList(iterator *jsoniter.Iterator) []ListeningMethod { + list := []ListeningMethod{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ListeningMethod(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/listening_method_type.go b/clientapi/arohcp/v1alpha1/listening_method_type.go new file mode 100644 index 00000000..7badd5f7 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/listening_method_type.go @@ -0,0 +1,30 @@ +/* +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 + +// ListeningMethod represents the values of the 'listening_method' enumerated type. +type ListeningMethod string + +const ( + // Uses both external and internal traffic. + ListeningMethodExternal ListeningMethod = "external" + // Uses only internal traffic. + ListeningMethodInternal ListeningMethod = "internal" +) diff --git a/clientapi/arohcp/v1alpha1/long_list_type_json.go b/clientapi/arohcp/v1alpha1/long_list_type_json.go new file mode 100644 index 00000000..d8476c41 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/long_list_type_json.go @@ -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" +) + +// MarshalLongList writes a list of values of the 'long' type to +// the given writer. +func MarshalLongList(list []int64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLongList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLongList writes a list of value of the 'long' type to +// the given stream. +func WriteLongList(list []int64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalLongList reads a list of values of the 'long' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLongList(source interface{}) (items []int64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLongList(iterator) + err = iterator.Error + return +} + +// ReadLongList reads list of values of the ”long' type from +// the given iterator. +func ReadLongList(iterator *jsoniter.Iterator) []int64 { + list := []int64{} + for iterator.ReadArray() { + item := iterator.ReadInt64() + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_builder.go b/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_builder.go new file mode 100644 index 00000000..20e194bb --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_builder.go @@ -0,0 +1,99 @@ +/* +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 + +// MachinePoolAutoscalingBuilder contains the data and logic needed to build 'machine_pool_autoscaling' objects. +// +// Representation of a autoscaling in a machine pool. +type MachinePoolAutoscalingBuilder struct { + bitmap_ uint32 + id string + href string + maxReplicas int + minReplicas int +} + +// NewMachinePoolAutoscaling creates a new builder of 'machine_pool_autoscaling' objects. +func NewMachinePoolAutoscaling() *MachinePoolAutoscalingBuilder { + return &MachinePoolAutoscalingBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *MachinePoolAutoscalingBuilder) Link(value bool) *MachinePoolAutoscalingBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *MachinePoolAutoscalingBuilder) ID(value string) *MachinePoolAutoscalingBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *MachinePoolAutoscalingBuilder) HREF(value string) *MachinePoolAutoscalingBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *MachinePoolAutoscalingBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// MaxReplicas sets the value of the 'max_replicas' attribute to the given value. +func (b *MachinePoolAutoscalingBuilder) MaxReplicas(value int) *MachinePoolAutoscalingBuilder { + b.maxReplicas = value + b.bitmap_ |= 8 + return b +} + +// MinReplicas sets the value of the 'min_replicas' attribute to the given value. +func (b *MachinePoolAutoscalingBuilder) MinReplicas(value int) *MachinePoolAutoscalingBuilder { + b.minReplicas = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *MachinePoolAutoscalingBuilder) Copy(object *MachinePoolAutoscaling) *MachinePoolAutoscalingBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.maxReplicas = object.maxReplicas + b.minReplicas = object.minReplicas + return b +} + +// Build creates a 'machine_pool_autoscaling' object using the configuration stored in the builder. +func (b *MachinePoolAutoscalingBuilder) Build() (object *MachinePoolAutoscaling, err error) { + object = new(MachinePoolAutoscaling) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.maxReplicas = b.maxReplicas + object.minReplicas = b.minReplicas + return +} diff --git a/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_list_builder.go b/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_list_builder.go new file mode 100644 index 00000000..c38de252 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_list_builder.go @@ -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 + +// MachinePoolAutoscalingListBuilder contains the data and logic needed to build +// 'machine_pool_autoscaling' objects. +type MachinePoolAutoscalingListBuilder struct { + items []*MachinePoolAutoscalingBuilder +} + +// NewMachinePoolAutoscalingList creates a new builder of 'machine_pool_autoscaling' objects. +func NewMachinePoolAutoscalingList() *MachinePoolAutoscalingListBuilder { + return new(MachinePoolAutoscalingListBuilder) +} + +// Items sets the items of the list. +func (b *MachinePoolAutoscalingListBuilder) Items(values ...*MachinePoolAutoscalingBuilder) *MachinePoolAutoscalingListBuilder { + b.items = make([]*MachinePoolAutoscalingBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *MachinePoolAutoscalingListBuilder) 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 *MachinePoolAutoscalingListBuilder) Copy(list *MachinePoolAutoscalingList) *MachinePoolAutoscalingListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*MachinePoolAutoscalingBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewMachinePoolAutoscaling().Copy(v) + } + } + return b +} + +// Build creates a list of 'machine_pool_autoscaling' objects using the +// configuration stored in the builder. +func (b *MachinePoolAutoscalingListBuilder) Build() (list *MachinePoolAutoscalingList, err error) { + items := make([]*MachinePoolAutoscaling, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(MachinePoolAutoscalingList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_list_type_json.go b/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_list_type_json.go new file mode 100644 index 00000000..8935e81b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_list_type_json.go @@ -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" +) + +// MarshalMachinePoolAutoscalingList writes a list of values of the 'machine_pool_autoscaling' type to +// the given writer. +func MarshalMachinePoolAutoscalingList(list []*MachinePoolAutoscaling, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachinePoolAutoscalingList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachinePoolAutoscalingList writes a list of value of the 'machine_pool_autoscaling' type to +// the given stream. +func WriteMachinePoolAutoscalingList(list []*MachinePoolAutoscaling, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteMachinePoolAutoscaling(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalMachinePoolAutoscalingList reads a list of values of the 'machine_pool_autoscaling' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMachinePoolAutoscalingList(source interface{}) (items []*MachinePoolAutoscaling, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMachinePoolAutoscalingList(iterator) + err = iterator.Error + return +} + +// ReadMachinePoolAutoscalingList reads list of values of the ”machine_pool_autoscaling' type from +// the given iterator. +func ReadMachinePoolAutoscalingList(iterator *jsoniter.Iterator) []*MachinePoolAutoscaling { + list := []*MachinePoolAutoscaling{} + for iterator.ReadArray() { + item := ReadMachinePoolAutoscaling(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_type.go b/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_type.go new file mode 100644 index 00000000..3bf232a5 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_type.go @@ -0,0 +1,289 @@ +/* +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 + +// MachinePoolAutoscalingKind is the name of the type used to represent objects +// of type 'machine_pool_autoscaling'. +const MachinePoolAutoscalingKind = "MachinePoolAutoscaling" + +// MachinePoolAutoscalingLinkKind is the name of the type used to represent links +// to objects of type 'machine_pool_autoscaling'. +const MachinePoolAutoscalingLinkKind = "MachinePoolAutoscalingLink" + +// MachinePoolAutoscalingNilKind is the name of the type used to nil references +// to objects of type 'machine_pool_autoscaling'. +const MachinePoolAutoscalingNilKind = "MachinePoolAutoscalingNil" + +// MachinePoolAutoscaling represents the values of the 'machine_pool_autoscaling' type. +// +// Representation of a autoscaling in a machine pool. +type MachinePoolAutoscaling struct { + bitmap_ uint32 + id string + href string + maxReplicas int + minReplicas int +} + +// Kind returns the name of the type of the object. +func (o *MachinePoolAutoscaling) Kind() string { + if o == nil { + return MachinePoolAutoscalingNilKind + } + if o.bitmap_&1 != 0 { + return MachinePoolAutoscalingLinkKind + } + return MachinePoolAutoscalingKind +} + +// Link returns true if this is a link. +func (o *MachinePoolAutoscaling) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *MachinePoolAutoscaling) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *MachinePoolAutoscaling) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *MachinePoolAutoscaling) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *MachinePoolAutoscaling) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *MachinePoolAutoscaling) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// MaxReplicas returns the value of the 'max_replicas' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The maximum number of replicas for the machine pool. +func (o *MachinePoolAutoscaling) MaxReplicas() int { + if o != nil && o.bitmap_&8 != 0 { + return o.maxReplicas + } + return 0 +} + +// GetMaxReplicas returns the value of the 'max_replicas' attribute and +// a flag indicating if the attribute has a value. +// +// The maximum number of replicas for the machine pool. +func (o *MachinePoolAutoscaling) GetMaxReplicas() (value int, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.maxReplicas + } + return +} + +// MinReplicas returns the value of the 'min_replicas' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The minimum number of replicas for the machine pool. +func (o *MachinePoolAutoscaling) MinReplicas() int { + if o != nil && o.bitmap_&16 != 0 { + return o.minReplicas + } + return 0 +} + +// GetMinReplicas returns the value of the 'min_replicas' attribute and +// a flag indicating if the attribute has a value. +// +// The minimum number of replicas for the machine pool. +func (o *MachinePoolAutoscaling) GetMinReplicas() (value int, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.minReplicas + } + return +} + +// MachinePoolAutoscalingListKind is the name of the type used to represent list of objects of +// type 'machine_pool_autoscaling'. +const MachinePoolAutoscalingListKind = "MachinePoolAutoscalingList" + +// MachinePoolAutoscalingListLinkKind is the name of the type used to represent links to list +// of objects of type 'machine_pool_autoscaling'. +const MachinePoolAutoscalingListLinkKind = "MachinePoolAutoscalingListLink" + +// MachinePoolAutoscalingNilKind is the name of the type used to nil lists of objects of +// type 'machine_pool_autoscaling'. +const MachinePoolAutoscalingListNilKind = "MachinePoolAutoscalingListNil" + +// MachinePoolAutoscalingList is a list of values of the 'machine_pool_autoscaling' type. +type MachinePoolAutoscalingList struct { + href string + link bool + items []*MachinePoolAutoscaling +} + +// Kind returns the name of the type of the object. +func (l *MachinePoolAutoscalingList) Kind() string { + if l == nil { + return MachinePoolAutoscalingListNilKind + } + if l.link { + return MachinePoolAutoscalingListLinkKind + } + return MachinePoolAutoscalingListKind +} + +// Link returns true iif this is a link. +func (l *MachinePoolAutoscalingList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *MachinePoolAutoscalingList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *MachinePoolAutoscalingList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *MachinePoolAutoscalingList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *MachinePoolAutoscalingList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *MachinePoolAutoscalingList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *MachinePoolAutoscalingList) SetItems(items []*MachinePoolAutoscaling) { + l.items = items +} + +// Items returns the items of the list. +func (l *MachinePoolAutoscalingList) Items() []*MachinePoolAutoscaling { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *MachinePoolAutoscalingList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *MachinePoolAutoscalingList) Get(i int) *MachinePoolAutoscaling { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *MachinePoolAutoscalingList) Slice() []*MachinePoolAutoscaling { + var slice []*MachinePoolAutoscaling + if l == nil { + slice = make([]*MachinePoolAutoscaling, 0) + } else { + slice = make([]*MachinePoolAutoscaling, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *MachinePoolAutoscalingList) Each(f func(item *MachinePoolAutoscaling) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *MachinePoolAutoscalingList) Range(f func(index int, item *MachinePoolAutoscaling) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_type_json.go b/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_type_json.go new file mode 100644 index 00000000..94dddffd --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_pool_autoscaling_type_json.go @@ -0,0 +1,133 @@ +/* +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" +) + +// MarshalMachinePoolAutoscaling writes a value of the 'machine_pool_autoscaling' type to the given writer. +func MarshalMachinePoolAutoscaling(object *MachinePoolAutoscaling, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachinePoolAutoscaling(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachinePoolAutoscaling writes a value of the 'machine_pool_autoscaling' type to the given stream. +func WriteMachinePoolAutoscaling(object *MachinePoolAutoscaling, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(MachinePoolAutoscalingLinkKind) + } else { + stream.WriteString(MachinePoolAutoscalingKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_replicas") + stream.WriteInt(object.maxReplicas) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("min_replicas") + stream.WriteInt(object.minReplicas) + } + stream.WriteObjectEnd() +} + +// UnmarshalMachinePoolAutoscaling reads a value of the 'machine_pool_autoscaling' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalMachinePoolAutoscaling(source interface{}) (object *MachinePoolAutoscaling, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadMachinePoolAutoscaling(iterator) + err = iterator.Error + return +} + +// ReadMachinePoolAutoscaling reads a value of the 'machine_pool_autoscaling' type from the given iterator. +func ReadMachinePoolAutoscaling(iterator *jsoniter.Iterator) *MachinePoolAutoscaling { + object := &MachinePoolAutoscaling{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == MachinePoolAutoscalingLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "max_replicas": + value := iterator.ReadInt() + object.maxReplicas = value + object.bitmap_ |= 8 + case "min_replicas": + value := iterator.ReadInt() + object.minReplicas = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_builder.go b/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_builder.go new file mode 100644 index 00000000..3b9cc9b7 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_builder.go @@ -0,0 +1,73 @@ +/* +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 + +// MachinePoolSecurityGroupFilterBuilder contains the data and logic needed to build 'machine_pool_security_group_filter' objects. +// +// Security Group Filter object, containing name of the filter tag and value of the filter tag +type MachinePoolSecurityGroupFilterBuilder struct { + bitmap_ uint32 + name string + value string +} + +// NewMachinePoolSecurityGroupFilter creates a new builder of 'machine_pool_security_group_filter' objects. +func NewMachinePoolSecurityGroupFilter() *MachinePoolSecurityGroupFilterBuilder { + return &MachinePoolSecurityGroupFilterBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *MachinePoolSecurityGroupFilterBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *MachinePoolSecurityGroupFilterBuilder) Name(value string) *MachinePoolSecurityGroupFilterBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *MachinePoolSecurityGroupFilterBuilder) Value(value string) *MachinePoolSecurityGroupFilterBuilder { + b.value = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *MachinePoolSecurityGroupFilterBuilder) Copy(object *MachinePoolSecurityGroupFilter) *MachinePoolSecurityGroupFilterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + b.value = object.value + return b +} + +// Build creates a 'machine_pool_security_group_filter' object using the configuration stored in the builder. +func (b *MachinePoolSecurityGroupFilterBuilder) Build() (object *MachinePoolSecurityGroupFilter, err error) { + object = new(MachinePoolSecurityGroupFilter) + object.bitmap_ = b.bitmap_ + object.name = b.name + object.value = b.value + return +} diff --git a/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_list_builder.go b/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_list_builder.go new file mode 100644 index 00000000..b395e8f5 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_list_builder.go @@ -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 + +// MachinePoolSecurityGroupFilterListBuilder contains the data and logic needed to build +// 'machine_pool_security_group_filter' objects. +type MachinePoolSecurityGroupFilterListBuilder struct { + items []*MachinePoolSecurityGroupFilterBuilder +} + +// NewMachinePoolSecurityGroupFilterList creates a new builder of 'machine_pool_security_group_filter' objects. +func NewMachinePoolSecurityGroupFilterList() *MachinePoolSecurityGroupFilterListBuilder { + return new(MachinePoolSecurityGroupFilterListBuilder) +} + +// Items sets the items of the list. +func (b *MachinePoolSecurityGroupFilterListBuilder) Items(values ...*MachinePoolSecurityGroupFilterBuilder) *MachinePoolSecurityGroupFilterListBuilder { + b.items = make([]*MachinePoolSecurityGroupFilterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *MachinePoolSecurityGroupFilterListBuilder) 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 *MachinePoolSecurityGroupFilterListBuilder) Copy(list *MachinePoolSecurityGroupFilterList) *MachinePoolSecurityGroupFilterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*MachinePoolSecurityGroupFilterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewMachinePoolSecurityGroupFilter().Copy(v) + } + } + return b +} + +// Build creates a list of 'machine_pool_security_group_filter' objects using the +// configuration stored in the builder. +func (b *MachinePoolSecurityGroupFilterListBuilder) Build() (list *MachinePoolSecurityGroupFilterList, err error) { + items := make([]*MachinePoolSecurityGroupFilter, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(MachinePoolSecurityGroupFilterList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_list_type_json.go b/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_list_type_json.go new file mode 100644 index 00000000..11d8e272 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_list_type_json.go @@ -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" +) + +// MarshalMachinePoolSecurityGroupFilterList writes a list of values of the 'machine_pool_security_group_filter' type to +// the given writer. +func MarshalMachinePoolSecurityGroupFilterList(list []*MachinePoolSecurityGroupFilter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachinePoolSecurityGroupFilterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachinePoolSecurityGroupFilterList writes a list of value of the 'machine_pool_security_group_filter' type to +// the given stream. +func WriteMachinePoolSecurityGroupFilterList(list []*MachinePoolSecurityGroupFilter, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteMachinePoolSecurityGroupFilter(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalMachinePoolSecurityGroupFilterList reads a list of values of the 'machine_pool_security_group_filter' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMachinePoolSecurityGroupFilterList(source interface{}) (items []*MachinePoolSecurityGroupFilter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMachinePoolSecurityGroupFilterList(iterator) + err = iterator.Error + return +} + +// ReadMachinePoolSecurityGroupFilterList reads list of values of the ”machine_pool_security_group_filter' type from +// the given iterator. +func ReadMachinePoolSecurityGroupFilterList(iterator *jsoniter.Iterator) []*MachinePoolSecurityGroupFilter { + list := []*MachinePoolSecurityGroupFilter{} + for iterator.ReadArray() { + item := ReadMachinePoolSecurityGroupFilter(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_type.go b/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_type.go new file mode 100644 index 00000000..fc3eaa91 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_type.go @@ -0,0 +1,181 @@ +/* +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 + +// MachinePoolSecurityGroupFilter represents the values of the 'machine_pool_security_group_filter' type. +// +// Security Group Filter object, containing name of the filter tag and value of the filter tag +type MachinePoolSecurityGroupFilter struct { + bitmap_ uint32 + name string + value string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *MachinePoolSecurityGroupFilter) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *MachinePoolSecurityGroupFilter) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *MachinePoolSecurityGroupFilter) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *MachinePoolSecurityGroupFilter) Value() string { + if o != nil && o.bitmap_&2 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +func (o *MachinePoolSecurityGroupFilter) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.value + } + return +} + +// MachinePoolSecurityGroupFilterListKind is the name of the type used to represent list of objects of +// type 'machine_pool_security_group_filter'. +const MachinePoolSecurityGroupFilterListKind = "MachinePoolSecurityGroupFilterList" + +// MachinePoolSecurityGroupFilterListLinkKind is the name of the type used to represent links to list +// of objects of type 'machine_pool_security_group_filter'. +const MachinePoolSecurityGroupFilterListLinkKind = "MachinePoolSecurityGroupFilterListLink" + +// MachinePoolSecurityGroupFilterNilKind is the name of the type used to nil lists of objects of +// type 'machine_pool_security_group_filter'. +const MachinePoolSecurityGroupFilterListNilKind = "MachinePoolSecurityGroupFilterListNil" + +// MachinePoolSecurityGroupFilterList is a list of values of the 'machine_pool_security_group_filter' type. +type MachinePoolSecurityGroupFilterList struct { + href string + link bool + items []*MachinePoolSecurityGroupFilter +} + +// Len returns the length of the list. +func (l *MachinePoolSecurityGroupFilterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *MachinePoolSecurityGroupFilterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *MachinePoolSecurityGroupFilterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *MachinePoolSecurityGroupFilterList) SetItems(items []*MachinePoolSecurityGroupFilter) { + l.items = items +} + +// Items returns the items of the list. +func (l *MachinePoolSecurityGroupFilterList) Items() []*MachinePoolSecurityGroupFilter { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *MachinePoolSecurityGroupFilterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *MachinePoolSecurityGroupFilterList) Get(i int) *MachinePoolSecurityGroupFilter { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *MachinePoolSecurityGroupFilterList) Slice() []*MachinePoolSecurityGroupFilter { + var slice []*MachinePoolSecurityGroupFilter + if l == nil { + slice = make([]*MachinePoolSecurityGroupFilter, 0) + } else { + slice = make([]*MachinePoolSecurityGroupFilter, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *MachinePoolSecurityGroupFilterList) Each(f func(item *MachinePoolSecurityGroupFilter) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *MachinePoolSecurityGroupFilterList) Range(f func(index int, item *MachinePoolSecurityGroupFilter) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_type_json.go b/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_type_json.go new file mode 100644 index 00000000..76c1544c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_pool_security_group_filter_type_json.go @@ -0,0 +1,99 @@ +/* +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" +) + +// MarshalMachinePoolSecurityGroupFilter writes a value of the 'machine_pool_security_group_filter' type to the given writer. +func MarshalMachinePoolSecurityGroupFilter(object *MachinePoolSecurityGroupFilter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachinePoolSecurityGroupFilter(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachinePoolSecurityGroupFilter writes a value of the 'machine_pool_security_group_filter' type to the given stream. +func WriteMachinePoolSecurityGroupFilter(object *MachinePoolSecurityGroupFilter, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalMachinePoolSecurityGroupFilter reads a value of the 'machine_pool_security_group_filter' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalMachinePoolSecurityGroupFilter(source interface{}) (object *MachinePoolSecurityGroupFilter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadMachinePoolSecurityGroupFilter(iterator) + err = iterator.Error + return +} + +// ReadMachinePoolSecurityGroupFilter reads a value of the 'machine_pool_security_group_filter' type from the given iterator. +func ReadMachinePoolSecurityGroupFilter(iterator *jsoniter.Iterator) *MachinePoolSecurityGroupFilter { + object := &MachinePoolSecurityGroupFilter{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/machine_type_builder.go b/clientapi/arohcp/v1alpha1/machine_type_builder.go new file mode 100644 index 00000000..df7a6d4f --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_type_builder.go @@ -0,0 +1,253 @@ +/* +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 v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" // MachineTypeBuilder contains the data and logic needed to build 'machine_type' objects. +// Machine type. +type MachineTypeBuilder struct { + bitmap_ uint32 + id string + href string + cpu *ValueBuilder + architecture ProcessorType + category MachineTypeCategory + cloudProvider *v1.CloudProviderBuilder + genericName string + memory *ValueBuilder + name string + size MachineTypeSize + ccsOnly bool +} + +// NewMachineType creates a new builder of 'machine_type' objects. +func NewMachineType() *MachineTypeBuilder { + return &MachineTypeBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *MachineTypeBuilder) Link(value bool) *MachineTypeBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *MachineTypeBuilder) ID(value string) *MachineTypeBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *MachineTypeBuilder) HREF(value string) *MachineTypeBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *MachineTypeBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CCSOnly sets the value of the 'CCS_only' attribute to the given value. +func (b *MachineTypeBuilder) CCSOnly(value bool) *MachineTypeBuilder { + b.ccsOnly = value + b.bitmap_ |= 8 + return b +} + +// CPU sets the value of the 'CPU' attribute to the given value. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +func (b *MachineTypeBuilder) CPU(value *ValueBuilder) *MachineTypeBuilder { + b.cpu = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + 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_ |= 64 + return b +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +// +// Cloud provider. +func (b *MachineTypeBuilder) CloudProvider(value *v1.CloudProviderBuilder) *MachineTypeBuilder { + b.cloudProvider = value + if value != nil { + b.bitmap_ |= 128 + } else { + 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_ |= 256 + return b +} + +// Memory sets the value of the 'memory' attribute to the given value. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +func (b *MachineTypeBuilder) Memory(value *ValueBuilder) *MachineTypeBuilder { + b.memory = value + if value != nil { + b.bitmap_ |= 512 + } else { + 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_ |= 1024 + return b +} + +// Size sets the value of the 'size' attribute to the given value. +// +// Machine type size. +func (b *MachineTypeBuilder) Size(value MachineTypeSize) *MachineTypeBuilder { + b.size = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *MachineTypeBuilder) Copy(object *MachineType) *MachineTypeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.ccsOnly = object.ccsOnly + if object.cpu != nil { + b.cpu = NewValue().Copy(object.cpu) + } else { + b.cpu = nil + } + b.architecture = object.architecture + b.category = object.category + if object.cloudProvider != nil { + b.cloudProvider = v1.NewCloudProvider().Copy(object.cloudProvider) + } else { + b.cloudProvider = nil + } + b.genericName = object.genericName + if object.memory != nil { + b.memory = NewValue().Copy(object.memory) + } else { + b.memory = nil + } + b.name = object.name + b.size = object.size + return b +} + +// Build creates a 'machine_type' object using the configuration stored in the builder. +func (b *MachineTypeBuilder) Build() (object *MachineType, err error) { + object = new(MachineType) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.ccsOnly = b.ccsOnly + if b.cpu != nil { + object.cpu, err = b.cpu.Build() + if err != nil { + return + } + } + object.architecture = b.architecture + object.category = b.category + if b.cloudProvider != nil { + object.cloudProvider, err = b.cloudProvider.Build() + if err != nil { + return + } + } + object.genericName = b.genericName + if b.memory != nil { + object.memory, err = b.memory.Build() + if err != nil { + return + } + } + object.name = b.name + object.size = b.size + return +} diff --git a/clientapi/arohcp/v1alpha1/machine_type_category_list_type_json.go b/clientapi/arohcp/v1alpha1/machine_type_category_list_type_json.go new file mode 100644 index 00000000..27597dc7 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_type_category_list_type_json.go @@ -0,0 +1,76 @@ +/* +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" +) + +// MarshalMachineTypeCategoryList writes a list of values of the 'machine_type_category' type to +// the given writer. +func MarshalMachineTypeCategoryList(list []MachineTypeCategory, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachineTypeCategoryList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachineTypeCategoryList writes a list of value of the 'machine_type_category' type to +// the given stream. +func WriteMachineTypeCategoryList(list []MachineTypeCategory, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalMachineTypeCategoryList reads a list of values of the 'machine_type_category' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMachineTypeCategoryList(source interface{}) (items []MachineTypeCategory, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMachineTypeCategoryList(iterator) + err = iterator.Error + return +} + +// ReadMachineTypeCategoryList reads list of values of the ”machine_type_category' type from +// the given iterator. +func ReadMachineTypeCategoryList(iterator *jsoniter.Iterator) []MachineTypeCategory { + list := []MachineTypeCategory{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := MachineTypeCategory(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/machine_type_category_type.go b/clientapi/arohcp/v1alpha1/machine_type_category_type.go new file mode 100644 index 00000000..75ddddf1 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_type_category_type.go @@ -0,0 +1,34 @@ +/* +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 + +// MachineTypeCategory represents the values of the 'machine_type_category' enumerated type. +type MachineTypeCategory string + +const ( + // Accelerated Computing machine type. + MachineTypeCategoryAcceleratedComputing MachineTypeCategory = "accelerated_computing" + // Compute Optimized machine type. + MachineTypeCategoryComputeOptimized MachineTypeCategory = "compute_optimized" + // General Purpose machine type. + MachineTypeCategoryGeneralPurpose MachineTypeCategory = "general_purpose" + // Memory Optimized machine type. + MachineTypeCategoryMemoryOptimized MachineTypeCategory = "memory_optimized" +) diff --git a/clientapi/arohcp/v1alpha1/machine_type_list_builder.go b/clientapi/arohcp/v1alpha1/machine_type_list_builder.go new file mode 100644 index 00000000..afac36d5 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_type_list_builder.go @@ -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 + +// MachineTypeListBuilder contains the data and logic needed to build +// 'machine_type' objects. +type MachineTypeListBuilder struct { + items []*MachineTypeBuilder +} + +// NewMachineTypeList creates a new builder of 'machine_type' objects. +func NewMachineTypeList() *MachineTypeListBuilder { + return new(MachineTypeListBuilder) +} + +// Items sets the items of the list. +func (b *MachineTypeListBuilder) Items(values ...*MachineTypeBuilder) *MachineTypeListBuilder { + b.items = make([]*MachineTypeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *MachineTypeListBuilder) 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 *MachineTypeListBuilder) Copy(list *MachineTypeList) *MachineTypeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*MachineTypeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewMachineType().Copy(v) + } + } + return b +} + +// Build creates a list of 'machine_type' objects using the +// configuration stored in the builder. +func (b *MachineTypeListBuilder) Build() (list *MachineTypeList, err error) { + items := make([]*MachineType, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(MachineTypeList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/machine_type_list_type_json.go b/clientapi/arohcp/v1alpha1/machine_type_list_type_json.go new file mode 100644 index 00000000..5979b868 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_type_list_type_json.go @@ -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" +) + +// MarshalMachineTypeList writes a list of values of the 'machine_type' type to +// the given writer. +func MarshalMachineTypeList(list []*MachineType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachineTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachineTypeList writes a list of value of the 'machine_type' type to +// the given stream. +func WriteMachineTypeList(list []*MachineType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteMachineType(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalMachineTypeList reads a list of values of the 'machine_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMachineTypeList(source interface{}) (items []*MachineType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMachineTypeList(iterator) + err = iterator.Error + return +} + +// ReadMachineTypeList reads list of values of the ”machine_type' type from +// the given iterator. +func ReadMachineTypeList(iterator *jsoniter.Iterator) []*MachineType { + list := []*MachineType{} + for iterator.ReadArray() { + item := ReadMachineType(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/machine_type_size_list_type_json.go b/clientapi/arohcp/v1alpha1/machine_type_size_list_type_json.go new file mode 100644 index 00000000..b85cda99 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_type_size_list_type_json.go @@ -0,0 +1,76 @@ +/* +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" +) + +// MarshalMachineTypeSizeList writes a list of values of the 'machine_type_size' type to +// the given writer. +func MarshalMachineTypeSizeList(list []MachineTypeSize, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachineTypeSizeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachineTypeSizeList writes a list of value of the 'machine_type_size' type to +// the given stream. +func WriteMachineTypeSizeList(list []MachineTypeSize, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalMachineTypeSizeList reads a list of values of the 'machine_type_size' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMachineTypeSizeList(source interface{}) (items []MachineTypeSize, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMachineTypeSizeList(iterator) + err = iterator.Error + return +} + +// ReadMachineTypeSizeList reads list of values of the ”machine_type_size' type from +// the given iterator. +func ReadMachineTypeSizeList(iterator *jsoniter.Iterator) []MachineTypeSize { + list := []MachineTypeSize{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := MachineTypeSize(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/machine_type_size_type.go b/clientapi/arohcp/v1alpha1/machine_type_size_type.go new file mode 100644 index 00000000..c1992f0c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_type_size_type.go @@ -0,0 +1,32 @@ +/* +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 + +// MachineTypeSize represents the values of the 'machine_type_size' enumerated type. +type MachineTypeSize string + +const ( + // Large machine type (e.g. c5.4xlarge, custom-16-65536) + MachineTypeSizeLarge MachineTypeSize = "large" + // Medium machine type (e.g. r5.2xlarge, custom-8-32768) + MachineTypeSizeMedium MachineTypeSize = "medium" + // Small machine type (e.g. m5.xlarge, custom-4-16384) + MachineTypeSizeSmall MachineTypeSize = "small" +) diff --git a/clientapi/arohcp/v1alpha1/machine_type_type.go b/clientapi/arohcp/v1alpha1/machine_type_type.go new file mode 100644 index 00000000..1e1c40d8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_type_type.go @@ -0,0 +1,465 @@ +/* +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 v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" + +// MachineTypeKind is the name of the type used to represent objects +// of type 'machine_type'. +const MachineTypeKind = "MachineType" + +// MachineTypeLinkKind is the name of the type used to represent links +// to objects of type 'machine_type'. +const MachineTypeLinkKind = "MachineTypeLink" + +// MachineTypeNilKind is the name of the type used to nil references +// to objects of type 'machine_type'. +const MachineTypeNilKind = "MachineTypeNil" + +// MachineType represents the values of the 'machine_type' type. +// +// Machine type. +type MachineType struct { + bitmap_ uint32 + id string + href string + cpu *Value + architecture ProcessorType + category MachineTypeCategory + cloudProvider *v1.CloudProvider + genericName string + memory *Value + name string + size MachineTypeSize + ccsOnly bool +} + +// Kind returns the name of the type of the object. +func (o *MachineType) Kind() string { + if o == nil { + return MachineTypeNilKind + } + if o.bitmap_&1 != 0 { + return MachineTypeLinkKind + } + return MachineTypeKind +} + +// Link returns true if this is a link. +func (o *MachineType) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *MachineType) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *MachineType) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *MachineType) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *MachineType) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *MachineType) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CCSOnly returns the value of the 'CCS_only' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// 'true' if the instance type is supported only for CCS clusters, 'false' otherwise. +func (o *MachineType) CCSOnly() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.ccsOnly + } + return false +} + +// GetCCSOnly returns the value of the 'CCS_only' attribute and +// a flag indicating if the attribute has a value. +// +// 'true' if the instance type is supported only for CCS clusters, 'false' otherwise. +func (o *MachineType) GetCCSOnly() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.ccsOnly + } + return +} + +// CPU returns the value of the 'CPU' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The amount of cpu's of the machine type. +func (o *MachineType) CPU() *Value { + if o != nil && o.bitmap_&16 != 0 { + return o.cpu + } + return nil +} + +// GetCPU returns the value of the 'CPU' attribute and +// a flag indicating if the attribute has a value. +// +// The amount of cpu's of the machine type. +func (o *MachineType) GetCPU() (value *Value, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.cpu + } + 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_&64 != 0 { + return o.category + } + return MachineTypeCategory("") +} + +// GetCategory returns the value of the 'category' attribute and +// a flag indicating if the attribute has a value. +// +// The category which the machine type is suitable for. +func (o *MachineType) GetCategory() (value MachineTypeCategory, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.category + } + return +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the cloud provider that the machine type belongs to. +func (o *MachineType) CloudProvider() *v1.CloudProvider { + if o != nil && o.bitmap_&128 != 0 { + return o.cloudProvider + } + return nil +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the cloud provider that the machine type belongs to. +func (o *MachineType) GetCloudProvider() (value *v1.CloudProvider, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// GenericName returns the value of the 'generic_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Generic name for quota purposes, for example `highmem-4`. +// Cloud provider agnostic - many values are shared between "similar" +// 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_&256 != 0 { + return o.genericName + } + return "" +} + +// GetGenericName returns the value of the 'generic_name' attribute and +// a flag indicating if the attribute has a value. +// +// Generic name for quota purposes, for example `highmem-4`. +// Cloud provider agnostic - many values are shared between "similar" +// 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_&256 != 0 + if ok { + value = o.genericName + } + return +} + +// Memory returns the value of the 'memory' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The amount of memory of the machine type. +func (o *MachineType) Memory() *Value { + if o != nil && o.bitmap_&512 != 0 { + return o.memory + } + return nil +} + +// GetMemory returns the value of the 'memory' attribute and +// a flag indicating if the attribute has a value. +// +// The amount of memory of the machine type. +func (o *MachineType) GetMemory() (value *Value, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.memory + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Human friendly identifier of the machine type, for example `r5.xlarge - Memory Optimized`. +func (o *MachineType) Name() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// 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_&1024 != 0 + if ok { + value = o.name + } + return +} + +// Size returns the value of the 'size' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The size of the machine type. +func (o *MachineType) Size() MachineTypeSize { + if o != nil && o.bitmap_&2048 != 0 { + return o.size + } + return MachineTypeSize("") +} + +// GetSize returns the value of the 'size' attribute and +// a flag indicating if the attribute has a value. +// +// The size of the machine type. +func (o *MachineType) GetSize() (value MachineTypeSize, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.size + } + return +} + +// MachineTypeListKind is the name of the type used to represent list of objects of +// type 'machine_type'. +const MachineTypeListKind = "MachineTypeList" + +// MachineTypeListLinkKind is the name of the type used to represent links to list +// of objects of type 'machine_type'. +const MachineTypeListLinkKind = "MachineTypeListLink" + +// MachineTypeNilKind is the name of the type used to nil lists of objects of +// type 'machine_type'. +const MachineTypeListNilKind = "MachineTypeListNil" + +// MachineTypeList is a list of values of the 'machine_type' type. +type MachineTypeList struct { + href string + link bool + items []*MachineType +} + +// Kind returns the name of the type of the object. +func (l *MachineTypeList) Kind() string { + if l == nil { + return MachineTypeListNilKind + } + if l.link { + return MachineTypeListLinkKind + } + return MachineTypeListKind +} + +// Link returns true iif this is a link. +func (l *MachineTypeList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *MachineTypeList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *MachineTypeList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *MachineTypeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *MachineTypeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *MachineTypeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *MachineTypeList) SetItems(items []*MachineType) { + l.items = items +} + +// Items returns the items of the list. +func (l *MachineTypeList) Items() []*MachineType { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *MachineTypeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *MachineTypeList) Get(i int) *MachineType { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *MachineTypeList) Slice() []*MachineType { + var slice []*MachineType + if l == nil { + slice = make([]*MachineType, 0) + } else { + slice = make([]*MachineType, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *MachineTypeList) Each(f func(item *MachineType) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *MachineTypeList) Range(f func(index int, item *MachineType) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/machine_type_type_json.go b/clientapi/arohcp/v1alpha1/machine_type_type_json.go new file mode 100644 index 00000000..3de735b0 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/machine_type_type_json.go @@ -0,0 +1,228 @@ +/* +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" + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMachineType writes a value of the 'machine_type' type to the given writer. +func MarshalMachineType(object *MachineType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachineType(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachineType writes a value of the 'machine_type' type to the given stream. +func WriteMachineType(object *MachineType, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(MachineTypeLinkKind) + } else { + stream.WriteString(MachineTypeKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ccs_only") + stream.WriteBool(object.ccsOnly) + count++ + } + present_ = object.bitmap_&16 != 0 && object.cpu != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cpu") + WriteValue(object.cpu, 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() + } + stream.WriteObjectField("category") + stream.WriteString(string(object.category)) + count++ + } + present_ = object.bitmap_&128 != 0 && object.cloudProvider != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + v1.WriteCloudProvider(object.cloudProvider, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("generic_name") + stream.WriteString(object.genericName) + count++ + } + present_ = object.bitmap_&512 != 0 && object.memory != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("memory") + WriteValue(object.memory, stream) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("size") + stream.WriteString(string(object.size)) + } + stream.WriteObjectEnd() +} + +// UnmarshalMachineType reads a value of the 'machine_type' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalMachineType(source interface{}) (object *MachineType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadMachineType(iterator) + err = iterator.Error + return +} + +// ReadMachineType reads a value of the 'machine_type' type from the given iterator. +func ReadMachineType(iterator *jsoniter.Iterator) *MachineType { + object := &MachineType{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == MachineTypeLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "ccs_only": + value := iterator.ReadBool() + object.ccsOnly = value + object.bitmap_ |= 8 + case "cpu": + 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_ |= 64 + case "cloud_provider": + value := v1.ReadCloudProvider(iterator) + object.cloudProvider = value + object.bitmap_ |= 128 + case "generic_name": + value := iterator.ReadString() + object.genericName = value + object.bitmap_ |= 256 + case "memory": + value := ReadValue(iterator) + object.memory = value + object.bitmap_ |= 512 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1024 + case "size": + text := iterator.ReadString() + value := MachineTypeSize(text) + object.size = value + object.bitmap_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/managed_service_builder.go b/clientapi/arohcp/v1alpha1/managed_service_builder.go new file mode 100644 index 00000000..76fc7aba --- /dev/null +++ b/clientapi/arohcp/v1alpha1/managed_service_builder.go @@ -0,0 +1,63 @@ +/* +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 + +// ManagedServiceBuilder contains the data and logic needed to build 'managed_service' objects. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type ManagedServiceBuilder struct { + bitmap_ uint32 + enabled bool +} + +// NewManagedService creates a new builder of 'managed_service' objects. +func NewManagedService() *ManagedServiceBuilder { + return &ManagedServiceBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ManagedServiceBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *ManagedServiceBuilder) Enabled(value bool) *ManagedServiceBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ManagedServiceBuilder) Copy(object *ManagedService) *ManagedServiceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + return b +} + +// Build creates a 'managed_service' object using the configuration stored in the builder. +func (b *ManagedServiceBuilder) Build() (object *ManagedService, err error) { + object = new(ManagedService) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + return +} diff --git a/clientapi/arohcp/v1alpha1/managed_service_list_builder.go b/clientapi/arohcp/v1alpha1/managed_service_list_builder.go new file mode 100644 index 00000000..fe0a7dca --- /dev/null +++ b/clientapi/arohcp/v1alpha1/managed_service_list_builder.go @@ -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 + +// ManagedServiceListBuilder contains the data and logic needed to build +// 'managed_service' objects. +type ManagedServiceListBuilder struct { + items []*ManagedServiceBuilder +} + +// NewManagedServiceList creates a new builder of 'managed_service' objects. +func NewManagedServiceList() *ManagedServiceListBuilder { + return new(ManagedServiceListBuilder) +} + +// Items sets the items of the list. +func (b *ManagedServiceListBuilder) Items(values ...*ManagedServiceBuilder) *ManagedServiceListBuilder { + b.items = make([]*ManagedServiceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ManagedServiceListBuilder) 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 *ManagedServiceListBuilder) Copy(list *ManagedServiceList) *ManagedServiceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ManagedServiceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewManagedService().Copy(v) + } + } + return b +} + +// Build creates a list of 'managed_service' objects using the +// configuration stored in the builder. +func (b *ManagedServiceListBuilder) Build() (list *ManagedServiceList, err error) { + items := make([]*ManagedService, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ManagedServiceList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/managed_service_list_type_json.go b/clientapi/arohcp/v1alpha1/managed_service_list_type_json.go new file mode 100644 index 00000000..3c2670c3 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/managed_service_list_type_json.go @@ -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" +) + +// MarshalManagedServiceList writes a list of values of the 'managed_service' type to +// the given writer. +func MarshalManagedServiceList(list []*ManagedService, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManagedServiceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManagedServiceList writes a list of value of the 'managed_service' type to +// the given stream. +func WriteManagedServiceList(list []*ManagedService, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteManagedService(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalManagedServiceList reads a list of values of the 'managed_service' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalManagedServiceList(source interface{}) (items []*ManagedService, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadManagedServiceList(iterator) + err = iterator.Error + return +} + +// ReadManagedServiceList reads list of values of the ”managed_service' type from +// the given iterator. +func ReadManagedServiceList(iterator *jsoniter.Iterator) []*ManagedService { + list := []*ManagedService{} + for iterator.ReadArray() { + item := ReadManagedService(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/managed_service_type.go b/clientapi/arohcp/v1alpha1/managed_service_type.go new file mode 100644 index 00000000..718531db --- /dev/null +++ b/clientapi/arohcp/v1alpha1/managed_service_type.go @@ -0,0 +1,169 @@ +/* +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 + +// ManagedService represents the values of the 'managed_service' type. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type ManagedService struct { + bitmap_ uint32 + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ManagedService) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates whether the cluster belongs to a managed service +// This should only be set by the "Managed Service" service. +// clusters with this set can only be modified by the "Managed Service" service. +func (o *ManagedService) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates whether the cluster belongs to a managed service +// This should only be set by the "Managed Service" service. +// clusters with this set can only be modified by the "Managed Service" service. +func (o *ManagedService) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// ManagedServiceListKind is the name of the type used to represent list of objects of +// type 'managed_service'. +const ManagedServiceListKind = "ManagedServiceList" + +// ManagedServiceListLinkKind is the name of the type used to represent links to list +// of objects of type 'managed_service'. +const ManagedServiceListLinkKind = "ManagedServiceListLink" + +// ManagedServiceNilKind is the name of the type used to nil lists of objects of +// type 'managed_service'. +const ManagedServiceListNilKind = "ManagedServiceListNil" + +// ManagedServiceList is a list of values of the 'managed_service' type. +type ManagedServiceList struct { + href string + link bool + items []*ManagedService +} + +// Len returns the length of the list. +func (l *ManagedServiceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ManagedServiceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ManagedServiceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ManagedServiceList) SetItems(items []*ManagedService) { + l.items = items +} + +// Items returns the items of the list. +func (l *ManagedServiceList) Items() []*ManagedService { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ManagedServiceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ManagedServiceList) Get(i int) *ManagedService { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ManagedServiceList) Slice() []*ManagedService { + var slice []*ManagedService + if l == nil { + slice = make([]*ManagedService, 0) + } else { + slice = make([]*ManagedService, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ManagedServiceList) Each(f func(item *ManagedService) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ManagedServiceList) Range(f func(index int, item *ManagedService) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/managed_service_type_json.go b/clientapi/arohcp/v1alpha1/managed_service_type_json.go new file mode 100644 index 00000000..a0596633 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/managed_service_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalManagedService writes a value of the 'managed_service' type to the given writer. +func MarshalManagedService(object *ManagedService, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManagedService(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManagedService writes a value of the 'managed_service' type to the given stream. +func WriteManagedService(object *ManagedService, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalManagedService reads a value of the 'managed_service' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalManagedService(source interface{}) (object *ManagedService, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadManagedService(iterator) + err = iterator.Error + return +} + +// ReadManagedService reads a value of the 'managed_service' type from the given iterator. +func ReadManagedService(iterator *jsoniter.Iterator) *ManagedService { + object := &ManagedService{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/metadata_reader.go b/clientapi/arohcp/v1alpha1/metadata_reader.go new file mode 100644 index 00000000..5878574d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/metadata_reader.go @@ -0,0 +1,76 @@ +/* +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" +) + +// MarshalMetadata writes a value of the metadata type to the given target, which +// can be a writer or a JSON encoder. +func MarshalMetadata(object *Metadata, writer io.Writer) error { + stream := helpers.NewStream(writer) + writeMetadata(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} +func writeMetadata(object *Metadata, stream *jsoniter.Stream) { + stream.WriteObjectStart() + if object.bitmap_&1 != 0 { + stream.WriteObjectField("server_version") + stream.WriteString(object.serverVersion) + } + stream.WriteObjectEnd() +} + +// UnmarshalMetadata reads a value of the metadata type from the given source, which +// which can be a reader, a slice of byte or a string. +func UnmarshalMetadata(source interface{}) (object *Metadata, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = readMetadata(iterator) + err = iterator.Error + return +} +func readMetadata(iterator *jsoniter.Iterator) *Metadata { + object := &Metadata{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "server_version": + object.serverVersion = iterator.ReadString() + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/metadata_type.go b/clientapi/arohcp/v1alpha1/metadata_type.go new file mode 100644 index 00000000..1b3df173 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/metadata_type.go @@ -0,0 +1,44 @@ +/* +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 + +// Metadata contains the version metadata. +type Metadata struct { + bitmap_ uint32 + serverVersion string +} + +// ServerVersion returns the version of the server. +func (m *Metadata) ServerVersion() string { + if m != nil && m.bitmap_&1 != 0 { + return m.serverVersion + } + return "" +} + +// GetServerVersion returns the value of the server version and a flag indicating if +// the attribute has a value. +func (m *Metadata) GetServerVersion() (value string, ok bool) { + ok = m != nil && m.bitmap_&1 != 0 + if ok { + value = m.serverVersion + } + return +} diff --git a/clientapi/arohcp/v1alpha1/network_builder.go b/clientapi/arohcp/v1alpha1/network_builder.go new file mode 100644 index 00000000..5f87cd32 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/network_builder.go @@ -0,0 +1,103 @@ +/* +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 + +// NetworkBuilder contains the data and logic needed to build 'network' objects. +// +// Network configuration of a cluster. +type NetworkBuilder struct { + bitmap_ uint32 + hostPrefix int + machineCIDR string + podCIDR string + serviceCIDR string + type_ string +} + +// NewNetwork creates a new builder of 'network' objects. +func NewNetwork() *NetworkBuilder { + return &NetworkBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NetworkBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// HostPrefix sets the value of the 'host_prefix' attribute to the given value. +func (b *NetworkBuilder) HostPrefix(value int) *NetworkBuilder { + b.hostPrefix = value + b.bitmap_ |= 1 + return b +} + +// MachineCIDR sets the value of the 'machine_CIDR' attribute to the given value. +func (b *NetworkBuilder) MachineCIDR(value string) *NetworkBuilder { + b.machineCIDR = value + b.bitmap_ |= 2 + return b +} + +// PodCIDR sets the value of the 'pod_CIDR' attribute to the given value. +func (b *NetworkBuilder) PodCIDR(value string) *NetworkBuilder { + b.podCIDR = value + b.bitmap_ |= 4 + return b +} + +// ServiceCIDR sets the value of the 'service_CIDR' attribute to the given value. +func (b *NetworkBuilder) ServiceCIDR(value string) *NetworkBuilder { + b.serviceCIDR = value + b.bitmap_ |= 8 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *NetworkBuilder) Type(value string) *NetworkBuilder { + b.type_ = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NetworkBuilder) Copy(object *Network) *NetworkBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.hostPrefix = object.hostPrefix + b.machineCIDR = object.machineCIDR + b.podCIDR = object.podCIDR + b.serviceCIDR = object.serviceCIDR + b.type_ = object.type_ + return b +} + +// Build creates a 'network' object using the configuration stored in the builder. +func (b *NetworkBuilder) Build() (object *Network, err error) { + object = new(Network) + object.bitmap_ = b.bitmap_ + object.hostPrefix = b.hostPrefix + object.machineCIDR = b.machineCIDR + object.podCIDR = b.podCIDR + object.serviceCIDR = b.serviceCIDR + object.type_ = b.type_ + return +} diff --git a/clientapi/arohcp/v1alpha1/network_list_builder.go b/clientapi/arohcp/v1alpha1/network_list_builder.go new file mode 100644 index 00000000..597548e6 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/network_list_builder.go @@ -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 + +// NetworkListBuilder contains the data and logic needed to build +// 'network' objects. +type NetworkListBuilder struct { + items []*NetworkBuilder +} + +// NewNetworkList creates a new builder of 'network' objects. +func NewNetworkList() *NetworkListBuilder { + return new(NetworkListBuilder) +} + +// Items sets the items of the list. +func (b *NetworkListBuilder) Items(values ...*NetworkBuilder) *NetworkListBuilder { + b.items = make([]*NetworkBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NetworkListBuilder) 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 *NetworkListBuilder) Copy(list *NetworkList) *NetworkListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NetworkBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNetwork().Copy(v) + } + } + return b +} + +// Build creates a list of 'network' objects using the +// configuration stored in the builder. +func (b *NetworkListBuilder) Build() (list *NetworkList, err error) { + items := make([]*Network, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NetworkList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/network_list_type_json.go b/clientapi/arohcp/v1alpha1/network_list_type_json.go new file mode 100644 index 00000000..f199ca00 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/network_list_type_json.go @@ -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" +) + +// MarshalNetworkList writes a list of values of the 'network' type to +// the given writer. +func MarshalNetworkList(list []*Network, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNetworkList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNetworkList writes a list of value of the 'network' type to +// the given stream. +func WriteNetworkList(list []*Network, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNetwork(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNetworkList reads a list of values of the 'network' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNetworkList(source interface{}) (items []*Network, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNetworkList(iterator) + err = iterator.Error + return +} + +// ReadNetworkList reads list of values of the ”network' type from +// the given iterator. +func ReadNetworkList(iterator *jsoniter.Iterator) []*Network { + list := []*Network{} + for iterator.ReadArray() { + item := ReadNetwork(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/network_type.go b/clientapi/arohcp/v1alpha1/network_type.go new file mode 100644 index 00000000..5a6eef86 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/network_type.go @@ -0,0 +1,261 @@ +/* +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 + +// Network represents the values of the 'network' type. +// +// Network configuration of a cluster. +type Network struct { + bitmap_ uint32 + hostPrefix int + machineCIDR string + podCIDR string + serviceCIDR string + type_ string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Network) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// HostPrefix returns the value of the 'host_prefix' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Network host prefix which is defaulted to `23` if not specified. +func (o *Network) HostPrefix() int { + if o != nil && o.bitmap_&1 != 0 { + return o.hostPrefix + } + return 0 +} + +// GetHostPrefix returns the value of the 'host_prefix' attribute and +// a flag indicating if the attribute has a value. +// +// Network host prefix which is defaulted to `23` if not specified. +func (o *Network) GetHostPrefix() (value int, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.hostPrefix + } + return +} + +// MachineCIDR returns the value of the 'machine_CIDR' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// IP address block from which to assign machine IP addresses, for example `10.0.0.0/16`. +func (o *Network) MachineCIDR() string { + if o != nil && o.bitmap_&2 != 0 { + return o.machineCIDR + } + return "" +} + +// GetMachineCIDR returns the value of the 'machine_CIDR' attribute and +// a flag indicating if the attribute has a value. +// +// IP address block from which to assign machine IP addresses, for example `10.0.0.0/16`. +func (o *Network) GetMachineCIDR() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.machineCIDR + } + return +} + +// PodCIDR returns the value of the 'pod_CIDR' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// IP address block from which to assign pod IP addresses, for example `10.128.0.0/14`. +func (o *Network) PodCIDR() string { + if o != nil && o.bitmap_&4 != 0 { + return o.podCIDR + } + return "" +} + +// GetPodCIDR returns the value of the 'pod_CIDR' attribute and +// a flag indicating if the attribute has a value. +// +// IP address block from which to assign pod IP addresses, for example `10.128.0.0/14`. +func (o *Network) GetPodCIDR() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.podCIDR + } + return +} + +// ServiceCIDR returns the value of the 'service_CIDR' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// IP address block from which to assign service IP addresses, for example `172.30.0.0/16`. +func (o *Network) ServiceCIDR() string { + if o != nil && o.bitmap_&8 != 0 { + return o.serviceCIDR + } + return "" +} + +// GetServiceCIDR returns the value of the 'service_CIDR' attribute and +// a flag indicating if the attribute has a value. +// +// IP address block from which to assign service IP addresses, for example `172.30.0.0/16`. +func (o *Network) GetServiceCIDR() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.serviceCIDR + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The main controller responsible for rendering the core networking components. +func (o *Network) Type() string { + if o != nil && o.bitmap_&16 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// The main controller responsible for rendering the core networking components. +func (o *Network) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.type_ + } + return +} + +// NetworkListKind is the name of the type used to represent list of objects of +// type 'network'. +const NetworkListKind = "NetworkList" + +// NetworkListLinkKind is the name of the type used to represent links to list +// of objects of type 'network'. +const NetworkListLinkKind = "NetworkListLink" + +// NetworkNilKind is the name of the type used to nil lists of objects of +// type 'network'. +const NetworkListNilKind = "NetworkListNil" + +// NetworkList is a list of values of the 'network' type. +type NetworkList struct { + href string + link bool + items []*Network +} + +// Len returns the length of the list. +func (l *NetworkList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NetworkList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NetworkList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NetworkList) SetItems(items []*Network) { + l.items = items +} + +// Items returns the items of the list. +func (l *NetworkList) Items() []*Network { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NetworkList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NetworkList) Get(i int) *Network { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NetworkList) Slice() []*Network { + var slice []*Network + if l == nil { + slice = make([]*Network, 0) + } else { + slice = make([]*Network, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NetworkList) Each(f func(item *Network) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NetworkList) Range(f func(index int, item *Network) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/network_type_json.go b/clientapi/arohcp/v1alpha1/network_type_json.go new file mode 100644 index 00000000..7fc5ca42 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/network_type_json.go @@ -0,0 +1,138 @@ +/* +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" +) + +// MarshalNetwork writes a value of the 'network' type to the given writer. +func MarshalNetwork(object *Network, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNetwork(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNetwork writes a value of the 'network' type to the given stream. +func WriteNetwork(object *Network, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("host_prefix") + stream.WriteInt(object.hostPrefix) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("machine_cidr") + stream.WriteString(object.machineCIDR) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("pod_cidr") + stream.WriteString(object.podCIDR) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_cidr") + stream.WriteString(object.serviceCIDR) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalNetwork reads a value of the 'network' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNetwork(source interface{}) (object *Network, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNetwork(iterator) + err = iterator.Error + return +} + +// ReadNetwork reads a value of the 'network' type from the given iterator. +func ReadNetwork(iterator *jsoniter.Iterator) *Network { + object := &Network{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "host_prefix": + value := iterator.ReadInt() + object.hostPrefix = value + object.bitmap_ |= 1 + case "machine_cidr": + value := iterator.ReadString() + object.machineCIDR = value + object.bitmap_ |= 2 + case "pod_cidr": + value := iterator.ReadString() + object.podCIDR = value + object.bitmap_ |= 4 + case "service_cidr": + value := iterator.ReadString() + object.serviceCIDR = value + object.bitmap_ |= 8 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_autoscaling_builder.go b/clientapi/arohcp/v1alpha1/node_pool_autoscaling_builder.go new file mode 100644 index 00000000..353f95c6 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_autoscaling_builder.go @@ -0,0 +1,99 @@ +/* +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 + +// NodePoolAutoscalingBuilder contains the data and logic needed to build 'node_pool_autoscaling' objects. +// +// Representation of a autoscaling in a node pool. +type NodePoolAutoscalingBuilder struct { + bitmap_ uint32 + id string + href string + maxReplica int + minReplica int +} + +// NewNodePoolAutoscaling creates a new builder of 'node_pool_autoscaling' objects. +func NewNodePoolAutoscaling() *NodePoolAutoscalingBuilder { + return &NodePoolAutoscalingBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *NodePoolAutoscalingBuilder) Link(value bool) *NodePoolAutoscalingBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *NodePoolAutoscalingBuilder) ID(value string) *NodePoolAutoscalingBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *NodePoolAutoscalingBuilder) HREF(value string) *NodePoolAutoscalingBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NodePoolAutoscalingBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// MaxReplica sets the value of the 'max_replica' attribute to the given value. +func (b *NodePoolAutoscalingBuilder) MaxReplica(value int) *NodePoolAutoscalingBuilder { + b.maxReplica = value + b.bitmap_ |= 8 + return b +} + +// MinReplica sets the value of the 'min_replica' attribute to the given value. +func (b *NodePoolAutoscalingBuilder) MinReplica(value int) *NodePoolAutoscalingBuilder { + b.minReplica = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NodePoolAutoscalingBuilder) Copy(object *NodePoolAutoscaling) *NodePoolAutoscalingBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.maxReplica = object.maxReplica + b.minReplica = object.minReplica + return b +} + +// Build creates a 'node_pool_autoscaling' object using the configuration stored in the builder. +func (b *NodePoolAutoscalingBuilder) Build() (object *NodePoolAutoscaling, err error) { + object = new(NodePoolAutoscaling) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.maxReplica = b.maxReplica + object.minReplica = b.minReplica + return +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_autoscaling_list_builder.go b/clientapi/arohcp/v1alpha1/node_pool_autoscaling_list_builder.go new file mode 100644 index 00000000..0b202210 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_autoscaling_list_builder.go @@ -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 + +// NodePoolAutoscalingListBuilder contains the data and logic needed to build +// 'node_pool_autoscaling' objects. +type NodePoolAutoscalingListBuilder struct { + items []*NodePoolAutoscalingBuilder +} + +// NewNodePoolAutoscalingList creates a new builder of 'node_pool_autoscaling' objects. +func NewNodePoolAutoscalingList() *NodePoolAutoscalingListBuilder { + return new(NodePoolAutoscalingListBuilder) +} + +// Items sets the items of the list. +func (b *NodePoolAutoscalingListBuilder) Items(values ...*NodePoolAutoscalingBuilder) *NodePoolAutoscalingListBuilder { + b.items = make([]*NodePoolAutoscalingBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NodePoolAutoscalingListBuilder) 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 *NodePoolAutoscalingListBuilder) Copy(list *NodePoolAutoscalingList) *NodePoolAutoscalingListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NodePoolAutoscalingBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNodePoolAutoscaling().Copy(v) + } + } + return b +} + +// Build creates a list of 'node_pool_autoscaling' objects using the +// configuration stored in the builder. +func (b *NodePoolAutoscalingListBuilder) Build() (list *NodePoolAutoscalingList, err error) { + items := make([]*NodePoolAutoscaling, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NodePoolAutoscalingList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_autoscaling_list_type_json.go b/clientapi/arohcp/v1alpha1/node_pool_autoscaling_list_type_json.go new file mode 100644 index 00000000..fa3daa32 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_autoscaling_list_type_json.go @@ -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" +) + +// MarshalNodePoolAutoscalingList writes a list of values of the 'node_pool_autoscaling' type to +// the given writer. +func MarshalNodePoolAutoscalingList(list []*NodePoolAutoscaling, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolAutoscalingList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolAutoscalingList writes a list of value of the 'node_pool_autoscaling' type to +// the given stream. +func WriteNodePoolAutoscalingList(list []*NodePoolAutoscaling, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNodePoolAutoscaling(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodePoolAutoscalingList reads a list of values of the 'node_pool_autoscaling' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodePoolAutoscalingList(source interface{}) (items []*NodePoolAutoscaling, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodePoolAutoscalingList(iterator) + err = iterator.Error + return +} + +// ReadNodePoolAutoscalingList reads list of values of the ”node_pool_autoscaling' type from +// the given iterator. +func ReadNodePoolAutoscalingList(iterator *jsoniter.Iterator) []*NodePoolAutoscaling { + list := []*NodePoolAutoscaling{} + for iterator.ReadArray() { + item := ReadNodePoolAutoscaling(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_autoscaling_type.go b/clientapi/arohcp/v1alpha1/node_pool_autoscaling_type.go new file mode 100644 index 00000000..85c2e21d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_autoscaling_type.go @@ -0,0 +1,289 @@ +/* +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 + +// NodePoolAutoscalingKind is the name of the type used to represent objects +// of type 'node_pool_autoscaling'. +const NodePoolAutoscalingKind = "NodePoolAutoscaling" + +// NodePoolAutoscalingLinkKind is the name of the type used to represent links +// to objects of type 'node_pool_autoscaling'. +const NodePoolAutoscalingLinkKind = "NodePoolAutoscalingLink" + +// NodePoolAutoscalingNilKind is the name of the type used to nil references +// to objects of type 'node_pool_autoscaling'. +const NodePoolAutoscalingNilKind = "NodePoolAutoscalingNil" + +// NodePoolAutoscaling represents the values of the 'node_pool_autoscaling' type. +// +// Representation of a autoscaling in a node pool. +type NodePoolAutoscaling struct { + bitmap_ uint32 + id string + href string + maxReplica int + minReplica int +} + +// Kind returns the name of the type of the object. +func (o *NodePoolAutoscaling) Kind() string { + if o == nil { + return NodePoolAutoscalingNilKind + } + if o.bitmap_&1 != 0 { + return NodePoolAutoscalingLinkKind + } + return NodePoolAutoscalingKind +} + +// Link returns true if this is a link. +func (o *NodePoolAutoscaling) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *NodePoolAutoscaling) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *NodePoolAutoscaling) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *NodePoolAutoscaling) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *NodePoolAutoscaling) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NodePoolAutoscaling) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// MaxReplica returns the value of the 'max_replica' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The maximum number of replicas for the node pool. +func (o *NodePoolAutoscaling) MaxReplica() int { + if o != nil && o.bitmap_&8 != 0 { + return o.maxReplica + } + return 0 +} + +// GetMaxReplica returns the value of the 'max_replica' attribute and +// a flag indicating if the attribute has a value. +// +// The maximum number of replicas for the node pool. +func (o *NodePoolAutoscaling) GetMaxReplica() (value int, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.maxReplica + } + return +} + +// MinReplica returns the value of the 'min_replica' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The minimum number of replicas for the node pool. +func (o *NodePoolAutoscaling) MinReplica() int { + if o != nil && o.bitmap_&16 != 0 { + return o.minReplica + } + return 0 +} + +// GetMinReplica returns the value of the 'min_replica' attribute and +// a flag indicating if the attribute has a value. +// +// The minimum number of replicas for the node pool. +func (o *NodePoolAutoscaling) GetMinReplica() (value int, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.minReplica + } + return +} + +// NodePoolAutoscalingListKind is the name of the type used to represent list of objects of +// type 'node_pool_autoscaling'. +const NodePoolAutoscalingListKind = "NodePoolAutoscalingList" + +// NodePoolAutoscalingListLinkKind is the name of the type used to represent links to list +// of objects of type 'node_pool_autoscaling'. +const NodePoolAutoscalingListLinkKind = "NodePoolAutoscalingListLink" + +// NodePoolAutoscalingNilKind is the name of the type used to nil lists of objects of +// type 'node_pool_autoscaling'. +const NodePoolAutoscalingListNilKind = "NodePoolAutoscalingListNil" + +// NodePoolAutoscalingList is a list of values of the 'node_pool_autoscaling' type. +type NodePoolAutoscalingList struct { + href string + link bool + items []*NodePoolAutoscaling +} + +// Kind returns the name of the type of the object. +func (l *NodePoolAutoscalingList) Kind() string { + if l == nil { + return NodePoolAutoscalingListNilKind + } + if l.link { + return NodePoolAutoscalingListLinkKind + } + return NodePoolAutoscalingListKind +} + +// Link returns true iif this is a link. +func (l *NodePoolAutoscalingList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *NodePoolAutoscalingList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *NodePoolAutoscalingList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *NodePoolAutoscalingList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NodePoolAutoscalingList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NodePoolAutoscalingList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NodePoolAutoscalingList) SetItems(items []*NodePoolAutoscaling) { + l.items = items +} + +// Items returns the items of the list. +func (l *NodePoolAutoscalingList) Items() []*NodePoolAutoscaling { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NodePoolAutoscalingList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NodePoolAutoscalingList) Get(i int) *NodePoolAutoscaling { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NodePoolAutoscalingList) Slice() []*NodePoolAutoscaling { + var slice []*NodePoolAutoscaling + if l == nil { + slice = make([]*NodePoolAutoscaling, 0) + } else { + slice = make([]*NodePoolAutoscaling, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NodePoolAutoscalingList) Each(f func(item *NodePoolAutoscaling) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NodePoolAutoscalingList) Range(f func(index int, item *NodePoolAutoscaling) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_autoscaling_type_json.go b/clientapi/arohcp/v1alpha1/node_pool_autoscaling_type_json.go new file mode 100644 index 00000000..e8821b81 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_autoscaling_type_json.go @@ -0,0 +1,133 @@ +/* +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" +) + +// MarshalNodePoolAutoscaling writes a value of the 'node_pool_autoscaling' type to the given writer. +func MarshalNodePoolAutoscaling(object *NodePoolAutoscaling, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolAutoscaling(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolAutoscaling writes a value of the 'node_pool_autoscaling' type to the given stream. +func WriteNodePoolAutoscaling(object *NodePoolAutoscaling, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(NodePoolAutoscalingLinkKind) + } else { + stream.WriteString(NodePoolAutoscalingKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_replica") + stream.WriteInt(object.maxReplica) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("min_replica") + stream.WriteInt(object.minReplica) + } + stream.WriteObjectEnd() +} + +// UnmarshalNodePoolAutoscaling reads a value of the 'node_pool_autoscaling' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNodePoolAutoscaling(source interface{}) (object *NodePoolAutoscaling, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNodePoolAutoscaling(iterator) + err = iterator.Error + return +} + +// ReadNodePoolAutoscaling reads a value of the 'node_pool_autoscaling' type from the given iterator. +func ReadNodePoolAutoscaling(iterator *jsoniter.Iterator) *NodePoolAutoscaling { + object := &NodePoolAutoscaling{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == NodePoolAutoscalingLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "max_replica": + value := iterator.ReadInt() + object.maxReplica = value + object.bitmap_ |= 8 + case "min_replica": + value := iterator.ReadInt() + object.minReplica = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_builder.go b/clientapi/arohcp/v1alpha1/node_pool_builder.go new file mode 100644 index 00000000..41068819 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_builder.go @@ -0,0 +1,401 @@ +/* +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 + +// NodePoolBuilder contains the data and logic needed to build 'node_pool' objects. +// +// Representation of a node pool in a cluster. +type NodePoolBuilder struct { + bitmap_ uint32 + id string + href string + awsNodePool *AWSNodePoolBuilder + autoscaling *NodePoolAutoscalingBuilder + availabilityZone string + azureNodePool *AzureNodePoolBuilder + kubeletConfigs []string + labels map[string]string + managementUpgrade *NodePoolManagementUpgradeBuilder + nodeDrainGracePeriod *ValueBuilder + replicas int + status *NodePoolStatusBuilder + subnet string + taints []*TaintBuilder + tuningConfigs []string + version *VersionBuilder + autoRepair bool +} + +// NewNodePool creates a new builder of 'node_pool' objects. +func NewNodePool() *NodePoolBuilder { + return &NodePoolBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *NodePoolBuilder) Link(value bool) *NodePoolBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *NodePoolBuilder) ID(value string) *NodePoolBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *NodePoolBuilder) HREF(value string) *NodePoolBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NodePoolBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AWSNodePool sets the value of the 'AWS_node_pool' attribute to the given value. +// +// Representation of aws node pool specific parameters. +func (b *NodePoolBuilder) AWSNodePool(value *AWSNodePoolBuilder) *NodePoolBuilder { + b.awsNodePool = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// AutoRepair sets the value of the 'auto_repair' attribute to the given value. +func (b *NodePoolBuilder) AutoRepair(value bool) *NodePoolBuilder { + b.autoRepair = value + b.bitmap_ |= 16 + return b +} + +// Autoscaling sets the value of the 'autoscaling' attribute to the given value. +// +// Representation of a autoscaling in a node pool. +func (b *NodePoolBuilder) Autoscaling(value *NodePoolAutoscalingBuilder) *NodePoolBuilder { + b.autoscaling = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// AvailabilityZone sets the value of the 'availability_zone' attribute to the given value. +func (b *NodePoolBuilder) AvailabilityZone(value string) *NodePoolBuilder { + b.availabilityZone = value + b.bitmap_ |= 64 + return b +} + +// AzureNodePool sets the value of the 'azure_node_pool' attribute to the given value. +// +// Representation of azure node pool specific parameters. +func (b *NodePoolBuilder) AzureNodePool(value *AzureNodePoolBuilder) *NodePoolBuilder { + b.azureNodePool = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// KubeletConfigs sets the value of the 'kubelet_configs' attribute to the given values. +func (b *NodePoolBuilder) KubeletConfigs(values ...string) *NodePoolBuilder { + b.kubeletConfigs = make([]string, len(values)) + copy(b.kubeletConfigs, values) + b.bitmap_ |= 256 + return b +} + +// Labels sets the value of the 'labels' attribute to the given value. +func (b *NodePoolBuilder) Labels(value map[string]string) *NodePoolBuilder { + b.labels = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// ManagementUpgrade sets the value of the 'management_upgrade' attribute to the given value. +// +// Representation of node pool management. +func (b *NodePoolBuilder) ManagementUpgrade(value *NodePoolManagementUpgradeBuilder) *NodePoolBuilder { + b.managementUpgrade = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// NodeDrainGracePeriod sets the value of the 'node_drain_grace_period' attribute to the given value. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +func (b *NodePoolBuilder) NodeDrainGracePeriod(value *ValueBuilder) *NodePoolBuilder { + b.nodeDrainGracePeriod = value + if value != nil { + b.bitmap_ |= 2048 + } else { + b.bitmap_ &^= 2048 + } + return b +} + +// Replicas sets the value of the 'replicas' attribute to the given value. +func (b *NodePoolBuilder) Replicas(value int) *NodePoolBuilder { + b.replicas = value + b.bitmap_ |= 4096 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +// +// Representation of the status of a node pool. +func (b *NodePoolBuilder) Status(value *NodePoolStatusBuilder) *NodePoolBuilder { + b.status = value + if value != nil { + b.bitmap_ |= 8192 + } else { + b.bitmap_ &^= 8192 + } + return b +} + +// Subnet sets the value of the 'subnet' attribute to the given value. +func (b *NodePoolBuilder) Subnet(value string) *NodePoolBuilder { + b.subnet = value + b.bitmap_ |= 16384 + return b +} + +// Taints sets the value of the 'taints' attribute to the given values. +func (b *NodePoolBuilder) Taints(values ...*TaintBuilder) *NodePoolBuilder { + b.taints = make([]*TaintBuilder, len(values)) + copy(b.taints, values) + b.bitmap_ |= 32768 + return b +} + +// TuningConfigs sets the value of the 'tuning_configs' attribute to the given values. +func (b *NodePoolBuilder) TuningConfigs(values ...string) *NodePoolBuilder { + b.tuningConfigs = make([]string, len(values)) + copy(b.tuningConfigs, values) + b.bitmap_ |= 65536 + return b +} + +// Version sets the value of the 'version' attribute to the given value. +// +// Representation of an _OpenShift_ version. +func (b *NodePoolBuilder) Version(value *VersionBuilder) *NodePoolBuilder { + b.version = value + if value != nil { + b.bitmap_ |= 131072 + } else { + b.bitmap_ &^= 131072 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NodePoolBuilder) Copy(object *NodePool) *NodePoolBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.awsNodePool != nil { + b.awsNodePool = NewAWSNodePool().Copy(object.awsNodePool) + } else { + b.awsNodePool = nil + } + b.autoRepair = object.autoRepair + if object.autoscaling != nil { + b.autoscaling = NewNodePoolAutoscaling().Copy(object.autoscaling) + } else { + b.autoscaling = nil + } + b.availabilityZone = object.availabilityZone + if object.azureNodePool != nil { + b.azureNodePool = NewAzureNodePool().Copy(object.azureNodePool) + } else { + b.azureNodePool = nil + } + if object.kubeletConfigs != nil { + b.kubeletConfigs = make([]string, len(object.kubeletConfigs)) + copy(b.kubeletConfigs, object.kubeletConfigs) + } else { + b.kubeletConfigs = nil + } + if len(object.labels) > 0 { + b.labels = map[string]string{} + for k, v := range object.labels { + b.labels[k] = v + } + } else { + b.labels = nil + } + if object.managementUpgrade != nil { + b.managementUpgrade = NewNodePoolManagementUpgrade().Copy(object.managementUpgrade) + } else { + b.managementUpgrade = nil + } + if object.nodeDrainGracePeriod != nil { + b.nodeDrainGracePeriod = NewValue().Copy(object.nodeDrainGracePeriod) + } else { + b.nodeDrainGracePeriod = nil + } + b.replicas = object.replicas + if object.status != nil { + b.status = NewNodePoolStatus().Copy(object.status) + } else { + b.status = nil + } + b.subnet = object.subnet + if object.taints != nil { + b.taints = make([]*TaintBuilder, len(object.taints)) + for i, v := range object.taints { + b.taints[i] = NewTaint().Copy(v) + } + } else { + b.taints = nil + } + if object.tuningConfigs != nil { + b.tuningConfigs = make([]string, len(object.tuningConfigs)) + copy(b.tuningConfigs, object.tuningConfigs) + } else { + b.tuningConfigs = nil + } + if object.version != nil { + b.version = NewVersion().Copy(object.version) + } else { + b.version = nil + } + return b +} + +// Build creates a 'node_pool' object using the configuration stored in the builder. +func (b *NodePoolBuilder) Build() (object *NodePool, err error) { + object = new(NodePool) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.awsNodePool != nil { + object.awsNodePool, err = b.awsNodePool.Build() + if err != nil { + return + } + } + object.autoRepair = b.autoRepair + if b.autoscaling != nil { + object.autoscaling, err = b.autoscaling.Build() + if err != nil { + return + } + } + object.availabilityZone = b.availabilityZone + if b.azureNodePool != nil { + object.azureNodePool, err = b.azureNodePool.Build() + if err != nil { + return + } + } + if b.kubeletConfigs != nil { + object.kubeletConfigs = make([]string, len(b.kubeletConfigs)) + copy(object.kubeletConfigs, b.kubeletConfigs) + } + if b.labels != nil { + object.labels = make(map[string]string) + for k, v := range b.labels { + object.labels[k] = v + } + } + if b.managementUpgrade != nil { + object.managementUpgrade, err = b.managementUpgrade.Build() + if err != nil { + return + } + } + if b.nodeDrainGracePeriod != nil { + object.nodeDrainGracePeriod, err = b.nodeDrainGracePeriod.Build() + if err != nil { + return + } + } + object.replicas = b.replicas + if b.status != nil { + object.status, err = b.status.Build() + if err != nil { + return + } + } + object.subnet = b.subnet + if b.taints != nil { + object.taints = make([]*Taint, len(b.taints)) + for i, v := range b.taints { + object.taints[i], err = v.Build() + if err != nil { + return + } + } + } + if b.tuningConfigs != nil { + object.tuningConfigs = make([]string, len(b.tuningConfigs)) + copy(object.tuningConfigs, b.tuningConfigs) + } + if b.version != nil { + object.version, err = b.version.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_list_builder.go b/clientapi/arohcp/v1alpha1/node_pool_list_builder.go new file mode 100644 index 00000000..4619c019 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_list_builder.go @@ -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 + +// NodePoolListBuilder contains the data and logic needed to build +// 'node_pool' objects. +type NodePoolListBuilder struct { + items []*NodePoolBuilder +} + +// NewNodePoolList creates a new builder of 'node_pool' objects. +func NewNodePoolList() *NodePoolListBuilder { + return new(NodePoolListBuilder) +} + +// Items sets the items of the list. +func (b *NodePoolListBuilder) Items(values ...*NodePoolBuilder) *NodePoolListBuilder { + b.items = make([]*NodePoolBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NodePoolListBuilder) 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 *NodePoolListBuilder) Copy(list *NodePoolList) *NodePoolListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NodePoolBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNodePool().Copy(v) + } + } + return b +} + +// Build creates a list of 'node_pool' objects using the +// configuration stored in the builder. +func (b *NodePoolListBuilder) Build() (list *NodePoolList, err error) { + items := make([]*NodePool, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NodePoolList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_list_type_json.go b/clientapi/arohcp/v1alpha1/node_pool_list_type_json.go new file mode 100644 index 00000000..f3e4291f --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_list_type_json.go @@ -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" +) + +// MarshalNodePoolList writes a list of values of the 'node_pool' type to +// the given writer. +func MarshalNodePoolList(list []*NodePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolList writes a list of value of the 'node_pool' type to +// the given stream. +func WriteNodePoolList(list []*NodePool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNodePool(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodePoolList reads a list of values of the 'node_pool' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodePoolList(source interface{}) (items []*NodePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodePoolList(iterator) + err = iterator.Error + return +} + +// ReadNodePoolList reads list of values of the ”node_pool' type from +// the given iterator. +func ReadNodePoolList(iterator *jsoniter.Iterator) []*NodePool { + list := []*NodePool{} + for iterator.ReadArray() { + item := ReadNodePool(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_builder.go b/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_builder.go new file mode 100644 index 00000000..0b8cbb4b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_builder.go @@ -0,0 +1,109 @@ +/* +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 + +// NodePoolManagementUpgradeBuilder contains the data and logic needed to build 'node_pool_management_upgrade' objects. +// +// Representation of node pool management. +type NodePoolManagementUpgradeBuilder struct { + bitmap_ uint32 + id string + href string + maxSurge string + maxUnavailable string + type_ string +} + +// NewNodePoolManagementUpgrade creates a new builder of 'node_pool_management_upgrade' objects. +func NewNodePoolManagementUpgrade() *NodePoolManagementUpgradeBuilder { + return &NodePoolManagementUpgradeBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *NodePoolManagementUpgradeBuilder) Link(value bool) *NodePoolManagementUpgradeBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *NodePoolManagementUpgradeBuilder) ID(value string) *NodePoolManagementUpgradeBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *NodePoolManagementUpgradeBuilder) HREF(value string) *NodePoolManagementUpgradeBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NodePoolManagementUpgradeBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// MaxSurge sets the value of the 'max_surge' attribute to the given value. +func (b *NodePoolManagementUpgradeBuilder) MaxSurge(value string) *NodePoolManagementUpgradeBuilder { + b.maxSurge = value + b.bitmap_ |= 8 + return b +} + +// MaxUnavailable sets the value of the 'max_unavailable' attribute to the given value. +func (b *NodePoolManagementUpgradeBuilder) MaxUnavailable(value string) *NodePoolManagementUpgradeBuilder { + b.maxUnavailable = value + b.bitmap_ |= 16 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *NodePoolManagementUpgradeBuilder) Type(value string) *NodePoolManagementUpgradeBuilder { + b.type_ = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NodePoolManagementUpgradeBuilder) Copy(object *NodePoolManagementUpgrade) *NodePoolManagementUpgradeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.maxSurge = object.maxSurge + b.maxUnavailable = object.maxUnavailable + b.type_ = object.type_ + return b +} + +// Build creates a 'node_pool_management_upgrade' object using the configuration stored in the builder. +func (b *NodePoolManagementUpgradeBuilder) Build() (object *NodePoolManagementUpgrade, err error) { + object = new(NodePoolManagementUpgrade) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.maxSurge = b.maxSurge + object.maxUnavailable = b.maxUnavailable + object.type_ = b.type_ + return +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_list_builder.go b/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_list_builder.go new file mode 100644 index 00000000..1143fba6 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_list_builder.go @@ -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 + +// NodePoolManagementUpgradeListBuilder contains the data and logic needed to build +// 'node_pool_management_upgrade' objects. +type NodePoolManagementUpgradeListBuilder struct { + items []*NodePoolManagementUpgradeBuilder +} + +// NewNodePoolManagementUpgradeList creates a new builder of 'node_pool_management_upgrade' objects. +func NewNodePoolManagementUpgradeList() *NodePoolManagementUpgradeListBuilder { + return new(NodePoolManagementUpgradeListBuilder) +} + +// Items sets the items of the list. +func (b *NodePoolManagementUpgradeListBuilder) Items(values ...*NodePoolManagementUpgradeBuilder) *NodePoolManagementUpgradeListBuilder { + b.items = make([]*NodePoolManagementUpgradeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NodePoolManagementUpgradeListBuilder) 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 *NodePoolManagementUpgradeListBuilder) Copy(list *NodePoolManagementUpgradeList) *NodePoolManagementUpgradeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NodePoolManagementUpgradeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNodePoolManagementUpgrade().Copy(v) + } + } + return b +} + +// Build creates a list of 'node_pool_management_upgrade' objects using the +// configuration stored in the builder. +func (b *NodePoolManagementUpgradeListBuilder) Build() (list *NodePoolManagementUpgradeList, err error) { + items := make([]*NodePoolManagementUpgrade, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NodePoolManagementUpgradeList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_list_type_json.go b/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_list_type_json.go new file mode 100644 index 00000000..e5c3cf6b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_list_type_json.go @@ -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" +) + +// MarshalNodePoolManagementUpgradeList writes a list of values of the 'node_pool_management_upgrade' type to +// the given writer. +func MarshalNodePoolManagementUpgradeList(list []*NodePoolManagementUpgrade, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolManagementUpgradeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolManagementUpgradeList writes a list of value of the 'node_pool_management_upgrade' type to +// the given stream. +func WriteNodePoolManagementUpgradeList(list []*NodePoolManagementUpgrade, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNodePoolManagementUpgrade(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodePoolManagementUpgradeList reads a list of values of the 'node_pool_management_upgrade' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodePoolManagementUpgradeList(source interface{}) (items []*NodePoolManagementUpgrade, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodePoolManagementUpgradeList(iterator) + err = iterator.Error + return +} + +// ReadNodePoolManagementUpgradeList reads list of values of the ”node_pool_management_upgrade' type from +// the given iterator. +func ReadNodePoolManagementUpgradeList(iterator *jsoniter.Iterator) []*NodePoolManagementUpgrade { + list := []*NodePoolManagementUpgrade{} + for iterator.ReadArray() { + item := ReadNodePoolManagementUpgrade(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_type.go b/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_type.go new file mode 100644 index 00000000..2857caa8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_type.go @@ -0,0 +1,313 @@ +/* +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 + +// NodePoolManagementUpgradeKind is the name of the type used to represent objects +// of type 'node_pool_management_upgrade'. +const NodePoolManagementUpgradeKind = "NodePoolManagementUpgrade" + +// NodePoolManagementUpgradeLinkKind is the name of the type used to represent links +// to objects of type 'node_pool_management_upgrade'. +const NodePoolManagementUpgradeLinkKind = "NodePoolManagementUpgradeLink" + +// NodePoolManagementUpgradeNilKind is the name of the type used to nil references +// to objects of type 'node_pool_management_upgrade'. +const NodePoolManagementUpgradeNilKind = "NodePoolManagementUpgradeNil" + +// NodePoolManagementUpgrade represents the values of the 'node_pool_management_upgrade' type. +// +// Representation of node pool management. +type NodePoolManagementUpgrade struct { + bitmap_ uint32 + id string + href string + maxSurge string + maxUnavailable string + type_ string +} + +// Kind returns the name of the type of the object. +func (o *NodePoolManagementUpgrade) Kind() string { + if o == nil { + return NodePoolManagementUpgradeNilKind + } + if o.bitmap_&1 != 0 { + return NodePoolManagementUpgradeLinkKind + } + return NodePoolManagementUpgradeKind +} + +// Link returns true if this is a link. +func (o *NodePoolManagementUpgrade) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *NodePoolManagementUpgrade) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *NodePoolManagementUpgrade) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *NodePoolManagementUpgrade) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *NodePoolManagementUpgrade) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NodePoolManagementUpgrade) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// MaxSurge returns the value of the 'max_surge' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Maximum number of nodes in the NodePool of a ROSA HCP cluster that can be scheduled above the desired number of nodes during the upgrade. +func (o *NodePoolManagementUpgrade) MaxSurge() string { + if o != nil && o.bitmap_&8 != 0 { + return o.maxSurge + } + return "" +} + +// GetMaxSurge returns the value of the 'max_surge' attribute and +// a flag indicating if the attribute has a value. +// +// Maximum number of nodes in the NodePool of a ROSA HCP cluster that can be scheduled above the desired number of nodes during the upgrade. +func (o *NodePoolManagementUpgrade) GetMaxSurge() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.maxSurge + } + return +} + +// MaxUnavailable returns the value of the 'max_unavailable' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Maximum number of nodes in the NodePool of a ROSA HCP cluster that can be unavailable during the upgrade. +func (o *NodePoolManagementUpgrade) MaxUnavailable() string { + if o != nil && o.bitmap_&16 != 0 { + return o.maxUnavailable + } + return "" +} + +// GetMaxUnavailable returns the value of the 'max_unavailable' attribute and +// a flag indicating if the attribute has a value. +// +// Maximum number of nodes in the NodePool of a ROSA HCP cluster that can be unavailable during the upgrade. +func (o *NodePoolManagementUpgrade) GetMaxUnavailable() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.maxUnavailable + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of strategy for handling upgrades. +func (o *NodePoolManagementUpgrade) Type() string { + if o != nil && o.bitmap_&32 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of strategy for handling upgrades. +func (o *NodePoolManagementUpgrade) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.type_ + } + return +} + +// NodePoolManagementUpgradeListKind is the name of the type used to represent list of objects of +// type 'node_pool_management_upgrade'. +const NodePoolManagementUpgradeListKind = "NodePoolManagementUpgradeList" + +// NodePoolManagementUpgradeListLinkKind is the name of the type used to represent links to list +// of objects of type 'node_pool_management_upgrade'. +const NodePoolManagementUpgradeListLinkKind = "NodePoolManagementUpgradeListLink" + +// NodePoolManagementUpgradeNilKind is the name of the type used to nil lists of objects of +// type 'node_pool_management_upgrade'. +const NodePoolManagementUpgradeListNilKind = "NodePoolManagementUpgradeListNil" + +// NodePoolManagementUpgradeList is a list of values of the 'node_pool_management_upgrade' type. +type NodePoolManagementUpgradeList struct { + href string + link bool + items []*NodePoolManagementUpgrade +} + +// Kind returns the name of the type of the object. +func (l *NodePoolManagementUpgradeList) Kind() string { + if l == nil { + return NodePoolManagementUpgradeListNilKind + } + if l.link { + return NodePoolManagementUpgradeListLinkKind + } + return NodePoolManagementUpgradeListKind +} + +// Link returns true iif this is a link. +func (l *NodePoolManagementUpgradeList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *NodePoolManagementUpgradeList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *NodePoolManagementUpgradeList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *NodePoolManagementUpgradeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NodePoolManagementUpgradeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NodePoolManagementUpgradeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NodePoolManagementUpgradeList) SetItems(items []*NodePoolManagementUpgrade) { + l.items = items +} + +// Items returns the items of the list. +func (l *NodePoolManagementUpgradeList) Items() []*NodePoolManagementUpgrade { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NodePoolManagementUpgradeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NodePoolManagementUpgradeList) Get(i int) *NodePoolManagementUpgrade { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NodePoolManagementUpgradeList) Slice() []*NodePoolManagementUpgrade { + var slice []*NodePoolManagementUpgrade + if l == nil { + slice = make([]*NodePoolManagementUpgrade, 0) + } else { + slice = make([]*NodePoolManagementUpgrade, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NodePoolManagementUpgradeList) Each(f func(item *NodePoolManagementUpgrade) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NodePoolManagementUpgradeList) Range(f func(index int, item *NodePoolManagementUpgrade) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_type_json.go b/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_type_json.go new file mode 100644 index 00000000..8c252de5 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_management_upgrade_type_json.go @@ -0,0 +1,146 @@ +/* +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" +) + +// MarshalNodePoolManagementUpgrade writes a value of the 'node_pool_management_upgrade' type to the given writer. +func MarshalNodePoolManagementUpgrade(object *NodePoolManagementUpgrade, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolManagementUpgrade(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolManagementUpgrade writes a value of the 'node_pool_management_upgrade' type to the given stream. +func WriteNodePoolManagementUpgrade(object *NodePoolManagementUpgrade, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(NodePoolManagementUpgradeLinkKind) + } else { + stream.WriteString(NodePoolManagementUpgradeKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_surge") + stream.WriteString(object.maxSurge) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_unavailable") + stream.WriteString(object.maxUnavailable) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalNodePoolManagementUpgrade reads a value of the 'node_pool_management_upgrade' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNodePoolManagementUpgrade(source interface{}) (object *NodePoolManagementUpgrade, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNodePoolManagementUpgrade(iterator) + err = iterator.Error + return +} + +// ReadNodePoolManagementUpgrade reads a value of the 'node_pool_management_upgrade' type from the given iterator. +func ReadNodePoolManagementUpgrade(iterator *jsoniter.Iterator) *NodePoolManagementUpgrade { + object := &NodePoolManagementUpgrade{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == NodePoolManagementUpgradeLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "max_surge": + value := iterator.ReadString() + object.maxSurge = value + object.bitmap_ |= 8 + case "max_unavailable": + value := iterator.ReadString() + object.maxUnavailable = value + object.bitmap_ |= 16 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_state_builder.go b/clientapi/arohcp/v1alpha1/node_pool_state_builder.go new file mode 100644 index 00000000..207733c3 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_state_builder.go @@ -0,0 +1,103 @@ +/* +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 ( + time "time" +) + +// NodePoolStateBuilder contains the data and logic needed to build 'node_pool_state' objects. +// +// Representation of the status of a node pool. +type NodePoolStateBuilder struct { + bitmap_ uint32 + id string + href string + lastUpdatedTimestamp time.Time + nodePoolStateValue string +} + +// NewNodePoolState creates a new builder of 'node_pool_state' objects. +func NewNodePoolState() *NodePoolStateBuilder { + return &NodePoolStateBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *NodePoolStateBuilder) Link(value bool) *NodePoolStateBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *NodePoolStateBuilder) ID(value string) *NodePoolStateBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *NodePoolStateBuilder) HREF(value string) *NodePoolStateBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NodePoolStateBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// LastUpdatedTimestamp sets the value of the 'last_updated_timestamp' attribute to the given value. +func (b *NodePoolStateBuilder) LastUpdatedTimestamp(value time.Time) *NodePoolStateBuilder { + b.lastUpdatedTimestamp = value + b.bitmap_ |= 8 + return b +} + +// NodePoolStateValue sets the value of the 'node_pool_state_value' attribute to the given value. +func (b *NodePoolStateBuilder) NodePoolStateValue(value string) *NodePoolStateBuilder { + b.nodePoolStateValue = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NodePoolStateBuilder) Copy(object *NodePoolState) *NodePoolStateBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.lastUpdatedTimestamp = object.lastUpdatedTimestamp + b.nodePoolStateValue = object.nodePoolStateValue + return b +} + +// Build creates a 'node_pool_state' object using the configuration stored in the builder. +func (b *NodePoolStateBuilder) Build() (object *NodePoolState, err error) { + object = new(NodePoolState) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.lastUpdatedTimestamp = b.lastUpdatedTimestamp + object.nodePoolStateValue = b.nodePoolStateValue + return +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_state_list_builder.go b/clientapi/arohcp/v1alpha1/node_pool_state_list_builder.go new file mode 100644 index 00000000..8954aefe --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_state_list_builder.go @@ -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 + +// NodePoolStateListBuilder contains the data and logic needed to build +// 'node_pool_state' objects. +type NodePoolStateListBuilder struct { + items []*NodePoolStateBuilder +} + +// NewNodePoolStateList creates a new builder of 'node_pool_state' objects. +func NewNodePoolStateList() *NodePoolStateListBuilder { + return new(NodePoolStateListBuilder) +} + +// Items sets the items of the list. +func (b *NodePoolStateListBuilder) Items(values ...*NodePoolStateBuilder) *NodePoolStateListBuilder { + b.items = make([]*NodePoolStateBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NodePoolStateListBuilder) 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 *NodePoolStateListBuilder) Copy(list *NodePoolStateList) *NodePoolStateListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NodePoolStateBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNodePoolState().Copy(v) + } + } + return b +} + +// Build creates a list of 'node_pool_state' objects using the +// configuration stored in the builder. +func (b *NodePoolStateListBuilder) Build() (list *NodePoolStateList, err error) { + items := make([]*NodePoolState, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NodePoolStateList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_state_list_type_json.go b/clientapi/arohcp/v1alpha1/node_pool_state_list_type_json.go new file mode 100644 index 00000000..abeec7ac --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_state_list_type_json.go @@ -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" +) + +// MarshalNodePoolStateList writes a list of values of the 'node_pool_state' type to +// the given writer. +func MarshalNodePoolStateList(list []*NodePoolState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolStateList writes a list of value of the 'node_pool_state' type to +// the given stream. +func WriteNodePoolStateList(list []*NodePoolState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNodePoolState(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodePoolStateList reads a list of values of the 'node_pool_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodePoolStateList(source interface{}) (items []*NodePoolState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodePoolStateList(iterator) + err = iterator.Error + return +} + +// ReadNodePoolStateList reads list of values of the ”node_pool_state' type from +// the given iterator. +func ReadNodePoolStateList(iterator *jsoniter.Iterator) []*NodePoolState { + list := []*NodePoolState{} + for iterator.ReadArray() { + item := ReadNodePoolState(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_state_type.go b/clientapi/arohcp/v1alpha1/node_pool_state_type.go new file mode 100644 index 00000000..a06cb0cd --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_state_type.go @@ -0,0 +1,293 @@ +/* +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 ( + time "time" +) + +// NodePoolStateKind is the name of the type used to represent objects +// of type 'node_pool_state'. +const NodePoolStateKind = "NodePoolState" + +// NodePoolStateLinkKind is the name of the type used to represent links +// to objects of type 'node_pool_state'. +const NodePoolStateLinkKind = "NodePoolStateLink" + +// NodePoolStateNilKind is the name of the type used to nil references +// to objects of type 'node_pool_state'. +const NodePoolStateNilKind = "NodePoolStateNil" + +// NodePoolState represents the values of the 'node_pool_state' type. +// +// Representation of the status of a node pool. +type NodePoolState struct { + bitmap_ uint32 + id string + href string + lastUpdatedTimestamp time.Time + nodePoolStateValue string +} + +// Kind returns the name of the type of the object. +func (o *NodePoolState) Kind() string { + if o == nil { + return NodePoolStateNilKind + } + if o.bitmap_&1 != 0 { + return NodePoolStateLinkKind + } + return NodePoolStateKind +} + +// Link returns true if this is a link. +func (o *NodePoolState) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *NodePoolState) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *NodePoolState) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *NodePoolState) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *NodePoolState) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NodePoolState) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// LastUpdatedTimestamp returns the value of the 'last_updated_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The current number of replicas for the node pool. +func (o *NodePoolState) LastUpdatedTimestamp() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.lastUpdatedTimestamp + } + return time.Time{} +} + +// GetLastUpdatedTimestamp returns the value of the 'last_updated_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// The current number of replicas for the node pool. +func (o *NodePoolState) GetLastUpdatedTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.lastUpdatedTimestamp + } + return +} + +// NodePoolStateValue returns the value of the 'node_pool_state_value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The current state of the node pool +func (o *NodePoolState) NodePoolStateValue() string { + if o != nil && o.bitmap_&16 != 0 { + return o.nodePoolStateValue + } + return "" +} + +// GetNodePoolStateValue returns the value of the 'node_pool_state_value' attribute and +// a flag indicating if the attribute has a value. +// +// The current state of the node pool +func (o *NodePoolState) GetNodePoolStateValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.nodePoolStateValue + } + return +} + +// NodePoolStateListKind is the name of the type used to represent list of objects of +// type 'node_pool_state'. +const NodePoolStateListKind = "NodePoolStateList" + +// NodePoolStateListLinkKind is the name of the type used to represent links to list +// of objects of type 'node_pool_state'. +const NodePoolStateListLinkKind = "NodePoolStateListLink" + +// NodePoolStateNilKind is the name of the type used to nil lists of objects of +// type 'node_pool_state'. +const NodePoolStateListNilKind = "NodePoolStateListNil" + +// NodePoolStateList is a list of values of the 'node_pool_state' type. +type NodePoolStateList struct { + href string + link bool + items []*NodePoolState +} + +// Kind returns the name of the type of the object. +func (l *NodePoolStateList) Kind() string { + if l == nil { + return NodePoolStateListNilKind + } + if l.link { + return NodePoolStateListLinkKind + } + return NodePoolStateListKind +} + +// Link returns true iif this is a link. +func (l *NodePoolStateList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *NodePoolStateList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *NodePoolStateList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *NodePoolStateList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NodePoolStateList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NodePoolStateList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NodePoolStateList) SetItems(items []*NodePoolState) { + l.items = items +} + +// Items returns the items of the list. +func (l *NodePoolStateList) Items() []*NodePoolState { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NodePoolStateList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NodePoolStateList) Get(i int) *NodePoolState { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NodePoolStateList) Slice() []*NodePoolState { + var slice []*NodePoolState + if l == nil { + slice = make([]*NodePoolState, 0) + } else { + slice = make([]*NodePoolState, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NodePoolStateList) Each(f func(item *NodePoolState) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NodePoolStateList) Range(f func(index int, item *NodePoolState) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_state_type_json.go b/clientapi/arohcp/v1alpha1/node_pool_state_type_json.go new file mode 100644 index 00000000..1cd92ab8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_state_type_json.go @@ -0,0 +1,138 @@ +/* +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" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePoolState writes a value of the 'node_pool_state' type to the given writer. +func MarshalNodePoolState(object *NodePoolState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolState(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolState writes a value of the 'node_pool_state' type to the given stream. +func WriteNodePoolState(object *NodePoolState, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(NodePoolStateLinkKind) + } else { + stream.WriteString(NodePoolStateKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_updated_timestamp") + stream.WriteString((object.lastUpdatedTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("node_pool_state_value") + stream.WriteString(object.nodePoolStateValue) + } + stream.WriteObjectEnd() +} + +// UnmarshalNodePoolState reads a value of the 'node_pool_state' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNodePoolState(source interface{}) (object *NodePoolState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNodePoolState(iterator) + err = iterator.Error + return +} + +// ReadNodePoolState reads a value of the 'node_pool_state' type from the given iterator. +func ReadNodePoolState(iterator *jsoniter.Iterator) *NodePoolState { + object := &NodePoolState{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == NodePoolStateLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "last_updated_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastUpdatedTimestamp = value + object.bitmap_ |= 8 + case "node_pool_state_value": + value := iterator.ReadString() + object.nodePoolStateValue = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_status_builder.go b/clientapi/arohcp/v1alpha1/node_pool_status_builder.go new file mode 100644 index 00000000..9e782079 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_status_builder.go @@ -0,0 +1,124 @@ +/* +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 + +// NodePoolStatusBuilder contains the data and logic needed to build 'node_pool_status' objects. +// +// Representation of the status of a node pool. +type NodePoolStatusBuilder struct { + bitmap_ uint32 + id string + href string + currentReplicas int + message string + state *NodePoolStateBuilder +} + +// NewNodePoolStatus creates a new builder of 'node_pool_status' objects. +func NewNodePoolStatus() *NodePoolStatusBuilder { + return &NodePoolStatusBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *NodePoolStatusBuilder) Link(value bool) *NodePoolStatusBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *NodePoolStatusBuilder) ID(value string) *NodePoolStatusBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *NodePoolStatusBuilder) HREF(value string) *NodePoolStatusBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NodePoolStatusBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CurrentReplicas sets the value of the 'current_replicas' attribute to the given value. +func (b *NodePoolStatusBuilder) CurrentReplicas(value int) *NodePoolStatusBuilder { + b.currentReplicas = value + b.bitmap_ |= 8 + return b +} + +// Message sets the value of the 'message' attribute to the given value. +func (b *NodePoolStatusBuilder) Message(value string) *NodePoolStatusBuilder { + b.message = value + b.bitmap_ |= 16 + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// Representation of the status of a node pool. +func (b *NodePoolStatusBuilder) State(value *NodePoolStateBuilder) *NodePoolStatusBuilder { + b.state = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NodePoolStatusBuilder) Copy(object *NodePoolStatus) *NodePoolStatusBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.currentReplicas = object.currentReplicas + b.message = object.message + if object.state != nil { + b.state = NewNodePoolState().Copy(object.state) + } else { + b.state = nil + } + return b +} + +// Build creates a 'node_pool_status' object using the configuration stored in the builder. +func (b *NodePoolStatusBuilder) Build() (object *NodePoolStatus, err error) { + object = new(NodePoolStatus) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.currentReplicas = b.currentReplicas + object.message = b.message + if b.state != nil { + object.state, err = b.state.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_status_list_builder.go b/clientapi/arohcp/v1alpha1/node_pool_status_list_builder.go new file mode 100644 index 00000000..3869fa68 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_status_list_builder.go @@ -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 + +// NodePoolStatusListBuilder contains the data and logic needed to build +// 'node_pool_status' objects. +type NodePoolStatusListBuilder struct { + items []*NodePoolStatusBuilder +} + +// NewNodePoolStatusList creates a new builder of 'node_pool_status' objects. +func NewNodePoolStatusList() *NodePoolStatusListBuilder { + return new(NodePoolStatusListBuilder) +} + +// Items sets the items of the list. +func (b *NodePoolStatusListBuilder) Items(values ...*NodePoolStatusBuilder) *NodePoolStatusListBuilder { + b.items = make([]*NodePoolStatusBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NodePoolStatusListBuilder) 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 *NodePoolStatusListBuilder) Copy(list *NodePoolStatusList) *NodePoolStatusListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NodePoolStatusBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNodePoolStatus().Copy(v) + } + } + return b +} + +// Build creates a list of 'node_pool_status' objects using the +// configuration stored in the builder. +func (b *NodePoolStatusListBuilder) Build() (list *NodePoolStatusList, err error) { + items := make([]*NodePoolStatus, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NodePoolStatusList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_status_list_type_json.go b/clientapi/arohcp/v1alpha1/node_pool_status_list_type_json.go new file mode 100644 index 00000000..a7344bf0 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_status_list_type_json.go @@ -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" +) + +// MarshalNodePoolStatusList writes a list of values of the 'node_pool_status' type to +// the given writer. +func MarshalNodePoolStatusList(list []*NodePoolStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolStatusList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolStatusList writes a list of value of the 'node_pool_status' type to +// the given stream. +func WriteNodePoolStatusList(list []*NodePoolStatus, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNodePoolStatus(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodePoolStatusList reads a list of values of the 'node_pool_status' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodePoolStatusList(source interface{}) (items []*NodePoolStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodePoolStatusList(iterator) + err = iterator.Error + return +} + +// ReadNodePoolStatusList reads list of values of the ”node_pool_status' type from +// the given iterator. +func ReadNodePoolStatusList(iterator *jsoniter.Iterator) []*NodePoolStatus { + list := []*NodePoolStatus{} + for iterator.ReadArray() { + item := ReadNodePoolStatus(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_status_type.go b/clientapi/arohcp/v1alpha1/node_pool_status_type.go new file mode 100644 index 00000000..3aa455c7 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_status_type.go @@ -0,0 +1,313 @@ +/* +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 + +// NodePoolStatusKind is the name of the type used to represent objects +// of type 'node_pool_status'. +const NodePoolStatusKind = "NodePoolStatus" + +// NodePoolStatusLinkKind is the name of the type used to represent links +// to objects of type 'node_pool_status'. +const NodePoolStatusLinkKind = "NodePoolStatusLink" + +// NodePoolStatusNilKind is the name of the type used to nil references +// to objects of type 'node_pool_status'. +const NodePoolStatusNilKind = "NodePoolStatusNil" + +// NodePoolStatus represents the values of the 'node_pool_status' type. +// +// Representation of the status of a node pool. +type NodePoolStatus struct { + bitmap_ uint32 + id string + href string + currentReplicas int + message string + state *NodePoolState +} + +// Kind returns the name of the type of the object. +func (o *NodePoolStatus) Kind() string { + if o == nil { + return NodePoolStatusNilKind + } + if o.bitmap_&1 != 0 { + return NodePoolStatusLinkKind + } + return NodePoolStatusKind +} + +// Link returns true if this is a link. +func (o *NodePoolStatus) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *NodePoolStatus) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *NodePoolStatus) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *NodePoolStatus) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *NodePoolStatus) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NodePoolStatus) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CurrentReplicas returns the value of the 'current_replicas' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The current number of replicas for the node pool. +func (o *NodePoolStatus) CurrentReplicas() int { + if o != nil && o.bitmap_&8 != 0 { + return o.currentReplicas + } + return 0 +} + +// GetCurrentReplicas returns the value of the 'current_replicas' attribute and +// a flag indicating if the attribute has a value. +// +// The current number of replicas for the node pool. +func (o *NodePoolStatus) GetCurrentReplicas() (value int, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.currentReplicas + } + return +} + +// Message returns the value of the 'message' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Adds additional information about the NodePool status when the node pool doesn't reach the desired replicas. +func (o *NodePoolStatus) Message() string { + if o != nil && o.bitmap_&16 != 0 { + return o.message + } + return "" +} + +// GetMessage returns the value of the 'message' attribute and +// a flag indicating if the attribute has a value. +// +// Adds additional information about the NodePool status when the node pool doesn't reach the desired replicas. +func (o *NodePoolStatus) GetMessage() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.message + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The current state of the node pool +func (o *NodePoolStatus) State() *NodePoolState { + if o != nil && o.bitmap_&32 != 0 { + return o.state + } + return nil +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// The current state of the node pool +func (o *NodePoolStatus) GetState() (value *NodePoolState, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.state + } + return +} + +// NodePoolStatusListKind is the name of the type used to represent list of objects of +// type 'node_pool_status'. +const NodePoolStatusListKind = "NodePoolStatusList" + +// NodePoolStatusListLinkKind is the name of the type used to represent links to list +// of objects of type 'node_pool_status'. +const NodePoolStatusListLinkKind = "NodePoolStatusListLink" + +// NodePoolStatusNilKind is the name of the type used to nil lists of objects of +// type 'node_pool_status'. +const NodePoolStatusListNilKind = "NodePoolStatusListNil" + +// NodePoolStatusList is a list of values of the 'node_pool_status' type. +type NodePoolStatusList struct { + href string + link bool + items []*NodePoolStatus +} + +// Kind returns the name of the type of the object. +func (l *NodePoolStatusList) Kind() string { + if l == nil { + return NodePoolStatusListNilKind + } + if l.link { + return NodePoolStatusListLinkKind + } + return NodePoolStatusListKind +} + +// Link returns true iif this is a link. +func (l *NodePoolStatusList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *NodePoolStatusList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *NodePoolStatusList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *NodePoolStatusList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NodePoolStatusList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NodePoolStatusList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NodePoolStatusList) SetItems(items []*NodePoolStatus) { + l.items = items +} + +// Items returns the items of the list. +func (l *NodePoolStatusList) Items() []*NodePoolStatus { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NodePoolStatusList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NodePoolStatusList) Get(i int) *NodePoolStatus { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NodePoolStatusList) Slice() []*NodePoolStatus { + var slice []*NodePoolStatus + if l == nil { + slice = make([]*NodePoolStatus, 0) + } else { + slice = make([]*NodePoolStatus, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NodePoolStatusList) Each(f func(item *NodePoolStatus) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NodePoolStatusList) Range(f func(index int, item *NodePoolStatus) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_status_type_json.go b/clientapi/arohcp/v1alpha1/node_pool_status_type_json.go new file mode 100644 index 00000000..f9389150 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_status_type_json.go @@ -0,0 +1,146 @@ +/* +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" +) + +// MarshalNodePoolStatus writes a value of the 'node_pool_status' type to the given writer. +func MarshalNodePoolStatus(object *NodePoolStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolStatus(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolStatus writes a value of the 'node_pool_status' type to the given stream. +func WriteNodePoolStatus(object *NodePoolStatus, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(NodePoolStatusLinkKind) + } else { + stream.WriteString(NodePoolStatusKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("current_replicas") + stream.WriteInt(object.currentReplicas) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("message") + stream.WriteString(object.message) + count++ + } + present_ = object.bitmap_&32 != 0 && object.state != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + WriteNodePoolState(object.state, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalNodePoolStatus reads a value of the 'node_pool_status' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNodePoolStatus(source interface{}) (object *NodePoolStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNodePoolStatus(iterator) + err = iterator.Error + return +} + +// ReadNodePoolStatus reads a value of the 'node_pool_status' type from the given iterator. +func ReadNodePoolStatus(iterator *jsoniter.Iterator) *NodePoolStatus { + object := &NodePoolStatus{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == NodePoolStatusLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "current_replicas": + value := iterator.ReadInt() + object.currentReplicas = value + object.bitmap_ |= 8 + case "message": + value := iterator.ReadString() + object.message = value + object.bitmap_ |= 16 + case "state": + value := ReadNodePoolState(iterator) + object.state = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_type.go b/clientapi/arohcp/v1alpha1/node_pool_type.go new file mode 100644 index 00000000..4341e095 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_type.go @@ -0,0 +1,605 @@ +/* +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 + +// NodePoolKind is the name of the type used to represent objects +// of type 'node_pool'. +const NodePoolKind = "NodePool" + +// NodePoolLinkKind is the name of the type used to represent links +// to objects of type 'node_pool'. +const NodePoolLinkKind = "NodePoolLink" + +// NodePoolNilKind is the name of the type used to nil references +// to objects of type 'node_pool'. +const NodePoolNilKind = "NodePoolNil" + +// NodePool represents the values of the 'node_pool' type. +// +// Representation of a node pool in a cluster. +type NodePool struct { + bitmap_ uint32 + id string + href string + awsNodePool *AWSNodePool + autoscaling *NodePoolAutoscaling + availabilityZone string + azureNodePool *AzureNodePool + kubeletConfigs []string + labels map[string]string + managementUpgrade *NodePoolManagementUpgrade + nodeDrainGracePeriod *Value + replicas int + status *NodePoolStatus + subnet string + taints []*Taint + tuningConfigs []string + version *Version + autoRepair bool +} + +// Kind returns the name of the type of the object. +func (o *NodePool) Kind() string { + if o == nil { + return NodePoolNilKind + } + if o.bitmap_&1 != 0 { + return NodePoolLinkKind + } + return NodePoolKind +} + +// Link returns true if this is a link. +func (o *NodePool) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *NodePool) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *NodePool) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *NodePool) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *NodePool) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NodePool) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AWSNodePool returns the value of the 'AWS_node_pool' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS specific parameters (Optional). +func (o *NodePool) AWSNodePool() *AWSNodePool { + if o != nil && o.bitmap_&8 != 0 { + return o.awsNodePool + } + return nil +} + +// GetAWSNodePool returns the value of the 'AWS_node_pool' attribute and +// a flag indicating if the attribute has a value. +// +// AWS specific parameters (Optional). +func (o *NodePool) GetAWSNodePool() (value *AWSNodePool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.awsNodePool + } + return +} + +// AutoRepair returns the value of the 'auto_repair' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Specifies whether health checks should be enabled for machines in the NodePool. +func (o *NodePool) AutoRepair() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.autoRepair + } + return false +} + +// GetAutoRepair returns the value of the 'auto_repair' attribute and +// a flag indicating if the attribute has a value. +// +// Specifies whether health checks should be enabled for machines in the NodePool. +func (o *NodePool) GetAutoRepair() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.autoRepair + } + return +} + +// Autoscaling returns the value of the 'autoscaling' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for auto-scaling the machine pool. +// Replicas and autoscaling cannot be used together. +func (o *NodePool) Autoscaling() *NodePoolAutoscaling { + if o != nil && o.bitmap_&32 != 0 { + return o.autoscaling + } + return nil +} + +// GetAutoscaling returns the value of the 'autoscaling' attribute and +// a flag indicating if the attribute has a value. +// +// Details for auto-scaling the machine pool. +// Replicas and autoscaling cannot be used together. +func (o *NodePool) GetAutoscaling() (value *NodePoolAutoscaling, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.autoscaling + } + return +} + +// AvailabilityZone returns the value of the 'availability_zone' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The availability zone upon which the node is created. +func (o *NodePool) AvailabilityZone() string { + if o != nil && o.bitmap_&64 != 0 { + return o.availabilityZone + } + return "" +} + +// GetAvailabilityZone returns the value of the 'availability_zone' attribute and +// a flag indicating if the attribute has a value. +// +// The availability zone upon which the node is created. +func (o *NodePool) GetAvailabilityZone() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.availabilityZone + } + return +} + +// AzureNodePool returns the value of the 'azure_node_pool' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Azure specific parameters. +func (o *NodePool) AzureNodePool() *AzureNodePool { + if o != nil && o.bitmap_&128 != 0 { + return o.azureNodePool + } + return nil +} + +// GetAzureNodePool returns the value of the 'azure_node_pool' attribute and +// a flag indicating if the attribute has a value. +// +// Azure specific parameters. +func (o *NodePool) GetAzureNodePool() (value *AzureNodePool, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.azureNodePool + } + return +} + +// KubeletConfigs returns the value of the 'kubelet_configs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The names of the KubeletConfigs for this node pool. +func (o *NodePool) KubeletConfigs() []string { + if o != nil && o.bitmap_&256 != 0 { + return o.kubeletConfigs + } + return nil +} + +// GetKubeletConfigs returns the value of the 'kubelet_configs' attribute and +// a flag indicating if the attribute has a value. +// +// The names of the KubeletConfigs for this node pool. +func (o *NodePool) GetKubeletConfigs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.kubeletConfigs + } + return +} + +// Labels returns the value of the 'labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The labels set on the Nodes created. +func (o *NodePool) Labels() map[string]string { + if o != nil && o.bitmap_&512 != 0 { + return o.labels + } + return nil +} + +// GetLabels returns the value of the 'labels' attribute and +// a flag indicating if the attribute has a value. +// +// The labels set on the Nodes created. +func (o *NodePool) GetLabels() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.labels + } + return +} + +// ManagementUpgrade returns the value of the 'management_upgrade' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Management parameters (Optional). +func (o *NodePool) ManagementUpgrade() *NodePoolManagementUpgrade { + if o != nil && o.bitmap_&1024 != 0 { + return o.managementUpgrade + } + return nil +} + +// GetManagementUpgrade returns the value of the 'management_upgrade' attribute and +// a flag indicating if the attribute has a value. +// +// Management parameters (Optional). +func (o *NodePool) GetManagementUpgrade() (value *NodePoolManagementUpgrade, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.managementUpgrade + } + return +} + +// NodeDrainGracePeriod returns the value of the 'node_drain_grace_period' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Time to wait for a NodePool to drain when it is upgraded or replaced before it is forcibly removed. +func (o *NodePool) NodeDrainGracePeriod() *Value { + if o != nil && o.bitmap_&2048 != 0 { + return o.nodeDrainGracePeriod + } + return nil +} + +// GetNodeDrainGracePeriod returns the value of the 'node_drain_grace_period' attribute and +// a flag indicating if the attribute has a value. +// +// Time to wait for a NodePool to drain when it is upgraded or replaced before it is forcibly removed. +func (o *NodePool) GetNodeDrainGracePeriod() (value *Value, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.nodeDrainGracePeriod + } + return +} + +// Replicas returns the value of the 'replicas' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The number of Machines (and Nodes) to create. +// Replicas and autoscaling cannot be used together. +func (o *NodePool) Replicas() int { + if o != nil && o.bitmap_&4096 != 0 { + return o.replicas + } + return 0 +} + +// GetReplicas returns the value of the 'replicas' attribute and +// a flag indicating if the attribute has a value. +// +// The number of Machines (and Nodes) to create. +// Replicas and autoscaling cannot be used together. +func (o *NodePool) GetReplicas() (value int, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.replicas + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// NodePool status. +func (o *NodePool) Status() *NodePoolStatus { + if o != nil && o.bitmap_&8192 != 0 { + return o.status + } + return nil +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// NodePool status. +func (o *NodePool) GetStatus() (value *NodePoolStatus, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.status + } + return +} + +// Subnet returns the value of the 'subnet' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The subnet upon which the nodes are created. +func (o *NodePool) Subnet() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.subnet + } + return "" +} + +// GetSubnet returns the value of the 'subnet' attribute and +// a flag indicating if the attribute has a value. +// +// The subnet upon which the nodes are created. +func (o *NodePool) GetSubnet() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.subnet + } + return +} + +// Taints returns the value of the 'taints' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The taints set on the Nodes created. +func (o *NodePool) Taints() []*Taint { + if o != nil && o.bitmap_&32768 != 0 { + return o.taints + } + return nil +} + +// GetTaints returns the value of the 'taints' attribute and +// a flag indicating if the attribute has a value. +// +// The taints set on the Nodes created. +func (o *NodePool) GetTaints() (value []*Taint, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.taints + } + return +} + +// TuningConfigs returns the value of the 'tuning_configs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The names of the tuning configs for this node pool. +func (o *NodePool) TuningConfigs() []string { + if o != nil && o.bitmap_&65536 != 0 { + return o.tuningConfigs + } + return nil +} + +// GetTuningConfigs returns the value of the 'tuning_configs' attribute and +// a flag indicating if the attribute has a value. +// +// The names of the tuning configs for this node pool. +func (o *NodePool) GetTuningConfigs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.tuningConfigs + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Version of the node pool. +func (o *NodePool) Version() *Version { + if o != nil && o.bitmap_&131072 != 0 { + return o.version + } + return nil +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +// +// Version of the node pool. +func (o *NodePool) GetVersion() (value *Version, ok bool) { + ok = o != nil && o.bitmap_&131072 != 0 + if ok { + value = o.version + } + return +} + +// NodePoolListKind is the name of the type used to represent list of objects of +// type 'node_pool'. +const NodePoolListKind = "NodePoolList" + +// NodePoolListLinkKind is the name of the type used to represent links to list +// of objects of type 'node_pool'. +const NodePoolListLinkKind = "NodePoolListLink" + +// NodePoolNilKind is the name of the type used to nil lists of objects of +// type 'node_pool'. +const NodePoolListNilKind = "NodePoolListNil" + +// NodePoolList is a list of values of the 'node_pool' type. +type NodePoolList struct { + href string + link bool + items []*NodePool +} + +// Kind returns the name of the type of the object. +func (l *NodePoolList) Kind() string { + if l == nil { + return NodePoolListNilKind + } + if l.link { + return NodePoolListLinkKind + } + return NodePoolListKind +} + +// Link returns true iif this is a link. +func (l *NodePoolList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *NodePoolList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *NodePoolList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *NodePoolList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NodePoolList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NodePoolList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NodePoolList) SetItems(items []*NodePool) { + l.items = items +} + +// Items returns the items of the list. +func (l *NodePoolList) Items() []*NodePool { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NodePoolList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NodePoolList) Get(i int) *NodePool { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NodePoolList) Slice() []*NodePool { + var slice []*NodePool + if l == nil { + slice = make([]*NodePool, 0) + } else { + slice = make([]*NodePool, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NodePoolList) Each(f func(item *NodePool) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NodePoolList) Range(f func(index int, item *NodePool) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/node_pool_type_json.go b/clientapi/arohcp/v1alpha1/node_pool_type_json.go new file mode 100644 index 00000000..92d39c40 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/node_pool_type_json.go @@ -0,0 +1,331 @@ +/* +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" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePool writes a value of the 'node_pool' type to the given writer. +func MarshalNodePool(object *NodePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePool(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePool writes a value of the 'node_pool' type to the given stream. +func WriteNodePool(object *NodePool, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(NodePoolLinkKind) + } else { + stream.WriteString(NodePoolKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.awsNodePool != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws_node_pool") + WriteAWSNodePool(object.awsNodePool, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("auto_repair") + stream.WriteBool(object.autoRepair) + count++ + } + present_ = object.bitmap_&32 != 0 && object.autoscaling != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("autoscaling") + WriteNodePoolAutoscaling(object.autoscaling, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zone") + stream.WriteString(object.availabilityZone) + count++ + } + present_ = object.bitmap_&128 != 0 && object.azureNodePool != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("azure_node_pool") + WriteAzureNodePool(object.azureNodePool, stream) + count++ + } + present_ = object.bitmap_&256 != 0 && object.kubeletConfigs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kubelet_configs") + WriteStringList(object.kubeletConfigs, stream) + count++ + } + present_ = object.bitmap_&512 != 0 && object.labels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("labels") + if object.labels != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.labels)) + i := 0 + for key := range object.labels { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.labels[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&1024 != 0 && object.managementUpgrade != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("management_upgrade") + WriteNodePoolManagementUpgrade(object.managementUpgrade, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.nodeDrainGracePeriod != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("node_drain_grace_period") + WriteValue(object.nodeDrainGracePeriod, stream) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("replicas") + stream.WriteInt(object.replicas) + count++ + } + present_ = object.bitmap_&8192 != 0 && object.status != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + WriteNodePoolStatus(object.status, stream) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnet") + stream.WriteString(object.subnet) + count++ + } + present_ = object.bitmap_&32768 != 0 && object.taints != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("taints") + WriteTaintList(object.taints, stream) + count++ + } + present_ = object.bitmap_&65536 != 0 && object.tuningConfigs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("tuning_configs") + WriteStringList(object.tuningConfigs, stream) + count++ + } + present_ = object.bitmap_&131072 != 0 && object.version != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + WriteVersion(object.version, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalNodePool reads a value of the 'node_pool' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNodePool(source interface{}) (object *NodePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNodePool(iterator) + err = iterator.Error + return +} + +// ReadNodePool reads a value of the 'node_pool' type from the given iterator. +func ReadNodePool(iterator *jsoniter.Iterator) *NodePool { + object := &NodePool{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == NodePoolLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "aws_node_pool": + value := ReadAWSNodePool(iterator) + object.awsNodePool = value + object.bitmap_ |= 8 + case "auto_repair": + value := iterator.ReadBool() + object.autoRepair = value + object.bitmap_ |= 16 + case "autoscaling": + value := ReadNodePoolAutoscaling(iterator) + object.autoscaling = value + object.bitmap_ |= 32 + case "availability_zone": + value := iterator.ReadString() + object.availabilityZone = value + object.bitmap_ |= 64 + case "azure_node_pool": + value := ReadAzureNodePool(iterator) + object.azureNodePool = value + object.bitmap_ |= 128 + case "kubelet_configs": + value := ReadStringList(iterator) + object.kubeletConfigs = value + object.bitmap_ |= 256 + case "labels": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.labels = value + object.bitmap_ |= 512 + case "management_upgrade": + value := ReadNodePoolManagementUpgrade(iterator) + object.managementUpgrade = value + object.bitmap_ |= 1024 + case "node_drain_grace_period": + value := ReadValue(iterator) + object.nodeDrainGracePeriod = value + object.bitmap_ |= 2048 + case "replicas": + value := iterator.ReadInt() + object.replicas = value + object.bitmap_ |= 4096 + case "status": + value := ReadNodePoolStatus(iterator) + object.status = value + object.bitmap_ |= 8192 + case "subnet": + value := iterator.ReadString() + object.subnet = value + object.bitmap_ |= 16384 + case "taints": + value := ReadTaintList(iterator) + object.taints = value + object.bitmap_ |= 32768 + case "tuning_configs": + value := ReadStringList(iterator) + object.tuningConfigs = value + object.bitmap_ |= 65536 + case "version": + value := ReadVersion(iterator) + object.version = value + object.bitmap_ |= 131072 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/oidc_config_builder.go b/clientapi/arohcp/v1alpha1/oidc_config_builder.go new file mode 100644 index 00000000..d15571e8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/oidc_config_builder.go @@ -0,0 +1,167 @@ +/* +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 ( + time "time" +) + +// OidcConfigBuilder contains the data and logic needed to build 'oidc_config' objects. +// +// Contains the necessary attributes to support oidc configuration hosting under Red Hat or registering a Customer's byo oidc config. +type OidcConfigBuilder struct { + bitmap_ uint32 + href string + id string + creationTimestamp time.Time + installerRoleArn string + issuerUrl string + lastUpdateTimestamp time.Time + lastUsedTimestamp time.Time + organizationId string + secretArn string + managed bool + reusable bool +} + +// NewOidcConfig creates a new builder of 'oidc_config' objects. +func NewOidcConfig() *OidcConfigBuilder { + return &OidcConfigBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *OidcConfigBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// HREF sets the value of the 'HREF' attribute to the given value. +func (b *OidcConfigBuilder) HREF(value string) *OidcConfigBuilder { + b.href = value + b.bitmap_ |= 1 + return b +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *OidcConfigBuilder) ID(value string) *OidcConfigBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *OidcConfigBuilder) CreationTimestamp(value time.Time) *OidcConfigBuilder { + b.creationTimestamp = value + b.bitmap_ |= 4 + return b +} + +// InstallerRoleArn sets the value of the 'installer_role_arn' attribute to the given value. +func (b *OidcConfigBuilder) InstallerRoleArn(value string) *OidcConfigBuilder { + b.installerRoleArn = value + b.bitmap_ |= 8 + return b +} + +// IssuerUrl sets the value of the 'issuer_url' attribute to the given value. +func (b *OidcConfigBuilder) IssuerUrl(value string) *OidcConfigBuilder { + b.issuerUrl = value + b.bitmap_ |= 16 + return b +} + +// LastUpdateTimestamp sets the value of the 'last_update_timestamp' attribute to the given value. +func (b *OidcConfigBuilder) LastUpdateTimestamp(value time.Time) *OidcConfigBuilder { + b.lastUpdateTimestamp = value + b.bitmap_ |= 32 + return b +} + +// LastUsedTimestamp sets the value of the 'last_used_timestamp' attribute to the given value. +func (b *OidcConfigBuilder) LastUsedTimestamp(value time.Time) *OidcConfigBuilder { + b.lastUsedTimestamp = value + b.bitmap_ |= 64 + return b +} + +// Managed sets the value of the 'managed' attribute to the given value. +func (b *OidcConfigBuilder) Managed(value bool) *OidcConfigBuilder { + b.managed = value + b.bitmap_ |= 128 + return b +} + +// OrganizationId sets the value of the 'organization_id' attribute to the given value. +func (b *OidcConfigBuilder) OrganizationId(value string) *OidcConfigBuilder { + b.organizationId = value + b.bitmap_ |= 256 + return b +} + +// Reusable sets the value of the 'reusable' attribute to the given value. +func (b *OidcConfigBuilder) Reusable(value bool) *OidcConfigBuilder { + b.reusable = value + b.bitmap_ |= 512 + return b +} + +// SecretArn sets the value of the 'secret_arn' attribute to the given value. +func (b *OidcConfigBuilder) SecretArn(value string) *OidcConfigBuilder { + b.secretArn = value + b.bitmap_ |= 1024 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *OidcConfigBuilder) Copy(object *OidcConfig) *OidcConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.href = object.href + b.id = object.id + b.creationTimestamp = object.creationTimestamp + b.installerRoleArn = object.installerRoleArn + b.issuerUrl = object.issuerUrl + b.lastUpdateTimestamp = object.lastUpdateTimestamp + b.lastUsedTimestamp = object.lastUsedTimestamp + b.managed = object.managed + b.organizationId = object.organizationId + b.reusable = object.reusable + b.secretArn = object.secretArn + return b +} + +// Build creates a 'oidc_config' object using the configuration stored in the builder. +func (b *OidcConfigBuilder) Build() (object *OidcConfig, err error) { + object = new(OidcConfig) + object.bitmap_ = b.bitmap_ + object.href = b.href + object.id = b.id + object.creationTimestamp = b.creationTimestamp + object.installerRoleArn = b.installerRoleArn + object.issuerUrl = b.issuerUrl + object.lastUpdateTimestamp = b.lastUpdateTimestamp + object.lastUsedTimestamp = b.lastUsedTimestamp + object.managed = b.managed + object.organizationId = b.organizationId + object.reusable = b.reusable + object.secretArn = b.secretArn + return +} diff --git a/clientapi/arohcp/v1alpha1/oidc_config_list_builder.go b/clientapi/arohcp/v1alpha1/oidc_config_list_builder.go new file mode 100644 index 00000000..5a23334b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/oidc_config_list_builder.go @@ -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 + +// OidcConfigListBuilder contains the data and logic needed to build +// 'oidc_config' objects. +type OidcConfigListBuilder struct { + items []*OidcConfigBuilder +} + +// NewOidcConfigList creates a new builder of 'oidc_config' objects. +func NewOidcConfigList() *OidcConfigListBuilder { + return new(OidcConfigListBuilder) +} + +// Items sets the items of the list. +func (b *OidcConfigListBuilder) Items(values ...*OidcConfigBuilder) *OidcConfigListBuilder { + b.items = make([]*OidcConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *OidcConfigListBuilder) 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 *OidcConfigListBuilder) Copy(list *OidcConfigList) *OidcConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*OidcConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewOidcConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'oidc_config' objects using the +// configuration stored in the builder. +func (b *OidcConfigListBuilder) Build() (list *OidcConfigList, err error) { + items := make([]*OidcConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(OidcConfigList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/oidc_config_list_type_json.go b/clientapi/arohcp/v1alpha1/oidc_config_list_type_json.go new file mode 100644 index 00000000..f62d0a64 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/oidc_config_list_type_json.go @@ -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" +) + +// MarshalOidcConfigList writes a list of values of the 'oidc_config' type to +// the given writer. +func MarshalOidcConfigList(list []*OidcConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOidcConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOidcConfigList writes a list of value of the 'oidc_config' type to +// the given stream. +func WriteOidcConfigList(list []*OidcConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteOidcConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalOidcConfigList reads a list of values of the 'oidc_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalOidcConfigList(source interface{}) (items []*OidcConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadOidcConfigList(iterator) + err = iterator.Error + return +} + +// ReadOidcConfigList reads list of values of the ”oidc_config' type from +// the given iterator. +func ReadOidcConfigList(iterator *jsoniter.Iterator) []*OidcConfig { + list := []*OidcConfig{} + for iterator.ReadArray() { + item := ReadOidcConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/oidc_config_type.go b/clientapi/arohcp/v1alpha1/oidc_config_type.go new file mode 100644 index 00000000..df16b610 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/oidc_config_type.go @@ -0,0 +1,409 @@ +/* +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 ( + time "time" +) + +// OidcConfig represents the values of the 'oidc_config' type. +// +// Contains the necessary attributes to support oidc configuration hosting under Red Hat or registering a Customer's byo oidc config. +type OidcConfig struct { + bitmap_ uint32 + href string + id string + creationTimestamp time.Time + installerRoleArn string + issuerUrl string + lastUpdateTimestamp time.Time + lastUsedTimestamp time.Time + organizationId string + secretArn string + managed bool + reusable bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *OidcConfig) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// HREF returns the value of the 'HREF' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HREF for the oidc config, filled in response. +func (o *OidcConfig) HREF() string { + if o != nil && o.bitmap_&1 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the value of the 'HREF' attribute and +// a flag indicating if the attribute has a value. +// +// HREF for the oidc config, filled in response. +func (o *OidcConfig) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.href + } + return +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID for the oidc config, filled in response. +func (o *OidcConfig) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID for the oidc config, filled in response. +func (o *OidcConfig) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Creation timestamp, filled in response. +func (o *OidcConfig) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&4 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Creation timestamp, filled in response. +func (o *OidcConfig) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// InstallerRoleArn returns the value of the 'installer_role_arn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN of the AWS role to assume when installing the cluster as to reveal the secret, supplied in request. It is only to be used in Unmanaged Oidc Config. +func (o *OidcConfig) InstallerRoleArn() string { + if o != nil && o.bitmap_&8 != 0 { + return o.installerRoleArn + } + return "" +} + +// GetInstallerRoleArn returns the value of the 'installer_role_arn' attribute and +// a flag indicating if the attribute has a value. +// +// ARN of the AWS role to assume when installing the cluster as to reveal the secret, supplied in request. It is only to be used in Unmanaged Oidc Config. +func (o *OidcConfig) GetInstallerRoleArn() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.installerRoleArn + } + return +} + +// IssuerUrl returns the value of the 'issuer_url' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Issuer URL, filled in response when Managed and supplied in Unmanaged. +func (o *OidcConfig) IssuerUrl() string { + if o != nil && o.bitmap_&16 != 0 { + return o.issuerUrl + } + return "" +} + +// GetIssuerUrl returns the value of the 'issuer_url' attribute and +// a flag indicating if the attribute has a value. +// +// Issuer URL, filled in response when Managed and supplied in Unmanaged. +func (o *OidcConfig) GetIssuerUrl() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.issuerUrl + } + return +} + +// LastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Last update timestamp, filled when patching a valid attribute of this oidc config. +func (o *OidcConfig) LastUpdateTimestamp() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.lastUpdateTimestamp + } + return time.Time{} +} + +// GetLastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Last update timestamp, filled when patching a valid attribute of this oidc config. +func (o *OidcConfig) GetLastUpdateTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.lastUpdateTimestamp + } + return +} + +// LastUsedTimestamp returns the value of the 'last_used_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Last used timestamp, filled by the latest cluster that used this oidc config. +func (o *OidcConfig) LastUsedTimestamp() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.lastUsedTimestamp + } + return time.Time{} +} + +// GetLastUsedTimestamp returns the value of the 'last_used_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Last used timestamp, filled by the latest cluster that used this oidc config. +func (o *OidcConfig) GetLastUsedTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.lastUsedTimestamp + } + return +} + +// Managed returns the value of the 'managed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates whether it is Managed or Unmanaged (Customer hosted). +func (o *OidcConfig) Managed() bool { + if o != nil && o.bitmap_&128 != 0 { + return o.managed + } + return false +} + +// GetManaged returns the value of the 'managed' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates whether it is Managed or Unmanaged (Customer hosted). +func (o *OidcConfig) GetManaged() (value bool, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.managed + } + return +} + +// OrganizationId returns the value of the 'organization_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Organization ID, filled in response respecting token provided. +func (o *OidcConfig) OrganizationId() string { + if o != nil && o.bitmap_&256 != 0 { + return o.organizationId + } + return "" +} + +// GetOrganizationId returns the value of the 'organization_id' attribute and +// a flag indicating if the attribute has a value. +// +// Organization ID, filled in response respecting token provided. +func (o *OidcConfig) GetOrganizationId() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.organizationId + } + return +} + +// Reusable returns the value of the 'reusable' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates whether the Oidc Config can be reused. +func (o *OidcConfig) Reusable() bool { + if o != nil && o.bitmap_&512 != 0 { + return o.reusable + } + return false +} + +// GetReusable returns the value of the 'reusable' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates whether the Oidc Config can be reused. +func (o *OidcConfig) GetReusable() (value bool, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.reusable + } + return +} + +// SecretArn returns the value of the 'secret_arn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Secrets Manager ARN for the OIDC private key, supplied in request. It is only to be used in Unmanaged Oidc Config. +func (o *OidcConfig) SecretArn() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.secretArn + } + return "" +} + +// GetSecretArn returns the value of the 'secret_arn' attribute and +// a flag indicating if the attribute has a value. +// +// Secrets Manager ARN for the OIDC private key, supplied in request. It is only to be used in Unmanaged Oidc Config. +func (o *OidcConfig) GetSecretArn() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.secretArn + } + return +} + +// OidcConfigListKind is the name of the type used to represent list of objects of +// type 'oidc_config'. +const OidcConfigListKind = "OidcConfigList" + +// OidcConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'oidc_config'. +const OidcConfigListLinkKind = "OidcConfigListLink" + +// OidcConfigNilKind is the name of the type used to nil lists of objects of +// type 'oidc_config'. +const OidcConfigListNilKind = "OidcConfigListNil" + +// OidcConfigList is a list of values of the 'oidc_config' type. +type OidcConfigList struct { + href string + link bool + items []*OidcConfig +} + +// Len returns the length of the list. +func (l *OidcConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *OidcConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *OidcConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *OidcConfigList) SetItems(items []*OidcConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *OidcConfigList) Items() []*OidcConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *OidcConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *OidcConfigList) Get(i int) *OidcConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *OidcConfigList) Slice() []*OidcConfig { + var slice []*OidcConfig + if l == nil { + slice = make([]*OidcConfig, 0) + } else { + slice = make([]*OidcConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *OidcConfigList) Each(f func(item *OidcConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *OidcConfigList) Range(f func(index int, item *OidcConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/oidc_config_type_json.go b/clientapi/arohcp/v1alpha1/oidc_config_type_json.go new file mode 100644 index 00000000..a47fcdc2 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/oidc_config_type_json.go @@ -0,0 +1,229 @@ +/* +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" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOidcConfig writes a value of the 'oidc_config' type to the given writer. +func MarshalOidcConfig(object *OidcConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOidcConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOidcConfig writes a value of the 'oidc_config' type to the given stream. +func WriteOidcConfig(object *OidcConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("installer_role_arn") + stream.WriteString(object.installerRoleArn) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("issuer_url") + stream.WriteString(object.issuerUrl) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_update_timestamp") + stream.WriteString((object.lastUpdateTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_used_timestamp") + stream.WriteString((object.lastUsedTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed") + stream.WriteBool(object.managed) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationId) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("reusable") + stream.WriteBool(object.reusable) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("secret_arn") + stream.WriteString(object.secretArn) + } + stream.WriteObjectEnd() +} + +// UnmarshalOidcConfig reads a value of the 'oidc_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalOidcConfig(source interface{}) (object *OidcConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadOidcConfig(iterator) + err = iterator.Error + return +} + +// ReadOidcConfig reads a value of the 'oidc_config' type from the given iterator. +func ReadOidcConfig(iterator *jsoniter.Iterator) *OidcConfig { + object := &OidcConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 1 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 2 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 4 + case "installer_role_arn": + value := iterator.ReadString() + object.installerRoleArn = value + object.bitmap_ |= 8 + case "issuer_url": + value := iterator.ReadString() + object.issuerUrl = value + object.bitmap_ |= 16 + case "last_update_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastUpdateTimestamp = value + object.bitmap_ |= 32 + case "last_used_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastUsedTimestamp = value + object.bitmap_ |= 64 + case "managed": + value := iterator.ReadBool() + object.managed = value + object.bitmap_ |= 128 + case "organization_id": + value := iterator.ReadString() + object.organizationId = value + object.bitmap_ |= 256 + case "reusable": + value := iterator.ReadBool() + object.reusable = value + object.bitmap_ |= 512 + case "secret_arn": + value := iterator.ReadString() + object.secretArn = value + object.bitmap_ |= 1024 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/operator_iam_role_builder.go b/clientapi/arohcp/v1alpha1/operator_iam_role_builder.go new file mode 100644 index 00000000..89d8da8e --- /dev/null +++ b/clientapi/arohcp/v1alpha1/operator_iam_role_builder.go @@ -0,0 +1,103 @@ +/* +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 + +// OperatorIAMRoleBuilder contains the data and logic needed to build 'operator_IAM_role' objects. +// +// Contains the necessary attributes to allow each operator to access the necessary AWS resources +type OperatorIAMRoleBuilder struct { + bitmap_ uint32 + id string + name string + namespace string + roleARN string + serviceAccount string +} + +// NewOperatorIAMRole creates a new builder of 'operator_IAM_role' objects. +func NewOperatorIAMRole() *OperatorIAMRoleBuilder { + return &OperatorIAMRoleBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *OperatorIAMRoleBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *OperatorIAMRoleBuilder) ID(value string) *OperatorIAMRoleBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *OperatorIAMRoleBuilder) Name(value string) *OperatorIAMRoleBuilder { + b.name = value + b.bitmap_ |= 2 + return b +} + +// Namespace sets the value of the 'namespace' attribute to the given value. +func (b *OperatorIAMRoleBuilder) Namespace(value string) *OperatorIAMRoleBuilder { + b.namespace = value + b.bitmap_ |= 4 + return b +} + +// RoleARN sets the value of the 'role_ARN' attribute to the given value. +func (b *OperatorIAMRoleBuilder) RoleARN(value string) *OperatorIAMRoleBuilder { + b.roleARN = value + b.bitmap_ |= 8 + return b +} + +// ServiceAccount sets the value of the 'service_account' attribute to the given value. +func (b *OperatorIAMRoleBuilder) ServiceAccount(value string) *OperatorIAMRoleBuilder { + b.serviceAccount = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *OperatorIAMRoleBuilder) Copy(object *OperatorIAMRole) *OperatorIAMRoleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.name = object.name + b.namespace = object.namespace + b.roleARN = object.roleARN + b.serviceAccount = object.serviceAccount + return b +} + +// Build creates a 'operator_IAM_role' object using the configuration stored in the builder. +func (b *OperatorIAMRoleBuilder) Build() (object *OperatorIAMRole, err error) { + object = new(OperatorIAMRole) + object.bitmap_ = b.bitmap_ + object.id = b.id + object.name = b.name + object.namespace = b.namespace + object.roleARN = b.roleARN + object.serviceAccount = b.serviceAccount + return +} diff --git a/clientapi/arohcp/v1alpha1/operator_iam_role_list_builder.go b/clientapi/arohcp/v1alpha1/operator_iam_role_list_builder.go new file mode 100644 index 00000000..78ccc0f0 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/operator_iam_role_list_builder.go @@ -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 + +// OperatorIAMRoleListBuilder contains the data and logic needed to build +// 'operator_IAM_role' objects. +type OperatorIAMRoleListBuilder struct { + items []*OperatorIAMRoleBuilder +} + +// NewOperatorIAMRoleList creates a new builder of 'operator_IAM_role' objects. +func NewOperatorIAMRoleList() *OperatorIAMRoleListBuilder { + return new(OperatorIAMRoleListBuilder) +} + +// Items sets the items of the list. +func (b *OperatorIAMRoleListBuilder) Items(values ...*OperatorIAMRoleBuilder) *OperatorIAMRoleListBuilder { + b.items = make([]*OperatorIAMRoleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *OperatorIAMRoleListBuilder) 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 *OperatorIAMRoleListBuilder) Copy(list *OperatorIAMRoleList) *OperatorIAMRoleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*OperatorIAMRoleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewOperatorIAMRole().Copy(v) + } + } + return b +} + +// Build creates a list of 'operator_IAM_role' objects using the +// configuration stored in the builder. +func (b *OperatorIAMRoleListBuilder) Build() (list *OperatorIAMRoleList, err error) { + items := make([]*OperatorIAMRole, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(OperatorIAMRoleList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/operator_iam_role_list_type_json.go b/clientapi/arohcp/v1alpha1/operator_iam_role_list_type_json.go new file mode 100644 index 00000000..24342a9b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/operator_iam_role_list_type_json.go @@ -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" +) + +// MarshalOperatorIAMRoleList writes a list of values of the 'operator_IAM_role' type to +// the given writer. +func MarshalOperatorIAMRoleList(list []*OperatorIAMRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOperatorIAMRoleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOperatorIAMRoleList writes a list of value of the 'operator_IAM_role' type to +// the given stream. +func WriteOperatorIAMRoleList(list []*OperatorIAMRole, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteOperatorIAMRole(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalOperatorIAMRoleList reads a list of values of the 'operator_IAM_role' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalOperatorIAMRoleList(source interface{}) (items []*OperatorIAMRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadOperatorIAMRoleList(iterator) + err = iterator.Error + return +} + +// ReadOperatorIAMRoleList reads list of values of the ”operator_IAM_role' type from +// the given iterator. +func ReadOperatorIAMRoleList(iterator *jsoniter.Iterator) []*OperatorIAMRole { + list := []*OperatorIAMRole{} + for iterator.ReadArray() { + item := ReadOperatorIAMRole(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/operator_iam_role_type.go b/clientapi/arohcp/v1alpha1/operator_iam_role_type.go new file mode 100644 index 00000000..4671c327 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/operator_iam_role_type.go @@ -0,0 +1,261 @@ +/* +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 + +// OperatorIAMRole represents the values of the 'operator_IAM_role' type. +// +// Contains the necessary attributes to allow each operator to access the necessary AWS resources +type OperatorIAMRole struct { + bitmap_ uint32 + id string + name string + namespace string + roleARN string + serviceAccount string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *OperatorIAMRole) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Randomly-generated ID to identify the operator role +func (o *OperatorIAMRole) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// Randomly-generated ID to identify the operator role +func (o *OperatorIAMRole) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the credentials secret used to access cloud resources +func (o *OperatorIAMRole) Name() string { + if o != nil && o.bitmap_&2 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the credentials secret used to access cloud resources +func (o *OperatorIAMRole) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.name + } + return +} + +// Namespace returns the value of the 'namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Namespace where the credentials secret lives in the cluster +func (o *OperatorIAMRole) Namespace() string { + if o != nil && o.bitmap_&4 != 0 { + return o.namespace + } + return "" +} + +// GetNamespace returns the value of the 'namespace' attribute and +// a flag indicating if the attribute has a value. +// +// Namespace where the credentials secret lives in the cluster +func (o *OperatorIAMRole) GetNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.namespace + } + return +} + +// RoleARN returns the value of the 'role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Role to assume when accessing AWS resources +func (o *OperatorIAMRole) RoleARN() string { + if o != nil && o.bitmap_&8 != 0 { + return o.roleARN + } + return "" +} + +// GetRoleARN returns the value of the 'role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// Role to assume when accessing AWS resources +func (o *OperatorIAMRole) GetRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.roleARN + } + return +} + +// ServiceAccount returns the value of the 'service_account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Service account name to use when authenticating +func (o *OperatorIAMRole) ServiceAccount() string { + if o != nil && o.bitmap_&16 != 0 { + return o.serviceAccount + } + return "" +} + +// GetServiceAccount returns the value of the 'service_account' attribute and +// a flag indicating if the attribute has a value. +// +// Service account name to use when authenticating +func (o *OperatorIAMRole) GetServiceAccount() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.serviceAccount + } + return +} + +// OperatorIAMRoleListKind is the name of the type used to represent list of objects of +// type 'operator_IAM_role'. +const OperatorIAMRoleListKind = "OperatorIAMRoleList" + +// OperatorIAMRoleListLinkKind is the name of the type used to represent links to list +// of objects of type 'operator_IAM_role'. +const OperatorIAMRoleListLinkKind = "OperatorIAMRoleListLink" + +// OperatorIAMRoleNilKind is the name of the type used to nil lists of objects of +// type 'operator_IAM_role'. +const OperatorIAMRoleListNilKind = "OperatorIAMRoleListNil" + +// OperatorIAMRoleList is a list of values of the 'operator_IAM_role' type. +type OperatorIAMRoleList struct { + href string + link bool + items []*OperatorIAMRole +} + +// Len returns the length of the list. +func (l *OperatorIAMRoleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *OperatorIAMRoleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *OperatorIAMRoleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *OperatorIAMRoleList) SetItems(items []*OperatorIAMRole) { + l.items = items +} + +// Items returns the items of the list. +func (l *OperatorIAMRoleList) Items() []*OperatorIAMRole { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *OperatorIAMRoleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *OperatorIAMRoleList) Get(i int) *OperatorIAMRole { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *OperatorIAMRoleList) Slice() []*OperatorIAMRole { + var slice []*OperatorIAMRole + if l == nil { + slice = make([]*OperatorIAMRole, 0) + } else { + slice = make([]*OperatorIAMRole, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *OperatorIAMRoleList) Each(f func(item *OperatorIAMRole) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *OperatorIAMRoleList) Range(f func(index int, item *OperatorIAMRole) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/operator_iam_role_type_json.go b/clientapi/arohcp/v1alpha1/operator_iam_role_type_json.go new file mode 100644 index 00000000..e0d12338 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/operator_iam_role_type_json.go @@ -0,0 +1,138 @@ +/* +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" +) + +// MarshalOperatorIAMRole writes a value of the 'operator_IAM_role' type to the given writer. +func MarshalOperatorIAMRole(object *OperatorIAMRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOperatorIAMRole(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOperatorIAMRole writes a value of the 'operator_IAM_role' type to the given stream. +func WriteOperatorIAMRole(object *OperatorIAMRole, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("namespace") + stream.WriteString(object.namespace) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role_arn") + stream.WriteString(object.roleARN) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_account") + stream.WriteString(object.serviceAccount) + } + stream.WriteObjectEnd() +} + +// UnmarshalOperatorIAMRole reads a value of the 'operator_IAM_role' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalOperatorIAMRole(source interface{}) (object *OperatorIAMRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadOperatorIAMRole(iterator) + err = iterator.Error + return +} + +// ReadOperatorIAMRole reads a value of the 'operator_IAM_role' type from the given iterator. +func ReadOperatorIAMRole(iterator *jsoniter.Iterator) *OperatorIAMRole { + object := &OperatorIAMRole{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 2 + case "namespace": + value := iterator.ReadString() + object.namespace = value + object.bitmap_ |= 4 + case "role_arn": + value := iterator.ReadString() + object.roleARN = value + object.bitmap_ |= 8 + case "service_account": + value := iterator.ReadString() + object.serviceAccount = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_builder.go b/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_builder.go new file mode 100644 index 00000000..9d5f25a3 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_builder.go @@ -0,0 +1,79 @@ +/* +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 + +// PrivateLinkClusterConfigurationBuilder contains the data and logic needed to build 'private_link_cluster_configuration' objects. +// +// Manages the configuration for the Private Links. +type PrivateLinkClusterConfigurationBuilder struct { + bitmap_ uint32 + principals []*PrivateLinkPrincipalBuilder +} + +// NewPrivateLinkClusterConfiguration creates a new builder of 'private_link_cluster_configuration' objects. +func NewPrivateLinkClusterConfiguration() *PrivateLinkClusterConfigurationBuilder { + return &PrivateLinkClusterConfigurationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *PrivateLinkClusterConfigurationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Principals sets the value of the 'principals' attribute to the given values. +func (b *PrivateLinkClusterConfigurationBuilder) Principals(values ...*PrivateLinkPrincipalBuilder) *PrivateLinkClusterConfigurationBuilder { + b.principals = make([]*PrivateLinkPrincipalBuilder, len(values)) + copy(b.principals, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *PrivateLinkClusterConfigurationBuilder) Copy(object *PrivateLinkClusterConfiguration) *PrivateLinkClusterConfigurationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.principals != nil { + b.principals = make([]*PrivateLinkPrincipalBuilder, len(object.principals)) + for i, v := range object.principals { + b.principals[i] = NewPrivateLinkPrincipal().Copy(v) + } + } else { + b.principals = nil + } + return b +} + +// Build creates a 'private_link_cluster_configuration' object using the configuration stored in the builder. +func (b *PrivateLinkClusterConfigurationBuilder) Build() (object *PrivateLinkClusterConfiguration, err error) { + object = new(PrivateLinkClusterConfiguration) + object.bitmap_ = b.bitmap_ + if b.principals != nil { + object.principals = make([]*PrivateLinkPrincipal, len(b.principals)) + for i, v := range b.principals { + object.principals[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_list_builder.go b/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_list_builder.go new file mode 100644 index 00000000..70bcecff --- /dev/null +++ b/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_list_builder.go @@ -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 + +// PrivateLinkClusterConfigurationListBuilder contains the data and logic needed to build +// 'private_link_cluster_configuration' objects. +type PrivateLinkClusterConfigurationListBuilder struct { + items []*PrivateLinkClusterConfigurationBuilder +} + +// NewPrivateLinkClusterConfigurationList creates a new builder of 'private_link_cluster_configuration' objects. +func NewPrivateLinkClusterConfigurationList() *PrivateLinkClusterConfigurationListBuilder { + return new(PrivateLinkClusterConfigurationListBuilder) +} + +// Items sets the items of the list. +func (b *PrivateLinkClusterConfigurationListBuilder) Items(values ...*PrivateLinkClusterConfigurationBuilder) *PrivateLinkClusterConfigurationListBuilder { + b.items = make([]*PrivateLinkClusterConfigurationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *PrivateLinkClusterConfigurationListBuilder) 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 *PrivateLinkClusterConfigurationListBuilder) Copy(list *PrivateLinkClusterConfigurationList) *PrivateLinkClusterConfigurationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*PrivateLinkClusterConfigurationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewPrivateLinkClusterConfiguration().Copy(v) + } + } + return b +} + +// Build creates a list of 'private_link_cluster_configuration' objects using the +// configuration stored in the builder. +func (b *PrivateLinkClusterConfigurationListBuilder) Build() (list *PrivateLinkClusterConfigurationList, err error) { + items := make([]*PrivateLinkClusterConfiguration, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(PrivateLinkClusterConfigurationList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_list_type_json.go b/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_list_type_json.go new file mode 100644 index 00000000..c985b4b5 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_list_type_json.go @@ -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" +) + +// MarshalPrivateLinkClusterConfigurationList writes a list of values of the 'private_link_cluster_configuration' type to +// the given writer. +func MarshalPrivateLinkClusterConfigurationList(list []*PrivateLinkClusterConfiguration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePrivateLinkClusterConfigurationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePrivateLinkClusterConfigurationList writes a list of value of the 'private_link_cluster_configuration' type to +// the given stream. +func WritePrivateLinkClusterConfigurationList(list []*PrivateLinkClusterConfiguration, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WritePrivateLinkClusterConfiguration(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalPrivateLinkClusterConfigurationList reads a list of values of the 'private_link_cluster_configuration' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalPrivateLinkClusterConfigurationList(source interface{}) (items []*PrivateLinkClusterConfiguration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadPrivateLinkClusterConfigurationList(iterator) + err = iterator.Error + return +} + +// ReadPrivateLinkClusterConfigurationList reads list of values of the ”private_link_cluster_configuration' type from +// the given iterator. +func ReadPrivateLinkClusterConfigurationList(iterator *jsoniter.Iterator) []*PrivateLinkClusterConfiguration { + list := []*PrivateLinkClusterConfiguration{} + for iterator.ReadArray() { + item := ReadPrivateLinkClusterConfiguration(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_type.go b/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_type.go new file mode 100644 index 00000000..8561557d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_type.go @@ -0,0 +1,165 @@ +/* +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 + +// PrivateLinkClusterConfiguration represents the values of the 'private_link_cluster_configuration' type. +// +// Manages the configuration for the Private Links. +type PrivateLinkClusterConfiguration struct { + bitmap_ uint32 + principals []*PrivateLinkPrincipal +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *PrivateLinkClusterConfiguration) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Principals returns the value of the 'principals' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of additional principals for the Private Link +func (o *PrivateLinkClusterConfiguration) Principals() []*PrivateLinkPrincipal { + if o != nil && o.bitmap_&1 != 0 { + return o.principals + } + return nil +} + +// GetPrincipals returns the value of the 'principals' attribute and +// a flag indicating if the attribute has a value. +// +// List of additional principals for the Private Link +func (o *PrivateLinkClusterConfiguration) GetPrincipals() (value []*PrivateLinkPrincipal, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.principals + } + return +} + +// PrivateLinkClusterConfigurationListKind is the name of the type used to represent list of objects of +// type 'private_link_cluster_configuration'. +const PrivateLinkClusterConfigurationListKind = "PrivateLinkClusterConfigurationList" + +// PrivateLinkClusterConfigurationListLinkKind is the name of the type used to represent links to list +// of objects of type 'private_link_cluster_configuration'. +const PrivateLinkClusterConfigurationListLinkKind = "PrivateLinkClusterConfigurationListLink" + +// PrivateLinkClusterConfigurationNilKind is the name of the type used to nil lists of objects of +// type 'private_link_cluster_configuration'. +const PrivateLinkClusterConfigurationListNilKind = "PrivateLinkClusterConfigurationListNil" + +// PrivateLinkClusterConfigurationList is a list of values of the 'private_link_cluster_configuration' type. +type PrivateLinkClusterConfigurationList struct { + href string + link bool + items []*PrivateLinkClusterConfiguration +} + +// Len returns the length of the list. +func (l *PrivateLinkClusterConfigurationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *PrivateLinkClusterConfigurationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *PrivateLinkClusterConfigurationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *PrivateLinkClusterConfigurationList) SetItems(items []*PrivateLinkClusterConfiguration) { + l.items = items +} + +// Items returns the items of the list. +func (l *PrivateLinkClusterConfigurationList) Items() []*PrivateLinkClusterConfiguration { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *PrivateLinkClusterConfigurationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *PrivateLinkClusterConfigurationList) Get(i int) *PrivateLinkClusterConfiguration { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *PrivateLinkClusterConfigurationList) Slice() []*PrivateLinkClusterConfiguration { + var slice []*PrivateLinkClusterConfiguration + if l == nil { + slice = make([]*PrivateLinkClusterConfiguration, 0) + } else { + slice = make([]*PrivateLinkClusterConfiguration, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *PrivateLinkClusterConfigurationList) Each(f func(item *PrivateLinkClusterConfiguration) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *PrivateLinkClusterConfigurationList) Range(f func(index int, item *PrivateLinkClusterConfiguration) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_type_json.go b/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_type_json.go new file mode 100644 index 00000000..dfeda3dc --- /dev/null +++ b/clientapi/arohcp/v1alpha1/private_link_cluster_configuration_type_json.go @@ -0,0 +1,86 @@ +/* +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" +) + +// MarshalPrivateLinkClusterConfiguration writes a value of the 'private_link_cluster_configuration' type to the given writer. +func MarshalPrivateLinkClusterConfiguration(object *PrivateLinkClusterConfiguration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePrivateLinkClusterConfiguration(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePrivateLinkClusterConfiguration writes a value of the 'private_link_cluster_configuration' type to the given stream. +func WritePrivateLinkClusterConfiguration(object *PrivateLinkClusterConfiguration, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.principals != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("principals") + WritePrivateLinkPrincipalList(object.principals, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalPrivateLinkClusterConfiguration reads a value of the 'private_link_cluster_configuration' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalPrivateLinkClusterConfiguration(source interface{}) (object *PrivateLinkClusterConfiguration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadPrivateLinkClusterConfiguration(iterator) + err = iterator.Error + return +} + +// ReadPrivateLinkClusterConfiguration reads a value of the 'private_link_cluster_configuration' type from the given iterator. +func ReadPrivateLinkClusterConfiguration(iterator *jsoniter.Iterator) *PrivateLinkClusterConfiguration { + object := &PrivateLinkClusterConfiguration{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "principals": + value := ReadPrivateLinkPrincipalList(iterator) + object.principals = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/private_link_principal_builder.go b/clientapi/arohcp/v1alpha1/private_link_principal_builder.go new file mode 100644 index 00000000..93e7fee3 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/private_link_principal_builder.go @@ -0,0 +1,87 @@ +/* +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 + +// PrivateLinkPrincipalBuilder contains the data and logic needed to build 'private_link_principal' objects. +type PrivateLinkPrincipalBuilder struct { + bitmap_ uint32 + id string + href string + principal string +} + +// NewPrivateLinkPrincipal creates a new builder of 'private_link_principal' objects. +func NewPrivateLinkPrincipal() *PrivateLinkPrincipalBuilder { + return &PrivateLinkPrincipalBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *PrivateLinkPrincipalBuilder) Link(value bool) *PrivateLinkPrincipalBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *PrivateLinkPrincipalBuilder) ID(value string) *PrivateLinkPrincipalBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *PrivateLinkPrincipalBuilder) HREF(value string) *PrivateLinkPrincipalBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *PrivateLinkPrincipalBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Principal sets the value of the 'principal' attribute to the given value. +func (b *PrivateLinkPrincipalBuilder) Principal(value string) *PrivateLinkPrincipalBuilder { + b.principal = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *PrivateLinkPrincipalBuilder) Copy(object *PrivateLinkPrincipal) *PrivateLinkPrincipalBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.principal = object.principal + return b +} + +// Build creates a 'private_link_principal' object using the configuration stored in the builder. +func (b *PrivateLinkPrincipalBuilder) Build() (object *PrivateLinkPrincipal, err error) { + object = new(PrivateLinkPrincipal) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.principal = b.principal + return +} diff --git a/clientapi/arohcp/v1alpha1/private_link_principal_list_builder.go b/clientapi/arohcp/v1alpha1/private_link_principal_list_builder.go new file mode 100644 index 00000000..f7b72c3b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/private_link_principal_list_builder.go @@ -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 + +// PrivateLinkPrincipalListBuilder contains the data and logic needed to build +// 'private_link_principal' objects. +type PrivateLinkPrincipalListBuilder struct { + items []*PrivateLinkPrincipalBuilder +} + +// NewPrivateLinkPrincipalList creates a new builder of 'private_link_principal' objects. +func NewPrivateLinkPrincipalList() *PrivateLinkPrincipalListBuilder { + return new(PrivateLinkPrincipalListBuilder) +} + +// Items sets the items of the list. +func (b *PrivateLinkPrincipalListBuilder) Items(values ...*PrivateLinkPrincipalBuilder) *PrivateLinkPrincipalListBuilder { + b.items = make([]*PrivateLinkPrincipalBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *PrivateLinkPrincipalListBuilder) 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 *PrivateLinkPrincipalListBuilder) Copy(list *PrivateLinkPrincipalList) *PrivateLinkPrincipalListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*PrivateLinkPrincipalBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewPrivateLinkPrincipal().Copy(v) + } + } + return b +} + +// Build creates a list of 'private_link_principal' objects using the +// configuration stored in the builder. +func (b *PrivateLinkPrincipalListBuilder) Build() (list *PrivateLinkPrincipalList, err error) { + items := make([]*PrivateLinkPrincipal, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(PrivateLinkPrincipalList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/private_link_principal_list_type_json.go b/clientapi/arohcp/v1alpha1/private_link_principal_list_type_json.go new file mode 100644 index 00000000..52c3bc6d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/private_link_principal_list_type_json.go @@ -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" +) + +// MarshalPrivateLinkPrincipalList writes a list of values of the 'private_link_principal' type to +// the given writer. +func MarshalPrivateLinkPrincipalList(list []*PrivateLinkPrincipal, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePrivateLinkPrincipalList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePrivateLinkPrincipalList writes a list of value of the 'private_link_principal' type to +// the given stream. +func WritePrivateLinkPrincipalList(list []*PrivateLinkPrincipal, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WritePrivateLinkPrincipal(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalPrivateLinkPrincipalList reads a list of values of the 'private_link_principal' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalPrivateLinkPrincipalList(source interface{}) (items []*PrivateLinkPrincipal, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadPrivateLinkPrincipalList(iterator) + err = iterator.Error + return +} + +// ReadPrivateLinkPrincipalList reads list of values of the ”private_link_principal' type from +// the given iterator. +func ReadPrivateLinkPrincipalList(iterator *jsoniter.Iterator) []*PrivateLinkPrincipal { + list := []*PrivateLinkPrincipal{} + for iterator.ReadArray() { + item := ReadPrivateLinkPrincipal(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/private_link_principal_type.go b/clientapi/arohcp/v1alpha1/private_link_principal_type.go new file mode 100644 index 00000000..53c39326 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/private_link_principal_type.go @@ -0,0 +1,263 @@ +/* +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 + +// PrivateLinkPrincipalKind is the name of the type used to represent objects +// of type 'private_link_principal'. +const PrivateLinkPrincipalKind = "PrivateLinkPrincipal" + +// PrivateLinkPrincipalLinkKind is the name of the type used to represent links +// to objects of type 'private_link_principal'. +const PrivateLinkPrincipalLinkKind = "PrivateLinkPrincipalLink" + +// PrivateLinkPrincipalNilKind is the name of the type used to nil references +// to objects of type 'private_link_principal'. +const PrivateLinkPrincipalNilKind = "PrivateLinkPrincipalNil" + +// PrivateLinkPrincipal represents the values of the 'private_link_principal' type. +type PrivateLinkPrincipal struct { + bitmap_ uint32 + id string + href string + principal string +} + +// Kind returns the name of the type of the object. +func (o *PrivateLinkPrincipal) Kind() string { + if o == nil { + return PrivateLinkPrincipalNilKind + } + if o.bitmap_&1 != 0 { + return PrivateLinkPrincipalLinkKind + } + return PrivateLinkPrincipalKind +} + +// Link returns true if this is a link. +func (o *PrivateLinkPrincipal) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *PrivateLinkPrincipal) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *PrivateLinkPrincipal) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *PrivateLinkPrincipal) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *PrivateLinkPrincipal) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *PrivateLinkPrincipal) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Principal returns the value of the 'principal' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN for a principal that is allowed for this Private Link. +func (o *PrivateLinkPrincipal) Principal() string { + if o != nil && o.bitmap_&8 != 0 { + return o.principal + } + return "" +} + +// GetPrincipal returns the value of the 'principal' attribute and +// a flag indicating if the attribute has a value. +// +// ARN for a principal that is allowed for this Private Link. +func (o *PrivateLinkPrincipal) GetPrincipal() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.principal + } + return +} + +// PrivateLinkPrincipalListKind is the name of the type used to represent list of objects of +// type 'private_link_principal'. +const PrivateLinkPrincipalListKind = "PrivateLinkPrincipalList" + +// PrivateLinkPrincipalListLinkKind is the name of the type used to represent links to list +// of objects of type 'private_link_principal'. +const PrivateLinkPrincipalListLinkKind = "PrivateLinkPrincipalListLink" + +// PrivateLinkPrincipalNilKind is the name of the type used to nil lists of objects of +// type 'private_link_principal'. +const PrivateLinkPrincipalListNilKind = "PrivateLinkPrincipalListNil" + +// PrivateLinkPrincipalList is a list of values of the 'private_link_principal' type. +type PrivateLinkPrincipalList struct { + href string + link bool + items []*PrivateLinkPrincipal +} + +// Kind returns the name of the type of the object. +func (l *PrivateLinkPrincipalList) Kind() string { + if l == nil { + return PrivateLinkPrincipalListNilKind + } + if l.link { + return PrivateLinkPrincipalListLinkKind + } + return PrivateLinkPrincipalListKind +} + +// Link returns true iif this is a link. +func (l *PrivateLinkPrincipalList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *PrivateLinkPrincipalList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *PrivateLinkPrincipalList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *PrivateLinkPrincipalList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *PrivateLinkPrincipalList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *PrivateLinkPrincipalList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *PrivateLinkPrincipalList) SetItems(items []*PrivateLinkPrincipal) { + l.items = items +} + +// Items returns the items of the list. +func (l *PrivateLinkPrincipalList) Items() []*PrivateLinkPrincipal { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *PrivateLinkPrincipalList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *PrivateLinkPrincipalList) Get(i int) *PrivateLinkPrincipal { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *PrivateLinkPrincipalList) Slice() []*PrivateLinkPrincipal { + var slice []*PrivateLinkPrincipal + if l == nil { + slice = make([]*PrivateLinkPrincipal, 0) + } else { + slice = make([]*PrivateLinkPrincipal, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *PrivateLinkPrincipalList) Each(f func(item *PrivateLinkPrincipal) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *PrivateLinkPrincipalList) Range(f func(index int, item *PrivateLinkPrincipal) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/private_link_principal_type_json.go b/clientapi/arohcp/v1alpha1/private_link_principal_type_json.go new file mode 100644 index 00000000..8bd16b84 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/private_link_principal_type_json.go @@ -0,0 +1,120 @@ +/* +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" +) + +// MarshalPrivateLinkPrincipal writes a value of the 'private_link_principal' type to the given writer. +func MarshalPrivateLinkPrincipal(object *PrivateLinkPrincipal, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePrivateLinkPrincipal(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePrivateLinkPrincipal writes a value of the 'private_link_principal' type to the given stream. +func WritePrivateLinkPrincipal(object *PrivateLinkPrincipal, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(PrivateLinkPrincipalLinkKind) + } else { + stream.WriteString(PrivateLinkPrincipalKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("principal") + stream.WriteString(object.principal) + } + stream.WriteObjectEnd() +} + +// UnmarshalPrivateLinkPrincipal reads a value of the 'private_link_principal' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalPrivateLinkPrincipal(source interface{}) (object *PrivateLinkPrincipal, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadPrivateLinkPrincipal(iterator) + err = iterator.Error + return +} + +// ReadPrivateLinkPrincipal reads a value of the 'private_link_principal' type from the given iterator. +func ReadPrivateLinkPrincipal(iterator *jsoniter.Iterator) *PrivateLinkPrincipal { + object := &PrivateLinkPrincipal{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == PrivateLinkPrincipalLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "principal": + value := iterator.ReadString() + object.principal = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/processor_type_list_type_json.go b/clientapi/arohcp/v1alpha1/processor_type_list_type_json.go new file mode 100644 index 00000000..4af214f3 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/processor_type_list_type_json.go @@ -0,0 +1,76 @@ +/* +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" +) + +// MarshalProcessorTypeList writes a list of values of the 'processor_type' type to +// the given writer. +func MarshalProcessorTypeList(list []ProcessorType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProcessorTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProcessorTypeList writes a list of value of the 'processor_type' type to +// the given stream. +func WriteProcessorTypeList(list []ProcessorType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalProcessorTypeList reads a list of values of the 'processor_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProcessorTypeList(source interface{}) (items []ProcessorType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProcessorTypeList(iterator) + err = iterator.Error + return +} + +// ReadProcessorTypeList reads list of values of the ”processor_type' type from +// the given iterator. +func ReadProcessorTypeList(iterator *jsoniter.Iterator) []ProcessorType { + list := []ProcessorType{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ProcessorType(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/processor_type_type.go b/clientapi/arohcp/v1alpha1/processor_type_type.go new file mode 100644 index 00000000..d4b940b8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/processor_type_type.go @@ -0,0 +1,30 @@ +/* +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 + +// ProcessorType represents the values of the 'processor_type' enumerated type. +type ProcessorType string + +const ( + // Amd64 + ProcessorTypeAMD64 ProcessorType = "amd64" + // Arm64 + ProcessorTypeARM64 ProcessorType = "arm64" +) diff --git a/clientapi/arohcp/v1alpha1/provision_shard_builder.go b/clientapi/arohcp/v1alpha1/provision_shard_builder.go new file mode 100644 index 00000000..bc92ddcf --- /dev/null +++ b/clientapi/arohcp/v1alpha1/provision_shard_builder.go @@ -0,0 +1,295 @@ +/* +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 ( + time "time" + + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// ProvisionShardBuilder contains the data and logic needed to build 'provision_shard' objects. +// +// Contains the properties of the provision shard, including AWS and GCP related configurations +type ProvisionShardBuilder struct { + bitmap_ uint32 + id string + href string + awsAccountOperatorConfig *ServerConfigBuilder + awsBaseDomain string + gcpBaseDomain string + gcpProjectOperator *ServerConfigBuilder + cloudProvider *v1.CloudProviderBuilder + creationTimestamp time.Time + hiveConfig *ServerConfigBuilder + hypershiftConfig *ServerConfigBuilder + lastUpdateTimestamp time.Time + managementCluster string + region *v1.CloudRegionBuilder + status string +} + +// NewProvisionShard creates a new builder of 'provision_shard' objects. +func NewProvisionShard() *ProvisionShardBuilder { + return &ProvisionShardBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ProvisionShardBuilder) Link(value bool) *ProvisionShardBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ProvisionShardBuilder) ID(value string) *ProvisionShardBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ProvisionShardBuilder) HREF(value string) *ProvisionShardBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ProvisionShardBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AWSAccountOperatorConfig sets the value of the 'AWS_account_operator_config' attribute to the given value. +// +// Representation of a server config +func (b *ProvisionShardBuilder) AWSAccountOperatorConfig(value *ServerConfigBuilder) *ProvisionShardBuilder { + b.awsAccountOperatorConfig = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// AWSBaseDomain sets the value of the 'AWS_base_domain' attribute to the given value. +func (b *ProvisionShardBuilder) AWSBaseDomain(value string) *ProvisionShardBuilder { + b.awsBaseDomain = value + b.bitmap_ |= 16 + return b +} + +// GCPBaseDomain sets the value of the 'GCP_base_domain' attribute to the given value. +func (b *ProvisionShardBuilder) GCPBaseDomain(value string) *ProvisionShardBuilder { + b.gcpBaseDomain = value + b.bitmap_ |= 32 + return b +} + +// GCPProjectOperator sets the value of the 'GCP_project_operator' attribute to the given value. +// +// Representation of a server config +func (b *ProvisionShardBuilder) GCPProjectOperator(value *ServerConfigBuilder) *ProvisionShardBuilder { + b.gcpProjectOperator = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +// +// Cloud provider. +func (b *ProvisionShardBuilder) CloudProvider(value *v1.CloudProviderBuilder) *ProvisionShardBuilder { + b.cloudProvider = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *ProvisionShardBuilder) CreationTimestamp(value time.Time) *ProvisionShardBuilder { + b.creationTimestamp = value + b.bitmap_ |= 256 + return b +} + +// HiveConfig sets the value of the 'hive_config' attribute to the given value. +// +// Representation of a server config +func (b *ProvisionShardBuilder) HiveConfig(value *ServerConfigBuilder) *ProvisionShardBuilder { + b.hiveConfig = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// HypershiftConfig sets the value of the 'hypershift_config' attribute to the given value. +// +// Representation of a server config +func (b *ProvisionShardBuilder) HypershiftConfig(value *ServerConfigBuilder) *ProvisionShardBuilder { + b.hypershiftConfig = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// LastUpdateTimestamp sets the value of the 'last_update_timestamp' attribute to the given value. +func (b *ProvisionShardBuilder) LastUpdateTimestamp(value time.Time) *ProvisionShardBuilder { + b.lastUpdateTimestamp = value + b.bitmap_ |= 2048 + return b +} + +// ManagementCluster sets the value of the 'management_cluster' attribute to the given value. +func (b *ProvisionShardBuilder) ManagementCluster(value string) *ProvisionShardBuilder { + b.managementCluster = value + b.bitmap_ |= 4096 + return b +} + +// Region sets the value of the 'region' attribute to the given value. +// +// Description of a region of a cloud provider. +func (b *ProvisionShardBuilder) Region(value *v1.CloudRegionBuilder) *ProvisionShardBuilder { + b.region = value + if value != nil { + b.bitmap_ |= 8192 + } else { + b.bitmap_ &^= 8192 + } + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *ProvisionShardBuilder) Status(value string) *ProvisionShardBuilder { + b.status = value + b.bitmap_ |= 16384 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ProvisionShardBuilder) Copy(object *ProvisionShard) *ProvisionShardBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.awsAccountOperatorConfig != nil { + b.awsAccountOperatorConfig = NewServerConfig().Copy(object.awsAccountOperatorConfig) + } else { + b.awsAccountOperatorConfig = nil + } + b.awsBaseDomain = object.awsBaseDomain + b.gcpBaseDomain = object.gcpBaseDomain + if object.gcpProjectOperator != nil { + b.gcpProjectOperator = NewServerConfig().Copy(object.gcpProjectOperator) + } else { + b.gcpProjectOperator = nil + } + if object.cloudProvider != nil { + b.cloudProvider = v1.NewCloudProvider().Copy(object.cloudProvider) + } else { + b.cloudProvider = nil + } + b.creationTimestamp = object.creationTimestamp + if object.hiveConfig != nil { + b.hiveConfig = NewServerConfig().Copy(object.hiveConfig) + } else { + b.hiveConfig = nil + } + if object.hypershiftConfig != nil { + b.hypershiftConfig = NewServerConfig().Copy(object.hypershiftConfig) + } else { + b.hypershiftConfig = nil + } + b.lastUpdateTimestamp = object.lastUpdateTimestamp + b.managementCluster = object.managementCluster + if object.region != nil { + b.region = v1.NewCloudRegion().Copy(object.region) + } else { + b.region = nil + } + b.status = object.status + return b +} + +// Build creates a 'provision_shard' object using the configuration stored in the builder. +func (b *ProvisionShardBuilder) Build() (object *ProvisionShard, err error) { + object = new(ProvisionShard) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.awsAccountOperatorConfig != nil { + object.awsAccountOperatorConfig, err = b.awsAccountOperatorConfig.Build() + if err != nil { + return + } + } + object.awsBaseDomain = b.awsBaseDomain + object.gcpBaseDomain = b.gcpBaseDomain + if b.gcpProjectOperator != nil { + object.gcpProjectOperator, err = b.gcpProjectOperator.Build() + if err != nil { + return + } + } + if b.cloudProvider != nil { + object.cloudProvider, err = b.cloudProvider.Build() + if err != nil { + return + } + } + object.creationTimestamp = b.creationTimestamp + if b.hiveConfig != nil { + object.hiveConfig, err = b.hiveConfig.Build() + if err != nil { + return + } + } + if b.hypershiftConfig != nil { + object.hypershiftConfig, err = b.hypershiftConfig.Build() + if err != nil { + return + } + } + object.lastUpdateTimestamp = b.lastUpdateTimestamp + object.managementCluster = b.managementCluster + if b.region != nil { + object.region, err = b.region.Build() + if err != nil { + return + } + } + object.status = b.status + return +} diff --git a/clientapi/arohcp/v1alpha1/provision_shard_list_builder.go b/clientapi/arohcp/v1alpha1/provision_shard_list_builder.go new file mode 100644 index 00000000..3c8eb7ad --- /dev/null +++ b/clientapi/arohcp/v1alpha1/provision_shard_list_builder.go @@ -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 + +// ProvisionShardListBuilder contains the data and logic needed to build +// 'provision_shard' objects. +type ProvisionShardListBuilder struct { + items []*ProvisionShardBuilder +} + +// NewProvisionShardList creates a new builder of 'provision_shard' objects. +func NewProvisionShardList() *ProvisionShardListBuilder { + return new(ProvisionShardListBuilder) +} + +// Items sets the items of the list. +func (b *ProvisionShardListBuilder) Items(values ...*ProvisionShardBuilder) *ProvisionShardListBuilder { + b.items = make([]*ProvisionShardBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ProvisionShardListBuilder) 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 *ProvisionShardListBuilder) Copy(list *ProvisionShardList) *ProvisionShardListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ProvisionShardBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewProvisionShard().Copy(v) + } + } + return b +} + +// Build creates a list of 'provision_shard' objects using the +// configuration stored in the builder. +func (b *ProvisionShardListBuilder) Build() (list *ProvisionShardList, err error) { + items := make([]*ProvisionShard, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ProvisionShardList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/provision_shard_list_type_json.go b/clientapi/arohcp/v1alpha1/provision_shard_list_type_json.go new file mode 100644 index 00000000..dd8320df --- /dev/null +++ b/clientapi/arohcp/v1alpha1/provision_shard_list_type_json.go @@ -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" +) + +// MarshalProvisionShardList writes a list of values of the 'provision_shard' type to +// the given writer. +func MarshalProvisionShardList(list []*ProvisionShard, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProvisionShardList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProvisionShardList writes a list of value of the 'provision_shard' type to +// the given stream. +func WriteProvisionShardList(list []*ProvisionShard, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteProvisionShard(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalProvisionShardList reads a list of values of the 'provision_shard' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProvisionShardList(source interface{}) (items []*ProvisionShard, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProvisionShardList(iterator) + err = iterator.Error + return +} + +// ReadProvisionShardList reads list of values of the ”provision_shard' type from +// the given iterator. +func ReadProvisionShardList(iterator *jsoniter.Iterator) []*ProvisionShard { + list := []*ProvisionShard{} + for iterator.ReadArray() { + item := ReadProvisionShard(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/provision_shard_topology_list_type_json.go b/clientapi/arohcp/v1alpha1/provision_shard_topology_list_type_json.go new file mode 100644 index 00000000..9bf57161 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/provision_shard_topology_list_type_json.go @@ -0,0 +1,76 @@ +/* +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" +) + +// MarshalProvisionShardTopologyList writes a list of values of the 'provision_shard_topology' type to +// the given writer. +func MarshalProvisionShardTopologyList(list []ProvisionShardTopology, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProvisionShardTopologyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProvisionShardTopologyList writes a list of value of the 'provision_shard_topology' type to +// the given stream. +func WriteProvisionShardTopologyList(list []ProvisionShardTopology, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalProvisionShardTopologyList reads a list of values of the 'provision_shard_topology' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProvisionShardTopologyList(source interface{}) (items []ProvisionShardTopology, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProvisionShardTopologyList(iterator) + err = iterator.Error + return +} + +// ReadProvisionShardTopologyList reads list of values of the ”provision_shard_topology' type from +// the given iterator. +func ReadProvisionShardTopologyList(iterator *jsoniter.Iterator) []ProvisionShardTopology { + list := []ProvisionShardTopology{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ProvisionShardTopology(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/provision_shard_topology_type.go b/clientapi/arohcp/v1alpha1/provision_shard_topology_type.go new file mode 100644 index 00000000..c407f04a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/provision_shard_topology_type.go @@ -0,0 +1,28 @@ +/* +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 + +// ProvisionShardTopology represents the values of the 'provision_shard_topology' enumerated type. +type ProvisionShardTopology string + +const ( + // Provision shard for hosted clusters is configured in a "dedicated" topology. + ProvisionShardTopologyDedicated ProvisionShardTopology = "dedicated" +) diff --git a/clientapi/arohcp/v1alpha1/provision_shard_type.go b/clientapi/arohcp/v1alpha1/provision_shard_type.go new file mode 100644 index 00000000..035ae76c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/provision_shard_type.go @@ -0,0 +1,541 @@ +/* +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 ( + time "time" + + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" +) + +// ProvisionShardKind is the name of the type used to represent objects +// of type 'provision_shard'. +const ProvisionShardKind = "ProvisionShard" + +// ProvisionShardLinkKind is the name of the type used to represent links +// to objects of type 'provision_shard'. +const ProvisionShardLinkKind = "ProvisionShardLink" + +// ProvisionShardNilKind is the name of the type used to nil references +// to objects of type 'provision_shard'. +const ProvisionShardNilKind = "ProvisionShardNil" + +// ProvisionShard represents the values of the 'provision_shard' type. +// +// Contains the properties of the provision shard, including AWS and GCP related configurations +type ProvisionShard struct { + bitmap_ uint32 + id string + href string + awsAccountOperatorConfig *ServerConfig + awsBaseDomain string + gcpBaseDomain string + gcpProjectOperator *ServerConfig + cloudProvider *v1.CloudProvider + creationTimestamp time.Time + hiveConfig *ServerConfig + hypershiftConfig *ServerConfig + lastUpdateTimestamp time.Time + managementCluster string + region *v1.CloudRegion + status string +} + +// Kind returns the name of the type of the object. +func (o *ProvisionShard) Kind() string { + if o == nil { + return ProvisionShardNilKind + } + if o.bitmap_&1 != 0 { + return ProvisionShardLinkKind + } + return ProvisionShardKind +} + +// Link returns true if this is a link. +func (o *ProvisionShard) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ProvisionShard) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ProvisionShard) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ProvisionShard) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ProvisionShard) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ProvisionShard) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AWSAccountOperatorConfig returns the value of the 'AWS_account_operator_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the configuration for the AWS account operator. +func (o *ProvisionShard) AWSAccountOperatorConfig() *ServerConfig { + if o != nil && o.bitmap_&8 != 0 { + return o.awsAccountOperatorConfig + } + return nil +} + +// GetAWSAccountOperatorConfig returns the value of the 'AWS_account_operator_config' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the configuration for the AWS account operator. +func (o *ProvisionShard) GetAWSAccountOperatorConfig() (value *ServerConfig, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.awsAccountOperatorConfig + } + return +} + +// AWSBaseDomain returns the value of the 'AWS_base_domain' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the AWS base domain. +func (o *ProvisionShard) AWSBaseDomain() string { + if o != nil && o.bitmap_&16 != 0 { + return o.awsBaseDomain + } + return "" +} + +// GetAWSBaseDomain returns the value of the 'AWS_base_domain' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the AWS base domain. +func (o *ProvisionShard) GetAWSBaseDomain() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.awsBaseDomain + } + return +} + +// GCPBaseDomain returns the value of the 'GCP_base_domain' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the GCP base domain. +func (o *ProvisionShard) GCPBaseDomain() string { + if o != nil && o.bitmap_&32 != 0 { + return o.gcpBaseDomain + } + return "" +} + +// GetGCPBaseDomain returns the value of the 'GCP_base_domain' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the GCP base domain. +func (o *ProvisionShard) GetGCPBaseDomain() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.gcpBaseDomain + } + return +} + +// GCPProjectOperator returns the value of the 'GCP_project_operator' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the configuration for the GCP project operator. +func (o *ProvisionShard) GCPProjectOperator() *ServerConfig { + if o != nil && o.bitmap_&64 != 0 { + return o.gcpProjectOperator + } + return nil +} + +// GetGCPProjectOperator returns the value of the 'GCP_project_operator' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the configuration for the GCP project operator. +func (o *ProvisionShard) GetGCPProjectOperator() (value *ServerConfig, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.gcpProjectOperator + } + return +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the cloud provider name. +func (o *ProvisionShard) CloudProvider() *v1.CloudProvider { + if o != nil && o.bitmap_&128 != 0 { + return o.cloudProvider + } + return nil +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the cloud provider name. +func (o *ProvisionShard) GetCloudProvider() (value *v1.CloudProvider, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the provision shard was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *ProvisionShard) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the provision shard was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *ProvisionShard) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// HiveConfig returns the value of the 'hive_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the configuration for Hive. +func (o *ProvisionShard) HiveConfig() *ServerConfig { + if o != nil && o.bitmap_&512 != 0 { + return o.hiveConfig + } + return nil +} + +// GetHiveConfig returns the value of the 'hive_config' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the configuration for Hive. +func (o *ProvisionShard) GetHiveConfig() (value *ServerConfig, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.hiveConfig + } + return +} + +// HypershiftConfig returns the value of the 'hypershift_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the configuration for Hypershift. +func (o *ProvisionShard) HypershiftConfig() *ServerConfig { + if o != nil && o.bitmap_&1024 != 0 { + return o.hypershiftConfig + } + return nil +} + +// GetHypershiftConfig returns the value of the 'hypershift_config' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the configuration for Hypershift. +func (o *ProvisionShard) GetHypershiftConfig() (value *ServerConfig, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.hypershiftConfig + } + return +} + +// LastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the provision shard was last updated, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *ProvisionShard) LastUpdateTimestamp() time.Time { + if o != nil && o.bitmap_&2048 != 0 { + return o.lastUpdateTimestamp + } + return time.Time{} +} + +// GetLastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the provision shard was last updated, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *ProvisionShard) GetLastUpdateTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.lastUpdateTimestamp + } + return +} + +// ManagementCluster returns the value of the 'management_cluster' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the name of the management cluster for Hypershift clusters that are assigned to this shard. +// This field is populated by OCM, and must not be overwritten via API. +func (o *ProvisionShard) ManagementCluster() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.managementCluster + } + return "" +} + +// GetManagementCluster returns the value of the 'management_cluster' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the name of the management cluster for Hypershift clusters that are assigned to this shard. +// This field is populated by OCM, and must not be overwritten via API. +func (o *ProvisionShard) GetManagementCluster() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.managementCluster + } + return +} + +// Region returns the value of the 'region' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the cloud-provider region in which the provisioner spins up the cluster. +func (o *ProvisionShard) Region() *v1.CloudRegion { + if o != nil && o.bitmap_&8192 != 0 { + return o.region + } + return nil +} + +// GetRegion returns the value of the 'region' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the cloud-provider region in which the provisioner spins up the cluster. +func (o *ProvisionShard) GetRegion() (value *v1.CloudRegion, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.region + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Status of the provision shard. Possible values: active/maintenance/offline. +func (o *ProvisionShard) Status() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.status + } + return "" +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// Status of the provision shard. Possible values: active/maintenance/offline. +func (o *ProvisionShard) GetStatus() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.status + } + return +} + +// ProvisionShardListKind is the name of the type used to represent list of objects of +// type 'provision_shard'. +const ProvisionShardListKind = "ProvisionShardList" + +// ProvisionShardListLinkKind is the name of the type used to represent links to list +// of objects of type 'provision_shard'. +const ProvisionShardListLinkKind = "ProvisionShardListLink" + +// ProvisionShardNilKind is the name of the type used to nil lists of objects of +// type 'provision_shard'. +const ProvisionShardListNilKind = "ProvisionShardListNil" + +// ProvisionShardList is a list of values of the 'provision_shard' type. +type ProvisionShardList struct { + href string + link bool + items []*ProvisionShard +} + +// Kind returns the name of the type of the object. +func (l *ProvisionShardList) Kind() string { + if l == nil { + return ProvisionShardListNilKind + } + if l.link { + return ProvisionShardListLinkKind + } + return ProvisionShardListKind +} + +// Link returns true iif this is a link. +func (l *ProvisionShardList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ProvisionShardList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ProvisionShardList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ProvisionShardList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ProvisionShardList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ProvisionShardList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ProvisionShardList) SetItems(items []*ProvisionShard) { + l.items = items +} + +// Items returns the items of the list. +func (l *ProvisionShardList) Items() []*ProvisionShard { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ProvisionShardList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ProvisionShardList) Get(i int) *ProvisionShard { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ProvisionShardList) Slice() []*ProvisionShard { + var slice []*ProvisionShard + if l == nil { + slice = make([]*ProvisionShard, 0) + } else { + slice = make([]*ProvisionShard, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ProvisionShardList) Each(f func(item *ProvisionShard) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ProvisionShardList) Range(f func(index int, item *ProvisionShard) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/provision_shard_type_json.go b/clientapi/arohcp/v1alpha1/provision_shard_type_json.go new file mode 100644 index 00000000..ab0c450a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/provision_shard_type_json.go @@ -0,0 +1,273 @@ +/* +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" + "time" + + jsoniter "github.com/json-iterator/go" + v1 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProvisionShard writes a value of the 'provision_shard' type to the given writer. +func MarshalProvisionShard(object *ProvisionShard, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProvisionShard(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProvisionShard writes a value of the 'provision_shard' type to the given stream. +func WriteProvisionShard(object *ProvisionShard, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ProvisionShardLinkKind) + } else { + stream.WriteString(ProvisionShardKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.awsAccountOperatorConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws_account_operator_config") + WriteServerConfig(object.awsAccountOperatorConfig, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws_base_domain") + stream.WriteString(object.awsBaseDomain) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp_base_domain") + stream.WriteString(object.gcpBaseDomain) + count++ + } + present_ = object.bitmap_&64 != 0 && object.gcpProjectOperator != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp_project_operator") + WriteServerConfig(object.gcpProjectOperator, stream) + count++ + } + present_ = object.bitmap_&128 != 0 && object.cloudProvider != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + v1.WriteCloudProvider(object.cloudProvider, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&512 != 0 && object.hiveConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hive_config") + WriteServerConfig(object.hiveConfig, stream) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.hypershiftConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hypershift_config") + WriteServerConfig(object.hypershiftConfig, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_update_timestamp") + stream.WriteString((object.lastUpdateTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("management_cluster") + stream.WriteString(object.managementCluster) + count++ + } + present_ = object.bitmap_&8192 != 0 && object.region != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region") + v1.WriteCloudRegion(object.region, stream) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteString(object.status) + } + stream.WriteObjectEnd() +} + +// UnmarshalProvisionShard reads a value of the 'provision_shard' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalProvisionShard(source interface{}) (object *ProvisionShard, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadProvisionShard(iterator) + err = iterator.Error + return +} + +// ReadProvisionShard reads a value of the 'provision_shard' type from the given iterator. +func ReadProvisionShard(iterator *jsoniter.Iterator) *ProvisionShard { + object := &ProvisionShard{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ProvisionShardLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "aws_account_operator_config": + value := ReadServerConfig(iterator) + object.awsAccountOperatorConfig = value + object.bitmap_ |= 8 + case "aws_base_domain": + value := iterator.ReadString() + object.awsBaseDomain = value + object.bitmap_ |= 16 + case "gcp_base_domain": + value := iterator.ReadString() + object.gcpBaseDomain = value + object.bitmap_ |= 32 + case "gcp_project_operator": + value := ReadServerConfig(iterator) + object.gcpProjectOperator = value + object.bitmap_ |= 64 + case "cloud_provider": + value := v1.ReadCloudProvider(iterator) + object.cloudProvider = value + object.bitmap_ |= 128 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 256 + case "hive_config": + value := ReadServerConfig(iterator) + object.hiveConfig = value + object.bitmap_ |= 512 + case "hypershift_config": + value := ReadServerConfig(iterator) + object.hypershiftConfig = value + object.bitmap_ |= 1024 + case "last_update_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastUpdateTimestamp = value + object.bitmap_ |= 2048 + case "management_cluster": + value := iterator.ReadString() + object.managementCluster = value + object.bitmap_ |= 4096 + case "region": + value := v1.ReadCloudRegion(iterator) + object.region = value + object.bitmap_ |= 8192 + case "status": + value := iterator.ReadString() + object.status = value + object.bitmap_ |= 16384 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/proxy_builder.go b/clientapi/arohcp/v1alpha1/proxy_builder.go new file mode 100644 index 00000000..d48cd620 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/proxy_builder.go @@ -0,0 +1,83 @@ +/* +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 + +// ProxyBuilder contains the data and logic needed to build 'proxy' objects. +// +// Proxy configuration of a cluster. +type ProxyBuilder struct { + bitmap_ uint32 + httpProxy string + httpsProxy string + noProxy string +} + +// NewProxy creates a new builder of 'proxy' objects. +func NewProxy() *ProxyBuilder { + return &ProxyBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ProxyBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// HTTPProxy sets the value of the 'HTTP_proxy' attribute to the given value. +func (b *ProxyBuilder) HTTPProxy(value string) *ProxyBuilder { + b.httpProxy = value + b.bitmap_ |= 1 + return b +} + +// HTTPSProxy sets the value of the 'HTTPS_proxy' attribute to the given value. +func (b *ProxyBuilder) HTTPSProxy(value string) *ProxyBuilder { + b.httpsProxy = value + b.bitmap_ |= 2 + return b +} + +// NoProxy sets the value of the 'no_proxy' attribute to the given value. +func (b *ProxyBuilder) NoProxy(value string) *ProxyBuilder { + b.noProxy = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ProxyBuilder) Copy(object *Proxy) *ProxyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.httpProxy = object.httpProxy + b.httpsProxy = object.httpsProxy + b.noProxy = object.noProxy + return b +} + +// Build creates a 'proxy' object using the configuration stored in the builder. +func (b *ProxyBuilder) Build() (object *Proxy, err error) { + object = new(Proxy) + object.bitmap_ = b.bitmap_ + object.httpProxy = b.httpProxy + object.httpsProxy = b.httpsProxy + object.noProxy = b.noProxy + return +} diff --git a/clientapi/arohcp/v1alpha1/proxy_list_builder.go b/clientapi/arohcp/v1alpha1/proxy_list_builder.go new file mode 100644 index 00000000..b9d1fdd5 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/proxy_list_builder.go @@ -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 + +// ProxyListBuilder contains the data and logic needed to build +// 'proxy' objects. +type ProxyListBuilder struct { + items []*ProxyBuilder +} + +// NewProxyList creates a new builder of 'proxy' objects. +func NewProxyList() *ProxyListBuilder { + return new(ProxyListBuilder) +} + +// Items sets the items of the list. +func (b *ProxyListBuilder) Items(values ...*ProxyBuilder) *ProxyListBuilder { + b.items = make([]*ProxyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ProxyListBuilder) 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 *ProxyListBuilder) Copy(list *ProxyList) *ProxyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ProxyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewProxy().Copy(v) + } + } + return b +} + +// Build creates a list of 'proxy' objects using the +// configuration stored in the builder. +func (b *ProxyListBuilder) Build() (list *ProxyList, err error) { + items := make([]*Proxy, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ProxyList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/proxy_list_type_json.go b/clientapi/arohcp/v1alpha1/proxy_list_type_json.go new file mode 100644 index 00000000..e6656b58 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/proxy_list_type_json.go @@ -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" +) + +// MarshalProxyList writes a list of values of the 'proxy' type to +// the given writer. +func MarshalProxyList(list []*Proxy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProxyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProxyList writes a list of value of the 'proxy' type to +// the given stream. +func WriteProxyList(list []*Proxy, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteProxy(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalProxyList reads a list of values of the 'proxy' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProxyList(source interface{}) (items []*Proxy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProxyList(iterator) + err = iterator.Error + return +} + +// ReadProxyList reads list of values of the ”proxy' type from +// the given iterator. +func ReadProxyList(iterator *jsoniter.Iterator) []*Proxy { + list := []*Proxy{} + for iterator.ReadArray() { + item := ReadProxy(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/proxy_type.go b/clientapi/arohcp/v1alpha1/proxy_type.go new file mode 100644 index 00000000..5ffe1c5a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/proxy_type.go @@ -0,0 +1,215 @@ +/* +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 + +// Proxy represents the values of the 'proxy' type. +// +// Proxy configuration of a cluster. +type Proxy struct { + bitmap_ uint32 + httpProxy string + httpsProxy string + noProxy string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Proxy) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// HTTPProxy returns the value of the 'HTTP_proxy' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HTTPProxy is the URL of the proxy for HTTP requests. +func (o *Proxy) HTTPProxy() string { + if o != nil && o.bitmap_&1 != 0 { + return o.httpProxy + } + return "" +} + +// GetHTTPProxy returns the value of the 'HTTP_proxy' attribute and +// a flag indicating if the attribute has a value. +// +// HTTPProxy is the URL of the proxy for HTTP requests. +func (o *Proxy) GetHTTPProxy() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.httpProxy + } + return +} + +// HTTPSProxy returns the value of the 'HTTPS_proxy' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HTTPSProxy is the URL of the proxy for HTTPS requests. +func (o *Proxy) HTTPSProxy() string { + if o != nil && o.bitmap_&2 != 0 { + return o.httpsProxy + } + return "" +} + +// GetHTTPSProxy returns the value of the 'HTTPS_proxy' attribute and +// a flag indicating if the attribute has a value. +// +// HTTPSProxy is the URL of the proxy for HTTPS requests. +func (o *Proxy) GetHTTPSProxy() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.httpsProxy + } + return +} + +// NoProxy returns the value of the 'no_proxy' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// NoProxy is a comma-separated list of domains and CIDRs for which +// the proxy should not be used +func (o *Proxy) NoProxy() string { + if o != nil && o.bitmap_&4 != 0 { + return o.noProxy + } + return "" +} + +// GetNoProxy returns the value of the 'no_proxy' attribute and +// a flag indicating if the attribute has a value. +// +// NoProxy is a comma-separated list of domains and CIDRs for which +// the proxy should not be used +func (o *Proxy) GetNoProxy() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.noProxy + } + return +} + +// ProxyListKind is the name of the type used to represent list of objects of +// type 'proxy'. +const ProxyListKind = "ProxyList" + +// ProxyListLinkKind is the name of the type used to represent links to list +// of objects of type 'proxy'. +const ProxyListLinkKind = "ProxyListLink" + +// ProxyNilKind is the name of the type used to nil lists of objects of +// type 'proxy'. +const ProxyListNilKind = "ProxyListNil" + +// ProxyList is a list of values of the 'proxy' type. +type ProxyList struct { + href string + link bool + items []*Proxy +} + +// Len returns the length of the list. +func (l *ProxyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ProxyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ProxyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ProxyList) SetItems(items []*Proxy) { + l.items = items +} + +// Items returns the items of the list. +func (l *ProxyList) Items() []*Proxy { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ProxyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ProxyList) Get(i int) *Proxy { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ProxyList) Slice() []*Proxy { + var slice []*Proxy + if l == nil { + slice = make([]*Proxy, 0) + } else { + slice = make([]*Proxy, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ProxyList) Each(f func(item *Proxy) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ProxyList) Range(f func(index int, item *Proxy) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/proxy_type_json.go b/clientapi/arohcp/v1alpha1/proxy_type_json.go new file mode 100644 index 00000000..e7695505 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/proxy_type_json.go @@ -0,0 +1,112 @@ +/* +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" +) + +// MarshalProxy writes a value of the 'proxy' type to the given writer. +func MarshalProxy(object *Proxy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProxy(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProxy writes a value of the 'proxy' type to the given stream. +func WriteProxy(object *Proxy, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("http_proxy") + stream.WriteString(object.httpProxy) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("https_proxy") + stream.WriteString(object.httpsProxy) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("no_proxy") + stream.WriteString(object.noProxy) + } + stream.WriteObjectEnd() +} + +// UnmarshalProxy reads a value of the 'proxy' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalProxy(source interface{}) (object *Proxy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadProxy(iterator) + err = iterator.Error + return +} + +// ReadProxy reads a value of the 'proxy' type from the given iterator. +func ReadProxy(iterator *jsoniter.Iterator) *Proxy { + object := &Proxy{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "http_proxy": + value := iterator.ReadString() + object.httpProxy = value + object.bitmap_ |= 1 + case "https_proxy": + value := iterator.ReadString() + object.httpsProxy = value + object.bitmap_ |= 2 + case "no_proxy": + value := iterator.ReadString() + object.noProxy = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/registry_allowlist_builder.go b/clientapi/arohcp/v1alpha1/registry_allowlist_builder.go new file mode 100644 index 00000000..e38c388a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_allowlist_builder.go @@ -0,0 +1,137 @@ +/* +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 ( + time "time" +) + +// RegistryAllowlistBuilder contains the data and logic needed to build 'registry_allowlist' objects. +// +// RegistryAllowlist represents a single registry allowlist. +type RegistryAllowlistBuilder struct { + bitmap_ uint32 + id string + href string + cloudProvider *CloudProviderBuilder + creationTimestamp time.Time + registries []string +} + +// NewRegistryAllowlist creates a new builder of 'registry_allowlist' objects. +func NewRegistryAllowlist() *RegistryAllowlistBuilder { + return &RegistryAllowlistBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *RegistryAllowlistBuilder) Link(value bool) *RegistryAllowlistBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *RegistryAllowlistBuilder) ID(value string) *RegistryAllowlistBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *RegistryAllowlistBuilder) HREF(value string) *RegistryAllowlistBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RegistryAllowlistBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +// +// Cloud provider. +func (b *RegistryAllowlistBuilder) CloudProvider(value *CloudProviderBuilder) *RegistryAllowlistBuilder { + b.cloudProvider = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *RegistryAllowlistBuilder) CreationTimestamp(value time.Time) *RegistryAllowlistBuilder { + b.creationTimestamp = value + b.bitmap_ |= 16 + return b +} + +// Registries sets the value of the 'registries' attribute to the given values. +func (b *RegistryAllowlistBuilder) Registries(values ...string) *RegistryAllowlistBuilder { + b.registries = make([]string, len(values)) + copy(b.registries, values) + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RegistryAllowlistBuilder) Copy(object *RegistryAllowlist) *RegistryAllowlistBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.cloudProvider != nil { + b.cloudProvider = NewCloudProvider().Copy(object.cloudProvider) + } else { + b.cloudProvider = nil + } + b.creationTimestamp = object.creationTimestamp + if object.registries != nil { + b.registries = make([]string, len(object.registries)) + copy(b.registries, object.registries) + } else { + b.registries = nil + } + return b +} + +// Build creates a 'registry_allowlist' object using the configuration stored in the builder. +func (b *RegistryAllowlistBuilder) Build() (object *RegistryAllowlist, err error) { + object = new(RegistryAllowlist) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.cloudProvider != nil { + object.cloudProvider, err = b.cloudProvider.Build() + if err != nil { + return + } + } + object.creationTimestamp = b.creationTimestamp + if b.registries != nil { + object.registries = make([]string, len(b.registries)) + copy(object.registries, b.registries) + } + return +} diff --git a/clientapi/arohcp/v1alpha1/registry_allowlist_list_builder.go b/clientapi/arohcp/v1alpha1/registry_allowlist_list_builder.go new file mode 100644 index 00000000..35f88ace --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_allowlist_list_builder.go @@ -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 + +// RegistryAllowlistListBuilder contains the data and logic needed to build +// 'registry_allowlist' objects. +type RegistryAllowlistListBuilder struct { + items []*RegistryAllowlistBuilder +} + +// NewRegistryAllowlistList creates a new builder of 'registry_allowlist' objects. +func NewRegistryAllowlistList() *RegistryAllowlistListBuilder { + return new(RegistryAllowlistListBuilder) +} + +// Items sets the items of the list. +func (b *RegistryAllowlistListBuilder) Items(values ...*RegistryAllowlistBuilder) *RegistryAllowlistListBuilder { + b.items = make([]*RegistryAllowlistBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RegistryAllowlistListBuilder) 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 *RegistryAllowlistListBuilder) Copy(list *RegistryAllowlistList) *RegistryAllowlistListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RegistryAllowlistBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRegistryAllowlist().Copy(v) + } + } + return b +} + +// Build creates a list of 'registry_allowlist' objects using the +// configuration stored in the builder. +func (b *RegistryAllowlistListBuilder) Build() (list *RegistryAllowlistList, err error) { + items := make([]*RegistryAllowlist, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RegistryAllowlistList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/registry_allowlist_list_type_json.go b/clientapi/arohcp/v1alpha1/registry_allowlist_list_type_json.go new file mode 100644 index 00000000..46a5b3d9 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_allowlist_list_type_json.go @@ -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" +) + +// MarshalRegistryAllowlistList writes a list of values of the 'registry_allowlist' type to +// the given writer. +func MarshalRegistryAllowlistList(list []*RegistryAllowlist, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistryAllowlistList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistryAllowlistList writes a list of value of the 'registry_allowlist' type to +// the given stream. +func WriteRegistryAllowlistList(list []*RegistryAllowlist, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRegistryAllowlist(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRegistryAllowlistList reads a list of values of the 'registry_allowlist' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRegistryAllowlistList(source interface{}) (items []*RegistryAllowlist, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRegistryAllowlistList(iterator) + err = iterator.Error + return +} + +// ReadRegistryAllowlistList reads list of values of the ”registry_allowlist' type from +// the given iterator. +func ReadRegistryAllowlistList(iterator *jsoniter.Iterator) []*RegistryAllowlist { + list := []*RegistryAllowlist{} + for iterator.ReadArray() { + item := ReadRegistryAllowlist(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/registry_allowlist_type.go b/clientapi/arohcp/v1alpha1/registry_allowlist_type.go new file mode 100644 index 00000000..37b8a410 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_allowlist_type.go @@ -0,0 +1,317 @@ +/* +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 ( + time "time" +) + +// RegistryAllowlistKind is the name of the type used to represent objects +// of type 'registry_allowlist'. +const RegistryAllowlistKind = "RegistryAllowlist" + +// RegistryAllowlistLinkKind is the name of the type used to represent links +// to objects of type 'registry_allowlist'. +const RegistryAllowlistLinkKind = "RegistryAllowlistLink" + +// RegistryAllowlistNilKind is the name of the type used to nil references +// to objects of type 'registry_allowlist'. +const RegistryAllowlistNilKind = "RegistryAllowlistNil" + +// RegistryAllowlist represents the values of the 'registry_allowlist' type. +// +// RegistryAllowlist represents a single registry allowlist. +type RegistryAllowlist struct { + bitmap_ uint32 + id string + href string + cloudProvider *CloudProvider + creationTimestamp time.Time + registries []string +} + +// Kind returns the name of the type of the object. +func (o *RegistryAllowlist) Kind() string { + if o == nil { + return RegistryAllowlistNilKind + } + if o.bitmap_&1 != 0 { + return RegistryAllowlistLinkKind + } + return RegistryAllowlistKind +} + +// Link returns true if this is a link. +func (o *RegistryAllowlist) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *RegistryAllowlist) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *RegistryAllowlist) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *RegistryAllowlist) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *RegistryAllowlist) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RegistryAllowlist) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// CloudProvider is the cloud provider for which this allowlist is valid. +func (o *RegistryAllowlist) CloudProvider() *CloudProvider { + if o != nil && o.bitmap_&8 != 0 { + return o.cloudProvider + } + return nil +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +// +// CloudProvider is the cloud provider for which this allowlist is valid. +func (o *RegistryAllowlist) GetCloudProvider() (value *CloudProvider, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// CreationTimestamp is the date and time when the allow list has been created. +func (o *RegistryAllowlist) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// CreationTimestamp is the date and time when the allow list has been created. +func (o *RegistryAllowlist) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// Registries returns the value of the 'registries' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Registries is the list of registries contained in this Allowlist. +func (o *RegistryAllowlist) Registries() []string { + if o != nil && o.bitmap_&32 != 0 { + return o.registries + } + return nil +} + +// GetRegistries returns the value of the 'registries' attribute and +// a flag indicating if the attribute has a value. +// +// Registries is the list of registries contained in this Allowlist. +func (o *RegistryAllowlist) GetRegistries() (value []string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.registries + } + return +} + +// RegistryAllowlistListKind is the name of the type used to represent list of objects of +// type 'registry_allowlist'. +const RegistryAllowlistListKind = "RegistryAllowlistList" + +// RegistryAllowlistListLinkKind is the name of the type used to represent links to list +// of objects of type 'registry_allowlist'. +const RegistryAllowlistListLinkKind = "RegistryAllowlistListLink" + +// RegistryAllowlistNilKind is the name of the type used to nil lists of objects of +// type 'registry_allowlist'. +const RegistryAllowlistListNilKind = "RegistryAllowlistListNil" + +// RegistryAllowlistList is a list of values of the 'registry_allowlist' type. +type RegistryAllowlistList struct { + href string + link bool + items []*RegistryAllowlist +} + +// Kind returns the name of the type of the object. +func (l *RegistryAllowlistList) Kind() string { + if l == nil { + return RegistryAllowlistListNilKind + } + if l.link { + return RegistryAllowlistListLinkKind + } + return RegistryAllowlistListKind +} + +// Link returns true iif this is a link. +func (l *RegistryAllowlistList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *RegistryAllowlistList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *RegistryAllowlistList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *RegistryAllowlistList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RegistryAllowlistList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RegistryAllowlistList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RegistryAllowlistList) SetItems(items []*RegistryAllowlist) { + l.items = items +} + +// Items returns the items of the list. +func (l *RegistryAllowlistList) Items() []*RegistryAllowlist { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RegistryAllowlistList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RegistryAllowlistList) Get(i int) *RegistryAllowlist { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RegistryAllowlistList) Slice() []*RegistryAllowlist { + var slice []*RegistryAllowlist + if l == nil { + slice = make([]*RegistryAllowlist, 0) + } else { + slice = make([]*RegistryAllowlist, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RegistryAllowlistList) Each(f func(item *RegistryAllowlist) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RegistryAllowlistList) Range(f func(index int, item *RegistryAllowlist) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/registry_allowlist_type_json.go b/clientapi/arohcp/v1alpha1/registry_allowlist_type_json.go new file mode 100644 index 00000000..80fb3dc2 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_allowlist_type_json.go @@ -0,0 +1,151 @@ +/* +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" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRegistryAllowlist writes a value of the 'registry_allowlist' type to the given writer. +func MarshalRegistryAllowlist(object *RegistryAllowlist, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistryAllowlist(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistryAllowlist writes a value of the 'registry_allowlist' type to the given stream. +func WriteRegistryAllowlist(object *RegistryAllowlist, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(RegistryAllowlistLinkKind) + } else { + stream.WriteString(RegistryAllowlistKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.cloudProvider != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + WriteCloudProvider(object.cloudProvider, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 && object.registries != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("registries") + WriteStringList(object.registries, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalRegistryAllowlist reads a value of the 'registry_allowlist' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRegistryAllowlist(source interface{}) (object *RegistryAllowlist, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRegistryAllowlist(iterator) + err = iterator.Error + return +} + +// ReadRegistryAllowlist reads a value of the 'registry_allowlist' type from the given iterator. +func ReadRegistryAllowlist(iterator *jsoniter.Iterator) *RegistryAllowlist { + object := &RegistryAllowlist{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == RegistryAllowlistLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "cloud_provider": + value := ReadCloudProvider(iterator) + object.cloudProvider = value + object.bitmap_ |= 8 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 16 + case "registries": + value := ReadStringList(iterator) + object.registries = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/registry_location_builder.go b/clientapi/arohcp/v1alpha1/registry_location_builder.go new file mode 100644 index 00000000..dd14e5c2 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_location_builder.go @@ -0,0 +1,74 @@ +/* +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 + +// RegistryLocationBuilder contains the data and logic needed to build 'registry_location' objects. +// +// RegistryLocation contains a location of the registry specified by the registry domain +// name. The domain name might include wildcards, like '*' or '??'. +type RegistryLocationBuilder struct { + bitmap_ uint32 + domainName string + insecure bool +} + +// NewRegistryLocation creates a new builder of 'registry_location' objects. +func NewRegistryLocation() *RegistryLocationBuilder { + return &RegistryLocationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RegistryLocationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// DomainName sets the value of the 'domain_name' attribute to the given value. +func (b *RegistryLocationBuilder) DomainName(value string) *RegistryLocationBuilder { + b.domainName = value + b.bitmap_ |= 1 + return b +} + +// Insecure sets the value of the 'insecure' attribute to the given value. +func (b *RegistryLocationBuilder) Insecure(value bool) *RegistryLocationBuilder { + b.insecure = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RegistryLocationBuilder) Copy(object *RegistryLocation) *RegistryLocationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.domainName = object.domainName + b.insecure = object.insecure + return b +} + +// Build creates a 'registry_location' object using the configuration stored in the builder. +func (b *RegistryLocationBuilder) Build() (object *RegistryLocation, err error) { + object = new(RegistryLocation) + object.bitmap_ = b.bitmap_ + object.domainName = b.domainName + object.insecure = b.insecure + return +} diff --git a/clientapi/arohcp/v1alpha1/registry_location_list_builder.go b/clientapi/arohcp/v1alpha1/registry_location_list_builder.go new file mode 100644 index 00000000..59e1004a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_location_list_builder.go @@ -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 + +// RegistryLocationListBuilder contains the data and logic needed to build +// 'registry_location' objects. +type RegistryLocationListBuilder struct { + items []*RegistryLocationBuilder +} + +// NewRegistryLocationList creates a new builder of 'registry_location' objects. +func NewRegistryLocationList() *RegistryLocationListBuilder { + return new(RegistryLocationListBuilder) +} + +// Items sets the items of the list. +func (b *RegistryLocationListBuilder) Items(values ...*RegistryLocationBuilder) *RegistryLocationListBuilder { + b.items = make([]*RegistryLocationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RegistryLocationListBuilder) 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 *RegistryLocationListBuilder) Copy(list *RegistryLocationList) *RegistryLocationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RegistryLocationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRegistryLocation().Copy(v) + } + } + return b +} + +// Build creates a list of 'registry_location' objects using the +// configuration stored in the builder. +func (b *RegistryLocationListBuilder) Build() (list *RegistryLocationList, err error) { + items := make([]*RegistryLocation, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RegistryLocationList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/registry_location_list_type_json.go b/clientapi/arohcp/v1alpha1/registry_location_list_type_json.go new file mode 100644 index 00000000..7453bf0a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_location_list_type_json.go @@ -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" +) + +// MarshalRegistryLocationList writes a list of values of the 'registry_location' type to +// the given writer. +func MarshalRegistryLocationList(list []*RegistryLocation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistryLocationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistryLocationList writes a list of value of the 'registry_location' type to +// the given stream. +func WriteRegistryLocationList(list []*RegistryLocation, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRegistryLocation(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRegistryLocationList reads a list of values of the 'registry_location' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRegistryLocationList(source interface{}) (items []*RegistryLocation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRegistryLocationList(iterator) + err = iterator.Error + return +} + +// ReadRegistryLocationList reads list of values of the ”registry_location' type from +// the given iterator. +func ReadRegistryLocationList(iterator *jsoniter.Iterator) []*RegistryLocation { + list := []*RegistryLocation{} + for iterator.ReadArray() { + item := ReadRegistryLocation(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/registry_location_type.go b/clientapi/arohcp/v1alpha1/registry_location_type.go new file mode 100644 index 00000000..5bf8df1d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_location_type.go @@ -0,0 +1,196 @@ +/* +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 + +// RegistryLocation represents the values of the 'registry_location' type. +// +// RegistryLocation contains a location of the registry specified by the registry domain +// name. The domain name might include wildcards, like '*' or '??'. +type RegistryLocation struct { + bitmap_ uint32 + domainName string + insecure bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RegistryLocation) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// DomainName returns the value of the 'domain_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// domainName specifies a domain name for the registry +// In case the registry use non-standard (80 or 443) port, the port should be included +// in the domain name as well. +func (o *RegistryLocation) DomainName() string { + if o != nil && o.bitmap_&1 != 0 { + return o.domainName + } + return "" +} + +// GetDomainName returns the value of the 'domain_name' attribute and +// a flag indicating if the attribute has a value. +// +// domainName specifies a domain name for the registry +// In case the registry use non-standard (80 or 443) port, the port should be included +// in the domain name as well. +func (o *RegistryLocation) GetDomainName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.domainName + } + return +} + +// Insecure returns the value of the 'insecure' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// insecure indicates whether the registry is secure (https) or insecure (http) +// By default (if not specified) the registry is assumed as secure. +func (o *RegistryLocation) Insecure() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.insecure + } + return false +} + +// GetInsecure returns the value of the 'insecure' attribute and +// a flag indicating if the attribute has a value. +// +// insecure indicates whether the registry is secure (https) or insecure (http) +// By default (if not specified) the registry is assumed as secure. +func (o *RegistryLocation) GetInsecure() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.insecure + } + return +} + +// RegistryLocationListKind is the name of the type used to represent list of objects of +// type 'registry_location'. +const RegistryLocationListKind = "RegistryLocationList" + +// RegistryLocationListLinkKind is the name of the type used to represent links to list +// of objects of type 'registry_location'. +const RegistryLocationListLinkKind = "RegistryLocationListLink" + +// RegistryLocationNilKind is the name of the type used to nil lists of objects of +// type 'registry_location'. +const RegistryLocationListNilKind = "RegistryLocationListNil" + +// RegistryLocationList is a list of values of the 'registry_location' type. +type RegistryLocationList struct { + href string + link bool + items []*RegistryLocation +} + +// Len returns the length of the list. +func (l *RegistryLocationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RegistryLocationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RegistryLocationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RegistryLocationList) SetItems(items []*RegistryLocation) { + l.items = items +} + +// Items returns the items of the list. +func (l *RegistryLocationList) Items() []*RegistryLocation { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RegistryLocationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RegistryLocationList) Get(i int) *RegistryLocation { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RegistryLocationList) Slice() []*RegistryLocation { + var slice []*RegistryLocation + if l == nil { + slice = make([]*RegistryLocation, 0) + } else { + slice = make([]*RegistryLocation, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RegistryLocationList) Each(f func(item *RegistryLocation) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RegistryLocationList) Range(f func(index int, item *RegistryLocation) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/registry_location_type_json.go b/clientapi/arohcp/v1alpha1/registry_location_type_json.go new file mode 100644 index 00000000..01445280 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_location_type_json.go @@ -0,0 +1,99 @@ +/* +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" +) + +// MarshalRegistryLocation writes a value of the 'registry_location' type to the given writer. +func MarshalRegistryLocation(object *RegistryLocation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistryLocation(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistryLocation writes a value of the 'registry_location' type to the given stream. +func WriteRegistryLocation(object *RegistryLocation, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("domain_name") + stream.WriteString(object.domainName) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("insecure") + stream.WriteBool(object.insecure) + } + stream.WriteObjectEnd() +} + +// UnmarshalRegistryLocation reads a value of the 'registry_location' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRegistryLocation(source interface{}) (object *RegistryLocation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRegistryLocation(iterator) + err = iterator.Error + return +} + +// ReadRegistryLocation reads a value of the 'registry_location' type from the given iterator. +func ReadRegistryLocation(iterator *jsoniter.Iterator) *RegistryLocation { + object := &RegistryLocation{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "domain_name": + value := iterator.ReadString() + object.domainName = value + object.bitmap_ |= 1 + case "insecure": + value := iterator.ReadBool() + object.insecure = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/registry_sources_builder.go b/clientapi/arohcp/v1alpha1/registry_sources_builder.go new file mode 100644 index 00000000..ded409e2 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_sources_builder.go @@ -0,0 +1,112 @@ +/* +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 + +// RegistrySourcesBuilder contains the data and logic needed to build 'registry_sources' objects. +// +// RegistrySources contains configuration that determines how the container runtime should treat individual +// registries when accessing images for builds and pods. For instance, whether or not to allow insecure access. +// It does not contain configuration for the internal cluster registry. +type RegistrySourcesBuilder struct { + bitmap_ uint32 + allowedRegistries []string + blockedRegistries []string + insecureRegistries []string +} + +// NewRegistrySources creates a new builder of 'registry_sources' objects. +func NewRegistrySources() *RegistrySourcesBuilder { + return &RegistrySourcesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RegistrySourcesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AllowedRegistries sets the value of the 'allowed_registries' attribute to the given values. +func (b *RegistrySourcesBuilder) AllowedRegistries(values ...string) *RegistrySourcesBuilder { + b.allowedRegistries = make([]string, len(values)) + copy(b.allowedRegistries, values) + b.bitmap_ |= 1 + return b +} + +// BlockedRegistries sets the value of the 'blocked_registries' attribute to the given values. +func (b *RegistrySourcesBuilder) BlockedRegistries(values ...string) *RegistrySourcesBuilder { + b.blockedRegistries = make([]string, len(values)) + copy(b.blockedRegistries, values) + b.bitmap_ |= 2 + return b +} + +// InsecureRegistries sets the value of the 'insecure_registries' attribute to the given values. +func (b *RegistrySourcesBuilder) InsecureRegistries(values ...string) *RegistrySourcesBuilder { + b.insecureRegistries = make([]string, len(values)) + copy(b.insecureRegistries, values) + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RegistrySourcesBuilder) Copy(object *RegistrySources) *RegistrySourcesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.allowedRegistries != nil { + b.allowedRegistries = make([]string, len(object.allowedRegistries)) + copy(b.allowedRegistries, object.allowedRegistries) + } else { + b.allowedRegistries = nil + } + if object.blockedRegistries != nil { + b.blockedRegistries = make([]string, len(object.blockedRegistries)) + copy(b.blockedRegistries, object.blockedRegistries) + } else { + b.blockedRegistries = nil + } + if object.insecureRegistries != nil { + b.insecureRegistries = make([]string, len(object.insecureRegistries)) + copy(b.insecureRegistries, object.insecureRegistries) + } else { + b.insecureRegistries = nil + } + return b +} + +// Build creates a 'registry_sources' object using the configuration stored in the builder. +func (b *RegistrySourcesBuilder) Build() (object *RegistrySources, err error) { + object = new(RegistrySources) + object.bitmap_ = b.bitmap_ + if b.allowedRegistries != nil { + object.allowedRegistries = make([]string, len(b.allowedRegistries)) + copy(object.allowedRegistries, b.allowedRegistries) + } + if b.blockedRegistries != nil { + object.blockedRegistries = make([]string, len(b.blockedRegistries)) + copy(object.blockedRegistries, b.blockedRegistries) + } + if b.insecureRegistries != nil { + object.insecureRegistries = make([]string, len(b.insecureRegistries)) + copy(object.insecureRegistries, b.insecureRegistries) + } + return +} diff --git a/clientapi/arohcp/v1alpha1/registry_sources_list_builder.go b/clientapi/arohcp/v1alpha1/registry_sources_list_builder.go new file mode 100644 index 00000000..b3b6393b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_sources_list_builder.go @@ -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 + +// RegistrySourcesListBuilder contains the data and logic needed to build +// 'registry_sources' objects. +type RegistrySourcesListBuilder struct { + items []*RegistrySourcesBuilder +} + +// NewRegistrySourcesList creates a new builder of 'registry_sources' objects. +func NewRegistrySourcesList() *RegistrySourcesListBuilder { + return new(RegistrySourcesListBuilder) +} + +// Items sets the items of the list. +func (b *RegistrySourcesListBuilder) Items(values ...*RegistrySourcesBuilder) *RegistrySourcesListBuilder { + b.items = make([]*RegistrySourcesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RegistrySourcesListBuilder) 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 *RegistrySourcesListBuilder) Copy(list *RegistrySourcesList) *RegistrySourcesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RegistrySourcesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRegistrySources().Copy(v) + } + } + return b +} + +// Build creates a list of 'registry_sources' objects using the +// configuration stored in the builder. +func (b *RegistrySourcesListBuilder) Build() (list *RegistrySourcesList, err error) { + items := make([]*RegistrySources, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RegistrySourcesList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/registry_sources_list_type_json.go b/clientapi/arohcp/v1alpha1/registry_sources_list_type_json.go new file mode 100644 index 00000000..43faba82 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_sources_list_type_json.go @@ -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" +) + +// MarshalRegistrySourcesList writes a list of values of the 'registry_sources' type to +// the given writer. +func MarshalRegistrySourcesList(list []*RegistrySources, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistrySourcesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistrySourcesList writes a list of value of the 'registry_sources' type to +// the given stream. +func WriteRegistrySourcesList(list []*RegistrySources, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRegistrySources(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRegistrySourcesList reads a list of values of the 'registry_sources' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRegistrySourcesList(source interface{}) (items []*RegistrySources, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRegistrySourcesList(iterator) + err = iterator.Error + return +} + +// ReadRegistrySourcesList reads list of values of the ”registry_sources' type from +// the given iterator. +func ReadRegistrySourcesList(iterator *jsoniter.Iterator) []*RegistrySources { + list := []*RegistrySources{} + for iterator.ReadArray() { + item := ReadRegistrySources(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/registry_sources_type.go b/clientapi/arohcp/v1alpha1/registry_sources_type.go new file mode 100644 index 00000000..e21ad69b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_sources_type.go @@ -0,0 +1,237 @@ +/* +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 + +// RegistrySources represents the values of the 'registry_sources' type. +// +// RegistrySources contains configuration that determines how the container runtime should treat individual +// registries when accessing images for builds and pods. For instance, whether or not to allow insecure access. +// It does not contain configuration for the internal cluster registry. +type RegistrySources struct { + bitmap_ uint32 + allowedRegistries []string + blockedRegistries []string + insecureRegistries []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RegistrySources) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AllowedRegistries returns the value of the 'allowed_registries' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AllowedRegistries: registries for which image pull and push actions are allowed. +// To specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name. +// For example, *.example.com. You can specify an individual repository within a registry. +// For example: reg1.io/myrepo/myapp:latest. All other registries are blocked. +// Mutually exclusive with `BlockedRegistries` +func (o *RegistrySources) AllowedRegistries() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.allowedRegistries + } + return nil +} + +// GetAllowedRegistries returns the value of the 'allowed_registries' attribute and +// a flag indicating if the attribute has a value. +// +// AllowedRegistries: registries for which image pull and push actions are allowed. +// To specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name. +// For example, *.example.com. You can specify an individual repository within a registry. +// For example: reg1.io/myrepo/myapp:latest. All other registries are blocked. +// Mutually exclusive with `BlockedRegistries` +func (o *RegistrySources) GetAllowedRegistries() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.allowedRegistries + } + return +} + +// BlockedRegistries returns the value of the 'blocked_registries' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// BlockedRegistries: registries for which image pull and push actions are denied. +// To specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name. +// For example, *.example.com. You can specify an individual repository within a registry. +// For example: reg1.io/myrepo/myapp:latest. All other registries are allowed. +// Mutually exclusive with `AllowedRegistries` +func (o *RegistrySources) BlockedRegistries() []string { + if o != nil && o.bitmap_&2 != 0 { + return o.blockedRegistries + } + return nil +} + +// GetBlockedRegistries returns the value of the 'blocked_registries' attribute and +// a flag indicating if the attribute has a value. +// +// BlockedRegistries: registries for which image pull and push actions are denied. +// To specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name. +// For example, *.example.com. You can specify an individual repository within a registry. +// For example: reg1.io/myrepo/myapp:latest. All other registries are allowed. +// Mutually exclusive with `AllowedRegistries` +func (o *RegistrySources) GetBlockedRegistries() (value []string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.blockedRegistries + } + return +} + +// InsecureRegistries returns the value of the 'insecure_registries' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// InsecureRegistries are registries which do not have a valid TLS certificate or only support HTTP connections. +// To specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name. +// For example, *.example.com. You can specify an individual repository within a registry. +// For example: reg1.io/myrepo/myapp:latest. +func (o *RegistrySources) InsecureRegistries() []string { + if o != nil && o.bitmap_&4 != 0 { + return o.insecureRegistries + } + return nil +} + +// GetInsecureRegistries returns the value of the 'insecure_registries' attribute and +// a flag indicating if the attribute has a value. +// +// InsecureRegistries are registries which do not have a valid TLS certificate or only support HTTP connections. +// To specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name. +// For example, *.example.com. You can specify an individual repository within a registry. +// For example: reg1.io/myrepo/myapp:latest. +func (o *RegistrySources) GetInsecureRegistries() (value []string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.insecureRegistries + } + return +} + +// RegistrySourcesListKind is the name of the type used to represent list of objects of +// type 'registry_sources'. +const RegistrySourcesListKind = "RegistrySourcesList" + +// RegistrySourcesListLinkKind is the name of the type used to represent links to list +// of objects of type 'registry_sources'. +const RegistrySourcesListLinkKind = "RegistrySourcesListLink" + +// RegistrySourcesNilKind is the name of the type used to nil lists of objects of +// type 'registry_sources'. +const RegistrySourcesListNilKind = "RegistrySourcesListNil" + +// RegistrySourcesList is a list of values of the 'registry_sources' type. +type RegistrySourcesList struct { + href string + link bool + items []*RegistrySources +} + +// Len returns the length of the list. +func (l *RegistrySourcesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RegistrySourcesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RegistrySourcesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RegistrySourcesList) SetItems(items []*RegistrySources) { + l.items = items +} + +// Items returns the items of the list. +func (l *RegistrySourcesList) Items() []*RegistrySources { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RegistrySourcesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RegistrySourcesList) Get(i int) *RegistrySources { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RegistrySourcesList) Slice() []*RegistrySources { + var slice []*RegistrySources + if l == nil { + slice = make([]*RegistrySources, 0) + } else { + slice = make([]*RegistrySources, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RegistrySourcesList) Each(f func(item *RegistrySources) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RegistrySourcesList) Range(f func(index int, item *RegistrySources) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/registry_sources_type_json.go b/clientapi/arohcp/v1alpha1/registry_sources_type_json.go new file mode 100644 index 00000000..642e446d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/registry_sources_type_json.go @@ -0,0 +1,112 @@ +/* +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" +) + +// MarshalRegistrySources writes a value of the 'registry_sources' type to the given writer. +func MarshalRegistrySources(object *RegistrySources, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistrySources(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistrySources writes a value of the 'registry_sources' type to the given stream. +func WriteRegistrySources(object *RegistrySources, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.allowedRegistries != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("allowed_registries") + WriteStringList(object.allowedRegistries, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.blockedRegistries != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("blocked_registries") + WriteStringList(object.blockedRegistries, stream) + count++ + } + present_ = object.bitmap_&4 != 0 && object.insecureRegistries != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("insecure_registries") + WriteStringList(object.insecureRegistries, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalRegistrySources reads a value of the 'registry_sources' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRegistrySources(source interface{}) (object *RegistrySources, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRegistrySources(iterator) + err = iterator.Error + return +} + +// ReadRegistrySources reads a value of the 'registry_sources' type from the given iterator. +func ReadRegistrySources(iterator *jsoniter.Iterator) *RegistrySources { + object := &RegistrySources{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "allowed_registries": + value := ReadStringList(iterator) + object.allowedRegistries = value + object.bitmap_ |= 1 + case "blocked_registries": + value := ReadStringList(iterator) + object.blockedRegistries = value + object.bitmap_ |= 2 + case "insecure_registries": + value := ReadStringList(iterator) + object.insecureRegistries = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/release_image_details_builder.go b/clientapi/arohcp/v1alpha1/release_image_details_builder.go new file mode 100644 index 00000000..238f8311 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/release_image_details_builder.go @@ -0,0 +1,80 @@ +/* +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 + +// ReleaseImageDetailsBuilder contains the data and logic needed to build 'release_image_details' objects. +type ReleaseImageDetailsBuilder struct { + bitmap_ uint32 + availableUpgrades []string + releaseImage string +} + +// NewReleaseImageDetails creates a new builder of 'release_image_details' objects. +func NewReleaseImageDetails() *ReleaseImageDetailsBuilder { + return &ReleaseImageDetailsBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ReleaseImageDetailsBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AvailableUpgrades sets the value of the 'available_upgrades' attribute to the given values. +func (b *ReleaseImageDetailsBuilder) AvailableUpgrades(values ...string) *ReleaseImageDetailsBuilder { + b.availableUpgrades = make([]string, len(values)) + copy(b.availableUpgrades, values) + b.bitmap_ |= 1 + return b +} + +// ReleaseImage sets the value of the 'release_image' attribute to the given value. +func (b *ReleaseImageDetailsBuilder) ReleaseImage(value string) *ReleaseImageDetailsBuilder { + b.releaseImage = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ReleaseImageDetailsBuilder) Copy(object *ReleaseImageDetails) *ReleaseImageDetailsBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.availableUpgrades != nil { + b.availableUpgrades = make([]string, len(object.availableUpgrades)) + copy(b.availableUpgrades, object.availableUpgrades) + } else { + b.availableUpgrades = nil + } + b.releaseImage = object.releaseImage + return b +} + +// Build creates a 'release_image_details' object using the configuration stored in the builder. +func (b *ReleaseImageDetailsBuilder) Build() (object *ReleaseImageDetails, err error) { + object = new(ReleaseImageDetails) + object.bitmap_ = b.bitmap_ + if b.availableUpgrades != nil { + object.availableUpgrades = make([]string, len(b.availableUpgrades)) + copy(object.availableUpgrades, b.availableUpgrades) + } + object.releaseImage = b.releaseImage + return +} diff --git a/clientapi/arohcp/v1alpha1/release_image_details_list_builder.go b/clientapi/arohcp/v1alpha1/release_image_details_list_builder.go new file mode 100644 index 00000000..e770d55c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/release_image_details_list_builder.go @@ -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 + +// ReleaseImageDetailsListBuilder contains the data and logic needed to build +// 'release_image_details' objects. +type ReleaseImageDetailsListBuilder struct { + items []*ReleaseImageDetailsBuilder +} + +// NewReleaseImageDetailsList creates a new builder of 'release_image_details' objects. +func NewReleaseImageDetailsList() *ReleaseImageDetailsListBuilder { + return new(ReleaseImageDetailsListBuilder) +} + +// Items sets the items of the list. +func (b *ReleaseImageDetailsListBuilder) Items(values ...*ReleaseImageDetailsBuilder) *ReleaseImageDetailsListBuilder { + b.items = make([]*ReleaseImageDetailsBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ReleaseImageDetailsListBuilder) 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 *ReleaseImageDetailsListBuilder) Copy(list *ReleaseImageDetailsList) *ReleaseImageDetailsListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ReleaseImageDetailsBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewReleaseImageDetails().Copy(v) + } + } + return b +} + +// Build creates a list of 'release_image_details' objects using the +// configuration stored in the builder. +func (b *ReleaseImageDetailsListBuilder) Build() (list *ReleaseImageDetailsList, err error) { + items := make([]*ReleaseImageDetails, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ReleaseImageDetailsList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/release_image_details_list_type_json.go b/clientapi/arohcp/v1alpha1/release_image_details_list_type_json.go new file mode 100644 index 00000000..a2c5cea7 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/release_image_details_list_type_json.go @@ -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" +) + +// MarshalReleaseImageDetailsList writes a list of values of the 'release_image_details' type to +// the given writer. +func MarshalReleaseImageDetailsList(list []*ReleaseImageDetails, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteReleaseImageDetailsList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteReleaseImageDetailsList writes a list of value of the 'release_image_details' type to +// the given stream. +func WriteReleaseImageDetailsList(list []*ReleaseImageDetails, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteReleaseImageDetails(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalReleaseImageDetailsList reads a list of values of the 'release_image_details' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalReleaseImageDetailsList(source interface{}) (items []*ReleaseImageDetails, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadReleaseImageDetailsList(iterator) + err = iterator.Error + return +} + +// ReadReleaseImageDetailsList reads list of values of the ”release_image_details' type from +// the given iterator. +func ReadReleaseImageDetailsList(iterator *jsoniter.Iterator) []*ReleaseImageDetails { + list := []*ReleaseImageDetails{} + for iterator.ReadArray() { + item := ReadReleaseImageDetails(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/release_image_details_type.go b/clientapi/arohcp/v1alpha1/release_image_details_type.go new file mode 100644 index 00000000..b6c10e5e --- /dev/null +++ b/clientapi/arohcp/v1alpha1/release_image_details_type.go @@ -0,0 +1,187 @@ +/* +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 + +// ReleaseImageDetails represents the values of the 'release_image_details' type. +type ReleaseImageDetails struct { + bitmap_ uint32 + availableUpgrades []string + releaseImage string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ReleaseImageDetails) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AvailableUpgrades returns the value of the 'available_upgrades' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AvailableUpgrades is the list of versions this version can be upgraded to. +func (o *ReleaseImageDetails) AvailableUpgrades() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.availableUpgrades + } + return nil +} + +// GetAvailableUpgrades returns the value of the 'available_upgrades' attribute and +// a flag indicating if the attribute has a value. +// +// AvailableUpgrades is the list of versions this version can be upgraded to. +func (o *ReleaseImageDetails) GetAvailableUpgrades() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.availableUpgrades + } + return +} + +// ReleaseImage returns the value of the 'release_image' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ReleaseImage contains the URI of Openshift release image. +func (o *ReleaseImageDetails) ReleaseImage() string { + if o != nil && o.bitmap_&2 != 0 { + return o.releaseImage + } + return "" +} + +// GetReleaseImage returns the value of the 'release_image' attribute and +// a flag indicating if the attribute has a value. +// +// ReleaseImage contains the URI of Openshift release image. +func (o *ReleaseImageDetails) GetReleaseImage() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.releaseImage + } + return +} + +// ReleaseImageDetailsListKind is the name of the type used to represent list of objects of +// type 'release_image_details'. +const ReleaseImageDetailsListKind = "ReleaseImageDetailsList" + +// ReleaseImageDetailsListLinkKind is the name of the type used to represent links to list +// of objects of type 'release_image_details'. +const ReleaseImageDetailsListLinkKind = "ReleaseImageDetailsListLink" + +// ReleaseImageDetailsNilKind is the name of the type used to nil lists of objects of +// type 'release_image_details'. +const ReleaseImageDetailsListNilKind = "ReleaseImageDetailsListNil" + +// ReleaseImageDetailsList is a list of values of the 'release_image_details' type. +type ReleaseImageDetailsList struct { + href string + link bool + items []*ReleaseImageDetails +} + +// Len returns the length of the list. +func (l *ReleaseImageDetailsList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ReleaseImageDetailsList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ReleaseImageDetailsList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ReleaseImageDetailsList) SetItems(items []*ReleaseImageDetails) { + l.items = items +} + +// Items returns the items of the list. +func (l *ReleaseImageDetailsList) Items() []*ReleaseImageDetails { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ReleaseImageDetailsList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ReleaseImageDetailsList) Get(i int) *ReleaseImageDetails { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ReleaseImageDetailsList) Slice() []*ReleaseImageDetails { + var slice []*ReleaseImageDetails + if l == nil { + slice = make([]*ReleaseImageDetails, 0) + } else { + slice = make([]*ReleaseImageDetails, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ReleaseImageDetailsList) Each(f func(item *ReleaseImageDetails) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ReleaseImageDetailsList) Range(f func(index int, item *ReleaseImageDetails) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/release_image_details_type_json.go b/clientapi/arohcp/v1alpha1/release_image_details_type_json.go new file mode 100644 index 00000000..5d47f098 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/release_image_details_type_json.go @@ -0,0 +1,99 @@ +/* +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" +) + +// MarshalReleaseImageDetails writes a value of the 'release_image_details' type to the given writer. +func MarshalReleaseImageDetails(object *ReleaseImageDetails, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteReleaseImageDetails(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteReleaseImageDetails writes a value of the 'release_image_details' type to the given stream. +func WriteReleaseImageDetails(object *ReleaseImageDetails, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.availableUpgrades != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("available_upgrades") + WriteStringList(object.availableUpgrades, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("release_image") + stream.WriteString(object.releaseImage) + } + stream.WriteObjectEnd() +} + +// UnmarshalReleaseImageDetails reads a value of the 'release_image_details' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalReleaseImageDetails(source interface{}) (object *ReleaseImageDetails, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadReleaseImageDetails(iterator) + err = iterator.Error + return +} + +// ReadReleaseImageDetails reads a value of the 'release_image_details' type from the given iterator. +func ReadReleaseImageDetails(iterator *jsoniter.Iterator) *ReleaseImageDetails { + object := &ReleaseImageDetails{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "available_upgrades": + value := ReadStringList(iterator) + object.availableUpgrades = value + object.bitmap_ |= 1 + case "release_image": + value := iterator.ReadString() + object.releaseImage = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/release_images_builder.go b/clientapi/arohcp/v1alpha1/release_images_builder.go new file mode 100644 index 00000000..8941304e --- /dev/null +++ b/clientapi/arohcp/v1alpha1/release_images_builder.go @@ -0,0 +1,97 @@ +/* +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 + +// ReleaseImagesBuilder contains the data and logic needed to build 'release_images' objects. +type ReleaseImagesBuilder struct { + bitmap_ uint32 + arm64 *ReleaseImageDetailsBuilder + multi *ReleaseImageDetailsBuilder +} + +// NewReleaseImages creates a new builder of 'release_images' objects. +func NewReleaseImages() *ReleaseImagesBuilder { + return &ReleaseImagesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ReleaseImagesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ARM64 sets the value of the 'ARM64' attribute to the given value. +func (b *ReleaseImagesBuilder) ARM64(value *ReleaseImageDetailsBuilder) *ReleaseImagesBuilder { + b.arm64 = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// Multi sets the value of the 'multi' attribute to the given value. +func (b *ReleaseImagesBuilder) Multi(value *ReleaseImageDetailsBuilder) *ReleaseImagesBuilder { + b.multi = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ReleaseImagesBuilder) Copy(object *ReleaseImages) *ReleaseImagesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.arm64 != nil { + b.arm64 = NewReleaseImageDetails().Copy(object.arm64) + } else { + b.arm64 = nil + } + if object.multi != nil { + b.multi = NewReleaseImageDetails().Copy(object.multi) + } else { + b.multi = nil + } + return b +} + +// Build creates a 'release_images' object using the configuration stored in the builder. +func (b *ReleaseImagesBuilder) Build() (object *ReleaseImages, err error) { + object = new(ReleaseImages) + object.bitmap_ = b.bitmap_ + if b.arm64 != nil { + object.arm64, err = b.arm64.Build() + if err != nil { + return + } + } + if b.multi != nil { + object.multi, err = b.multi.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/release_images_list_builder.go b/clientapi/arohcp/v1alpha1/release_images_list_builder.go new file mode 100644 index 00000000..c8377b37 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/release_images_list_builder.go @@ -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 + +// ReleaseImagesListBuilder contains the data and logic needed to build +// 'release_images' objects. +type ReleaseImagesListBuilder struct { + items []*ReleaseImagesBuilder +} + +// NewReleaseImagesList creates a new builder of 'release_images' objects. +func NewReleaseImagesList() *ReleaseImagesListBuilder { + return new(ReleaseImagesListBuilder) +} + +// Items sets the items of the list. +func (b *ReleaseImagesListBuilder) Items(values ...*ReleaseImagesBuilder) *ReleaseImagesListBuilder { + b.items = make([]*ReleaseImagesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ReleaseImagesListBuilder) 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 *ReleaseImagesListBuilder) Copy(list *ReleaseImagesList) *ReleaseImagesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ReleaseImagesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewReleaseImages().Copy(v) + } + } + return b +} + +// Build creates a list of 'release_images' objects using the +// configuration stored in the builder. +func (b *ReleaseImagesListBuilder) Build() (list *ReleaseImagesList, err error) { + items := make([]*ReleaseImages, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ReleaseImagesList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/release_images_list_type_json.go b/clientapi/arohcp/v1alpha1/release_images_list_type_json.go new file mode 100644 index 00000000..7677bf1a --- /dev/null +++ b/clientapi/arohcp/v1alpha1/release_images_list_type_json.go @@ -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" +) + +// MarshalReleaseImagesList writes a list of values of the 'release_images' type to +// the given writer. +func MarshalReleaseImagesList(list []*ReleaseImages, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteReleaseImagesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteReleaseImagesList writes a list of value of the 'release_images' type to +// the given stream. +func WriteReleaseImagesList(list []*ReleaseImages, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteReleaseImages(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalReleaseImagesList reads a list of values of the 'release_images' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalReleaseImagesList(source interface{}) (items []*ReleaseImages, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadReleaseImagesList(iterator) + err = iterator.Error + return +} + +// ReadReleaseImagesList reads list of values of the ”release_images' type from +// the given iterator. +func ReadReleaseImagesList(iterator *jsoniter.Iterator) []*ReleaseImages { + list := []*ReleaseImages{} + for iterator.ReadArray() { + item := ReadReleaseImages(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/release_images_type.go b/clientapi/arohcp/v1alpha1/release_images_type.go new file mode 100644 index 00000000..8ad960db --- /dev/null +++ b/clientapi/arohcp/v1alpha1/release_images_type.go @@ -0,0 +1,187 @@ +/* +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 + +// ReleaseImages represents the values of the 'release_images' type. +type ReleaseImages struct { + bitmap_ uint32 + arm64 *ReleaseImageDetails + multi *ReleaseImageDetails +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ReleaseImages) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ARM64 returns the value of the 'ARM64' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Arm64 will contain the reference for the arm64 image which will be used for cluster deployments +func (o *ReleaseImages) ARM64() *ReleaseImageDetails { + if o != nil && o.bitmap_&1 != 0 { + return o.arm64 + } + return nil +} + +// GetARM64 returns the value of the 'ARM64' attribute and +// a flag indicating if the attribute has a value. +// +// Arm64 will contain the reference for the arm64 image which will be used for cluster deployments +func (o *ReleaseImages) GetARM64() (value *ReleaseImageDetails, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.arm64 + } + return +} + +// Multi returns the value of the 'multi' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Multi will contain the reference for the multi image which will be used for cluster deployments +func (o *ReleaseImages) Multi() *ReleaseImageDetails { + if o != nil && o.bitmap_&2 != 0 { + return o.multi + } + return nil +} + +// GetMulti returns the value of the 'multi' attribute and +// a flag indicating if the attribute has a value. +// +// Multi will contain the reference for the multi image which will be used for cluster deployments +func (o *ReleaseImages) GetMulti() (value *ReleaseImageDetails, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.multi + } + return +} + +// ReleaseImagesListKind is the name of the type used to represent list of objects of +// type 'release_images'. +const ReleaseImagesListKind = "ReleaseImagesList" + +// ReleaseImagesListLinkKind is the name of the type used to represent links to list +// of objects of type 'release_images'. +const ReleaseImagesListLinkKind = "ReleaseImagesListLink" + +// ReleaseImagesNilKind is the name of the type used to nil lists of objects of +// type 'release_images'. +const ReleaseImagesListNilKind = "ReleaseImagesListNil" + +// ReleaseImagesList is a list of values of the 'release_images' type. +type ReleaseImagesList struct { + href string + link bool + items []*ReleaseImages +} + +// Len returns the length of the list. +func (l *ReleaseImagesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ReleaseImagesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ReleaseImagesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ReleaseImagesList) SetItems(items []*ReleaseImages) { + l.items = items +} + +// Items returns the items of the list. +func (l *ReleaseImagesList) Items() []*ReleaseImages { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ReleaseImagesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ReleaseImagesList) Get(i int) *ReleaseImages { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ReleaseImagesList) Slice() []*ReleaseImages { + var slice []*ReleaseImages + if l == nil { + slice = make([]*ReleaseImages, 0) + } else { + slice = make([]*ReleaseImages, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ReleaseImagesList) Each(f func(item *ReleaseImages) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ReleaseImagesList) Range(f func(index int, item *ReleaseImages) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/release_images_type_json.go b/clientapi/arohcp/v1alpha1/release_images_type_json.go new file mode 100644 index 00000000..5cb2a1c2 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/release_images_type_json.go @@ -0,0 +1,99 @@ +/* +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" +) + +// MarshalReleaseImages writes a value of the 'release_images' type to the given writer. +func MarshalReleaseImages(object *ReleaseImages, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteReleaseImages(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteReleaseImages writes a value of the 'release_images' type to the given stream. +func WriteReleaseImages(object *ReleaseImages, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.arm64 != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("arm64") + WriteReleaseImageDetails(object.arm64, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.multi != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("multi") + WriteReleaseImageDetails(object.multi, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalReleaseImages reads a value of the 'release_images' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalReleaseImages(source interface{}) (object *ReleaseImages, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadReleaseImages(iterator) + err = iterator.Error + return +} + +// ReadReleaseImages reads a value of the 'release_images' type from the given iterator. +func ReadReleaseImages(iterator *jsoniter.Iterator) *ReleaseImages { + object := &ReleaseImages{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "arm64": + value := ReadReleaseImageDetails(iterator) + object.arm64 = value + object.bitmap_ |= 1 + case "multi": + value := ReadReleaseImageDetails(iterator) + object.multi = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/root_volume_builder.go b/clientapi/arohcp/v1alpha1/root_volume_builder.go new file mode 100644 index 00000000..a953234c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/root_volume_builder.go @@ -0,0 +1,103 @@ +/* +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 + +// RootVolumeBuilder contains the data and logic needed to build 'root_volume' objects. +// +// Root volume capabilities. +type RootVolumeBuilder struct { + bitmap_ uint32 + aws *AWSVolumeBuilder + gcp *GCPVolumeBuilder +} + +// NewRootVolume creates a new builder of 'root_volume' objects. +func NewRootVolume() *RootVolumeBuilder { + return &RootVolumeBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RootVolumeBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AWS sets the value of the 'AWS' attribute to the given value. +// +// Holds settings for an AWS storage volume. +func (b *RootVolumeBuilder) AWS(value *AWSVolumeBuilder) *RootVolumeBuilder { + b.aws = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// GCP sets the value of the 'GCP' attribute to the given value. +// +// Holds settings for an GCP storage volume. +func (b *RootVolumeBuilder) GCP(value *GCPVolumeBuilder) *RootVolumeBuilder { + b.gcp = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RootVolumeBuilder) Copy(object *RootVolume) *RootVolumeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.aws != nil { + b.aws = NewAWSVolume().Copy(object.aws) + } else { + b.aws = nil + } + if object.gcp != nil { + b.gcp = NewGCPVolume().Copy(object.gcp) + } else { + b.gcp = nil + } + return b +} + +// Build creates a 'root_volume' object using the configuration stored in the builder. +func (b *RootVolumeBuilder) Build() (object *RootVolume, err error) { + object = new(RootVolume) + object.bitmap_ = b.bitmap_ + if b.aws != nil { + object.aws, err = b.aws.Build() + if err != nil { + return + } + } + if b.gcp != nil { + object.gcp, err = b.gcp.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/arohcp/v1alpha1/root_volume_list_builder.go b/clientapi/arohcp/v1alpha1/root_volume_list_builder.go new file mode 100644 index 00000000..3ce6ecb1 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/root_volume_list_builder.go @@ -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 + +// RootVolumeListBuilder contains the data and logic needed to build +// 'root_volume' objects. +type RootVolumeListBuilder struct { + items []*RootVolumeBuilder +} + +// NewRootVolumeList creates a new builder of 'root_volume' objects. +func NewRootVolumeList() *RootVolumeListBuilder { + return new(RootVolumeListBuilder) +} + +// Items sets the items of the list. +func (b *RootVolumeListBuilder) Items(values ...*RootVolumeBuilder) *RootVolumeListBuilder { + b.items = make([]*RootVolumeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RootVolumeListBuilder) 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 *RootVolumeListBuilder) Copy(list *RootVolumeList) *RootVolumeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RootVolumeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRootVolume().Copy(v) + } + } + return b +} + +// Build creates a list of 'root_volume' objects using the +// configuration stored in the builder. +func (b *RootVolumeListBuilder) Build() (list *RootVolumeList, err error) { + items := make([]*RootVolume, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RootVolumeList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/root_volume_list_type_json.go b/clientapi/arohcp/v1alpha1/root_volume_list_type_json.go new file mode 100644 index 00000000..3927492c --- /dev/null +++ b/clientapi/arohcp/v1alpha1/root_volume_list_type_json.go @@ -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" +) + +// MarshalRootVolumeList writes a list of values of the 'root_volume' type to +// the given writer. +func MarshalRootVolumeList(list []*RootVolume, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRootVolumeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRootVolumeList writes a list of value of the 'root_volume' type to +// the given stream. +func WriteRootVolumeList(list []*RootVolume, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRootVolume(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRootVolumeList reads a list of values of the 'root_volume' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRootVolumeList(source interface{}) (items []*RootVolume, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRootVolumeList(iterator) + err = iterator.Error + return +} + +// ReadRootVolumeList reads list of values of the ”root_volume' type from +// the given iterator. +func ReadRootVolumeList(iterator *jsoniter.Iterator) []*RootVolume { + list := []*RootVolume{} + for iterator.ReadArray() { + item := ReadRootVolume(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/root_volume_type.go b/clientapi/arohcp/v1alpha1/root_volume_type.go new file mode 100644 index 00000000..5e8bf45f --- /dev/null +++ b/clientapi/arohcp/v1alpha1/root_volume_type.go @@ -0,0 +1,189 @@ +/* +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 + +// RootVolume represents the values of the 'root_volume' type. +// +// Root volume capabilities. +type RootVolume struct { + bitmap_ uint32 + aws *AWSVolume + gcp *GCPVolume +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RootVolume) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AWS returns the value of the 'AWS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS volume specification +func (o *RootVolume) AWS() *AWSVolume { + if o != nil && o.bitmap_&1 != 0 { + return o.aws + } + return nil +} + +// GetAWS returns the value of the 'AWS' attribute and +// a flag indicating if the attribute has a value. +// +// AWS volume specification +func (o *RootVolume) GetAWS() (value *AWSVolume, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.aws + } + return +} + +// GCP returns the value of the 'GCP' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP Volume specification +func (o *RootVolume) GCP() *GCPVolume { + if o != nil && o.bitmap_&2 != 0 { + return o.gcp + } + return nil +} + +// GetGCP returns the value of the 'GCP' attribute and +// a flag indicating if the attribute has a value. +// +// GCP Volume specification +func (o *RootVolume) GetGCP() (value *GCPVolume, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.gcp + } + return +} + +// RootVolumeListKind is the name of the type used to represent list of objects of +// type 'root_volume'. +const RootVolumeListKind = "RootVolumeList" + +// RootVolumeListLinkKind is the name of the type used to represent links to list +// of objects of type 'root_volume'. +const RootVolumeListLinkKind = "RootVolumeListLink" + +// RootVolumeNilKind is the name of the type used to nil lists of objects of +// type 'root_volume'. +const RootVolumeListNilKind = "RootVolumeListNil" + +// RootVolumeList is a list of values of the 'root_volume' type. +type RootVolumeList struct { + href string + link bool + items []*RootVolume +} + +// Len returns the length of the list. +func (l *RootVolumeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RootVolumeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RootVolumeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RootVolumeList) SetItems(items []*RootVolume) { + l.items = items +} + +// Items returns the items of the list. +func (l *RootVolumeList) Items() []*RootVolume { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RootVolumeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RootVolumeList) Get(i int) *RootVolume { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RootVolumeList) Slice() []*RootVolume { + var slice []*RootVolume + if l == nil { + slice = make([]*RootVolume, 0) + } else { + slice = make([]*RootVolume, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RootVolumeList) Each(f func(item *RootVolume) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RootVolumeList) Range(f func(index int, item *RootVolume) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/root_volume_type_json.go b/clientapi/arohcp/v1alpha1/root_volume_type_json.go new file mode 100644 index 00000000..daf94335 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/root_volume_type_json.go @@ -0,0 +1,99 @@ +/* +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" +) + +// MarshalRootVolume writes a value of the 'root_volume' type to the given writer. +func MarshalRootVolume(object *RootVolume, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRootVolume(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRootVolume writes a value of the 'root_volume' type to the given stream. +func WriteRootVolume(object *RootVolume, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.aws != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws") + WriteAWSVolume(object.aws, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.gcp != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp") + WriteGCPVolume(object.gcp, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalRootVolume reads a value of the 'root_volume' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRootVolume(source interface{}) (object *RootVolume, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRootVolume(iterator) + err = iterator.Error + return +} + +// ReadRootVolume reads a value of the 'root_volume' type from the given iterator. +func ReadRootVolume(iterator *jsoniter.Iterator) *RootVolume { + object := &RootVolume{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "aws": + value := ReadAWSVolume(iterator) + object.aws = value + object.bitmap_ |= 1 + case "gcp": + value := ReadGCPVolume(iterator) + object.gcp = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/server_config_builder.go b/clientapi/arohcp/v1alpha1/server_config_builder.go new file mode 100644 index 00000000..825c1277 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/server_config_builder.go @@ -0,0 +1,134 @@ +/* +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 + +// ServerConfigBuilder contains the data and logic needed to build 'server_config' objects. +// +// Representation of a server config +type ServerConfigBuilder struct { + bitmap_ uint32 + id string + href string + awsShard *AWSShardBuilder + kubeconfig string + server string + topology ProvisionShardTopology +} + +// NewServerConfig creates a new builder of 'server_config' objects. +func NewServerConfig() *ServerConfigBuilder { + return &ServerConfigBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ServerConfigBuilder) Link(value bool) *ServerConfigBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ServerConfigBuilder) ID(value string) *ServerConfigBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ServerConfigBuilder) HREF(value string) *ServerConfigBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ServerConfigBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AWSShard sets the value of the 'AWS_shard' attribute to the given value. +// +// Config for AWS provision shards +func (b *ServerConfigBuilder) AWSShard(value *AWSShardBuilder) *ServerConfigBuilder { + b.awsShard = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// Kubeconfig sets the value of the 'kubeconfig' attribute to the given value. +func (b *ServerConfigBuilder) Kubeconfig(value string) *ServerConfigBuilder { + b.kubeconfig = value + b.bitmap_ |= 16 + return b +} + +// Server sets the value of the 'server' attribute to the given value. +func (b *ServerConfigBuilder) Server(value string) *ServerConfigBuilder { + b.server = value + b.bitmap_ |= 32 + return b +} + +// Topology sets the value of the 'topology' attribute to the given value. +func (b *ServerConfigBuilder) Topology(value ProvisionShardTopology) *ServerConfigBuilder { + b.topology = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ServerConfigBuilder) Copy(object *ServerConfig) *ServerConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.awsShard != nil { + b.awsShard = NewAWSShard().Copy(object.awsShard) + } else { + b.awsShard = nil + } + b.kubeconfig = object.kubeconfig + b.server = object.server + b.topology = object.topology + return b +} + +// Build creates a 'server_config' object using the configuration stored in the builder. +func (b *ServerConfigBuilder) Build() (object *ServerConfig, err error) { + object = new(ServerConfig) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.awsShard != nil { + object.awsShard, err = b.awsShard.Build() + if err != nil { + return + } + } + object.kubeconfig = b.kubeconfig + object.server = b.server + object.topology = b.topology + return +} diff --git a/clientapi/arohcp/v1alpha1/server_config_list_builder.go b/clientapi/arohcp/v1alpha1/server_config_list_builder.go new file mode 100644 index 00000000..ec79f5c8 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/server_config_list_builder.go @@ -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 + +// ServerConfigListBuilder contains the data and logic needed to build +// 'server_config' objects. +type ServerConfigListBuilder struct { + items []*ServerConfigBuilder +} + +// NewServerConfigList creates a new builder of 'server_config' objects. +func NewServerConfigList() *ServerConfigListBuilder { + return new(ServerConfigListBuilder) +} + +// Items sets the items of the list. +func (b *ServerConfigListBuilder) Items(values ...*ServerConfigBuilder) *ServerConfigListBuilder { + b.items = make([]*ServerConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ServerConfigListBuilder) 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 *ServerConfigListBuilder) Copy(list *ServerConfigList) *ServerConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ServerConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewServerConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'server_config' objects using the +// configuration stored in the builder. +func (b *ServerConfigListBuilder) Build() (list *ServerConfigList, err error) { + items := make([]*ServerConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ServerConfigList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/server_config_list_type_json.go b/clientapi/arohcp/v1alpha1/server_config_list_type_json.go new file mode 100644 index 00000000..a8546e62 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/server_config_list_type_json.go @@ -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" +) + +// MarshalServerConfigList writes a list of values of the 'server_config' type to +// the given writer. +func MarshalServerConfigList(list []*ServerConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServerConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServerConfigList writes a list of value of the 'server_config' type to +// the given stream. +func WriteServerConfigList(list []*ServerConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteServerConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalServerConfigList reads a list of values of the 'server_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalServerConfigList(source interface{}) (items []*ServerConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadServerConfigList(iterator) + err = iterator.Error + return +} + +// ReadServerConfigList reads list of values of the ”server_config' type from +// the given iterator. +func ReadServerConfigList(iterator *jsoniter.Iterator) []*ServerConfig { + list := []*ServerConfig{} + for iterator.ReadArray() { + item := ReadServerConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/server_config_type.go b/clientapi/arohcp/v1alpha1/server_config_type.go new file mode 100644 index 00000000..7db968f1 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/server_config_type.go @@ -0,0 +1,337 @@ +/* +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 + +// ServerConfigKind is the name of the type used to represent objects +// of type 'server_config'. +const ServerConfigKind = "ServerConfig" + +// ServerConfigLinkKind is the name of the type used to represent links +// to objects of type 'server_config'. +const ServerConfigLinkKind = "ServerConfigLink" + +// ServerConfigNilKind is the name of the type used to nil references +// to objects of type 'server_config'. +const ServerConfigNilKind = "ServerConfigNil" + +// ServerConfig represents the values of the 'server_config' type. +// +// Representation of a server config +type ServerConfig struct { + bitmap_ uint32 + id string + href string + awsShard *AWSShard + kubeconfig string + server string + topology ProvisionShardTopology +} + +// Kind returns the name of the type of the object. +func (o *ServerConfig) Kind() string { + if o == nil { + return ServerConfigNilKind + } + if o.bitmap_&1 != 0 { + return ServerConfigLinkKind + } + return ServerConfigKind +} + +// Link returns true if this is a link. +func (o *ServerConfig) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ServerConfig) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ServerConfig) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ServerConfig) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ServerConfig) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ServerConfig) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AWSShard returns the value of the 'AWS_shard' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Config for AWS provision shards +func (o *ServerConfig) AWSShard() *AWSShard { + if o != nil && o.bitmap_&8 != 0 { + return o.awsShard + } + return nil +} + +// GetAWSShard returns the value of the 'AWS_shard' attribute and +// a flag indicating if the attribute has a value. +// +// Config for AWS provision shards +func (o *ServerConfig) GetAWSShard() (value *AWSShard, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.awsShard + } + return +} + +// Kubeconfig returns the value of the 'kubeconfig' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The kubeconfig of the server. +func (o *ServerConfig) Kubeconfig() string { + if o != nil && o.bitmap_&16 != 0 { + return o.kubeconfig + } + return "" +} + +// GetKubeconfig returns the value of the 'kubeconfig' attribute and +// a flag indicating if the attribute has a value. +// +// The kubeconfig of the server. +func (o *ServerConfig) GetKubeconfig() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.kubeconfig + } + return +} + +// Server returns the value of the 'server' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The URL of the server. +func (o *ServerConfig) Server() string { + if o != nil && o.bitmap_&32 != 0 { + return o.server + } + return "" +} + +// GetServer returns the value of the 'server' attribute and +// a flag indicating if the attribute has a value. +// +// The URL of the server. +func (o *ServerConfig) GetServer() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.server + } + return +} + +// Topology returns the value of the 'topology' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The topology of a provision shard (Optional). +func (o *ServerConfig) Topology() ProvisionShardTopology { + if o != nil && o.bitmap_&64 != 0 { + return o.topology + } + return ProvisionShardTopology("") +} + +// GetTopology returns the value of the 'topology' attribute and +// a flag indicating if the attribute has a value. +// +// The topology of a provision shard (Optional). +func (o *ServerConfig) GetTopology() (value ProvisionShardTopology, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.topology + } + return +} + +// ServerConfigListKind is the name of the type used to represent list of objects of +// type 'server_config'. +const ServerConfigListKind = "ServerConfigList" + +// ServerConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'server_config'. +const ServerConfigListLinkKind = "ServerConfigListLink" + +// ServerConfigNilKind is the name of the type used to nil lists of objects of +// type 'server_config'. +const ServerConfigListNilKind = "ServerConfigListNil" + +// ServerConfigList is a list of values of the 'server_config' type. +type ServerConfigList struct { + href string + link bool + items []*ServerConfig +} + +// Kind returns the name of the type of the object. +func (l *ServerConfigList) Kind() string { + if l == nil { + return ServerConfigListNilKind + } + if l.link { + return ServerConfigListLinkKind + } + return ServerConfigListKind +} + +// Link returns true iif this is a link. +func (l *ServerConfigList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ServerConfigList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ServerConfigList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ServerConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ServerConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ServerConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ServerConfigList) SetItems(items []*ServerConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *ServerConfigList) Items() []*ServerConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ServerConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ServerConfigList) Get(i int) *ServerConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ServerConfigList) Slice() []*ServerConfig { + var slice []*ServerConfig + if l == nil { + slice = make([]*ServerConfig, 0) + } else { + slice = make([]*ServerConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ServerConfigList) Each(f func(item *ServerConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ServerConfigList) Range(f func(index int, item *ServerConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/server_config_type_json.go b/clientapi/arohcp/v1alpha1/server_config_type_json.go new file mode 100644 index 00000000..3596be6d --- /dev/null +++ b/clientapi/arohcp/v1alpha1/server_config_type_json.go @@ -0,0 +1,160 @@ +/* +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" +) + +// MarshalServerConfig writes a value of the 'server_config' type to the given writer. +func MarshalServerConfig(object *ServerConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServerConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServerConfig writes a value of the 'server_config' type to the given stream. +func WriteServerConfig(object *ServerConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ServerConfigLinkKind) + } else { + stream.WriteString(ServerConfigKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.awsShard != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws_shard") + WriteAWSShard(object.awsShard, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kubeconfig") + stream.WriteString(object.kubeconfig) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("server") + stream.WriteString(object.server) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("topology") + stream.WriteString(string(object.topology)) + } + stream.WriteObjectEnd() +} + +// UnmarshalServerConfig reads a value of the 'server_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalServerConfig(source interface{}) (object *ServerConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadServerConfig(iterator) + err = iterator.Error + return +} + +// ReadServerConfig reads a value of the 'server_config' type from the given iterator. +func ReadServerConfig(iterator *jsoniter.Iterator) *ServerConfig { + object := &ServerConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ServerConfigLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "aws_shard": + value := ReadAWSShard(iterator) + object.awsShard = value + object.bitmap_ |= 8 + case "kubeconfig": + value := iterator.ReadString() + object.kubeconfig = value + object.bitmap_ |= 16 + case "server": + value := iterator.ReadString() + object.server = value + object.bitmap_ |= 32 + case "topology": + text := iterator.ReadString() + value := ProvisionShardTopology(text) + object.topology = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/string_list_type_json.go b/clientapi/arohcp/v1alpha1/string_list_type_json.go new file mode 100644 index 00000000..6aa569f2 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/string_list_type_json.go @@ -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" +) + +// MarshalStringList writes a list of values of the 'string' type to +// the given writer. +func MarshalStringList(list []string, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStringList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStringList writes a list of value of the 'string' type to +// the given stream. +func WriteStringList(list []string, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalStringList reads a list of values of the 'string' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStringList(source interface{}) (items []string, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStringList(iterator) + err = iterator.Error + return +} + +// ReadStringList reads list of values of the ”string' type from +// the given iterator. +func ReadStringList(iterator *jsoniter.Iterator) []string { + list := []string{} + for iterator.ReadArray() { + item := iterator.ReadString() + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/sts_builder.go b/clientapi/arohcp/v1alpha1/sts_builder.go new file mode 100644 index 00000000..b7753195 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/sts_builder.go @@ -0,0 +1,219 @@ +/* +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 + +// STSBuilder contains the data and logic needed to build 'STS' objects. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type STSBuilder struct { + bitmap_ uint32 + oidcEndpointURL string + externalID string + instanceIAMRoles *InstanceIAMRolesBuilder + oidcConfig *OidcConfigBuilder + operatorIAMRoles []*OperatorIAMRoleBuilder + operatorRolePrefix string + permissionBoundary string + roleARN string + supportRoleARN string + autoMode bool + enabled bool + managedPolicies bool +} + +// NewSTS creates a new builder of 'STS' objects. +func NewSTS() *STSBuilder { + return &STSBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *STSBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// OIDCEndpointURL sets the value of the 'OIDC_endpoint_URL' attribute to the given value. +func (b *STSBuilder) OIDCEndpointURL(value string) *STSBuilder { + b.oidcEndpointURL = value + b.bitmap_ |= 1 + return b +} + +// AutoMode sets the value of the 'auto_mode' attribute to the given value. +func (b *STSBuilder) AutoMode(value bool) *STSBuilder { + b.autoMode = value + b.bitmap_ |= 2 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *STSBuilder) Enabled(value bool) *STSBuilder { + b.enabled = value + b.bitmap_ |= 4 + return b +} + +// ExternalID sets the value of the 'external_ID' attribute to the given value. +func (b *STSBuilder) ExternalID(value string) *STSBuilder { + b.externalID = value + b.bitmap_ |= 8 + return b +} + +// InstanceIAMRoles sets the value of the 'instance_IAM_roles' attribute to the given value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (b *STSBuilder) InstanceIAMRoles(value *InstanceIAMRolesBuilder) *STSBuilder { + b.instanceIAMRoles = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// ManagedPolicies sets the value of the 'managed_policies' attribute to the given value. +func (b *STSBuilder) ManagedPolicies(value bool) *STSBuilder { + b.managedPolicies = value + b.bitmap_ |= 32 + return b +} + +// OidcConfig sets the value of the 'oidc_config' attribute to the given value. +// +// Contains the necessary attributes to support oidc configuration hosting under Red Hat or registering a Customer's byo oidc config. +func (b *STSBuilder) OidcConfig(value *OidcConfigBuilder) *STSBuilder { + b.oidcConfig = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// OperatorIAMRoles sets the value of the 'operator_IAM_roles' attribute to the given values. +func (b *STSBuilder) OperatorIAMRoles(values ...*OperatorIAMRoleBuilder) *STSBuilder { + b.operatorIAMRoles = make([]*OperatorIAMRoleBuilder, len(values)) + copy(b.operatorIAMRoles, values) + b.bitmap_ |= 128 + return b +} + +// OperatorRolePrefix sets the value of the 'operator_role_prefix' attribute to the given value. +func (b *STSBuilder) OperatorRolePrefix(value string) *STSBuilder { + b.operatorRolePrefix = value + b.bitmap_ |= 256 + return b +} + +// PermissionBoundary sets the value of the 'permission_boundary' attribute to the given value. +func (b *STSBuilder) PermissionBoundary(value string) *STSBuilder { + b.permissionBoundary = value + b.bitmap_ |= 512 + return b +} + +// RoleARN sets the value of the 'role_ARN' attribute to the given value. +func (b *STSBuilder) RoleARN(value string) *STSBuilder { + b.roleARN = value + b.bitmap_ |= 1024 + return b +} + +// SupportRoleARN sets the value of the 'support_role_ARN' attribute to the given value. +func (b *STSBuilder) SupportRoleARN(value string) *STSBuilder { + b.supportRoleARN = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *STSBuilder) Copy(object *STS) *STSBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.oidcEndpointURL = object.oidcEndpointURL + b.autoMode = object.autoMode + b.enabled = object.enabled + b.externalID = object.externalID + if object.instanceIAMRoles != nil { + b.instanceIAMRoles = NewInstanceIAMRoles().Copy(object.instanceIAMRoles) + } else { + b.instanceIAMRoles = nil + } + b.managedPolicies = object.managedPolicies + if object.oidcConfig != nil { + b.oidcConfig = NewOidcConfig().Copy(object.oidcConfig) + } else { + b.oidcConfig = nil + } + if object.operatorIAMRoles != nil { + b.operatorIAMRoles = make([]*OperatorIAMRoleBuilder, len(object.operatorIAMRoles)) + for i, v := range object.operatorIAMRoles { + b.operatorIAMRoles[i] = NewOperatorIAMRole().Copy(v) + } + } else { + b.operatorIAMRoles = nil + } + b.operatorRolePrefix = object.operatorRolePrefix + b.permissionBoundary = object.permissionBoundary + b.roleARN = object.roleARN + b.supportRoleARN = object.supportRoleARN + return b +} + +// Build creates a 'STS' object using the configuration stored in the builder. +func (b *STSBuilder) Build() (object *STS, err error) { + object = new(STS) + object.bitmap_ = b.bitmap_ + object.oidcEndpointURL = b.oidcEndpointURL + object.autoMode = b.autoMode + object.enabled = b.enabled + object.externalID = b.externalID + if b.instanceIAMRoles != nil { + object.instanceIAMRoles, err = b.instanceIAMRoles.Build() + if err != nil { + return + } + } + object.managedPolicies = b.managedPolicies + if b.oidcConfig != nil { + object.oidcConfig, err = b.oidcConfig.Build() + if err != nil { + return + } + } + if b.operatorIAMRoles != nil { + object.operatorIAMRoles = make([]*OperatorIAMRole, len(b.operatorIAMRoles)) + for i, v := range b.operatorIAMRoles { + object.operatorIAMRoles[i], err = v.Build() + if err != nil { + return + } + } + } + object.operatorRolePrefix = b.operatorRolePrefix + object.permissionBoundary = b.permissionBoundary + object.roleARN = b.roleARN + object.supportRoleARN = b.supportRoleARN + return +} diff --git a/clientapi/arohcp/v1alpha1/sts_list_builder.go b/clientapi/arohcp/v1alpha1/sts_list_builder.go new file mode 100644 index 00000000..f95e0d68 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/sts_list_builder.go @@ -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 + +// STSListBuilder contains the data and logic needed to build +// 'STS' objects. +type STSListBuilder struct { + items []*STSBuilder +} + +// NewSTSList creates a new builder of 'STS' objects. +func NewSTSList() *STSListBuilder { + return new(STSListBuilder) +} + +// Items sets the items of the list. +func (b *STSListBuilder) Items(values ...*STSBuilder) *STSListBuilder { + b.items = make([]*STSBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *STSListBuilder) 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 *STSListBuilder) Copy(list *STSList) *STSListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*STSBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSTS().Copy(v) + } + } + return b +} + +// Build creates a list of 'STS' objects using the +// configuration stored in the builder. +func (b *STSListBuilder) Build() (list *STSList, err error) { + items := make([]*STS, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(STSList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/sts_list_type_json.go b/clientapi/arohcp/v1alpha1/sts_list_type_json.go new file mode 100644 index 00000000..bff03094 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/sts_list_type_json.go @@ -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" +) + +// MarshalSTSList writes a list of values of the 'STS' type to +// the given writer. +func MarshalSTSList(list []*STS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSTSList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSTSList writes a list of value of the 'STS' type to +// the given stream. +func WriteSTSList(list []*STS, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSTS(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSTSList reads a list of values of the 'STS' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSTSList(source interface{}) (items []*STS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSTSList(iterator) + err = iterator.Error + return +} + +// ReadSTSList reads list of values of the ”STS' type from +// the given iterator. +func ReadSTSList(iterator *jsoniter.Iterator) []*STS { + list := []*STS{} + for iterator.ReadArray() { + item := ReadSTS(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/sts_type.go b/clientapi/arohcp/v1alpha1/sts_type.go new file mode 100644 index 00000000..2c026817 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/sts_type.go @@ -0,0 +1,429 @@ +/* +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 + +// STS represents the values of the 'STS' type. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type STS struct { + bitmap_ uint32 + oidcEndpointURL string + externalID string + instanceIAMRoles *InstanceIAMRoles + oidcConfig *OidcConfig + operatorIAMRoles []*OperatorIAMRole + operatorRolePrefix string + permissionBoundary string + roleARN string + supportRoleARN string + autoMode bool + enabled bool + managedPolicies bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *STS) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// OIDCEndpointURL returns the value of the 'OIDC_endpoint_URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// URL of the location where OIDC configuration and keys are available +func (o *STS) OIDCEndpointURL() string { + if o != nil && o.bitmap_&1 != 0 { + return o.oidcEndpointURL + } + return "" +} + +// GetOIDCEndpointURL returns the value of the 'OIDC_endpoint_URL' attribute and +// a flag indicating if the attribute has a value. +// +// URL of the location where OIDC configuration and keys are available +func (o *STS) GetOIDCEndpointURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.oidcEndpointURL + } + return +} + +// AutoMode returns the value of the 'auto_mode' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Auto creation mode for cluster - OCM will create the operator roles and OIDC provider. false by default. +func (o *STS) AutoMode() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.autoMode + } + return false +} + +// GetAutoMode returns the value of the 'auto_mode' attribute and +// a flag indicating if the attribute has a value. +// +// Auto creation mode for cluster - OCM will create the operator roles and OIDC provider. false by default. +func (o *STS) GetAutoMode() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.autoMode + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// If STS is enabled or disabled +func (o *STS) Enabled() bool { + if o != nil && o.bitmap_&4 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// If STS is enabled or disabled +func (o *STS) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.enabled + } + return +} + +// ExternalID returns the value of the 'external_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional unique identifier when assuming role in another account +func (o *STS) ExternalID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.externalID + } + return "" +} + +// GetExternalID returns the value of the 'external_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Optional unique identifier when assuming role in another account +func (o *STS) GetExternalID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.externalID + } + return +} + +// InstanceIAMRoles returns the value of the 'instance_IAM_roles' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Instance IAM roles to use for the instance profiles of the master and worker instances +func (o *STS) InstanceIAMRoles() *InstanceIAMRoles { + if o != nil && o.bitmap_&16 != 0 { + return o.instanceIAMRoles + } + return nil +} + +// GetInstanceIAMRoles returns the value of the 'instance_IAM_roles' attribute and +// a flag indicating if the attribute has a value. +// +// Instance IAM roles to use for the instance profiles of the master and worker instances +func (o *STS) GetInstanceIAMRoles() (value *InstanceIAMRoles, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.instanceIAMRoles + } + return +} + +// ManagedPolicies returns the value of the 'managed_policies' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// If true, cluster account and operator roles have managed policies attached. +func (o *STS) ManagedPolicies() bool { + if o != nil && o.bitmap_&32 != 0 { + return o.managedPolicies + } + return false +} + +// GetManagedPolicies returns the value of the 'managed_policies' attribute and +// a flag indicating if the attribute has a value. +// +// If true, cluster account and operator roles have managed policies attached. +func (o *STS) GetManagedPolicies() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.managedPolicies + } + return +} + +// OidcConfig returns the value of the 'oidc_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Registered Oidc Config, if available holds information related to the oidc config. +func (o *STS) OidcConfig() *OidcConfig { + if o != nil && o.bitmap_&64 != 0 { + return o.oidcConfig + } + return nil +} + +// GetOidcConfig returns the value of the 'oidc_config' attribute and +// a flag indicating if the attribute has a value. +// +// Registered Oidc Config, if available holds information related to the oidc config. +func (o *STS) GetOidcConfig() (value *OidcConfig, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.oidcConfig + } + return +} + +// OperatorIAMRoles returns the value of the 'operator_IAM_roles' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of roles necessary to access the AWS resources of the various operators used during installation +func (o *STS) OperatorIAMRoles() []*OperatorIAMRole { + if o != nil && o.bitmap_&128 != 0 { + return o.operatorIAMRoles + } + return nil +} + +// GetOperatorIAMRoles returns the value of the 'operator_IAM_roles' attribute and +// a flag indicating if the attribute has a value. +// +// List of roles necessary to access the AWS resources of the various operators used during installation +func (o *STS) GetOperatorIAMRoles() (value []*OperatorIAMRole, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.operatorIAMRoles + } + return +} + +// OperatorRolePrefix returns the value of the 'operator_role_prefix' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional user provided prefix for operator roles. +func (o *STS) OperatorRolePrefix() string { + if o != nil && o.bitmap_&256 != 0 { + return o.operatorRolePrefix + } + return "" +} + +// GetOperatorRolePrefix returns the value of the 'operator_role_prefix' attribute and +// a flag indicating if the attribute has a value. +// +// Optional user provided prefix for operator roles. +func (o *STS) GetOperatorRolePrefix() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.operatorRolePrefix + } + return +} + +// PermissionBoundary returns the value of the 'permission_boundary' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional user provided permission boundary. +func (o *STS) PermissionBoundary() string { + if o != nil && o.bitmap_&512 != 0 { + return o.permissionBoundary + } + return "" +} + +// GetPermissionBoundary returns the value of the 'permission_boundary' attribute and +// a flag indicating if the attribute has a value. +// +// Optional user provided permission boundary. +func (o *STS) GetPermissionBoundary() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.permissionBoundary + } + return +} + +// RoleARN returns the value of the 'role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN of the AWS role to assume when installing the cluster +func (o *STS) RoleARN() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.roleARN + } + return "" +} + +// GetRoleARN returns the value of the 'role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// ARN of the AWS role to assume when installing the cluster +func (o *STS) GetRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.roleARN + } + return +} + +// SupportRoleARN returns the value of the 'support_role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN of the AWS role used by SREs to access the cluster AWS account in order to provide support +func (o *STS) SupportRoleARN() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.supportRoleARN + } + return "" +} + +// GetSupportRoleARN returns the value of the 'support_role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// ARN of the AWS role used by SREs to access the cluster AWS account in order to provide support +func (o *STS) GetSupportRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.supportRoleARN + } + return +} + +// STSListKind is the name of the type used to represent list of objects of +// type 'STS'. +const STSListKind = "STSList" + +// STSListLinkKind is the name of the type used to represent links to list +// of objects of type 'STS'. +const STSListLinkKind = "STSListLink" + +// STSNilKind is the name of the type used to nil lists of objects of +// type 'STS'. +const STSListNilKind = "STSListNil" + +// STSList is a list of values of the 'STS' type. +type STSList struct { + href string + link bool + items []*STS +} + +// Len returns the length of the list. +func (l *STSList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *STSList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *STSList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *STSList) SetItems(items []*STS) { + l.items = items +} + +// Items returns the items of the list. +func (l *STSList) Items() []*STS { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *STSList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *STSList) Get(i int) *STS { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *STSList) Slice() []*STS { + var slice []*STS + if l == nil { + slice = make([]*STS, 0) + } else { + slice = make([]*STS, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *STSList) Each(f func(item *STS) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *STSList) Range(f func(index int, item *STS) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/sts_type_json.go b/clientapi/arohcp/v1alpha1/sts_type_json.go new file mode 100644 index 00000000..90f285dd --- /dev/null +++ b/clientapi/arohcp/v1alpha1/sts_type_json.go @@ -0,0 +1,229 @@ +/* +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" +) + +// MarshalSTS writes a value of the 'STS' type to the given writer. +func MarshalSTS(object *STS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSTS(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSTS writes a value of the 'STS' type to the given stream. +func WriteSTS(object *STS, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("oidc_endpoint_url") + stream.WriteString(object.oidcEndpointURL) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("auto_mode") + stream.WriteBool(object.autoMode) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_id") + stream.WriteString(object.externalID) + count++ + } + present_ = object.bitmap_&16 != 0 && object.instanceIAMRoles != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("instance_iam_roles") + WriteInstanceIAMRoles(object.instanceIAMRoles, stream) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_policies") + stream.WriteBool(object.managedPolicies) + count++ + } + present_ = object.bitmap_&64 != 0 && object.oidcConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("oidc_config") + WriteOidcConfig(object.oidcConfig, stream) + count++ + } + present_ = object.bitmap_&128 != 0 && object.operatorIAMRoles != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_iam_roles") + WriteOperatorIAMRoleList(object.operatorIAMRoles, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_role_prefix") + stream.WriteString(object.operatorRolePrefix) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("permission_boundary") + stream.WriteString(object.permissionBoundary) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role_arn") + stream.WriteString(object.roleARN) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("support_role_arn") + stream.WriteString(object.supportRoleARN) + } + stream.WriteObjectEnd() +} + +// UnmarshalSTS reads a value of the 'STS' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSTS(source interface{}) (object *STS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSTS(iterator) + err = iterator.Error + return +} + +// ReadSTS reads a value of the 'STS' type from the given iterator. +func ReadSTS(iterator *jsoniter.Iterator) *STS { + object := &STS{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "oidc_endpoint_url": + value := iterator.ReadString() + object.oidcEndpointURL = value + object.bitmap_ |= 1 + case "auto_mode": + value := iterator.ReadBool() + object.autoMode = value + object.bitmap_ |= 2 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 4 + case "external_id": + value := iterator.ReadString() + object.externalID = value + object.bitmap_ |= 8 + case "instance_iam_roles": + value := ReadInstanceIAMRoles(iterator) + object.instanceIAMRoles = value + object.bitmap_ |= 16 + case "managed_policies": + value := iterator.ReadBool() + object.managedPolicies = value + object.bitmap_ |= 32 + case "oidc_config": + value := ReadOidcConfig(iterator) + object.oidcConfig = value + object.bitmap_ |= 64 + case "operator_iam_roles": + value := ReadOperatorIAMRoleList(iterator) + object.operatorIAMRoles = value + object.bitmap_ |= 128 + case "operator_role_prefix": + value := iterator.ReadString() + object.operatorRolePrefix = value + object.bitmap_ |= 256 + case "permission_boundary": + value := iterator.ReadString() + object.permissionBoundary = value + object.bitmap_ |= 512 + case "role_arn": + value := iterator.ReadString() + object.roleARN = value + object.bitmap_ |= 1024 + case "support_role_arn": + value := iterator.ReadString() + object.supportRoleARN = value + object.bitmap_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/taint_builder.go b/clientapi/arohcp/v1alpha1/taint_builder.go new file mode 100644 index 00000000..ba5a9274 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/taint_builder.go @@ -0,0 +1,83 @@ +/* +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 + +// TaintBuilder contains the data and logic needed to build 'taint' objects. +// +// Representation of a Taint set on a MachinePool in a cluster. +type TaintBuilder struct { + bitmap_ uint32 + effect string + key string + value string +} + +// NewTaint creates a new builder of 'taint' objects. +func NewTaint() *TaintBuilder { + return &TaintBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *TaintBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Effect sets the value of the 'effect' attribute to the given value. +func (b *TaintBuilder) Effect(value string) *TaintBuilder { + b.effect = value + b.bitmap_ |= 1 + return b +} + +// Key sets the value of the 'key' attribute to the given value. +func (b *TaintBuilder) Key(value string) *TaintBuilder { + b.key = value + b.bitmap_ |= 2 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *TaintBuilder) Value(value string) *TaintBuilder { + b.value = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *TaintBuilder) Copy(object *Taint) *TaintBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.effect = object.effect + b.key = object.key + b.value = object.value + return b +} + +// Build creates a 'taint' object using the configuration stored in the builder. +func (b *TaintBuilder) Build() (object *Taint, err error) { + object = new(Taint) + object.bitmap_ = b.bitmap_ + object.effect = b.effect + object.key = b.key + object.value = b.value + return +} diff --git a/clientapi/arohcp/v1alpha1/taint_list_builder.go b/clientapi/arohcp/v1alpha1/taint_list_builder.go new file mode 100644 index 00000000..836a7f0b --- /dev/null +++ b/clientapi/arohcp/v1alpha1/taint_list_builder.go @@ -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 + +// TaintListBuilder contains the data and logic needed to build +// 'taint' objects. +type TaintListBuilder struct { + items []*TaintBuilder +} + +// NewTaintList creates a new builder of 'taint' objects. +func NewTaintList() *TaintListBuilder { + return new(TaintListBuilder) +} + +// Items sets the items of the list. +func (b *TaintListBuilder) Items(values ...*TaintBuilder) *TaintListBuilder { + b.items = make([]*TaintBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *TaintListBuilder) 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 *TaintListBuilder) Copy(list *TaintList) *TaintListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*TaintBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewTaint().Copy(v) + } + } + return b +} + +// Build creates a list of 'taint' objects using the +// configuration stored in the builder. +func (b *TaintListBuilder) Build() (list *TaintList, err error) { + items := make([]*Taint, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(TaintList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/taint_list_type_json.go b/clientapi/arohcp/v1alpha1/taint_list_type_json.go new file mode 100644 index 00000000..d80128e9 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/taint_list_type_json.go @@ -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" +) + +// MarshalTaintList writes a list of values of the 'taint' type to +// the given writer. +func MarshalTaintList(list []*Taint, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTaintList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTaintList writes a list of value of the 'taint' type to +// the given stream. +func WriteTaintList(list []*Taint, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteTaint(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalTaintList reads a list of values of the 'taint' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalTaintList(source interface{}) (items []*Taint, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadTaintList(iterator) + err = iterator.Error + return +} + +// ReadTaintList reads list of values of the ”taint' type from +// the given iterator. +func ReadTaintList(iterator *jsoniter.Iterator) []*Taint { + list := []*Taint{} + for iterator.ReadArray() { + item := ReadTaint(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/taint_type.go b/clientapi/arohcp/v1alpha1/taint_type.go new file mode 100644 index 00000000..d2253079 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/taint_type.go @@ -0,0 +1,213 @@ +/* +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 + +// Taint represents the values of the 'taint' type. +// +// Representation of a Taint set on a MachinePool in a cluster. +type Taint struct { + bitmap_ uint32 + effect string + key string + value string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Taint) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Effect returns the value of the 'effect' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The effect on the node for the pods matching the taint, i.e: NoSchedule, NoExecute, PreferNoSchedule. +func (o *Taint) Effect() string { + if o != nil && o.bitmap_&1 != 0 { + return o.effect + } + return "" +} + +// GetEffect returns the value of the 'effect' attribute and +// a flag indicating if the attribute has a value. +// +// The effect on the node for the pods matching the taint, i.e: NoSchedule, NoExecute, PreferNoSchedule. +func (o *Taint) GetEffect() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.effect + } + return +} + +// Key returns the value of the 'key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The key for the taint +func (o *Taint) Key() string { + if o != nil && o.bitmap_&2 != 0 { + return o.key + } + return "" +} + +// GetKey returns the value of the 'key' attribute and +// a flag indicating if the attribute has a value. +// +// The key for the taint +func (o *Taint) GetKey() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.key + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The value for the taint. +func (o *Taint) Value() string { + if o != nil && o.bitmap_&4 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// The value for the taint. +func (o *Taint) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.value + } + return +} + +// TaintListKind is the name of the type used to represent list of objects of +// type 'taint'. +const TaintListKind = "TaintList" + +// TaintListLinkKind is the name of the type used to represent links to list +// of objects of type 'taint'. +const TaintListLinkKind = "TaintListLink" + +// TaintNilKind is the name of the type used to nil lists of objects of +// type 'taint'. +const TaintListNilKind = "TaintListNil" + +// TaintList is a list of values of the 'taint' type. +type TaintList struct { + href string + link bool + items []*Taint +} + +// Len returns the length of the list. +func (l *TaintList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *TaintList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *TaintList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *TaintList) SetItems(items []*Taint) { + l.items = items +} + +// Items returns the items of the list. +func (l *TaintList) Items() []*Taint { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *TaintList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *TaintList) Get(i int) *Taint { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *TaintList) Slice() []*Taint { + var slice []*Taint + if l == nil { + slice = make([]*Taint, 0) + } else { + slice = make([]*Taint, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *TaintList) Each(f func(item *Taint) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *TaintList) Range(f func(index int, item *Taint) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/taint_type_json.go b/clientapi/arohcp/v1alpha1/taint_type_json.go new file mode 100644 index 00000000..e6205926 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/taint_type_json.go @@ -0,0 +1,112 @@ +/* +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" +) + +// MarshalTaint writes a value of the 'taint' type to the given writer. +func MarshalTaint(object *Taint, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTaint(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTaint writes a value of the 'taint' type to the given stream. +func WriteTaint(object *Taint, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("effect") + stream.WriteString(object.effect) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key") + stream.WriteString(object.key) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalTaint reads a value of the 'taint' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalTaint(source interface{}) (object *Taint, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadTaint(iterator) + err = iterator.Error + return +} + +// ReadTaint reads a value of the 'taint' type from the given iterator. +func ReadTaint(iterator *jsoniter.Iterator) *Taint { + object := &Taint{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "effect": + value := iterator.ReadString() + object.effect = value + object.bitmap_ |= 1 + case "key": + value := iterator.ReadString() + object.key = value + object.bitmap_ |= 2 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/value_builder.go b/clientapi/arohcp/v1alpha1/value_builder.go new file mode 100644 index 00000000..5c0b2f22 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/value_builder.go @@ -0,0 +1,90 @@ +/* +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 + +// ValueBuilder contains the data and logic needed to build 'value' objects. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +type ValueBuilder struct { + bitmap_ uint32 + unit string + value float64 +} + +// NewValue creates a new builder of 'value' objects. +func NewValue() *ValueBuilder { + return &ValueBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ValueBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Unit sets the value of the 'unit' attribute to the given value. +func (b *ValueBuilder) Unit(value string) *ValueBuilder { + b.unit = value + b.bitmap_ |= 1 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *ValueBuilder) Value(value float64) *ValueBuilder { + b.value = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ValueBuilder) Copy(object *Value) *ValueBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.unit = object.unit + b.value = object.value + return b +} + +// Build creates a 'value' object using the configuration stored in the builder. +func (b *ValueBuilder) Build() (object *Value, err error) { + object = new(Value) + object.bitmap_ = b.bitmap_ + object.unit = b.unit + object.value = b.value + return +} diff --git a/clientapi/arohcp/v1alpha1/value_list_builder.go b/clientapi/arohcp/v1alpha1/value_list_builder.go new file mode 100644 index 00000000..d8b1aed5 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/value_list_builder.go @@ -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 + +// ValueListBuilder contains the data and logic needed to build +// 'value' objects. +type ValueListBuilder struct { + items []*ValueBuilder +} + +// NewValueList creates a new builder of 'value' objects. +func NewValueList() *ValueListBuilder { + return new(ValueListBuilder) +} + +// Items sets the items of the list. +func (b *ValueListBuilder) Items(values ...*ValueBuilder) *ValueListBuilder { + b.items = make([]*ValueBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ValueListBuilder) 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 *ValueListBuilder) Copy(list *ValueList) *ValueListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ValueBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewValue().Copy(v) + } + } + return b +} + +// Build creates a list of 'value' objects using the +// configuration stored in the builder. +func (b *ValueListBuilder) Build() (list *ValueList, err error) { + items := make([]*Value, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ValueList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/value_list_type_json.go b/clientapi/arohcp/v1alpha1/value_list_type_json.go new file mode 100644 index 00000000..78e22c91 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/value_list_type_json.go @@ -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" +) + +// MarshalValueList writes a list of values of the 'value' type to +// the given writer. +func MarshalValueList(list []*Value, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteValueList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteValueList writes a list of value of the 'value' type to +// the given stream. +func WriteValueList(list []*Value, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteValue(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalValueList reads a list of values of the 'value' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalValueList(source interface{}) (items []*Value, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadValueList(iterator) + err = iterator.Error + return +} + +// ReadValueList reads list of values of the ”value' type from +// the given iterator. +func ReadValueList(iterator *jsoniter.Iterator) []*Value { + list := []*Value{} + for iterator.ReadArray() { + item := ReadValue(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/value_type.go b/clientapi/arohcp/v1alpha1/value_type.go new file mode 100644 index 00000000..ac4f8e20 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/value_type.go @@ -0,0 +1,206 @@ +/* +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 + +// Value represents the values of the 'value' type. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +type Value struct { + bitmap_ uint32 + unit string + value float64 +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Value) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Unit returns the value of the 'unit' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the unit used to measure the value. +func (o *Value) Unit() string { + if o != nil && o.bitmap_&1 != 0 { + return o.unit + } + return "" +} + +// GetUnit returns the value of the 'unit' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the unit used to measure the value. +func (o *Value) GetUnit() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.unit + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Numeric value. +func (o *Value) Value() float64 { + if o != nil && o.bitmap_&2 != 0 { + return o.value + } + return 0.0 +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Numeric value. +func (o *Value) GetValue() (value float64, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.value + } + return +} + +// ValueListKind is the name of the type used to represent list of objects of +// type 'value'. +const ValueListKind = "ValueList" + +// ValueListLinkKind is the name of the type used to represent links to list +// of objects of type 'value'. +const ValueListLinkKind = "ValueListLink" + +// ValueNilKind is the name of the type used to nil lists of objects of +// type 'value'. +const ValueListNilKind = "ValueListNil" + +// ValueList is a list of values of the 'value' type. +type ValueList struct { + href string + link bool + items []*Value +} + +// Len returns the length of the list. +func (l *ValueList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ValueList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ValueList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ValueList) SetItems(items []*Value) { + l.items = items +} + +// Items returns the items of the list. +func (l *ValueList) Items() []*Value { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ValueList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ValueList) Get(i int) *Value { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ValueList) Slice() []*Value { + var slice []*Value + if l == nil { + slice = make([]*Value, 0) + } else { + slice = make([]*Value, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ValueList) Each(f func(item *Value) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ValueList) Range(f func(index int, item *Value) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/value_type_json.go b/clientapi/arohcp/v1alpha1/value_type_json.go new file mode 100644 index 00000000..4723afcb --- /dev/null +++ b/clientapi/arohcp/v1alpha1/value_type_json.go @@ -0,0 +1,99 @@ +/* +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" +) + +// MarshalValue writes a value of the 'value' type to the given writer. +func MarshalValue(object *Value, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteValue(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteValue writes a value of the 'value' type to the given stream. +func WriteValue(object *Value, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("unit") + stream.WriteString(object.unit) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteFloat64(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalValue reads a value of the 'value' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalValue(source interface{}) (object *Value, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadValue(iterator) + err = iterator.Error + return +} + +// ReadValue reads a value of the 'value' type from the given iterator. +func ReadValue(iterator *jsoniter.Iterator) *Value { + object := &Value{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "unit": + value := iterator.ReadString() + object.unit = value + object.bitmap_ |= 1 + case "value": + value := iterator.ReadFloat64() + object.value = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/arohcp/v1alpha1/version_builder.go b/clientapi/arohcp/v1alpha1/version_builder.go new file mode 100644 index 00000000..82bdde21 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/version_builder.go @@ -0,0 +1,260 @@ +/* +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 ( + time "time" +) + +// VersionBuilder contains the data and logic needed to build 'version' objects. +// +// Representation of an _OpenShift_ version. +type VersionBuilder struct { + bitmap_ uint32 + id string + href string + availableUpgrades []string + channelGroup string + endOfLifeTimestamp time.Time + imageOverrides *ImageOverridesBuilder + rawID string + releaseImage string + releaseImages *ReleaseImagesBuilder + gcpMarketplaceEnabled bool + rosaEnabled bool + default_ bool + enabled bool + hostedControlPlaneDefault bool + hostedControlPlaneEnabled bool + wifEnabled bool +} + +// NewVersion creates a new builder of 'version' objects. +func NewVersion() *VersionBuilder { + return &VersionBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *VersionBuilder) Link(value bool) *VersionBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *VersionBuilder) ID(value string) *VersionBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *VersionBuilder) HREF(value string) *VersionBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *VersionBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// GCPMarketplaceEnabled sets the value of the 'GCP_marketplace_enabled' attribute to the given value. +func (b *VersionBuilder) GCPMarketplaceEnabled(value bool) *VersionBuilder { + b.gcpMarketplaceEnabled = value + b.bitmap_ |= 8 + return b +} + +// ROSAEnabled sets the value of the 'ROSA_enabled' attribute to the given value. +func (b *VersionBuilder) ROSAEnabled(value bool) *VersionBuilder { + b.rosaEnabled = value + b.bitmap_ |= 16 + return b +} + +// AvailableUpgrades sets the value of the 'available_upgrades' attribute to the given values. +func (b *VersionBuilder) AvailableUpgrades(values ...string) *VersionBuilder { + b.availableUpgrades = make([]string, len(values)) + copy(b.availableUpgrades, values) + b.bitmap_ |= 32 + return b +} + +// ChannelGroup sets the value of the 'channel_group' attribute to the given value. +func (b *VersionBuilder) ChannelGroup(value string) *VersionBuilder { + b.channelGroup = value + b.bitmap_ |= 64 + return b +} + +// Default sets the value of the 'default' attribute to the given value. +func (b *VersionBuilder) Default(value bool) *VersionBuilder { + b.default_ = value + b.bitmap_ |= 128 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *VersionBuilder) Enabled(value bool) *VersionBuilder { + b.enabled = value + b.bitmap_ |= 256 + return b +} + +// EndOfLifeTimestamp sets the value of the 'end_of_life_timestamp' attribute to the given value. +func (b *VersionBuilder) EndOfLifeTimestamp(value time.Time) *VersionBuilder { + b.endOfLifeTimestamp = value + b.bitmap_ |= 512 + return b +} + +// HostedControlPlaneDefault sets the value of the 'hosted_control_plane_default' attribute to the given value. +func (b *VersionBuilder) HostedControlPlaneDefault(value bool) *VersionBuilder { + b.hostedControlPlaneDefault = value + b.bitmap_ |= 1024 + return b +} + +// HostedControlPlaneEnabled sets the value of the 'hosted_control_plane_enabled' attribute to the given value. +func (b *VersionBuilder) HostedControlPlaneEnabled(value bool) *VersionBuilder { + b.hostedControlPlaneEnabled = value + b.bitmap_ |= 2048 + return b +} + +// ImageOverrides sets the value of the 'image_overrides' attribute to the given value. +// +// ImageOverrides holds the lists of available images per cloud provider. +func (b *VersionBuilder) ImageOverrides(value *ImageOverridesBuilder) *VersionBuilder { + b.imageOverrides = value + if value != nil { + b.bitmap_ |= 4096 + } else { + b.bitmap_ &^= 4096 + } + return b +} + +// RawID sets the value of the 'raw_ID' attribute to the given value. +func (b *VersionBuilder) RawID(value string) *VersionBuilder { + b.rawID = value + b.bitmap_ |= 8192 + return b +} + +// ReleaseImage sets the value of the 'release_image' attribute to the given value. +func (b *VersionBuilder) ReleaseImage(value string) *VersionBuilder { + b.releaseImage = value + b.bitmap_ |= 16384 + return b +} + +// ReleaseImages sets the value of the 'release_images' attribute to the given value. +func (b *VersionBuilder) ReleaseImages(value *ReleaseImagesBuilder) *VersionBuilder { + b.releaseImages = value + if value != nil { + b.bitmap_ |= 32768 + } else { + b.bitmap_ &^= 32768 + } + return b +} + +// WifEnabled sets the value of the 'wif_enabled' attribute to the given value. +func (b *VersionBuilder) WifEnabled(value bool) *VersionBuilder { + b.wifEnabled = value + b.bitmap_ |= 65536 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *VersionBuilder) Copy(object *Version) *VersionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.gcpMarketplaceEnabled = object.gcpMarketplaceEnabled + b.rosaEnabled = object.rosaEnabled + if object.availableUpgrades != nil { + b.availableUpgrades = make([]string, len(object.availableUpgrades)) + copy(b.availableUpgrades, object.availableUpgrades) + } else { + b.availableUpgrades = nil + } + b.channelGroup = object.channelGroup + b.default_ = object.default_ + b.enabled = object.enabled + b.endOfLifeTimestamp = object.endOfLifeTimestamp + b.hostedControlPlaneDefault = object.hostedControlPlaneDefault + b.hostedControlPlaneEnabled = object.hostedControlPlaneEnabled + if object.imageOverrides != nil { + b.imageOverrides = NewImageOverrides().Copy(object.imageOverrides) + } else { + b.imageOverrides = nil + } + b.rawID = object.rawID + b.releaseImage = object.releaseImage + if object.releaseImages != nil { + b.releaseImages = NewReleaseImages().Copy(object.releaseImages) + } else { + b.releaseImages = nil + } + b.wifEnabled = object.wifEnabled + return b +} + +// Build creates a 'version' object using the configuration stored in the builder. +func (b *VersionBuilder) Build() (object *Version, err error) { + object = new(Version) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.gcpMarketplaceEnabled = b.gcpMarketplaceEnabled + object.rosaEnabled = b.rosaEnabled + if b.availableUpgrades != nil { + object.availableUpgrades = make([]string, len(b.availableUpgrades)) + copy(object.availableUpgrades, b.availableUpgrades) + } + object.channelGroup = b.channelGroup + object.default_ = b.default_ + object.enabled = b.enabled + object.endOfLifeTimestamp = b.endOfLifeTimestamp + object.hostedControlPlaneDefault = b.hostedControlPlaneDefault + object.hostedControlPlaneEnabled = b.hostedControlPlaneEnabled + if b.imageOverrides != nil { + object.imageOverrides, err = b.imageOverrides.Build() + if err != nil { + return + } + } + object.rawID = b.rawID + object.releaseImage = b.releaseImage + if b.releaseImages != nil { + object.releaseImages, err = b.releaseImages.Build() + if err != nil { + return + } + } + object.wifEnabled = b.wifEnabled + return +} diff --git a/clientapi/arohcp/v1alpha1/version_list_builder.go b/clientapi/arohcp/v1alpha1/version_list_builder.go new file mode 100644 index 00000000..12b7b9a7 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/version_list_builder.go @@ -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 + +// VersionListBuilder contains the data and logic needed to build +// 'version' objects. +type VersionListBuilder struct { + items []*VersionBuilder +} + +// NewVersionList creates a new builder of 'version' objects. +func NewVersionList() *VersionListBuilder { + return new(VersionListBuilder) +} + +// Items sets the items of the list. +func (b *VersionListBuilder) Items(values ...*VersionBuilder) *VersionListBuilder { + b.items = make([]*VersionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *VersionListBuilder) 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 *VersionListBuilder) Copy(list *VersionList) *VersionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*VersionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewVersion().Copy(v) + } + } + return b +} + +// Build creates a list of 'version' objects using the +// configuration stored in the builder. +func (b *VersionListBuilder) Build() (list *VersionList, err error) { + items := make([]*Version, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(VersionList) + list.items = items + return +} diff --git a/clientapi/arohcp/v1alpha1/version_list_type_json.go b/clientapi/arohcp/v1alpha1/version_list_type_json.go new file mode 100644 index 00000000..e4b54d71 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/version_list_type_json.go @@ -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" +) + +// MarshalVersionList writes a list of values of the 'version' type to +// the given writer. +func MarshalVersionList(list []*Version, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteVersionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteVersionList writes a list of value of the 'version' type to +// the given stream. +func WriteVersionList(list []*Version, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteVersion(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalVersionList reads a list of values of the 'version' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalVersionList(source interface{}) (items []*Version, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadVersionList(iterator) + err = iterator.Error + return +} + +// ReadVersionList reads list of values of the ”version' type from +// the given iterator. +func ReadVersionList(iterator *jsoniter.Iterator) []*Version { + list := []*Version{} + for iterator.ReadArray() { + item := ReadVersion(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/arohcp/v1alpha1/version_type.go b/clientapi/arohcp/v1alpha1/version_type.go new file mode 100644 index 00000000..3b5cb4de --- /dev/null +++ b/clientapi/arohcp/v1alpha1/version_type.go @@ -0,0 +1,591 @@ +/* +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 ( + time "time" +) + +// VersionKind is the name of the type used to represent objects +// of type 'version'. +const VersionKind = "Version" + +// VersionLinkKind is the name of the type used to represent links +// to objects of type 'version'. +const VersionLinkKind = "VersionLink" + +// VersionNilKind is the name of the type used to nil references +// to objects of type 'version'. +const VersionNilKind = "VersionNil" + +// Version represents the values of the 'version' type. +// +// Representation of an _OpenShift_ version. +type Version struct { + bitmap_ uint32 + id string + href string + availableUpgrades []string + channelGroup string + endOfLifeTimestamp time.Time + imageOverrides *ImageOverrides + rawID string + releaseImage string + releaseImages *ReleaseImages + gcpMarketplaceEnabled bool + rosaEnabled bool + default_ bool + enabled bool + hostedControlPlaneDefault bool + hostedControlPlaneEnabled bool + wifEnabled bool +} + +// Kind returns the name of the type of the object. +func (o *Version) Kind() string { + if o == nil { + return VersionNilKind + } + if o.bitmap_&1 != 0 { + return VersionLinkKind + } + return VersionKind +} + +// Link returns true if this is a link. +func (o *Version) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Version) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Version) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Version) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Version) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Version) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// GCPMarketplaceEnabled returns the value of the 'GCP_marketplace_enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCPMarketplaceEnabled indicates if this version can be used to create GCP Marketplace clusters. +func (o *Version) GCPMarketplaceEnabled() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.gcpMarketplaceEnabled + } + return false +} + +// GetGCPMarketplaceEnabled returns the value of the 'GCP_marketplace_enabled' attribute and +// a flag indicating if the attribute has a value. +// +// GCPMarketplaceEnabled indicates if this version can be used to create GCP Marketplace clusters. +func (o *Version) GetGCPMarketplaceEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.gcpMarketplaceEnabled + } + return +} + +// ROSAEnabled returns the value of the 'ROSA_enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ROSAEnabled indicates whether this version can be used to create ROSA clusters. +func (o *Version) ROSAEnabled() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.rosaEnabled + } + return false +} + +// GetROSAEnabled returns the value of the 'ROSA_enabled' attribute and +// a flag indicating if the attribute has a value. +// +// ROSAEnabled indicates whether this version can be used to create ROSA clusters. +func (o *Version) GetROSAEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.rosaEnabled + } + return +} + +// AvailableUpgrades returns the value of the 'available_upgrades' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AvailableUpgrades is the list of versions this version can be upgraded to. +func (o *Version) AvailableUpgrades() []string { + if o != nil && o.bitmap_&32 != 0 { + return o.availableUpgrades + } + return nil +} + +// GetAvailableUpgrades returns the value of the 'available_upgrades' attribute and +// a flag indicating if the attribute has a value. +// +// AvailableUpgrades is the list of versions this version can be upgraded to. +func (o *Version) GetAvailableUpgrades() (value []string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.availableUpgrades + } + return +} + +// ChannelGroup returns the value of the 'channel_group' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ChannelGroup is the name of the group where this image belongs. +// ChannelGroup is a mechanism to partition the images to different groups, +// each image belongs to only a single group. +func (o *Version) ChannelGroup() string { + if o != nil && o.bitmap_&64 != 0 { + return o.channelGroup + } + return "" +} + +// GetChannelGroup returns the value of the 'channel_group' attribute and +// a flag indicating if the attribute has a value. +// +// ChannelGroup is the name of the group where this image belongs. +// ChannelGroup is a mechanism to partition the images to different groups, +// each image belongs to only a single group. +func (o *Version) GetChannelGroup() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.channelGroup + } + return +} + +// Default returns the value of the 'default' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this should be selected as the default version when a cluster is created +// without specifying explicitly the version. +func (o *Version) Default() bool { + if o != nil && o.bitmap_&128 != 0 { + return o.default_ + } + return false +} + +// GetDefault returns the value of the 'default' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this should be selected as the default version when a cluster is created +// without specifying explicitly the version. +func (o *Version) GetDefault() (value bool, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.default_ + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this version can be used to create clusters. +func (o *Version) Enabled() bool { + if o != nil && o.bitmap_&256 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this version can be used to create clusters. +func (o *Version) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.enabled + } + return +} + +// EndOfLifeTimestamp returns the value of the 'end_of_life_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// EndOfLifeTimestamp is the date and time when the version will get to End of Life, using the +// format defined in https://www.ietf.org/rfc/rfc3339.txt[RC3339]. +func (o *Version) EndOfLifeTimestamp() time.Time { + if o != nil && o.bitmap_&512 != 0 { + return o.endOfLifeTimestamp + } + return time.Time{} +} + +// GetEndOfLifeTimestamp returns the value of the 'end_of_life_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// EndOfLifeTimestamp is the date and time when the version will get to End of Life, using the +// format defined in https://www.ietf.org/rfc/rfc3339.txt[RC3339]. +func (o *Version) GetEndOfLifeTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.endOfLifeTimestamp + } + return +} + +// HostedControlPlaneDefault returns the value of the 'hosted_control_plane_default' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HostedControlPlaneDefault is a flag that indicates if this should be selected as the default version when a +// HCP cluster is created without specifying explicitly the version. +func (o *Version) HostedControlPlaneDefault() bool { + if o != nil && o.bitmap_&1024 != 0 { + return o.hostedControlPlaneDefault + } + return false +} + +// GetHostedControlPlaneDefault returns the value of the 'hosted_control_plane_default' attribute and +// a flag indicating if the attribute has a value. +// +// HostedControlPlaneDefault is a flag that indicates if this should be selected as the default version when a +// HCP cluster is created without specifying explicitly the version. +func (o *Version) GetHostedControlPlaneDefault() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.hostedControlPlaneDefault + } + return +} + +// HostedControlPlaneEnabled returns the value of the 'hosted_control_plane_enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HostedControlPlaneEnabled indicates whether this version can be used to create HCP clusters. +func (o *Version) HostedControlPlaneEnabled() bool { + if o != nil && o.bitmap_&2048 != 0 { + return o.hostedControlPlaneEnabled + } + return false +} + +// GetHostedControlPlaneEnabled returns the value of the 'hosted_control_plane_enabled' attribute and +// a flag indicating if the attribute has a value. +// +// HostedControlPlaneEnabled indicates whether this version can be used to create HCP clusters. +func (o *Version) GetHostedControlPlaneEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.hostedControlPlaneEnabled + } + return +} + +// ImageOverrides returns the value of the 'image_overrides' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ImageOverrides contains the lists of images per cloud provider. +func (o *Version) ImageOverrides() *ImageOverrides { + if o != nil && o.bitmap_&4096 != 0 { + return o.imageOverrides + } + return nil +} + +// GetImageOverrides returns the value of the 'image_overrides' attribute and +// a flag indicating if the attribute has a value. +// +// ImageOverrides contains the lists of images per cloud provider. +func (o *Version) GetImageOverrides() (value *ImageOverrides, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.imageOverrides + } + return +} + +// RawID returns the value of the 'raw_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// RawID is the id of the version - without channel group and prefix. +func (o *Version) RawID() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.rawID + } + return "" +} + +// GetRawID returns the value of the 'raw_ID' attribute and +// a flag indicating if the attribute has a value. +// +// RawID is the id of the version - without channel group and prefix. +func (o *Version) GetRawID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.rawID + } + return +} + +// ReleaseImage returns the value of the 'release_image' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ReleaseImage contains the URI of Openshift release image for amd64 architecture. +func (o *Version) ReleaseImage() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.releaseImage + } + return "" +} + +// GetReleaseImage returns the value of the 'release_image' attribute and +// a flag indicating if the attribute has a value. +// +// ReleaseImage contains the URI of Openshift release image for amd64 architecture. +func (o *Version) GetReleaseImage() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.releaseImage + } + return +} + +// ReleaseImages returns the value of the 'release_images' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ReleaseImages contains the URI of OpenShift release images for arm64 and multi architectures. +func (o *Version) ReleaseImages() *ReleaseImages { + if o != nil && o.bitmap_&32768 != 0 { + return o.releaseImages + } + return nil +} + +// GetReleaseImages returns the value of the 'release_images' attribute and +// a flag indicating if the attribute has a value. +// +// ReleaseImages contains the URI of OpenShift release images for arm64 and multi architectures. +func (o *Version) GetReleaseImages() (value *ReleaseImages, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.releaseImages + } + return +} + +// WifEnabled returns the value of the 'wif_enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// WifEnabled is a flag that indicates whether this version is enabled for Workload Identity Federation. +func (o *Version) WifEnabled() bool { + if o != nil && o.bitmap_&65536 != 0 { + return o.wifEnabled + } + return false +} + +// GetWifEnabled returns the value of the 'wif_enabled' attribute and +// a flag indicating if the attribute has a value. +// +// WifEnabled is a flag that indicates whether this version is enabled for Workload Identity Federation. +func (o *Version) GetWifEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.wifEnabled + } + return +} + +// VersionListKind is the name of the type used to represent list of objects of +// type 'version'. +const VersionListKind = "VersionList" + +// VersionListLinkKind is the name of the type used to represent links to list +// of objects of type 'version'. +const VersionListLinkKind = "VersionListLink" + +// VersionNilKind is the name of the type used to nil lists of objects of +// type 'version'. +const VersionListNilKind = "VersionListNil" + +// VersionList is a list of values of the 'version' type. +type VersionList struct { + href string + link bool + items []*Version +} + +// Kind returns the name of the type of the object. +func (l *VersionList) Kind() string { + if l == nil { + return VersionListNilKind + } + if l.link { + return VersionListLinkKind + } + return VersionListKind +} + +// Link returns true iif this is a link. +func (l *VersionList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *VersionList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *VersionList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *VersionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *VersionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *VersionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *VersionList) SetItems(items []*Version) { + l.items = items +} + +// Items returns the items of the list. +func (l *VersionList) Items() []*Version { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *VersionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *VersionList) Get(i int) *Version { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *VersionList) Slice() []*Version { + var slice []*Version + if l == nil { + slice = make([]*Version, 0) + } else { + slice = make([]*Version, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *VersionList) Each(f func(item *Version) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *VersionList) Range(f func(index int, item *Version) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/arohcp/v1alpha1/version_type_json.go b/clientapi/arohcp/v1alpha1/version_type_json.go new file mode 100644 index 00000000..ca6a7356 --- /dev/null +++ b/clientapi/arohcp/v1alpha1/version_type_json.go @@ -0,0 +1,294 @@ +/* +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" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalVersion writes a value of the 'version' type to the given writer. +func MarshalVersion(object *Version, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteVersion(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteVersion writes a value of the 'version' type to the given stream. +func WriteVersion(object *Version, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(VersionLinkKind) + } else { + stream.WriteString(VersionKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp_marketplace_enabled") + stream.WriteBool(object.gcpMarketplaceEnabled) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("rosa_enabled") + stream.WriteBool(object.rosaEnabled) + count++ + } + present_ = object.bitmap_&32 != 0 && object.availableUpgrades != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("available_upgrades") + WriteStringList(object.availableUpgrades, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("channel_group") + stream.WriteString(object.channelGroup) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("default") + stream.WriteBool(object.default_) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("end_of_life_timestamp") + stream.WriteString((object.endOfLifeTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hosted_control_plane_default") + stream.WriteBool(object.hostedControlPlaneDefault) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hosted_control_plane_enabled") + stream.WriteBool(object.hostedControlPlaneEnabled) + count++ + } + present_ = object.bitmap_&4096 != 0 && object.imageOverrides != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("image_overrides") + WriteImageOverrides(object.imageOverrides, stream) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("raw_id") + stream.WriteString(object.rawID) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("release_image") + stream.WriteString(object.releaseImage) + count++ + } + present_ = object.bitmap_&32768 != 0 && object.releaseImages != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("release_images") + WriteReleaseImages(object.releaseImages, stream) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("wif_enabled") + stream.WriteBool(object.wifEnabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalVersion reads a value of the 'version' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalVersion(source interface{}) (object *Version, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadVersion(iterator) + err = iterator.Error + return +} + +// ReadVersion reads a value of the 'version' type from the given iterator. +func ReadVersion(iterator *jsoniter.Iterator) *Version { + object := &Version{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == VersionLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "gcp_marketplace_enabled": + value := iterator.ReadBool() + object.gcpMarketplaceEnabled = value + object.bitmap_ |= 8 + case "rosa_enabled": + value := iterator.ReadBool() + object.rosaEnabled = value + object.bitmap_ |= 16 + case "available_upgrades": + value := ReadStringList(iterator) + object.availableUpgrades = value + object.bitmap_ |= 32 + case "channel_group": + value := iterator.ReadString() + object.channelGroup = value + object.bitmap_ |= 64 + case "default": + value := iterator.ReadBool() + object.default_ = value + object.bitmap_ |= 128 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 256 + case "end_of_life_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.endOfLifeTimestamp = value + object.bitmap_ |= 512 + case "hosted_control_plane_default": + value := iterator.ReadBool() + object.hostedControlPlaneDefault = value + object.bitmap_ |= 1024 + case "hosted_control_plane_enabled": + value := iterator.ReadBool() + object.hostedControlPlaneEnabled = value + object.bitmap_ |= 2048 + case "image_overrides": + value := ReadImageOverrides(iterator) + object.imageOverrides = value + object.bitmap_ |= 4096 + case "raw_id": + value := iterator.ReadString() + object.rawID = value + object.bitmap_ |= 8192 + case "release_image": + value := iterator.ReadString() + object.releaseImage = value + object.bitmap_ |= 16384 + case "release_images": + value := ReadReleaseImages(iterator) + object.releaseImages = value + object.bitmap_ |= 32768 + case "wif_enabled": + value := iterator.ReadBool() + object.wifEnabled = value + object.bitmap_ |= 65536 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/access_review_request_builder.go b/clientapi/authorizations/v1/access_review_request_builder.go new file mode 100644 index 00000000..58a5937f --- /dev/null +++ b/clientapi/authorizations/v1/access_review_request_builder.go @@ -0,0 +1,123 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// AccessReviewRequestBuilder contains the data and logic needed to build 'access_review_request' objects. +// +// Representation of an access review +type AccessReviewRequestBuilder struct { + bitmap_ uint32 + accountUsername string + action string + clusterID string + clusterUUID string + organizationID string + resourceType string + subscriptionID string +} + +// NewAccessReviewRequest creates a new builder of 'access_review_request' objects. +func NewAccessReviewRequest() *AccessReviewRequestBuilder { + return &AccessReviewRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AccessReviewRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AccountUsername sets the value of the 'account_username' attribute to the given value. +func (b *AccessReviewRequestBuilder) AccountUsername(value string) *AccessReviewRequestBuilder { + b.accountUsername = value + b.bitmap_ |= 1 + return b +} + +// Action sets the value of the 'action' attribute to the given value. +func (b *AccessReviewRequestBuilder) Action(value string) *AccessReviewRequestBuilder { + b.action = value + b.bitmap_ |= 2 + return b +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *AccessReviewRequestBuilder) ClusterID(value string) *AccessReviewRequestBuilder { + b.clusterID = value + b.bitmap_ |= 4 + return b +} + +// ClusterUUID sets the value of the 'cluster_UUID' attribute to the given value. +func (b *AccessReviewRequestBuilder) ClusterUUID(value string) *AccessReviewRequestBuilder { + b.clusterUUID = value + b.bitmap_ |= 8 + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *AccessReviewRequestBuilder) OrganizationID(value string) *AccessReviewRequestBuilder { + b.organizationID = value + b.bitmap_ |= 16 + return b +} + +// ResourceType sets the value of the 'resource_type' attribute to the given value. +func (b *AccessReviewRequestBuilder) ResourceType(value string) *AccessReviewRequestBuilder { + b.resourceType = value + b.bitmap_ |= 32 + return b +} + +// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value. +func (b *AccessReviewRequestBuilder) SubscriptionID(value string) *AccessReviewRequestBuilder { + b.subscriptionID = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AccessReviewRequestBuilder) Copy(object *AccessReviewRequest) *AccessReviewRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.accountUsername = object.accountUsername + b.action = object.action + b.clusterID = object.clusterID + b.clusterUUID = object.clusterUUID + b.organizationID = object.organizationID + b.resourceType = object.resourceType + b.subscriptionID = object.subscriptionID + return b +} + +// Build creates a 'access_review_request' object using the configuration stored in the builder. +func (b *AccessReviewRequestBuilder) Build() (object *AccessReviewRequest, err error) { + object = new(AccessReviewRequest) + object.bitmap_ = b.bitmap_ + object.accountUsername = b.accountUsername + object.action = b.action + object.clusterID = b.clusterID + object.clusterUUID = b.clusterUUID + object.organizationID = b.organizationID + object.resourceType = b.resourceType + object.subscriptionID = b.subscriptionID + return +} diff --git a/clientapi/authorizations/v1/access_review_request_list_builder.go b/clientapi/authorizations/v1/access_review_request_list_builder.go new file mode 100644 index 00000000..4ddb4d24 --- /dev/null +++ b/clientapi/authorizations/v1/access_review_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// AccessReviewRequestListBuilder contains the data and logic needed to build +// 'access_review_request' objects. +type AccessReviewRequestListBuilder struct { + items []*AccessReviewRequestBuilder +} + +// NewAccessReviewRequestList creates a new builder of 'access_review_request' objects. +func NewAccessReviewRequestList() *AccessReviewRequestListBuilder { + return new(AccessReviewRequestListBuilder) +} + +// Items sets the items of the list. +func (b *AccessReviewRequestListBuilder) Items(values ...*AccessReviewRequestBuilder) *AccessReviewRequestListBuilder { + b.items = make([]*AccessReviewRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AccessReviewRequestListBuilder) 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 *AccessReviewRequestListBuilder) Copy(list *AccessReviewRequestList) *AccessReviewRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AccessReviewRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAccessReviewRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'access_review_request' objects using the +// configuration stored in the builder. +func (b *AccessReviewRequestListBuilder) Build() (list *AccessReviewRequestList, err error) { + items := make([]*AccessReviewRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AccessReviewRequestList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/access_review_request_list_type_json.go b/clientapi/authorizations/v1/access_review_request_list_type_json.go new file mode 100644 index 00000000..d0d082ca --- /dev/null +++ b/clientapi/authorizations/v1/access_review_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessReviewRequestList writes a list of values of the 'access_review_request' type to +// the given writer. +func MarshalAccessReviewRequestList(list []*AccessReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessReviewRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessReviewRequestList writes a list of value of the 'access_review_request' type to +// the given stream. +func WriteAccessReviewRequestList(list []*AccessReviewRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAccessReviewRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAccessReviewRequestList reads a list of values of the 'access_review_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAccessReviewRequestList(source interface{}) (items []*AccessReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAccessReviewRequestList(iterator) + err = iterator.Error + return +} + +// ReadAccessReviewRequestList reads list of values of the ”access_review_request' type from +// the given iterator. +func ReadAccessReviewRequestList(iterator *jsoniter.Iterator) []*AccessReviewRequest { + list := []*AccessReviewRequest{} + for iterator.ReadArray() { + item := ReadAccessReviewRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/access_review_request_type.go b/clientapi/authorizations/v1/access_review_request_type.go new file mode 100644 index 00000000..e72e9a25 --- /dev/null +++ b/clientapi/authorizations/v1/access_review_request_type.go @@ -0,0 +1,311 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// AccessReviewRequest represents the values of the 'access_review_request' type. +// +// Representation of an access review +type AccessReviewRequest struct { + bitmap_ uint32 + accountUsername string + action string + clusterID string + clusterUUID string + organizationID string + resourceType string + subscriptionID string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AccessReviewRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AccountUsername returns the value of the 'account_username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the username of the account of which access is being reviewed +func (o *AccessReviewRequest) AccountUsername() string { + if o != nil && o.bitmap_&1 != 0 { + return o.accountUsername + } + return "" +} + +// GetAccountUsername returns the value of the 'account_username' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the username of the account of which access is being reviewed +func (o *AccessReviewRequest) GetAccountUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.accountUsername + } + return +} + +// Action returns the value of the 'action' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the action, one of: [get,list,create,delete,update] +func (o *AccessReviewRequest) Action() string { + if o != nil && o.bitmap_&2 != 0 { + return o.action + } + return "" +} + +// GetAction returns the value of the 'action' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the action, one of: [get,list,create,delete,update] +func (o *AccessReviewRequest) GetAction() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.action + } + return +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Cluster (internal id) the resource type belongs to +func (o *AccessReviewRequest) ClusterID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Cluster (internal id) the resource type belongs to +func (o *AccessReviewRequest) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.clusterID + } + return +} + +// ClusterUUID returns the value of the 'cluster_UUID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Cluster (external id) the resource type belongs to +func (o *AccessReviewRequest) ClusterUUID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clusterUUID + } + return "" +} + +// GetClusterUUID returns the value of the 'cluster_UUID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Cluster (external id) the resource type belongs to +func (o *AccessReviewRequest) GetClusterUUID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clusterUUID + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Organization the resource type belongs to +func (o *AccessReviewRequest) OrganizationID() string { + if o != nil && o.bitmap_&16 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Organization the resource type belongs to +func (o *AccessReviewRequest) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.organizationID + } + return +} + +// ResourceType returns the value of the 'resource_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the type of the resource an action would be taken on. +// See uhc-account-manager/openapi/openapi.yaml for a list of possible values +func (o *AccessReviewRequest) ResourceType() string { + if o != nil && o.bitmap_&32 != 0 { + return o.resourceType + } + return "" +} + +// GetResourceType returns the value of the 'resource_type' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the type of the resource an action would be taken on. +// See uhc-account-manager/openapi/openapi.yaml for a list of possible values +func (o *AccessReviewRequest) GetResourceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.resourceType + } + return +} + +// SubscriptionID returns the value of the 'subscription_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Subscription the resource type belongs to +func (o *AccessReviewRequest) SubscriptionID() string { + if o != nil && o.bitmap_&64 != 0 { + return o.subscriptionID + } + return "" +} + +// GetSubscriptionID returns the value of the 'subscription_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Subscription the resource type belongs to +func (o *AccessReviewRequest) GetSubscriptionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.subscriptionID + } + return +} + +// AccessReviewRequestListKind is the name of the type used to represent list of objects of +// type 'access_review_request'. +const AccessReviewRequestListKind = "AccessReviewRequestList" + +// AccessReviewRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'access_review_request'. +const AccessReviewRequestListLinkKind = "AccessReviewRequestListLink" + +// AccessReviewRequestNilKind is the name of the type used to nil lists of objects of +// type 'access_review_request'. +const AccessReviewRequestListNilKind = "AccessReviewRequestListNil" + +// AccessReviewRequestList is a list of values of the 'access_review_request' type. +type AccessReviewRequestList struct { + href string + link bool + items []*AccessReviewRequest +} + +// Len returns the length of the list. +func (l *AccessReviewRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AccessReviewRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AccessReviewRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AccessReviewRequestList) SetItems(items []*AccessReviewRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *AccessReviewRequestList) Items() []*AccessReviewRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AccessReviewRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AccessReviewRequestList) Get(i int) *AccessReviewRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AccessReviewRequestList) Slice() []*AccessReviewRequest { + var slice []*AccessReviewRequest + if l == nil { + slice = make([]*AccessReviewRequest, 0) + } else { + slice = make([]*AccessReviewRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AccessReviewRequestList) Each(f func(item *AccessReviewRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AccessReviewRequestList) Range(f func(index int, item *AccessReviewRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/access_review_request_type_json.go b/clientapi/authorizations/v1/access_review_request_type_json.go new file mode 100644 index 00000000..9ab26c2e --- /dev/null +++ b/clientapi/authorizations/v1/access_review_request_type_json.go @@ -0,0 +1,164 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessReviewRequest writes a value of the 'access_review_request' type to the given writer. +func MarshalAccessReviewRequest(object *AccessReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessReviewRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessReviewRequest writes a value of the 'access_review_request' type to the given stream. +func WriteAccessReviewRequest(object *AccessReviewRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_username") + stream.WriteString(object.accountUsername) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("action") + stream.WriteString(object.action) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_uuid") + stream.WriteString(object.clusterUUID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_type") + stream.WriteString(object.resourceType) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionID) + } + stream.WriteObjectEnd() +} + +// UnmarshalAccessReviewRequest reads a value of the 'access_review_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAccessReviewRequest(source interface{}) (object *AccessReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAccessReviewRequest(iterator) + err = iterator.Error + return +} + +// ReadAccessReviewRequest reads a value of the 'access_review_request' type from the given iterator. +func ReadAccessReviewRequest(iterator *jsoniter.Iterator) *AccessReviewRequest { + object := &AccessReviewRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "account_username": + value := iterator.ReadString() + object.accountUsername = value + object.bitmap_ |= 1 + case "action": + value := iterator.ReadString() + object.action = value + object.bitmap_ |= 2 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 4 + case "cluster_uuid": + value := iterator.ReadString() + object.clusterUUID = value + object.bitmap_ |= 8 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 16 + case "resource_type": + value := iterator.ReadString() + object.resourceType = value + object.bitmap_ |= 32 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionID = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/access_review_response_builder.go b/clientapi/authorizations/v1/access_review_response_builder.go new file mode 100644 index 00000000..7011eb40 --- /dev/null +++ b/clientapi/authorizations/v1/access_review_response_builder.go @@ -0,0 +1,153 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// AccessReviewResponseBuilder contains the data and logic needed to build 'access_review_response' objects. +// +// Representation of an access review response +type AccessReviewResponseBuilder struct { + bitmap_ uint32 + accountUsername string + action string + clusterID string + clusterUUID string + organizationID string + reason string + resourceType string + subscriptionID string + allowed bool + isOCMInternal bool +} + +// NewAccessReviewResponse creates a new builder of 'access_review_response' objects. +func NewAccessReviewResponse() *AccessReviewResponseBuilder { + return &AccessReviewResponseBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AccessReviewResponseBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AccountUsername sets the value of the 'account_username' attribute to the given value. +func (b *AccessReviewResponseBuilder) AccountUsername(value string) *AccessReviewResponseBuilder { + b.accountUsername = value + b.bitmap_ |= 1 + return b +} + +// Action sets the value of the 'action' attribute to the given value. +func (b *AccessReviewResponseBuilder) Action(value string) *AccessReviewResponseBuilder { + b.action = value + b.bitmap_ |= 2 + return b +} + +// Allowed sets the value of the 'allowed' attribute to the given value. +func (b *AccessReviewResponseBuilder) Allowed(value bool) *AccessReviewResponseBuilder { + b.allowed = value + b.bitmap_ |= 4 + return b +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *AccessReviewResponseBuilder) ClusterID(value string) *AccessReviewResponseBuilder { + b.clusterID = value + b.bitmap_ |= 8 + return b +} + +// ClusterUUID sets the value of the 'cluster_UUID' attribute to the given value. +func (b *AccessReviewResponseBuilder) ClusterUUID(value string) *AccessReviewResponseBuilder { + b.clusterUUID = value + b.bitmap_ |= 16 + return b +} + +// IsOCMInternal sets the value of the 'is_OCM_internal' attribute to the given value. +func (b *AccessReviewResponseBuilder) IsOCMInternal(value bool) *AccessReviewResponseBuilder { + b.isOCMInternal = value + b.bitmap_ |= 32 + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *AccessReviewResponseBuilder) OrganizationID(value string) *AccessReviewResponseBuilder { + b.organizationID = value + b.bitmap_ |= 64 + return b +} + +// Reason sets the value of the 'reason' attribute to the given value. +func (b *AccessReviewResponseBuilder) Reason(value string) *AccessReviewResponseBuilder { + b.reason = value + b.bitmap_ |= 128 + return b +} + +// ResourceType sets the value of the 'resource_type' attribute to the given value. +func (b *AccessReviewResponseBuilder) ResourceType(value string) *AccessReviewResponseBuilder { + b.resourceType = value + b.bitmap_ |= 256 + return b +} + +// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value. +func (b *AccessReviewResponseBuilder) SubscriptionID(value string) *AccessReviewResponseBuilder { + b.subscriptionID = value + b.bitmap_ |= 512 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AccessReviewResponseBuilder) Copy(object *AccessReviewResponse) *AccessReviewResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.accountUsername = object.accountUsername + b.action = object.action + b.allowed = object.allowed + b.clusterID = object.clusterID + b.clusterUUID = object.clusterUUID + b.isOCMInternal = object.isOCMInternal + b.organizationID = object.organizationID + b.reason = object.reason + b.resourceType = object.resourceType + b.subscriptionID = object.subscriptionID + return b +} + +// Build creates a 'access_review_response' object using the configuration stored in the builder. +func (b *AccessReviewResponseBuilder) Build() (object *AccessReviewResponse, err error) { + object = new(AccessReviewResponse) + object.bitmap_ = b.bitmap_ + object.accountUsername = b.accountUsername + object.action = b.action + object.allowed = b.allowed + object.clusterID = b.clusterID + object.clusterUUID = b.clusterUUID + object.isOCMInternal = b.isOCMInternal + object.organizationID = b.organizationID + object.reason = b.reason + object.resourceType = b.resourceType + object.subscriptionID = b.subscriptionID + return +} diff --git a/clientapi/authorizations/v1/access_review_response_list_builder.go b/clientapi/authorizations/v1/access_review_response_list_builder.go new file mode 100644 index 00000000..d4568409 --- /dev/null +++ b/clientapi/authorizations/v1/access_review_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// AccessReviewResponseListBuilder contains the data and logic needed to build +// 'access_review_response' objects. +type AccessReviewResponseListBuilder struct { + items []*AccessReviewResponseBuilder +} + +// NewAccessReviewResponseList creates a new builder of 'access_review_response' objects. +func NewAccessReviewResponseList() *AccessReviewResponseListBuilder { + return new(AccessReviewResponseListBuilder) +} + +// Items sets the items of the list. +func (b *AccessReviewResponseListBuilder) Items(values ...*AccessReviewResponseBuilder) *AccessReviewResponseListBuilder { + b.items = make([]*AccessReviewResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AccessReviewResponseListBuilder) 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 *AccessReviewResponseListBuilder) Copy(list *AccessReviewResponseList) *AccessReviewResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AccessReviewResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAccessReviewResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'access_review_response' objects using the +// configuration stored in the builder. +func (b *AccessReviewResponseListBuilder) Build() (list *AccessReviewResponseList, err error) { + items := make([]*AccessReviewResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AccessReviewResponseList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/access_review_response_list_type_json.go b/clientapi/authorizations/v1/access_review_response_list_type_json.go new file mode 100644 index 00000000..abebeb4d --- /dev/null +++ b/clientapi/authorizations/v1/access_review_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessReviewResponseList writes a list of values of the 'access_review_response' type to +// the given writer. +func MarshalAccessReviewResponseList(list []*AccessReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessReviewResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessReviewResponseList writes a list of value of the 'access_review_response' type to +// the given stream. +func WriteAccessReviewResponseList(list []*AccessReviewResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAccessReviewResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAccessReviewResponseList reads a list of values of the 'access_review_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAccessReviewResponseList(source interface{}) (items []*AccessReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAccessReviewResponseList(iterator) + err = iterator.Error + return +} + +// ReadAccessReviewResponseList reads list of values of the ”access_review_response' type from +// the given iterator. +func ReadAccessReviewResponseList(iterator *jsoniter.Iterator) []*AccessReviewResponse { + list := []*AccessReviewResponse{} + for iterator.ReadArray() { + item := ReadAccessReviewResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/access_review_response_type.go b/clientapi/authorizations/v1/access_review_response_type.go new file mode 100644 index 00000000..fdea078b --- /dev/null +++ b/clientapi/authorizations/v1/access_review_response_type.go @@ -0,0 +1,383 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// AccessReviewResponse represents the values of the 'access_review_response' type. +// +// Representation of an access review response +type AccessReviewResponse struct { + bitmap_ uint32 + accountUsername string + action string + clusterID string + clusterUUID string + organizationID string + reason string + resourceType string + subscriptionID string + allowed bool + isOCMInternal bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AccessReviewResponse) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AccountUsername returns the value of the 'account_username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the username of the account of which access is being reviewed. +func (o *AccessReviewResponse) AccountUsername() string { + if o != nil && o.bitmap_&1 != 0 { + return o.accountUsername + } + return "" +} + +// GetAccountUsername returns the value of the 'account_username' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the username of the account of which access is being reviewed. +func (o *AccessReviewResponse) GetAccountUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.accountUsername + } + return +} + +// Action returns the value of the 'action' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the action, one of: [get,list,create,delete,update]. +func (o *AccessReviewResponse) Action() string { + if o != nil && o.bitmap_&2 != 0 { + return o.action + } + return "" +} + +// GetAction returns the value of the 'action' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the action, one of: [get,list,create,delete,update]. +func (o *AccessReviewResponse) GetAction() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.action + } + return +} + +// Allowed returns the value of the 'allowed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines whether the action on the specified resource type is allowed. +func (o *AccessReviewResponse) Allowed() bool { + if o != nil && o.bitmap_&4 != 0 { + return o.allowed + } + return false +} + +// GetAllowed returns the value of the 'allowed' attribute and +// a flag indicating if the attribute has a value. +// +// Defines whether the action on the specified resource type is allowed. +func (o *AccessReviewResponse) GetAllowed() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.allowed + } + return +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Cluster (internal id) the resource type belongs to. +func (o *AccessReviewResponse) ClusterID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Cluster (internal id) the resource type belongs to. +func (o *AccessReviewResponse) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clusterID + } + return +} + +// ClusterUUID returns the value of the 'cluster_UUID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Cluster (external id) the resource type belongs to. +func (o *AccessReviewResponse) ClusterUUID() string { + if o != nil && o.bitmap_&16 != 0 { + return o.clusterUUID + } + return "" +} + +// GetClusterUUID returns the value of the 'cluster_UUID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Cluster (external id) the resource type belongs to. +func (o *AccessReviewResponse) GetClusterUUID() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.clusterUUID + } + return +} + +// IsOCMInternal returns the value of the 'is_OCM_internal' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines whether an account is ocm internal. +func (o *AccessReviewResponse) IsOCMInternal() bool { + if o != nil && o.bitmap_&32 != 0 { + return o.isOCMInternal + } + return false +} + +// GetIsOCMInternal returns the value of the 'is_OCM_internal' attribute and +// a flag indicating if the attribute has a value. +// +// Defines whether an account is ocm internal. +func (o *AccessReviewResponse) GetIsOCMInternal() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.isOCMInternal + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Organization the resource type belongs to. +func (o *AccessReviewResponse) OrganizationID() string { + if o != nil && o.bitmap_&64 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Organization the resource type belongs to. +func (o *AccessReviewResponse) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.organizationID + } + return +} + +// Reason returns the value of the 'reason' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines further context for the value in allowed (if applicable). +func (o *AccessReviewResponse) Reason() string { + if o != nil && o.bitmap_&128 != 0 { + return o.reason + } + return "" +} + +// GetReason returns the value of the 'reason' attribute and +// a flag indicating if the attribute has a value. +// +// Defines further context for the value in allowed (if applicable). +func (o *AccessReviewResponse) GetReason() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.reason + } + return +} + +// ResourceType returns the value of the 'resource_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the type of the resource an action would be taken on. +// See uhc-account-manager/openapi/openapi.yaml for a list of possible values. +func (o *AccessReviewResponse) ResourceType() string { + if o != nil && o.bitmap_&256 != 0 { + return o.resourceType + } + return "" +} + +// GetResourceType returns the value of the 'resource_type' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the type of the resource an action would be taken on. +// See uhc-account-manager/openapi/openapi.yaml for a list of possible values. +func (o *AccessReviewResponse) GetResourceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.resourceType + } + return +} + +// SubscriptionID returns the value of the 'subscription_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Subscription the resource type belongs to. +func (o *AccessReviewResponse) SubscriptionID() string { + if o != nil && o.bitmap_&512 != 0 { + return o.subscriptionID + } + return "" +} + +// GetSubscriptionID returns the value of the 'subscription_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Subscription the resource type belongs to. +func (o *AccessReviewResponse) GetSubscriptionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.subscriptionID + } + return +} + +// AccessReviewResponseListKind is the name of the type used to represent list of objects of +// type 'access_review_response'. +const AccessReviewResponseListKind = "AccessReviewResponseList" + +// AccessReviewResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'access_review_response'. +const AccessReviewResponseListLinkKind = "AccessReviewResponseListLink" + +// AccessReviewResponseNilKind is the name of the type used to nil lists of objects of +// type 'access_review_response'. +const AccessReviewResponseListNilKind = "AccessReviewResponseListNil" + +// AccessReviewResponseList is a list of values of the 'access_review_response' type. +type AccessReviewResponseList struct { + href string + link bool + items []*AccessReviewResponse +} + +// Len returns the length of the list. +func (l *AccessReviewResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AccessReviewResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AccessReviewResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AccessReviewResponseList) SetItems(items []*AccessReviewResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *AccessReviewResponseList) Items() []*AccessReviewResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AccessReviewResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AccessReviewResponseList) Get(i int) *AccessReviewResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AccessReviewResponseList) Slice() []*AccessReviewResponse { + var slice []*AccessReviewResponse + if l == nil { + slice = make([]*AccessReviewResponse, 0) + } else { + slice = make([]*AccessReviewResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AccessReviewResponseList) Each(f func(item *AccessReviewResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AccessReviewResponseList) Range(f func(index int, item *AccessReviewResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/access_review_response_type_json.go b/clientapi/authorizations/v1/access_review_response_type_json.go new file mode 100644 index 00000000..7a781952 --- /dev/null +++ b/clientapi/authorizations/v1/access_review_response_type_json.go @@ -0,0 +1,203 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAccessReviewResponse writes a value of the 'access_review_response' type to the given writer. +func MarshalAccessReviewResponse(object *AccessReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAccessReviewResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAccessReviewResponse writes a value of the 'access_review_response' type to the given stream. +func WriteAccessReviewResponse(object *AccessReviewResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_username") + stream.WriteString(object.accountUsername) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("action") + stream.WriteString(object.action) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("allowed") + stream.WriteBool(object.allowed) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_uuid") + stream.WriteString(object.clusterUUID) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("is_ocm_internal") + stream.WriteBool(object.isOCMInternal) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("reason") + stream.WriteString(object.reason) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_type") + stream.WriteString(object.resourceType) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionID) + } + stream.WriteObjectEnd() +} + +// UnmarshalAccessReviewResponse reads a value of the 'access_review_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAccessReviewResponse(source interface{}) (object *AccessReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAccessReviewResponse(iterator) + err = iterator.Error + return +} + +// ReadAccessReviewResponse reads a value of the 'access_review_response' type from the given iterator. +func ReadAccessReviewResponse(iterator *jsoniter.Iterator) *AccessReviewResponse { + object := &AccessReviewResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "account_username": + value := iterator.ReadString() + object.accountUsername = value + object.bitmap_ |= 1 + case "action": + value := iterator.ReadString() + object.action = value + object.bitmap_ |= 2 + case "allowed": + value := iterator.ReadBool() + object.allowed = value + object.bitmap_ |= 4 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 8 + case "cluster_uuid": + value := iterator.ReadString() + object.clusterUUID = value + object.bitmap_ |= 16 + case "is_ocm_internal": + value := iterator.ReadBool() + object.isOCMInternal = value + object.bitmap_ |= 32 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 64 + case "reason": + value := iterator.ReadString() + object.reason = value + object.bitmap_ |= 128 + case "resource_type": + value := iterator.ReadString() + object.resourceType = value + object.bitmap_ |= 256 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionID = value + object.bitmap_ |= 512 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/boolean_list_type_json.go b/clientapi/authorizations/v1/boolean_list_type_json.go new file mode 100644 index 00000000..e96b2e78 --- /dev/null +++ b/clientapi/authorizations/v1/boolean_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBooleanList writes a list of values of the 'boolean' type to +// the given writer. +func MarshalBooleanList(list []bool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBooleanList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBooleanList writes a list of value of the 'boolean' type to +// the given stream. +func WriteBooleanList(list []bool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteBool(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalBooleanList reads a list of values of the 'boolean' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBooleanList(source interface{}) (items []bool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBooleanList(iterator) + err = iterator.Error + return +} + +// ReadBooleanList reads list of values of the ”boolean' type from +// the given iterator. +func ReadBooleanList(iterator *jsoniter.Iterator) []bool { + list := []bool{} + for iterator.ReadArray() { + item := iterator.ReadBool() + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/capability_review_request_builder.go b/clientapi/authorizations/v1/capability_review_request_builder.go new file mode 100644 index 00000000..a1ff2ca6 --- /dev/null +++ b/clientapi/authorizations/v1/capability_review_request_builder.go @@ -0,0 +1,123 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// CapabilityReviewRequestBuilder contains the data and logic needed to build 'capability_review_request' objects. +// +// Representation of a capability review. +type CapabilityReviewRequestBuilder struct { + bitmap_ uint32 + accountUsername string + capability string + clusterID string + organizationID string + resourceType string + subscriptionID string + type_ string +} + +// NewCapabilityReviewRequest creates a new builder of 'capability_review_request' objects. +func NewCapabilityReviewRequest() *CapabilityReviewRequestBuilder { + return &CapabilityReviewRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CapabilityReviewRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AccountUsername sets the value of the 'account_username' attribute to the given value. +func (b *CapabilityReviewRequestBuilder) AccountUsername(value string) *CapabilityReviewRequestBuilder { + b.accountUsername = value + b.bitmap_ |= 1 + return b +} + +// Capability sets the value of the 'capability' attribute to the given value. +func (b *CapabilityReviewRequestBuilder) Capability(value string) *CapabilityReviewRequestBuilder { + b.capability = value + b.bitmap_ |= 2 + return b +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *CapabilityReviewRequestBuilder) ClusterID(value string) *CapabilityReviewRequestBuilder { + b.clusterID = value + b.bitmap_ |= 4 + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *CapabilityReviewRequestBuilder) OrganizationID(value string) *CapabilityReviewRequestBuilder { + b.organizationID = value + b.bitmap_ |= 8 + return b +} + +// ResourceType sets the value of the 'resource_type' attribute to the given value. +func (b *CapabilityReviewRequestBuilder) ResourceType(value string) *CapabilityReviewRequestBuilder { + b.resourceType = value + b.bitmap_ |= 16 + return b +} + +// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value. +func (b *CapabilityReviewRequestBuilder) SubscriptionID(value string) *CapabilityReviewRequestBuilder { + b.subscriptionID = value + b.bitmap_ |= 32 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *CapabilityReviewRequestBuilder) Type(value string) *CapabilityReviewRequestBuilder { + b.type_ = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CapabilityReviewRequestBuilder) Copy(object *CapabilityReviewRequest) *CapabilityReviewRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.accountUsername = object.accountUsername + b.capability = object.capability + b.clusterID = object.clusterID + b.organizationID = object.organizationID + b.resourceType = object.resourceType + b.subscriptionID = object.subscriptionID + b.type_ = object.type_ + return b +} + +// Build creates a 'capability_review_request' object using the configuration stored in the builder. +func (b *CapabilityReviewRequestBuilder) Build() (object *CapabilityReviewRequest, err error) { + object = new(CapabilityReviewRequest) + object.bitmap_ = b.bitmap_ + object.accountUsername = b.accountUsername + object.capability = b.capability + object.clusterID = b.clusterID + object.organizationID = b.organizationID + object.resourceType = b.resourceType + object.subscriptionID = b.subscriptionID + object.type_ = b.type_ + return +} diff --git a/clientapi/authorizations/v1/capability_review_request_list_builder.go b/clientapi/authorizations/v1/capability_review_request_list_builder.go new file mode 100644 index 00000000..0ae9c2e1 --- /dev/null +++ b/clientapi/authorizations/v1/capability_review_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// CapabilityReviewRequestListBuilder contains the data and logic needed to build +// 'capability_review_request' objects. +type CapabilityReviewRequestListBuilder struct { + items []*CapabilityReviewRequestBuilder +} + +// NewCapabilityReviewRequestList creates a new builder of 'capability_review_request' objects. +func NewCapabilityReviewRequestList() *CapabilityReviewRequestListBuilder { + return new(CapabilityReviewRequestListBuilder) +} + +// Items sets the items of the list. +func (b *CapabilityReviewRequestListBuilder) Items(values ...*CapabilityReviewRequestBuilder) *CapabilityReviewRequestListBuilder { + b.items = make([]*CapabilityReviewRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CapabilityReviewRequestListBuilder) 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 *CapabilityReviewRequestListBuilder) Copy(list *CapabilityReviewRequestList) *CapabilityReviewRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CapabilityReviewRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCapabilityReviewRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'capability_review_request' objects using the +// configuration stored in the builder. +func (b *CapabilityReviewRequestListBuilder) Build() (list *CapabilityReviewRequestList, err error) { + items := make([]*CapabilityReviewRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CapabilityReviewRequestList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/capability_review_request_list_type_json.go b/clientapi/authorizations/v1/capability_review_request_list_type_json.go new file mode 100644 index 00000000..a9877037 --- /dev/null +++ b/clientapi/authorizations/v1/capability_review_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCapabilityReviewRequestList writes a list of values of the 'capability_review_request' type to +// the given writer. +func MarshalCapabilityReviewRequestList(list []*CapabilityReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCapabilityReviewRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCapabilityReviewRequestList writes a list of value of the 'capability_review_request' type to +// the given stream. +func WriteCapabilityReviewRequestList(list []*CapabilityReviewRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCapabilityReviewRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCapabilityReviewRequestList reads a list of values of the 'capability_review_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCapabilityReviewRequestList(source interface{}) (items []*CapabilityReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCapabilityReviewRequestList(iterator) + err = iterator.Error + return +} + +// ReadCapabilityReviewRequestList reads list of values of the ”capability_review_request' type from +// the given iterator. +func ReadCapabilityReviewRequestList(iterator *jsoniter.Iterator) []*CapabilityReviewRequest { + list := []*CapabilityReviewRequest{} + for iterator.ReadArray() { + item := ReadCapabilityReviewRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/capability_review_request_type.go b/clientapi/authorizations/v1/capability_review_request_type.go new file mode 100644 index 00000000..59f00a2e --- /dev/null +++ b/clientapi/authorizations/v1/capability_review_request_type.go @@ -0,0 +1,311 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// CapabilityReviewRequest represents the values of the 'capability_review_request' type. +// +// Representation of a capability review. +type CapabilityReviewRequest struct { + bitmap_ uint32 + accountUsername string + capability string + clusterID string + organizationID string + resourceType string + subscriptionID string + type_ string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CapabilityReviewRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AccountUsername returns the value of the 'account_username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the username of the account of which capability is being reviewed. +func (o *CapabilityReviewRequest) AccountUsername() string { + if o != nil && o.bitmap_&1 != 0 { + return o.accountUsername + } + return "" +} + +// GetAccountUsername returns the value of the 'account_username' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the username of the account of which capability is being reviewed. +func (o *CapabilityReviewRequest) GetAccountUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.accountUsername + } + return +} + +// Capability returns the value of the 'capability' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Capability to review [manage_cluster_admin]. +func (o *CapabilityReviewRequest) Capability() string { + if o != nil && o.bitmap_&2 != 0 { + return o.capability + } + return "" +} + +// GetCapability returns the value of the 'capability' attribute and +// a flag indicating if the attribute has a value. +// +// Capability to review [manage_cluster_admin]. +func (o *CapabilityReviewRequest) GetCapability() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.capability + } + return +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Cluster (internal id) the resource type belongs to. +func (o *CapabilityReviewRequest) ClusterID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Cluster (internal id) the resource type belongs to. +func (o *CapabilityReviewRequest) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.clusterID + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Organization the resource type belongs to. +func (o *CapabilityReviewRequest) OrganizationID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Organization the resource type belongs to. +func (o *CapabilityReviewRequest) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.organizationID + } + return +} + +// ResourceType returns the value of the 'resource_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the type of the resource. +// See uhc-account-manager/openapi/openapi.yaml for a list of possible values. +func (o *CapabilityReviewRequest) ResourceType() string { + if o != nil && o.bitmap_&16 != 0 { + return o.resourceType + } + return "" +} + +// GetResourceType returns the value of the 'resource_type' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the type of the resource. +// See uhc-account-manager/openapi/openapi.yaml for a list of possible values. +func (o *CapabilityReviewRequest) GetResourceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.resourceType + } + return +} + +// SubscriptionID returns the value of the 'subscription_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Subscription the resource type belongs to. +func (o *CapabilityReviewRequest) SubscriptionID() string { + if o != nil && o.bitmap_&32 != 0 { + return o.subscriptionID + } + return "" +} + +// GetSubscriptionID returns the value of the 'subscription_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Subscription the resource type belongs to. +func (o *CapabilityReviewRequest) GetSubscriptionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.subscriptionID + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of capability [Cluster]. +func (o *CapabilityReviewRequest) Type() string { + if o != nil && o.bitmap_&64 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of capability [Cluster]. +func (o *CapabilityReviewRequest) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.type_ + } + return +} + +// CapabilityReviewRequestListKind is the name of the type used to represent list of objects of +// type 'capability_review_request'. +const CapabilityReviewRequestListKind = "CapabilityReviewRequestList" + +// CapabilityReviewRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'capability_review_request'. +const CapabilityReviewRequestListLinkKind = "CapabilityReviewRequestListLink" + +// CapabilityReviewRequestNilKind is the name of the type used to nil lists of objects of +// type 'capability_review_request'. +const CapabilityReviewRequestListNilKind = "CapabilityReviewRequestListNil" + +// CapabilityReviewRequestList is a list of values of the 'capability_review_request' type. +type CapabilityReviewRequestList struct { + href string + link bool + items []*CapabilityReviewRequest +} + +// Len returns the length of the list. +func (l *CapabilityReviewRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CapabilityReviewRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CapabilityReviewRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CapabilityReviewRequestList) SetItems(items []*CapabilityReviewRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *CapabilityReviewRequestList) Items() []*CapabilityReviewRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CapabilityReviewRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CapabilityReviewRequestList) Get(i int) *CapabilityReviewRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CapabilityReviewRequestList) Slice() []*CapabilityReviewRequest { + var slice []*CapabilityReviewRequest + if l == nil { + slice = make([]*CapabilityReviewRequest, 0) + } else { + slice = make([]*CapabilityReviewRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CapabilityReviewRequestList) Each(f func(item *CapabilityReviewRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CapabilityReviewRequestList) Range(f func(index int, item *CapabilityReviewRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/capability_review_request_type_json.go b/clientapi/authorizations/v1/capability_review_request_type_json.go new file mode 100644 index 00000000..1d93b611 --- /dev/null +++ b/clientapi/authorizations/v1/capability_review_request_type_json.go @@ -0,0 +1,164 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCapabilityReviewRequest writes a value of the 'capability_review_request' type to the given writer. +func MarshalCapabilityReviewRequest(object *CapabilityReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCapabilityReviewRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCapabilityReviewRequest writes a value of the 'capability_review_request' type to the given stream. +func WriteCapabilityReviewRequest(object *CapabilityReviewRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_username") + stream.WriteString(object.accountUsername) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("capability") + stream.WriteString(object.capability) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_type") + stream.WriteString(object.resourceType) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionID) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalCapabilityReviewRequest reads a value of the 'capability_review_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCapabilityReviewRequest(source interface{}) (object *CapabilityReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCapabilityReviewRequest(iterator) + err = iterator.Error + return +} + +// ReadCapabilityReviewRequest reads a value of the 'capability_review_request' type from the given iterator. +func ReadCapabilityReviewRequest(iterator *jsoniter.Iterator) *CapabilityReviewRequest { + object := &CapabilityReviewRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "account_username": + value := iterator.ReadString() + object.accountUsername = value + object.bitmap_ |= 1 + case "capability": + value := iterator.ReadString() + object.capability = value + object.bitmap_ |= 2 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 4 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 8 + case "resource_type": + value := iterator.ReadString() + object.resourceType = value + object.bitmap_ |= 16 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionID = value + object.bitmap_ |= 32 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/capability_review_response_builder.go b/clientapi/authorizations/v1/capability_review_response_builder.go new file mode 100644 index 00000000..25d09d4c --- /dev/null +++ b/clientapi/authorizations/v1/capability_review_response_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// CapabilityReviewResponseBuilder contains the data and logic needed to build 'capability_review_response' objects. +// +// Representation of a capability review response. +type CapabilityReviewResponseBuilder struct { + bitmap_ uint32 + result string +} + +// NewCapabilityReviewResponse creates a new builder of 'capability_review_response' objects. +func NewCapabilityReviewResponse() *CapabilityReviewResponseBuilder { + return &CapabilityReviewResponseBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CapabilityReviewResponseBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Result sets the value of the 'result' attribute to the given value. +func (b *CapabilityReviewResponseBuilder) Result(value string) *CapabilityReviewResponseBuilder { + b.result = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CapabilityReviewResponseBuilder) Copy(object *CapabilityReviewResponse) *CapabilityReviewResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.result = object.result + return b +} + +// Build creates a 'capability_review_response' object using the configuration stored in the builder. +func (b *CapabilityReviewResponseBuilder) Build() (object *CapabilityReviewResponse, err error) { + object = new(CapabilityReviewResponse) + object.bitmap_ = b.bitmap_ + object.result = b.result + return +} diff --git a/clientapi/authorizations/v1/capability_review_response_list_builder.go b/clientapi/authorizations/v1/capability_review_response_list_builder.go new file mode 100644 index 00000000..a81d2ac0 --- /dev/null +++ b/clientapi/authorizations/v1/capability_review_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// CapabilityReviewResponseListBuilder contains the data and logic needed to build +// 'capability_review_response' objects. +type CapabilityReviewResponseListBuilder struct { + items []*CapabilityReviewResponseBuilder +} + +// NewCapabilityReviewResponseList creates a new builder of 'capability_review_response' objects. +func NewCapabilityReviewResponseList() *CapabilityReviewResponseListBuilder { + return new(CapabilityReviewResponseListBuilder) +} + +// Items sets the items of the list. +func (b *CapabilityReviewResponseListBuilder) Items(values ...*CapabilityReviewResponseBuilder) *CapabilityReviewResponseListBuilder { + b.items = make([]*CapabilityReviewResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CapabilityReviewResponseListBuilder) 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 *CapabilityReviewResponseListBuilder) Copy(list *CapabilityReviewResponseList) *CapabilityReviewResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CapabilityReviewResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCapabilityReviewResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'capability_review_response' objects using the +// configuration stored in the builder. +func (b *CapabilityReviewResponseListBuilder) Build() (list *CapabilityReviewResponseList, err error) { + items := make([]*CapabilityReviewResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CapabilityReviewResponseList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/capability_review_response_list_type_json.go b/clientapi/authorizations/v1/capability_review_response_list_type_json.go new file mode 100644 index 00000000..934b0e18 --- /dev/null +++ b/clientapi/authorizations/v1/capability_review_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCapabilityReviewResponseList writes a list of values of the 'capability_review_response' type to +// the given writer. +func MarshalCapabilityReviewResponseList(list []*CapabilityReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCapabilityReviewResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCapabilityReviewResponseList writes a list of value of the 'capability_review_response' type to +// the given stream. +func WriteCapabilityReviewResponseList(list []*CapabilityReviewResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCapabilityReviewResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCapabilityReviewResponseList reads a list of values of the 'capability_review_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCapabilityReviewResponseList(source interface{}) (items []*CapabilityReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCapabilityReviewResponseList(iterator) + err = iterator.Error + return +} + +// ReadCapabilityReviewResponseList reads list of values of the ”capability_review_response' type from +// the given iterator. +func ReadCapabilityReviewResponseList(iterator *jsoniter.Iterator) []*CapabilityReviewResponse { + list := []*CapabilityReviewResponse{} + for iterator.ReadArray() { + item := ReadCapabilityReviewResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/capability_review_response_type.go b/clientapi/authorizations/v1/capability_review_response_type.go new file mode 100644 index 00000000..fc660981 --- /dev/null +++ b/clientapi/authorizations/v1/capability_review_response_type.go @@ -0,0 +1,161 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// CapabilityReviewResponse represents the values of the 'capability_review_response' type. +// +// Representation of a capability review response. +type CapabilityReviewResponse struct { + bitmap_ uint32 + result string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CapabilityReviewResponse) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Result returns the value of the 'result' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CapabilityReviewResponse) Result() string { + if o != nil && o.bitmap_&1 != 0 { + return o.result + } + return "" +} + +// GetResult returns the value of the 'result' attribute and +// a flag indicating if the attribute has a value. +func (o *CapabilityReviewResponse) GetResult() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.result + } + return +} + +// CapabilityReviewResponseListKind is the name of the type used to represent list of objects of +// type 'capability_review_response'. +const CapabilityReviewResponseListKind = "CapabilityReviewResponseList" + +// CapabilityReviewResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'capability_review_response'. +const CapabilityReviewResponseListLinkKind = "CapabilityReviewResponseListLink" + +// CapabilityReviewResponseNilKind is the name of the type used to nil lists of objects of +// type 'capability_review_response'. +const CapabilityReviewResponseListNilKind = "CapabilityReviewResponseListNil" + +// CapabilityReviewResponseList is a list of values of the 'capability_review_response' type. +type CapabilityReviewResponseList struct { + href string + link bool + items []*CapabilityReviewResponse +} + +// Len returns the length of the list. +func (l *CapabilityReviewResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CapabilityReviewResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CapabilityReviewResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CapabilityReviewResponseList) SetItems(items []*CapabilityReviewResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *CapabilityReviewResponseList) Items() []*CapabilityReviewResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CapabilityReviewResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CapabilityReviewResponseList) Get(i int) *CapabilityReviewResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CapabilityReviewResponseList) Slice() []*CapabilityReviewResponse { + var slice []*CapabilityReviewResponse + if l == nil { + slice = make([]*CapabilityReviewResponse, 0) + } else { + slice = make([]*CapabilityReviewResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CapabilityReviewResponseList) Each(f func(item *CapabilityReviewResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CapabilityReviewResponseList) Range(f func(index int, item *CapabilityReviewResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/capability_review_response_type_json.go b/clientapi/authorizations/v1/capability_review_response_type_json.go new file mode 100644 index 00000000..87f925ca --- /dev/null +++ b/clientapi/authorizations/v1/capability_review_response_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCapabilityReviewResponse writes a value of the 'capability_review_response' type to the given writer. +func MarshalCapabilityReviewResponse(object *CapabilityReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCapabilityReviewResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCapabilityReviewResponse writes a value of the 'capability_review_response' type to the given stream. +func WriteCapabilityReviewResponse(object *CapabilityReviewResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("result") + stream.WriteString(object.result) + } + stream.WriteObjectEnd() +} + +// UnmarshalCapabilityReviewResponse reads a value of the 'capability_review_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCapabilityReviewResponse(source interface{}) (object *CapabilityReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCapabilityReviewResponse(iterator) + err = iterator.Error + return +} + +// ReadCapabilityReviewResponse reads a value of the 'capability_review_response' type from the given iterator. +func ReadCapabilityReviewResponse(iterator *jsoniter.Iterator) *CapabilityReviewResponse { + object := &CapabilityReviewResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "result": + value := iterator.ReadString() + object.result = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/date_list_type_json.go b/clientapi/authorizations/v1/date_list_type_json.go new file mode 100644 index 00000000..6e974dda --- /dev/null +++ b/clientapi/authorizations/v1/date_list_type_json.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDateList writes a list of values of the 'date' type to +// the given writer. +func MarshalDateList(list []time.Time, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDateList writes a list of value of the 'date' type to +// the given stream. +func WriteDateList(list []time.Time, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString((value).Format(time.RFC3339)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDateList reads a list of values of the 'date' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDateList(source interface{}) (items []time.Time, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDateList(iterator) + err = iterator.Error + return +} + +// ReadDateList reads list of values of the ”date' type from +// the given iterator. +func ReadDateList(iterator *jsoniter.Iterator) []time.Time { + list := []time.Time{} + for iterator.ReadArray() { + text := iterator.ReadString() + item, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/export_control_review_request_builder.go b/clientapi/authorizations/v1/export_control_review_request_builder.go new file mode 100644 index 00000000..a4d660d3 --- /dev/null +++ b/clientapi/authorizations/v1/export_control_review_request_builder.go @@ -0,0 +1,61 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// ExportControlReviewRequestBuilder contains the data and logic needed to build 'export_control_review_request' objects. +type ExportControlReviewRequestBuilder struct { + bitmap_ uint32 + accountUsername string +} + +// NewExportControlReviewRequest creates a new builder of 'export_control_review_request' objects. +func NewExportControlReviewRequest() *ExportControlReviewRequestBuilder { + return &ExportControlReviewRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ExportControlReviewRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AccountUsername sets the value of the 'account_username' attribute to the given value. +func (b *ExportControlReviewRequestBuilder) AccountUsername(value string) *ExportControlReviewRequestBuilder { + b.accountUsername = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ExportControlReviewRequestBuilder) Copy(object *ExportControlReviewRequest) *ExportControlReviewRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.accountUsername = object.accountUsername + return b +} + +// Build creates a 'export_control_review_request' object using the configuration stored in the builder. +func (b *ExportControlReviewRequestBuilder) Build() (object *ExportControlReviewRequest, err error) { + object = new(ExportControlReviewRequest) + object.bitmap_ = b.bitmap_ + object.accountUsername = b.accountUsername + return +} diff --git a/clientapi/authorizations/v1/export_control_review_request_list_builder.go b/clientapi/authorizations/v1/export_control_review_request_list_builder.go new file mode 100644 index 00000000..1848c5ac --- /dev/null +++ b/clientapi/authorizations/v1/export_control_review_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// ExportControlReviewRequestListBuilder contains the data and logic needed to build +// 'export_control_review_request' objects. +type ExportControlReviewRequestListBuilder struct { + items []*ExportControlReviewRequestBuilder +} + +// NewExportControlReviewRequestList creates a new builder of 'export_control_review_request' objects. +func NewExportControlReviewRequestList() *ExportControlReviewRequestListBuilder { + return new(ExportControlReviewRequestListBuilder) +} + +// Items sets the items of the list. +func (b *ExportControlReviewRequestListBuilder) Items(values ...*ExportControlReviewRequestBuilder) *ExportControlReviewRequestListBuilder { + b.items = make([]*ExportControlReviewRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ExportControlReviewRequestListBuilder) 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 *ExportControlReviewRequestListBuilder) Copy(list *ExportControlReviewRequestList) *ExportControlReviewRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ExportControlReviewRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewExportControlReviewRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'export_control_review_request' objects using the +// configuration stored in the builder. +func (b *ExportControlReviewRequestListBuilder) Build() (list *ExportControlReviewRequestList, err error) { + items := make([]*ExportControlReviewRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ExportControlReviewRequestList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/export_control_review_request_list_type_json.go b/clientapi/authorizations/v1/export_control_review_request_list_type_json.go new file mode 100644 index 00000000..d5110fe1 --- /dev/null +++ b/clientapi/authorizations/v1/export_control_review_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExportControlReviewRequestList writes a list of values of the 'export_control_review_request' type to +// the given writer. +func MarshalExportControlReviewRequestList(list []*ExportControlReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExportControlReviewRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExportControlReviewRequestList writes a list of value of the 'export_control_review_request' type to +// the given stream. +func WriteExportControlReviewRequestList(list []*ExportControlReviewRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteExportControlReviewRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalExportControlReviewRequestList reads a list of values of the 'export_control_review_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalExportControlReviewRequestList(source interface{}) (items []*ExportControlReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadExportControlReviewRequestList(iterator) + err = iterator.Error + return +} + +// ReadExportControlReviewRequestList reads list of values of the ”export_control_review_request' type from +// the given iterator. +func ReadExportControlReviewRequestList(iterator *jsoniter.Iterator) []*ExportControlReviewRequest { + list := []*ExportControlReviewRequest{} + for iterator.ReadArray() { + item := ReadExportControlReviewRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/export_control_review_request_type.go b/clientapi/authorizations/v1/export_control_review_request_type.go new file mode 100644 index 00000000..0442ac8f --- /dev/null +++ b/clientapi/authorizations/v1/export_control_review_request_type.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// ExportControlReviewRequest represents the values of the 'export_control_review_request' type. +type ExportControlReviewRequest struct { + bitmap_ uint32 + accountUsername string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ExportControlReviewRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AccountUsername returns the value of the 'account_username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ExportControlReviewRequest) AccountUsername() string { + if o != nil && o.bitmap_&1 != 0 { + return o.accountUsername + } + return "" +} + +// GetAccountUsername returns the value of the 'account_username' attribute and +// a flag indicating if the attribute has a value. +func (o *ExportControlReviewRequest) GetAccountUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.accountUsername + } + return +} + +// ExportControlReviewRequestListKind is the name of the type used to represent list of objects of +// type 'export_control_review_request'. +const ExportControlReviewRequestListKind = "ExportControlReviewRequestList" + +// ExportControlReviewRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'export_control_review_request'. +const ExportControlReviewRequestListLinkKind = "ExportControlReviewRequestListLink" + +// ExportControlReviewRequestNilKind is the name of the type used to nil lists of objects of +// type 'export_control_review_request'. +const ExportControlReviewRequestListNilKind = "ExportControlReviewRequestListNil" + +// ExportControlReviewRequestList is a list of values of the 'export_control_review_request' type. +type ExportControlReviewRequestList struct { + href string + link bool + items []*ExportControlReviewRequest +} + +// Len returns the length of the list. +func (l *ExportControlReviewRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ExportControlReviewRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ExportControlReviewRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ExportControlReviewRequestList) SetItems(items []*ExportControlReviewRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *ExportControlReviewRequestList) Items() []*ExportControlReviewRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ExportControlReviewRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ExportControlReviewRequestList) Get(i int) *ExportControlReviewRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ExportControlReviewRequestList) Slice() []*ExportControlReviewRequest { + var slice []*ExportControlReviewRequest + if l == nil { + slice = make([]*ExportControlReviewRequest, 0) + } else { + slice = make([]*ExportControlReviewRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ExportControlReviewRequestList) Each(f func(item *ExportControlReviewRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ExportControlReviewRequestList) Range(f func(index int, item *ExportControlReviewRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/export_control_review_request_type_json.go b/clientapi/authorizations/v1/export_control_review_request_type_json.go new file mode 100644 index 00000000..10fd94f3 --- /dev/null +++ b/clientapi/authorizations/v1/export_control_review_request_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExportControlReviewRequest writes a value of the 'export_control_review_request' type to the given writer. +func MarshalExportControlReviewRequest(object *ExportControlReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExportControlReviewRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExportControlReviewRequest writes a value of the 'export_control_review_request' type to the given stream. +func WriteExportControlReviewRequest(object *ExportControlReviewRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_username") + stream.WriteString(object.accountUsername) + } + stream.WriteObjectEnd() +} + +// UnmarshalExportControlReviewRequest reads a value of the 'export_control_review_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalExportControlReviewRequest(source interface{}) (object *ExportControlReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadExportControlReviewRequest(iterator) + err = iterator.Error + return +} + +// ReadExportControlReviewRequest reads a value of the 'export_control_review_request' type from the given iterator. +func ReadExportControlReviewRequest(iterator *jsoniter.Iterator) *ExportControlReviewRequest { + object := &ExportControlReviewRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "account_username": + value := iterator.ReadString() + object.accountUsername = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/export_control_review_response_builder.go b/clientapi/authorizations/v1/export_control_review_response_builder.go new file mode 100644 index 00000000..73bd6442 --- /dev/null +++ b/clientapi/authorizations/v1/export_control_review_response_builder.go @@ -0,0 +1,61 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// ExportControlReviewResponseBuilder contains the data and logic needed to build 'export_control_review_response' objects. +type ExportControlReviewResponseBuilder struct { + bitmap_ uint32 + restricted bool +} + +// NewExportControlReviewResponse creates a new builder of 'export_control_review_response' objects. +func NewExportControlReviewResponse() *ExportControlReviewResponseBuilder { + return &ExportControlReviewResponseBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ExportControlReviewResponseBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Restricted sets the value of the 'restricted' attribute to the given value. +func (b *ExportControlReviewResponseBuilder) Restricted(value bool) *ExportControlReviewResponseBuilder { + b.restricted = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ExportControlReviewResponseBuilder) Copy(object *ExportControlReviewResponse) *ExportControlReviewResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.restricted = object.restricted + return b +} + +// Build creates a 'export_control_review_response' object using the configuration stored in the builder. +func (b *ExportControlReviewResponseBuilder) Build() (object *ExportControlReviewResponse, err error) { + object = new(ExportControlReviewResponse) + object.bitmap_ = b.bitmap_ + object.restricted = b.restricted + return +} diff --git a/clientapi/authorizations/v1/export_control_review_response_list_builder.go b/clientapi/authorizations/v1/export_control_review_response_list_builder.go new file mode 100644 index 00000000..0a3ae7c1 --- /dev/null +++ b/clientapi/authorizations/v1/export_control_review_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// ExportControlReviewResponseListBuilder contains the data and logic needed to build +// 'export_control_review_response' objects. +type ExportControlReviewResponseListBuilder struct { + items []*ExportControlReviewResponseBuilder +} + +// NewExportControlReviewResponseList creates a new builder of 'export_control_review_response' objects. +func NewExportControlReviewResponseList() *ExportControlReviewResponseListBuilder { + return new(ExportControlReviewResponseListBuilder) +} + +// Items sets the items of the list. +func (b *ExportControlReviewResponseListBuilder) Items(values ...*ExportControlReviewResponseBuilder) *ExportControlReviewResponseListBuilder { + b.items = make([]*ExportControlReviewResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ExportControlReviewResponseListBuilder) 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 *ExportControlReviewResponseListBuilder) Copy(list *ExportControlReviewResponseList) *ExportControlReviewResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ExportControlReviewResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewExportControlReviewResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'export_control_review_response' objects using the +// configuration stored in the builder. +func (b *ExportControlReviewResponseListBuilder) Build() (list *ExportControlReviewResponseList, err error) { + items := make([]*ExportControlReviewResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ExportControlReviewResponseList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/export_control_review_response_list_type_json.go b/clientapi/authorizations/v1/export_control_review_response_list_type_json.go new file mode 100644 index 00000000..377ab6b7 --- /dev/null +++ b/clientapi/authorizations/v1/export_control_review_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExportControlReviewResponseList writes a list of values of the 'export_control_review_response' type to +// the given writer. +func MarshalExportControlReviewResponseList(list []*ExportControlReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExportControlReviewResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExportControlReviewResponseList writes a list of value of the 'export_control_review_response' type to +// the given stream. +func WriteExportControlReviewResponseList(list []*ExportControlReviewResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteExportControlReviewResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalExportControlReviewResponseList reads a list of values of the 'export_control_review_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalExportControlReviewResponseList(source interface{}) (items []*ExportControlReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadExportControlReviewResponseList(iterator) + err = iterator.Error + return +} + +// ReadExportControlReviewResponseList reads list of values of the ”export_control_review_response' type from +// the given iterator. +func ReadExportControlReviewResponseList(iterator *jsoniter.Iterator) []*ExportControlReviewResponse { + list := []*ExportControlReviewResponse{} + for iterator.ReadArray() { + item := ReadExportControlReviewResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/export_control_review_response_type.go b/clientapi/authorizations/v1/export_control_review_response_type.go new file mode 100644 index 00000000..34425b55 --- /dev/null +++ b/clientapi/authorizations/v1/export_control_review_response_type.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// ExportControlReviewResponse represents the values of the 'export_control_review_response' type. +type ExportControlReviewResponse struct { + bitmap_ uint32 + restricted bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ExportControlReviewResponse) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Restricted returns the value of the 'restricted' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ExportControlReviewResponse) Restricted() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.restricted + } + return false +} + +// GetRestricted returns the value of the 'restricted' attribute and +// a flag indicating if the attribute has a value. +func (o *ExportControlReviewResponse) GetRestricted() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.restricted + } + return +} + +// ExportControlReviewResponseListKind is the name of the type used to represent list of objects of +// type 'export_control_review_response'. +const ExportControlReviewResponseListKind = "ExportControlReviewResponseList" + +// ExportControlReviewResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'export_control_review_response'. +const ExportControlReviewResponseListLinkKind = "ExportControlReviewResponseListLink" + +// ExportControlReviewResponseNilKind is the name of the type used to nil lists of objects of +// type 'export_control_review_response'. +const ExportControlReviewResponseListNilKind = "ExportControlReviewResponseListNil" + +// ExportControlReviewResponseList is a list of values of the 'export_control_review_response' type. +type ExportControlReviewResponseList struct { + href string + link bool + items []*ExportControlReviewResponse +} + +// Len returns the length of the list. +func (l *ExportControlReviewResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ExportControlReviewResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ExportControlReviewResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ExportControlReviewResponseList) SetItems(items []*ExportControlReviewResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *ExportControlReviewResponseList) Items() []*ExportControlReviewResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ExportControlReviewResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ExportControlReviewResponseList) Get(i int) *ExportControlReviewResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ExportControlReviewResponseList) Slice() []*ExportControlReviewResponse { + var slice []*ExportControlReviewResponse + if l == nil { + slice = make([]*ExportControlReviewResponse, 0) + } else { + slice = make([]*ExportControlReviewResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ExportControlReviewResponseList) Each(f func(item *ExportControlReviewResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ExportControlReviewResponseList) Range(f func(index int, item *ExportControlReviewResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/export_control_review_response_type_json.go b/clientapi/authorizations/v1/export_control_review_response_type_json.go new file mode 100644 index 00000000..8e854724 --- /dev/null +++ b/clientapi/authorizations/v1/export_control_review_response_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExportControlReviewResponse writes a value of the 'export_control_review_response' type to the given writer. +func MarshalExportControlReviewResponse(object *ExportControlReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExportControlReviewResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExportControlReviewResponse writes a value of the 'export_control_review_response' type to the given stream. +func WriteExportControlReviewResponse(object *ExportControlReviewResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("restricted") + stream.WriteBool(object.restricted) + } + stream.WriteObjectEnd() +} + +// UnmarshalExportControlReviewResponse reads a value of the 'export_control_review_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalExportControlReviewResponse(source interface{}) (object *ExportControlReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadExportControlReviewResponse(iterator) + err = iterator.Error + return +} + +// ReadExportControlReviewResponse reads a value of the 'export_control_review_response' type from the given iterator. +func ReadExportControlReviewResponse(iterator *jsoniter.Iterator) *ExportControlReviewResponse { + object := &ExportControlReviewResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "restricted": + value := iterator.ReadBool() + object.restricted = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/feature_review_request_builder.go b/clientapi/authorizations/v1/feature_review_request_builder.go new file mode 100644 index 00000000..e1a614ba --- /dev/null +++ b/clientapi/authorizations/v1/feature_review_request_builder.go @@ -0,0 +1,83 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// FeatureReviewRequestBuilder contains the data and logic needed to build 'feature_review_request' objects. +// +// Representation of a feature review +type FeatureReviewRequestBuilder struct { + bitmap_ uint32 + accountUsername string + feature string + organizationId string +} + +// NewFeatureReviewRequest creates a new builder of 'feature_review_request' objects. +func NewFeatureReviewRequest() *FeatureReviewRequestBuilder { + return &FeatureReviewRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *FeatureReviewRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AccountUsername sets the value of the 'account_username' attribute to the given value. +func (b *FeatureReviewRequestBuilder) AccountUsername(value string) *FeatureReviewRequestBuilder { + b.accountUsername = value + b.bitmap_ |= 1 + return b +} + +// Feature sets the value of the 'feature' attribute to the given value. +func (b *FeatureReviewRequestBuilder) Feature(value string) *FeatureReviewRequestBuilder { + b.feature = value + b.bitmap_ |= 2 + return b +} + +// OrganizationId sets the value of the 'organization_id' attribute to the given value. +func (b *FeatureReviewRequestBuilder) OrganizationId(value string) *FeatureReviewRequestBuilder { + b.organizationId = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *FeatureReviewRequestBuilder) Copy(object *FeatureReviewRequest) *FeatureReviewRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.accountUsername = object.accountUsername + b.feature = object.feature + b.organizationId = object.organizationId + return b +} + +// Build creates a 'feature_review_request' object using the configuration stored in the builder. +func (b *FeatureReviewRequestBuilder) Build() (object *FeatureReviewRequest, err error) { + object = new(FeatureReviewRequest) + object.bitmap_ = b.bitmap_ + object.accountUsername = b.accountUsername + object.feature = b.feature + object.organizationId = b.organizationId + return +} diff --git a/clientapi/authorizations/v1/feature_review_request_list_builder.go b/clientapi/authorizations/v1/feature_review_request_list_builder.go new file mode 100644 index 00000000..bd00c33c --- /dev/null +++ b/clientapi/authorizations/v1/feature_review_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// FeatureReviewRequestListBuilder contains the data and logic needed to build +// 'feature_review_request' objects. +type FeatureReviewRequestListBuilder struct { + items []*FeatureReviewRequestBuilder +} + +// NewFeatureReviewRequestList creates a new builder of 'feature_review_request' objects. +func NewFeatureReviewRequestList() *FeatureReviewRequestListBuilder { + return new(FeatureReviewRequestListBuilder) +} + +// Items sets the items of the list. +func (b *FeatureReviewRequestListBuilder) Items(values ...*FeatureReviewRequestBuilder) *FeatureReviewRequestListBuilder { + b.items = make([]*FeatureReviewRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *FeatureReviewRequestListBuilder) 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 *FeatureReviewRequestListBuilder) Copy(list *FeatureReviewRequestList) *FeatureReviewRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*FeatureReviewRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewFeatureReviewRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'feature_review_request' objects using the +// configuration stored in the builder. +func (b *FeatureReviewRequestListBuilder) Build() (list *FeatureReviewRequestList, err error) { + items := make([]*FeatureReviewRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(FeatureReviewRequestList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/feature_review_request_list_type_json.go b/clientapi/authorizations/v1/feature_review_request_list_type_json.go new file mode 100644 index 00000000..8f173805 --- /dev/null +++ b/clientapi/authorizations/v1/feature_review_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFeatureReviewRequestList writes a list of values of the 'feature_review_request' type to +// the given writer. +func MarshalFeatureReviewRequestList(list []*FeatureReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFeatureReviewRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFeatureReviewRequestList writes a list of value of the 'feature_review_request' type to +// the given stream. +func WriteFeatureReviewRequestList(list []*FeatureReviewRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteFeatureReviewRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalFeatureReviewRequestList reads a list of values of the 'feature_review_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFeatureReviewRequestList(source interface{}) (items []*FeatureReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFeatureReviewRequestList(iterator) + err = iterator.Error + return +} + +// ReadFeatureReviewRequestList reads list of values of the ”feature_review_request' type from +// the given iterator. +func ReadFeatureReviewRequestList(iterator *jsoniter.Iterator) []*FeatureReviewRequest { + list := []*FeatureReviewRequest{} + for iterator.ReadArray() { + item := ReadFeatureReviewRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/feature_review_request_type.go b/clientapi/authorizations/v1/feature_review_request_type.go new file mode 100644 index 00000000..d5097fe6 --- /dev/null +++ b/clientapi/authorizations/v1/feature_review_request_type.go @@ -0,0 +1,213 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// FeatureReviewRequest represents the values of the 'feature_review_request' type. +// +// Representation of a feature review +type FeatureReviewRequest struct { + bitmap_ uint32 + accountUsername string + feature string + organizationId string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *FeatureReviewRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AccountUsername returns the value of the 'account_username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the username of the account of which access is being reviewed +func (o *FeatureReviewRequest) AccountUsername() string { + if o != nil && o.bitmap_&1 != 0 { + return o.accountUsername + } + return "" +} + +// GetAccountUsername returns the value of the 'account_username' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the username of the account of which access is being reviewed +func (o *FeatureReviewRequest) GetAccountUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.accountUsername + } + return +} + +// Feature returns the value of the 'feature' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the feature which can be toggled +func (o *FeatureReviewRequest) Feature() string { + if o != nil && o.bitmap_&2 != 0 { + return o.feature + } + return "" +} + +// GetFeature returns the value of the 'feature' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the feature which can be toggled +func (o *FeatureReviewRequest) GetFeature() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.feature + } + return +} + +// OrganizationId returns the value of the 'organization_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the organisation id of the account of which access is being reviewed +func (o *FeatureReviewRequest) OrganizationId() string { + if o != nil && o.bitmap_&4 != 0 { + return o.organizationId + } + return "" +} + +// GetOrganizationId returns the value of the 'organization_id' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the organisation id of the account of which access is being reviewed +func (o *FeatureReviewRequest) GetOrganizationId() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.organizationId + } + return +} + +// FeatureReviewRequestListKind is the name of the type used to represent list of objects of +// type 'feature_review_request'. +const FeatureReviewRequestListKind = "FeatureReviewRequestList" + +// FeatureReviewRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'feature_review_request'. +const FeatureReviewRequestListLinkKind = "FeatureReviewRequestListLink" + +// FeatureReviewRequestNilKind is the name of the type used to nil lists of objects of +// type 'feature_review_request'. +const FeatureReviewRequestListNilKind = "FeatureReviewRequestListNil" + +// FeatureReviewRequestList is a list of values of the 'feature_review_request' type. +type FeatureReviewRequestList struct { + href string + link bool + items []*FeatureReviewRequest +} + +// Len returns the length of the list. +func (l *FeatureReviewRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *FeatureReviewRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *FeatureReviewRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *FeatureReviewRequestList) SetItems(items []*FeatureReviewRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *FeatureReviewRequestList) Items() []*FeatureReviewRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *FeatureReviewRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *FeatureReviewRequestList) Get(i int) *FeatureReviewRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *FeatureReviewRequestList) Slice() []*FeatureReviewRequest { + var slice []*FeatureReviewRequest + if l == nil { + slice = make([]*FeatureReviewRequest, 0) + } else { + slice = make([]*FeatureReviewRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *FeatureReviewRequestList) Each(f func(item *FeatureReviewRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *FeatureReviewRequestList) Range(f func(index int, item *FeatureReviewRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/feature_review_request_type_json.go b/clientapi/authorizations/v1/feature_review_request_type_json.go new file mode 100644 index 00000000..ad7c6d84 --- /dev/null +++ b/clientapi/authorizations/v1/feature_review_request_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFeatureReviewRequest writes a value of the 'feature_review_request' type to the given writer. +func MarshalFeatureReviewRequest(object *FeatureReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFeatureReviewRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFeatureReviewRequest writes a value of the 'feature_review_request' type to the given stream. +func WriteFeatureReviewRequest(object *FeatureReviewRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_username") + stream.WriteString(object.accountUsername) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("feature") + stream.WriteString(object.feature) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationId) + } + stream.WriteObjectEnd() +} + +// UnmarshalFeatureReviewRequest reads a value of the 'feature_review_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalFeatureReviewRequest(source interface{}) (object *FeatureReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadFeatureReviewRequest(iterator) + err = iterator.Error + return +} + +// ReadFeatureReviewRequest reads a value of the 'feature_review_request' type from the given iterator. +func ReadFeatureReviewRequest(iterator *jsoniter.Iterator) *FeatureReviewRequest { + object := &FeatureReviewRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "account_username": + value := iterator.ReadString() + object.accountUsername = value + object.bitmap_ |= 1 + case "feature": + value := iterator.ReadString() + object.feature = value + object.bitmap_ |= 2 + case "organization_id": + value := iterator.ReadString() + object.organizationId = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/feature_review_response_builder.go b/clientapi/authorizations/v1/feature_review_response_builder.go new file mode 100644 index 00000000..186da17b --- /dev/null +++ b/clientapi/authorizations/v1/feature_review_response_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// FeatureReviewResponseBuilder contains the data and logic needed to build 'feature_review_response' objects. +// +// Representation of a feature review response +type FeatureReviewResponseBuilder struct { + bitmap_ uint32 + featureID string + enabled bool +} + +// NewFeatureReviewResponse creates a new builder of 'feature_review_response' objects. +func NewFeatureReviewResponse() *FeatureReviewResponseBuilder { + return &FeatureReviewResponseBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *FeatureReviewResponseBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *FeatureReviewResponseBuilder) Enabled(value bool) *FeatureReviewResponseBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// FeatureID sets the value of the 'feature_ID' attribute to the given value. +func (b *FeatureReviewResponseBuilder) FeatureID(value string) *FeatureReviewResponseBuilder { + b.featureID = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *FeatureReviewResponseBuilder) Copy(object *FeatureReviewResponse) *FeatureReviewResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + b.featureID = object.featureID + return b +} + +// Build creates a 'feature_review_response' object using the configuration stored in the builder. +func (b *FeatureReviewResponseBuilder) Build() (object *FeatureReviewResponse, err error) { + object = new(FeatureReviewResponse) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + object.featureID = b.featureID + return +} diff --git a/clientapi/authorizations/v1/feature_review_response_list_builder.go b/clientapi/authorizations/v1/feature_review_response_list_builder.go new file mode 100644 index 00000000..740387e7 --- /dev/null +++ b/clientapi/authorizations/v1/feature_review_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// FeatureReviewResponseListBuilder contains the data and logic needed to build +// 'feature_review_response' objects. +type FeatureReviewResponseListBuilder struct { + items []*FeatureReviewResponseBuilder +} + +// NewFeatureReviewResponseList creates a new builder of 'feature_review_response' objects. +func NewFeatureReviewResponseList() *FeatureReviewResponseListBuilder { + return new(FeatureReviewResponseListBuilder) +} + +// Items sets the items of the list. +func (b *FeatureReviewResponseListBuilder) Items(values ...*FeatureReviewResponseBuilder) *FeatureReviewResponseListBuilder { + b.items = make([]*FeatureReviewResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *FeatureReviewResponseListBuilder) 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 *FeatureReviewResponseListBuilder) Copy(list *FeatureReviewResponseList) *FeatureReviewResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*FeatureReviewResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewFeatureReviewResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'feature_review_response' objects using the +// configuration stored in the builder. +func (b *FeatureReviewResponseListBuilder) Build() (list *FeatureReviewResponseList, err error) { + items := make([]*FeatureReviewResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(FeatureReviewResponseList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/feature_review_response_list_type_json.go b/clientapi/authorizations/v1/feature_review_response_list_type_json.go new file mode 100644 index 00000000..63752f85 --- /dev/null +++ b/clientapi/authorizations/v1/feature_review_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFeatureReviewResponseList writes a list of values of the 'feature_review_response' type to +// the given writer. +func MarshalFeatureReviewResponseList(list []*FeatureReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFeatureReviewResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFeatureReviewResponseList writes a list of value of the 'feature_review_response' type to +// the given stream. +func WriteFeatureReviewResponseList(list []*FeatureReviewResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteFeatureReviewResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalFeatureReviewResponseList reads a list of values of the 'feature_review_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFeatureReviewResponseList(source interface{}) (items []*FeatureReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFeatureReviewResponseList(iterator) + err = iterator.Error + return +} + +// ReadFeatureReviewResponseList reads list of values of the ”feature_review_response' type from +// the given iterator. +func ReadFeatureReviewResponseList(iterator *jsoniter.Iterator) []*FeatureReviewResponse { + list := []*FeatureReviewResponse{} + for iterator.ReadArray() { + item := ReadFeatureReviewResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/feature_review_response_type.go b/clientapi/authorizations/v1/feature_review_response_type.go new file mode 100644 index 00000000..31bacaff --- /dev/null +++ b/clientapi/authorizations/v1/feature_review_response_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// FeatureReviewResponse represents the values of the 'feature_review_response' type. +// +// Representation of a feature review response +type FeatureReviewResponse struct { + bitmap_ uint32 + featureID string + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *FeatureReviewResponse) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines whether the feature can be toggled +func (o *FeatureReviewResponse) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Defines whether the feature can be toggled +func (o *FeatureReviewResponse) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// FeatureID returns the value of the 'feature_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the feature id which can be toggled +func (o *FeatureReviewResponse) FeatureID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.featureID + } + return "" +} + +// GetFeatureID returns the value of the 'feature_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the feature id which can be toggled +func (o *FeatureReviewResponse) GetFeatureID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.featureID + } + return +} + +// FeatureReviewResponseListKind is the name of the type used to represent list of objects of +// type 'feature_review_response'. +const FeatureReviewResponseListKind = "FeatureReviewResponseList" + +// FeatureReviewResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'feature_review_response'. +const FeatureReviewResponseListLinkKind = "FeatureReviewResponseListLink" + +// FeatureReviewResponseNilKind is the name of the type used to nil lists of objects of +// type 'feature_review_response'. +const FeatureReviewResponseListNilKind = "FeatureReviewResponseListNil" + +// FeatureReviewResponseList is a list of values of the 'feature_review_response' type. +type FeatureReviewResponseList struct { + href string + link bool + items []*FeatureReviewResponse +} + +// Len returns the length of the list. +func (l *FeatureReviewResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *FeatureReviewResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *FeatureReviewResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *FeatureReviewResponseList) SetItems(items []*FeatureReviewResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *FeatureReviewResponseList) Items() []*FeatureReviewResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *FeatureReviewResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *FeatureReviewResponseList) Get(i int) *FeatureReviewResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *FeatureReviewResponseList) Slice() []*FeatureReviewResponse { + var slice []*FeatureReviewResponse + if l == nil { + slice = make([]*FeatureReviewResponse, 0) + } else { + slice = make([]*FeatureReviewResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *FeatureReviewResponseList) Each(f func(item *FeatureReviewResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *FeatureReviewResponseList) Range(f func(index int, item *FeatureReviewResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/feature_review_response_type_json.go b/clientapi/authorizations/v1/feature_review_response_type_json.go new file mode 100644 index 00000000..3520b27d --- /dev/null +++ b/clientapi/authorizations/v1/feature_review_response_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFeatureReviewResponse writes a value of the 'feature_review_response' type to the given writer. +func MarshalFeatureReviewResponse(object *FeatureReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFeatureReviewResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFeatureReviewResponse writes a value of the 'feature_review_response' type to the given stream. +func WriteFeatureReviewResponse(object *FeatureReviewResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("feature_id") + stream.WriteString(object.featureID) + } + stream.WriteObjectEnd() +} + +// UnmarshalFeatureReviewResponse reads a value of the 'feature_review_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalFeatureReviewResponse(source interface{}) (object *FeatureReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadFeatureReviewResponse(iterator) + err = iterator.Error + return +} + +// ReadFeatureReviewResponse reads a value of the 'feature_review_response' type from the given iterator. +func ReadFeatureReviewResponse(iterator *jsoniter.Iterator) *FeatureReviewResponse { + object := &FeatureReviewResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + case "feature_id": + value := iterator.ReadString() + object.featureID = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/float_list_type_json.go b/clientapi/authorizations/v1/float_list_type_json.go new file mode 100644 index 00000000..871dc246 --- /dev/null +++ b/clientapi/authorizations/v1/float_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFloatList writes a list of values of the 'float' type to +// the given writer. +func MarshalFloatList(list []float64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFloatList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFloatList writes a list of value of the 'float' type to +// the given stream. +func WriteFloatList(list []float64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteFloat64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalFloatList reads a list of values of the 'float' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFloatList(source interface{}) (items []float64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFloatList(iterator) + err = iterator.Error + return +} + +// ReadFloatList reads list of values of the ”float' type from +// the given iterator. +func ReadFloatList(iterator *jsoniter.Iterator) []float64 { + list := []float64{} + for iterator.ReadArray() { + item := iterator.ReadFloat64() + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/integer_list_type_json.go b/clientapi/authorizations/v1/integer_list_type_json.go new file mode 100644 index 00000000..d6a939c4 --- /dev/null +++ b/clientapi/authorizations/v1/integer_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIntegerList writes a list of values of the 'integer' type to +// the given writer. +func MarshalIntegerList(list []int, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIntegerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIntegerList writes a list of value of the 'integer' type to +// the given stream. +func WriteIntegerList(list []int, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalIntegerList reads a list of values of the 'integer' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIntegerList(source interface{}) (items []int, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIntegerList(iterator) + err = iterator.Error + return +} + +// ReadIntegerList reads list of values of the ”integer' type from +// the given iterator. +func ReadIntegerList(iterator *jsoniter.Iterator) []int { + list := []int{} + for iterator.ReadArray() { + item := iterator.ReadInt() + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/interface_list_type_json.go b/clientapi/authorizations/v1/interface_list_type_json.go new file mode 100644 index 00000000..dbae59c1 --- /dev/null +++ b/clientapi/authorizations/v1/interface_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInterfaceList writes a list of values of the 'interface' type to +// the given writer. +func MarshalInterfaceList(list []interface{}, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInterfaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInterfaceList writes a list of value of the 'interface' type to +// the given stream. +func WriteInterfaceList(list []interface{}, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteVal(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalInterfaceList reads a list of values of the 'interface' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInterfaceList(source interface{}) (items []interface{}, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInterfaceList(iterator) + err = iterator.Error + return +} + +// ReadInterfaceList reads list of values of the ”interface' type from +// the given iterator. +func ReadInterfaceList(iterator *jsoniter.Iterator) []interface{} { + list := []interface{}{} + for iterator.ReadArray() { + var item interface{} + iterator.ReadVal(&item) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/long_list_type_json.go b/clientapi/authorizations/v1/long_list_type_json.go new file mode 100644 index 00000000..780957e8 --- /dev/null +++ b/clientapi/authorizations/v1/long_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLongList writes a list of values of the 'long' type to +// the given writer. +func MarshalLongList(list []int64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLongList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLongList writes a list of value of the 'long' type to +// the given stream. +func WriteLongList(list []int64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalLongList reads a list of values of the 'long' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLongList(source interface{}) (items []int64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLongList(iterator) + err = iterator.Error + return +} + +// ReadLongList reads list of values of the ”long' type from +// the given iterator. +func ReadLongList(iterator *jsoniter.Iterator) []int64 { + list := []int64{} + for iterator.ReadArray() { + item := iterator.ReadInt64() + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/metadata_reader.go b/clientapi/authorizations/v1/metadata_reader.go new file mode 100644 index 00000000..62f37867 --- /dev/null +++ b/clientapi/authorizations/v1/metadata_reader.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMetadata writes a value of the metadata type to the given target, which +// can be a writer or a JSON encoder. +func MarshalMetadata(object *Metadata, writer io.Writer) error { + stream := helpers.NewStream(writer) + writeMetadata(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} +func writeMetadata(object *Metadata, stream *jsoniter.Stream) { + stream.WriteObjectStart() + if object.bitmap_&1 != 0 { + stream.WriteObjectField("server_version") + stream.WriteString(object.serverVersion) + } + stream.WriteObjectEnd() +} + +// UnmarshalMetadata reads a value of the metadata type from the given source, which +// which can be a reader, a slice of byte or a string. +func UnmarshalMetadata(source interface{}) (object *Metadata, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = readMetadata(iterator) + err = iterator.Error + return +} +func readMetadata(iterator *jsoniter.Iterator) *Metadata { + object := &Metadata{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "server_version": + object.serverVersion = iterator.ReadString() + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/metadata_type.go b/clientapi/authorizations/v1/metadata_type.go new file mode 100644 index 00000000..b2804ecd --- /dev/null +++ b/clientapi/authorizations/v1/metadata_type.go @@ -0,0 +1,44 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// Metadata contains the version metadata. +type Metadata struct { + bitmap_ uint32 + serverVersion string +} + +// ServerVersion returns the version of the server. +func (m *Metadata) ServerVersion() string { + if m != nil && m.bitmap_&1 != 0 { + return m.serverVersion + } + return "" +} + +// GetServerVersion returns the value of the server version and a flag indicating if +// the attribute has a value. +func (m *Metadata) GetServerVersion() (value string, ok bool) { + ok = m != nil && m.bitmap_&1 != 0 + if ok { + value = m.serverVersion + } + return +} diff --git a/clientapi/authorizations/v1/resource_review_builder.go b/clientapi/authorizations/v1/resource_review_builder.go new file mode 100644 index 00000000..eddc3c1c --- /dev/null +++ b/clientapi/authorizations/v1/resource_review_builder.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// ResourceReviewBuilder contains the data and logic needed to build 'resource_review' objects. +// +// Contains the result of performing a resource access review. +type ResourceReviewBuilder struct { + bitmap_ uint32 + accountUsername string + action string + clusterIDs []string + clusterUUIDs []string + organizationIDs []string + resourceType string + subscriptionIDs []string +} + +// NewResourceReview creates a new builder of 'resource_review' objects. +func NewResourceReview() *ResourceReviewBuilder { + return &ResourceReviewBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ResourceReviewBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AccountUsername sets the value of the 'account_username' attribute to the given value. +func (b *ResourceReviewBuilder) AccountUsername(value string) *ResourceReviewBuilder { + b.accountUsername = value + b.bitmap_ |= 1 + return b +} + +// Action sets the value of the 'action' attribute to the given value. +func (b *ResourceReviewBuilder) Action(value string) *ResourceReviewBuilder { + b.action = value + b.bitmap_ |= 2 + return b +} + +// ClusterIDs sets the value of the 'cluster_IDs' attribute to the given values. +func (b *ResourceReviewBuilder) ClusterIDs(values ...string) *ResourceReviewBuilder { + b.clusterIDs = make([]string, len(values)) + copy(b.clusterIDs, values) + b.bitmap_ |= 4 + return b +} + +// ClusterUUIDs sets the value of the 'cluster_UUIDs' attribute to the given values. +func (b *ResourceReviewBuilder) ClusterUUIDs(values ...string) *ResourceReviewBuilder { + b.clusterUUIDs = make([]string, len(values)) + copy(b.clusterUUIDs, values) + b.bitmap_ |= 8 + return b +} + +// OrganizationIDs sets the value of the 'organization_IDs' attribute to the given values. +func (b *ResourceReviewBuilder) OrganizationIDs(values ...string) *ResourceReviewBuilder { + b.organizationIDs = make([]string, len(values)) + copy(b.organizationIDs, values) + b.bitmap_ |= 16 + return b +} + +// ResourceType sets the value of the 'resource_type' attribute to the given value. +func (b *ResourceReviewBuilder) ResourceType(value string) *ResourceReviewBuilder { + b.resourceType = value + b.bitmap_ |= 32 + return b +} + +// SubscriptionIDs sets the value of the 'subscription_IDs' attribute to the given values. +func (b *ResourceReviewBuilder) SubscriptionIDs(values ...string) *ResourceReviewBuilder { + b.subscriptionIDs = make([]string, len(values)) + copy(b.subscriptionIDs, values) + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ResourceReviewBuilder) Copy(object *ResourceReview) *ResourceReviewBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.accountUsername = object.accountUsername + b.action = object.action + if object.clusterIDs != nil { + b.clusterIDs = make([]string, len(object.clusterIDs)) + copy(b.clusterIDs, object.clusterIDs) + } else { + b.clusterIDs = nil + } + if object.clusterUUIDs != nil { + b.clusterUUIDs = make([]string, len(object.clusterUUIDs)) + copy(b.clusterUUIDs, object.clusterUUIDs) + } else { + b.clusterUUIDs = nil + } + if object.organizationIDs != nil { + b.organizationIDs = make([]string, len(object.organizationIDs)) + copy(b.organizationIDs, object.organizationIDs) + } else { + b.organizationIDs = nil + } + b.resourceType = object.resourceType + if object.subscriptionIDs != nil { + b.subscriptionIDs = make([]string, len(object.subscriptionIDs)) + copy(b.subscriptionIDs, object.subscriptionIDs) + } else { + b.subscriptionIDs = nil + } + return b +} + +// Build creates a 'resource_review' object using the configuration stored in the builder. +func (b *ResourceReviewBuilder) Build() (object *ResourceReview, err error) { + object = new(ResourceReview) + object.bitmap_ = b.bitmap_ + object.accountUsername = b.accountUsername + object.action = b.action + if b.clusterIDs != nil { + object.clusterIDs = make([]string, len(b.clusterIDs)) + copy(object.clusterIDs, b.clusterIDs) + } + if b.clusterUUIDs != nil { + object.clusterUUIDs = make([]string, len(b.clusterUUIDs)) + copy(object.clusterUUIDs, b.clusterUUIDs) + } + if b.organizationIDs != nil { + object.organizationIDs = make([]string, len(b.organizationIDs)) + copy(object.organizationIDs, b.organizationIDs) + } + object.resourceType = b.resourceType + if b.subscriptionIDs != nil { + object.subscriptionIDs = make([]string, len(b.subscriptionIDs)) + copy(object.subscriptionIDs, b.subscriptionIDs) + } + return +} diff --git a/clientapi/authorizations/v1/resource_review_list_builder.go b/clientapi/authorizations/v1/resource_review_list_builder.go new file mode 100644 index 00000000..ce88decc --- /dev/null +++ b/clientapi/authorizations/v1/resource_review_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// ResourceReviewListBuilder contains the data and logic needed to build +// 'resource_review' objects. +type ResourceReviewListBuilder struct { + items []*ResourceReviewBuilder +} + +// NewResourceReviewList creates a new builder of 'resource_review' objects. +func NewResourceReviewList() *ResourceReviewListBuilder { + return new(ResourceReviewListBuilder) +} + +// Items sets the items of the list. +func (b *ResourceReviewListBuilder) Items(values ...*ResourceReviewBuilder) *ResourceReviewListBuilder { + b.items = make([]*ResourceReviewBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ResourceReviewListBuilder) 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 *ResourceReviewListBuilder) Copy(list *ResourceReviewList) *ResourceReviewListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ResourceReviewBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewResourceReview().Copy(v) + } + } + return b +} + +// Build creates a list of 'resource_review' objects using the +// configuration stored in the builder. +func (b *ResourceReviewListBuilder) Build() (list *ResourceReviewList, err error) { + items := make([]*ResourceReview, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ResourceReviewList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/resource_review_list_type_json.go b/clientapi/authorizations/v1/resource_review_list_type_json.go new file mode 100644 index 00000000..b7346d46 --- /dev/null +++ b/clientapi/authorizations/v1/resource_review_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalResourceReviewList writes a list of values of the 'resource_review' type to +// the given writer. +func MarshalResourceReviewList(list []*ResourceReview, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteResourceReviewList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteResourceReviewList writes a list of value of the 'resource_review' type to +// the given stream. +func WriteResourceReviewList(list []*ResourceReview, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteResourceReview(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalResourceReviewList reads a list of values of the 'resource_review' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalResourceReviewList(source interface{}) (items []*ResourceReview, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadResourceReviewList(iterator) + err = iterator.Error + return +} + +// ReadResourceReviewList reads list of values of the ”resource_review' type from +// the given iterator. +func ReadResourceReviewList(iterator *jsoniter.Iterator) []*ResourceReview { + list := []*ResourceReview{} + for iterator.ReadArray() { + item := ReadResourceReview(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/resource_review_request_builder.go b/clientapi/authorizations/v1/resource_review_request_builder.go new file mode 100644 index 00000000..d4d3e69c --- /dev/null +++ b/clientapi/authorizations/v1/resource_review_request_builder.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// ResourceReviewRequestBuilder contains the data and logic needed to build 'resource_review_request' objects. +// +// Request to perform a resource access review. +type ResourceReviewRequestBuilder struct { + bitmap_ uint32 + accountUsername string + action string + excludeSubscriptionStatuses []SubscriptionStatus + resourceType string + reduceClusterList bool +} + +// NewResourceReviewRequest creates a new builder of 'resource_review_request' objects. +func NewResourceReviewRequest() *ResourceReviewRequestBuilder { + return &ResourceReviewRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ResourceReviewRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AccountUsername sets the value of the 'account_username' attribute to the given value. +func (b *ResourceReviewRequestBuilder) AccountUsername(value string) *ResourceReviewRequestBuilder { + b.accountUsername = value + b.bitmap_ |= 1 + return b +} + +// Action sets the value of the 'action' attribute to the given value. +func (b *ResourceReviewRequestBuilder) Action(value string) *ResourceReviewRequestBuilder { + b.action = value + b.bitmap_ |= 2 + return b +} + +// ExcludeSubscriptionStatuses sets the value of the 'exclude_subscription_statuses' attribute to the given values. +func (b *ResourceReviewRequestBuilder) ExcludeSubscriptionStatuses(values ...SubscriptionStatus) *ResourceReviewRequestBuilder { + b.excludeSubscriptionStatuses = make([]SubscriptionStatus, len(values)) + copy(b.excludeSubscriptionStatuses, values) + b.bitmap_ |= 4 + return b +} + +// ReduceClusterList sets the value of the 'reduce_cluster_list' attribute to the given value. +func (b *ResourceReviewRequestBuilder) ReduceClusterList(value bool) *ResourceReviewRequestBuilder { + b.reduceClusterList = value + b.bitmap_ |= 8 + return b +} + +// ResourceType sets the value of the 'resource_type' attribute to the given value. +func (b *ResourceReviewRequestBuilder) ResourceType(value string) *ResourceReviewRequestBuilder { + b.resourceType = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ResourceReviewRequestBuilder) Copy(object *ResourceReviewRequest) *ResourceReviewRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.accountUsername = object.accountUsername + b.action = object.action + if object.excludeSubscriptionStatuses != nil { + b.excludeSubscriptionStatuses = make([]SubscriptionStatus, len(object.excludeSubscriptionStatuses)) + copy(b.excludeSubscriptionStatuses, object.excludeSubscriptionStatuses) + } else { + b.excludeSubscriptionStatuses = nil + } + b.reduceClusterList = object.reduceClusterList + b.resourceType = object.resourceType + return b +} + +// Build creates a 'resource_review_request' object using the configuration stored in the builder. +func (b *ResourceReviewRequestBuilder) Build() (object *ResourceReviewRequest, err error) { + object = new(ResourceReviewRequest) + object.bitmap_ = b.bitmap_ + object.accountUsername = b.accountUsername + object.action = b.action + if b.excludeSubscriptionStatuses != nil { + object.excludeSubscriptionStatuses = make([]SubscriptionStatus, len(b.excludeSubscriptionStatuses)) + copy(object.excludeSubscriptionStatuses, b.excludeSubscriptionStatuses) + } + object.reduceClusterList = b.reduceClusterList + object.resourceType = b.resourceType + return +} diff --git a/clientapi/authorizations/v1/resource_review_request_list_builder.go b/clientapi/authorizations/v1/resource_review_request_list_builder.go new file mode 100644 index 00000000..aead3a08 --- /dev/null +++ b/clientapi/authorizations/v1/resource_review_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// ResourceReviewRequestListBuilder contains the data and logic needed to build +// 'resource_review_request' objects. +type ResourceReviewRequestListBuilder struct { + items []*ResourceReviewRequestBuilder +} + +// NewResourceReviewRequestList creates a new builder of 'resource_review_request' objects. +func NewResourceReviewRequestList() *ResourceReviewRequestListBuilder { + return new(ResourceReviewRequestListBuilder) +} + +// Items sets the items of the list. +func (b *ResourceReviewRequestListBuilder) Items(values ...*ResourceReviewRequestBuilder) *ResourceReviewRequestListBuilder { + b.items = make([]*ResourceReviewRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ResourceReviewRequestListBuilder) 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 *ResourceReviewRequestListBuilder) Copy(list *ResourceReviewRequestList) *ResourceReviewRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ResourceReviewRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewResourceReviewRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'resource_review_request' objects using the +// configuration stored in the builder. +func (b *ResourceReviewRequestListBuilder) Build() (list *ResourceReviewRequestList, err error) { + items := make([]*ResourceReviewRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ResourceReviewRequestList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/resource_review_request_list_type_json.go b/clientapi/authorizations/v1/resource_review_request_list_type_json.go new file mode 100644 index 00000000..0428a8c9 --- /dev/null +++ b/clientapi/authorizations/v1/resource_review_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalResourceReviewRequestList writes a list of values of the 'resource_review_request' type to +// the given writer. +func MarshalResourceReviewRequestList(list []*ResourceReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteResourceReviewRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteResourceReviewRequestList writes a list of value of the 'resource_review_request' type to +// the given stream. +func WriteResourceReviewRequestList(list []*ResourceReviewRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteResourceReviewRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalResourceReviewRequestList reads a list of values of the 'resource_review_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalResourceReviewRequestList(source interface{}) (items []*ResourceReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadResourceReviewRequestList(iterator) + err = iterator.Error + return +} + +// ReadResourceReviewRequestList reads list of values of the ”resource_review_request' type from +// the given iterator. +func ReadResourceReviewRequestList(iterator *jsoniter.Iterator) []*ResourceReviewRequest { + list := []*ResourceReviewRequest{} + for iterator.ReadArray() { + item := ReadResourceReviewRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/resource_review_request_type.go b/clientapi/authorizations/v1/resource_review_request_type.go new file mode 100644 index 00000000..ae233eb9 --- /dev/null +++ b/clientapi/authorizations/v1/resource_review_request_type.go @@ -0,0 +1,263 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// ResourceReviewRequest represents the values of the 'resource_review_request' type. +// +// Request to perform a resource access review. +type ResourceReviewRequest struct { + bitmap_ uint32 + accountUsername string + action string + excludeSubscriptionStatuses []SubscriptionStatus + resourceType string + reduceClusterList bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ResourceReviewRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AccountUsername returns the value of the 'account_username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the account that is trying to access the resource. +func (o *ResourceReviewRequest) AccountUsername() string { + if o != nil && o.bitmap_&1 != 0 { + return o.accountUsername + } + return "" +} + +// GetAccountUsername returns the value of the 'account_username' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the account that is trying to access the resource. +func (o *ResourceReviewRequest) GetAccountUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.accountUsername + } + return +} + +// Action returns the value of the 'action' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Action that will be performed on the resource. +func (o *ResourceReviewRequest) Action() string { + if o != nil && o.bitmap_&2 != 0 { + return o.action + } + return "" +} + +// GetAction returns the value of the 'action' attribute and +// a flag indicating if the attribute has a value. +// +// Action that will be performed on the resource. +func (o *ResourceReviewRequest) GetAction() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.action + } + return +} + +// ExcludeSubscriptionStatuses returns the value of the 'exclude_subscription_statuses' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Subscriptions with these statuses will be excluded from results. +func (o *ResourceReviewRequest) ExcludeSubscriptionStatuses() []SubscriptionStatus { + if o != nil && o.bitmap_&4 != 0 { + return o.excludeSubscriptionStatuses + } + return nil +} + +// GetExcludeSubscriptionStatuses returns the value of the 'exclude_subscription_statuses' attribute and +// a flag indicating if the attribute has a value. +// +// Subscriptions with these statuses will be excluded from results. +func (o *ResourceReviewRequest) GetExcludeSubscriptionStatuses() (value []SubscriptionStatus, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.excludeSubscriptionStatuses + } + return +} + +// ReduceClusterList returns the value of the 'reduce_cluster_list' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// If true, in the case when all subscriptions in organization are permitted, response will *not* include +// these subscriptions' ID, but organization only. +func (o *ResourceReviewRequest) ReduceClusterList() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.reduceClusterList + } + return false +} + +// GetReduceClusterList returns the value of the 'reduce_cluster_list' attribute and +// a flag indicating if the attribute has a value. +// +// If true, in the case when all subscriptions in organization are permitted, response will *not* include +// these subscriptions' ID, but organization only. +func (o *ResourceReviewRequest) GetReduceClusterList() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.reduceClusterList + } + return +} + +// ResourceType returns the value of the 'resource_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of resource. +func (o *ResourceReviewRequest) ResourceType() string { + if o != nil && o.bitmap_&16 != 0 { + return o.resourceType + } + return "" +} + +// GetResourceType returns the value of the 'resource_type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of resource. +func (o *ResourceReviewRequest) GetResourceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.resourceType + } + return +} + +// ResourceReviewRequestListKind is the name of the type used to represent list of objects of +// type 'resource_review_request'. +const ResourceReviewRequestListKind = "ResourceReviewRequestList" + +// ResourceReviewRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'resource_review_request'. +const ResourceReviewRequestListLinkKind = "ResourceReviewRequestListLink" + +// ResourceReviewRequestNilKind is the name of the type used to nil lists of objects of +// type 'resource_review_request'. +const ResourceReviewRequestListNilKind = "ResourceReviewRequestListNil" + +// ResourceReviewRequestList is a list of values of the 'resource_review_request' type. +type ResourceReviewRequestList struct { + href string + link bool + items []*ResourceReviewRequest +} + +// Len returns the length of the list. +func (l *ResourceReviewRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ResourceReviewRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ResourceReviewRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ResourceReviewRequestList) SetItems(items []*ResourceReviewRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *ResourceReviewRequestList) Items() []*ResourceReviewRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ResourceReviewRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ResourceReviewRequestList) Get(i int) *ResourceReviewRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ResourceReviewRequestList) Slice() []*ResourceReviewRequest { + var slice []*ResourceReviewRequest + if l == nil { + slice = make([]*ResourceReviewRequest, 0) + } else { + slice = make([]*ResourceReviewRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ResourceReviewRequestList) Each(f func(item *ResourceReviewRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ResourceReviewRequestList) Range(f func(index int, item *ResourceReviewRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/resource_review_request_type_json.go b/clientapi/authorizations/v1/resource_review_request_type_json.go new file mode 100644 index 00000000..74796fe5 --- /dev/null +++ b/clientapi/authorizations/v1/resource_review_request_type_json.go @@ -0,0 +1,138 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalResourceReviewRequest writes a value of the 'resource_review_request' type to the given writer. +func MarshalResourceReviewRequest(object *ResourceReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteResourceReviewRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteResourceReviewRequest writes a value of the 'resource_review_request' type to the given stream. +func WriteResourceReviewRequest(object *ResourceReviewRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_username") + stream.WriteString(object.accountUsername) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("action") + stream.WriteString(object.action) + count++ + } + present_ = object.bitmap_&4 != 0 && object.excludeSubscriptionStatuses != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("exclude_subscription_statuses") + WriteSubscriptionStatusList(object.excludeSubscriptionStatuses, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("reduce_cluster_list") + stream.WriteBool(object.reduceClusterList) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_type") + stream.WriteString(object.resourceType) + } + stream.WriteObjectEnd() +} + +// UnmarshalResourceReviewRequest reads a value of the 'resource_review_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalResourceReviewRequest(source interface{}) (object *ResourceReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadResourceReviewRequest(iterator) + err = iterator.Error + return +} + +// ReadResourceReviewRequest reads a value of the 'resource_review_request' type from the given iterator. +func ReadResourceReviewRequest(iterator *jsoniter.Iterator) *ResourceReviewRequest { + object := &ResourceReviewRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "account_username": + value := iterator.ReadString() + object.accountUsername = value + object.bitmap_ |= 1 + case "action": + value := iterator.ReadString() + object.action = value + object.bitmap_ |= 2 + case "exclude_subscription_statuses": + value := ReadSubscriptionStatusList(iterator) + object.excludeSubscriptionStatuses = value + object.bitmap_ |= 4 + case "reduce_cluster_list": + value := iterator.ReadBool() + object.reduceClusterList = value + object.bitmap_ |= 8 + case "resource_type": + value := iterator.ReadString() + object.resourceType = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/resource_review_type.go b/clientapi/authorizations/v1/resource_review_type.go new file mode 100644 index 00000000..5c039c19 --- /dev/null +++ b/clientapi/authorizations/v1/resource_review_type.go @@ -0,0 +1,311 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// ResourceReview represents the values of the 'resource_review' type. +// +// Contains the result of performing a resource access review. +type ResourceReview struct { + bitmap_ uint32 + accountUsername string + action string + clusterIDs []string + clusterUUIDs []string + organizationIDs []string + resourceType string + subscriptionIDs []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ResourceReview) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AccountUsername returns the value of the 'account_username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the account that is trying to perform the access. +func (o *ResourceReview) AccountUsername() string { + if o != nil && o.bitmap_&1 != 0 { + return o.accountUsername + } + return "" +} + +// GetAccountUsername returns the value of the 'account_username' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the account that is trying to perform the access. +func (o *ResourceReview) GetAccountUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.accountUsername + } + return +} + +// Action returns the value of the 'action' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Action that will the user is trying to perform. +func (o *ResourceReview) Action() string { + if o != nil && o.bitmap_&2 != 0 { + return o.action + } + return "" +} + +// GetAction returns the value of the 'action' attribute and +// a flag indicating if the attribute has a value. +// +// Action that will the user is trying to perform. +func (o *ResourceReview) GetAction() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.action + } + return +} + +// ClusterIDs returns the value of the 'cluster_IDs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Identifiers of the Clusters (internal ids) that the user has permission to perform the action upon. +func (o *ResourceReview) ClusterIDs() []string { + if o != nil && o.bitmap_&4 != 0 { + return o.clusterIDs + } + return nil +} + +// GetClusterIDs returns the value of the 'cluster_IDs' attribute and +// a flag indicating if the attribute has a value. +// +// Identifiers of the Clusters (internal ids) that the user has permission to perform the action upon. +func (o *ResourceReview) GetClusterIDs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.clusterIDs + } + return +} + +// ClusterUUIDs returns the value of the 'cluster_UUIDs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Identifiers which Clusters (external ids) that the user has permission to perform the action upon. +func (o *ResourceReview) ClusterUUIDs() []string { + if o != nil && o.bitmap_&8 != 0 { + return o.clusterUUIDs + } + return nil +} + +// GetClusterUUIDs returns the value of the 'cluster_UUIDs' attribute and +// a flag indicating if the attribute has a value. +// +// Identifiers which Clusters (external ids) that the user has permission to perform the action upon. +func (o *ResourceReview) GetClusterUUIDs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clusterUUIDs + } + return +} + +// OrganizationIDs returns the value of the 'organization_IDs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Identifiers of the organizations that the user has permissions to perform the action +// upon. +func (o *ResourceReview) OrganizationIDs() []string { + if o != nil && o.bitmap_&16 != 0 { + return o.organizationIDs + } + return nil +} + +// GetOrganizationIDs returns the value of the 'organization_IDs' attribute and +// a flag indicating if the attribute has a value. +// +// Identifiers of the organizations that the user has permissions to perform the action +// upon. +func (o *ResourceReview) GetOrganizationIDs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.organizationIDs + } + return +} + +// ResourceType returns the value of the 'resource_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of resource. +func (o *ResourceReview) ResourceType() string { + if o != nil && o.bitmap_&32 != 0 { + return o.resourceType + } + return "" +} + +// GetResourceType returns the value of the 'resource_type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of resource. +func (o *ResourceReview) GetResourceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.resourceType + } + return +} + +// SubscriptionIDs returns the value of the 'subscription_IDs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Identifiers of the subscriptions that the user has permission to perform the action upon. +func (o *ResourceReview) SubscriptionIDs() []string { + if o != nil && o.bitmap_&64 != 0 { + return o.subscriptionIDs + } + return nil +} + +// GetSubscriptionIDs returns the value of the 'subscription_IDs' attribute and +// a flag indicating if the attribute has a value. +// +// Identifiers of the subscriptions that the user has permission to perform the action upon. +func (o *ResourceReview) GetSubscriptionIDs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.subscriptionIDs + } + return +} + +// ResourceReviewListKind is the name of the type used to represent list of objects of +// type 'resource_review'. +const ResourceReviewListKind = "ResourceReviewList" + +// ResourceReviewListLinkKind is the name of the type used to represent links to list +// of objects of type 'resource_review'. +const ResourceReviewListLinkKind = "ResourceReviewListLink" + +// ResourceReviewNilKind is the name of the type used to nil lists of objects of +// type 'resource_review'. +const ResourceReviewListNilKind = "ResourceReviewListNil" + +// ResourceReviewList is a list of values of the 'resource_review' type. +type ResourceReviewList struct { + href string + link bool + items []*ResourceReview +} + +// Len returns the length of the list. +func (l *ResourceReviewList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ResourceReviewList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ResourceReviewList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ResourceReviewList) SetItems(items []*ResourceReview) { + l.items = items +} + +// Items returns the items of the list. +func (l *ResourceReviewList) Items() []*ResourceReview { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ResourceReviewList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ResourceReviewList) Get(i int) *ResourceReview { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ResourceReviewList) Slice() []*ResourceReview { + var slice []*ResourceReview + if l == nil { + slice = make([]*ResourceReview, 0) + } else { + slice = make([]*ResourceReview, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ResourceReviewList) Each(f func(item *ResourceReview) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ResourceReviewList) Range(f func(index int, item *ResourceReview) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/resource_review_type_json.go b/clientapi/authorizations/v1/resource_review_type_json.go new file mode 100644 index 00000000..7a0eb79a --- /dev/null +++ b/clientapi/authorizations/v1/resource_review_type_json.go @@ -0,0 +1,164 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalResourceReview writes a value of the 'resource_review' type to the given writer. +func MarshalResourceReview(object *ResourceReview, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteResourceReview(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteResourceReview writes a value of the 'resource_review' type to the given stream. +func WriteResourceReview(object *ResourceReview, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_username") + stream.WriteString(object.accountUsername) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("action") + stream.WriteString(object.action) + count++ + } + present_ = object.bitmap_&4 != 0 && object.clusterIDs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_ids") + WriteStringList(object.clusterIDs, stream) + count++ + } + present_ = object.bitmap_&8 != 0 && object.clusterUUIDs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_uuids") + WriteStringList(object.clusterUUIDs, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.organizationIDs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_ids") + WriteStringList(object.organizationIDs, stream) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_type") + stream.WriteString(object.resourceType) + count++ + } + present_ = object.bitmap_&64 != 0 && object.subscriptionIDs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_ids") + WriteStringList(object.subscriptionIDs, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalResourceReview reads a value of the 'resource_review' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalResourceReview(source interface{}) (object *ResourceReview, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadResourceReview(iterator) + err = iterator.Error + return +} + +// ReadResourceReview reads a value of the 'resource_review' type from the given iterator. +func ReadResourceReview(iterator *jsoniter.Iterator) *ResourceReview { + object := &ResourceReview{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "account_username": + value := iterator.ReadString() + object.accountUsername = value + object.bitmap_ |= 1 + case "action": + value := iterator.ReadString() + object.action = value + object.bitmap_ |= 2 + case "cluster_ids": + value := ReadStringList(iterator) + object.clusterIDs = value + object.bitmap_ |= 4 + case "cluster_uuids": + value := ReadStringList(iterator) + object.clusterUUIDs = value + object.bitmap_ |= 8 + case "organization_ids": + value := ReadStringList(iterator) + object.organizationIDs = value + object.bitmap_ |= 16 + case "resource_type": + value := iterator.ReadString() + object.resourceType = value + object.bitmap_ |= 32 + case "subscription_ids": + value := ReadStringList(iterator) + object.subscriptionIDs = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/self_access_review_request_builder.go b/clientapi/authorizations/v1/self_access_review_request_builder.go new file mode 100644 index 00000000..2978c507 --- /dev/null +++ b/clientapi/authorizations/v1/self_access_review_request_builder.go @@ -0,0 +1,113 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfAccessReviewRequestBuilder contains the data and logic needed to build 'self_access_review_request' objects. +// +// Representation of an access review performed against oneself +type SelfAccessReviewRequestBuilder struct { + bitmap_ uint32 + action string + clusterID string + clusterUUID string + organizationID string + resourceType string + subscriptionID string +} + +// NewSelfAccessReviewRequest creates a new builder of 'self_access_review_request' objects. +func NewSelfAccessReviewRequest() *SelfAccessReviewRequestBuilder { + return &SelfAccessReviewRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SelfAccessReviewRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Action sets the value of the 'action' attribute to the given value. +func (b *SelfAccessReviewRequestBuilder) Action(value string) *SelfAccessReviewRequestBuilder { + b.action = value + b.bitmap_ |= 1 + return b +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *SelfAccessReviewRequestBuilder) ClusterID(value string) *SelfAccessReviewRequestBuilder { + b.clusterID = value + b.bitmap_ |= 2 + return b +} + +// ClusterUUID sets the value of the 'cluster_UUID' attribute to the given value. +func (b *SelfAccessReviewRequestBuilder) ClusterUUID(value string) *SelfAccessReviewRequestBuilder { + b.clusterUUID = value + b.bitmap_ |= 4 + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *SelfAccessReviewRequestBuilder) OrganizationID(value string) *SelfAccessReviewRequestBuilder { + b.organizationID = value + b.bitmap_ |= 8 + return b +} + +// ResourceType sets the value of the 'resource_type' attribute to the given value. +func (b *SelfAccessReviewRequestBuilder) ResourceType(value string) *SelfAccessReviewRequestBuilder { + b.resourceType = value + b.bitmap_ |= 16 + return b +} + +// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value. +func (b *SelfAccessReviewRequestBuilder) SubscriptionID(value string) *SelfAccessReviewRequestBuilder { + b.subscriptionID = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SelfAccessReviewRequestBuilder) Copy(object *SelfAccessReviewRequest) *SelfAccessReviewRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.action = object.action + b.clusterID = object.clusterID + b.clusterUUID = object.clusterUUID + b.organizationID = object.organizationID + b.resourceType = object.resourceType + b.subscriptionID = object.subscriptionID + return b +} + +// Build creates a 'self_access_review_request' object using the configuration stored in the builder. +func (b *SelfAccessReviewRequestBuilder) Build() (object *SelfAccessReviewRequest, err error) { + object = new(SelfAccessReviewRequest) + object.bitmap_ = b.bitmap_ + object.action = b.action + object.clusterID = b.clusterID + object.clusterUUID = b.clusterUUID + object.organizationID = b.organizationID + object.resourceType = b.resourceType + object.subscriptionID = b.subscriptionID + return +} diff --git a/clientapi/authorizations/v1/self_access_review_request_list_builder.go b/clientapi/authorizations/v1/self_access_review_request_list_builder.go new file mode 100644 index 00000000..116d2314 --- /dev/null +++ b/clientapi/authorizations/v1/self_access_review_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfAccessReviewRequestListBuilder contains the data and logic needed to build +// 'self_access_review_request' objects. +type SelfAccessReviewRequestListBuilder struct { + items []*SelfAccessReviewRequestBuilder +} + +// NewSelfAccessReviewRequestList creates a new builder of 'self_access_review_request' objects. +func NewSelfAccessReviewRequestList() *SelfAccessReviewRequestListBuilder { + return new(SelfAccessReviewRequestListBuilder) +} + +// Items sets the items of the list. +func (b *SelfAccessReviewRequestListBuilder) Items(values ...*SelfAccessReviewRequestBuilder) *SelfAccessReviewRequestListBuilder { + b.items = make([]*SelfAccessReviewRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SelfAccessReviewRequestListBuilder) 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 *SelfAccessReviewRequestListBuilder) Copy(list *SelfAccessReviewRequestList) *SelfAccessReviewRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SelfAccessReviewRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSelfAccessReviewRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'self_access_review_request' objects using the +// configuration stored in the builder. +func (b *SelfAccessReviewRequestListBuilder) Build() (list *SelfAccessReviewRequestList, err error) { + items := make([]*SelfAccessReviewRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SelfAccessReviewRequestList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/self_access_review_request_list_type_json.go b/clientapi/authorizations/v1/self_access_review_request_list_type_json.go new file mode 100644 index 00000000..94be7ea8 --- /dev/null +++ b/clientapi/authorizations/v1/self_access_review_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfAccessReviewRequestList writes a list of values of the 'self_access_review_request' type to +// the given writer. +func MarshalSelfAccessReviewRequestList(list []*SelfAccessReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfAccessReviewRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfAccessReviewRequestList writes a list of value of the 'self_access_review_request' type to +// the given stream. +func WriteSelfAccessReviewRequestList(list []*SelfAccessReviewRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSelfAccessReviewRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSelfAccessReviewRequestList reads a list of values of the 'self_access_review_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSelfAccessReviewRequestList(source interface{}) (items []*SelfAccessReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSelfAccessReviewRequestList(iterator) + err = iterator.Error + return +} + +// ReadSelfAccessReviewRequestList reads list of values of the ”self_access_review_request' type from +// the given iterator. +func ReadSelfAccessReviewRequestList(iterator *jsoniter.Iterator) []*SelfAccessReviewRequest { + list := []*SelfAccessReviewRequest{} + for iterator.ReadArray() { + item := ReadSelfAccessReviewRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/self_access_review_request_type.go b/clientapi/authorizations/v1/self_access_review_request_type.go new file mode 100644 index 00000000..d0377f0b --- /dev/null +++ b/clientapi/authorizations/v1/self_access_review_request_type.go @@ -0,0 +1,287 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfAccessReviewRequest represents the values of the 'self_access_review_request' type. +// +// Representation of an access review performed against oneself +type SelfAccessReviewRequest struct { + bitmap_ uint32 + action string + clusterID string + clusterUUID string + organizationID string + resourceType string + subscriptionID string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SelfAccessReviewRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Action returns the value of the 'action' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the action, one of: [get,list,create,delete,update] +func (o *SelfAccessReviewRequest) Action() string { + if o != nil && o.bitmap_&1 != 0 { + return o.action + } + return "" +} + +// GetAction returns the value of the 'action' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the action, one of: [get,list,create,delete,update] +func (o *SelfAccessReviewRequest) GetAction() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.action + } + return +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Cluster (internal id) the resource type belongs to +func (o *SelfAccessReviewRequest) ClusterID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Cluster (internal id) the resource type belongs to +func (o *SelfAccessReviewRequest) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.clusterID + } + return +} + +// ClusterUUID returns the value of the 'cluster_UUID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Cluster (external id) the resource type belongs to +func (o *SelfAccessReviewRequest) ClusterUUID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.clusterUUID + } + return "" +} + +// GetClusterUUID returns the value of the 'cluster_UUID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Cluster (external id) the resource type belongs to +func (o *SelfAccessReviewRequest) GetClusterUUID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.clusterUUID + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Organization the resource type belongs to +func (o *SelfAccessReviewRequest) OrganizationID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Organization the resource type belongs to +func (o *SelfAccessReviewRequest) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.organizationID + } + return +} + +// ResourceType returns the value of the 'resource_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the type of the resource an action would be taken on. +// See uhc-account-manager/openapi/openapi.yaml for a list of possible values +func (o *SelfAccessReviewRequest) ResourceType() string { + if o != nil && o.bitmap_&16 != 0 { + return o.resourceType + } + return "" +} + +// GetResourceType returns the value of the 'resource_type' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the type of the resource an action would be taken on. +// See uhc-account-manager/openapi/openapi.yaml for a list of possible values +func (o *SelfAccessReviewRequest) GetResourceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.resourceType + } + return +} + +// SubscriptionID returns the value of the 'subscription_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Subscription the resource type belongs to +func (o *SelfAccessReviewRequest) SubscriptionID() string { + if o != nil && o.bitmap_&32 != 0 { + return o.subscriptionID + } + return "" +} + +// GetSubscriptionID returns the value of the 'subscription_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Subscription the resource type belongs to +func (o *SelfAccessReviewRequest) GetSubscriptionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.subscriptionID + } + return +} + +// SelfAccessReviewRequestListKind is the name of the type used to represent list of objects of +// type 'self_access_review_request'. +const SelfAccessReviewRequestListKind = "SelfAccessReviewRequestList" + +// SelfAccessReviewRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'self_access_review_request'. +const SelfAccessReviewRequestListLinkKind = "SelfAccessReviewRequestListLink" + +// SelfAccessReviewRequestNilKind is the name of the type used to nil lists of objects of +// type 'self_access_review_request'. +const SelfAccessReviewRequestListNilKind = "SelfAccessReviewRequestListNil" + +// SelfAccessReviewRequestList is a list of values of the 'self_access_review_request' type. +type SelfAccessReviewRequestList struct { + href string + link bool + items []*SelfAccessReviewRequest +} + +// Len returns the length of the list. +func (l *SelfAccessReviewRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SelfAccessReviewRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SelfAccessReviewRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SelfAccessReviewRequestList) SetItems(items []*SelfAccessReviewRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *SelfAccessReviewRequestList) Items() []*SelfAccessReviewRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SelfAccessReviewRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SelfAccessReviewRequestList) Get(i int) *SelfAccessReviewRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SelfAccessReviewRequestList) Slice() []*SelfAccessReviewRequest { + var slice []*SelfAccessReviewRequest + if l == nil { + slice = make([]*SelfAccessReviewRequest, 0) + } else { + slice = make([]*SelfAccessReviewRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SelfAccessReviewRequestList) Each(f func(item *SelfAccessReviewRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SelfAccessReviewRequestList) Range(f func(index int, item *SelfAccessReviewRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/self_access_review_request_type_json.go b/clientapi/authorizations/v1/self_access_review_request_type_json.go new file mode 100644 index 00000000..638e2c04 --- /dev/null +++ b/clientapi/authorizations/v1/self_access_review_request_type_json.go @@ -0,0 +1,151 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfAccessReviewRequest writes a value of the 'self_access_review_request' type to the given writer. +func MarshalSelfAccessReviewRequest(object *SelfAccessReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfAccessReviewRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfAccessReviewRequest writes a value of the 'self_access_review_request' type to the given stream. +func WriteSelfAccessReviewRequest(object *SelfAccessReviewRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("action") + stream.WriteString(object.action) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_uuid") + stream.WriteString(object.clusterUUID) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_type") + stream.WriteString(object.resourceType) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionID) + } + stream.WriteObjectEnd() +} + +// UnmarshalSelfAccessReviewRequest reads a value of the 'self_access_review_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSelfAccessReviewRequest(source interface{}) (object *SelfAccessReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSelfAccessReviewRequest(iterator) + err = iterator.Error + return +} + +// ReadSelfAccessReviewRequest reads a value of the 'self_access_review_request' type from the given iterator. +func ReadSelfAccessReviewRequest(iterator *jsoniter.Iterator) *SelfAccessReviewRequest { + object := &SelfAccessReviewRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "action": + value := iterator.ReadString() + object.action = value + object.bitmap_ |= 1 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 2 + case "cluster_uuid": + value := iterator.ReadString() + object.clusterUUID = value + object.bitmap_ |= 4 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 8 + case "resource_type": + value := iterator.ReadString() + object.resourceType = value + object.bitmap_ |= 16 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionID = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/self_access_review_response_builder.go b/clientapi/authorizations/v1/self_access_review_response_builder.go new file mode 100644 index 00000000..fc304610 --- /dev/null +++ b/clientapi/authorizations/v1/self_access_review_response_builder.go @@ -0,0 +1,143 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfAccessReviewResponseBuilder contains the data and logic needed to build 'self_access_review_response' objects. +// +// Representation of an access review response, performed against oneself +type SelfAccessReviewResponseBuilder struct { + bitmap_ uint32 + action string + clusterID string + clusterUUID string + organizationID string + reason string + resourceType string + subscriptionID string + allowed bool + isOCMInternal bool +} + +// NewSelfAccessReviewResponse creates a new builder of 'self_access_review_response' objects. +func NewSelfAccessReviewResponse() *SelfAccessReviewResponseBuilder { + return &SelfAccessReviewResponseBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SelfAccessReviewResponseBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Action sets the value of the 'action' attribute to the given value. +func (b *SelfAccessReviewResponseBuilder) Action(value string) *SelfAccessReviewResponseBuilder { + b.action = value + b.bitmap_ |= 1 + return b +} + +// Allowed sets the value of the 'allowed' attribute to the given value. +func (b *SelfAccessReviewResponseBuilder) Allowed(value bool) *SelfAccessReviewResponseBuilder { + b.allowed = value + b.bitmap_ |= 2 + return b +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *SelfAccessReviewResponseBuilder) ClusterID(value string) *SelfAccessReviewResponseBuilder { + b.clusterID = value + b.bitmap_ |= 4 + return b +} + +// ClusterUUID sets the value of the 'cluster_UUID' attribute to the given value. +func (b *SelfAccessReviewResponseBuilder) ClusterUUID(value string) *SelfAccessReviewResponseBuilder { + b.clusterUUID = value + b.bitmap_ |= 8 + return b +} + +// IsOCMInternal sets the value of the 'is_OCM_internal' attribute to the given value. +func (b *SelfAccessReviewResponseBuilder) IsOCMInternal(value bool) *SelfAccessReviewResponseBuilder { + b.isOCMInternal = value + b.bitmap_ |= 16 + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *SelfAccessReviewResponseBuilder) OrganizationID(value string) *SelfAccessReviewResponseBuilder { + b.organizationID = value + b.bitmap_ |= 32 + return b +} + +// Reason sets the value of the 'reason' attribute to the given value. +func (b *SelfAccessReviewResponseBuilder) Reason(value string) *SelfAccessReviewResponseBuilder { + b.reason = value + b.bitmap_ |= 64 + return b +} + +// ResourceType sets the value of the 'resource_type' attribute to the given value. +func (b *SelfAccessReviewResponseBuilder) ResourceType(value string) *SelfAccessReviewResponseBuilder { + b.resourceType = value + b.bitmap_ |= 128 + return b +} + +// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value. +func (b *SelfAccessReviewResponseBuilder) SubscriptionID(value string) *SelfAccessReviewResponseBuilder { + b.subscriptionID = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SelfAccessReviewResponseBuilder) Copy(object *SelfAccessReviewResponse) *SelfAccessReviewResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.action = object.action + b.allowed = object.allowed + b.clusterID = object.clusterID + b.clusterUUID = object.clusterUUID + b.isOCMInternal = object.isOCMInternal + b.organizationID = object.organizationID + b.reason = object.reason + b.resourceType = object.resourceType + b.subscriptionID = object.subscriptionID + return b +} + +// Build creates a 'self_access_review_response' object using the configuration stored in the builder. +func (b *SelfAccessReviewResponseBuilder) Build() (object *SelfAccessReviewResponse, err error) { + object = new(SelfAccessReviewResponse) + object.bitmap_ = b.bitmap_ + object.action = b.action + object.allowed = b.allowed + object.clusterID = b.clusterID + object.clusterUUID = b.clusterUUID + object.isOCMInternal = b.isOCMInternal + object.organizationID = b.organizationID + object.reason = b.reason + object.resourceType = b.resourceType + object.subscriptionID = b.subscriptionID + return +} diff --git a/clientapi/authorizations/v1/self_access_review_response_list_builder.go b/clientapi/authorizations/v1/self_access_review_response_list_builder.go new file mode 100644 index 00000000..3d8c9cd7 --- /dev/null +++ b/clientapi/authorizations/v1/self_access_review_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfAccessReviewResponseListBuilder contains the data and logic needed to build +// 'self_access_review_response' objects. +type SelfAccessReviewResponseListBuilder struct { + items []*SelfAccessReviewResponseBuilder +} + +// NewSelfAccessReviewResponseList creates a new builder of 'self_access_review_response' objects. +func NewSelfAccessReviewResponseList() *SelfAccessReviewResponseListBuilder { + return new(SelfAccessReviewResponseListBuilder) +} + +// Items sets the items of the list. +func (b *SelfAccessReviewResponseListBuilder) Items(values ...*SelfAccessReviewResponseBuilder) *SelfAccessReviewResponseListBuilder { + b.items = make([]*SelfAccessReviewResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SelfAccessReviewResponseListBuilder) 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 *SelfAccessReviewResponseListBuilder) Copy(list *SelfAccessReviewResponseList) *SelfAccessReviewResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SelfAccessReviewResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSelfAccessReviewResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'self_access_review_response' objects using the +// configuration stored in the builder. +func (b *SelfAccessReviewResponseListBuilder) Build() (list *SelfAccessReviewResponseList, err error) { + items := make([]*SelfAccessReviewResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SelfAccessReviewResponseList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/self_access_review_response_list_type_json.go b/clientapi/authorizations/v1/self_access_review_response_list_type_json.go new file mode 100644 index 00000000..f6e67637 --- /dev/null +++ b/clientapi/authorizations/v1/self_access_review_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfAccessReviewResponseList writes a list of values of the 'self_access_review_response' type to +// the given writer. +func MarshalSelfAccessReviewResponseList(list []*SelfAccessReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfAccessReviewResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfAccessReviewResponseList writes a list of value of the 'self_access_review_response' type to +// the given stream. +func WriteSelfAccessReviewResponseList(list []*SelfAccessReviewResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSelfAccessReviewResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSelfAccessReviewResponseList reads a list of values of the 'self_access_review_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSelfAccessReviewResponseList(source interface{}) (items []*SelfAccessReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSelfAccessReviewResponseList(iterator) + err = iterator.Error + return +} + +// ReadSelfAccessReviewResponseList reads list of values of the ”self_access_review_response' type from +// the given iterator. +func ReadSelfAccessReviewResponseList(iterator *jsoniter.Iterator) []*SelfAccessReviewResponse { + list := []*SelfAccessReviewResponse{} + for iterator.ReadArray() { + item := ReadSelfAccessReviewResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/self_access_review_response_type.go b/clientapi/authorizations/v1/self_access_review_response_type.go new file mode 100644 index 00000000..1df541a6 --- /dev/null +++ b/clientapi/authorizations/v1/self_access_review_response_type.go @@ -0,0 +1,359 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfAccessReviewResponse represents the values of the 'self_access_review_response' type. +// +// Representation of an access review response, performed against oneself +type SelfAccessReviewResponse struct { + bitmap_ uint32 + action string + clusterID string + clusterUUID string + organizationID string + reason string + resourceType string + subscriptionID string + allowed bool + isOCMInternal bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SelfAccessReviewResponse) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Action returns the value of the 'action' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the action, one of: [get,list,create,delete,update]. +func (o *SelfAccessReviewResponse) Action() string { + if o != nil && o.bitmap_&1 != 0 { + return o.action + } + return "" +} + +// GetAction returns the value of the 'action' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the action, one of: [get,list,create,delete,update]. +func (o *SelfAccessReviewResponse) GetAction() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.action + } + return +} + +// Allowed returns the value of the 'allowed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines whether the action on the specified resource type is allowed. +func (o *SelfAccessReviewResponse) Allowed() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.allowed + } + return false +} + +// GetAllowed returns the value of the 'allowed' attribute and +// a flag indicating if the attribute has a value. +// +// Defines whether the action on the specified resource type is allowed. +func (o *SelfAccessReviewResponse) GetAllowed() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.allowed + } + return +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Cluster (internal id) the resource type belongs to. +func (o *SelfAccessReviewResponse) ClusterID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Cluster (internal id) the resource type belongs to. +func (o *SelfAccessReviewResponse) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.clusterID + } + return +} + +// ClusterUUID returns the value of the 'cluster_UUID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Cluster (external id) the resource type belongs to. +func (o *SelfAccessReviewResponse) ClusterUUID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clusterUUID + } + return "" +} + +// GetClusterUUID returns the value of the 'cluster_UUID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Cluster (external id) the resource type belongs to. +func (o *SelfAccessReviewResponse) GetClusterUUID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clusterUUID + } + return +} + +// IsOCMInternal returns the value of the 'is_OCM_internal' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines whether an account is ocm internal. +func (o *SelfAccessReviewResponse) IsOCMInternal() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.isOCMInternal + } + return false +} + +// GetIsOCMInternal returns the value of the 'is_OCM_internal' attribute and +// a flag indicating if the attribute has a value. +// +// Defines whether an account is ocm internal. +func (o *SelfAccessReviewResponse) GetIsOCMInternal() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.isOCMInternal + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Organization the resource type belongs to. +func (o *SelfAccessReviewResponse) OrganizationID() string { + if o != nil && o.bitmap_&32 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Organization the resource type belongs to. +func (o *SelfAccessReviewResponse) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.organizationID + } + return +} + +// Reason returns the value of the 'reason' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines further context for the value in allowed (if applicable). +func (o *SelfAccessReviewResponse) Reason() string { + if o != nil && o.bitmap_&64 != 0 { + return o.reason + } + return "" +} + +// GetReason returns the value of the 'reason' attribute and +// a flag indicating if the attribute has a value. +// +// Defines further context for the value in allowed (if applicable). +func (o *SelfAccessReviewResponse) GetReason() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.reason + } + return +} + +// ResourceType returns the value of the 'resource_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the type of the resource an action would be taken on. +// See uhc-account-manager/openapi/openapi.yaml for a list of possible values. +func (o *SelfAccessReviewResponse) ResourceType() string { + if o != nil && o.bitmap_&128 != 0 { + return o.resourceType + } + return "" +} + +// GetResourceType returns the value of the 'resource_type' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the type of the resource an action would be taken on. +// See uhc-account-manager/openapi/openapi.yaml for a list of possible values. +func (o *SelfAccessReviewResponse) GetResourceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.resourceType + } + return +} + +// SubscriptionID returns the value of the 'subscription_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Subscription the resource type belongs to. +func (o *SelfAccessReviewResponse) SubscriptionID() string { + if o != nil && o.bitmap_&256 != 0 { + return o.subscriptionID + } + return "" +} + +// GetSubscriptionID returns the value of the 'subscription_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Subscription the resource type belongs to. +func (o *SelfAccessReviewResponse) GetSubscriptionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.subscriptionID + } + return +} + +// SelfAccessReviewResponseListKind is the name of the type used to represent list of objects of +// type 'self_access_review_response'. +const SelfAccessReviewResponseListKind = "SelfAccessReviewResponseList" + +// SelfAccessReviewResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'self_access_review_response'. +const SelfAccessReviewResponseListLinkKind = "SelfAccessReviewResponseListLink" + +// SelfAccessReviewResponseNilKind is the name of the type used to nil lists of objects of +// type 'self_access_review_response'. +const SelfAccessReviewResponseListNilKind = "SelfAccessReviewResponseListNil" + +// SelfAccessReviewResponseList is a list of values of the 'self_access_review_response' type. +type SelfAccessReviewResponseList struct { + href string + link bool + items []*SelfAccessReviewResponse +} + +// Len returns the length of the list. +func (l *SelfAccessReviewResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SelfAccessReviewResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SelfAccessReviewResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SelfAccessReviewResponseList) SetItems(items []*SelfAccessReviewResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *SelfAccessReviewResponseList) Items() []*SelfAccessReviewResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SelfAccessReviewResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SelfAccessReviewResponseList) Get(i int) *SelfAccessReviewResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SelfAccessReviewResponseList) Slice() []*SelfAccessReviewResponse { + var slice []*SelfAccessReviewResponse + if l == nil { + slice = make([]*SelfAccessReviewResponse, 0) + } else { + slice = make([]*SelfAccessReviewResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SelfAccessReviewResponseList) Each(f func(item *SelfAccessReviewResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SelfAccessReviewResponseList) Range(f func(index int, item *SelfAccessReviewResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/self_access_review_response_type_json.go b/clientapi/authorizations/v1/self_access_review_response_type_json.go new file mode 100644 index 00000000..ffb000a2 --- /dev/null +++ b/clientapi/authorizations/v1/self_access_review_response_type_json.go @@ -0,0 +1,190 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfAccessReviewResponse writes a value of the 'self_access_review_response' type to the given writer. +func MarshalSelfAccessReviewResponse(object *SelfAccessReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfAccessReviewResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfAccessReviewResponse writes a value of the 'self_access_review_response' type to the given stream. +func WriteSelfAccessReviewResponse(object *SelfAccessReviewResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("action") + stream.WriteString(object.action) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("allowed") + stream.WriteBool(object.allowed) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_uuid") + stream.WriteString(object.clusterUUID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("is_ocm_internal") + stream.WriteBool(object.isOCMInternal) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("reason") + stream.WriteString(object.reason) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_type") + stream.WriteString(object.resourceType) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionID) + } + stream.WriteObjectEnd() +} + +// UnmarshalSelfAccessReviewResponse reads a value of the 'self_access_review_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSelfAccessReviewResponse(source interface{}) (object *SelfAccessReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSelfAccessReviewResponse(iterator) + err = iterator.Error + return +} + +// ReadSelfAccessReviewResponse reads a value of the 'self_access_review_response' type from the given iterator. +func ReadSelfAccessReviewResponse(iterator *jsoniter.Iterator) *SelfAccessReviewResponse { + object := &SelfAccessReviewResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "action": + value := iterator.ReadString() + object.action = value + object.bitmap_ |= 1 + case "allowed": + value := iterator.ReadBool() + object.allowed = value + object.bitmap_ |= 2 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 4 + case "cluster_uuid": + value := iterator.ReadString() + object.clusterUUID = value + object.bitmap_ |= 8 + case "is_ocm_internal": + value := iterator.ReadBool() + object.isOCMInternal = value + object.bitmap_ |= 16 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 32 + case "reason": + value := iterator.ReadString() + object.reason = value + object.bitmap_ |= 64 + case "resource_type": + value := iterator.ReadString() + object.resourceType = value + object.bitmap_ |= 128 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionID = value + object.bitmap_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/self_capability_review_request_builder.go b/clientapi/authorizations/v1/self_capability_review_request_builder.go new file mode 100644 index 00000000..a6acdcac --- /dev/null +++ b/clientapi/authorizations/v1/self_capability_review_request_builder.go @@ -0,0 +1,123 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfCapabilityReviewRequestBuilder contains the data and logic needed to build 'self_capability_review_request' objects. +// +// Representation of a capability review. +type SelfCapabilityReviewRequestBuilder struct { + bitmap_ uint32 + accountUsername string + capability string + clusterID string + organizationID string + resourceType string + subscriptionID string + type_ string +} + +// NewSelfCapabilityReviewRequest creates a new builder of 'self_capability_review_request' objects. +func NewSelfCapabilityReviewRequest() *SelfCapabilityReviewRequestBuilder { + return &SelfCapabilityReviewRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SelfCapabilityReviewRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AccountUsername sets the value of the 'account_username' attribute to the given value. +func (b *SelfCapabilityReviewRequestBuilder) AccountUsername(value string) *SelfCapabilityReviewRequestBuilder { + b.accountUsername = value + b.bitmap_ |= 1 + return b +} + +// Capability sets the value of the 'capability' attribute to the given value. +func (b *SelfCapabilityReviewRequestBuilder) Capability(value string) *SelfCapabilityReviewRequestBuilder { + b.capability = value + b.bitmap_ |= 2 + return b +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *SelfCapabilityReviewRequestBuilder) ClusterID(value string) *SelfCapabilityReviewRequestBuilder { + b.clusterID = value + b.bitmap_ |= 4 + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *SelfCapabilityReviewRequestBuilder) OrganizationID(value string) *SelfCapabilityReviewRequestBuilder { + b.organizationID = value + b.bitmap_ |= 8 + return b +} + +// ResourceType sets the value of the 'resource_type' attribute to the given value. +func (b *SelfCapabilityReviewRequestBuilder) ResourceType(value string) *SelfCapabilityReviewRequestBuilder { + b.resourceType = value + b.bitmap_ |= 16 + return b +} + +// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value. +func (b *SelfCapabilityReviewRequestBuilder) SubscriptionID(value string) *SelfCapabilityReviewRequestBuilder { + b.subscriptionID = value + b.bitmap_ |= 32 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *SelfCapabilityReviewRequestBuilder) Type(value string) *SelfCapabilityReviewRequestBuilder { + b.type_ = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SelfCapabilityReviewRequestBuilder) Copy(object *SelfCapabilityReviewRequest) *SelfCapabilityReviewRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.accountUsername = object.accountUsername + b.capability = object.capability + b.clusterID = object.clusterID + b.organizationID = object.organizationID + b.resourceType = object.resourceType + b.subscriptionID = object.subscriptionID + b.type_ = object.type_ + return b +} + +// Build creates a 'self_capability_review_request' object using the configuration stored in the builder. +func (b *SelfCapabilityReviewRequestBuilder) Build() (object *SelfCapabilityReviewRequest, err error) { + object = new(SelfCapabilityReviewRequest) + object.bitmap_ = b.bitmap_ + object.accountUsername = b.accountUsername + object.capability = b.capability + object.clusterID = b.clusterID + object.organizationID = b.organizationID + object.resourceType = b.resourceType + object.subscriptionID = b.subscriptionID + object.type_ = b.type_ + return +} diff --git a/clientapi/authorizations/v1/self_capability_review_request_list_builder.go b/clientapi/authorizations/v1/self_capability_review_request_list_builder.go new file mode 100644 index 00000000..3c0701ad --- /dev/null +++ b/clientapi/authorizations/v1/self_capability_review_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfCapabilityReviewRequestListBuilder contains the data and logic needed to build +// 'self_capability_review_request' objects. +type SelfCapabilityReviewRequestListBuilder struct { + items []*SelfCapabilityReviewRequestBuilder +} + +// NewSelfCapabilityReviewRequestList creates a new builder of 'self_capability_review_request' objects. +func NewSelfCapabilityReviewRequestList() *SelfCapabilityReviewRequestListBuilder { + return new(SelfCapabilityReviewRequestListBuilder) +} + +// Items sets the items of the list. +func (b *SelfCapabilityReviewRequestListBuilder) Items(values ...*SelfCapabilityReviewRequestBuilder) *SelfCapabilityReviewRequestListBuilder { + b.items = make([]*SelfCapabilityReviewRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SelfCapabilityReviewRequestListBuilder) 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 *SelfCapabilityReviewRequestListBuilder) Copy(list *SelfCapabilityReviewRequestList) *SelfCapabilityReviewRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SelfCapabilityReviewRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSelfCapabilityReviewRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'self_capability_review_request' objects using the +// configuration stored in the builder. +func (b *SelfCapabilityReviewRequestListBuilder) Build() (list *SelfCapabilityReviewRequestList, err error) { + items := make([]*SelfCapabilityReviewRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SelfCapabilityReviewRequestList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/self_capability_review_request_list_type_json.go b/clientapi/authorizations/v1/self_capability_review_request_list_type_json.go new file mode 100644 index 00000000..314fd756 --- /dev/null +++ b/clientapi/authorizations/v1/self_capability_review_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfCapabilityReviewRequestList writes a list of values of the 'self_capability_review_request' type to +// the given writer. +func MarshalSelfCapabilityReviewRequestList(list []*SelfCapabilityReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfCapabilityReviewRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfCapabilityReviewRequestList writes a list of value of the 'self_capability_review_request' type to +// the given stream. +func WriteSelfCapabilityReviewRequestList(list []*SelfCapabilityReviewRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSelfCapabilityReviewRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSelfCapabilityReviewRequestList reads a list of values of the 'self_capability_review_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSelfCapabilityReviewRequestList(source interface{}) (items []*SelfCapabilityReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSelfCapabilityReviewRequestList(iterator) + err = iterator.Error + return +} + +// ReadSelfCapabilityReviewRequestList reads list of values of the ”self_capability_review_request' type from +// the given iterator. +func ReadSelfCapabilityReviewRequestList(iterator *jsoniter.Iterator) []*SelfCapabilityReviewRequest { + list := []*SelfCapabilityReviewRequest{} + for iterator.ReadArray() { + item := ReadSelfCapabilityReviewRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/self_capability_review_request_type.go b/clientapi/authorizations/v1/self_capability_review_request_type.go new file mode 100644 index 00000000..3f0cd2bb --- /dev/null +++ b/clientapi/authorizations/v1/self_capability_review_request_type.go @@ -0,0 +1,311 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfCapabilityReviewRequest represents the values of the 'self_capability_review_request' type. +// +// Representation of a capability review. +type SelfCapabilityReviewRequest struct { + bitmap_ uint32 + accountUsername string + capability string + clusterID string + organizationID string + resourceType string + subscriptionID string + type_ string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SelfCapabilityReviewRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AccountUsername returns the value of the 'account_username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the username of the account of which capability is being reviewed. +func (o *SelfCapabilityReviewRequest) AccountUsername() string { + if o != nil && o.bitmap_&1 != 0 { + return o.accountUsername + } + return "" +} + +// GetAccountUsername returns the value of the 'account_username' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the username of the account of which capability is being reviewed. +func (o *SelfCapabilityReviewRequest) GetAccountUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.accountUsername + } + return +} + +// Capability returns the value of the 'capability' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Capability to review [manage_cluster_admin]. +func (o *SelfCapabilityReviewRequest) Capability() string { + if o != nil && o.bitmap_&2 != 0 { + return o.capability + } + return "" +} + +// GetCapability returns the value of the 'capability' attribute and +// a flag indicating if the attribute has a value. +// +// Capability to review [manage_cluster_admin]. +func (o *SelfCapabilityReviewRequest) GetCapability() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.capability + } + return +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Cluster (internal id) the resource type belongs to. +func (o *SelfCapabilityReviewRequest) ClusterID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Cluster (internal id) the resource type belongs to. +func (o *SelfCapabilityReviewRequest) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.clusterID + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Organization the resource type belongs to. +func (o *SelfCapabilityReviewRequest) OrganizationID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Organization the resource type belongs to. +func (o *SelfCapabilityReviewRequest) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.organizationID + } + return +} + +// ResourceType returns the value of the 'resource_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the type of the resource. +// See uhc-account-manager/openapi/openapi.yaml for a list of possible values. +func (o *SelfCapabilityReviewRequest) ResourceType() string { + if o != nil && o.bitmap_&16 != 0 { + return o.resourceType + } + return "" +} + +// GetResourceType returns the value of the 'resource_type' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the type of the resource. +// See uhc-account-manager/openapi/openapi.yaml for a list of possible values. +func (o *SelfCapabilityReviewRequest) GetResourceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.resourceType + } + return +} + +// SubscriptionID returns the value of the 'subscription_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Subscription the resource type belongs to. +func (o *SelfCapabilityReviewRequest) SubscriptionID() string { + if o != nil && o.bitmap_&32 != 0 { + return o.subscriptionID + } + return "" +} + +// GetSubscriptionID returns the value of the 'subscription_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Subscription the resource type belongs to. +func (o *SelfCapabilityReviewRequest) GetSubscriptionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.subscriptionID + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of capability [Cluster]. +func (o *SelfCapabilityReviewRequest) Type() string { + if o != nil && o.bitmap_&64 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of capability [Cluster]. +func (o *SelfCapabilityReviewRequest) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.type_ + } + return +} + +// SelfCapabilityReviewRequestListKind is the name of the type used to represent list of objects of +// type 'self_capability_review_request'. +const SelfCapabilityReviewRequestListKind = "SelfCapabilityReviewRequestList" + +// SelfCapabilityReviewRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'self_capability_review_request'. +const SelfCapabilityReviewRequestListLinkKind = "SelfCapabilityReviewRequestListLink" + +// SelfCapabilityReviewRequestNilKind is the name of the type used to nil lists of objects of +// type 'self_capability_review_request'. +const SelfCapabilityReviewRequestListNilKind = "SelfCapabilityReviewRequestListNil" + +// SelfCapabilityReviewRequestList is a list of values of the 'self_capability_review_request' type. +type SelfCapabilityReviewRequestList struct { + href string + link bool + items []*SelfCapabilityReviewRequest +} + +// Len returns the length of the list. +func (l *SelfCapabilityReviewRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SelfCapabilityReviewRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SelfCapabilityReviewRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SelfCapabilityReviewRequestList) SetItems(items []*SelfCapabilityReviewRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *SelfCapabilityReviewRequestList) Items() []*SelfCapabilityReviewRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SelfCapabilityReviewRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SelfCapabilityReviewRequestList) Get(i int) *SelfCapabilityReviewRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SelfCapabilityReviewRequestList) Slice() []*SelfCapabilityReviewRequest { + var slice []*SelfCapabilityReviewRequest + if l == nil { + slice = make([]*SelfCapabilityReviewRequest, 0) + } else { + slice = make([]*SelfCapabilityReviewRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SelfCapabilityReviewRequestList) Each(f func(item *SelfCapabilityReviewRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SelfCapabilityReviewRequestList) Range(f func(index int, item *SelfCapabilityReviewRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/self_capability_review_request_type_json.go b/clientapi/authorizations/v1/self_capability_review_request_type_json.go new file mode 100644 index 00000000..00157a5c --- /dev/null +++ b/clientapi/authorizations/v1/self_capability_review_request_type_json.go @@ -0,0 +1,164 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfCapabilityReviewRequest writes a value of the 'self_capability_review_request' type to the given writer. +func MarshalSelfCapabilityReviewRequest(object *SelfCapabilityReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfCapabilityReviewRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfCapabilityReviewRequest writes a value of the 'self_capability_review_request' type to the given stream. +func WriteSelfCapabilityReviewRequest(object *SelfCapabilityReviewRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_username") + stream.WriteString(object.accountUsername) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("capability") + stream.WriteString(object.capability) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_type") + stream.WriteString(object.resourceType) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionID) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalSelfCapabilityReviewRequest reads a value of the 'self_capability_review_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSelfCapabilityReviewRequest(source interface{}) (object *SelfCapabilityReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSelfCapabilityReviewRequest(iterator) + err = iterator.Error + return +} + +// ReadSelfCapabilityReviewRequest reads a value of the 'self_capability_review_request' type from the given iterator. +func ReadSelfCapabilityReviewRequest(iterator *jsoniter.Iterator) *SelfCapabilityReviewRequest { + object := &SelfCapabilityReviewRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "account_username": + value := iterator.ReadString() + object.accountUsername = value + object.bitmap_ |= 1 + case "capability": + value := iterator.ReadString() + object.capability = value + object.bitmap_ |= 2 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 4 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 8 + case "resource_type": + value := iterator.ReadString() + object.resourceType = value + object.bitmap_ |= 16 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionID = value + object.bitmap_ |= 32 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/self_capability_review_response_builder.go b/clientapi/authorizations/v1/self_capability_review_response_builder.go new file mode 100644 index 00000000..2d93a2b0 --- /dev/null +++ b/clientapi/authorizations/v1/self_capability_review_response_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfCapabilityReviewResponseBuilder contains the data and logic needed to build 'self_capability_review_response' objects. +// +// Representation of a capability review response. +type SelfCapabilityReviewResponseBuilder struct { + bitmap_ uint32 + result string +} + +// NewSelfCapabilityReviewResponse creates a new builder of 'self_capability_review_response' objects. +func NewSelfCapabilityReviewResponse() *SelfCapabilityReviewResponseBuilder { + return &SelfCapabilityReviewResponseBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SelfCapabilityReviewResponseBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Result sets the value of the 'result' attribute to the given value. +func (b *SelfCapabilityReviewResponseBuilder) Result(value string) *SelfCapabilityReviewResponseBuilder { + b.result = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SelfCapabilityReviewResponseBuilder) Copy(object *SelfCapabilityReviewResponse) *SelfCapabilityReviewResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.result = object.result + return b +} + +// Build creates a 'self_capability_review_response' object using the configuration stored in the builder. +func (b *SelfCapabilityReviewResponseBuilder) Build() (object *SelfCapabilityReviewResponse, err error) { + object = new(SelfCapabilityReviewResponse) + object.bitmap_ = b.bitmap_ + object.result = b.result + return +} diff --git a/clientapi/authorizations/v1/self_capability_review_response_list_builder.go b/clientapi/authorizations/v1/self_capability_review_response_list_builder.go new file mode 100644 index 00000000..9835591f --- /dev/null +++ b/clientapi/authorizations/v1/self_capability_review_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfCapabilityReviewResponseListBuilder contains the data and logic needed to build +// 'self_capability_review_response' objects. +type SelfCapabilityReviewResponseListBuilder struct { + items []*SelfCapabilityReviewResponseBuilder +} + +// NewSelfCapabilityReviewResponseList creates a new builder of 'self_capability_review_response' objects. +func NewSelfCapabilityReviewResponseList() *SelfCapabilityReviewResponseListBuilder { + return new(SelfCapabilityReviewResponseListBuilder) +} + +// Items sets the items of the list. +func (b *SelfCapabilityReviewResponseListBuilder) Items(values ...*SelfCapabilityReviewResponseBuilder) *SelfCapabilityReviewResponseListBuilder { + b.items = make([]*SelfCapabilityReviewResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SelfCapabilityReviewResponseListBuilder) 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 *SelfCapabilityReviewResponseListBuilder) Copy(list *SelfCapabilityReviewResponseList) *SelfCapabilityReviewResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SelfCapabilityReviewResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSelfCapabilityReviewResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'self_capability_review_response' objects using the +// configuration stored in the builder. +func (b *SelfCapabilityReviewResponseListBuilder) Build() (list *SelfCapabilityReviewResponseList, err error) { + items := make([]*SelfCapabilityReviewResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SelfCapabilityReviewResponseList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/self_capability_review_response_list_type_json.go b/clientapi/authorizations/v1/self_capability_review_response_list_type_json.go new file mode 100644 index 00000000..cee082a9 --- /dev/null +++ b/clientapi/authorizations/v1/self_capability_review_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfCapabilityReviewResponseList writes a list of values of the 'self_capability_review_response' type to +// the given writer. +func MarshalSelfCapabilityReviewResponseList(list []*SelfCapabilityReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfCapabilityReviewResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfCapabilityReviewResponseList writes a list of value of the 'self_capability_review_response' type to +// the given stream. +func WriteSelfCapabilityReviewResponseList(list []*SelfCapabilityReviewResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSelfCapabilityReviewResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSelfCapabilityReviewResponseList reads a list of values of the 'self_capability_review_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSelfCapabilityReviewResponseList(source interface{}) (items []*SelfCapabilityReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSelfCapabilityReviewResponseList(iterator) + err = iterator.Error + return +} + +// ReadSelfCapabilityReviewResponseList reads list of values of the ”self_capability_review_response' type from +// the given iterator. +func ReadSelfCapabilityReviewResponseList(iterator *jsoniter.Iterator) []*SelfCapabilityReviewResponse { + list := []*SelfCapabilityReviewResponse{} + for iterator.ReadArray() { + item := ReadSelfCapabilityReviewResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/self_capability_review_response_type.go b/clientapi/authorizations/v1/self_capability_review_response_type.go new file mode 100644 index 00000000..27c73ba3 --- /dev/null +++ b/clientapi/authorizations/v1/self_capability_review_response_type.go @@ -0,0 +1,161 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfCapabilityReviewResponse represents the values of the 'self_capability_review_response' type. +// +// Representation of a capability review response. +type SelfCapabilityReviewResponse struct { + bitmap_ uint32 + result string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SelfCapabilityReviewResponse) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Result returns the value of the 'result' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SelfCapabilityReviewResponse) Result() string { + if o != nil && o.bitmap_&1 != 0 { + return o.result + } + return "" +} + +// GetResult returns the value of the 'result' attribute and +// a flag indicating if the attribute has a value. +func (o *SelfCapabilityReviewResponse) GetResult() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.result + } + return +} + +// SelfCapabilityReviewResponseListKind is the name of the type used to represent list of objects of +// type 'self_capability_review_response'. +const SelfCapabilityReviewResponseListKind = "SelfCapabilityReviewResponseList" + +// SelfCapabilityReviewResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'self_capability_review_response'. +const SelfCapabilityReviewResponseListLinkKind = "SelfCapabilityReviewResponseListLink" + +// SelfCapabilityReviewResponseNilKind is the name of the type used to nil lists of objects of +// type 'self_capability_review_response'. +const SelfCapabilityReviewResponseListNilKind = "SelfCapabilityReviewResponseListNil" + +// SelfCapabilityReviewResponseList is a list of values of the 'self_capability_review_response' type. +type SelfCapabilityReviewResponseList struct { + href string + link bool + items []*SelfCapabilityReviewResponse +} + +// Len returns the length of the list. +func (l *SelfCapabilityReviewResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SelfCapabilityReviewResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SelfCapabilityReviewResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SelfCapabilityReviewResponseList) SetItems(items []*SelfCapabilityReviewResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *SelfCapabilityReviewResponseList) Items() []*SelfCapabilityReviewResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SelfCapabilityReviewResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SelfCapabilityReviewResponseList) Get(i int) *SelfCapabilityReviewResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SelfCapabilityReviewResponseList) Slice() []*SelfCapabilityReviewResponse { + var slice []*SelfCapabilityReviewResponse + if l == nil { + slice = make([]*SelfCapabilityReviewResponse, 0) + } else { + slice = make([]*SelfCapabilityReviewResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SelfCapabilityReviewResponseList) Each(f func(item *SelfCapabilityReviewResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SelfCapabilityReviewResponseList) Range(f func(index int, item *SelfCapabilityReviewResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/self_capability_review_response_type_json.go b/clientapi/authorizations/v1/self_capability_review_response_type_json.go new file mode 100644 index 00000000..1084aeee --- /dev/null +++ b/clientapi/authorizations/v1/self_capability_review_response_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfCapabilityReviewResponse writes a value of the 'self_capability_review_response' type to the given writer. +func MarshalSelfCapabilityReviewResponse(object *SelfCapabilityReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfCapabilityReviewResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfCapabilityReviewResponse writes a value of the 'self_capability_review_response' type to the given stream. +func WriteSelfCapabilityReviewResponse(object *SelfCapabilityReviewResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("result") + stream.WriteString(object.result) + } + stream.WriteObjectEnd() +} + +// UnmarshalSelfCapabilityReviewResponse reads a value of the 'self_capability_review_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSelfCapabilityReviewResponse(source interface{}) (object *SelfCapabilityReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSelfCapabilityReviewResponse(iterator) + err = iterator.Error + return +} + +// ReadSelfCapabilityReviewResponse reads a value of the 'self_capability_review_response' type from the given iterator. +func ReadSelfCapabilityReviewResponse(iterator *jsoniter.Iterator) *SelfCapabilityReviewResponse { + object := &SelfCapabilityReviewResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "result": + value := iterator.ReadString() + object.result = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/self_feature_review_request_builder.go b/clientapi/authorizations/v1/self_feature_review_request_builder.go new file mode 100644 index 00000000..4f6a4670 --- /dev/null +++ b/clientapi/authorizations/v1/self_feature_review_request_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfFeatureReviewRequestBuilder contains the data and logic needed to build 'self_feature_review_request' objects. +// +// Representation of a feature review performed against oneself +type SelfFeatureReviewRequestBuilder struct { + bitmap_ uint32 + feature string +} + +// NewSelfFeatureReviewRequest creates a new builder of 'self_feature_review_request' objects. +func NewSelfFeatureReviewRequest() *SelfFeatureReviewRequestBuilder { + return &SelfFeatureReviewRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SelfFeatureReviewRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Feature sets the value of the 'feature' attribute to the given value. +func (b *SelfFeatureReviewRequestBuilder) Feature(value string) *SelfFeatureReviewRequestBuilder { + b.feature = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SelfFeatureReviewRequestBuilder) Copy(object *SelfFeatureReviewRequest) *SelfFeatureReviewRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.feature = object.feature + return b +} + +// Build creates a 'self_feature_review_request' object using the configuration stored in the builder. +func (b *SelfFeatureReviewRequestBuilder) Build() (object *SelfFeatureReviewRequest, err error) { + object = new(SelfFeatureReviewRequest) + object.bitmap_ = b.bitmap_ + object.feature = b.feature + return +} diff --git a/clientapi/authorizations/v1/self_feature_review_request_list_builder.go b/clientapi/authorizations/v1/self_feature_review_request_list_builder.go new file mode 100644 index 00000000..1633a3e0 --- /dev/null +++ b/clientapi/authorizations/v1/self_feature_review_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfFeatureReviewRequestListBuilder contains the data and logic needed to build +// 'self_feature_review_request' objects. +type SelfFeatureReviewRequestListBuilder struct { + items []*SelfFeatureReviewRequestBuilder +} + +// NewSelfFeatureReviewRequestList creates a new builder of 'self_feature_review_request' objects. +func NewSelfFeatureReviewRequestList() *SelfFeatureReviewRequestListBuilder { + return new(SelfFeatureReviewRequestListBuilder) +} + +// Items sets the items of the list. +func (b *SelfFeatureReviewRequestListBuilder) Items(values ...*SelfFeatureReviewRequestBuilder) *SelfFeatureReviewRequestListBuilder { + b.items = make([]*SelfFeatureReviewRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SelfFeatureReviewRequestListBuilder) 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 *SelfFeatureReviewRequestListBuilder) Copy(list *SelfFeatureReviewRequestList) *SelfFeatureReviewRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SelfFeatureReviewRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSelfFeatureReviewRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'self_feature_review_request' objects using the +// configuration stored in the builder. +func (b *SelfFeatureReviewRequestListBuilder) Build() (list *SelfFeatureReviewRequestList, err error) { + items := make([]*SelfFeatureReviewRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SelfFeatureReviewRequestList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/self_feature_review_request_list_type_json.go b/clientapi/authorizations/v1/self_feature_review_request_list_type_json.go new file mode 100644 index 00000000..b1a43066 --- /dev/null +++ b/clientapi/authorizations/v1/self_feature_review_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfFeatureReviewRequestList writes a list of values of the 'self_feature_review_request' type to +// the given writer. +func MarshalSelfFeatureReviewRequestList(list []*SelfFeatureReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfFeatureReviewRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfFeatureReviewRequestList writes a list of value of the 'self_feature_review_request' type to +// the given stream. +func WriteSelfFeatureReviewRequestList(list []*SelfFeatureReviewRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSelfFeatureReviewRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSelfFeatureReviewRequestList reads a list of values of the 'self_feature_review_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSelfFeatureReviewRequestList(source interface{}) (items []*SelfFeatureReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSelfFeatureReviewRequestList(iterator) + err = iterator.Error + return +} + +// ReadSelfFeatureReviewRequestList reads list of values of the ”self_feature_review_request' type from +// the given iterator. +func ReadSelfFeatureReviewRequestList(iterator *jsoniter.Iterator) []*SelfFeatureReviewRequest { + list := []*SelfFeatureReviewRequest{} + for iterator.ReadArray() { + item := ReadSelfFeatureReviewRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/self_feature_review_request_type.go b/clientapi/authorizations/v1/self_feature_review_request_type.go new file mode 100644 index 00000000..7494077b --- /dev/null +++ b/clientapi/authorizations/v1/self_feature_review_request_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfFeatureReviewRequest represents the values of the 'self_feature_review_request' type. +// +// Representation of a feature review performed against oneself +type SelfFeatureReviewRequest struct { + bitmap_ uint32 + feature string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SelfFeatureReviewRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Feature returns the value of the 'feature' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the feature which can be toggled +func (o *SelfFeatureReviewRequest) Feature() string { + if o != nil && o.bitmap_&1 != 0 { + return o.feature + } + return "" +} + +// GetFeature returns the value of the 'feature' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the feature which can be toggled +func (o *SelfFeatureReviewRequest) GetFeature() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.feature + } + return +} + +// SelfFeatureReviewRequestListKind is the name of the type used to represent list of objects of +// type 'self_feature_review_request'. +const SelfFeatureReviewRequestListKind = "SelfFeatureReviewRequestList" + +// SelfFeatureReviewRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'self_feature_review_request'. +const SelfFeatureReviewRequestListLinkKind = "SelfFeatureReviewRequestListLink" + +// SelfFeatureReviewRequestNilKind is the name of the type used to nil lists of objects of +// type 'self_feature_review_request'. +const SelfFeatureReviewRequestListNilKind = "SelfFeatureReviewRequestListNil" + +// SelfFeatureReviewRequestList is a list of values of the 'self_feature_review_request' type. +type SelfFeatureReviewRequestList struct { + href string + link bool + items []*SelfFeatureReviewRequest +} + +// Len returns the length of the list. +func (l *SelfFeatureReviewRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SelfFeatureReviewRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SelfFeatureReviewRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SelfFeatureReviewRequestList) SetItems(items []*SelfFeatureReviewRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *SelfFeatureReviewRequestList) Items() []*SelfFeatureReviewRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SelfFeatureReviewRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SelfFeatureReviewRequestList) Get(i int) *SelfFeatureReviewRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SelfFeatureReviewRequestList) Slice() []*SelfFeatureReviewRequest { + var slice []*SelfFeatureReviewRequest + if l == nil { + slice = make([]*SelfFeatureReviewRequest, 0) + } else { + slice = make([]*SelfFeatureReviewRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SelfFeatureReviewRequestList) Each(f func(item *SelfFeatureReviewRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SelfFeatureReviewRequestList) Range(f func(index int, item *SelfFeatureReviewRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/self_feature_review_request_type_json.go b/clientapi/authorizations/v1/self_feature_review_request_type_json.go new file mode 100644 index 00000000..c6b7aadc --- /dev/null +++ b/clientapi/authorizations/v1/self_feature_review_request_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfFeatureReviewRequest writes a value of the 'self_feature_review_request' type to the given writer. +func MarshalSelfFeatureReviewRequest(object *SelfFeatureReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfFeatureReviewRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfFeatureReviewRequest writes a value of the 'self_feature_review_request' type to the given stream. +func WriteSelfFeatureReviewRequest(object *SelfFeatureReviewRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("feature") + stream.WriteString(object.feature) + } + stream.WriteObjectEnd() +} + +// UnmarshalSelfFeatureReviewRequest reads a value of the 'self_feature_review_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSelfFeatureReviewRequest(source interface{}) (object *SelfFeatureReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSelfFeatureReviewRequest(iterator) + err = iterator.Error + return +} + +// ReadSelfFeatureReviewRequest reads a value of the 'self_feature_review_request' type from the given iterator. +func ReadSelfFeatureReviewRequest(iterator *jsoniter.Iterator) *SelfFeatureReviewRequest { + object := &SelfFeatureReviewRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "feature": + value := iterator.ReadString() + object.feature = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/self_feature_review_response_builder.go b/clientapi/authorizations/v1/self_feature_review_response_builder.go new file mode 100644 index 00000000..a0168f44 --- /dev/null +++ b/clientapi/authorizations/v1/self_feature_review_response_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfFeatureReviewResponseBuilder contains the data and logic needed to build 'self_feature_review_response' objects. +// +// Representation of a feature review response, performed against oneself +type SelfFeatureReviewResponseBuilder struct { + bitmap_ uint32 + featureID string + enabled bool +} + +// NewSelfFeatureReviewResponse creates a new builder of 'self_feature_review_response' objects. +func NewSelfFeatureReviewResponse() *SelfFeatureReviewResponseBuilder { + return &SelfFeatureReviewResponseBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SelfFeatureReviewResponseBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *SelfFeatureReviewResponseBuilder) Enabled(value bool) *SelfFeatureReviewResponseBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// FeatureID sets the value of the 'feature_ID' attribute to the given value. +func (b *SelfFeatureReviewResponseBuilder) FeatureID(value string) *SelfFeatureReviewResponseBuilder { + b.featureID = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SelfFeatureReviewResponseBuilder) Copy(object *SelfFeatureReviewResponse) *SelfFeatureReviewResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + b.featureID = object.featureID + return b +} + +// Build creates a 'self_feature_review_response' object using the configuration stored in the builder. +func (b *SelfFeatureReviewResponseBuilder) Build() (object *SelfFeatureReviewResponse, err error) { + object = new(SelfFeatureReviewResponse) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + object.featureID = b.featureID + return +} diff --git a/clientapi/authorizations/v1/self_feature_review_response_list_builder.go b/clientapi/authorizations/v1/self_feature_review_response_list_builder.go new file mode 100644 index 00000000..3a144ae0 --- /dev/null +++ b/clientapi/authorizations/v1/self_feature_review_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfFeatureReviewResponseListBuilder contains the data and logic needed to build +// 'self_feature_review_response' objects. +type SelfFeatureReviewResponseListBuilder struct { + items []*SelfFeatureReviewResponseBuilder +} + +// NewSelfFeatureReviewResponseList creates a new builder of 'self_feature_review_response' objects. +func NewSelfFeatureReviewResponseList() *SelfFeatureReviewResponseListBuilder { + return new(SelfFeatureReviewResponseListBuilder) +} + +// Items sets the items of the list. +func (b *SelfFeatureReviewResponseListBuilder) Items(values ...*SelfFeatureReviewResponseBuilder) *SelfFeatureReviewResponseListBuilder { + b.items = make([]*SelfFeatureReviewResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SelfFeatureReviewResponseListBuilder) 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 *SelfFeatureReviewResponseListBuilder) Copy(list *SelfFeatureReviewResponseList) *SelfFeatureReviewResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SelfFeatureReviewResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSelfFeatureReviewResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'self_feature_review_response' objects using the +// configuration stored in the builder. +func (b *SelfFeatureReviewResponseListBuilder) Build() (list *SelfFeatureReviewResponseList, err error) { + items := make([]*SelfFeatureReviewResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SelfFeatureReviewResponseList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/self_feature_review_response_list_type_json.go b/clientapi/authorizations/v1/self_feature_review_response_list_type_json.go new file mode 100644 index 00000000..4d30106a --- /dev/null +++ b/clientapi/authorizations/v1/self_feature_review_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfFeatureReviewResponseList writes a list of values of the 'self_feature_review_response' type to +// the given writer. +func MarshalSelfFeatureReviewResponseList(list []*SelfFeatureReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfFeatureReviewResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfFeatureReviewResponseList writes a list of value of the 'self_feature_review_response' type to +// the given stream. +func WriteSelfFeatureReviewResponseList(list []*SelfFeatureReviewResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSelfFeatureReviewResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSelfFeatureReviewResponseList reads a list of values of the 'self_feature_review_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSelfFeatureReviewResponseList(source interface{}) (items []*SelfFeatureReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSelfFeatureReviewResponseList(iterator) + err = iterator.Error + return +} + +// ReadSelfFeatureReviewResponseList reads list of values of the ”self_feature_review_response' type from +// the given iterator. +func ReadSelfFeatureReviewResponseList(iterator *jsoniter.Iterator) []*SelfFeatureReviewResponse { + list := []*SelfFeatureReviewResponse{} + for iterator.ReadArray() { + item := ReadSelfFeatureReviewResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/self_feature_review_response_type.go b/clientapi/authorizations/v1/self_feature_review_response_type.go new file mode 100644 index 00000000..64610234 --- /dev/null +++ b/clientapi/authorizations/v1/self_feature_review_response_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfFeatureReviewResponse represents the values of the 'self_feature_review_response' type. +// +// Representation of a feature review response, performed against oneself +type SelfFeatureReviewResponse struct { + bitmap_ uint32 + featureID string + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SelfFeatureReviewResponse) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines whether the feature can be toggled +func (o *SelfFeatureReviewResponse) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Defines whether the feature can be toggled +func (o *SelfFeatureReviewResponse) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// FeatureID returns the value of the 'feature_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the feature id which can be toggled +func (o *SelfFeatureReviewResponse) FeatureID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.featureID + } + return "" +} + +// GetFeatureID returns the value of the 'feature_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the feature id which can be toggled +func (o *SelfFeatureReviewResponse) GetFeatureID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.featureID + } + return +} + +// SelfFeatureReviewResponseListKind is the name of the type used to represent list of objects of +// type 'self_feature_review_response'. +const SelfFeatureReviewResponseListKind = "SelfFeatureReviewResponseList" + +// SelfFeatureReviewResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'self_feature_review_response'. +const SelfFeatureReviewResponseListLinkKind = "SelfFeatureReviewResponseListLink" + +// SelfFeatureReviewResponseNilKind is the name of the type used to nil lists of objects of +// type 'self_feature_review_response'. +const SelfFeatureReviewResponseListNilKind = "SelfFeatureReviewResponseListNil" + +// SelfFeatureReviewResponseList is a list of values of the 'self_feature_review_response' type. +type SelfFeatureReviewResponseList struct { + href string + link bool + items []*SelfFeatureReviewResponse +} + +// Len returns the length of the list. +func (l *SelfFeatureReviewResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SelfFeatureReviewResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SelfFeatureReviewResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SelfFeatureReviewResponseList) SetItems(items []*SelfFeatureReviewResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *SelfFeatureReviewResponseList) Items() []*SelfFeatureReviewResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SelfFeatureReviewResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SelfFeatureReviewResponseList) Get(i int) *SelfFeatureReviewResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SelfFeatureReviewResponseList) Slice() []*SelfFeatureReviewResponse { + var slice []*SelfFeatureReviewResponse + if l == nil { + slice = make([]*SelfFeatureReviewResponse, 0) + } else { + slice = make([]*SelfFeatureReviewResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SelfFeatureReviewResponseList) Each(f func(item *SelfFeatureReviewResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SelfFeatureReviewResponseList) Range(f func(index int, item *SelfFeatureReviewResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/self_feature_review_response_type_json.go b/clientapi/authorizations/v1/self_feature_review_response_type_json.go new file mode 100644 index 00000000..8c738502 --- /dev/null +++ b/clientapi/authorizations/v1/self_feature_review_response_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfFeatureReviewResponse writes a value of the 'self_feature_review_response' type to the given writer. +func MarshalSelfFeatureReviewResponse(object *SelfFeatureReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfFeatureReviewResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfFeatureReviewResponse writes a value of the 'self_feature_review_response' type to the given stream. +func WriteSelfFeatureReviewResponse(object *SelfFeatureReviewResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("feature_id") + stream.WriteString(object.featureID) + } + stream.WriteObjectEnd() +} + +// UnmarshalSelfFeatureReviewResponse reads a value of the 'self_feature_review_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSelfFeatureReviewResponse(source interface{}) (object *SelfFeatureReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSelfFeatureReviewResponse(iterator) + err = iterator.Error + return +} + +// ReadSelfFeatureReviewResponse reads a value of the 'self_feature_review_response' type from the given iterator. +func ReadSelfFeatureReviewResponse(iterator *jsoniter.Iterator) *SelfFeatureReviewResponse { + object := &SelfFeatureReviewResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + case "feature_id": + value := iterator.ReadString() + object.featureID = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/self_terms_review_request_builder.go b/clientapi/authorizations/v1/self_terms_review_request_builder.go new file mode 100644 index 00000000..b6ea8762 --- /dev/null +++ b/clientapi/authorizations/v1/self_terms_review_request_builder.go @@ -0,0 +1,74 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfTermsReviewRequestBuilder contains the data and logic needed to build 'self_terms_review_request' objects. +// +// Representation of Red Hat's Terms and Conditions for using OpenShift Dedicated and Amazon Red Hat OpenShift [Terms] +// review requests. +type SelfTermsReviewRequestBuilder struct { + bitmap_ uint32 + eventCode string + siteCode string +} + +// NewSelfTermsReviewRequest creates a new builder of 'self_terms_review_request' objects. +func NewSelfTermsReviewRequest() *SelfTermsReviewRequestBuilder { + return &SelfTermsReviewRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SelfTermsReviewRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// EventCode sets the value of the 'event_code' attribute to the given value. +func (b *SelfTermsReviewRequestBuilder) EventCode(value string) *SelfTermsReviewRequestBuilder { + b.eventCode = value + b.bitmap_ |= 1 + return b +} + +// SiteCode sets the value of the 'site_code' attribute to the given value. +func (b *SelfTermsReviewRequestBuilder) SiteCode(value string) *SelfTermsReviewRequestBuilder { + b.siteCode = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SelfTermsReviewRequestBuilder) Copy(object *SelfTermsReviewRequest) *SelfTermsReviewRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.eventCode = object.eventCode + b.siteCode = object.siteCode + return b +} + +// Build creates a 'self_terms_review_request' object using the configuration stored in the builder. +func (b *SelfTermsReviewRequestBuilder) Build() (object *SelfTermsReviewRequest, err error) { + object = new(SelfTermsReviewRequest) + object.bitmap_ = b.bitmap_ + object.eventCode = b.eventCode + object.siteCode = b.siteCode + return +} diff --git a/clientapi/authorizations/v1/self_terms_review_request_list_builder.go b/clientapi/authorizations/v1/self_terms_review_request_list_builder.go new file mode 100644 index 00000000..e905846c --- /dev/null +++ b/clientapi/authorizations/v1/self_terms_review_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfTermsReviewRequestListBuilder contains the data and logic needed to build +// 'self_terms_review_request' objects. +type SelfTermsReviewRequestListBuilder struct { + items []*SelfTermsReviewRequestBuilder +} + +// NewSelfTermsReviewRequestList creates a new builder of 'self_terms_review_request' objects. +func NewSelfTermsReviewRequestList() *SelfTermsReviewRequestListBuilder { + return new(SelfTermsReviewRequestListBuilder) +} + +// Items sets the items of the list. +func (b *SelfTermsReviewRequestListBuilder) Items(values ...*SelfTermsReviewRequestBuilder) *SelfTermsReviewRequestListBuilder { + b.items = make([]*SelfTermsReviewRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SelfTermsReviewRequestListBuilder) 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 *SelfTermsReviewRequestListBuilder) Copy(list *SelfTermsReviewRequestList) *SelfTermsReviewRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SelfTermsReviewRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSelfTermsReviewRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'self_terms_review_request' objects using the +// configuration stored in the builder. +func (b *SelfTermsReviewRequestListBuilder) Build() (list *SelfTermsReviewRequestList, err error) { + items := make([]*SelfTermsReviewRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SelfTermsReviewRequestList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/self_terms_review_request_list_type_json.go b/clientapi/authorizations/v1/self_terms_review_request_list_type_json.go new file mode 100644 index 00000000..3672bad3 --- /dev/null +++ b/clientapi/authorizations/v1/self_terms_review_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfTermsReviewRequestList writes a list of values of the 'self_terms_review_request' type to +// the given writer. +func MarshalSelfTermsReviewRequestList(list []*SelfTermsReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfTermsReviewRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfTermsReviewRequestList writes a list of value of the 'self_terms_review_request' type to +// the given stream. +func WriteSelfTermsReviewRequestList(list []*SelfTermsReviewRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSelfTermsReviewRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSelfTermsReviewRequestList reads a list of values of the 'self_terms_review_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSelfTermsReviewRequestList(source interface{}) (items []*SelfTermsReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSelfTermsReviewRequestList(iterator) + err = iterator.Error + return +} + +// ReadSelfTermsReviewRequestList reads list of values of the ”self_terms_review_request' type from +// the given iterator. +func ReadSelfTermsReviewRequestList(iterator *jsoniter.Iterator) []*SelfTermsReviewRequest { + list := []*SelfTermsReviewRequest{} + for iterator.ReadArray() { + item := ReadSelfTermsReviewRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/self_terms_review_request_type.go b/clientapi/authorizations/v1/self_terms_review_request_type.go new file mode 100644 index 00000000..b5f81fe9 --- /dev/null +++ b/clientapi/authorizations/v1/self_terms_review_request_type.go @@ -0,0 +1,190 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SelfTermsReviewRequest represents the values of the 'self_terms_review_request' type. +// +// Representation of Red Hat's Terms and Conditions for using OpenShift Dedicated and Amazon Red Hat OpenShift [Terms] +// review requests. +type SelfTermsReviewRequest struct { + bitmap_ uint32 + eventCode string + siteCode string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SelfTermsReviewRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// EventCode returns the value of the 'event_code' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the event code of the terms being checked +func (o *SelfTermsReviewRequest) EventCode() string { + if o != nil && o.bitmap_&1 != 0 { + return o.eventCode + } + return "" +} + +// GetEventCode returns the value of the 'event_code' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the event code of the terms being checked +func (o *SelfTermsReviewRequest) GetEventCode() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.eventCode + } + return +} + +// SiteCode returns the value of the 'site_code' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the site code of the terms being checked +func (o *SelfTermsReviewRequest) SiteCode() string { + if o != nil && o.bitmap_&2 != 0 { + return o.siteCode + } + return "" +} + +// GetSiteCode returns the value of the 'site_code' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the site code of the terms being checked +func (o *SelfTermsReviewRequest) GetSiteCode() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.siteCode + } + return +} + +// SelfTermsReviewRequestListKind is the name of the type used to represent list of objects of +// type 'self_terms_review_request'. +const SelfTermsReviewRequestListKind = "SelfTermsReviewRequestList" + +// SelfTermsReviewRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'self_terms_review_request'. +const SelfTermsReviewRequestListLinkKind = "SelfTermsReviewRequestListLink" + +// SelfTermsReviewRequestNilKind is the name of the type used to nil lists of objects of +// type 'self_terms_review_request'. +const SelfTermsReviewRequestListNilKind = "SelfTermsReviewRequestListNil" + +// SelfTermsReviewRequestList is a list of values of the 'self_terms_review_request' type. +type SelfTermsReviewRequestList struct { + href string + link bool + items []*SelfTermsReviewRequest +} + +// Len returns the length of the list. +func (l *SelfTermsReviewRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SelfTermsReviewRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SelfTermsReviewRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SelfTermsReviewRequestList) SetItems(items []*SelfTermsReviewRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *SelfTermsReviewRequestList) Items() []*SelfTermsReviewRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SelfTermsReviewRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SelfTermsReviewRequestList) Get(i int) *SelfTermsReviewRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SelfTermsReviewRequestList) Slice() []*SelfTermsReviewRequest { + var slice []*SelfTermsReviewRequest + if l == nil { + slice = make([]*SelfTermsReviewRequest, 0) + } else { + slice = make([]*SelfTermsReviewRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SelfTermsReviewRequestList) Each(f func(item *SelfTermsReviewRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SelfTermsReviewRequestList) Range(f func(index int, item *SelfTermsReviewRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/self_terms_review_request_type_json.go b/clientapi/authorizations/v1/self_terms_review_request_type_json.go new file mode 100644 index 00000000..fabb4f16 --- /dev/null +++ b/clientapi/authorizations/v1/self_terms_review_request_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSelfTermsReviewRequest writes a value of the 'self_terms_review_request' type to the given writer. +func MarshalSelfTermsReviewRequest(object *SelfTermsReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSelfTermsReviewRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSelfTermsReviewRequest writes a value of the 'self_terms_review_request' type to the given stream. +func WriteSelfTermsReviewRequest(object *SelfTermsReviewRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("event_code") + stream.WriteString(object.eventCode) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("site_code") + stream.WriteString(object.siteCode) + } + stream.WriteObjectEnd() +} + +// UnmarshalSelfTermsReviewRequest reads a value of the 'self_terms_review_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSelfTermsReviewRequest(source interface{}) (object *SelfTermsReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSelfTermsReviewRequest(iterator) + err = iterator.Error + return +} + +// ReadSelfTermsReviewRequest reads a value of the 'self_terms_review_request' type from the given iterator. +func ReadSelfTermsReviewRequest(iterator *jsoniter.Iterator) *SelfTermsReviewRequest { + object := &SelfTermsReviewRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "event_code": + value := iterator.ReadString() + object.eventCode = value + object.bitmap_ |= 1 + case "site_code": + value := iterator.ReadString() + object.siteCode = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/string_list_type_json.go b/clientapi/authorizations/v1/string_list_type_json.go new file mode 100644 index 00000000..918df95c --- /dev/null +++ b/clientapi/authorizations/v1/string_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStringList writes a list of values of the 'string' type to +// the given writer. +func MarshalStringList(list []string, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStringList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStringList writes a list of value of the 'string' type to +// the given stream. +func WriteStringList(list []string, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalStringList reads a list of values of the 'string' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStringList(source interface{}) (items []string, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStringList(iterator) + err = iterator.Error + return +} + +// ReadStringList reads list of values of the ”string' type from +// the given iterator. +func ReadStringList(iterator *jsoniter.Iterator) []string { + list := []string{} + for iterator.ReadArray() { + item := iterator.ReadString() + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/subscription_status_list_type_json.go b/clientapi/authorizations/v1/subscription_status_list_type_json.go new file mode 100644 index 00000000..45f1eb6b --- /dev/null +++ b/clientapi/authorizations/v1/subscription_status_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSubscriptionStatusList writes a list of values of the 'subscription_status' type to +// the given writer. +func MarshalSubscriptionStatusList(list []SubscriptionStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSubscriptionStatusList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSubscriptionStatusList writes a list of value of the 'subscription_status' type to +// the given stream. +func WriteSubscriptionStatusList(list []SubscriptionStatus, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalSubscriptionStatusList reads a list of values of the 'subscription_status' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSubscriptionStatusList(source interface{}) (items []SubscriptionStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSubscriptionStatusList(iterator) + err = iterator.Error + return +} + +// ReadSubscriptionStatusList reads list of values of the ”subscription_status' type from +// the given iterator. +func ReadSubscriptionStatusList(iterator *jsoniter.Iterator) []SubscriptionStatus { + list := []SubscriptionStatus{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := SubscriptionStatus(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/subscription_status_type.go b/clientapi/authorizations/v1/subscription_status_type.go new file mode 100644 index 00000000..d632921f --- /dev/null +++ b/clientapi/authorizations/v1/subscription_status_type.go @@ -0,0 +1,53 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// SubscriptionStatus represents the values of the 'subscription_status' enumerated type. +type SubscriptionStatus string + +const ( + // Active state subscriptions have their related resources currently running and reporting an active state + // Whether a subscription is active is determined depending on the plan of the subscription + // For example, OCP subscriptions are active if the OCP cluster is successfully reporting metrics + // RHOSR subscriptions are active if the service-registry service determines they are, the service updates the subscription as necessary + SubscriptionStatusActive SubscriptionStatus = "active" + // Subscriptions move to Archived when the resources are no longer visibile to OCM and suspected removed + // Users can also move some disconnected subscriptions to archived state + // If a subscription in Archived state's resources start reporting again, the subscription may move back to Active + SubscriptionStatusArchived SubscriptionStatus = "archived" + // Deprovisioned subscriptions can be considered completely deleted. As of this writing, only managed plan subscriptions are completely + // deleted. Instead of actual DB row deletion, subscriptions are moved to Deprovisioned status and all associated resources (quota, + // roles, etc) are _actually_ deleted. This allows us to keep track of what subscriptions existed and when. + SubscriptionStatusDeprovisioned SubscriptionStatus = "deprovisioned" + // Disconnected subscriptions are Active subscriptions that are intentionally not reporting an active state. There may be some + // desire by the subscription owner not to connect the resources to OCM. This status allows the subscription to stay in OCM without + // automatically moving to Stale or Archived. + SubscriptionStatusDisconnected SubscriptionStatus = "disconnected" + // Reserved subscriptions are created during the resource installation process. A reserved subscription represents a subscription + // whose resources do not yet exist, but are expected to exist soon. Creating a reserved subscription allows services to reserve quota + // for resources that are in the process of creation. Services are expected to update the status to Active or Deprovisioned once + // the creation process completes, or fails. + SubscriptionStatusReserved SubscriptionStatus = "reserved" + // Stale subscriptions are active subscriptions who have stopped reporting an active state. Once reports cease, the subscription + // is moved to stale to indicate to users that OCM can no longer see the Active resources. Subscriptions in stale state will automatically + // transition back to active if the resources stat reporting again. They will also transition to Disconnected or Archived if the + // resources never resume reporting. + SubscriptionStatusStale SubscriptionStatus = "stale" +) diff --git a/clientapi/authorizations/v1/terms_review_request_builder.go b/clientapi/authorizations/v1/terms_review_request_builder.go new file mode 100644 index 00000000..4fd57c1b --- /dev/null +++ b/clientapi/authorizations/v1/terms_review_request_builder.go @@ -0,0 +1,94 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// TermsReviewRequestBuilder contains the data and logic needed to build 'terms_review_request' objects. +// +// Representation of Red Hat's Terms and Conditions for using OpenShift Dedicated and Amazon Red Hat OpenShift [Terms] +// review requests. +type TermsReviewRequestBuilder struct { + bitmap_ uint32 + accountUsername string + eventCode string + siteCode string + checkOptionalTerms bool +} + +// NewTermsReviewRequest creates a new builder of 'terms_review_request' objects. +func NewTermsReviewRequest() *TermsReviewRequestBuilder { + return &TermsReviewRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *TermsReviewRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AccountUsername sets the value of the 'account_username' attribute to the given value. +func (b *TermsReviewRequestBuilder) AccountUsername(value string) *TermsReviewRequestBuilder { + b.accountUsername = value + b.bitmap_ |= 1 + return b +} + +// CheckOptionalTerms sets the value of the 'check_optional_terms' attribute to the given value. +func (b *TermsReviewRequestBuilder) CheckOptionalTerms(value bool) *TermsReviewRequestBuilder { + b.checkOptionalTerms = value + b.bitmap_ |= 2 + return b +} + +// EventCode sets the value of the 'event_code' attribute to the given value. +func (b *TermsReviewRequestBuilder) EventCode(value string) *TermsReviewRequestBuilder { + b.eventCode = value + b.bitmap_ |= 4 + return b +} + +// SiteCode sets the value of the 'site_code' attribute to the given value. +func (b *TermsReviewRequestBuilder) SiteCode(value string) *TermsReviewRequestBuilder { + b.siteCode = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *TermsReviewRequestBuilder) Copy(object *TermsReviewRequest) *TermsReviewRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.accountUsername = object.accountUsername + b.checkOptionalTerms = object.checkOptionalTerms + b.eventCode = object.eventCode + b.siteCode = object.siteCode + return b +} + +// Build creates a 'terms_review_request' object using the configuration stored in the builder. +func (b *TermsReviewRequestBuilder) Build() (object *TermsReviewRequest, err error) { + object = new(TermsReviewRequest) + object.bitmap_ = b.bitmap_ + object.accountUsername = b.accountUsername + object.checkOptionalTerms = b.checkOptionalTerms + object.eventCode = b.eventCode + object.siteCode = b.siteCode + return +} diff --git a/clientapi/authorizations/v1/terms_review_request_list_builder.go b/clientapi/authorizations/v1/terms_review_request_list_builder.go new file mode 100644 index 00000000..c91df32d --- /dev/null +++ b/clientapi/authorizations/v1/terms_review_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// TermsReviewRequestListBuilder contains the data and logic needed to build +// 'terms_review_request' objects. +type TermsReviewRequestListBuilder struct { + items []*TermsReviewRequestBuilder +} + +// NewTermsReviewRequestList creates a new builder of 'terms_review_request' objects. +func NewTermsReviewRequestList() *TermsReviewRequestListBuilder { + return new(TermsReviewRequestListBuilder) +} + +// Items sets the items of the list. +func (b *TermsReviewRequestListBuilder) Items(values ...*TermsReviewRequestBuilder) *TermsReviewRequestListBuilder { + b.items = make([]*TermsReviewRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *TermsReviewRequestListBuilder) 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 *TermsReviewRequestListBuilder) Copy(list *TermsReviewRequestList) *TermsReviewRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*TermsReviewRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewTermsReviewRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'terms_review_request' objects using the +// configuration stored in the builder. +func (b *TermsReviewRequestListBuilder) Build() (list *TermsReviewRequestList, err error) { + items := make([]*TermsReviewRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(TermsReviewRequestList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/terms_review_request_list_type_json.go b/clientapi/authorizations/v1/terms_review_request_list_type_json.go new file mode 100644 index 00000000..064e686c --- /dev/null +++ b/clientapi/authorizations/v1/terms_review_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTermsReviewRequestList writes a list of values of the 'terms_review_request' type to +// the given writer. +func MarshalTermsReviewRequestList(list []*TermsReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTermsReviewRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTermsReviewRequestList writes a list of value of the 'terms_review_request' type to +// the given stream. +func WriteTermsReviewRequestList(list []*TermsReviewRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteTermsReviewRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalTermsReviewRequestList reads a list of values of the 'terms_review_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalTermsReviewRequestList(source interface{}) (items []*TermsReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadTermsReviewRequestList(iterator) + err = iterator.Error + return +} + +// ReadTermsReviewRequestList reads list of values of the ”terms_review_request' type from +// the given iterator. +func ReadTermsReviewRequestList(iterator *jsoniter.Iterator) []*TermsReviewRequest { + list := []*TermsReviewRequest{} + for iterator.ReadArray() { + item := ReadTermsReviewRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/terms_review_request_type.go b/clientapi/authorizations/v1/terms_review_request_type.go new file mode 100644 index 00000000..197bc235 --- /dev/null +++ b/clientapi/authorizations/v1/terms_review_request_type.go @@ -0,0 +1,238 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// TermsReviewRequest represents the values of the 'terms_review_request' type. +// +// Representation of Red Hat's Terms and Conditions for using OpenShift Dedicated and Amazon Red Hat OpenShift [Terms] +// review requests. +type TermsReviewRequest struct { + bitmap_ uint32 + accountUsername string + eventCode string + siteCode string + checkOptionalTerms bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *TermsReviewRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AccountUsername returns the value of the 'account_username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the username of the account of which Terms is being reviewed. +func (o *TermsReviewRequest) AccountUsername() string { + if o != nil && o.bitmap_&1 != 0 { + return o.accountUsername + } + return "" +} + +// GetAccountUsername returns the value of the 'account_username' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the username of the account of which Terms is being reviewed. +func (o *TermsReviewRequest) GetAccountUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.accountUsername + } + return +} + +// CheckOptionalTerms returns the value of the 'check_optional_terms' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// If false, only `terms_required` will be checked +func (o *TermsReviewRequest) CheckOptionalTerms() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.checkOptionalTerms + } + return false +} + +// GetCheckOptionalTerms returns the value of the 'check_optional_terms' attribute and +// a flag indicating if the attribute has a value. +// +// If false, only `terms_required` will be checked +func (o *TermsReviewRequest) GetCheckOptionalTerms() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.checkOptionalTerms + } + return +} + +// EventCode returns the value of the 'event_code' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the event code of the terms being checked +func (o *TermsReviewRequest) EventCode() string { + if o != nil && o.bitmap_&4 != 0 { + return o.eventCode + } + return "" +} + +// GetEventCode returns the value of the 'event_code' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the event code of the terms being checked +func (o *TermsReviewRequest) GetEventCode() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.eventCode + } + return +} + +// SiteCode returns the value of the 'site_code' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the site code of the terms being checked +func (o *TermsReviewRequest) SiteCode() string { + if o != nil && o.bitmap_&8 != 0 { + return o.siteCode + } + return "" +} + +// GetSiteCode returns the value of the 'site_code' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the site code of the terms being checked +func (o *TermsReviewRequest) GetSiteCode() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.siteCode + } + return +} + +// TermsReviewRequestListKind is the name of the type used to represent list of objects of +// type 'terms_review_request'. +const TermsReviewRequestListKind = "TermsReviewRequestList" + +// TermsReviewRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'terms_review_request'. +const TermsReviewRequestListLinkKind = "TermsReviewRequestListLink" + +// TermsReviewRequestNilKind is the name of the type used to nil lists of objects of +// type 'terms_review_request'. +const TermsReviewRequestListNilKind = "TermsReviewRequestListNil" + +// TermsReviewRequestList is a list of values of the 'terms_review_request' type. +type TermsReviewRequestList struct { + href string + link bool + items []*TermsReviewRequest +} + +// Len returns the length of the list. +func (l *TermsReviewRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *TermsReviewRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *TermsReviewRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *TermsReviewRequestList) SetItems(items []*TermsReviewRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *TermsReviewRequestList) Items() []*TermsReviewRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *TermsReviewRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *TermsReviewRequestList) Get(i int) *TermsReviewRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *TermsReviewRequestList) Slice() []*TermsReviewRequest { + var slice []*TermsReviewRequest + if l == nil { + slice = make([]*TermsReviewRequest, 0) + } else { + slice = make([]*TermsReviewRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *TermsReviewRequestList) Each(f func(item *TermsReviewRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *TermsReviewRequestList) Range(f func(index int, item *TermsReviewRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/terms_review_request_type_json.go b/clientapi/authorizations/v1/terms_review_request_type_json.go new file mode 100644 index 00000000..de9f324b --- /dev/null +++ b/clientapi/authorizations/v1/terms_review_request_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTermsReviewRequest writes a value of the 'terms_review_request' type to the given writer. +func MarshalTermsReviewRequest(object *TermsReviewRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTermsReviewRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTermsReviewRequest writes a value of the 'terms_review_request' type to the given stream. +func WriteTermsReviewRequest(object *TermsReviewRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_username") + stream.WriteString(object.accountUsername) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("check_optional_terms") + stream.WriteBool(object.checkOptionalTerms) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("event_code") + stream.WriteString(object.eventCode) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("site_code") + stream.WriteString(object.siteCode) + } + stream.WriteObjectEnd() +} + +// UnmarshalTermsReviewRequest reads a value of the 'terms_review_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalTermsReviewRequest(source interface{}) (object *TermsReviewRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadTermsReviewRequest(iterator) + err = iterator.Error + return +} + +// ReadTermsReviewRequest reads a value of the 'terms_review_request' type from the given iterator. +func ReadTermsReviewRequest(iterator *jsoniter.Iterator) *TermsReviewRequest { + object := &TermsReviewRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "account_username": + value := iterator.ReadString() + object.accountUsername = value + object.bitmap_ |= 1 + case "check_optional_terms": + value := iterator.ReadBool() + object.checkOptionalTerms = value + object.bitmap_ |= 2 + case "event_code": + value := iterator.ReadString() + object.eventCode = value + object.bitmap_ |= 4 + case "site_code": + value := iterator.ReadString() + object.siteCode = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/authorizations/v1/terms_review_response_builder.go b/clientapi/authorizations/v1/terms_review_response_builder.go new file mode 100644 index 00000000..f889cff9 --- /dev/null +++ b/clientapi/authorizations/v1/terms_review_response_builder.go @@ -0,0 +1,104 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// TermsReviewResponseBuilder contains the data and logic needed to build 'terms_review_response' objects. +// +// Representation of Red Hat's Terms and Conditions for using OpenShift Dedicated and Amazon Red Hat OpenShift [Terms] +// review response. +type TermsReviewResponseBuilder struct { + bitmap_ uint32 + accountId string + organizationID string + redirectUrl string + termsAvailable bool + termsRequired bool +} + +// NewTermsReviewResponse creates a new builder of 'terms_review_response' objects. +func NewTermsReviewResponse() *TermsReviewResponseBuilder { + return &TermsReviewResponseBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *TermsReviewResponseBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AccountId sets the value of the 'account_id' attribute to the given value. +func (b *TermsReviewResponseBuilder) AccountId(value string) *TermsReviewResponseBuilder { + b.accountId = value + b.bitmap_ |= 1 + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *TermsReviewResponseBuilder) OrganizationID(value string) *TermsReviewResponseBuilder { + b.organizationID = value + b.bitmap_ |= 2 + return b +} + +// RedirectUrl sets the value of the 'redirect_url' attribute to the given value. +func (b *TermsReviewResponseBuilder) RedirectUrl(value string) *TermsReviewResponseBuilder { + b.redirectUrl = value + b.bitmap_ |= 4 + return b +} + +// TermsAvailable sets the value of the 'terms_available' attribute to the given value. +func (b *TermsReviewResponseBuilder) TermsAvailable(value bool) *TermsReviewResponseBuilder { + b.termsAvailable = value + b.bitmap_ |= 8 + return b +} + +// TermsRequired sets the value of the 'terms_required' attribute to the given value. +func (b *TermsReviewResponseBuilder) TermsRequired(value bool) *TermsReviewResponseBuilder { + b.termsRequired = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *TermsReviewResponseBuilder) Copy(object *TermsReviewResponse) *TermsReviewResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.accountId = object.accountId + b.organizationID = object.organizationID + b.redirectUrl = object.redirectUrl + b.termsAvailable = object.termsAvailable + b.termsRequired = object.termsRequired + return b +} + +// Build creates a 'terms_review_response' object using the configuration stored in the builder. +func (b *TermsReviewResponseBuilder) Build() (object *TermsReviewResponse, err error) { + object = new(TermsReviewResponse) + object.bitmap_ = b.bitmap_ + object.accountId = b.accountId + object.organizationID = b.organizationID + object.redirectUrl = b.redirectUrl + object.termsAvailable = b.termsAvailable + object.termsRequired = b.termsRequired + return +} diff --git a/clientapi/authorizations/v1/terms_review_response_list_builder.go b/clientapi/authorizations/v1/terms_review_response_list_builder.go new file mode 100644 index 00000000..b2ca9e99 --- /dev/null +++ b/clientapi/authorizations/v1/terms_review_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// TermsReviewResponseListBuilder contains the data and logic needed to build +// 'terms_review_response' objects. +type TermsReviewResponseListBuilder struct { + items []*TermsReviewResponseBuilder +} + +// NewTermsReviewResponseList creates a new builder of 'terms_review_response' objects. +func NewTermsReviewResponseList() *TermsReviewResponseListBuilder { + return new(TermsReviewResponseListBuilder) +} + +// Items sets the items of the list. +func (b *TermsReviewResponseListBuilder) Items(values ...*TermsReviewResponseBuilder) *TermsReviewResponseListBuilder { + b.items = make([]*TermsReviewResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *TermsReviewResponseListBuilder) 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 *TermsReviewResponseListBuilder) Copy(list *TermsReviewResponseList) *TermsReviewResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*TermsReviewResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewTermsReviewResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'terms_review_response' objects using the +// configuration stored in the builder. +func (b *TermsReviewResponseListBuilder) Build() (list *TermsReviewResponseList, err error) { + items := make([]*TermsReviewResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(TermsReviewResponseList) + list.items = items + return +} diff --git a/clientapi/authorizations/v1/terms_review_response_list_type_json.go b/clientapi/authorizations/v1/terms_review_response_list_type_json.go new file mode 100644 index 00000000..b7638129 --- /dev/null +++ b/clientapi/authorizations/v1/terms_review_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTermsReviewResponseList writes a list of values of the 'terms_review_response' type to +// the given writer. +func MarshalTermsReviewResponseList(list []*TermsReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTermsReviewResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTermsReviewResponseList writes a list of value of the 'terms_review_response' type to +// the given stream. +func WriteTermsReviewResponseList(list []*TermsReviewResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteTermsReviewResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalTermsReviewResponseList reads a list of values of the 'terms_review_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalTermsReviewResponseList(source interface{}) (items []*TermsReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadTermsReviewResponseList(iterator) + err = iterator.Error + return +} + +// ReadTermsReviewResponseList reads list of values of the ”terms_review_response' type from +// the given iterator. +func ReadTermsReviewResponseList(iterator *jsoniter.Iterator) []*TermsReviewResponse { + list := []*TermsReviewResponse{} + for iterator.ReadArray() { + item := ReadTermsReviewResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/authorizations/v1/terms_review_response_type.go b/clientapi/authorizations/v1/terms_review_response_type.go new file mode 100644 index 00000000..7ea2c0d1 --- /dev/null +++ b/clientapi/authorizations/v1/terms_review_response_type.go @@ -0,0 +1,264 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +// TermsReviewResponse represents the values of the 'terms_review_response' type. +// +// Representation of Red Hat's Terms and Conditions for using OpenShift Dedicated and Amazon Red Hat OpenShift [Terms] +// review response. +type TermsReviewResponse struct { + bitmap_ uint32 + accountId string + organizationID string + redirectUrl string + termsAvailable bool + termsRequired bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *TermsReviewResponse) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AccountId returns the value of the 'account_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Account ID of requesting user. +func (o *TermsReviewResponse) AccountId() string { + if o != nil && o.bitmap_&1 != 0 { + return o.accountId + } + return "" +} + +// GetAccountId returns the value of the 'account_id' attribute and +// a flag indicating if the attribute has a value. +// +// Account ID of requesting user. +func (o *TermsReviewResponse) GetAccountId() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.accountId + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates which Organization the user belongs to. +func (o *TermsReviewResponse) OrganizationID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates which Organization the user belongs to. +func (o *TermsReviewResponse) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.organizationID + } + return +} + +// RedirectUrl returns the value of the 'redirect_url' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional URL to Red Hat's Terms and Conditions Application if the user has either required or available Terms +// needs to acknowledge. +func (o *TermsReviewResponse) RedirectUrl() string { + if o != nil && o.bitmap_&4 != 0 { + return o.redirectUrl + } + return "" +} + +// GetRedirectUrl returns the value of the 'redirect_url' attribute and +// a flag indicating if the attribute has a value. +// +// Optional URL to Red Hat's Terms and Conditions Application if the user has either required or available Terms +// needs to acknowledge. +func (o *TermsReviewResponse) GetRedirectUrl() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.redirectUrl + } + return +} + +// TermsAvailable returns the value of the 'terms_available' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines whether Terms are available. +func (o *TermsReviewResponse) TermsAvailable() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.termsAvailable + } + return false +} + +// GetTermsAvailable returns the value of the 'terms_available' attribute and +// a flag indicating if the attribute has a value. +// +// Defines whether Terms are available. +func (o *TermsReviewResponse) GetTermsAvailable() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.termsAvailable + } + return +} + +// TermsRequired returns the value of the 'terms_required' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines whether user is required to accept Terms before using OpenShift Dedicated and Amazon Red Hat OpenShift. +func (o *TermsReviewResponse) TermsRequired() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.termsRequired + } + return false +} + +// GetTermsRequired returns the value of the 'terms_required' attribute and +// a flag indicating if the attribute has a value. +// +// Defines whether user is required to accept Terms before using OpenShift Dedicated and Amazon Red Hat OpenShift. +func (o *TermsReviewResponse) GetTermsRequired() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.termsRequired + } + return +} + +// TermsReviewResponseListKind is the name of the type used to represent list of objects of +// type 'terms_review_response'. +const TermsReviewResponseListKind = "TermsReviewResponseList" + +// TermsReviewResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'terms_review_response'. +const TermsReviewResponseListLinkKind = "TermsReviewResponseListLink" + +// TermsReviewResponseNilKind is the name of the type used to nil lists of objects of +// type 'terms_review_response'. +const TermsReviewResponseListNilKind = "TermsReviewResponseListNil" + +// TermsReviewResponseList is a list of values of the 'terms_review_response' type. +type TermsReviewResponseList struct { + href string + link bool + items []*TermsReviewResponse +} + +// Len returns the length of the list. +func (l *TermsReviewResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *TermsReviewResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *TermsReviewResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *TermsReviewResponseList) SetItems(items []*TermsReviewResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *TermsReviewResponseList) Items() []*TermsReviewResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *TermsReviewResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *TermsReviewResponseList) Get(i int) *TermsReviewResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *TermsReviewResponseList) Slice() []*TermsReviewResponse { + var slice []*TermsReviewResponse + if l == nil { + slice = make([]*TermsReviewResponse, 0) + } else { + slice = make([]*TermsReviewResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *TermsReviewResponseList) Each(f func(item *TermsReviewResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *TermsReviewResponseList) Range(f func(index int, item *TermsReviewResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/authorizations/v1/terms_review_response_type_json.go b/clientapi/authorizations/v1/terms_review_response_type_json.go new file mode 100644 index 00000000..927d186a --- /dev/null +++ b/clientapi/authorizations/v1/terms_review_response_type_json.go @@ -0,0 +1,138 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/authorizations/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTermsReviewResponse writes a value of the 'terms_review_response' type to the given writer. +func MarshalTermsReviewResponse(object *TermsReviewResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTermsReviewResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTermsReviewResponse writes a value of the 'terms_review_response' type to the given stream. +func WriteTermsReviewResponse(object *TermsReviewResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_id") + stream.WriteString(object.accountId) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("redirect_url") + stream.WriteString(object.redirectUrl) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("terms_available") + stream.WriteBool(object.termsAvailable) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("terms_required") + stream.WriteBool(object.termsRequired) + } + stream.WriteObjectEnd() +} + +// UnmarshalTermsReviewResponse reads a value of the 'terms_review_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalTermsReviewResponse(source interface{}) (object *TermsReviewResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadTermsReviewResponse(iterator) + err = iterator.Error + return +} + +// ReadTermsReviewResponse reads a value of the 'terms_review_response' type from the given iterator. +func ReadTermsReviewResponse(iterator *jsoniter.Iterator) *TermsReviewResponse { + object := &TermsReviewResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "account_id": + value := iterator.ReadString() + object.accountId = value + object.bitmap_ |= 1 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 2 + case "redirect_url": + value := iterator.ReadString() + object.redirectUrl = value + object.bitmap_ |= 4 + case "terms_available": + value := iterator.ReadBool() + object.termsAvailable = value + object.bitmap_ |= 8 + case "terms_required": + value := iterator.ReadBool() + object.termsRequired = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_builder.go b/clientapi/clustersmgmt/v1/add_on_builder.go new file mode 100644 index 00000000..89ed5292 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_builder.go @@ -0,0 +1,447 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnBuilder contains the data and logic needed to build 'add_on' objects. +// +// Representation of an add-on that can be installed in a cluster. +type AddOnBuilder struct { + bitmap_ uint32 + id string + href string + commonAnnotations map[string]string + commonLabels map[string]string + config *AddOnConfigBuilder + credentialsRequests []*CredentialRequestBuilder + description string + docsLink string + icon string + installMode AddOnInstallMode + label string + name string + namespaces []*AddOnNamespaceBuilder + operatorName string + parameters *AddOnParameterListBuilder + requirements []*AddOnRequirementBuilder + resourceCost float64 + resourceName string + subOperators []*AddOnSubOperatorBuilder + targetNamespace string + version *AddOnVersionBuilder + enabled bool + hasExternalResources bool + hidden bool + managedService bool +} + +// NewAddOn creates a new builder of 'add_on' objects. +func NewAddOn() *AddOnBuilder { + return &AddOnBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddOnBuilder) Link(value bool) *AddOnBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddOnBuilder) ID(value string) *AddOnBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddOnBuilder) HREF(value string) *AddOnBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CommonAnnotations sets the value of the 'common_annotations' attribute to the given value. +func (b *AddOnBuilder) CommonAnnotations(value map[string]string) *AddOnBuilder { + b.commonAnnotations = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// CommonLabels sets the value of the 'common_labels' attribute to the given value. +func (b *AddOnBuilder) CommonLabels(value map[string]string) *AddOnBuilder { + b.commonLabels = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Config sets the value of the 'config' attribute to the given value. +// +// Representation of an add-on config. +// The attributes under it are to be used by the addon once its installed in the cluster. +func (b *AddOnBuilder) Config(value *AddOnConfigBuilder) *AddOnBuilder { + b.config = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// CredentialsRequests sets the value of the 'credentials_requests' attribute to the given values. +func (b *AddOnBuilder) CredentialsRequests(values ...*CredentialRequestBuilder) *AddOnBuilder { + b.credentialsRequests = make([]*CredentialRequestBuilder, len(values)) + copy(b.credentialsRequests, values) + b.bitmap_ |= 64 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *AddOnBuilder) Description(value string) *AddOnBuilder { + b.description = value + b.bitmap_ |= 128 + return b +} + +// DocsLink sets the value of the 'docs_link' attribute to the given value. +func (b *AddOnBuilder) DocsLink(value string) *AddOnBuilder { + b.docsLink = value + b.bitmap_ |= 256 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddOnBuilder) Enabled(value bool) *AddOnBuilder { + b.enabled = value + b.bitmap_ |= 512 + return b +} + +// HasExternalResources sets the value of the 'has_external_resources' attribute to the given value. +func (b *AddOnBuilder) HasExternalResources(value bool) *AddOnBuilder { + b.hasExternalResources = value + b.bitmap_ |= 1024 + return b +} + +// Hidden sets the value of the 'hidden' attribute to the given value. +func (b *AddOnBuilder) Hidden(value bool) *AddOnBuilder { + b.hidden = value + b.bitmap_ |= 2048 + return b +} + +// Icon sets the value of the 'icon' attribute to the given value. +func (b *AddOnBuilder) Icon(value string) *AddOnBuilder { + b.icon = value + b.bitmap_ |= 4096 + return b +} + +// InstallMode sets the value of the 'install_mode' attribute to the given value. +// +// Representation of an add-on InstallMode field. +func (b *AddOnBuilder) InstallMode(value AddOnInstallMode) *AddOnBuilder { + b.installMode = value + b.bitmap_ |= 8192 + return b +} + +// Label sets the value of the 'label' attribute to the given value. +func (b *AddOnBuilder) Label(value string) *AddOnBuilder { + b.label = value + b.bitmap_ |= 16384 + return b +} + +// ManagedService sets the value of the 'managed_service' attribute to the given value. +func (b *AddOnBuilder) ManagedService(value bool) *AddOnBuilder { + b.managedService = value + b.bitmap_ |= 32768 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AddOnBuilder) Name(value string) *AddOnBuilder { + b.name = value + b.bitmap_ |= 65536 + return b +} + +// Namespaces sets the value of the 'namespaces' attribute to the given values. +func (b *AddOnBuilder) Namespaces(values ...*AddOnNamespaceBuilder) *AddOnBuilder { + b.namespaces = make([]*AddOnNamespaceBuilder, len(values)) + copy(b.namespaces, values) + b.bitmap_ |= 131072 + return b +} + +// OperatorName sets the value of the 'operator_name' attribute to the given value. +func (b *AddOnBuilder) OperatorName(value string) *AddOnBuilder { + b.operatorName = value + b.bitmap_ |= 262144 + return b +} + +// Parameters sets the value of the 'parameters' attribute to the given values. +func (b *AddOnBuilder) Parameters(value *AddOnParameterListBuilder) *AddOnBuilder { + b.parameters = value + b.bitmap_ |= 524288 + return b +} + +// Requirements sets the value of the 'requirements' attribute to the given values. +func (b *AddOnBuilder) Requirements(values ...*AddOnRequirementBuilder) *AddOnBuilder { + b.requirements = make([]*AddOnRequirementBuilder, len(values)) + copy(b.requirements, values) + b.bitmap_ |= 1048576 + return b +} + +// ResourceCost sets the value of the 'resource_cost' attribute to the given value. +func (b *AddOnBuilder) ResourceCost(value float64) *AddOnBuilder { + b.resourceCost = value + b.bitmap_ |= 2097152 + return b +} + +// ResourceName sets the value of the 'resource_name' attribute to the given value. +func (b *AddOnBuilder) ResourceName(value string) *AddOnBuilder { + b.resourceName = value + b.bitmap_ |= 4194304 + return b +} + +// SubOperators sets the value of the 'sub_operators' attribute to the given values. +func (b *AddOnBuilder) SubOperators(values ...*AddOnSubOperatorBuilder) *AddOnBuilder { + b.subOperators = make([]*AddOnSubOperatorBuilder, len(values)) + copy(b.subOperators, values) + b.bitmap_ |= 8388608 + return b +} + +// TargetNamespace sets the value of the 'target_namespace' attribute to the given value. +func (b *AddOnBuilder) TargetNamespace(value string) *AddOnBuilder { + b.targetNamespace = value + b.bitmap_ |= 16777216 + return b +} + +// Version sets the value of the 'version' attribute to the given value. +// +// Representation of an add-on version. +func (b *AddOnBuilder) Version(value *AddOnVersionBuilder) *AddOnBuilder { + b.version = value + if value != nil { + b.bitmap_ |= 33554432 + } else { + b.bitmap_ &^= 33554432 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddOnBuilder) Copy(object *AddOn) *AddOnBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if len(object.commonAnnotations) > 0 { + b.commonAnnotations = map[string]string{} + for k, v := range object.commonAnnotations { + b.commonAnnotations[k] = v + } + } else { + b.commonAnnotations = nil + } + if len(object.commonLabels) > 0 { + b.commonLabels = map[string]string{} + for k, v := range object.commonLabels { + b.commonLabels[k] = v + } + } else { + b.commonLabels = nil + } + if object.config != nil { + b.config = NewAddOnConfig().Copy(object.config) + } else { + b.config = nil + } + if object.credentialsRequests != nil { + b.credentialsRequests = make([]*CredentialRequestBuilder, len(object.credentialsRequests)) + for i, v := range object.credentialsRequests { + b.credentialsRequests[i] = NewCredentialRequest().Copy(v) + } + } else { + b.credentialsRequests = nil + } + b.description = object.description + b.docsLink = object.docsLink + b.enabled = object.enabled + b.hasExternalResources = object.hasExternalResources + b.hidden = object.hidden + b.icon = object.icon + b.installMode = object.installMode + b.label = object.label + b.managedService = object.managedService + b.name = object.name + if object.namespaces != nil { + b.namespaces = make([]*AddOnNamespaceBuilder, len(object.namespaces)) + for i, v := range object.namespaces { + b.namespaces[i] = NewAddOnNamespace().Copy(v) + } + } else { + b.namespaces = nil + } + b.operatorName = object.operatorName + if object.parameters != nil { + b.parameters = NewAddOnParameterList().Copy(object.parameters) + } else { + b.parameters = nil + } + if object.requirements != nil { + b.requirements = make([]*AddOnRequirementBuilder, len(object.requirements)) + for i, v := range object.requirements { + b.requirements[i] = NewAddOnRequirement().Copy(v) + } + } else { + b.requirements = nil + } + b.resourceCost = object.resourceCost + b.resourceName = object.resourceName + if object.subOperators != nil { + b.subOperators = make([]*AddOnSubOperatorBuilder, len(object.subOperators)) + for i, v := range object.subOperators { + b.subOperators[i] = NewAddOnSubOperator().Copy(v) + } + } else { + b.subOperators = nil + } + b.targetNamespace = object.targetNamespace + if object.version != nil { + b.version = NewAddOnVersion().Copy(object.version) + } else { + b.version = nil + } + return b +} + +// Build creates a 'add_on' object using the configuration stored in the builder. +func (b *AddOnBuilder) Build() (object *AddOn, err error) { + object = new(AddOn) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.commonAnnotations != nil { + object.commonAnnotations = make(map[string]string) + for k, v := range b.commonAnnotations { + object.commonAnnotations[k] = v + } + } + if b.commonLabels != nil { + object.commonLabels = make(map[string]string) + for k, v := range b.commonLabels { + object.commonLabels[k] = v + } + } + if b.config != nil { + object.config, err = b.config.Build() + if err != nil { + return + } + } + if b.credentialsRequests != nil { + object.credentialsRequests = make([]*CredentialRequest, len(b.credentialsRequests)) + for i, v := range b.credentialsRequests { + object.credentialsRequests[i], err = v.Build() + if err != nil { + return + } + } + } + object.description = b.description + object.docsLink = b.docsLink + object.enabled = b.enabled + object.hasExternalResources = b.hasExternalResources + object.hidden = b.hidden + object.icon = b.icon + object.installMode = b.installMode + object.label = b.label + object.managedService = b.managedService + object.name = b.name + if b.namespaces != nil { + object.namespaces = make([]*AddOnNamespace, len(b.namespaces)) + for i, v := range b.namespaces { + object.namespaces[i], err = v.Build() + if err != nil { + return + } + } + } + object.operatorName = b.operatorName + if b.parameters != nil { + object.parameters, err = b.parameters.Build() + if err != nil { + return + } + } + if b.requirements != nil { + object.requirements = make([]*AddOnRequirement, len(b.requirements)) + for i, v := range b.requirements { + object.requirements[i], err = v.Build() + if err != nil { + return + } + } + } + object.resourceCost = b.resourceCost + object.resourceName = b.resourceName + if b.subOperators != nil { + object.subOperators = make([]*AddOnSubOperator, len(b.subOperators)) + for i, v := range b.subOperators { + object.subOperators[i], err = v.Build() + if err != nil { + return + } + } + } + object.targetNamespace = b.targetNamespace + if b.version != nil { + object.version, err = b.version.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_config_builder.go b/clientapi/clustersmgmt/v1/add_on_config_builder.go new file mode 100644 index 00000000..6a3b7abc --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_config_builder.go @@ -0,0 +1,132 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnConfigBuilder contains the data and logic needed to build 'add_on_config' objects. +// +// 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 { + bitmap_ uint32 + id string + href string + addOnEnvironmentVariables []*AddOnEnvironmentVariableBuilder + secretPropagations []*AddOnSecretPropagationBuilder +} + +// NewAddOnConfig creates a new builder of 'add_on_config' objects. +func NewAddOnConfig() *AddOnConfigBuilder { + return &AddOnConfigBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddOnConfigBuilder) Link(value bool) *AddOnConfigBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddOnConfigBuilder) ID(value string) *AddOnConfigBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddOnConfigBuilder) HREF(value string) *AddOnConfigBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnConfigBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AddOnEnvironmentVariables sets the value of the 'add_on_environment_variables' attribute to the given values. +func (b *AddOnConfigBuilder) AddOnEnvironmentVariables(values ...*AddOnEnvironmentVariableBuilder) *AddOnConfigBuilder { + b.addOnEnvironmentVariables = make([]*AddOnEnvironmentVariableBuilder, len(values)) + copy(b.addOnEnvironmentVariables, values) + b.bitmap_ |= 8 + return b +} + +// SecretPropagations sets the value of the 'secret_propagations' attribute to the given values. +func (b *AddOnConfigBuilder) SecretPropagations(values ...*AddOnSecretPropagationBuilder) *AddOnConfigBuilder { + b.secretPropagations = make([]*AddOnSecretPropagationBuilder, len(values)) + copy(b.secretPropagations, values) + b.bitmap_ |= 16 + 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 + } + b.bitmap_ = object.bitmap_ + 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 + object.bitmap_ = b.bitmap_ + 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 +} diff --git a/clientapi/clustersmgmt/v1/add_on_config_list_builder.go b/clientapi/clustersmgmt/v1/add_on_config_list_builder.go new file mode 100644 index 00000000..3da33bc7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_config_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// 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 +} diff --git a/clientapi/clustersmgmt/v1/add_on_config_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_config_list_type_json.go new file mode 100644 index 00000000..4bc07a27 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_config_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +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 +} diff --git a/clientapi/clustersmgmt/v1/add_on_config_type.go b/clientapi/clustersmgmt/v1/add_on_config_type.go new file mode 100644 index 00000000..3e2603b7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_config_type.go @@ -0,0 +1,290 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnConfigKind is the name of the type used to represent objects +// of type 'add_on_config'. +const AddOnConfigKind = "AddOnConfig" + +// AddOnConfigLinkKind is the name of the type used to represent links +// to objects of type 'add_on_config'. +const AddOnConfigLinkKind = "AddOnConfigLink" + +// AddOnConfigNilKind is the name of the type used to nil references +// to objects of type 'add_on_config'. +const AddOnConfigNilKind = "AddOnConfigNil" + +// AddOnConfig represents the values of the 'add_on_config' type. +// +// Representation of an add-on config. +// The attributes under it are to be used by the addon once its installed in the cluster. +type AddOnConfig struct { + bitmap_ uint32 + id string + href string + addOnEnvironmentVariables []*AddOnEnvironmentVariable + secretPropagations []*AddOnSecretPropagation +} + +// Kind returns the name of the type of the object. +func (o *AddOnConfig) Kind() string { + if o == nil { + return AddOnConfigNilKind + } + if o.bitmap_&1 != 0 { + return AddOnConfigLinkKind + } + return AddOnConfigKind +} + +// Link returns true if this is a link. +func (o *AddOnConfig) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddOnConfig) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddOnConfig) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddOnConfig) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddOnConfig) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOnConfig) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AddOnEnvironmentVariables returns the value of the 'add_on_environment_variables' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of environment variables for the addon +func (o *AddOnConfig) AddOnEnvironmentVariables() []*AddOnEnvironmentVariable { + if o != nil && o.bitmap_&8 != 0 { + return o.addOnEnvironmentVariables + } + return nil +} + +// GetAddOnEnvironmentVariables returns the value of the 'add_on_environment_variables' attribute and +// a flag indicating if the attribute has a value. +// +// List of environment variables for the addon +func (o *AddOnConfig) GetAddOnEnvironmentVariables() (value []*AddOnEnvironmentVariable, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.addOnEnvironmentVariables + } + return +} + +// SecretPropagations returns the value of the 'secret_propagations' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of secret propagations for the addon +func (o *AddOnConfig) SecretPropagations() []*AddOnSecretPropagation { + if o != nil && o.bitmap_&16 != 0 { + return o.secretPropagations + } + return nil +} + +// GetSecretPropagations returns the value of the 'secret_propagations' attribute and +// a flag indicating if the attribute has a value. +// +// List of secret propagations for the addon +func (o *AddOnConfig) GetSecretPropagations() (value []*AddOnSecretPropagation, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.secretPropagations + } + return +} + +// AddOnConfigListKind is the name of the type used to represent list of objects of +// type 'add_on_config'. +const AddOnConfigListKind = "AddOnConfigList" + +// AddOnConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on_config'. +const AddOnConfigListLinkKind = "AddOnConfigListLink" + +// AddOnConfigNilKind is the name of the type used to nil lists of objects of +// type 'add_on_config'. +const AddOnConfigListNilKind = "AddOnConfigListNil" + +// AddOnConfigList is a list of values of the 'add_on_config' type. +type AddOnConfigList struct { + href string + link bool + items []*AddOnConfig +} + +// Kind returns the name of the type of the object. +func (l *AddOnConfigList) Kind() string { + if l == nil { + return AddOnConfigListNilKind + } + if l.link { + return AddOnConfigListLinkKind + } + return AddOnConfigListKind +} + +// Link returns true iif this is a link. +func (l *AddOnConfigList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddOnConfigList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddOnConfigList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddOnConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnConfigList) SetItems(items []*AddOnConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnConfigList) Items() []*AddOnConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnConfigList) Get(i int) *AddOnConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnConfigList) Slice() []*AddOnConfig { + var slice []*AddOnConfig + if l == nil { + slice = make([]*AddOnConfig, 0) + } else { + slice = make([]*AddOnConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnConfigList) Each(f func(item *AddOnConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnConfigList) Range(f func(index int, item *AddOnConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_config_type_json.go b/clientapi/clustersmgmt/v1/add_on_config_type_json.go new file mode 100644 index 00000000..dda2ea05 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_config_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnConfig writes a value of the 'add_on_config' type to the given writer. +func MarshalAddOnConfig(object *AddOnConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnConfig writes a value of the 'add_on_config' type to the given stream. +func WriteAddOnConfig(object *AddOnConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddOnConfigLinkKind) + } else { + stream.WriteString(AddOnConfigKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.addOnEnvironmentVariables != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("add_on_environment_variables") + WriteAddOnEnvironmentVariableList(object.addOnEnvironmentVariables, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.secretPropagations != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("secret_propagations") + WriteAddOnSecretPropagationList(object.secretPropagations, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOnConfig reads a value of the 'add_on_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOnConfig(source interface{}) (object *AddOnConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOnConfig(iterator) + err = iterator.Error + return +} + +// ReadAddOnConfig reads a value of the 'add_on_config' type from the given iterator. +func ReadAddOnConfig(iterator *jsoniter.Iterator) *AddOnConfig { + object := &AddOnConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddOnConfigLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "add_on_environment_variables": + value := ReadAddOnEnvironmentVariableList(iterator) + object.addOnEnvironmentVariables = value + object.bitmap_ |= 8 + case "secret_propagations": + value := ReadAddOnSecretPropagationList(iterator) + object.secretPropagations = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_environment_variable_builder.go b/clientapi/clustersmgmt/v1/add_on_environment_variable_builder.go new file mode 100644 index 00000000..1496e004 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_environment_variable_builder.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnEnvironmentVariableBuilder contains the data and logic needed to build 'add_on_environment_variable' objects. +// +// Representation of an add-on env object. +type AddOnEnvironmentVariableBuilder struct { + bitmap_ uint32 + id string + href string + name string + value string +} + +// NewAddOnEnvironmentVariable creates a new builder of 'add_on_environment_variable' objects. +func NewAddOnEnvironmentVariable() *AddOnEnvironmentVariableBuilder { + return &AddOnEnvironmentVariableBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddOnEnvironmentVariableBuilder) Link(value bool) *AddOnEnvironmentVariableBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddOnEnvironmentVariableBuilder) ID(value string) *AddOnEnvironmentVariableBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddOnEnvironmentVariableBuilder) HREF(value string) *AddOnEnvironmentVariableBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnEnvironmentVariableBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AddOnEnvironmentVariableBuilder) Name(value string) *AddOnEnvironmentVariableBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *AddOnEnvironmentVariableBuilder) Value(value string) *AddOnEnvironmentVariableBuilder { + b.value = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddOnEnvironmentVariableBuilder) Copy(object *AddOnEnvironmentVariable) *AddOnEnvironmentVariableBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.name = object.name + b.value = object.value + return b +} + +// Build creates a 'add_on_environment_variable' object using the configuration stored in the builder. +func (b *AddOnEnvironmentVariableBuilder) Build() (object *AddOnEnvironmentVariable, err error) { + object = new(AddOnEnvironmentVariable) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.name = b.name + object.value = b.value + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_environment_variable_list_builder.go b/clientapi/clustersmgmt/v1/add_on_environment_variable_list_builder.go new file mode 100644 index 00000000..fc41468a --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_environment_variable_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnEnvironmentVariableListBuilder contains the data and logic needed to build +// 'add_on_environment_variable' objects. +type AddOnEnvironmentVariableListBuilder struct { + items []*AddOnEnvironmentVariableBuilder +} + +// NewAddOnEnvironmentVariableList creates a new builder of 'add_on_environment_variable' objects. +func NewAddOnEnvironmentVariableList() *AddOnEnvironmentVariableListBuilder { + return new(AddOnEnvironmentVariableListBuilder) +} + +// Items sets the items of the list. +func (b *AddOnEnvironmentVariableListBuilder) Items(values ...*AddOnEnvironmentVariableBuilder) *AddOnEnvironmentVariableListBuilder { + b.items = make([]*AddOnEnvironmentVariableBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddOnEnvironmentVariableListBuilder) 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 *AddOnEnvironmentVariableListBuilder) Copy(list *AddOnEnvironmentVariableList) *AddOnEnvironmentVariableListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddOnEnvironmentVariableBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddOnEnvironmentVariable().Copy(v) + } + } + return b +} + +// Build creates a list of 'add_on_environment_variable' objects using the +// configuration stored in the builder. +func (b *AddOnEnvironmentVariableListBuilder) Build() (list *AddOnEnvironmentVariableList, err error) { + items := make([]*AddOnEnvironmentVariable, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddOnEnvironmentVariableList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_environment_variable_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_environment_variable_list_type_json.go new file mode 100644 index 00000000..b0e54a32 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_environment_variable_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnEnvironmentVariableList writes a list of values of the 'add_on_environment_variable' type to +// the given writer. +func MarshalAddOnEnvironmentVariableList(list []*AddOnEnvironmentVariable, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnEnvironmentVariableList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnEnvironmentVariableList writes a list of value of the 'add_on_environment_variable' type to +// the given stream. +func WriteAddOnEnvironmentVariableList(list []*AddOnEnvironmentVariable, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddOnEnvironmentVariable(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnEnvironmentVariableList reads a list of values of the 'add_on_environment_variable' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnEnvironmentVariableList(source interface{}) (items []*AddOnEnvironmentVariable, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnEnvironmentVariableList(iterator) + err = iterator.Error + return +} + +// ReadAddOnEnvironmentVariableList reads list of values of the ”add_on_environment_variable' type from +// the given iterator. +func ReadAddOnEnvironmentVariableList(iterator *jsoniter.Iterator) []*AddOnEnvironmentVariable { + list := []*AddOnEnvironmentVariable{} + for iterator.ReadArray() { + item := ReadAddOnEnvironmentVariable(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_environment_variable_type.go b/clientapi/clustersmgmt/v1/add_on_environment_variable_type.go new file mode 100644 index 00000000..f4122d31 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_environment_variable_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnEnvironmentVariableKind is the name of the type used to represent objects +// of type 'add_on_environment_variable'. +const AddOnEnvironmentVariableKind = "AddOnEnvironmentVariable" + +// AddOnEnvironmentVariableLinkKind is the name of the type used to represent links +// to objects of type 'add_on_environment_variable'. +const AddOnEnvironmentVariableLinkKind = "AddOnEnvironmentVariableLink" + +// AddOnEnvironmentVariableNilKind is the name of the type used to nil references +// to objects of type 'add_on_environment_variable'. +const AddOnEnvironmentVariableNilKind = "AddOnEnvironmentVariableNil" + +// AddOnEnvironmentVariable represents the values of the 'add_on_environment_variable' type. +// +// Representation of an add-on env object. +type AddOnEnvironmentVariable struct { + bitmap_ uint32 + id string + href string + name string + value string +} + +// Kind returns the name of the type of the object. +func (o *AddOnEnvironmentVariable) Kind() string { + if o == nil { + return AddOnEnvironmentVariableNilKind + } + if o.bitmap_&1 != 0 { + return AddOnEnvironmentVariableLinkKind + } + return AddOnEnvironmentVariableKind +} + +// Link returns true if this is a link. +func (o *AddOnEnvironmentVariable) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddOnEnvironmentVariable) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddOnEnvironmentVariable) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddOnEnvironmentVariable) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddOnEnvironmentVariable) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOnEnvironmentVariable) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the env object. +func (o *AddOnEnvironmentVariable) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the env object. +func (o *AddOnEnvironmentVariable) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Value of the env object. +func (o *AddOnEnvironmentVariable) Value() string { + if o != nil && o.bitmap_&16 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Value of the env object. +func (o *AddOnEnvironmentVariable) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.value + } + return +} + +// AddOnEnvironmentVariableListKind is the name of the type used to represent list of objects of +// type 'add_on_environment_variable'. +const AddOnEnvironmentVariableListKind = "AddOnEnvironmentVariableList" + +// AddOnEnvironmentVariableListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on_environment_variable'. +const AddOnEnvironmentVariableListLinkKind = "AddOnEnvironmentVariableListLink" + +// AddOnEnvironmentVariableNilKind is the name of the type used to nil lists of objects of +// type 'add_on_environment_variable'. +const AddOnEnvironmentVariableListNilKind = "AddOnEnvironmentVariableListNil" + +// AddOnEnvironmentVariableList is a list of values of the 'add_on_environment_variable' type. +type AddOnEnvironmentVariableList struct { + href string + link bool + items []*AddOnEnvironmentVariable +} + +// Kind returns the name of the type of the object. +func (l *AddOnEnvironmentVariableList) Kind() string { + if l == nil { + return AddOnEnvironmentVariableListNilKind + } + if l.link { + return AddOnEnvironmentVariableListLinkKind + } + return AddOnEnvironmentVariableListKind +} + +// Link returns true iif this is a link. +func (l *AddOnEnvironmentVariableList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddOnEnvironmentVariableList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddOnEnvironmentVariableList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddOnEnvironmentVariableList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnEnvironmentVariableList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnEnvironmentVariableList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnEnvironmentVariableList) SetItems(items []*AddOnEnvironmentVariable) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnEnvironmentVariableList) Items() []*AddOnEnvironmentVariable { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnEnvironmentVariableList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnEnvironmentVariableList) Get(i int) *AddOnEnvironmentVariable { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnEnvironmentVariableList) Slice() []*AddOnEnvironmentVariable { + var slice []*AddOnEnvironmentVariable + if l == nil { + slice = make([]*AddOnEnvironmentVariable, 0) + } else { + slice = make([]*AddOnEnvironmentVariable, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnEnvironmentVariableList) Each(f func(item *AddOnEnvironmentVariable) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnEnvironmentVariableList) Range(f func(index int, item *AddOnEnvironmentVariable) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_environment_variable_type_json.go b/clientapi/clustersmgmt/v1/add_on_environment_variable_type_json.go new file mode 100644 index 00000000..8bf0ccfb --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_environment_variable_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnEnvironmentVariable writes a value of the 'add_on_environment_variable' type to the given writer. +func MarshalAddOnEnvironmentVariable(object *AddOnEnvironmentVariable, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnEnvironmentVariable(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnEnvironmentVariable writes a value of the 'add_on_environment_variable' type to the given stream. +func WriteAddOnEnvironmentVariable(object *AddOnEnvironmentVariable, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddOnEnvironmentVariableLinkKind) + } else { + stream.WriteString(AddOnEnvironmentVariableKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOnEnvironmentVariable reads a value of the 'add_on_environment_variable' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOnEnvironmentVariable(source interface{}) (object *AddOnEnvironmentVariable, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOnEnvironmentVariable(iterator) + err = iterator.Error + return +} + +// ReadAddOnEnvironmentVariable reads a value of the 'add_on_environment_variable' type from the given iterator. +func ReadAddOnEnvironmentVariable(iterator *jsoniter.Iterator) *AddOnEnvironmentVariable { + object := &AddOnEnvironmentVariable{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddOnEnvironmentVariableLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_install_mode_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_install_mode_list_type_json.go new file mode 100644 index 00000000..4cabf1d1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_install_mode_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnInstallModeList writes a list of values of the 'add_on_install_mode' type to +// the given writer. +func MarshalAddOnInstallModeList(list []AddOnInstallMode, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnInstallModeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnInstallModeList writes a list of value of the 'add_on_install_mode' type to +// the given stream. +func WriteAddOnInstallModeList(list []AddOnInstallMode, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnInstallModeList reads a list of values of the 'add_on_install_mode' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnInstallModeList(source interface{}) (items []AddOnInstallMode, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnInstallModeList(iterator) + err = iterator.Error + return +} + +// ReadAddOnInstallModeList reads list of values of the ”add_on_install_mode' type from +// the given iterator. +func ReadAddOnInstallModeList(iterator *jsoniter.Iterator) []AddOnInstallMode { + list := []AddOnInstallMode{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := AddOnInstallMode(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_install_mode_type.go b/clientapi/clustersmgmt/v1/add_on_install_mode_type.go new file mode 100644 index 00000000..6fb14c90 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_install_mode_type.go @@ -0,0 +1,32 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnInstallMode represents the values of the 'add_on_install_mode' enumerated type. +type AddOnInstallMode string + +const ( + // This mode means that the addon is deployed in all namespaces. + // However, the addon status is retrieved from the target namespace + AddOnInstallModeAllNamespaces AddOnInstallMode = "all_namespaces" + // This mode means that the the addon CRD exists in a single specific namespace. + // This namespace is reflected by the TargetNamespace addon field + AddOnInstallModeOwnNamespace AddOnInstallMode = "own_namespace" +) diff --git a/clientapi/clustersmgmt/v1/add_on_installation_billing_builder.go b/clientapi/clustersmgmt/v1/add_on_installation_billing_builder.go new file mode 100644 index 00000000..dd54eecb --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_billing_builder.go @@ -0,0 +1,101 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnInstallationBillingBuilder contains the data and logic needed to build 'add_on_installation_billing' objects. +// +// Representation of an add-on installation billing. +type AddOnInstallationBillingBuilder struct { + bitmap_ uint32 + id string + href string + billingMarketplaceAccount string + billingModel BillingModel +} + +// NewAddOnInstallationBilling creates a new builder of 'add_on_installation_billing' objects. +func NewAddOnInstallationBilling() *AddOnInstallationBillingBuilder { + return &AddOnInstallationBillingBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddOnInstallationBillingBuilder) Link(value bool) *AddOnInstallationBillingBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddOnInstallationBillingBuilder) ID(value string) *AddOnInstallationBillingBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddOnInstallationBillingBuilder) HREF(value string) *AddOnInstallationBillingBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnInstallationBillingBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// BillingMarketplaceAccount sets the value of the 'billing_marketplace_account' attribute to the given value. +func (b *AddOnInstallationBillingBuilder) BillingMarketplaceAccount(value string) *AddOnInstallationBillingBuilder { + b.billingMarketplaceAccount = value + b.bitmap_ |= 8 + return b +} + +// BillingModel sets the value of the 'billing_model' attribute to the given value. +// +// Billing model for cluster resources. +func (b *AddOnInstallationBillingBuilder) BillingModel(value BillingModel) *AddOnInstallationBillingBuilder { + b.billingModel = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddOnInstallationBillingBuilder) Copy(object *AddOnInstallationBilling) *AddOnInstallationBillingBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.billingMarketplaceAccount = object.billingMarketplaceAccount + b.billingModel = object.billingModel + return b +} + +// Build creates a 'add_on_installation_billing' object using the configuration stored in the builder. +func (b *AddOnInstallationBillingBuilder) Build() (object *AddOnInstallationBilling, err error) { + object = new(AddOnInstallationBilling) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.billingMarketplaceAccount = b.billingMarketplaceAccount + object.billingModel = b.billingModel + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_billing_list_builder.go b/clientapi/clustersmgmt/v1/add_on_installation_billing_list_builder.go new file mode 100644 index 00000000..18820036 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_billing_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnInstallationBillingListBuilder contains the data and logic needed to build +// 'add_on_installation_billing' objects. +type AddOnInstallationBillingListBuilder struct { + items []*AddOnInstallationBillingBuilder +} + +// NewAddOnInstallationBillingList creates a new builder of 'add_on_installation_billing' objects. +func NewAddOnInstallationBillingList() *AddOnInstallationBillingListBuilder { + return new(AddOnInstallationBillingListBuilder) +} + +// Items sets the items of the list. +func (b *AddOnInstallationBillingListBuilder) Items(values ...*AddOnInstallationBillingBuilder) *AddOnInstallationBillingListBuilder { + b.items = make([]*AddOnInstallationBillingBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddOnInstallationBillingListBuilder) 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 *AddOnInstallationBillingListBuilder) Copy(list *AddOnInstallationBillingList) *AddOnInstallationBillingListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddOnInstallationBillingBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddOnInstallationBilling().Copy(v) + } + } + return b +} + +// Build creates a list of 'add_on_installation_billing' objects using the +// configuration stored in the builder. +func (b *AddOnInstallationBillingListBuilder) Build() (list *AddOnInstallationBillingList, err error) { + items := make([]*AddOnInstallationBilling, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddOnInstallationBillingList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_billing_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_installation_billing_list_type_json.go new file mode 100644 index 00000000..2bb4e586 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_billing_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnInstallationBillingList writes a list of values of the 'add_on_installation_billing' type to +// the given writer. +func MarshalAddOnInstallationBillingList(list []*AddOnInstallationBilling, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnInstallationBillingList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnInstallationBillingList writes a list of value of the 'add_on_installation_billing' type to +// the given stream. +func WriteAddOnInstallationBillingList(list []*AddOnInstallationBilling, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddOnInstallationBilling(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnInstallationBillingList reads a list of values of the 'add_on_installation_billing' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnInstallationBillingList(source interface{}) (items []*AddOnInstallationBilling, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnInstallationBillingList(iterator) + err = iterator.Error + return +} + +// ReadAddOnInstallationBillingList reads list of values of the ”add_on_installation_billing' type from +// the given iterator. +func ReadAddOnInstallationBillingList(iterator *jsoniter.Iterator) []*AddOnInstallationBilling { + list := []*AddOnInstallationBilling{} + for iterator.ReadArray() { + item := ReadAddOnInstallationBilling(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_billing_type.go b/clientapi/clustersmgmt/v1/add_on_installation_billing_type.go new file mode 100644 index 00000000..761c1dd2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_billing_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnInstallationBillingKind is the name of the type used to represent objects +// of type 'add_on_installation_billing'. +const AddOnInstallationBillingKind = "AddOnInstallationBilling" + +// AddOnInstallationBillingLinkKind is the name of the type used to represent links +// to objects of type 'add_on_installation_billing'. +const AddOnInstallationBillingLinkKind = "AddOnInstallationBillingLink" + +// AddOnInstallationBillingNilKind is the name of the type used to nil references +// to objects of type 'add_on_installation_billing'. +const AddOnInstallationBillingNilKind = "AddOnInstallationBillingNil" + +// AddOnInstallationBilling represents the values of the 'add_on_installation_billing' type. +// +// Representation of an add-on installation billing. +type AddOnInstallationBilling struct { + bitmap_ uint32 + id string + href string + billingMarketplaceAccount string + billingModel BillingModel +} + +// Kind returns the name of the type of the object. +func (o *AddOnInstallationBilling) Kind() string { + if o == nil { + return AddOnInstallationBillingNilKind + } + if o.bitmap_&1 != 0 { + return AddOnInstallationBillingLinkKind + } + return AddOnInstallationBillingKind +} + +// Link returns true if this is a link. +func (o *AddOnInstallationBilling) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddOnInstallationBilling) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddOnInstallationBilling) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddOnInstallationBilling) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddOnInstallationBilling) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOnInstallationBilling) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// BillingMarketplaceAccount returns the value of the 'billing_marketplace_account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Account ID for billing market place +func (o *AddOnInstallationBilling) BillingMarketplaceAccount() string { + if o != nil && o.bitmap_&8 != 0 { + return o.billingMarketplaceAccount + } + return "" +} + +// GetBillingMarketplaceAccount returns the value of the 'billing_marketplace_account' attribute and +// a flag indicating if the attribute has a value. +// +// Account ID for billing market place +func (o *AddOnInstallationBilling) GetBillingMarketplaceAccount() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.billingMarketplaceAccount + } + return +} + +// BillingModel returns the value of the 'billing_model' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Billing Model for addon resources +func (o *AddOnInstallationBilling) BillingModel() BillingModel { + if o != nil && o.bitmap_&16 != 0 { + return o.billingModel + } + return BillingModel("") +} + +// GetBillingModel returns the value of the 'billing_model' attribute and +// a flag indicating if the attribute has a value. +// +// Billing Model for addon resources +func (o *AddOnInstallationBilling) GetBillingModel() (value BillingModel, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.billingModel + } + return +} + +// AddOnInstallationBillingListKind is the name of the type used to represent list of objects of +// type 'add_on_installation_billing'. +const AddOnInstallationBillingListKind = "AddOnInstallationBillingList" + +// AddOnInstallationBillingListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on_installation_billing'. +const AddOnInstallationBillingListLinkKind = "AddOnInstallationBillingListLink" + +// AddOnInstallationBillingNilKind is the name of the type used to nil lists of objects of +// type 'add_on_installation_billing'. +const AddOnInstallationBillingListNilKind = "AddOnInstallationBillingListNil" + +// AddOnInstallationBillingList is a list of values of the 'add_on_installation_billing' type. +type AddOnInstallationBillingList struct { + href string + link bool + items []*AddOnInstallationBilling +} + +// Kind returns the name of the type of the object. +func (l *AddOnInstallationBillingList) Kind() string { + if l == nil { + return AddOnInstallationBillingListNilKind + } + if l.link { + return AddOnInstallationBillingListLinkKind + } + return AddOnInstallationBillingListKind +} + +// Link returns true iif this is a link. +func (l *AddOnInstallationBillingList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddOnInstallationBillingList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddOnInstallationBillingList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddOnInstallationBillingList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnInstallationBillingList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnInstallationBillingList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnInstallationBillingList) SetItems(items []*AddOnInstallationBilling) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnInstallationBillingList) Items() []*AddOnInstallationBilling { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnInstallationBillingList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnInstallationBillingList) Get(i int) *AddOnInstallationBilling { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnInstallationBillingList) Slice() []*AddOnInstallationBilling { + var slice []*AddOnInstallationBilling + if l == nil { + slice = make([]*AddOnInstallationBilling, 0) + } else { + slice = make([]*AddOnInstallationBilling, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnInstallationBillingList) Each(f func(item *AddOnInstallationBilling) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnInstallationBillingList) Range(f func(index int, item *AddOnInstallationBilling) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_billing_type_json.go b/clientapi/clustersmgmt/v1/add_on_installation_billing_type_json.go new file mode 100644 index 00000000..a0ead359 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_billing_type_json.go @@ -0,0 +1,134 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnInstallationBilling writes a value of the 'add_on_installation_billing' type to the given writer. +func MarshalAddOnInstallationBilling(object *AddOnInstallationBilling, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnInstallationBilling(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnInstallationBilling writes a value of the 'add_on_installation_billing' type to the given stream. +func WriteAddOnInstallationBilling(object *AddOnInstallationBilling, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddOnInstallationBillingLinkKind) + } else { + stream.WriteString(AddOnInstallationBillingKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_marketplace_account") + stream.WriteString(object.billingMarketplaceAccount) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_model") + stream.WriteString(string(object.billingModel)) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOnInstallationBilling reads a value of the 'add_on_installation_billing' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOnInstallationBilling(source interface{}) (object *AddOnInstallationBilling, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOnInstallationBilling(iterator) + err = iterator.Error + return +} + +// ReadAddOnInstallationBilling reads a value of the 'add_on_installation_billing' type from the given iterator. +func ReadAddOnInstallationBilling(iterator *jsoniter.Iterator) *AddOnInstallationBilling { + object := &AddOnInstallationBilling{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddOnInstallationBillingLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "billing_marketplace_account": + value := iterator.ReadString() + object.billingMarketplaceAccount = value + object.bitmap_ |= 8 + case "billing_model": + text := iterator.ReadString() + value := BillingModel(text) + object.billingModel = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_builder.go b/clientapi/clustersmgmt/v1/add_on_installation_builder.go new file mode 100644 index 00000000..fe46d21e --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_builder.go @@ -0,0 +1,229 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// AddOnInstallationBuilder contains the data and logic needed to build 'add_on_installation' objects. +// +// Representation of an add-on installation in a cluster. +type AddOnInstallationBuilder struct { + bitmap_ uint32 + id string + href string + addon *AddOnBuilder + addonVersion *AddOnVersionBuilder + billing *AddOnInstallationBillingBuilder + creationTimestamp time.Time + operatorVersion string + parameters *AddOnInstallationParameterListBuilder + state AddOnInstallationState + stateDescription string + updatedTimestamp time.Time +} + +// NewAddOnInstallation creates a new builder of 'add_on_installation' objects. +func NewAddOnInstallation() *AddOnInstallationBuilder { + return &AddOnInstallationBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddOnInstallationBuilder) Link(value bool) *AddOnInstallationBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddOnInstallationBuilder) ID(value string) *AddOnInstallationBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddOnInstallationBuilder) HREF(value string) *AddOnInstallationBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnInstallationBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Addon sets the value of the 'addon' attribute to the given value. +// +// Representation of an add-on that can be installed in a cluster. +func (b *AddOnInstallationBuilder) Addon(value *AddOnBuilder) *AddOnInstallationBuilder { + b.addon = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// AddonVersion sets the value of the 'addon_version' attribute to the given value. +// +// Representation of an add-on version. +func (b *AddOnInstallationBuilder) AddonVersion(value *AddOnVersionBuilder) *AddOnInstallationBuilder { + b.addonVersion = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Billing sets the value of the 'billing' attribute to the given value. +// +// Representation of an add-on installation billing. +func (b *AddOnInstallationBuilder) Billing(value *AddOnInstallationBillingBuilder) *AddOnInstallationBuilder { + b.billing = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *AddOnInstallationBuilder) CreationTimestamp(value time.Time) *AddOnInstallationBuilder { + b.creationTimestamp = value + b.bitmap_ |= 64 + return b +} + +// OperatorVersion sets the value of the 'operator_version' attribute to the given value. +func (b *AddOnInstallationBuilder) OperatorVersion(value string) *AddOnInstallationBuilder { + b.operatorVersion = value + b.bitmap_ |= 128 + return b +} + +// Parameters sets the value of the 'parameters' attribute to the given values. +func (b *AddOnInstallationBuilder) Parameters(value *AddOnInstallationParameterListBuilder) *AddOnInstallationBuilder { + b.parameters = value + b.bitmap_ |= 256 + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// Representation of an add-on installation State field. +func (b *AddOnInstallationBuilder) State(value AddOnInstallationState) *AddOnInstallationBuilder { + b.state = value + b.bitmap_ |= 512 + return b +} + +// StateDescription sets the value of the 'state_description' attribute to the given value. +func (b *AddOnInstallationBuilder) StateDescription(value string) *AddOnInstallationBuilder { + b.stateDescription = value + b.bitmap_ |= 1024 + return b +} + +// UpdatedTimestamp sets the value of the 'updated_timestamp' attribute to the given value. +func (b *AddOnInstallationBuilder) UpdatedTimestamp(value time.Time) *AddOnInstallationBuilder { + b.updatedTimestamp = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddOnInstallationBuilder) Copy(object *AddOnInstallation) *AddOnInstallationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.addon != nil { + b.addon = NewAddOn().Copy(object.addon) + } else { + b.addon = nil + } + if object.addonVersion != nil { + b.addonVersion = NewAddOnVersion().Copy(object.addonVersion) + } else { + b.addonVersion = nil + } + if object.billing != nil { + b.billing = NewAddOnInstallationBilling().Copy(object.billing) + } else { + b.billing = nil + } + b.creationTimestamp = object.creationTimestamp + b.operatorVersion = object.operatorVersion + if object.parameters != nil { + b.parameters = NewAddOnInstallationParameterList().Copy(object.parameters) + } else { + b.parameters = nil + } + b.state = object.state + b.stateDescription = object.stateDescription + b.updatedTimestamp = object.updatedTimestamp + return b +} + +// Build creates a 'add_on_installation' object using the configuration stored in the builder. +func (b *AddOnInstallationBuilder) Build() (object *AddOnInstallation, err error) { + object = new(AddOnInstallation) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.addon != nil { + object.addon, err = b.addon.Build() + if err != nil { + return + } + } + if b.addonVersion != nil { + object.addonVersion, err = b.addonVersion.Build() + if err != nil { + return + } + } + if b.billing != nil { + object.billing, err = b.billing.Build() + if err != nil { + return + } + } + object.creationTimestamp = b.creationTimestamp + object.operatorVersion = b.operatorVersion + if b.parameters != nil { + object.parameters, err = b.parameters.Build() + if err != nil { + return + } + } + object.state = b.state + object.stateDescription = b.stateDescription + object.updatedTimestamp = b.updatedTimestamp + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_list_builder.go b/clientapi/clustersmgmt/v1/add_on_installation_list_builder.go new file mode 100644 index 00000000..b7898b59 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnInstallationListBuilder contains the data and logic needed to build +// 'add_on_installation' objects. +type AddOnInstallationListBuilder struct { + items []*AddOnInstallationBuilder +} + +// NewAddOnInstallationList creates a new builder of 'add_on_installation' objects. +func NewAddOnInstallationList() *AddOnInstallationListBuilder { + return new(AddOnInstallationListBuilder) +} + +// Items sets the items of the list. +func (b *AddOnInstallationListBuilder) Items(values ...*AddOnInstallationBuilder) *AddOnInstallationListBuilder { + b.items = make([]*AddOnInstallationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddOnInstallationListBuilder) 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 *AddOnInstallationListBuilder) Copy(list *AddOnInstallationList) *AddOnInstallationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddOnInstallationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddOnInstallation().Copy(v) + } + } + return b +} + +// Build creates a list of 'add_on_installation' objects using the +// configuration stored in the builder. +func (b *AddOnInstallationListBuilder) Build() (list *AddOnInstallationList, err error) { + items := make([]*AddOnInstallation, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddOnInstallationList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_installation_list_type_json.go new file mode 100644 index 00000000..32129216 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnInstallationList writes a list of values of the 'add_on_installation' type to +// the given writer. +func MarshalAddOnInstallationList(list []*AddOnInstallation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnInstallationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnInstallationList writes a list of value of the 'add_on_installation' type to +// the given stream. +func WriteAddOnInstallationList(list []*AddOnInstallation, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddOnInstallation(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnInstallationList reads a list of values of the 'add_on_installation' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnInstallationList(source interface{}) (items []*AddOnInstallation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnInstallationList(iterator) + err = iterator.Error + return +} + +// ReadAddOnInstallationList reads list of values of the ”add_on_installation' type from +// the given iterator. +func ReadAddOnInstallationList(iterator *jsoniter.Iterator) []*AddOnInstallation { + list := []*AddOnInstallation{} + for iterator.ReadArray() { + item := ReadAddOnInstallation(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_parameter_builder.go b/clientapi/clustersmgmt/v1/add_on_installation_parameter_builder.go new file mode 100644 index 00000000..5b1d85ba --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_parameter_builder.go @@ -0,0 +1,89 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnInstallationParameterBuilder contains the data and logic needed to build 'add_on_installation_parameter' objects. +// +// Representation of an add-on installation parameter. +type AddOnInstallationParameterBuilder struct { + bitmap_ uint32 + id string + href string + value string +} + +// NewAddOnInstallationParameter creates a new builder of 'add_on_installation_parameter' objects. +func NewAddOnInstallationParameter() *AddOnInstallationParameterBuilder { + return &AddOnInstallationParameterBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddOnInstallationParameterBuilder) Link(value bool) *AddOnInstallationParameterBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddOnInstallationParameterBuilder) ID(value string) *AddOnInstallationParameterBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddOnInstallationParameterBuilder) HREF(value string) *AddOnInstallationParameterBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnInstallationParameterBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *AddOnInstallationParameterBuilder) Value(value string) *AddOnInstallationParameterBuilder { + b.value = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddOnInstallationParameterBuilder) Copy(object *AddOnInstallationParameter) *AddOnInstallationParameterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.value = object.value + return b +} + +// Build creates a 'add_on_installation_parameter' object using the configuration stored in the builder. +func (b *AddOnInstallationParameterBuilder) Build() (object *AddOnInstallationParameter, err error) { + object = new(AddOnInstallationParameter) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.value = b.value + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_parameter_list_builder.go b/clientapi/clustersmgmt/v1/add_on_installation_parameter_list_builder.go new file mode 100644 index 00000000..ff423a22 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_parameter_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnInstallationParameterListBuilder contains the data and logic needed to build +// 'add_on_installation_parameter' objects. +type AddOnInstallationParameterListBuilder struct { + items []*AddOnInstallationParameterBuilder +} + +// NewAddOnInstallationParameterList creates a new builder of 'add_on_installation_parameter' objects. +func NewAddOnInstallationParameterList() *AddOnInstallationParameterListBuilder { + return new(AddOnInstallationParameterListBuilder) +} + +// Items sets the items of the list. +func (b *AddOnInstallationParameterListBuilder) Items(values ...*AddOnInstallationParameterBuilder) *AddOnInstallationParameterListBuilder { + b.items = make([]*AddOnInstallationParameterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddOnInstallationParameterListBuilder) 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 *AddOnInstallationParameterListBuilder) Copy(list *AddOnInstallationParameterList) *AddOnInstallationParameterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddOnInstallationParameterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddOnInstallationParameter().Copy(v) + } + } + return b +} + +// Build creates a list of 'add_on_installation_parameter' objects using the +// configuration stored in the builder. +func (b *AddOnInstallationParameterListBuilder) Build() (list *AddOnInstallationParameterList, err error) { + items := make([]*AddOnInstallationParameter, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddOnInstallationParameterList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_parameter_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_installation_parameter_list_type_json.go new file mode 100644 index 00000000..75acd596 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_parameter_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnInstallationParameterList writes a list of values of the 'add_on_installation_parameter' type to +// the given writer. +func MarshalAddOnInstallationParameterList(list []*AddOnInstallationParameter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnInstallationParameterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnInstallationParameterList writes a list of value of the 'add_on_installation_parameter' type to +// the given stream. +func WriteAddOnInstallationParameterList(list []*AddOnInstallationParameter, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddOnInstallationParameter(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnInstallationParameterList reads a list of values of the 'add_on_installation_parameter' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnInstallationParameterList(source interface{}) (items []*AddOnInstallationParameter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnInstallationParameterList(iterator) + err = iterator.Error + return +} + +// ReadAddOnInstallationParameterList reads list of values of the ”add_on_installation_parameter' type from +// the given iterator. +func ReadAddOnInstallationParameterList(iterator *jsoniter.Iterator) []*AddOnInstallationParameter { + list := []*AddOnInstallationParameter{} + for iterator.ReadArray() { + item := ReadAddOnInstallationParameter(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_parameter_type.go b/clientapi/clustersmgmt/v1/add_on_installation_parameter_type.go new file mode 100644 index 00000000..d86b03da --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_parameter_type.go @@ -0,0 +1,265 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnInstallationParameterKind is the name of the type used to represent objects +// of type 'add_on_installation_parameter'. +const AddOnInstallationParameterKind = "AddOnInstallationParameter" + +// AddOnInstallationParameterLinkKind is the name of the type used to represent links +// to objects of type 'add_on_installation_parameter'. +const AddOnInstallationParameterLinkKind = "AddOnInstallationParameterLink" + +// AddOnInstallationParameterNilKind is the name of the type used to nil references +// to objects of type 'add_on_installation_parameter'. +const AddOnInstallationParameterNilKind = "AddOnInstallationParameterNil" + +// AddOnInstallationParameter represents the values of the 'add_on_installation_parameter' type. +// +// Representation of an add-on installation parameter. +type AddOnInstallationParameter struct { + bitmap_ uint32 + id string + href string + value string +} + +// Kind returns the name of the type of the object. +func (o *AddOnInstallationParameter) Kind() string { + if o == nil { + return AddOnInstallationParameterNilKind + } + if o.bitmap_&1 != 0 { + return AddOnInstallationParameterLinkKind + } + return AddOnInstallationParameterKind +} + +// Link returns true if this is a link. +func (o *AddOnInstallationParameter) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddOnInstallationParameter) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddOnInstallationParameter) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddOnInstallationParameter) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddOnInstallationParameter) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOnInstallationParameter) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Value of the parameter. +func (o *AddOnInstallationParameter) Value() string { + if o != nil && o.bitmap_&8 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Value of the parameter. +func (o *AddOnInstallationParameter) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.value + } + return +} + +// AddOnInstallationParameterListKind is the name of the type used to represent list of objects of +// type 'add_on_installation_parameter'. +const AddOnInstallationParameterListKind = "AddOnInstallationParameterList" + +// AddOnInstallationParameterListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on_installation_parameter'. +const AddOnInstallationParameterListLinkKind = "AddOnInstallationParameterListLink" + +// AddOnInstallationParameterNilKind is the name of the type used to nil lists of objects of +// type 'add_on_installation_parameter'. +const AddOnInstallationParameterListNilKind = "AddOnInstallationParameterListNil" + +// AddOnInstallationParameterList is a list of values of the 'add_on_installation_parameter' type. +type AddOnInstallationParameterList struct { + href string + link bool + items []*AddOnInstallationParameter +} + +// Kind returns the name of the type of the object. +func (l *AddOnInstallationParameterList) Kind() string { + if l == nil { + return AddOnInstallationParameterListNilKind + } + if l.link { + return AddOnInstallationParameterListLinkKind + } + return AddOnInstallationParameterListKind +} + +// Link returns true iif this is a link. +func (l *AddOnInstallationParameterList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddOnInstallationParameterList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddOnInstallationParameterList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddOnInstallationParameterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnInstallationParameterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnInstallationParameterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnInstallationParameterList) SetItems(items []*AddOnInstallationParameter) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnInstallationParameterList) Items() []*AddOnInstallationParameter { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnInstallationParameterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnInstallationParameterList) Get(i int) *AddOnInstallationParameter { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnInstallationParameterList) Slice() []*AddOnInstallationParameter { + var slice []*AddOnInstallationParameter + if l == nil { + slice = make([]*AddOnInstallationParameter, 0) + } else { + slice = make([]*AddOnInstallationParameter, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnInstallationParameterList) Each(f func(item *AddOnInstallationParameter) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnInstallationParameterList) Range(f func(index int, item *AddOnInstallationParameter) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_parameter_type_json.go b/clientapi/clustersmgmt/v1/add_on_installation_parameter_type_json.go new file mode 100644 index 00000000..63c9b1eb --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_parameter_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnInstallationParameter writes a value of the 'add_on_installation_parameter' type to the given writer. +func MarshalAddOnInstallationParameter(object *AddOnInstallationParameter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnInstallationParameter(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnInstallationParameter writes a value of the 'add_on_installation_parameter' type to the given stream. +func WriteAddOnInstallationParameter(object *AddOnInstallationParameter, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddOnInstallationParameterLinkKind) + } else { + stream.WriteString(AddOnInstallationParameterKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOnInstallationParameter reads a value of the 'add_on_installation_parameter' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOnInstallationParameter(source interface{}) (object *AddOnInstallationParameter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOnInstallationParameter(iterator) + err = iterator.Error + return +} + +// ReadAddOnInstallationParameter reads a value of the 'add_on_installation_parameter' type from the given iterator. +func ReadAddOnInstallationParameter(iterator *jsoniter.Iterator) *AddOnInstallationParameter { + object := &AddOnInstallationParameter{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddOnInstallationParameterLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_state_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_installation_state_list_type_json.go new file mode 100644 index 00000000..e6bcad44 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_state_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnInstallationStateList writes a list of values of the 'add_on_installation_state' type to +// the given writer. +func MarshalAddOnInstallationStateList(list []AddOnInstallationState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnInstallationStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnInstallationStateList writes a list of value of the 'add_on_installation_state' type to +// the given stream. +func WriteAddOnInstallationStateList(list []AddOnInstallationState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnInstallationStateList reads a list of values of the 'add_on_installation_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnInstallationStateList(source interface{}) (items []AddOnInstallationState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnInstallationStateList(iterator) + err = iterator.Error + return +} + +// ReadAddOnInstallationStateList reads list of values of the ”add_on_installation_state' type from +// the given iterator. +func ReadAddOnInstallationStateList(iterator *jsoniter.Iterator) []AddOnInstallationState { + list := []AddOnInstallationState{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := AddOnInstallationState(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_state_type.go b/clientapi/clustersmgmt/v1/add_on_installation_state_type.go new file mode 100644 index 00000000..f1ae06e0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_state_type.go @@ -0,0 +1,36 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnInstallationState represents the values of the 'add_on_installation_state' enumerated type. +type AddOnInstallationState string + +const ( + // The add-on is being deleted. + AddOnInstallationStateDeleting AddOnInstallationState = "deleting" + // Error during installation. + AddOnInstallationStateFailed AddOnInstallationState = "failed" + // The add-on is still being installed. + AddOnInstallationStateInstalling AddOnInstallationState = "installing" + // The add-on is in pending state. + AddOnInstallationStatePending AddOnInstallationState = "pending" + // The add-on is ready to be used. + AddOnInstallationStateReady AddOnInstallationState = "ready" +) diff --git a/clientapi/clustersmgmt/v1/add_on_installation_type.go b/clientapi/clustersmgmt/v1/add_on_installation_type.go new file mode 100644 index 00000000..e80c3c8b --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_type.go @@ -0,0 +1,461 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// AddOnInstallationKind is the name of the type used to represent objects +// of type 'add_on_installation'. +const AddOnInstallationKind = "AddOnInstallation" + +// AddOnInstallationLinkKind is the name of the type used to represent links +// to objects of type 'add_on_installation'. +const AddOnInstallationLinkKind = "AddOnInstallationLink" + +// AddOnInstallationNilKind is the name of the type used to nil references +// to objects of type 'add_on_installation'. +const AddOnInstallationNilKind = "AddOnInstallationNil" + +// AddOnInstallation represents the values of the 'add_on_installation' type. +// +// Representation of an add-on installation in a cluster. +type AddOnInstallation struct { + bitmap_ uint32 + id string + href string + addon *AddOn + addonVersion *AddOnVersion + billing *AddOnInstallationBilling + creationTimestamp time.Time + operatorVersion string + parameters *AddOnInstallationParameterList + state AddOnInstallationState + stateDescription string + updatedTimestamp time.Time +} + +// Kind returns the name of the type of the object. +func (o *AddOnInstallation) Kind() string { + if o == nil { + return AddOnInstallationNilKind + } + if o.bitmap_&1 != 0 { + return AddOnInstallationLinkKind + } + return AddOnInstallationKind +} + +// Link returns true if this is a link. +func (o *AddOnInstallation) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddOnInstallation) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddOnInstallation) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddOnInstallation) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddOnInstallation) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOnInstallation) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Addon returns the value of the 'addon' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to add-on attached to this cluster. +func (o *AddOnInstallation) Addon() *AddOn { + if o != nil && o.bitmap_&8 != 0 { + return o.addon + } + return nil +} + +// GetAddon returns the value of the 'addon' attribute and +// a flag indicating if the attribute has a value. +// +// Link to add-on attached to this cluster. +func (o *AddOnInstallation) GetAddon() (value *AddOn, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.addon + } + return +} + +// AddonVersion returns the value of the 'addon_version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the installed version of this add-on. +func (o *AddOnInstallation) AddonVersion() *AddOnVersion { + if o != nil && o.bitmap_&16 != 0 { + return o.addonVersion + } + return nil +} + +// GetAddonVersion returns the value of the 'addon_version' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the installed version of this add-on. +func (o *AddOnInstallation) GetAddonVersion() (value *AddOnVersion, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.addonVersion + } + return +} + +// Billing returns the value of the 'billing' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Billing details for add-on installation resource +func (o *AddOnInstallation) Billing() *AddOnInstallationBilling { + if o != nil && o.bitmap_&32 != 0 { + return o.billing + } + return nil +} + +// GetBilling returns the value of the 'billing' attribute and +// a flag indicating if the attribute has a value. +// +// Billing details for add-on installation resource +func (o *AddOnInstallation) GetBilling() (value *AddOnInstallationBilling, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.billing + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the add-on was initially installed in the cluster. +func (o *AddOnInstallation) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the add-on was initially installed in the cluster. +func (o *AddOnInstallation) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// OperatorVersion returns the value of the 'operator_version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Version of the operator installed by the add-on. +func (o *AddOnInstallation) OperatorVersion() string { + if o != nil && o.bitmap_&128 != 0 { + return o.operatorVersion + } + return "" +} + +// GetOperatorVersion returns the value of the 'operator_version' attribute and +// a flag indicating if the attribute has a value. +// +// Version of the operator installed by the add-on. +func (o *AddOnInstallation) GetOperatorVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.operatorVersion + } + 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 add-on parameters for this add-on installation. +func (o *AddOnInstallation) Parameters() *AddOnInstallationParameterList { + if o != nil && o.bitmap_&256 != 0 { + return o.parameters + } + return nil +} + +// GetParameters returns the value of the 'parameters' attribute and +// a flag indicating if the attribute has a value. +// +// List of add-on parameters for this add-on installation. +func (o *AddOnInstallation) GetParameters() (value *AddOnInstallationParameterList, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.parameters + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Overall state of the add-on installation. +func (o *AddOnInstallation) State() AddOnInstallationState { + if o != nil && o.bitmap_&512 != 0 { + return o.state + } + return AddOnInstallationState("") +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// Overall state of the add-on installation. +func (o *AddOnInstallation) GetState() (value AddOnInstallationState, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.state + } + return +} + +// StateDescription returns the value of the 'state_description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Reason for the current State. +func (o *AddOnInstallation) StateDescription() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.stateDescription + } + return "" +} + +// GetStateDescription returns the value of the 'state_description' attribute and +// a flag indicating if the attribute has a value. +// +// Reason for the current State. +func (o *AddOnInstallation) GetStateDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.stateDescription + } + return +} + +// UpdatedTimestamp returns the value of the 'updated_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the add-on installation information was last updated. +func (o *AddOnInstallation) UpdatedTimestamp() time.Time { + if o != nil && o.bitmap_&2048 != 0 { + return o.updatedTimestamp + } + return time.Time{} +} + +// GetUpdatedTimestamp returns the value of the 'updated_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the add-on installation information was last updated. +func (o *AddOnInstallation) GetUpdatedTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.updatedTimestamp + } + return +} + +// AddOnInstallationListKind is the name of the type used to represent list of objects of +// type 'add_on_installation'. +const AddOnInstallationListKind = "AddOnInstallationList" + +// AddOnInstallationListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on_installation'. +const AddOnInstallationListLinkKind = "AddOnInstallationListLink" + +// AddOnInstallationNilKind is the name of the type used to nil lists of objects of +// type 'add_on_installation'. +const AddOnInstallationListNilKind = "AddOnInstallationListNil" + +// AddOnInstallationList is a list of values of the 'add_on_installation' type. +type AddOnInstallationList struct { + href string + link bool + items []*AddOnInstallation +} + +// Kind returns the name of the type of the object. +func (l *AddOnInstallationList) Kind() string { + if l == nil { + return AddOnInstallationListNilKind + } + if l.link { + return AddOnInstallationListLinkKind + } + return AddOnInstallationListKind +} + +// Link returns true iif this is a link. +func (l *AddOnInstallationList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddOnInstallationList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddOnInstallationList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddOnInstallationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnInstallationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnInstallationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnInstallationList) SetItems(items []*AddOnInstallation) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnInstallationList) Items() []*AddOnInstallation { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnInstallationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnInstallationList) Get(i int) *AddOnInstallation { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnInstallationList) Slice() []*AddOnInstallation { + var slice []*AddOnInstallation + if l == nil { + slice = make([]*AddOnInstallation, 0) + } else { + slice = make([]*AddOnInstallation, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnInstallationList) Each(f func(item *AddOnInstallation) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnInstallationList) Range(f func(index int, item *AddOnInstallation) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_installation_type_json.go b/clientapi/clustersmgmt/v1/add_on_installation_type_json.go new file mode 100644 index 00000000..2fbcffcd --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_installation_type_json.go @@ -0,0 +1,254 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnInstallation writes a value of the 'add_on_installation' type to the given writer. +func MarshalAddOnInstallation(object *AddOnInstallation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnInstallation(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnInstallation writes a value of the 'add_on_installation' type to the given stream. +func WriteAddOnInstallation(object *AddOnInstallation, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddOnInstallationLinkKind) + } else { + stream.WriteString(AddOnInstallationKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.addon != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("addon") + WriteAddOn(object.addon, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.addonVersion != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("addon_version") + WriteAddOnVersion(object.addonVersion, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.billing != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing") + WriteAddOnInstallationBilling(object.billing, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_version") + stream.WriteString(object.operatorVersion) + count++ + } + present_ = object.bitmap_&256 != 0 && object.parameters != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("parameters") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteAddOnInstallationParameterList(object.parameters.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(string(object.state)) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state_description") + stream.WriteString(object.stateDescription) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_timestamp") + stream.WriteString((object.updatedTimestamp).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOnInstallation reads a value of the 'add_on_installation' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOnInstallation(source interface{}) (object *AddOnInstallation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOnInstallation(iterator) + err = iterator.Error + return +} + +// ReadAddOnInstallation reads a value of the 'add_on_installation' type from the given iterator. +func ReadAddOnInstallation(iterator *jsoniter.Iterator) *AddOnInstallation { + object := &AddOnInstallation{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddOnInstallationLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "addon": + value := ReadAddOn(iterator) + object.addon = value + object.bitmap_ |= 8 + case "addon_version": + value := ReadAddOnVersion(iterator) + object.addonVersion = value + object.bitmap_ |= 16 + case "billing": + value := ReadAddOnInstallationBilling(iterator) + object.billing = value + object.bitmap_ |= 32 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 64 + case "operator_version": + value := iterator.ReadString() + object.operatorVersion = value + object.bitmap_ |= 128 + case "parameters": + value := &AddOnInstallationParameterList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == AddOnInstallationParameterListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadAddOnInstallationParameterList(iterator)) + default: + iterator.ReadAny() + } + } + object.parameters = value + object.bitmap_ |= 256 + case "state": + text := iterator.ReadString() + value := AddOnInstallationState(text) + object.state = value + object.bitmap_ |= 512 + case "state_description": + value := iterator.ReadString() + object.stateDescription = value + object.bitmap_ |= 1024 + case "updated_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.updatedTimestamp = value + object.bitmap_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_list_builder.go b/clientapi/clustersmgmt/v1/add_on_list_builder.go new file mode 100644 index 00000000..e25fd456 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnListBuilder contains the data and logic needed to build +// 'add_on' objects. +type AddOnListBuilder struct { + items []*AddOnBuilder +} + +// NewAddOnList creates a new builder of 'add_on' objects. +func NewAddOnList() *AddOnListBuilder { + return new(AddOnListBuilder) +} + +// Items sets the items of the list. +func (b *AddOnListBuilder) Items(values ...*AddOnBuilder) *AddOnListBuilder { + b.items = make([]*AddOnBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddOnListBuilder) 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 *AddOnListBuilder) Copy(list *AddOnList) *AddOnListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddOnBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddOn().Copy(v) + } + } + return b +} + +// Build creates a list of 'add_on' objects using the +// configuration stored in the builder. +func (b *AddOnListBuilder) Build() (list *AddOnList, err error) { + items := make([]*AddOn, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddOnList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_list_type_json.go new file mode 100644 index 00000000..0e0b53f2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnList writes a list of values of the 'add_on' type to +// the given writer. +func MarshalAddOnList(list []*AddOn, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnList writes a list of value of the 'add_on' type to +// the given stream. +func WriteAddOnList(list []*AddOn, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddOn(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnList reads a list of values of the 'add_on' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnList(source interface{}) (items []*AddOn, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnList(iterator) + err = iterator.Error + return +} + +// ReadAddOnList reads list of values of the ”add_on' type from +// the given iterator. +func ReadAddOnList(iterator *jsoniter.Iterator) []*AddOn { + list := []*AddOn{} + for iterator.ReadArray() { + item := ReadAddOn(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_namespace_builder.go b/clientapi/clustersmgmt/v1/add_on_namespace_builder.go new file mode 100644 index 00000000..3bc490b5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_namespace_builder.go @@ -0,0 +1,139 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnNamespaceBuilder contains the data and logic needed to build 'add_on_namespace' objects. +type AddOnNamespaceBuilder struct { + bitmap_ uint32 + id string + href string + annotations map[string]string + labels map[string]string + name string +} + +// NewAddOnNamespace creates a new builder of 'add_on_namespace' objects. +func NewAddOnNamespace() *AddOnNamespaceBuilder { + return &AddOnNamespaceBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddOnNamespaceBuilder) Link(value bool) *AddOnNamespaceBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddOnNamespaceBuilder) ID(value string) *AddOnNamespaceBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddOnNamespaceBuilder) HREF(value string) *AddOnNamespaceBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnNamespaceBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Annotations sets the value of the 'annotations' attribute to the given value. +func (b *AddOnNamespaceBuilder) Annotations(value map[string]string) *AddOnNamespaceBuilder { + b.annotations = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// Labels sets the value of the 'labels' attribute to the given value. +func (b *AddOnNamespaceBuilder) Labels(value map[string]string) *AddOnNamespaceBuilder { + b.labels = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AddOnNamespaceBuilder) Name(value string) *AddOnNamespaceBuilder { + b.name = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddOnNamespaceBuilder) Copy(object *AddOnNamespace) *AddOnNamespaceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if len(object.annotations) > 0 { + b.annotations = map[string]string{} + for k, v := range object.annotations { + b.annotations[k] = v + } + } else { + b.annotations = nil + } + if len(object.labels) > 0 { + b.labels = map[string]string{} + for k, v := range object.labels { + b.labels[k] = v + } + } else { + b.labels = nil + } + b.name = object.name + return b +} + +// Build creates a 'add_on_namespace' object using the configuration stored in the builder. +func (b *AddOnNamespaceBuilder) Build() (object *AddOnNamespace, err error) { + object = new(AddOnNamespace) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.annotations != nil { + object.annotations = make(map[string]string) + for k, v := range b.annotations { + object.annotations[k] = v + } + } + if b.labels != nil { + object.labels = make(map[string]string) + for k, v := range b.labels { + object.labels[k] = v + } + } + object.name = b.name + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_namespace_list_builder.go b/clientapi/clustersmgmt/v1/add_on_namespace_list_builder.go new file mode 100644 index 00000000..b11fec4f --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_namespace_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnNamespaceListBuilder contains the data and logic needed to build +// 'add_on_namespace' objects. +type AddOnNamespaceListBuilder struct { + items []*AddOnNamespaceBuilder +} + +// NewAddOnNamespaceList creates a new builder of 'add_on_namespace' objects. +func NewAddOnNamespaceList() *AddOnNamespaceListBuilder { + return new(AddOnNamespaceListBuilder) +} + +// Items sets the items of the list. +func (b *AddOnNamespaceListBuilder) Items(values ...*AddOnNamespaceBuilder) *AddOnNamespaceListBuilder { + b.items = make([]*AddOnNamespaceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddOnNamespaceListBuilder) 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 *AddOnNamespaceListBuilder) Copy(list *AddOnNamespaceList) *AddOnNamespaceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddOnNamespaceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddOnNamespace().Copy(v) + } + } + return b +} + +// Build creates a list of 'add_on_namespace' objects using the +// configuration stored in the builder. +func (b *AddOnNamespaceListBuilder) Build() (list *AddOnNamespaceList, err error) { + items := make([]*AddOnNamespace, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddOnNamespaceList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_namespace_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_namespace_list_type_json.go new file mode 100644 index 00000000..ea4e0827 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_namespace_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnNamespaceList writes a list of values of the 'add_on_namespace' type to +// the given writer. +func MarshalAddOnNamespaceList(list []*AddOnNamespace, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnNamespaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnNamespaceList writes a list of value of the 'add_on_namespace' type to +// the given stream. +func WriteAddOnNamespaceList(list []*AddOnNamespace, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddOnNamespace(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnNamespaceList reads a list of values of the 'add_on_namespace' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnNamespaceList(source interface{}) (items []*AddOnNamespace, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnNamespaceList(iterator) + err = iterator.Error + return +} + +// ReadAddOnNamespaceList reads list of values of the ”add_on_namespace' type from +// the given iterator. +func ReadAddOnNamespaceList(iterator *jsoniter.Iterator) []*AddOnNamespace { + list := []*AddOnNamespace{} + for iterator.ReadArray() { + item := ReadAddOnNamespace(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_namespace_type.go b/clientapi/clustersmgmt/v1/add_on_namespace_type.go new file mode 100644 index 00000000..a53c8d35 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_namespace_type.go @@ -0,0 +1,311 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnNamespaceKind is the name of the type used to represent objects +// of type 'add_on_namespace'. +const AddOnNamespaceKind = "AddOnNamespace" + +// AddOnNamespaceLinkKind is the name of the type used to represent links +// to objects of type 'add_on_namespace'. +const AddOnNamespaceLinkKind = "AddOnNamespaceLink" + +// AddOnNamespaceNilKind is the name of the type used to nil references +// to objects of type 'add_on_namespace'. +const AddOnNamespaceNilKind = "AddOnNamespaceNil" + +// AddOnNamespace represents the values of the 'add_on_namespace' type. +type AddOnNamespace struct { + bitmap_ uint32 + id string + href string + annotations map[string]string + labels map[string]string + name string +} + +// Kind returns the name of the type of the object. +func (o *AddOnNamespace) Kind() string { + if o == nil { + return AddOnNamespaceNilKind + } + if o.bitmap_&1 != 0 { + return AddOnNamespaceLinkKind + } + return AddOnNamespaceKind +} + +// Link returns true if this is a link. +func (o *AddOnNamespace) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddOnNamespace) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddOnNamespace) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddOnNamespace) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddOnNamespace) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOnNamespace) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Annotations returns the value of the 'annotations' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Annotations to be applied to this namespace. +func (o *AddOnNamespace) Annotations() map[string]string { + if o != nil && o.bitmap_&8 != 0 { + return o.annotations + } + return nil +} + +// GetAnnotations returns the value of the 'annotations' attribute and +// a flag indicating if the attribute has a value. +// +// Annotations to be applied to this namespace. +func (o *AddOnNamespace) GetAnnotations() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.annotations + } + return +} + +// Labels returns the value of the 'labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Labels to be applied to this namespace. +func (o *AddOnNamespace) Labels() map[string]string { + if o != nil && o.bitmap_&16 != 0 { + return o.labels + } + return nil +} + +// GetLabels returns the value of the 'labels' attribute and +// a flag indicating if the attribute has a value. +// +// Labels to be applied to this namespace. +func (o *AddOnNamespace) GetLabels() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.labels + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the namespace. +func (o *AddOnNamespace) Name() string { + if o != nil && o.bitmap_&32 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the namespace. +func (o *AddOnNamespace) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.name + } + return +} + +// AddOnNamespaceListKind is the name of the type used to represent list of objects of +// type 'add_on_namespace'. +const AddOnNamespaceListKind = "AddOnNamespaceList" + +// AddOnNamespaceListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on_namespace'. +const AddOnNamespaceListLinkKind = "AddOnNamespaceListLink" + +// AddOnNamespaceNilKind is the name of the type used to nil lists of objects of +// type 'add_on_namespace'. +const AddOnNamespaceListNilKind = "AddOnNamespaceListNil" + +// AddOnNamespaceList is a list of values of the 'add_on_namespace' type. +type AddOnNamespaceList struct { + href string + link bool + items []*AddOnNamespace +} + +// Kind returns the name of the type of the object. +func (l *AddOnNamespaceList) Kind() string { + if l == nil { + return AddOnNamespaceListNilKind + } + if l.link { + return AddOnNamespaceListLinkKind + } + return AddOnNamespaceListKind +} + +// Link returns true iif this is a link. +func (l *AddOnNamespaceList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddOnNamespaceList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddOnNamespaceList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddOnNamespaceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnNamespaceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnNamespaceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnNamespaceList) SetItems(items []*AddOnNamespace) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnNamespaceList) Items() []*AddOnNamespace { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnNamespaceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnNamespaceList) Get(i int) *AddOnNamespace { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnNamespaceList) Slice() []*AddOnNamespace { + var slice []*AddOnNamespace + if l == nil { + slice = make([]*AddOnNamespace, 0) + } else { + slice = make([]*AddOnNamespace, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnNamespaceList) Each(f func(item *AddOnNamespace) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnNamespaceList) Range(f func(index int, item *AddOnNamespace) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_namespace_type_json.go b/clientapi/clustersmgmt/v1/add_on_namespace_type_json.go new file mode 100644 index 00000000..fa7cb174 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_namespace_type_json.go @@ -0,0 +1,203 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnNamespace writes a value of the 'add_on_namespace' type to the given writer. +func MarshalAddOnNamespace(object *AddOnNamespace, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnNamespace(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnNamespace writes a value of the 'add_on_namespace' type to the given stream. +func WriteAddOnNamespace(object *AddOnNamespace, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddOnNamespaceLinkKind) + } else { + stream.WriteString(AddOnNamespaceKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.annotations != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("annotations") + if object.annotations != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.annotations)) + i := 0 + for key := range object.annotations { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.annotations[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&16 != 0 && object.labels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("labels") + if object.labels != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.labels)) + i := 0 + for key := range object.labels { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.labels[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOnNamespace reads a value of the 'add_on_namespace' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOnNamespace(source interface{}) (object *AddOnNamespace, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOnNamespace(iterator) + err = iterator.Error + return +} + +// ReadAddOnNamespace reads a value of the 'add_on_namespace' type from the given iterator. +func ReadAddOnNamespace(iterator *jsoniter.Iterator) *AddOnNamespace { + object := &AddOnNamespace{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddOnNamespaceLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "annotations": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.annotations = value + object.bitmap_ |= 8 + case "labels": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.labels = value + object.bitmap_ |= 16 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_parameter_builder.go b/clientapi/clustersmgmt/v1/add_on_parameter_builder.go new file mode 100644 index 00000000..e542de62 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_parameter_builder.go @@ -0,0 +1,256 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnParameterBuilder contains the data and logic needed to build 'add_on_parameter' objects. +// +// Representation of an add-on parameter. +type AddOnParameterBuilder struct { + bitmap_ uint32 + id string + href string + addon *AddOnBuilder + conditions []*AddOnRequirementBuilder + defaultValue string + description string + editableDirection string + name string + options []*AddOnParameterOptionBuilder + validation string + validationErrMsg string + valueType string + editable bool + enabled bool + required bool +} + +// NewAddOnParameter creates a new builder of 'add_on_parameter' objects. +func NewAddOnParameter() *AddOnParameterBuilder { + return &AddOnParameterBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddOnParameterBuilder) Link(value bool) *AddOnParameterBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddOnParameterBuilder) ID(value string) *AddOnParameterBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddOnParameterBuilder) HREF(value string) *AddOnParameterBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnParameterBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Addon sets the value of the 'addon' attribute to the given value. +// +// Representation of an add-on that can be installed in a cluster. +func (b *AddOnParameterBuilder) Addon(value *AddOnBuilder) *AddOnParameterBuilder { + b.addon = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// Conditions sets the value of the 'conditions' attribute to the given values. +func (b *AddOnParameterBuilder) Conditions(values ...*AddOnRequirementBuilder) *AddOnParameterBuilder { + b.conditions = make([]*AddOnRequirementBuilder, len(values)) + copy(b.conditions, values) + b.bitmap_ |= 16 + return b +} + +// DefaultValue sets the value of the 'default_value' attribute to the given value. +func (b *AddOnParameterBuilder) DefaultValue(value string) *AddOnParameterBuilder { + b.defaultValue = value + b.bitmap_ |= 32 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *AddOnParameterBuilder) Description(value string) *AddOnParameterBuilder { + b.description = value + b.bitmap_ |= 64 + return b +} + +// Editable sets the value of the 'editable' attribute to the given value. +func (b *AddOnParameterBuilder) Editable(value bool) *AddOnParameterBuilder { + b.editable = value + b.bitmap_ |= 128 + return b +} + +// EditableDirection sets the value of the 'editable_direction' attribute to the given value. +func (b *AddOnParameterBuilder) EditableDirection(value string) *AddOnParameterBuilder { + b.editableDirection = value + b.bitmap_ |= 256 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddOnParameterBuilder) Enabled(value bool) *AddOnParameterBuilder { + b.enabled = value + b.bitmap_ |= 512 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AddOnParameterBuilder) Name(value string) *AddOnParameterBuilder { + b.name = value + b.bitmap_ |= 1024 + return b +} + +// Options sets the value of the 'options' attribute to the given values. +func (b *AddOnParameterBuilder) Options(values ...*AddOnParameterOptionBuilder) *AddOnParameterBuilder { + b.options = make([]*AddOnParameterOptionBuilder, len(values)) + copy(b.options, values) + b.bitmap_ |= 2048 + return b +} + +// Required sets the value of the 'required' attribute to the given value. +func (b *AddOnParameterBuilder) Required(value bool) *AddOnParameterBuilder { + b.required = value + b.bitmap_ |= 4096 + return b +} + +// Validation sets the value of the 'validation' attribute to the given value. +func (b *AddOnParameterBuilder) Validation(value string) *AddOnParameterBuilder { + b.validation = value + b.bitmap_ |= 8192 + return b +} + +// ValidationErrMsg sets the value of the 'validation_err_msg' attribute to the given value. +func (b *AddOnParameterBuilder) ValidationErrMsg(value string) *AddOnParameterBuilder { + b.validationErrMsg = value + b.bitmap_ |= 16384 + return b +} + +// ValueType sets the value of the 'value_type' attribute to the given value. +func (b *AddOnParameterBuilder) ValueType(value string) *AddOnParameterBuilder { + b.valueType = value + b.bitmap_ |= 32768 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddOnParameterBuilder) Copy(object *AddOnParameter) *AddOnParameterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.addon != nil { + b.addon = NewAddOn().Copy(object.addon) + } else { + b.addon = nil + } + if object.conditions != nil { + b.conditions = make([]*AddOnRequirementBuilder, len(object.conditions)) + for i, v := range object.conditions { + b.conditions[i] = NewAddOnRequirement().Copy(v) + } + } else { + b.conditions = nil + } + b.defaultValue = object.defaultValue + b.description = object.description + b.editable = object.editable + b.editableDirection = object.editableDirection + b.enabled = object.enabled + b.name = object.name + if object.options != nil { + b.options = make([]*AddOnParameterOptionBuilder, len(object.options)) + for i, v := range object.options { + b.options[i] = NewAddOnParameterOption().Copy(v) + } + } else { + b.options = nil + } + b.required = object.required + b.validation = object.validation + b.validationErrMsg = object.validationErrMsg + b.valueType = object.valueType + return b +} + +// Build creates a 'add_on_parameter' object using the configuration stored in the builder. +func (b *AddOnParameterBuilder) Build() (object *AddOnParameter, err error) { + object = new(AddOnParameter) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.addon != nil { + object.addon, err = b.addon.Build() + if err != nil { + return + } + } + if b.conditions != nil { + object.conditions = make([]*AddOnRequirement, len(b.conditions)) + for i, v := range b.conditions { + object.conditions[i], err = v.Build() + if err != nil { + return + } + } + } + object.defaultValue = b.defaultValue + object.description = b.description + object.editable = b.editable + object.editableDirection = b.editableDirection + object.enabled = b.enabled + object.name = b.name + if b.options != nil { + object.options = make([]*AddOnParameterOption, len(b.options)) + for i, v := range b.options { + object.options[i], err = v.Build() + if err != nil { + return + } + } + } + object.required = b.required + object.validation = b.validation + object.validationErrMsg = b.validationErrMsg + object.valueType = b.valueType + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_parameter_list_builder.go b/clientapi/clustersmgmt/v1/add_on_parameter_list_builder.go new file mode 100644 index 00000000..0ade8f1e --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_parameter_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnParameterListBuilder contains the data and logic needed to build +// 'add_on_parameter' objects. +type AddOnParameterListBuilder struct { + items []*AddOnParameterBuilder +} + +// NewAddOnParameterList creates a new builder of 'add_on_parameter' objects. +func NewAddOnParameterList() *AddOnParameterListBuilder { + return new(AddOnParameterListBuilder) +} + +// Items sets the items of the list. +func (b *AddOnParameterListBuilder) Items(values ...*AddOnParameterBuilder) *AddOnParameterListBuilder { + b.items = make([]*AddOnParameterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddOnParameterListBuilder) 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 *AddOnParameterListBuilder) Copy(list *AddOnParameterList) *AddOnParameterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddOnParameterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddOnParameter().Copy(v) + } + } + return b +} + +// Build creates a list of 'add_on_parameter' objects using the +// configuration stored in the builder. +func (b *AddOnParameterListBuilder) Build() (list *AddOnParameterList, err error) { + items := make([]*AddOnParameter, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddOnParameterList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_parameter_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_parameter_list_type_json.go new file mode 100644 index 00000000..789b9428 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_parameter_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnParameterList writes a list of values of the 'add_on_parameter' type to +// the given writer. +func MarshalAddOnParameterList(list []*AddOnParameter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnParameterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnParameterList writes a list of value of the 'add_on_parameter' type to +// the given stream. +func WriteAddOnParameterList(list []*AddOnParameter, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddOnParameter(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnParameterList reads a list of values of the 'add_on_parameter' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnParameterList(source interface{}) (items []*AddOnParameter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnParameterList(iterator) + err = iterator.Error + return +} + +// ReadAddOnParameterList reads list of values of the ”add_on_parameter' type from +// the given iterator. +func ReadAddOnParameterList(iterator *jsoniter.Iterator) []*AddOnParameter { + list := []*AddOnParameter{} + for iterator.ReadArray() { + item := ReadAddOnParameter(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_parameter_option_builder.go b/clientapi/clustersmgmt/v1/add_on_parameter_option_builder.go new file mode 100644 index 00000000..9a0e6844 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_parameter_option_builder.go @@ -0,0 +1,109 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnParameterOptionBuilder contains the data and logic needed to build 'add_on_parameter_option' objects. +// +// Representation of an add-on parameter option. +type AddOnParameterOptionBuilder struct { + bitmap_ uint32 + name string + rank int + requirements []*AddOnRequirementBuilder + value string +} + +// NewAddOnParameterOption creates a new builder of 'add_on_parameter_option' objects. +func NewAddOnParameterOption() *AddOnParameterOptionBuilder { + return &AddOnParameterOptionBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnParameterOptionBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AddOnParameterOptionBuilder) Name(value string) *AddOnParameterOptionBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Rank sets the value of the 'rank' attribute to the given value. +func (b *AddOnParameterOptionBuilder) Rank(value int) *AddOnParameterOptionBuilder { + b.rank = value + b.bitmap_ |= 2 + return b +} + +// Requirements sets the value of the 'requirements' attribute to the given values. +func (b *AddOnParameterOptionBuilder) Requirements(values ...*AddOnRequirementBuilder) *AddOnParameterOptionBuilder { + b.requirements = make([]*AddOnRequirementBuilder, len(values)) + copy(b.requirements, values) + b.bitmap_ |= 4 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *AddOnParameterOptionBuilder) Value(value string) *AddOnParameterOptionBuilder { + b.value = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddOnParameterOptionBuilder) Copy(object *AddOnParameterOption) *AddOnParameterOptionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + b.rank = object.rank + if object.requirements != nil { + b.requirements = make([]*AddOnRequirementBuilder, len(object.requirements)) + for i, v := range object.requirements { + b.requirements[i] = NewAddOnRequirement().Copy(v) + } + } else { + b.requirements = nil + } + b.value = object.value + return b +} + +// Build creates a 'add_on_parameter_option' object using the configuration stored in the builder. +func (b *AddOnParameterOptionBuilder) Build() (object *AddOnParameterOption, err error) { + object = new(AddOnParameterOption) + object.bitmap_ = b.bitmap_ + object.name = b.name + object.rank = b.rank + if b.requirements != nil { + object.requirements = make([]*AddOnRequirement, len(b.requirements)) + for i, v := range b.requirements { + object.requirements[i], err = v.Build() + if err != nil { + return + } + } + } + object.value = b.value + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_parameter_option_list_builder.go b/clientapi/clustersmgmt/v1/add_on_parameter_option_list_builder.go new file mode 100644 index 00000000..89e5932d --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_parameter_option_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnParameterOptionListBuilder contains the data and logic needed to build +// 'add_on_parameter_option' objects. +type AddOnParameterOptionListBuilder struct { + items []*AddOnParameterOptionBuilder +} + +// NewAddOnParameterOptionList creates a new builder of 'add_on_parameter_option' objects. +func NewAddOnParameterOptionList() *AddOnParameterOptionListBuilder { + return new(AddOnParameterOptionListBuilder) +} + +// Items sets the items of the list. +func (b *AddOnParameterOptionListBuilder) Items(values ...*AddOnParameterOptionBuilder) *AddOnParameterOptionListBuilder { + b.items = make([]*AddOnParameterOptionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddOnParameterOptionListBuilder) 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 *AddOnParameterOptionListBuilder) Copy(list *AddOnParameterOptionList) *AddOnParameterOptionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddOnParameterOptionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddOnParameterOption().Copy(v) + } + } + return b +} + +// Build creates a list of 'add_on_parameter_option' objects using the +// configuration stored in the builder. +func (b *AddOnParameterOptionListBuilder) Build() (list *AddOnParameterOptionList, err error) { + items := make([]*AddOnParameterOption, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddOnParameterOptionList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_parameter_option_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_parameter_option_list_type_json.go new file mode 100644 index 00000000..fc53b703 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_parameter_option_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnParameterOptionList writes a list of values of the 'add_on_parameter_option' type to +// the given writer. +func MarshalAddOnParameterOptionList(list []*AddOnParameterOption, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnParameterOptionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnParameterOptionList writes a list of value of the 'add_on_parameter_option' type to +// the given stream. +func WriteAddOnParameterOptionList(list []*AddOnParameterOption, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddOnParameterOption(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnParameterOptionList reads a list of values of the 'add_on_parameter_option' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnParameterOptionList(source interface{}) (items []*AddOnParameterOption, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnParameterOptionList(iterator) + err = iterator.Error + return +} + +// ReadAddOnParameterOptionList reads list of values of the ”add_on_parameter_option' type from +// the given iterator. +func ReadAddOnParameterOptionList(iterator *jsoniter.Iterator) []*AddOnParameterOption { + list := []*AddOnParameterOption{} + for iterator.ReadArray() { + item := ReadAddOnParameterOption(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_parameter_option_type.go b/clientapi/clustersmgmt/v1/add_on_parameter_option_type.go new file mode 100644 index 00000000..d4275665 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_parameter_option_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnParameterOption represents the values of the 'add_on_parameter_option' type. +// +// Representation of an add-on parameter option. +type AddOnParameterOption struct { + bitmap_ uint32 + name string + rank int + requirements []*AddOnRequirement + value string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOnParameterOption) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the add-on parameter option. +func (o *AddOnParameterOption) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the add-on parameter option. +func (o *AddOnParameterOption) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Rank returns the value of the 'rank' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Rank of option to be used in cases where editable direction should be restricted. +func (o *AddOnParameterOption) Rank() int { + if o != nil && o.bitmap_&2 != 0 { + return o.rank + } + return 0 +} + +// GetRank returns the value of the 'rank' attribute and +// a flag indicating if the attribute has a value. +// +// Rank of option to be used in cases where editable direction should be restricted. +func (o *AddOnParameterOption) GetRank() (value int, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.rank + } + return +} + +// Requirements returns the value of the 'requirements' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of add-on requirements for this parameter option. +func (o *AddOnParameterOption) Requirements() []*AddOnRequirement { + if o != nil && o.bitmap_&4 != 0 { + return o.requirements + } + return nil +} + +// GetRequirements returns the value of the 'requirements' attribute and +// a flag indicating if the attribute has a value. +// +// List of add-on requirements for this parameter option. +func (o *AddOnParameterOption) GetRequirements() (value []*AddOnRequirement, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.requirements + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Value of the add-on parameter option. +func (o *AddOnParameterOption) Value() string { + if o != nil && o.bitmap_&8 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Value of the add-on parameter option. +func (o *AddOnParameterOption) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.value + } + return +} + +// AddOnParameterOptionListKind is the name of the type used to represent list of objects of +// type 'add_on_parameter_option'. +const AddOnParameterOptionListKind = "AddOnParameterOptionList" + +// AddOnParameterOptionListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on_parameter_option'. +const AddOnParameterOptionListLinkKind = "AddOnParameterOptionListLink" + +// AddOnParameterOptionNilKind is the name of the type used to nil lists of objects of +// type 'add_on_parameter_option'. +const AddOnParameterOptionListNilKind = "AddOnParameterOptionListNil" + +// AddOnParameterOptionList is a list of values of the 'add_on_parameter_option' type. +type AddOnParameterOptionList struct { + href string + link bool + items []*AddOnParameterOption +} + +// Len returns the length of the list. +func (l *AddOnParameterOptionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnParameterOptionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnParameterOptionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnParameterOptionList) SetItems(items []*AddOnParameterOption) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnParameterOptionList) Items() []*AddOnParameterOption { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnParameterOptionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnParameterOptionList) Get(i int) *AddOnParameterOption { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnParameterOptionList) Slice() []*AddOnParameterOption { + var slice []*AddOnParameterOption + if l == nil { + slice = make([]*AddOnParameterOption, 0) + } else { + slice = make([]*AddOnParameterOption, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnParameterOptionList) Each(f func(item *AddOnParameterOption) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnParameterOptionList) Range(f func(index int, item *AddOnParameterOption) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_parameter_option_type_json.go b/clientapi/clustersmgmt/v1/add_on_parameter_option_type_json.go new file mode 100644 index 00000000..3c443c52 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_parameter_option_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnParameterOption writes a value of the 'add_on_parameter_option' type to the given writer. +func MarshalAddOnParameterOption(object *AddOnParameterOption, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnParameterOption(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnParameterOption writes a value of the 'add_on_parameter_option' type to the given stream. +func WriteAddOnParameterOption(object *AddOnParameterOption, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("rank") + stream.WriteInt(object.rank) + count++ + } + present_ = object.bitmap_&4 != 0 && object.requirements != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("requirements") + WriteAddOnRequirementList(object.requirements, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOnParameterOption reads a value of the 'add_on_parameter_option' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOnParameterOption(source interface{}) (object *AddOnParameterOption, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOnParameterOption(iterator) + err = iterator.Error + return +} + +// ReadAddOnParameterOption reads a value of the 'add_on_parameter_option' type from the given iterator. +func ReadAddOnParameterOption(iterator *jsoniter.Iterator) *AddOnParameterOption { + object := &AddOnParameterOption{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "rank": + value := iterator.ReadInt() + object.rank = value + object.bitmap_ |= 2 + case "requirements": + value := ReadAddOnRequirementList(iterator) + object.requirements = value + object.bitmap_ |= 4 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_parameter_type.go b/clientapi/clustersmgmt/v1/add_on_parameter_type.go new file mode 100644 index 00000000..b14e33fe --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_parameter_type.go @@ -0,0 +1,555 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnParameterKind is the name of the type used to represent objects +// of type 'add_on_parameter'. +const AddOnParameterKind = "AddOnParameter" + +// AddOnParameterLinkKind is the name of the type used to represent links +// to objects of type 'add_on_parameter'. +const AddOnParameterLinkKind = "AddOnParameterLink" + +// AddOnParameterNilKind is the name of the type used to nil references +// to objects of type 'add_on_parameter'. +const AddOnParameterNilKind = "AddOnParameterNil" + +// AddOnParameter represents the values of the 'add_on_parameter' type. +// +// Representation of an add-on parameter. +type AddOnParameter struct { + bitmap_ uint32 + id string + href string + addon *AddOn + conditions []*AddOnRequirement + defaultValue string + description string + editableDirection string + name string + options []*AddOnParameterOption + validation string + validationErrMsg string + valueType string + editable bool + enabled bool + required bool +} + +// Kind returns the name of the type of the object. +func (o *AddOnParameter) Kind() string { + if o == nil { + return AddOnParameterNilKind + } + if o.bitmap_&1 != 0 { + return AddOnParameterLinkKind + } + return AddOnParameterKind +} + +// Link returns true if this is a link. +func (o *AddOnParameter) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddOnParameter) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddOnParameter) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddOnParameter) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddOnParameter) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOnParameter) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Addon returns the value of the 'addon' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to add-on. +func (o *AddOnParameter) Addon() *AddOn { + if o != nil && o.bitmap_&8 != 0 { + return o.addon + } + return nil +} + +// GetAddon returns the value of the 'addon' attribute and +// a flag indicating if the attribute has a value. +// +// Link to add-on. +func (o *AddOnParameter) GetAddon() (value *AddOn, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.addon + } + return +} + +// Conditions returns the value of the 'conditions' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Conditions in which this parameter is valid for +func (o *AddOnParameter) Conditions() []*AddOnRequirement { + if o != nil && o.bitmap_&16 != 0 { + return o.conditions + } + return nil +} + +// GetConditions returns the value of the 'conditions' attribute and +// a flag indicating if the attribute has a value. +// +// Conditions in which this parameter is valid for +func (o *AddOnParameter) GetConditions() (value []*AddOnRequirement, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.conditions + } + return +} + +// DefaultValue returns the value of the 'default_value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the value default for the add-on parameter. +func (o *AddOnParameter) DefaultValue() string { + if o != nil && o.bitmap_&32 != 0 { + return o.defaultValue + } + return "" +} + +// GetDefaultValue returns the value of the 'default_value' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the value default for the add-on parameter. +func (o *AddOnParameter) GetDefaultValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.defaultValue + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Description of the add-on parameter. +func (o *AddOnParameter) Description() string { + if o != nil && o.bitmap_&64 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Description of the add-on parameter. +func (o *AddOnParameter) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.description + } + return +} + +// Editable returns the value of the 'editable' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this parameter can be edited after creation. +func (o *AddOnParameter) Editable() bool { + if o != nil && o.bitmap_&128 != 0 { + return o.editable + } + return false +} + +// GetEditable returns the value of the 'editable' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this parameter can be edited after creation. +func (o *AddOnParameter) GetEditable() (value bool, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.editable + } + return +} + +// EditableDirection returns the value of the 'editable_direction' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Restricts if the parameter can be upscaled/downscaled +// Expected values are "up", "down", or "" (no restriction). +func (o *AddOnParameter) EditableDirection() string { + if o != nil && o.bitmap_&256 != 0 { + return o.editableDirection + } + return "" +} + +// GetEditableDirection returns the value of the 'editable_direction' attribute and +// a flag indicating if the attribute has a value. +// +// Restricts if the parameter can be upscaled/downscaled +// Expected values are "up", "down", or "" (no restriction). +func (o *AddOnParameter) GetEditableDirection() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.editableDirection + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this parameter is enabled for the add-on. +func (o *AddOnParameter) Enabled() bool { + if o != nil && o.bitmap_&512 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this parameter is enabled for the add-on. +func (o *AddOnParameter) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.enabled + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the add-on parameter. +func (o *AddOnParameter) Name() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the add-on parameter. +func (o *AddOnParameter) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.name + } + return +} + +// Options returns the value of the 'options' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of options for the add-on parameter value. +func (o *AddOnParameter) Options() []*AddOnParameterOption { + if o != nil && o.bitmap_&2048 != 0 { + return o.options + } + return nil +} + +// GetOptions returns the value of the 'options' attribute and +// a flag indicating if the attribute has a value. +// +// List of options for the add-on parameter value. +func (o *AddOnParameter) GetOptions() (value []*AddOnParameterOption, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.options + } + return +} + +// Required returns the value of the 'required' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this parameter is required by the add-on. +func (o *AddOnParameter) Required() bool { + if o != nil && o.bitmap_&4096 != 0 { + return o.required + } + return false +} + +// GetRequired returns the value of the 'required' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this parameter is required by the add-on. +func (o *AddOnParameter) GetRequired() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.required + } + return +} + +// Validation returns the value of the 'validation' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Validation rule for the add-on parameter. +func (o *AddOnParameter) Validation() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.validation + } + return "" +} + +// GetValidation returns the value of the 'validation' attribute and +// a flag indicating if the attribute has a value. +// +// Validation rule for the add-on parameter. +func (o *AddOnParameter) GetValidation() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.validation + } + return +} + +// ValidationErrMsg returns the value of the 'validation_err_msg' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Error message to return should the parameter be invalid. +func (o *AddOnParameter) ValidationErrMsg() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.validationErrMsg + } + return "" +} + +// GetValidationErrMsg returns the value of the 'validation_err_msg' attribute and +// a flag indicating if the attribute has a value. +// +// Error message to return should the parameter be invalid. +func (o *AddOnParameter) GetValidationErrMsg() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.validationErrMsg + } + return +} + +// ValueType returns the value of the 'value_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of value of the add-on parameter. +func (o *AddOnParameter) ValueType() string { + if o != nil && o.bitmap_&32768 != 0 { + return o.valueType + } + return "" +} + +// GetValueType returns the value of the 'value_type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of value of the add-on parameter. +func (o *AddOnParameter) GetValueType() (value string, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.valueType + } + return +} + +// AddOnParameterListKind is the name of the type used to represent list of objects of +// type 'add_on_parameter'. +const AddOnParameterListKind = "AddOnParameterList" + +// AddOnParameterListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on_parameter'. +const AddOnParameterListLinkKind = "AddOnParameterListLink" + +// AddOnParameterNilKind is the name of the type used to nil lists of objects of +// type 'add_on_parameter'. +const AddOnParameterListNilKind = "AddOnParameterListNil" + +// AddOnParameterList is a list of values of the 'add_on_parameter' type. +type AddOnParameterList struct { + href string + link bool + items []*AddOnParameter +} + +// Kind returns the name of the type of the object. +func (l *AddOnParameterList) Kind() string { + if l == nil { + return AddOnParameterListNilKind + } + if l.link { + return AddOnParameterListLinkKind + } + return AddOnParameterListKind +} + +// Link returns true iif this is a link. +func (l *AddOnParameterList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddOnParameterList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddOnParameterList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddOnParameterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnParameterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnParameterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnParameterList) SetItems(items []*AddOnParameter) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnParameterList) Items() []*AddOnParameter { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnParameterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnParameterList) Get(i int) *AddOnParameter { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnParameterList) Slice() []*AddOnParameter { + var slice []*AddOnParameter + if l == nil { + slice = make([]*AddOnParameter, 0) + } else { + slice = make([]*AddOnParameter, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnParameterList) Each(f func(item *AddOnParameter) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnParameterList) Range(f func(index int, item *AddOnParameter) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_parameter_type_json.go b/clientapi/clustersmgmt/v1/add_on_parameter_type_json.go new file mode 100644 index 00000000..9a6332ca --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_parameter_type_json.go @@ -0,0 +1,276 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnParameter writes a value of the 'add_on_parameter' type to the given writer. +func MarshalAddOnParameter(object *AddOnParameter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnParameter(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnParameter writes a value of the 'add_on_parameter' type to the given stream. +func WriteAddOnParameter(object *AddOnParameter, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddOnParameterLinkKind) + } else { + stream.WriteString(AddOnParameterKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.addon != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("addon") + WriteAddOn(object.addon, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.conditions != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("conditions") + WriteAddOnRequirementList(object.conditions, stream) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("default_value") + stream.WriteString(object.defaultValue) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("editable") + stream.WriteBool(object.editable) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("editable_direction") + stream.WriteString(object.editableDirection) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.options != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("options") + WriteAddOnParameterOptionList(object.options, stream) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("required") + stream.WriteBool(object.required) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("validation") + stream.WriteString(object.validation) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("validation_err_msg") + stream.WriteString(object.validationErrMsg) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value_type") + stream.WriteString(object.valueType) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOnParameter reads a value of the 'add_on_parameter' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOnParameter(source interface{}) (object *AddOnParameter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOnParameter(iterator) + err = iterator.Error + return +} + +// ReadAddOnParameter reads a value of the 'add_on_parameter' type from the given iterator. +func ReadAddOnParameter(iterator *jsoniter.Iterator) *AddOnParameter { + object := &AddOnParameter{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddOnParameterLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "addon": + value := ReadAddOn(iterator) + object.addon = value + object.bitmap_ |= 8 + case "conditions": + value := ReadAddOnRequirementList(iterator) + object.conditions = value + object.bitmap_ |= 16 + case "default_value": + value := iterator.ReadString() + object.defaultValue = value + object.bitmap_ |= 32 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 64 + case "editable": + value := iterator.ReadBool() + object.editable = value + object.bitmap_ |= 128 + case "editable_direction": + value := iterator.ReadString() + object.editableDirection = value + object.bitmap_ |= 256 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 512 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1024 + case "options": + value := ReadAddOnParameterOptionList(iterator) + object.options = value + object.bitmap_ |= 2048 + case "required": + value := iterator.ReadBool() + object.required = value + object.bitmap_ |= 4096 + case "validation": + value := iterator.ReadString() + object.validation = value + object.bitmap_ |= 8192 + case "validation_err_msg": + value := iterator.ReadString() + object.validationErrMsg = value + object.bitmap_ |= 16384 + case "value_type": + value := iterator.ReadString() + object.valueType = value + object.bitmap_ |= 32768 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_requirement_builder.go b/clientapi/clustersmgmt/v1/add_on_requirement_builder.go new file mode 100644 index 00000000..e2d31c81 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_requirement_builder.go @@ -0,0 +1,134 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnRequirementBuilder contains the data and logic needed to build 'add_on_requirement' objects. +// +// Representation of an add-on requirement. +type AddOnRequirementBuilder struct { + bitmap_ uint32 + id string + data map[string]interface{} + resource string + status *AddOnRequirementStatusBuilder + enabled bool +} + +// NewAddOnRequirement creates a new builder of 'add_on_requirement' objects. +func NewAddOnRequirement() *AddOnRequirementBuilder { + return &AddOnRequirementBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnRequirementBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *AddOnRequirementBuilder) ID(value string) *AddOnRequirementBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// Data sets the value of the 'data' attribute to the given value. +func (b *AddOnRequirementBuilder) Data(value map[string]interface{}) *AddOnRequirementBuilder { + b.data = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddOnRequirementBuilder) Enabled(value bool) *AddOnRequirementBuilder { + b.enabled = value + b.bitmap_ |= 4 + return b +} + +// Resource sets the value of the 'resource' attribute to the given value. +func (b *AddOnRequirementBuilder) Resource(value string) *AddOnRequirementBuilder { + b.resource = value + b.bitmap_ |= 8 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +// +// Representation of an add-on requirement status. +func (b *AddOnRequirementBuilder) Status(value *AddOnRequirementStatusBuilder) *AddOnRequirementBuilder { + b.status = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddOnRequirementBuilder) Copy(object *AddOnRequirement) *AddOnRequirementBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + if len(object.data) > 0 { + b.data = map[string]interface{}{} + for k, v := range object.data { + b.data[k] = v + } + } else { + b.data = nil + } + b.enabled = object.enabled + b.resource = object.resource + if object.status != nil { + b.status = NewAddOnRequirementStatus().Copy(object.status) + } else { + b.status = nil + } + return b +} + +// Build creates a 'add_on_requirement' object using the configuration stored in the builder. +func (b *AddOnRequirementBuilder) Build() (object *AddOnRequirement, err error) { + object = new(AddOnRequirement) + object.bitmap_ = b.bitmap_ + object.id = b.id + if b.data != nil { + object.data = make(map[string]interface{}) + for k, v := range b.data { + object.data[k] = v + } + } + object.enabled = b.enabled + object.resource = b.resource + if b.status != nil { + object.status, err = b.status.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_requirement_list_builder.go b/clientapi/clustersmgmt/v1/add_on_requirement_list_builder.go new file mode 100644 index 00000000..14f0bd98 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_requirement_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnRequirementListBuilder contains the data and logic needed to build +// 'add_on_requirement' objects. +type AddOnRequirementListBuilder struct { + items []*AddOnRequirementBuilder +} + +// NewAddOnRequirementList creates a new builder of 'add_on_requirement' objects. +func NewAddOnRequirementList() *AddOnRequirementListBuilder { + return new(AddOnRequirementListBuilder) +} + +// Items sets the items of the list. +func (b *AddOnRequirementListBuilder) Items(values ...*AddOnRequirementBuilder) *AddOnRequirementListBuilder { + b.items = make([]*AddOnRequirementBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddOnRequirementListBuilder) 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 *AddOnRequirementListBuilder) Copy(list *AddOnRequirementList) *AddOnRequirementListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddOnRequirementBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddOnRequirement().Copy(v) + } + } + return b +} + +// Build creates a list of 'add_on_requirement' objects using the +// configuration stored in the builder. +func (b *AddOnRequirementListBuilder) Build() (list *AddOnRequirementList, err error) { + items := make([]*AddOnRequirement, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddOnRequirementList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_requirement_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_requirement_list_type_json.go new file mode 100644 index 00000000..bbf393aa --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_requirement_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnRequirementList writes a list of values of the 'add_on_requirement' type to +// the given writer. +func MarshalAddOnRequirementList(list []*AddOnRequirement, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnRequirementList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnRequirementList writes a list of value of the 'add_on_requirement' type to +// the given stream. +func WriteAddOnRequirementList(list []*AddOnRequirement, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddOnRequirement(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnRequirementList reads a list of values of the 'add_on_requirement' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnRequirementList(source interface{}) (items []*AddOnRequirement, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnRequirementList(iterator) + err = iterator.Error + return +} + +// ReadAddOnRequirementList reads list of values of the ”add_on_requirement' type from +// the given iterator. +func ReadAddOnRequirementList(iterator *jsoniter.Iterator) []*AddOnRequirement { + list := []*AddOnRequirement{} + for iterator.ReadArray() { + item := ReadAddOnRequirement(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_requirement_status_builder.go b/clientapi/clustersmgmt/v1/add_on_requirement_status_builder.go new file mode 100644 index 00000000..15ac0aad --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_requirement_status_builder.go @@ -0,0 +1,82 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnRequirementStatusBuilder contains the data and logic needed to build 'add_on_requirement_status' objects. +// +// Representation of an add-on requirement status. +type AddOnRequirementStatusBuilder struct { + bitmap_ uint32 + errorMsgs []string + fulfilled bool +} + +// NewAddOnRequirementStatus creates a new builder of 'add_on_requirement_status' objects. +func NewAddOnRequirementStatus() *AddOnRequirementStatusBuilder { + return &AddOnRequirementStatusBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnRequirementStatusBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ErrorMsgs sets the value of the 'error_msgs' attribute to the given values. +func (b *AddOnRequirementStatusBuilder) ErrorMsgs(values ...string) *AddOnRequirementStatusBuilder { + b.errorMsgs = make([]string, len(values)) + copy(b.errorMsgs, values) + b.bitmap_ |= 1 + return b +} + +// Fulfilled sets the value of the 'fulfilled' attribute to the given value. +func (b *AddOnRequirementStatusBuilder) Fulfilled(value bool) *AddOnRequirementStatusBuilder { + b.fulfilled = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddOnRequirementStatusBuilder) Copy(object *AddOnRequirementStatus) *AddOnRequirementStatusBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.errorMsgs != nil { + b.errorMsgs = make([]string, len(object.errorMsgs)) + copy(b.errorMsgs, object.errorMsgs) + } else { + b.errorMsgs = nil + } + b.fulfilled = object.fulfilled + return b +} + +// Build creates a 'add_on_requirement_status' object using the configuration stored in the builder. +func (b *AddOnRequirementStatusBuilder) Build() (object *AddOnRequirementStatus, err error) { + object = new(AddOnRequirementStatus) + object.bitmap_ = b.bitmap_ + if b.errorMsgs != nil { + object.errorMsgs = make([]string, len(b.errorMsgs)) + copy(object.errorMsgs, b.errorMsgs) + } + object.fulfilled = b.fulfilled + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_requirement_status_list_builder.go b/clientapi/clustersmgmt/v1/add_on_requirement_status_list_builder.go new file mode 100644 index 00000000..a9519d51 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_requirement_status_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnRequirementStatusListBuilder contains the data and logic needed to build +// 'add_on_requirement_status' objects. +type AddOnRequirementStatusListBuilder struct { + items []*AddOnRequirementStatusBuilder +} + +// NewAddOnRequirementStatusList creates a new builder of 'add_on_requirement_status' objects. +func NewAddOnRequirementStatusList() *AddOnRequirementStatusListBuilder { + return new(AddOnRequirementStatusListBuilder) +} + +// Items sets the items of the list. +func (b *AddOnRequirementStatusListBuilder) Items(values ...*AddOnRequirementStatusBuilder) *AddOnRequirementStatusListBuilder { + b.items = make([]*AddOnRequirementStatusBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddOnRequirementStatusListBuilder) 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 *AddOnRequirementStatusListBuilder) Copy(list *AddOnRequirementStatusList) *AddOnRequirementStatusListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddOnRequirementStatusBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddOnRequirementStatus().Copy(v) + } + } + return b +} + +// Build creates a list of 'add_on_requirement_status' objects using the +// configuration stored in the builder. +func (b *AddOnRequirementStatusListBuilder) Build() (list *AddOnRequirementStatusList, err error) { + items := make([]*AddOnRequirementStatus, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddOnRequirementStatusList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_requirement_status_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_requirement_status_list_type_json.go new file mode 100644 index 00000000..9e85b36b --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_requirement_status_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnRequirementStatusList writes a list of values of the 'add_on_requirement_status' type to +// the given writer. +func MarshalAddOnRequirementStatusList(list []*AddOnRequirementStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnRequirementStatusList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnRequirementStatusList writes a list of value of the 'add_on_requirement_status' type to +// the given stream. +func WriteAddOnRequirementStatusList(list []*AddOnRequirementStatus, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddOnRequirementStatus(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnRequirementStatusList reads a list of values of the 'add_on_requirement_status' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnRequirementStatusList(source interface{}) (items []*AddOnRequirementStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnRequirementStatusList(iterator) + err = iterator.Error + return +} + +// ReadAddOnRequirementStatusList reads list of values of the ”add_on_requirement_status' type from +// the given iterator. +func ReadAddOnRequirementStatusList(iterator *jsoniter.Iterator) []*AddOnRequirementStatus { + list := []*AddOnRequirementStatus{} + for iterator.ReadArray() { + item := ReadAddOnRequirementStatus(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_requirement_status_type.go b/clientapi/clustersmgmt/v1/add_on_requirement_status_type.go new file mode 100644 index 00000000..3a948880 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_requirement_status_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnRequirementStatus represents the values of the 'add_on_requirement_status' type. +// +// Representation of an add-on requirement status. +type AddOnRequirementStatus struct { + bitmap_ uint32 + errorMsgs []string + fulfilled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOnRequirementStatus) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ErrorMsgs returns the value of the 'error_msgs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Error messages detailing reasons for unfulfilled requirements. +func (o *AddOnRequirementStatus) ErrorMsgs() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.errorMsgs + } + return nil +} + +// GetErrorMsgs returns the value of the 'error_msgs' attribute and +// a flag indicating if the attribute has a value. +// +// Error messages detailing reasons for unfulfilled requirements. +func (o *AddOnRequirementStatus) GetErrorMsgs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.errorMsgs + } + return +} + +// Fulfilled returns the value of the 'fulfilled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this requirement is fulfilled. +func (o *AddOnRequirementStatus) Fulfilled() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.fulfilled + } + return false +} + +// GetFulfilled returns the value of the 'fulfilled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this requirement is fulfilled. +func (o *AddOnRequirementStatus) GetFulfilled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.fulfilled + } + return +} + +// AddOnRequirementStatusListKind is the name of the type used to represent list of objects of +// type 'add_on_requirement_status'. +const AddOnRequirementStatusListKind = "AddOnRequirementStatusList" + +// AddOnRequirementStatusListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on_requirement_status'. +const AddOnRequirementStatusListLinkKind = "AddOnRequirementStatusListLink" + +// AddOnRequirementStatusNilKind is the name of the type used to nil lists of objects of +// type 'add_on_requirement_status'. +const AddOnRequirementStatusListNilKind = "AddOnRequirementStatusListNil" + +// AddOnRequirementStatusList is a list of values of the 'add_on_requirement_status' type. +type AddOnRequirementStatusList struct { + href string + link bool + items []*AddOnRequirementStatus +} + +// Len returns the length of the list. +func (l *AddOnRequirementStatusList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnRequirementStatusList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnRequirementStatusList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnRequirementStatusList) SetItems(items []*AddOnRequirementStatus) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnRequirementStatusList) Items() []*AddOnRequirementStatus { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnRequirementStatusList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnRequirementStatusList) Get(i int) *AddOnRequirementStatus { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnRequirementStatusList) Slice() []*AddOnRequirementStatus { + var slice []*AddOnRequirementStatus + if l == nil { + slice = make([]*AddOnRequirementStatus, 0) + } else { + slice = make([]*AddOnRequirementStatus, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnRequirementStatusList) Each(f func(item *AddOnRequirementStatus) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnRequirementStatusList) Range(f func(index int, item *AddOnRequirementStatus) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_requirement_status_type_json.go b/clientapi/clustersmgmt/v1/add_on_requirement_status_type_json.go new file mode 100644 index 00000000..3a8aa93b --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_requirement_status_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnRequirementStatus writes a value of the 'add_on_requirement_status' type to the given writer. +func MarshalAddOnRequirementStatus(object *AddOnRequirementStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnRequirementStatus(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnRequirementStatus writes a value of the 'add_on_requirement_status' type to the given stream. +func WriteAddOnRequirementStatus(object *AddOnRequirementStatus, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.errorMsgs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("error_msgs") + WriteStringList(object.errorMsgs, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("fulfilled") + stream.WriteBool(object.fulfilled) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOnRequirementStatus reads a value of the 'add_on_requirement_status' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOnRequirementStatus(source interface{}) (object *AddOnRequirementStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOnRequirementStatus(iterator) + err = iterator.Error + return +} + +// ReadAddOnRequirementStatus reads a value of the 'add_on_requirement_status' type from the given iterator. +func ReadAddOnRequirementStatus(iterator *jsoniter.Iterator) *AddOnRequirementStatus { + object := &AddOnRequirementStatus{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "error_msgs": + value := ReadStringList(iterator) + object.errorMsgs = value + object.bitmap_ |= 1 + case "fulfilled": + value := iterator.ReadBool() + object.fulfilled = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_requirement_type.go b/clientapi/clustersmgmt/v1/add_on_requirement_type.go new file mode 100644 index 00000000..00b59ec6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_requirement_type.go @@ -0,0 +1,261 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnRequirement represents the values of the 'add_on_requirement' type. +// +// Representation of an add-on requirement. +type AddOnRequirement struct { + bitmap_ uint32 + id string + data map[string]interface{} + resource string + status *AddOnRequirementStatus + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOnRequirement) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID of the add-on requirement. +func (o *AddOnRequirement) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID of the add-on requirement. +func (o *AddOnRequirement) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// Data returns the value of the 'data' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Data for the add-on requirement. +func (o *AddOnRequirement) Data() map[string]interface{} { + if o != nil && o.bitmap_&2 != 0 { + return o.data + } + return nil +} + +// GetData returns the value of the 'data' attribute and +// a flag indicating if the attribute has a value. +// +// Data for the add-on requirement. +func (o *AddOnRequirement) GetData() (value map[string]interface{}, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.data + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this requirement is enabled for the add-on. +func (o *AddOnRequirement) Enabled() bool { + if o != nil && o.bitmap_&4 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this requirement is enabled for the add-on. +func (o *AddOnRequirement) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.enabled + } + return +} + +// Resource returns the value of the 'resource' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of resource of the add-on requirement. +func (o *AddOnRequirement) Resource() string { + if o != nil && o.bitmap_&8 != 0 { + return o.resource + } + return "" +} + +// GetResource returns the value of the 'resource' attribute and +// a flag indicating if the attribute has a value. +// +// Type of resource of the add-on requirement. +func (o *AddOnRequirement) GetResource() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.resource + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional cluster specific status for the add-on. +func (o *AddOnRequirement) Status() *AddOnRequirementStatus { + if o != nil && o.bitmap_&16 != 0 { + return o.status + } + return nil +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// Optional cluster specific status for the add-on. +func (o *AddOnRequirement) GetStatus() (value *AddOnRequirementStatus, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.status + } + return +} + +// AddOnRequirementListKind is the name of the type used to represent list of objects of +// type 'add_on_requirement'. +const AddOnRequirementListKind = "AddOnRequirementList" + +// AddOnRequirementListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on_requirement'. +const AddOnRequirementListLinkKind = "AddOnRequirementListLink" + +// AddOnRequirementNilKind is the name of the type used to nil lists of objects of +// type 'add_on_requirement'. +const AddOnRequirementListNilKind = "AddOnRequirementListNil" + +// AddOnRequirementList is a list of values of the 'add_on_requirement' type. +type AddOnRequirementList struct { + href string + link bool + items []*AddOnRequirement +} + +// Len returns the length of the list. +func (l *AddOnRequirementList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnRequirementList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnRequirementList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnRequirementList) SetItems(items []*AddOnRequirement) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnRequirementList) Items() []*AddOnRequirement { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnRequirementList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnRequirementList) Get(i int) *AddOnRequirement { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnRequirementList) Slice() []*AddOnRequirement { + var slice []*AddOnRequirement + if l == nil { + slice = make([]*AddOnRequirement, 0) + } else { + slice = make([]*AddOnRequirement, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnRequirementList) Each(f func(item *AddOnRequirement) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnRequirementList) Range(f func(index int, item *AddOnRequirement) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_requirement_type_json.go b/clientapi/clustersmgmt/v1/add_on_requirement_type_json.go new file mode 100644 index 00000000..1eb71c0a --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_requirement_type_json.go @@ -0,0 +1,168 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnRequirement writes a value of the 'add_on_requirement' type to the given writer. +func MarshalAddOnRequirement(object *AddOnRequirement, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnRequirement(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnRequirement writes a value of the 'add_on_requirement' type to the given stream. +func WriteAddOnRequirement(object *AddOnRequirement, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 && object.data != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("data") + if object.data != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.data)) + i := 0 + for key := range object.data { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.data[key] + stream.WriteObjectField(key) + stream.WriteVal(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource") + stream.WriteString(object.resource) + count++ + } + present_ = object.bitmap_&16 != 0 && object.status != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + WriteAddOnRequirementStatus(object.status, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOnRequirement reads a value of the 'add_on_requirement' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOnRequirement(source interface{}) (object *AddOnRequirement, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOnRequirement(iterator) + err = iterator.Error + return +} + +// ReadAddOnRequirement reads a value of the 'add_on_requirement' type from the given iterator. +func ReadAddOnRequirement(iterator *jsoniter.Iterator) *AddOnRequirement { + object := &AddOnRequirement{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "data": + value := map[string]interface{}{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + var item interface{} + iterator.ReadVal(&item) + value[key] = item + } + object.data = value + object.bitmap_ |= 2 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 4 + case "resource": + value := iterator.ReadString() + object.resource = value + object.bitmap_ |= 8 + case "status": + value := ReadAddOnRequirementStatus(iterator) + object.status = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_secret_propagation_builder.go b/clientapi/clustersmgmt/v1/add_on_secret_propagation_builder.go new file mode 100644 index 00000000..9dd7f59d --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_secret_propagation_builder.go @@ -0,0 +1,93 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnSecretPropagationBuilder contains the data and logic needed to build 'add_on_secret_propagation' objects. +// +// Representation of an addon secret propagation +type AddOnSecretPropagationBuilder struct { + bitmap_ uint32 + id string + destinationSecret string + sourceSecret string + enabled bool +} + +// NewAddOnSecretPropagation creates a new builder of 'add_on_secret_propagation' objects. +func NewAddOnSecretPropagation() *AddOnSecretPropagationBuilder { + return &AddOnSecretPropagationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnSecretPropagationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *AddOnSecretPropagationBuilder) ID(value string) *AddOnSecretPropagationBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// DestinationSecret sets the value of the 'destination_secret' attribute to the given value. +func (b *AddOnSecretPropagationBuilder) DestinationSecret(value string) *AddOnSecretPropagationBuilder { + b.destinationSecret = value + b.bitmap_ |= 2 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddOnSecretPropagationBuilder) Enabled(value bool) *AddOnSecretPropagationBuilder { + b.enabled = value + b.bitmap_ |= 4 + return b +} + +// SourceSecret sets the value of the 'source_secret' attribute to the given value. +func (b *AddOnSecretPropagationBuilder) SourceSecret(value string) *AddOnSecretPropagationBuilder { + b.sourceSecret = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddOnSecretPropagationBuilder) Copy(object *AddOnSecretPropagation) *AddOnSecretPropagationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.destinationSecret = object.destinationSecret + b.enabled = object.enabled + b.sourceSecret = object.sourceSecret + return b +} + +// Build creates a 'add_on_secret_propagation' object using the configuration stored in the builder. +func (b *AddOnSecretPropagationBuilder) Build() (object *AddOnSecretPropagation, err error) { + object = new(AddOnSecretPropagation) + object.bitmap_ = b.bitmap_ + object.id = b.id + object.destinationSecret = b.destinationSecret + object.enabled = b.enabled + object.sourceSecret = b.sourceSecret + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_secret_propagation_list_builder.go b/clientapi/clustersmgmt/v1/add_on_secret_propagation_list_builder.go new file mode 100644 index 00000000..9926d394 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_secret_propagation_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnSecretPropagationListBuilder contains the data and logic needed to build +// 'add_on_secret_propagation' objects. +type AddOnSecretPropagationListBuilder struct { + items []*AddOnSecretPropagationBuilder +} + +// NewAddOnSecretPropagationList creates a new builder of 'add_on_secret_propagation' objects. +func NewAddOnSecretPropagationList() *AddOnSecretPropagationListBuilder { + return new(AddOnSecretPropagationListBuilder) +} + +// Items sets the items of the list. +func (b *AddOnSecretPropagationListBuilder) Items(values ...*AddOnSecretPropagationBuilder) *AddOnSecretPropagationListBuilder { + b.items = make([]*AddOnSecretPropagationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddOnSecretPropagationListBuilder) 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 *AddOnSecretPropagationListBuilder) Copy(list *AddOnSecretPropagationList) *AddOnSecretPropagationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddOnSecretPropagationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddOnSecretPropagation().Copy(v) + } + } + return b +} + +// Build creates a list of 'add_on_secret_propagation' objects using the +// configuration stored in the builder. +func (b *AddOnSecretPropagationListBuilder) Build() (list *AddOnSecretPropagationList, err error) { + items := make([]*AddOnSecretPropagation, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddOnSecretPropagationList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_secret_propagation_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_secret_propagation_list_type_json.go new file mode 100644 index 00000000..0884d156 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_secret_propagation_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnSecretPropagationList writes a list of values of the 'add_on_secret_propagation' type to +// the given writer. +func MarshalAddOnSecretPropagationList(list []*AddOnSecretPropagation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnSecretPropagationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnSecretPropagationList writes a list of value of the 'add_on_secret_propagation' type to +// the given stream. +func WriteAddOnSecretPropagationList(list []*AddOnSecretPropagation, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddOnSecretPropagation(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnSecretPropagationList reads a list of values of the 'add_on_secret_propagation' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnSecretPropagationList(source interface{}) (items []*AddOnSecretPropagation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnSecretPropagationList(iterator) + err = iterator.Error + return +} + +// ReadAddOnSecretPropagationList reads list of values of the ”add_on_secret_propagation' type from +// the given iterator. +func ReadAddOnSecretPropagationList(iterator *jsoniter.Iterator) []*AddOnSecretPropagation { + list := []*AddOnSecretPropagation{} + for iterator.ReadArray() { + item := ReadAddOnSecretPropagation(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_secret_propagation_type.go b/clientapi/clustersmgmt/v1/add_on_secret_propagation_type.go new file mode 100644 index 00000000..c9e08d38 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_secret_propagation_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnSecretPropagation represents the values of the 'add_on_secret_propagation' type. +// +// Representation of an addon secret propagation +type AddOnSecretPropagation struct { + bitmap_ uint32 + id string + destinationSecret string + sourceSecret string + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOnSecretPropagation) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID of the secret propagation +func (o *AddOnSecretPropagation) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID of the secret propagation +func (o *AddOnSecretPropagation) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// DestinationSecret returns the value of the 'destination_secret' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DestinationSecret is location of the secret to be added +func (o *AddOnSecretPropagation) DestinationSecret() string { + if o != nil && o.bitmap_&2 != 0 { + return o.destinationSecret + } + return "" +} + +// GetDestinationSecret returns the value of the 'destination_secret' attribute and +// a flag indicating if the attribute has a value. +// +// DestinationSecret is location of the secret to be added +func (o *AddOnSecretPropagation) GetDestinationSecret() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.destinationSecret + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates is this secret propagation is enabled for the addon +func (o *AddOnSecretPropagation) Enabled() bool { + if o != nil && o.bitmap_&4 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates is this secret propagation is enabled for the addon +func (o *AddOnSecretPropagation) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.enabled + } + return +} + +// SourceSecret returns the value of the 'source_secret' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// SourceSecret is location of the source secret +func (o *AddOnSecretPropagation) SourceSecret() string { + if o != nil && o.bitmap_&8 != 0 { + return o.sourceSecret + } + return "" +} + +// GetSourceSecret returns the value of the 'source_secret' attribute and +// a flag indicating if the attribute has a value. +// +// SourceSecret is location of the source secret +func (o *AddOnSecretPropagation) GetSourceSecret() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.sourceSecret + } + return +} + +// AddOnSecretPropagationListKind is the name of the type used to represent list of objects of +// type 'add_on_secret_propagation'. +const AddOnSecretPropagationListKind = "AddOnSecretPropagationList" + +// AddOnSecretPropagationListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on_secret_propagation'. +const AddOnSecretPropagationListLinkKind = "AddOnSecretPropagationListLink" + +// AddOnSecretPropagationNilKind is the name of the type used to nil lists of objects of +// type 'add_on_secret_propagation'. +const AddOnSecretPropagationListNilKind = "AddOnSecretPropagationListNil" + +// AddOnSecretPropagationList is a list of values of the 'add_on_secret_propagation' type. +type AddOnSecretPropagationList struct { + href string + link bool + items []*AddOnSecretPropagation +} + +// Len returns the length of the list. +func (l *AddOnSecretPropagationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnSecretPropagationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnSecretPropagationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnSecretPropagationList) SetItems(items []*AddOnSecretPropagation) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnSecretPropagationList) Items() []*AddOnSecretPropagation { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnSecretPropagationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnSecretPropagationList) Get(i int) *AddOnSecretPropagation { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnSecretPropagationList) Slice() []*AddOnSecretPropagation { + var slice []*AddOnSecretPropagation + if l == nil { + slice = make([]*AddOnSecretPropagation, 0) + } else { + slice = make([]*AddOnSecretPropagation, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnSecretPropagationList) Each(f func(item *AddOnSecretPropagation) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnSecretPropagationList) Range(f func(index int, item *AddOnSecretPropagation) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_secret_propagation_type_json.go b/clientapi/clustersmgmt/v1/add_on_secret_propagation_type_json.go new file mode 100644 index 00000000..4d574bce --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_secret_propagation_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnSecretPropagation writes a value of the 'add_on_secret_propagation' type to the given writer. +func MarshalAddOnSecretPropagation(object *AddOnSecretPropagation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnSecretPropagation(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnSecretPropagation writes a value of the 'add_on_secret_propagation' type to the given stream. +func WriteAddOnSecretPropagation(object *AddOnSecretPropagation, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("destination_secret") + stream.WriteString(object.destinationSecret) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("source_secret") + stream.WriteString(object.sourceSecret) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOnSecretPropagation reads a value of the 'add_on_secret_propagation' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOnSecretPropagation(source interface{}) (object *AddOnSecretPropagation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOnSecretPropagation(iterator) + err = iterator.Error + return +} + +// ReadAddOnSecretPropagation reads a value of the 'add_on_secret_propagation' type from the given iterator. +func ReadAddOnSecretPropagation(iterator *jsoniter.Iterator) *AddOnSecretPropagation { + object := &AddOnSecretPropagation{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "destination_secret": + value := iterator.ReadString() + object.destinationSecret = value + object.bitmap_ |= 2 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 4 + case "source_secret": + value := iterator.ReadString() + object.sourceSecret = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_sub_operator_builder.go b/clientapi/clustersmgmt/v1/add_on_sub_operator_builder.go new file mode 100644 index 00000000..06dbdc1c --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_sub_operator_builder.go @@ -0,0 +1,84 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnSubOperatorBuilder contains the data and logic needed to build 'add_on_sub_operator' objects. +// +// Representation of an add-on sub operator. A sub operator is an operator +// who's life cycle is controlled by the add-on umbrella operator. +type AddOnSubOperatorBuilder struct { + bitmap_ uint32 + operatorName string + operatorNamespace string + enabled bool +} + +// NewAddOnSubOperator creates a new builder of 'add_on_sub_operator' objects. +func NewAddOnSubOperator() *AddOnSubOperatorBuilder { + return &AddOnSubOperatorBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnSubOperatorBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddOnSubOperatorBuilder) Enabled(value bool) *AddOnSubOperatorBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// OperatorName sets the value of the 'operator_name' attribute to the given value. +func (b *AddOnSubOperatorBuilder) OperatorName(value string) *AddOnSubOperatorBuilder { + b.operatorName = value + b.bitmap_ |= 2 + return b +} + +// OperatorNamespace sets the value of the 'operator_namespace' attribute to the given value. +func (b *AddOnSubOperatorBuilder) OperatorNamespace(value string) *AddOnSubOperatorBuilder { + b.operatorNamespace = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddOnSubOperatorBuilder) Copy(object *AddOnSubOperator) *AddOnSubOperatorBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + b.operatorName = object.operatorName + b.operatorNamespace = object.operatorNamespace + return b +} + +// Build creates a 'add_on_sub_operator' object using the configuration stored in the builder. +func (b *AddOnSubOperatorBuilder) Build() (object *AddOnSubOperator, err error) { + object = new(AddOnSubOperator) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + object.operatorName = b.operatorName + object.operatorNamespace = b.operatorNamespace + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_sub_operator_list_builder.go b/clientapi/clustersmgmt/v1/add_on_sub_operator_list_builder.go new file mode 100644 index 00000000..c8e02962 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_sub_operator_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnSubOperatorListBuilder contains the data and logic needed to build +// 'add_on_sub_operator' objects. +type AddOnSubOperatorListBuilder struct { + items []*AddOnSubOperatorBuilder +} + +// NewAddOnSubOperatorList creates a new builder of 'add_on_sub_operator' objects. +func NewAddOnSubOperatorList() *AddOnSubOperatorListBuilder { + return new(AddOnSubOperatorListBuilder) +} + +// Items sets the items of the list. +func (b *AddOnSubOperatorListBuilder) Items(values ...*AddOnSubOperatorBuilder) *AddOnSubOperatorListBuilder { + b.items = make([]*AddOnSubOperatorBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddOnSubOperatorListBuilder) 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 *AddOnSubOperatorListBuilder) Copy(list *AddOnSubOperatorList) *AddOnSubOperatorListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddOnSubOperatorBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddOnSubOperator().Copy(v) + } + } + return b +} + +// Build creates a list of 'add_on_sub_operator' objects using the +// configuration stored in the builder. +func (b *AddOnSubOperatorListBuilder) Build() (list *AddOnSubOperatorList, err error) { + items := make([]*AddOnSubOperator, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddOnSubOperatorList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_sub_operator_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_sub_operator_list_type_json.go new file mode 100644 index 00000000..fa9b2054 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_sub_operator_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnSubOperatorList writes a list of values of the 'add_on_sub_operator' type to +// the given writer. +func MarshalAddOnSubOperatorList(list []*AddOnSubOperator, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnSubOperatorList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnSubOperatorList writes a list of value of the 'add_on_sub_operator' type to +// the given stream. +func WriteAddOnSubOperatorList(list []*AddOnSubOperator, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddOnSubOperator(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnSubOperatorList reads a list of values of the 'add_on_sub_operator' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnSubOperatorList(source interface{}) (items []*AddOnSubOperator, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnSubOperatorList(iterator) + err = iterator.Error + return +} + +// ReadAddOnSubOperatorList reads list of values of the ”add_on_sub_operator' type from +// the given iterator. +func ReadAddOnSubOperatorList(iterator *jsoniter.Iterator) []*AddOnSubOperator { + list := []*AddOnSubOperator{} + for iterator.ReadArray() { + item := ReadAddOnSubOperator(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_sub_operator_type.go b/clientapi/clustersmgmt/v1/add_on_sub_operator_type.go new file mode 100644 index 00000000..136b86b9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_sub_operator_type.go @@ -0,0 +1,214 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnSubOperator represents the values of the 'add_on_sub_operator' type. +// +// Representation of an add-on sub operator. A sub operator is an operator +// who's life cycle is controlled by the add-on umbrella operator. +type AddOnSubOperator struct { + bitmap_ uint32 + operatorName string + operatorNamespace string + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOnSubOperator) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if the sub operator is enabled for the add-on +func (o *AddOnSubOperator) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if the sub operator is enabled for the add-on +func (o *AddOnSubOperator) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// OperatorName returns the value of the 'operator_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the add-on sub operator +func (o *AddOnSubOperator) OperatorName() string { + if o != nil && o.bitmap_&2 != 0 { + return o.operatorName + } + return "" +} + +// GetOperatorName returns the value of the 'operator_name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the add-on sub operator +func (o *AddOnSubOperator) GetOperatorName() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.operatorName + } + return +} + +// OperatorNamespace returns the value of the 'operator_namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Namespace of the add-on sub operator +func (o *AddOnSubOperator) OperatorNamespace() string { + if o != nil && o.bitmap_&4 != 0 { + return o.operatorNamespace + } + return "" +} + +// GetOperatorNamespace returns the value of the 'operator_namespace' attribute and +// a flag indicating if the attribute has a value. +// +// Namespace of the add-on sub operator +func (o *AddOnSubOperator) GetOperatorNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.operatorNamespace + } + return +} + +// AddOnSubOperatorListKind is the name of the type used to represent list of objects of +// type 'add_on_sub_operator'. +const AddOnSubOperatorListKind = "AddOnSubOperatorList" + +// AddOnSubOperatorListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on_sub_operator'. +const AddOnSubOperatorListLinkKind = "AddOnSubOperatorListLink" + +// AddOnSubOperatorNilKind is the name of the type used to nil lists of objects of +// type 'add_on_sub_operator'. +const AddOnSubOperatorListNilKind = "AddOnSubOperatorListNil" + +// AddOnSubOperatorList is a list of values of the 'add_on_sub_operator' type. +type AddOnSubOperatorList struct { + href string + link bool + items []*AddOnSubOperator +} + +// Len returns the length of the list. +func (l *AddOnSubOperatorList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnSubOperatorList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnSubOperatorList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnSubOperatorList) SetItems(items []*AddOnSubOperator) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnSubOperatorList) Items() []*AddOnSubOperator { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnSubOperatorList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnSubOperatorList) Get(i int) *AddOnSubOperator { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnSubOperatorList) Slice() []*AddOnSubOperator { + var slice []*AddOnSubOperator + if l == nil { + slice = make([]*AddOnSubOperator, 0) + } else { + slice = make([]*AddOnSubOperator, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnSubOperatorList) Each(f func(item *AddOnSubOperator) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnSubOperatorList) Range(f func(index int, item *AddOnSubOperator) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_sub_operator_type_json.go b/clientapi/clustersmgmt/v1/add_on_sub_operator_type_json.go new file mode 100644 index 00000000..07fcaf64 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_sub_operator_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnSubOperator writes a value of the 'add_on_sub_operator' type to the given writer. +func MarshalAddOnSubOperator(object *AddOnSubOperator, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnSubOperator(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnSubOperator writes a value of the 'add_on_sub_operator' type to the given stream. +func WriteAddOnSubOperator(object *AddOnSubOperator, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_name") + stream.WriteString(object.operatorName) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_namespace") + stream.WriteString(object.operatorNamespace) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOnSubOperator reads a value of the 'add_on_sub_operator' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOnSubOperator(source interface{}) (object *AddOnSubOperator, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOnSubOperator(iterator) + err = iterator.Error + return +} + +// ReadAddOnSubOperator reads a value of the 'add_on_sub_operator' type from the given iterator. +func ReadAddOnSubOperator(iterator *jsoniter.Iterator) *AddOnSubOperator { + object := &AddOnSubOperator{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + case "operator_name": + value := iterator.ReadString() + object.operatorName = value + object.bitmap_ |= 2 + case "operator_namespace": + value := iterator.ReadString() + object.operatorNamespace = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_type.go b/clientapi/clustersmgmt/v1/add_on_type.go new file mode 100644 index 00000000..ba73c087 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_type.go @@ -0,0 +1,793 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnKind is the name of the type used to represent objects +// of type 'add_on'. +const AddOnKind = "AddOn" + +// AddOnLinkKind is the name of the type used to represent links +// to objects of type 'add_on'. +const AddOnLinkKind = "AddOnLink" + +// AddOnNilKind is the name of the type used to nil references +// to objects of type 'add_on'. +const AddOnNilKind = "AddOnNil" + +// AddOn represents the values of the 'add_on' type. +// +// Representation of an add-on that can be installed in a cluster. +type AddOn struct { + bitmap_ uint32 + id string + href string + commonAnnotations map[string]string + commonLabels map[string]string + config *AddOnConfig + credentialsRequests []*CredentialRequest + description string + docsLink string + icon string + installMode AddOnInstallMode + label string + name string + namespaces []*AddOnNamespace + operatorName string + parameters *AddOnParameterList + requirements []*AddOnRequirement + resourceCost float64 + resourceName string + subOperators []*AddOnSubOperator + targetNamespace string + version *AddOnVersion + enabled bool + hasExternalResources bool + hidden bool + managedService bool +} + +// Kind returns the name of the type of the object. +func (o *AddOn) Kind() string { + if o == nil { + return AddOnNilKind + } + if o.bitmap_&1 != 0 { + return AddOnLinkKind + } + return AddOnKind +} + +// Link returns true if this is a link. +func (o *AddOn) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddOn) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddOn) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddOn) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddOn) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOn) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CommonAnnotations returns the value of the 'common_annotations' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Common annotations to be applied to all resources created by this addon. +func (o *AddOn) CommonAnnotations() map[string]string { + if o != nil && o.bitmap_&8 != 0 { + return o.commonAnnotations + } + return nil +} + +// GetCommonAnnotations returns the value of the 'common_annotations' attribute and +// a flag indicating if the attribute has a value. +// +// Common annotations to be applied to all resources created by this addon. +func (o *AddOn) GetCommonAnnotations() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.commonAnnotations + } + return +} + +// CommonLabels returns the value of the 'common_labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Common labels to be applied to all resources created by this addon. +func (o *AddOn) CommonLabels() map[string]string { + if o != nil && o.bitmap_&16 != 0 { + return o.commonLabels + } + return nil +} + +// GetCommonLabels returns the value of the 'common_labels' attribute and +// a flag indicating if the attribute has a value. +// +// Common labels to be applied to all resources created by this addon. +func (o *AddOn) GetCommonLabels() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.commonLabels + } + return +} + +// Config returns the value of the 'config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional configs to be used by the addon once its installed in the cluster. +func (o *AddOn) Config() *AddOnConfig { + if o != nil && o.bitmap_&32 != 0 { + return o.config + } + return nil +} + +// GetConfig returns the value of the 'config' attribute and +// a flag indicating if the attribute has a value. +// +// Additional configs to be used by the addon once its installed in the cluster. +func (o *AddOn) GetConfig() (value *AddOnConfig, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.config + } + return +} + +// CredentialsRequests returns the value of the 'credentials_requests' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of credentials requests to authenticate operators to access cloud resources. +func (o *AddOn) CredentialsRequests() []*CredentialRequest { + if o != nil && o.bitmap_&64 != 0 { + return o.credentialsRequests + } + return nil +} + +// GetCredentialsRequests returns the value of the 'credentials_requests' attribute and +// a flag indicating if the attribute has a value. +// +// List of credentials requests to authenticate operators to access cloud resources. +func (o *AddOn) GetCredentialsRequests() (value []*CredentialRequest, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.credentialsRequests + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Description of the add-on. +func (o *AddOn) Description() string { + if o != nil && o.bitmap_&128 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Description of the add-on. +func (o *AddOn) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.description + } + return +} + +// DocsLink returns the value of the 'docs_link' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to documentation about the add-on. +func (o *AddOn) DocsLink() string { + if o != nil && o.bitmap_&256 != 0 { + return o.docsLink + } + return "" +} + +// GetDocsLink returns the value of the 'docs_link' attribute and +// a flag indicating if the attribute has a value. +// +// Link to documentation about the add-on. +func (o *AddOn) GetDocsLink() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.docsLink + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this add-on can be added to clusters. +func (o *AddOn) Enabled() bool { + if o != nil && o.bitmap_&512 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this add-on can be added to clusters. +func (o *AddOn) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.enabled + } + return +} + +// HasExternalResources returns the value of the 'has_external_resources' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this add-on has external resources associated with it +func (o *AddOn) HasExternalResources() bool { + if o != nil && o.bitmap_&1024 != 0 { + return o.hasExternalResources + } + return false +} + +// GetHasExternalResources returns the value of the 'has_external_resources' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this add-on has external resources associated with it +func (o *AddOn) GetHasExternalResources() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.hasExternalResources + } + return +} + +// Hidden returns the value of the 'hidden' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this add-on is hidden. +func (o *AddOn) Hidden() bool { + if o != nil && o.bitmap_&2048 != 0 { + return o.hidden + } + return false +} + +// GetHidden returns the value of the 'hidden' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this add-on is hidden. +func (o *AddOn) GetHidden() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.hidden + } + return +} + +// Icon returns the value of the 'icon' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Base64-encoded icon representing an add-on. The icon should be in PNG format. +func (o *AddOn) Icon() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.icon + } + return "" +} + +// GetIcon returns the value of the 'icon' attribute and +// a flag indicating if the attribute has a value. +// +// Base64-encoded icon representing an add-on. The icon should be in PNG format. +func (o *AddOn) GetIcon() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.icon + } + return +} + +// InstallMode returns the value of the 'install_mode' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The mode in which the addon is deployed. +func (o *AddOn) InstallMode() AddOnInstallMode { + if o != nil && o.bitmap_&8192 != 0 { + return o.installMode + } + return AddOnInstallMode("") +} + +// GetInstallMode returns the value of the 'install_mode' attribute and +// a flag indicating if the attribute has a value. +// +// The mode in which the addon is deployed. +func (o *AddOn) GetInstallMode() (value AddOnInstallMode, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.installMode + } + return +} + +// Label returns the value of the 'label' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Label used to attach to a cluster deployment when add-on is installed. +func (o *AddOn) Label() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.label + } + return "" +} + +// GetLabel returns the value of the 'label' attribute and +// a flag indicating if the attribute has a value. +// +// Label used to attach to a cluster deployment when add-on is installed. +func (o *AddOn) GetLabel() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.label + } + return +} + +// ManagedService returns the value of the 'managed_service' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if add-on is part of a managed service +func (o *AddOn) ManagedService() bool { + if o != nil && o.bitmap_&32768 != 0 { + return o.managedService + } + return false +} + +// GetManagedService returns the value of the 'managed_service' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if add-on is part of a managed service +func (o *AddOn) GetManagedService() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.managedService + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the add-on. +func (o *AddOn) Name() string { + if o != nil && o.bitmap_&65536 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the add-on. +func (o *AddOn) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.name + } + return +} + +// Namespaces returns the value of the 'namespaces' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Namespaces which are required by this addon. +func (o *AddOn) Namespaces() []*AddOnNamespace { + if o != nil && o.bitmap_&131072 != 0 { + return o.namespaces + } + return nil +} + +// GetNamespaces returns the value of the 'namespaces' attribute and +// a flag indicating if the attribute has a value. +// +// Namespaces which are required by this addon. +func (o *AddOn) GetNamespaces() (value []*AddOnNamespace, ok bool) { + ok = o != nil && o.bitmap_&131072 != 0 + if ok { + value = o.namespaces + } + return +} + +// OperatorName returns the value of the 'operator_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the operator installed by this add-on. +func (o *AddOn) OperatorName() string { + if o != nil && o.bitmap_&262144 != 0 { + return o.operatorName + } + return "" +} + +// GetOperatorName returns the value of the 'operator_name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the operator installed by this add-on. +func (o *AddOn) GetOperatorName() (value string, ok bool) { + ok = o != nil && o.bitmap_&262144 != 0 + if ok { + value = o.operatorName + } + 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. +func (o *AddOn) Parameters() *AddOnParameterList { + if o != nil && o.bitmap_&524288 != 0 { + return o.parameters + } + return nil +} + +// GetParameters returns the value of the 'parameters' attribute and +// a flag indicating if the attribute has a value. +// +// List of parameters for this add-on. +func (o *AddOn) GetParameters() (value *AddOnParameterList, ok bool) { + ok = o != nil && o.bitmap_&524288 != 0 + if ok { + value = o.parameters + } + return +} + +// Requirements returns the value of the 'requirements' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of requirements for this add-on. +func (o *AddOn) Requirements() []*AddOnRequirement { + if o != nil && o.bitmap_&1048576 != 0 { + return o.requirements + } + return nil +} + +// GetRequirements returns the value of the 'requirements' attribute and +// a flag indicating if the attribute has a value. +// +// List of requirements for this add-on. +func (o *AddOn) GetRequirements() (value []*AddOnRequirement, ok bool) { + ok = o != nil && o.bitmap_&1048576 != 0 + if ok { + value = o.requirements + } + return +} + +// ResourceCost returns the value of the 'resource_cost' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Used to determine how many units of quota an add-on consumes per resource name. +func (o *AddOn) ResourceCost() float64 { + if o != nil && o.bitmap_&2097152 != 0 { + return o.resourceCost + } + return 0.0 +} + +// GetResourceCost returns the value of the 'resource_cost' attribute and +// a flag indicating if the attribute has a value. +// +// Used to determine how many units of quota an add-on consumes per resource name. +func (o *AddOn) GetResourceCost() (value float64, ok bool) { + ok = o != nil && o.bitmap_&2097152 != 0 + if ok { + value = o.resourceCost + } + return +} + +// ResourceName returns the value of the 'resource_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Used to determine from where to reserve quota for this add-on. +func (o *AddOn) ResourceName() string { + if o != nil && o.bitmap_&4194304 != 0 { + return o.resourceName + } + return "" +} + +// GetResourceName returns the value of the 'resource_name' attribute and +// a flag indicating if the attribute has a value. +// +// Used to determine from where to reserve quota for this add-on. +func (o *AddOn) GetResourceName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4194304 != 0 + if ok { + value = o.resourceName + } + return +} + +// SubOperators returns the value of the 'sub_operators' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of sub operators for this add-on. +func (o *AddOn) SubOperators() []*AddOnSubOperator { + if o != nil && o.bitmap_&8388608 != 0 { + return o.subOperators + } + return nil +} + +// GetSubOperators returns the value of the 'sub_operators' attribute and +// a flag indicating if the attribute has a value. +// +// List of sub operators for this add-on. +func (o *AddOn) GetSubOperators() (value []*AddOnSubOperator, ok bool) { + ok = o != nil && o.bitmap_&8388608 != 0 + if ok { + value = o.subOperators + } + return +} + +// TargetNamespace returns the value of the 'target_namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The namespace in which the addon CRD exists. +func (o *AddOn) TargetNamespace() string { + if o != nil && o.bitmap_&16777216 != 0 { + return o.targetNamespace + } + return "" +} + +// GetTargetNamespace returns the value of the 'target_namespace' attribute and +// a flag indicating if the attribute has a value. +// +// The namespace in which the addon CRD exists. +func (o *AddOn) GetTargetNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&16777216 != 0 + if ok { + value = o.targetNamespace + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the current default version of this add-on. +func (o *AddOn) Version() *AddOnVersion { + if o != nil && o.bitmap_&33554432 != 0 { + return o.version + } + return nil +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the current default version of this add-on. +func (o *AddOn) GetVersion() (value *AddOnVersion, ok bool) { + ok = o != nil && o.bitmap_&33554432 != 0 + if ok { + value = o.version + } + return +} + +// AddOnListKind is the name of the type used to represent list of objects of +// type 'add_on'. +const AddOnListKind = "AddOnList" + +// AddOnListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on'. +const AddOnListLinkKind = "AddOnListLink" + +// AddOnNilKind is the name of the type used to nil lists of objects of +// type 'add_on'. +const AddOnListNilKind = "AddOnListNil" + +// AddOnList is a list of values of the 'add_on' type. +type AddOnList struct { + href string + link bool + items []*AddOn +} + +// Kind returns the name of the type of the object. +func (l *AddOnList) Kind() string { + if l == nil { + return AddOnListNilKind + } + if l.link { + return AddOnListLinkKind + } + return AddOnListKind +} + +// Link returns true iif this is a link. +func (l *AddOnList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddOnList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddOnList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddOnList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnList) SetItems(items []*AddOn) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnList) Items() []*AddOn { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnList) Get(i int) *AddOn { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnList) Slice() []*AddOn { + var slice []*AddOn + if l == nil { + slice = make([]*AddOn, 0) + } else { + slice = make([]*AddOn, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnList) Each(f func(item *AddOn) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnList) Range(f func(index int, item *AddOn) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_type_json.go b/clientapi/clustersmgmt/v1/add_on_type_json.go new file mode 100644 index 00000000..1f4eca47 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_type_json.go @@ -0,0 +1,484 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOn writes a value of the 'add_on' type to the given writer. +func MarshalAddOn(object *AddOn, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOn(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOn writes a value of the 'add_on' type to the given stream. +func WriteAddOn(object *AddOn, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddOnLinkKind) + } else { + stream.WriteString(AddOnKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.commonAnnotations != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("common_annotations") + if object.commonAnnotations != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.commonAnnotations)) + i := 0 + for key := range object.commonAnnotations { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.commonAnnotations[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&16 != 0 && object.commonLabels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("common_labels") + if object.commonLabels != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.commonLabels)) + i := 0 + for key := range object.commonLabels { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.commonLabels[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&32 != 0 && object.config != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("config") + WriteAddOnConfig(object.config, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.credentialsRequests != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("credentials_requests") + WriteCredentialRequestList(object.credentialsRequests, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("docs_link") + stream.WriteString(object.docsLink) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("has_external_resources") + stream.WriteBool(object.hasExternalResources) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hidden") + stream.WriteBool(object.hidden) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("icon") + stream.WriteString(object.icon) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("install_mode") + stream.WriteString(string(object.installMode)) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("label") + stream.WriteString(object.label) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_service") + stream.WriteBool(object.managedService) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&131072 != 0 && object.namespaces != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("namespaces") + WriteAddOnNamespaceList(object.namespaces, stream) + count++ + } + present_ = object.bitmap_&262144 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_name") + stream.WriteString(object.operatorName) + count++ + } + present_ = object.bitmap_&524288 != 0 && object.parameters != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("parameters") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteAddOnParameterList(object.parameters.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&1048576 != 0 && object.requirements != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("requirements") + WriteAddOnRequirementList(object.requirements, stream) + count++ + } + present_ = object.bitmap_&2097152 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_cost") + stream.WriteFloat64(object.resourceCost) + count++ + } + present_ = object.bitmap_&4194304 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_name") + stream.WriteString(object.resourceName) + count++ + } + present_ = object.bitmap_&8388608 != 0 && object.subOperators != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sub_operators") + WriteAddOnSubOperatorList(object.subOperators, stream) + count++ + } + present_ = object.bitmap_&16777216 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("target_namespace") + stream.WriteString(object.targetNamespace) + count++ + } + present_ = object.bitmap_&33554432 != 0 && object.version != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + WriteAddOnVersion(object.version, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOn reads a value of the 'add_on' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOn(source interface{}) (object *AddOn, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOn(iterator) + err = iterator.Error + return +} + +// ReadAddOn reads a value of the 'add_on' type from the given iterator. +func ReadAddOn(iterator *jsoniter.Iterator) *AddOn { + object := &AddOn{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddOnLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "common_annotations": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.commonAnnotations = value + object.bitmap_ |= 8 + case "common_labels": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.commonLabels = value + object.bitmap_ |= 16 + case "config": + value := ReadAddOnConfig(iterator) + object.config = value + object.bitmap_ |= 32 + case "credentials_requests": + value := ReadCredentialRequestList(iterator) + object.credentialsRequests = value + object.bitmap_ |= 64 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 128 + case "docs_link": + value := iterator.ReadString() + object.docsLink = value + object.bitmap_ |= 256 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 512 + case "has_external_resources": + value := iterator.ReadBool() + object.hasExternalResources = value + object.bitmap_ |= 1024 + case "hidden": + value := iterator.ReadBool() + object.hidden = value + object.bitmap_ |= 2048 + case "icon": + value := iterator.ReadString() + object.icon = value + object.bitmap_ |= 4096 + case "install_mode": + text := iterator.ReadString() + value := AddOnInstallMode(text) + object.installMode = value + object.bitmap_ |= 8192 + case "label": + value := iterator.ReadString() + object.label = value + object.bitmap_ |= 16384 + case "managed_service": + value := iterator.ReadBool() + object.managedService = value + object.bitmap_ |= 32768 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 65536 + case "namespaces": + value := ReadAddOnNamespaceList(iterator) + object.namespaces = value + object.bitmap_ |= 131072 + case "operator_name": + value := iterator.ReadString() + object.operatorName = value + object.bitmap_ |= 262144 + case "parameters": + value := &AddOnParameterList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == AddOnParameterListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadAddOnParameterList(iterator)) + default: + iterator.ReadAny() + } + } + object.parameters = value + object.bitmap_ |= 524288 + case "requirements": + value := ReadAddOnRequirementList(iterator) + object.requirements = value + object.bitmap_ |= 1048576 + case "resource_cost": + value := iterator.ReadFloat64() + object.resourceCost = value + object.bitmap_ |= 2097152 + case "resource_name": + value := iterator.ReadString() + object.resourceName = value + object.bitmap_ |= 4194304 + case "sub_operators": + value := ReadAddOnSubOperatorList(iterator) + object.subOperators = value + object.bitmap_ |= 8388608 + case "target_namespace": + value := iterator.ReadString() + object.targetNamespace = value + object.bitmap_ |= 16777216 + case "version": + value := ReadAddOnVersion(iterator) + object.version = value + object.bitmap_ |= 33554432 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/add_on_version_builder.go b/clientapi/clustersmgmt/v1/add_on_version_builder.go new file mode 100644 index 00000000..afbbd6a7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_version_builder.go @@ -0,0 +1,271 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnVersionBuilder contains the data and logic needed to build 'add_on_version' objects. +// +// Representation of an add-on version. +type AddOnVersionBuilder struct { + bitmap_ uint32 + id string + href string + additionalCatalogSources []*AdditionalCatalogSourceBuilder + availableUpgrades []string + channel string + config *AddOnConfigBuilder + packageImage string + parameters *AddOnParameterListBuilder + pullSecretName string + requirements []*AddOnRequirementBuilder + sourceImage string + subOperators []*AddOnSubOperatorBuilder + enabled bool +} + +// NewAddOnVersion creates a new builder of 'add_on_version' objects. +func NewAddOnVersion() *AddOnVersionBuilder { + return &AddOnVersionBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddOnVersionBuilder) Link(value bool) *AddOnVersionBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddOnVersionBuilder) ID(value string) *AddOnVersionBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddOnVersionBuilder) HREF(value string) *AddOnVersionBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddOnVersionBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AdditionalCatalogSources sets the value of the 'additional_catalog_sources' attribute to the given values. +func (b *AddOnVersionBuilder) AdditionalCatalogSources(values ...*AdditionalCatalogSourceBuilder) *AddOnVersionBuilder { + b.additionalCatalogSources = make([]*AdditionalCatalogSourceBuilder, len(values)) + copy(b.additionalCatalogSources, values) + b.bitmap_ |= 8 + return b +} + +// AvailableUpgrades sets the value of the 'available_upgrades' attribute to the given values. +func (b *AddOnVersionBuilder) AvailableUpgrades(values ...string) *AddOnVersionBuilder { + b.availableUpgrades = make([]string, len(values)) + copy(b.availableUpgrades, values) + b.bitmap_ |= 16 + return b +} + +// Channel sets the value of the 'channel' attribute to the given value. +func (b *AddOnVersionBuilder) Channel(value string) *AddOnVersionBuilder { + b.channel = value + b.bitmap_ |= 32 + return b +} + +// Config sets the value of the 'config' attribute to the given value. +// +// Representation of an add-on config. +// The attributes under it are to be used by the addon once its installed in the cluster. +func (b *AddOnVersionBuilder) Config(value *AddOnConfigBuilder) *AddOnVersionBuilder { + b.config = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AddOnVersionBuilder) Enabled(value bool) *AddOnVersionBuilder { + b.enabled = value + b.bitmap_ |= 128 + 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_ |= 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_ |= 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_ |= 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_ |= 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_ |= 8192 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddOnVersionBuilder) Copy(object *AddOnVersion) *AddOnVersionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.additionalCatalogSources != nil { + b.additionalCatalogSources = make([]*AdditionalCatalogSourceBuilder, len(object.additionalCatalogSources)) + for i, v := range object.additionalCatalogSources { + b.additionalCatalogSources[i] = NewAdditionalCatalogSource().Copy(v) + } + } else { + b.additionalCatalogSources = nil + } + if object.availableUpgrades != nil { + b.availableUpgrades = make([]string, len(object.availableUpgrades)) + copy(b.availableUpgrades, object.availableUpgrades) + } else { + b.availableUpgrades = nil + } + b.channel = object.channel + if object.config != nil { + b.config = NewAddOnConfig().Copy(object.config) + } else { + b.config = nil + } + b.enabled = object.enabled + b.packageImage = object.packageImage + if object.parameters != nil { + b.parameters = NewAddOnParameterList().Copy(object.parameters) + } else { + b.parameters = nil + } + b.pullSecretName = object.pullSecretName + if object.requirements != nil { + b.requirements = make([]*AddOnRequirementBuilder, len(object.requirements)) + for i, v := range object.requirements { + b.requirements[i] = NewAddOnRequirement().Copy(v) + } + } else { + b.requirements = nil + } + b.sourceImage = object.sourceImage + if object.subOperators != nil { + b.subOperators = make([]*AddOnSubOperatorBuilder, len(object.subOperators)) + for i, v := range object.subOperators { + b.subOperators[i] = NewAddOnSubOperator().Copy(v) + } + } else { + b.subOperators = nil + } + return b +} + +// Build creates a 'add_on_version' object using the configuration stored in the builder. +func (b *AddOnVersionBuilder) Build() (object *AddOnVersion, err error) { + object = new(AddOnVersion) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.additionalCatalogSources != nil { + object.additionalCatalogSources = make([]*AdditionalCatalogSource, len(b.additionalCatalogSources)) + for i, v := range b.additionalCatalogSources { + object.additionalCatalogSources[i], err = v.Build() + if err != nil { + return + } + } + } + if b.availableUpgrades != nil { + object.availableUpgrades = make([]string, len(b.availableUpgrades)) + copy(object.availableUpgrades, b.availableUpgrades) + } + object.channel = b.channel + if b.config != nil { + object.config, err = b.config.Build() + if err != nil { + return + } + } + object.enabled = b.enabled + object.packageImage = b.packageImage + if b.parameters != nil { + object.parameters, err = b.parameters.Build() + if err != nil { + return + } + } + object.pullSecretName = b.pullSecretName + if b.requirements != nil { + object.requirements = make([]*AddOnRequirement, len(b.requirements)) + for i, v := range b.requirements { + object.requirements[i], err = v.Build() + if err != nil { + return + } + } + } + object.sourceImage = b.sourceImage + if b.subOperators != nil { + object.subOperators = make([]*AddOnSubOperator, len(b.subOperators)) + for i, v := range b.subOperators { + object.subOperators[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_version_list_builder.go b/clientapi/clustersmgmt/v1/add_on_version_list_builder.go new file mode 100644 index 00000000..da6889a8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_version_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnVersionListBuilder contains the data and logic needed to build +// 'add_on_version' objects. +type AddOnVersionListBuilder struct { + items []*AddOnVersionBuilder +} + +// NewAddOnVersionList creates a new builder of 'add_on_version' objects. +func NewAddOnVersionList() *AddOnVersionListBuilder { + return new(AddOnVersionListBuilder) +} + +// Items sets the items of the list. +func (b *AddOnVersionListBuilder) Items(values ...*AddOnVersionBuilder) *AddOnVersionListBuilder { + b.items = make([]*AddOnVersionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddOnVersionListBuilder) 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 *AddOnVersionListBuilder) Copy(list *AddOnVersionList) *AddOnVersionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddOnVersionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddOnVersion().Copy(v) + } + } + return b +} + +// Build creates a list of 'add_on_version' objects using the +// configuration stored in the builder. +func (b *AddOnVersionListBuilder) Build() (list *AddOnVersionList, err error) { + items := make([]*AddOnVersion, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddOnVersionList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/add_on_version_list_type_json.go b/clientapi/clustersmgmt/v1/add_on_version_list_type_json.go new file mode 100644 index 00000000..087f80f6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_version_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnVersionList writes a list of values of the 'add_on_version' type to +// the given writer. +func MarshalAddOnVersionList(list []*AddOnVersion, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnVersionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnVersionList writes a list of value of the 'add_on_version' type to +// the given stream. +func WriteAddOnVersionList(list []*AddOnVersion, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddOnVersion(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddOnVersionList reads a list of values of the 'add_on_version' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddOnVersionList(source interface{}) (items []*AddOnVersion, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddOnVersionList(iterator) + err = iterator.Error + return +} + +// ReadAddOnVersionList reads list of values of the ”add_on_version' type from +// the given iterator. +func ReadAddOnVersionList(iterator *jsoniter.Iterator) []*AddOnVersion { + list := []*AddOnVersion{} + for iterator.ReadArray() { + item := ReadAddOnVersion(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/add_on_version_type.go b/clientapi/clustersmgmt/v1/add_on_version_type.go new file mode 100644 index 00000000..1de1faaf --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_version_type.go @@ -0,0 +1,505 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddOnVersionKind is the name of the type used to represent objects +// of type 'add_on_version'. +const AddOnVersionKind = "AddOnVersion" + +// AddOnVersionLinkKind is the name of the type used to represent links +// to objects of type 'add_on_version'. +const AddOnVersionLinkKind = "AddOnVersionLink" + +// AddOnVersionNilKind is the name of the type used to nil references +// to objects of type 'add_on_version'. +const AddOnVersionNilKind = "AddOnVersionNil" + +// AddOnVersion represents the values of the 'add_on_version' type. +// +// Representation of an add-on version. +type AddOnVersion struct { + bitmap_ uint32 + id string + href string + additionalCatalogSources []*AdditionalCatalogSource + availableUpgrades []string + channel string + config *AddOnConfig + packageImage string + parameters *AddOnParameterList + pullSecretName string + requirements []*AddOnRequirement + sourceImage string + subOperators []*AddOnSubOperator + enabled bool +} + +// Kind returns the name of the type of the object. +func (o *AddOnVersion) Kind() string { + if o == nil { + return AddOnVersionNilKind + } + if o.bitmap_&1 != 0 { + return AddOnVersionLinkKind + } + return AddOnVersionKind +} + +// Link returns true if this is a link. +func (o *AddOnVersion) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddOnVersion) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddOnVersion) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddOnVersion) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddOnVersion) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddOnVersion) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AdditionalCatalogSources returns the value of the 'additional_catalog_sources' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional catalog sources associated with this addon version +func (o *AddOnVersion) AdditionalCatalogSources() []*AdditionalCatalogSource { + if o != nil && o.bitmap_&8 != 0 { + return o.additionalCatalogSources + } + return nil +} + +// GetAdditionalCatalogSources returns the value of the 'additional_catalog_sources' attribute and +// a flag indicating if the attribute has a value. +// +// Additional catalog sources associated with this addon version +func (o *AddOnVersion) GetAdditionalCatalogSources() (value []*AdditionalCatalogSource, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.additionalCatalogSources + } + return +} + +// AvailableUpgrades returns the value of the 'available_upgrades' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AvailableUpgrades is the list of versions this version can be upgraded to. +func (o *AddOnVersion) AvailableUpgrades() []string { + if o != nil && o.bitmap_&16 != 0 { + return o.availableUpgrades + } + return nil +} + +// GetAvailableUpgrades returns the value of the 'available_upgrades' attribute and +// a flag indicating if the attribute has a value. +// +// AvailableUpgrades is the list of versions this version can be upgraded to. +func (o *AddOnVersion) GetAvailableUpgrades() (value []string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.availableUpgrades + } + return +} + +// Channel returns the value of the 'channel' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The specific addon catalog source channel of packages +func (o *AddOnVersion) Channel() string { + if o != nil && o.bitmap_&32 != 0 { + return o.channel + } + return "" +} + +// GetChannel returns the value of the 'channel' attribute and +// a flag indicating if the attribute has a value. +// +// The specific addon catalog source channel of packages +func (o *AddOnVersion) GetChannel() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.channel + } + return +} + +// Config returns the value of the 'config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional configs to be used by the addon once its installed in the cluster. +func (o *AddOnVersion) Config() *AddOnConfig { + if o != nil && o.bitmap_&64 != 0 { + return o.config + } + return nil +} + +// GetConfig returns the value of the 'config' attribute and +// a flag indicating if the attribute has a value. +// +// Additional configs to be used by the addon once its installed in the cluster. +func (o *AddOnVersion) GetConfig() (value *AddOnConfig, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.config + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this add-on version can be added to clusters. +func (o *AddOnVersion) Enabled() bool { + if o != nil && o.bitmap_&128 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this add-on version can be added to clusters. +func (o *AddOnVersion) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.enabled + } + 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_&512 != 0 { + return o.parameters + } + return nil +} + +// GetParameters returns the value of the 'parameters' attribute and +// a flag indicating if the attribute has a value. +// +// List of parameters for this add-on version. +func (o *AddOnVersion) GetParameters() (value *AddOnParameterList, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.parameters + } + return +} + +// PullSecretName returns the value of the 'pull_secret_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The pull secret name used for this addon version. +func (o *AddOnVersion) PullSecretName() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.pullSecretName + } + return "" +} + +// GetPullSecretName returns the value of the 'pull_secret_name' attribute and +// a flag indicating if the attribute has a value. +// +// The pull secret name used for this addon version. +func (o *AddOnVersion) GetPullSecretName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.pullSecretName + } + return +} + +// Requirements returns the value of the 'requirements' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of requirements for this add-on version. +func (o *AddOnVersion) Requirements() []*AddOnRequirement { + if o != nil && o.bitmap_&2048 != 0 { + return o.requirements + } + return nil +} + +// GetRequirements returns the value of the 'requirements' attribute and +// a flag indicating if the attribute has a value. +// +// List of requirements for this add-on version. +func (o *AddOnVersion) GetRequirements() (value []*AddOnRequirement, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.requirements + } + return +} + +// SourceImage returns the value of the 'source_image' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The catalog source image for this add-on version. +func (o *AddOnVersion) SourceImage() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.sourceImage + } + return "" +} + +// GetSourceImage returns the value of the 'source_image' attribute and +// a flag indicating if the attribute has a value. +// +// The catalog source image for this add-on version. +func (o *AddOnVersion) GetSourceImage() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.sourceImage + } + return +} + +// SubOperators returns the value of the 'sub_operators' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of sub operators for this add-on version. +func (o *AddOnVersion) SubOperators() []*AddOnSubOperator { + if o != nil && o.bitmap_&8192 != 0 { + return o.subOperators + } + return nil +} + +// GetSubOperators returns the value of the 'sub_operators' attribute and +// a flag indicating if the attribute has a value. +// +// List of sub operators for this add-on version. +func (o *AddOnVersion) GetSubOperators() (value []*AddOnSubOperator, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.subOperators + } + return +} + +// AddOnVersionListKind is the name of the type used to represent list of objects of +// type 'add_on_version'. +const AddOnVersionListKind = "AddOnVersionList" + +// AddOnVersionListLinkKind is the name of the type used to represent links to list +// of objects of type 'add_on_version'. +const AddOnVersionListLinkKind = "AddOnVersionListLink" + +// AddOnVersionNilKind is the name of the type used to nil lists of objects of +// type 'add_on_version'. +const AddOnVersionListNilKind = "AddOnVersionListNil" + +// AddOnVersionList is a list of values of the 'add_on_version' type. +type AddOnVersionList struct { + href string + link bool + items []*AddOnVersion +} + +// Kind returns the name of the type of the object. +func (l *AddOnVersionList) Kind() string { + if l == nil { + return AddOnVersionListNilKind + } + if l.link { + return AddOnVersionListLinkKind + } + return AddOnVersionListKind +} + +// Link returns true iif this is a link. +func (l *AddOnVersionList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddOnVersionList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddOnVersionList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddOnVersionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddOnVersionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddOnVersionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddOnVersionList) SetItems(items []*AddOnVersion) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddOnVersionList) Items() []*AddOnVersion { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddOnVersionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddOnVersionList) Get(i int) *AddOnVersion { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddOnVersionList) Slice() []*AddOnVersion { + var slice []*AddOnVersion + if l == nil { + slice = make([]*AddOnVersion, 0) + } else { + slice = make([]*AddOnVersion, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddOnVersionList) Each(f func(item *AddOnVersion) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddOnVersionList) Range(f func(index int, item *AddOnVersion) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/add_on_version_type_json.go b/clientapi/clustersmgmt/v1/add_on_version_type_json.go new file mode 100644 index 00000000..45234ee9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/add_on_version_type_json.go @@ -0,0 +1,270 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddOnVersion writes a value of the 'add_on_version' type to the given writer. +func MarshalAddOnVersion(object *AddOnVersion, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddOnVersion(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddOnVersion writes a value of the 'add_on_version' type to the given stream. +func WriteAddOnVersion(object *AddOnVersion, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddOnVersionLinkKind) + } else { + stream.WriteString(AddOnVersionKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.additionalCatalogSources != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_catalog_sources") + WriteAdditionalCatalogSourceList(object.additionalCatalogSources, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.availableUpgrades != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("available_upgrades") + WriteStringList(object.availableUpgrades, stream) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("channel") + stream.WriteString(object.channel) + count++ + } + present_ = object.bitmap_&64 != 0 && object.config != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("config") + WriteAddOnConfig(object.config, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + 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() + } + stream.WriteObjectField("parameters") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteAddOnParameterList(object.parameters.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("pull_secret_name") + stream.WriteString(object.pullSecretName) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.requirements != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("requirements") + WriteAddOnRequirementList(object.requirements, stream) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("source_image") + stream.WriteString(object.sourceImage) + count++ + } + present_ = object.bitmap_&8192 != 0 && object.subOperators != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sub_operators") + WriteAddOnSubOperatorList(object.subOperators, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddOnVersion reads a value of the 'add_on_version' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddOnVersion(source interface{}) (object *AddOnVersion, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddOnVersion(iterator) + err = iterator.Error + return +} + +// ReadAddOnVersion reads a value of the 'add_on_version' type from the given iterator. +func ReadAddOnVersion(iterator *jsoniter.Iterator) *AddOnVersion { + object := &AddOnVersion{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddOnVersionLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "additional_catalog_sources": + value := ReadAdditionalCatalogSourceList(iterator) + object.additionalCatalogSources = value + object.bitmap_ |= 8 + case "available_upgrades": + value := ReadStringList(iterator) + object.availableUpgrades = value + object.bitmap_ |= 16 + case "channel": + value := iterator.ReadString() + object.channel = value + object.bitmap_ |= 32 + case "config": + value := ReadAddOnConfig(iterator) + object.config = value + object.bitmap_ |= 64 + case "enabled": + 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 { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == AddOnParameterListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadAddOnParameterList(iterator)) + default: + iterator.ReadAny() + } + } + object.parameters = value + object.bitmap_ |= 512 + case "pull_secret_name": + value := iterator.ReadString() + object.pullSecretName = value + object.bitmap_ |= 1024 + case "requirements": + value := ReadAddOnRequirementList(iterator) + object.requirements = value + object.bitmap_ |= 2048 + case "source_image": + value := iterator.ReadString() + object.sourceImage = value + object.bitmap_ |= 4096 + case "sub_operators": + value := ReadAddOnSubOperatorList(iterator) + object.subOperators = value + object.bitmap_ |= 8192 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/additional_catalog_source_builder.go b/clientapi/clustersmgmt/v1/additional_catalog_source_builder.go new file mode 100644 index 00000000..5596877c --- /dev/null +++ b/clientapi/clustersmgmt/v1/additional_catalog_source_builder.go @@ -0,0 +1,93 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AdditionalCatalogSourceBuilder contains the data and logic needed to build 'additional_catalog_source' objects. +// +// Representation of an addon catalog source object used by addon versions. +type AdditionalCatalogSourceBuilder struct { + bitmap_ uint32 + id string + image string + name string + enabled bool +} + +// NewAdditionalCatalogSource creates a new builder of 'additional_catalog_source' objects. +func NewAdditionalCatalogSource() *AdditionalCatalogSourceBuilder { + return &AdditionalCatalogSourceBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AdditionalCatalogSourceBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *AdditionalCatalogSourceBuilder) ID(value string) *AdditionalCatalogSourceBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AdditionalCatalogSourceBuilder) Enabled(value bool) *AdditionalCatalogSourceBuilder { + b.enabled = value + b.bitmap_ |= 2 + return b +} + +// Image sets the value of the 'image' attribute to the given value. +func (b *AdditionalCatalogSourceBuilder) Image(value string) *AdditionalCatalogSourceBuilder { + b.image = value + b.bitmap_ |= 4 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AdditionalCatalogSourceBuilder) Name(value string) *AdditionalCatalogSourceBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AdditionalCatalogSourceBuilder) Copy(object *AdditionalCatalogSource) *AdditionalCatalogSourceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.enabled = object.enabled + b.image = object.image + b.name = object.name + return b +} + +// Build creates a 'additional_catalog_source' object using the configuration stored in the builder. +func (b *AdditionalCatalogSourceBuilder) Build() (object *AdditionalCatalogSource, err error) { + object = new(AdditionalCatalogSource) + object.bitmap_ = b.bitmap_ + object.id = b.id + object.enabled = b.enabled + object.image = b.image + object.name = b.name + return +} diff --git a/clientapi/clustersmgmt/v1/additional_catalog_source_list_builder.go b/clientapi/clustersmgmt/v1/additional_catalog_source_list_builder.go new file mode 100644 index 00000000..1d51d628 --- /dev/null +++ b/clientapi/clustersmgmt/v1/additional_catalog_source_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AdditionalCatalogSourceListBuilder contains the data and logic needed to build +// 'additional_catalog_source' objects. +type AdditionalCatalogSourceListBuilder struct { + items []*AdditionalCatalogSourceBuilder +} + +// NewAdditionalCatalogSourceList creates a new builder of 'additional_catalog_source' objects. +func NewAdditionalCatalogSourceList() *AdditionalCatalogSourceListBuilder { + return new(AdditionalCatalogSourceListBuilder) +} + +// Items sets the items of the list. +func (b *AdditionalCatalogSourceListBuilder) Items(values ...*AdditionalCatalogSourceBuilder) *AdditionalCatalogSourceListBuilder { + b.items = make([]*AdditionalCatalogSourceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AdditionalCatalogSourceListBuilder) 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 *AdditionalCatalogSourceListBuilder) Copy(list *AdditionalCatalogSourceList) *AdditionalCatalogSourceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AdditionalCatalogSourceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAdditionalCatalogSource().Copy(v) + } + } + return b +} + +// Build creates a list of 'additional_catalog_source' objects using the +// configuration stored in the builder. +func (b *AdditionalCatalogSourceListBuilder) Build() (list *AdditionalCatalogSourceList, err error) { + items := make([]*AdditionalCatalogSource, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AdditionalCatalogSourceList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/additional_catalog_source_list_type_json.go b/clientapi/clustersmgmt/v1/additional_catalog_source_list_type_json.go new file mode 100644 index 00000000..8d7be202 --- /dev/null +++ b/clientapi/clustersmgmt/v1/additional_catalog_source_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAdditionalCatalogSourceList writes a list of values of the 'additional_catalog_source' type to +// the given writer. +func MarshalAdditionalCatalogSourceList(list []*AdditionalCatalogSource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAdditionalCatalogSourceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAdditionalCatalogSourceList writes a list of value of the 'additional_catalog_source' type to +// the given stream. +func WriteAdditionalCatalogSourceList(list []*AdditionalCatalogSource, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAdditionalCatalogSource(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAdditionalCatalogSourceList reads a list of values of the 'additional_catalog_source' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAdditionalCatalogSourceList(source interface{}) (items []*AdditionalCatalogSource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAdditionalCatalogSourceList(iterator) + err = iterator.Error + return +} + +// ReadAdditionalCatalogSourceList reads list of values of the ”additional_catalog_source' type from +// the given iterator. +func ReadAdditionalCatalogSourceList(iterator *jsoniter.Iterator) []*AdditionalCatalogSource { + list := []*AdditionalCatalogSource{} + for iterator.ReadArray() { + item := ReadAdditionalCatalogSource(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/additional_catalog_source_type.go b/clientapi/clustersmgmt/v1/additional_catalog_source_type.go new file mode 100644 index 00000000..b98161f0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/additional_catalog_source_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AdditionalCatalogSource represents the values of the 'additional_catalog_source' type. +// +// Representation of an addon catalog source object used by addon versions. +type AdditionalCatalogSource struct { + bitmap_ uint32 + id string + image string + name string + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AdditionalCatalogSource) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID of the additional catalog source +func (o *AdditionalCatalogSource) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID of the additional catalog source +func (o *AdditionalCatalogSource) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates is this additional catalog source is enabled for the addon +func (o *AdditionalCatalogSource) Enabled() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates is this additional catalog source is enabled for the addon +func (o *AdditionalCatalogSource) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.enabled + } + return +} + +// Image returns the value of the 'image' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Image of the additional catalog source. +func (o *AdditionalCatalogSource) Image() string { + if o != nil && o.bitmap_&4 != 0 { + return o.image + } + return "" +} + +// GetImage returns the value of the 'image' attribute and +// a flag indicating if the attribute has a value. +// +// Image of the additional catalog source. +func (o *AdditionalCatalogSource) GetImage() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.image + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the additional catalog source. +func (o *AdditionalCatalogSource) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the additional catalog source. +func (o *AdditionalCatalogSource) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// AdditionalCatalogSourceListKind is the name of the type used to represent list of objects of +// type 'additional_catalog_source'. +const AdditionalCatalogSourceListKind = "AdditionalCatalogSourceList" + +// AdditionalCatalogSourceListLinkKind is the name of the type used to represent links to list +// of objects of type 'additional_catalog_source'. +const AdditionalCatalogSourceListLinkKind = "AdditionalCatalogSourceListLink" + +// AdditionalCatalogSourceNilKind is the name of the type used to nil lists of objects of +// type 'additional_catalog_source'. +const AdditionalCatalogSourceListNilKind = "AdditionalCatalogSourceListNil" + +// AdditionalCatalogSourceList is a list of values of the 'additional_catalog_source' type. +type AdditionalCatalogSourceList struct { + href string + link bool + items []*AdditionalCatalogSource +} + +// Len returns the length of the list. +func (l *AdditionalCatalogSourceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AdditionalCatalogSourceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AdditionalCatalogSourceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AdditionalCatalogSourceList) SetItems(items []*AdditionalCatalogSource) { + l.items = items +} + +// Items returns the items of the list. +func (l *AdditionalCatalogSourceList) Items() []*AdditionalCatalogSource { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AdditionalCatalogSourceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AdditionalCatalogSourceList) Get(i int) *AdditionalCatalogSource { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AdditionalCatalogSourceList) Slice() []*AdditionalCatalogSource { + var slice []*AdditionalCatalogSource + if l == nil { + slice = make([]*AdditionalCatalogSource, 0) + } else { + slice = make([]*AdditionalCatalogSource, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AdditionalCatalogSourceList) Each(f func(item *AdditionalCatalogSource) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AdditionalCatalogSourceList) Range(f func(index int, item *AdditionalCatalogSource) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/additional_catalog_source_type_json.go b/clientapi/clustersmgmt/v1/additional_catalog_source_type_json.go new file mode 100644 index 00000000..17b7c57f --- /dev/null +++ b/clientapi/clustersmgmt/v1/additional_catalog_source_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAdditionalCatalogSource writes a value of the 'additional_catalog_source' type to the given writer. +func MarshalAdditionalCatalogSource(object *AdditionalCatalogSource, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAdditionalCatalogSource(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAdditionalCatalogSource writes a value of the 'additional_catalog_source' type to the given stream. +func WriteAdditionalCatalogSource(object *AdditionalCatalogSource, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("image") + stream.WriteString(object.image) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + } + stream.WriteObjectEnd() +} + +// UnmarshalAdditionalCatalogSource reads a value of the 'additional_catalog_source' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAdditionalCatalogSource(source interface{}) (object *AdditionalCatalogSource, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAdditionalCatalogSource(iterator) + err = iterator.Error + return +} + +// ReadAdditionalCatalogSource reads a value of the 'additional_catalog_source' type from the given iterator. +func ReadAdditionalCatalogSource(iterator *jsoniter.Iterator) *AdditionalCatalogSource { + object := &AdditionalCatalogSource{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 2 + case "image": + value := iterator.ReadString() + object.image = value + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/addon_upgrade_policy_builder.go b/clientapi/clustersmgmt/v1/addon_upgrade_policy_builder.go new file mode 100644 index 00000000..072ba68f --- /dev/null +++ b/clientapi/clustersmgmt/v1/addon_upgrade_policy_builder.go @@ -0,0 +1,153 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// AddonUpgradePolicyBuilder contains the data and logic needed to build 'addon_upgrade_policy' objects. +// +// Representation of an upgrade policy that can be set for a cluster. +type AddonUpgradePolicyBuilder struct { + bitmap_ uint32 + id string + href string + addonID string + clusterID string + nextRun time.Time + schedule string + scheduleType string + upgradeType string + version string +} + +// NewAddonUpgradePolicy creates a new builder of 'addon_upgrade_policy' objects. +func NewAddonUpgradePolicy() *AddonUpgradePolicyBuilder { + return &AddonUpgradePolicyBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddonUpgradePolicyBuilder) Link(value bool) *AddonUpgradePolicyBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddonUpgradePolicyBuilder) ID(value string) *AddonUpgradePolicyBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddonUpgradePolicyBuilder) HREF(value string) *AddonUpgradePolicyBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonUpgradePolicyBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AddonID sets the value of the 'addon_ID' attribute to the given value. +func (b *AddonUpgradePolicyBuilder) AddonID(value string) *AddonUpgradePolicyBuilder { + b.addonID = value + b.bitmap_ |= 8 + return b +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *AddonUpgradePolicyBuilder) ClusterID(value string) *AddonUpgradePolicyBuilder { + b.clusterID = value + b.bitmap_ |= 16 + return b +} + +// NextRun sets the value of the 'next_run' attribute to the given value. +func (b *AddonUpgradePolicyBuilder) NextRun(value time.Time) *AddonUpgradePolicyBuilder { + b.nextRun = value + b.bitmap_ |= 32 + return b +} + +// Schedule sets the value of the 'schedule' attribute to the given value. +func (b *AddonUpgradePolicyBuilder) Schedule(value string) *AddonUpgradePolicyBuilder { + b.schedule = value + b.bitmap_ |= 64 + return b +} + +// ScheduleType sets the value of the 'schedule_type' attribute to the given value. +func (b *AddonUpgradePolicyBuilder) ScheduleType(value string) *AddonUpgradePolicyBuilder { + b.scheduleType = value + b.bitmap_ |= 128 + return b +} + +// UpgradeType sets the value of the 'upgrade_type' attribute to the given value. +func (b *AddonUpgradePolicyBuilder) UpgradeType(value string) *AddonUpgradePolicyBuilder { + b.upgradeType = value + b.bitmap_ |= 256 + return b +} + +// Version sets the value of the 'version' attribute to the given value. +func (b *AddonUpgradePolicyBuilder) Version(value string) *AddonUpgradePolicyBuilder { + b.version = value + b.bitmap_ |= 512 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonUpgradePolicyBuilder) Copy(object *AddonUpgradePolicy) *AddonUpgradePolicyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.addonID = object.addonID + b.clusterID = object.clusterID + b.nextRun = object.nextRun + b.schedule = object.schedule + b.scheduleType = object.scheduleType + b.upgradeType = object.upgradeType + b.version = object.version + return b +} + +// Build creates a 'addon_upgrade_policy' object using the configuration stored in the builder. +func (b *AddonUpgradePolicyBuilder) Build() (object *AddonUpgradePolicy, err error) { + object = new(AddonUpgradePolicy) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.addonID = b.addonID + object.clusterID = b.clusterID + object.nextRun = b.nextRun + object.schedule = b.schedule + object.scheduleType = b.scheduleType + object.upgradeType = b.upgradeType + object.version = b.version + return +} diff --git a/clientapi/clustersmgmt/v1/addon_upgrade_policy_list_builder.go b/clientapi/clustersmgmt/v1/addon_upgrade_policy_list_builder.go new file mode 100644 index 00000000..c42cf05a --- /dev/null +++ b/clientapi/clustersmgmt/v1/addon_upgrade_policy_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddonUpgradePolicyListBuilder contains the data and logic needed to build +// 'addon_upgrade_policy' objects. +type AddonUpgradePolicyListBuilder struct { + items []*AddonUpgradePolicyBuilder +} + +// NewAddonUpgradePolicyList creates a new builder of 'addon_upgrade_policy' objects. +func NewAddonUpgradePolicyList() *AddonUpgradePolicyListBuilder { + return new(AddonUpgradePolicyListBuilder) +} + +// Items sets the items of the list. +func (b *AddonUpgradePolicyListBuilder) Items(values ...*AddonUpgradePolicyBuilder) *AddonUpgradePolicyListBuilder { + b.items = make([]*AddonUpgradePolicyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonUpgradePolicyListBuilder) 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 *AddonUpgradePolicyListBuilder) Copy(list *AddonUpgradePolicyList) *AddonUpgradePolicyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonUpgradePolicyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonUpgradePolicy().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_upgrade_policy' objects using the +// configuration stored in the builder. +func (b *AddonUpgradePolicyListBuilder) Build() (list *AddonUpgradePolicyList, err error) { + items := make([]*AddonUpgradePolicy, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonUpgradePolicyList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/addon_upgrade_policy_list_type_json.go b/clientapi/clustersmgmt/v1/addon_upgrade_policy_list_type_json.go new file mode 100644 index 00000000..83d3e436 --- /dev/null +++ b/clientapi/clustersmgmt/v1/addon_upgrade_policy_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonUpgradePolicyList writes a list of values of the 'addon_upgrade_policy' type to +// the given writer. +func MarshalAddonUpgradePolicyList(list []*AddonUpgradePolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonUpgradePolicyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonUpgradePolicyList writes a list of value of the 'addon_upgrade_policy' type to +// the given stream. +func WriteAddonUpgradePolicyList(list []*AddonUpgradePolicy, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonUpgradePolicy(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonUpgradePolicyList reads a list of values of the 'addon_upgrade_policy' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonUpgradePolicyList(source interface{}) (items []*AddonUpgradePolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonUpgradePolicyList(iterator) + err = iterator.Error + return +} + +// ReadAddonUpgradePolicyList reads list of values of the ”addon_upgrade_policy' type from +// the given iterator. +func ReadAddonUpgradePolicyList(iterator *jsoniter.Iterator) []*AddonUpgradePolicy { + list := []*AddonUpgradePolicy{} + for iterator.ReadArray() { + item := ReadAddonUpgradePolicy(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_builder.go b/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_builder.go new file mode 100644 index 00000000..f576cfda --- /dev/null +++ b/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_builder.go @@ -0,0 +1,101 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddonUpgradePolicyStateBuilder contains the data and logic needed to build 'addon_upgrade_policy_state' objects. +// +// Representation of an addon upgrade policy state that that is set for a cluster. +type AddonUpgradePolicyStateBuilder struct { + bitmap_ uint32 + id string + href string + description string + value UpgradePolicyStateValue +} + +// NewAddonUpgradePolicyState creates a new builder of 'addon_upgrade_policy_state' objects. +func NewAddonUpgradePolicyState() *AddonUpgradePolicyStateBuilder { + return &AddonUpgradePolicyStateBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AddonUpgradePolicyStateBuilder) Link(value bool) *AddonUpgradePolicyStateBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AddonUpgradePolicyStateBuilder) ID(value string) *AddonUpgradePolicyStateBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AddonUpgradePolicyStateBuilder) HREF(value string) *AddonUpgradePolicyStateBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AddonUpgradePolicyStateBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *AddonUpgradePolicyStateBuilder) Description(value string) *AddonUpgradePolicyStateBuilder { + b.description = value + b.bitmap_ |= 8 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +// +// Overall state of a cluster upgrade policy. +func (b *AddonUpgradePolicyStateBuilder) Value(value UpgradePolicyStateValue) *AddonUpgradePolicyStateBuilder { + b.value = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AddonUpgradePolicyStateBuilder) Copy(object *AddonUpgradePolicyState) *AddonUpgradePolicyStateBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.description = object.description + b.value = object.value + return b +} + +// Build creates a 'addon_upgrade_policy_state' object using the configuration stored in the builder. +func (b *AddonUpgradePolicyStateBuilder) Build() (object *AddonUpgradePolicyState, err error) { + object = new(AddonUpgradePolicyState) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.description = b.description + object.value = b.value + return +} diff --git a/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_list_builder.go b/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_list_builder.go new file mode 100644 index 00000000..e5fa4ebe --- /dev/null +++ b/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddonUpgradePolicyStateListBuilder contains the data and logic needed to build +// 'addon_upgrade_policy_state' objects. +type AddonUpgradePolicyStateListBuilder struct { + items []*AddonUpgradePolicyStateBuilder +} + +// NewAddonUpgradePolicyStateList creates a new builder of 'addon_upgrade_policy_state' objects. +func NewAddonUpgradePolicyStateList() *AddonUpgradePolicyStateListBuilder { + return new(AddonUpgradePolicyStateListBuilder) +} + +// Items sets the items of the list. +func (b *AddonUpgradePolicyStateListBuilder) Items(values ...*AddonUpgradePolicyStateBuilder) *AddonUpgradePolicyStateListBuilder { + b.items = make([]*AddonUpgradePolicyStateBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AddonUpgradePolicyStateListBuilder) 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 *AddonUpgradePolicyStateListBuilder) Copy(list *AddonUpgradePolicyStateList) *AddonUpgradePolicyStateListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AddonUpgradePolicyStateBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAddonUpgradePolicyState().Copy(v) + } + } + return b +} + +// Build creates a list of 'addon_upgrade_policy_state' objects using the +// configuration stored in the builder. +func (b *AddonUpgradePolicyStateListBuilder) Build() (list *AddonUpgradePolicyStateList, err error) { + items := make([]*AddonUpgradePolicyState, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AddonUpgradePolicyStateList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_list_type_json.go b/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_list_type_json.go new file mode 100644 index 00000000..63c3a381 --- /dev/null +++ b/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonUpgradePolicyStateList writes a list of values of the 'addon_upgrade_policy_state' type to +// the given writer. +func MarshalAddonUpgradePolicyStateList(list []*AddonUpgradePolicyState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonUpgradePolicyStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonUpgradePolicyStateList writes a list of value of the 'addon_upgrade_policy_state' type to +// the given stream. +func WriteAddonUpgradePolicyStateList(list []*AddonUpgradePolicyState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAddonUpgradePolicyState(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAddonUpgradePolicyStateList reads a list of values of the 'addon_upgrade_policy_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAddonUpgradePolicyStateList(source interface{}) (items []*AddonUpgradePolicyState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAddonUpgradePolicyStateList(iterator) + err = iterator.Error + return +} + +// ReadAddonUpgradePolicyStateList reads list of values of the ”addon_upgrade_policy_state' type from +// the given iterator. +func ReadAddonUpgradePolicyStateList(iterator *jsoniter.Iterator) []*AddonUpgradePolicyState { + list := []*AddonUpgradePolicyState{} + for iterator.ReadArray() { + item := ReadAddonUpgradePolicyState(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_type.go b/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_type.go new file mode 100644 index 00000000..a82695cc --- /dev/null +++ b/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_type.go @@ -0,0 +1,291 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AddonUpgradePolicyStateKind is the name of the type used to represent objects +// of type 'addon_upgrade_policy_state'. +const AddonUpgradePolicyStateKind = "AddonUpgradePolicyState" + +// AddonUpgradePolicyStateLinkKind is the name of the type used to represent links +// to objects of type 'addon_upgrade_policy_state'. +const AddonUpgradePolicyStateLinkKind = "AddonUpgradePolicyStateLink" + +// AddonUpgradePolicyStateNilKind is the name of the type used to nil references +// to objects of type 'addon_upgrade_policy_state'. +const AddonUpgradePolicyStateNilKind = "AddonUpgradePolicyStateNil" + +// AddonUpgradePolicyState represents the values of the 'addon_upgrade_policy_state' type. +// +// Representation of an addon upgrade policy state that that is set for a cluster. +type AddonUpgradePolicyState struct { + bitmap_ uint32 + id string + href string + description string + value UpgradePolicyStateValue +} + +// Kind returns the name of the type of the object. +func (o *AddonUpgradePolicyState) Kind() string { + if o == nil { + return AddonUpgradePolicyStateNilKind + } + if o.bitmap_&1 != 0 { + return AddonUpgradePolicyStateLinkKind + } + return AddonUpgradePolicyStateKind +} + +// Link returns true if this is a link. +func (o *AddonUpgradePolicyState) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddonUpgradePolicyState) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddonUpgradePolicyState) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddonUpgradePolicyState) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddonUpgradePolicyState) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonUpgradePolicyState) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Description of the state. +func (o *AddonUpgradePolicyState) Description() string { + if o != nil && o.bitmap_&8 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Description of the state. +func (o *AddonUpgradePolicyState) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.description + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// State value can be 'pending', 'scheduled', 'cancelled', 'started', 'delayed', +// 'failed' or 'completed'. +func (o *AddonUpgradePolicyState) Value() UpgradePolicyStateValue { + if o != nil && o.bitmap_&16 != 0 { + return o.value + } + return UpgradePolicyStateValue("") +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// State value can be 'pending', 'scheduled', 'cancelled', 'started', 'delayed', +// 'failed' or 'completed'. +func (o *AddonUpgradePolicyState) GetValue() (value UpgradePolicyStateValue, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.value + } + return +} + +// AddonUpgradePolicyStateListKind is the name of the type used to represent list of objects of +// type 'addon_upgrade_policy_state'. +const AddonUpgradePolicyStateListKind = "AddonUpgradePolicyStateList" + +// AddonUpgradePolicyStateListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_upgrade_policy_state'. +const AddonUpgradePolicyStateListLinkKind = "AddonUpgradePolicyStateListLink" + +// AddonUpgradePolicyStateNilKind is the name of the type used to nil lists of objects of +// type 'addon_upgrade_policy_state'. +const AddonUpgradePolicyStateListNilKind = "AddonUpgradePolicyStateListNil" + +// AddonUpgradePolicyStateList is a list of values of the 'addon_upgrade_policy_state' type. +type AddonUpgradePolicyStateList struct { + href string + link bool + items []*AddonUpgradePolicyState +} + +// Kind returns the name of the type of the object. +func (l *AddonUpgradePolicyStateList) Kind() string { + if l == nil { + return AddonUpgradePolicyStateListNilKind + } + if l.link { + return AddonUpgradePolicyStateListLinkKind + } + return AddonUpgradePolicyStateListKind +} + +// Link returns true iif this is a link. +func (l *AddonUpgradePolicyStateList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddonUpgradePolicyStateList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddonUpgradePolicyStateList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddonUpgradePolicyStateList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonUpgradePolicyStateList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonUpgradePolicyStateList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonUpgradePolicyStateList) SetItems(items []*AddonUpgradePolicyState) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonUpgradePolicyStateList) Items() []*AddonUpgradePolicyState { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonUpgradePolicyStateList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonUpgradePolicyStateList) Get(i int) *AddonUpgradePolicyState { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonUpgradePolicyStateList) Slice() []*AddonUpgradePolicyState { + var slice []*AddonUpgradePolicyState + if l == nil { + slice = make([]*AddonUpgradePolicyState, 0) + } else { + slice = make([]*AddonUpgradePolicyState, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonUpgradePolicyStateList) Each(f func(item *AddonUpgradePolicyState) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonUpgradePolicyStateList) Range(f func(index int, item *AddonUpgradePolicyState) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_type_json.go b/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_type_json.go new file mode 100644 index 00000000..fbdae922 --- /dev/null +++ b/clientapi/clustersmgmt/v1/addon_upgrade_policy_state_type_json.go @@ -0,0 +1,134 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonUpgradePolicyState writes a value of the 'addon_upgrade_policy_state' type to the given writer. +func MarshalAddonUpgradePolicyState(object *AddonUpgradePolicyState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonUpgradePolicyState(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonUpgradePolicyState writes a value of the 'addon_upgrade_policy_state' type to the given stream. +func WriteAddonUpgradePolicyState(object *AddonUpgradePolicyState, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddonUpgradePolicyStateLinkKind) + } else { + stream.WriteString(AddonUpgradePolicyStateKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(string(object.value)) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonUpgradePolicyState reads a value of the 'addon_upgrade_policy_state' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonUpgradePolicyState(source interface{}) (object *AddonUpgradePolicyState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonUpgradePolicyState(iterator) + err = iterator.Error + return +} + +// ReadAddonUpgradePolicyState reads a value of the 'addon_upgrade_policy_state' type from the given iterator. +func ReadAddonUpgradePolicyState(iterator *jsoniter.Iterator) *AddonUpgradePolicyState { + object := &AddonUpgradePolicyState{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddonUpgradePolicyStateLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 8 + case "value": + text := iterator.ReadString() + value := UpgradePolicyStateValue(text) + object.value = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/addon_upgrade_policy_type.go b/clientapi/clustersmgmt/v1/addon_upgrade_policy_type.go new file mode 100644 index 00000000..623e2b5e --- /dev/null +++ b/clientapi/clustersmgmt/v1/addon_upgrade_policy_type.go @@ -0,0 +1,413 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// AddonUpgradePolicyKind is the name of the type used to represent objects +// of type 'addon_upgrade_policy'. +const AddonUpgradePolicyKind = "AddonUpgradePolicy" + +// AddonUpgradePolicyLinkKind is the name of the type used to represent links +// to objects of type 'addon_upgrade_policy'. +const AddonUpgradePolicyLinkKind = "AddonUpgradePolicyLink" + +// AddonUpgradePolicyNilKind is the name of the type used to nil references +// to objects of type 'addon_upgrade_policy'. +const AddonUpgradePolicyNilKind = "AddonUpgradePolicyNil" + +// AddonUpgradePolicy represents the values of the 'addon_upgrade_policy' type. +// +// Representation of an upgrade policy that can be set for a cluster. +type AddonUpgradePolicy struct { + bitmap_ uint32 + id string + href string + addonID string + clusterID string + nextRun time.Time + schedule string + scheduleType string + upgradeType string + version string +} + +// Kind returns the name of the type of the object. +func (o *AddonUpgradePolicy) Kind() string { + if o == nil { + return AddonUpgradePolicyNilKind + } + if o.bitmap_&1 != 0 { + return AddonUpgradePolicyLinkKind + } + return AddonUpgradePolicyKind +} + +// Link returns true if this is a link. +func (o *AddonUpgradePolicy) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AddonUpgradePolicy) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AddonUpgradePolicy) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AddonUpgradePolicy) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AddonUpgradePolicy) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AddonUpgradePolicy) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AddonID returns the value of the 'addon_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Addon ID this upgrade policy is defined for +func (o *AddonUpgradePolicy) AddonID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.addonID + } + return "" +} + +// GetAddonID returns the value of the 'addon_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Addon ID this upgrade policy is defined for +func (o *AddonUpgradePolicy) GetAddonID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.addonID + } + return +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster ID this upgrade policy is defined for. +func (o *AddonUpgradePolicy) ClusterID() string { + if o != nil && o.bitmap_&16 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster ID this upgrade policy is defined for. +func (o *AddonUpgradePolicy) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.clusterID + } + return +} + +// NextRun returns the value of the 'next_run' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Next time the upgrade should run. +func (o *AddonUpgradePolicy) NextRun() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.nextRun + } + return time.Time{} +} + +// GetNextRun returns the value of the 'next_run' attribute and +// a flag indicating if the attribute has a value. +// +// Next time the upgrade should run. +func (o *AddonUpgradePolicy) GetNextRun() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.nextRun + } + return +} + +// Schedule returns the value of the 'schedule' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Schedule cron expression that defines automatic upgrade scheduling. +func (o *AddonUpgradePolicy) Schedule() string { + if o != nil && o.bitmap_&64 != 0 { + return o.schedule + } + return "" +} + +// GetSchedule returns the value of the 'schedule' attribute and +// a flag indicating if the attribute has a value. +// +// Schedule cron expression that defines automatic upgrade scheduling. +func (o *AddonUpgradePolicy) GetSchedule() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.schedule + } + return +} + +// ScheduleType returns the value of the 'schedule_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Schedule type can be either "manual" (single execution) or "automatic" (re-occurring). +func (o *AddonUpgradePolicy) ScheduleType() string { + if o != nil && o.bitmap_&128 != 0 { + return o.scheduleType + } + return "" +} + +// GetScheduleType returns the value of the 'schedule_type' attribute and +// a flag indicating if the attribute has a value. +// +// Schedule type can be either "manual" (single execution) or "automatic" (re-occurring). +func (o *AddonUpgradePolicy) GetScheduleType() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.scheduleType + } + return +} + +// UpgradeType returns the value of the 'upgrade_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Upgrade type specify the type of the upgrade. Must be "ADDON". +func (o *AddonUpgradePolicy) UpgradeType() string { + if o != nil && o.bitmap_&256 != 0 { + return o.upgradeType + } + return "" +} + +// GetUpgradeType returns the value of the 'upgrade_type' attribute and +// a flag indicating if the attribute has a value. +// +// Upgrade type specify the type of the upgrade. Must be "ADDON". +func (o *AddonUpgradePolicy) GetUpgradeType() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.upgradeType + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Version is the desired upgrade version. +func (o *AddonUpgradePolicy) Version() string { + if o != nil && o.bitmap_&512 != 0 { + return o.version + } + return "" +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +// +// Version is the desired upgrade version. +func (o *AddonUpgradePolicy) GetVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.version + } + return +} + +// AddonUpgradePolicyListKind is the name of the type used to represent list of objects of +// type 'addon_upgrade_policy'. +const AddonUpgradePolicyListKind = "AddonUpgradePolicyList" + +// AddonUpgradePolicyListLinkKind is the name of the type used to represent links to list +// of objects of type 'addon_upgrade_policy'. +const AddonUpgradePolicyListLinkKind = "AddonUpgradePolicyListLink" + +// AddonUpgradePolicyNilKind is the name of the type used to nil lists of objects of +// type 'addon_upgrade_policy'. +const AddonUpgradePolicyListNilKind = "AddonUpgradePolicyListNil" + +// AddonUpgradePolicyList is a list of values of the 'addon_upgrade_policy' type. +type AddonUpgradePolicyList struct { + href string + link bool + items []*AddonUpgradePolicy +} + +// Kind returns the name of the type of the object. +func (l *AddonUpgradePolicyList) Kind() string { + if l == nil { + return AddonUpgradePolicyListNilKind + } + if l.link { + return AddonUpgradePolicyListLinkKind + } + return AddonUpgradePolicyListKind +} + +// Link returns true iif this is a link. +func (l *AddonUpgradePolicyList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AddonUpgradePolicyList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AddonUpgradePolicyList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AddonUpgradePolicyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AddonUpgradePolicyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AddonUpgradePolicyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AddonUpgradePolicyList) SetItems(items []*AddonUpgradePolicy) { + l.items = items +} + +// Items returns the items of the list. +func (l *AddonUpgradePolicyList) Items() []*AddonUpgradePolicy { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AddonUpgradePolicyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AddonUpgradePolicyList) Get(i int) *AddonUpgradePolicy { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AddonUpgradePolicyList) Slice() []*AddonUpgradePolicy { + var slice []*AddonUpgradePolicy + if l == nil { + slice = make([]*AddonUpgradePolicy, 0) + } else { + slice = make([]*AddonUpgradePolicy, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AddonUpgradePolicyList) Each(f func(item *AddonUpgradePolicy) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AddonUpgradePolicyList) Range(f func(index int, item *AddonUpgradePolicy) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/addon_upgrade_policy_type_json.go b/clientapi/clustersmgmt/v1/addon_upgrade_policy_type_json.go new file mode 100644 index 00000000..a0b474fd --- /dev/null +++ b/clientapi/clustersmgmt/v1/addon_upgrade_policy_type_json.go @@ -0,0 +1,203 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAddonUpgradePolicy writes a value of the 'addon_upgrade_policy' type to the given writer. +func MarshalAddonUpgradePolicy(object *AddonUpgradePolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAddonUpgradePolicy(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAddonUpgradePolicy writes a value of the 'addon_upgrade_policy' type to the given stream. +func WriteAddonUpgradePolicy(object *AddonUpgradePolicy, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AddonUpgradePolicyLinkKind) + } else { + stream.WriteString(AddonUpgradePolicyKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("addon_id") + stream.WriteString(object.addonID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("next_run") + stream.WriteString((object.nextRun).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("schedule") + stream.WriteString(object.schedule) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("schedule_type") + stream.WriteString(object.scheduleType) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("upgrade_type") + stream.WriteString(object.upgradeType) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + stream.WriteString(object.version) + } + stream.WriteObjectEnd() +} + +// UnmarshalAddonUpgradePolicy reads a value of the 'addon_upgrade_policy' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAddonUpgradePolicy(source interface{}) (object *AddonUpgradePolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAddonUpgradePolicy(iterator) + err = iterator.Error + return +} + +// ReadAddonUpgradePolicy reads a value of the 'addon_upgrade_policy' type from the given iterator. +func ReadAddonUpgradePolicy(iterator *jsoniter.Iterator) *AddonUpgradePolicy { + object := &AddonUpgradePolicy{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AddonUpgradePolicyLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "addon_id": + value := iterator.ReadString() + object.addonID = value + object.bitmap_ |= 8 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 16 + case "next_run": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.nextRun = value + object.bitmap_ |= 32 + case "schedule": + value := iterator.ReadString() + object.schedule = value + object.bitmap_ |= 64 + case "schedule_type": + value := iterator.ReadString() + object.scheduleType = value + object.bitmap_ |= 128 + case "upgrade_type": + value := iterator.ReadString() + object.upgradeType = value + object.bitmap_ |= 256 + case "version": + value := iterator.ReadString() + object.version = value + object.bitmap_ |= 512 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/admin_credentials_builder.go b/clientapi/clustersmgmt/v1/admin_credentials_builder.go new file mode 100644 index 00000000..9b926e0c --- /dev/null +++ b/clientapi/clustersmgmt/v1/admin_credentials_builder.go @@ -0,0 +1,74 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AdminCredentialsBuilder contains the data and logic needed to build 'admin_credentials' objects. +// +// Temporary administrator credentials generated during the installation of the +// cluster. +type AdminCredentialsBuilder struct { + bitmap_ uint32 + password string + user string +} + +// NewAdminCredentials creates a new builder of 'admin_credentials' objects. +func NewAdminCredentials() *AdminCredentialsBuilder { + return &AdminCredentialsBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AdminCredentialsBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Password sets the value of the 'password' attribute to the given value. +func (b *AdminCredentialsBuilder) Password(value string) *AdminCredentialsBuilder { + b.password = value + b.bitmap_ |= 1 + return b +} + +// User sets the value of the 'user' attribute to the given value. +func (b *AdminCredentialsBuilder) User(value string) *AdminCredentialsBuilder { + b.user = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AdminCredentialsBuilder) Copy(object *AdminCredentials) *AdminCredentialsBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.password = object.password + b.user = object.user + return b +} + +// Build creates a 'admin_credentials' object using the configuration stored in the builder. +func (b *AdminCredentialsBuilder) Build() (object *AdminCredentials, err error) { + object = new(AdminCredentials) + object.bitmap_ = b.bitmap_ + object.password = b.password + object.user = b.user + return +} diff --git a/clientapi/clustersmgmt/v1/admin_credentials_list_builder.go b/clientapi/clustersmgmt/v1/admin_credentials_list_builder.go new file mode 100644 index 00000000..3c5d41ee --- /dev/null +++ b/clientapi/clustersmgmt/v1/admin_credentials_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AdminCredentialsListBuilder contains the data and logic needed to build +// 'admin_credentials' objects. +type AdminCredentialsListBuilder struct { + items []*AdminCredentialsBuilder +} + +// NewAdminCredentialsList creates a new builder of 'admin_credentials' objects. +func NewAdminCredentialsList() *AdminCredentialsListBuilder { + return new(AdminCredentialsListBuilder) +} + +// Items sets the items of the list. +func (b *AdminCredentialsListBuilder) Items(values ...*AdminCredentialsBuilder) *AdminCredentialsListBuilder { + b.items = make([]*AdminCredentialsBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AdminCredentialsListBuilder) 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 *AdminCredentialsListBuilder) Copy(list *AdminCredentialsList) *AdminCredentialsListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AdminCredentialsBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAdminCredentials().Copy(v) + } + } + return b +} + +// Build creates a list of 'admin_credentials' objects using the +// configuration stored in the builder. +func (b *AdminCredentialsListBuilder) Build() (list *AdminCredentialsList, err error) { + items := make([]*AdminCredentials, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AdminCredentialsList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/admin_credentials_list_type_json.go b/clientapi/clustersmgmt/v1/admin_credentials_list_type_json.go new file mode 100644 index 00000000..a37ab1e9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/admin_credentials_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAdminCredentialsList writes a list of values of the 'admin_credentials' type to +// the given writer. +func MarshalAdminCredentialsList(list []*AdminCredentials, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAdminCredentialsList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAdminCredentialsList writes a list of value of the 'admin_credentials' type to +// the given stream. +func WriteAdminCredentialsList(list []*AdminCredentials, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAdminCredentials(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAdminCredentialsList reads a list of values of the 'admin_credentials' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAdminCredentialsList(source interface{}) (items []*AdminCredentials, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAdminCredentialsList(iterator) + err = iterator.Error + return +} + +// ReadAdminCredentialsList reads list of values of the ”admin_credentials' type from +// the given iterator. +func ReadAdminCredentialsList(iterator *jsoniter.Iterator) []*AdminCredentials { + list := []*AdminCredentials{} + for iterator.ReadArray() { + item := ReadAdminCredentials(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/admin_credentials_type.go b/clientapi/clustersmgmt/v1/admin_credentials_type.go new file mode 100644 index 00000000..49e3afb8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/admin_credentials_type.go @@ -0,0 +1,190 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AdminCredentials represents the values of the 'admin_credentials' type. +// +// Temporary administrator credentials generated during the installation of the +// cluster. +type AdminCredentials struct { + bitmap_ uint32 + password string + user string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AdminCredentials) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Password returns the value of the 'password' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster administrator password. +func (o *AdminCredentials) Password() string { + if o != nil && o.bitmap_&1 != 0 { + return o.password + } + return "" +} + +// GetPassword returns the value of the 'password' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster administrator password. +func (o *AdminCredentials) GetPassword() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.password + } + return +} + +// User returns the value of the 'user' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster administrator user name. +func (o *AdminCredentials) User() string { + if o != nil && o.bitmap_&2 != 0 { + return o.user + } + return "" +} + +// GetUser returns the value of the 'user' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster administrator user name. +func (o *AdminCredentials) GetUser() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.user + } + return +} + +// AdminCredentialsListKind is the name of the type used to represent list of objects of +// type 'admin_credentials'. +const AdminCredentialsListKind = "AdminCredentialsList" + +// AdminCredentialsListLinkKind is the name of the type used to represent links to list +// of objects of type 'admin_credentials'. +const AdminCredentialsListLinkKind = "AdminCredentialsListLink" + +// AdminCredentialsNilKind is the name of the type used to nil lists of objects of +// type 'admin_credentials'. +const AdminCredentialsListNilKind = "AdminCredentialsListNil" + +// AdminCredentialsList is a list of values of the 'admin_credentials' type. +type AdminCredentialsList struct { + href string + link bool + items []*AdminCredentials +} + +// Len returns the length of the list. +func (l *AdminCredentialsList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AdminCredentialsList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AdminCredentialsList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AdminCredentialsList) SetItems(items []*AdminCredentials) { + l.items = items +} + +// Items returns the items of the list. +func (l *AdminCredentialsList) Items() []*AdminCredentials { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AdminCredentialsList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AdminCredentialsList) Get(i int) *AdminCredentials { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AdminCredentialsList) Slice() []*AdminCredentials { + var slice []*AdminCredentials + if l == nil { + slice = make([]*AdminCredentials, 0) + } else { + slice = make([]*AdminCredentials, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AdminCredentialsList) Each(f func(item *AdminCredentials) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AdminCredentialsList) Range(f func(index int, item *AdminCredentials) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/admin_credentials_type_json.go b/clientapi/clustersmgmt/v1/admin_credentials_type_json.go new file mode 100644 index 00000000..7c8f117f --- /dev/null +++ b/clientapi/clustersmgmt/v1/admin_credentials_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAdminCredentials writes a value of the 'admin_credentials' type to the given writer. +func MarshalAdminCredentials(object *AdminCredentials, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAdminCredentials(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAdminCredentials writes a value of the 'admin_credentials' type to the given stream. +func WriteAdminCredentials(object *AdminCredentials, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("password") + stream.WriteString(object.password) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("user") + stream.WriteString(object.user) + } + stream.WriteObjectEnd() +} + +// UnmarshalAdminCredentials reads a value of the 'admin_credentials' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAdminCredentials(source interface{}) (object *AdminCredentials, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAdminCredentials(iterator) + err = iterator.Error + return +} + +// ReadAdminCredentials reads a value of the 'admin_credentials' type from the given iterator. +func ReadAdminCredentials(iterator *jsoniter.Iterator) *AdminCredentials { + object := &AdminCredentials{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "password": + value := iterator.ReadString() + object.password = value + object.bitmap_ |= 1 + case "user": + value := iterator.ReadString() + object.user = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/alert_info_builder.go b/clientapi/clustersmgmt/v1/alert_info_builder.go new file mode 100644 index 00000000..59660c35 --- /dev/null +++ b/clientapi/clustersmgmt/v1/alert_info_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AlertInfoBuilder contains the data and logic needed to build 'alert_info' objects. +// +// Provides information about a single alert firing on the cluster. +type AlertInfoBuilder struct { + bitmap_ uint32 + name string + severity AlertSeverity +} + +// NewAlertInfo creates a new builder of 'alert_info' objects. +func NewAlertInfo() *AlertInfoBuilder { + return &AlertInfoBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AlertInfoBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AlertInfoBuilder) Name(value string) *AlertInfoBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Severity sets the value of the 'severity' attribute to the given value. +// +// Severity of a cluster alert received via telemetry. +func (b *AlertInfoBuilder) Severity(value AlertSeverity) *AlertInfoBuilder { + b.severity = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AlertInfoBuilder) Copy(object *AlertInfo) *AlertInfoBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + b.severity = object.severity + return b +} + +// Build creates a 'alert_info' object using the configuration stored in the builder. +func (b *AlertInfoBuilder) Build() (object *AlertInfo, err error) { + object = new(AlertInfo) + object.bitmap_ = b.bitmap_ + object.name = b.name + object.severity = b.severity + return +} diff --git a/clientapi/clustersmgmt/v1/alert_info_list_builder.go b/clientapi/clustersmgmt/v1/alert_info_list_builder.go new file mode 100644 index 00000000..c3592c20 --- /dev/null +++ b/clientapi/clustersmgmt/v1/alert_info_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AlertInfoListBuilder contains the data and logic needed to build +// 'alert_info' objects. +type AlertInfoListBuilder struct { + items []*AlertInfoBuilder +} + +// NewAlertInfoList creates a new builder of 'alert_info' objects. +func NewAlertInfoList() *AlertInfoListBuilder { + return new(AlertInfoListBuilder) +} + +// Items sets the items of the list. +func (b *AlertInfoListBuilder) Items(values ...*AlertInfoBuilder) *AlertInfoListBuilder { + b.items = make([]*AlertInfoBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AlertInfoListBuilder) 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 *AlertInfoListBuilder) Copy(list *AlertInfoList) *AlertInfoListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AlertInfoBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAlertInfo().Copy(v) + } + } + return b +} + +// Build creates a list of 'alert_info' objects using the +// configuration stored in the builder. +func (b *AlertInfoListBuilder) Build() (list *AlertInfoList, err error) { + items := make([]*AlertInfo, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AlertInfoList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/alert_info_list_type_json.go b/clientapi/clustersmgmt/v1/alert_info_list_type_json.go new file mode 100644 index 00000000..5b3ecf87 --- /dev/null +++ b/clientapi/clustersmgmt/v1/alert_info_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAlertInfoList writes a list of values of the 'alert_info' type to +// the given writer. +func MarshalAlertInfoList(list []*AlertInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAlertInfoList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAlertInfoList writes a list of value of the 'alert_info' type to +// the given stream. +func WriteAlertInfoList(list []*AlertInfo, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAlertInfo(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAlertInfoList reads a list of values of the 'alert_info' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAlertInfoList(source interface{}) (items []*AlertInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAlertInfoList(iterator) + err = iterator.Error + return +} + +// ReadAlertInfoList reads list of values of the ”alert_info' type from +// the given iterator. +func ReadAlertInfoList(iterator *jsoniter.Iterator) []*AlertInfo { + list := []*AlertInfo{} + for iterator.ReadArray() { + item := ReadAlertInfo(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/alert_info_type.go b/clientapi/clustersmgmt/v1/alert_info_type.go new file mode 100644 index 00000000..4a49cd02 --- /dev/null +++ b/clientapi/clustersmgmt/v1/alert_info_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AlertInfo represents the values of the 'alert_info' type. +// +// Provides information about a single alert firing on the cluster. +type AlertInfo struct { + bitmap_ uint32 + name string + severity AlertSeverity +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AlertInfo) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The alert name. Multiple alerts with same name are possible. +func (o *AlertInfo) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// The alert name. Multiple alerts with same name are possible. +func (o *AlertInfo) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Severity returns the value of the 'severity' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The alert severity. +func (o *AlertInfo) Severity() AlertSeverity { + if o != nil && o.bitmap_&2 != 0 { + return o.severity + } + return AlertSeverity("") +} + +// GetSeverity returns the value of the 'severity' attribute and +// a flag indicating if the attribute has a value. +// +// The alert severity. +func (o *AlertInfo) GetSeverity() (value AlertSeverity, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.severity + } + return +} + +// AlertInfoListKind is the name of the type used to represent list of objects of +// type 'alert_info'. +const AlertInfoListKind = "AlertInfoList" + +// AlertInfoListLinkKind is the name of the type used to represent links to list +// of objects of type 'alert_info'. +const AlertInfoListLinkKind = "AlertInfoListLink" + +// AlertInfoNilKind is the name of the type used to nil lists of objects of +// type 'alert_info'. +const AlertInfoListNilKind = "AlertInfoListNil" + +// AlertInfoList is a list of values of the 'alert_info' type. +type AlertInfoList struct { + href string + link bool + items []*AlertInfo +} + +// Len returns the length of the list. +func (l *AlertInfoList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AlertInfoList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AlertInfoList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AlertInfoList) SetItems(items []*AlertInfo) { + l.items = items +} + +// Items returns the items of the list. +func (l *AlertInfoList) Items() []*AlertInfo { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AlertInfoList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AlertInfoList) Get(i int) *AlertInfo { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AlertInfoList) Slice() []*AlertInfo { + var slice []*AlertInfo + if l == nil { + slice = make([]*AlertInfo, 0) + } else { + slice = make([]*AlertInfo, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AlertInfoList) Each(f func(item *AlertInfo) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AlertInfoList) Range(f func(index int, item *AlertInfo) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/alert_info_type_json.go b/clientapi/clustersmgmt/v1/alert_info_type_json.go new file mode 100644 index 00000000..c9e0bd13 --- /dev/null +++ b/clientapi/clustersmgmt/v1/alert_info_type_json.go @@ -0,0 +1,100 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAlertInfo writes a value of the 'alert_info' type to the given writer. +func MarshalAlertInfo(object *AlertInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAlertInfo(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAlertInfo writes a value of the 'alert_info' type to the given stream. +func WriteAlertInfo(object *AlertInfo, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("severity") + stream.WriteString(string(object.severity)) + } + stream.WriteObjectEnd() +} + +// UnmarshalAlertInfo reads a value of the 'alert_info' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAlertInfo(source interface{}) (object *AlertInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAlertInfo(iterator) + err = iterator.Error + return +} + +// ReadAlertInfo reads a value of the 'alert_info' type from the given iterator. +func ReadAlertInfo(iterator *jsoniter.Iterator) *AlertInfo { + object := &AlertInfo{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "severity": + text := iterator.ReadString() + value := AlertSeverity(text) + object.severity = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/alert_severity_list_type_json.go b/clientapi/clustersmgmt/v1/alert_severity_list_type_json.go new file mode 100644 index 00000000..6a92ba44 --- /dev/null +++ b/clientapi/clustersmgmt/v1/alert_severity_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAlertSeverityList writes a list of values of the 'alert_severity' type to +// the given writer. +func MarshalAlertSeverityList(list []AlertSeverity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAlertSeverityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAlertSeverityList writes a list of value of the 'alert_severity' type to +// the given stream. +func WriteAlertSeverityList(list []AlertSeverity, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalAlertSeverityList reads a list of values of the 'alert_severity' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAlertSeverityList(source interface{}) (items []AlertSeverity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAlertSeverityList(iterator) + err = iterator.Error + return +} + +// ReadAlertSeverityList reads list of values of the ”alert_severity' type from +// the given iterator. +func ReadAlertSeverityList(iterator *jsoniter.Iterator) []AlertSeverity { + list := []AlertSeverity{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := AlertSeverity(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/alert_severity_type.go b/clientapi/clustersmgmt/v1/alert_severity_type.go new file mode 100644 index 00000000..ba77852c --- /dev/null +++ b/clientapi/clustersmgmt/v1/alert_severity_type.go @@ -0,0 +1,32 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AlertSeverity represents the values of the 'alert_severity' enumerated type. +type AlertSeverity string + +const ( + // Critical. + AlertSeverityCritical AlertSeverity = "critical" + // This level is only used for the "Watchdog" alert that is always on. + AlertSeverityNone AlertSeverity = "none" + // Warning. + AlertSeverityWarning AlertSeverity = "warning" +) diff --git a/clientapi/clustersmgmt/v1/alerts_info_builder.go b/clientapi/clustersmgmt/v1/alerts_info_builder.go new file mode 100644 index 00000000..5d29c16c --- /dev/null +++ b/clientapi/clustersmgmt/v1/alerts_info_builder.go @@ -0,0 +1,79 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AlertsInfoBuilder contains the data and logic needed to build 'alerts_info' objects. +// +// Provides information about the alerts firing on the cluster. +type AlertsInfoBuilder struct { + bitmap_ uint32 + alerts []*AlertInfoBuilder +} + +// NewAlertsInfo creates a new builder of 'alerts_info' objects. +func NewAlertsInfo() *AlertsInfoBuilder { + return &AlertsInfoBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AlertsInfoBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Alerts sets the value of the 'alerts' attribute to the given values. +func (b *AlertsInfoBuilder) Alerts(values ...*AlertInfoBuilder) *AlertsInfoBuilder { + b.alerts = make([]*AlertInfoBuilder, len(values)) + copy(b.alerts, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AlertsInfoBuilder) Copy(object *AlertsInfo) *AlertsInfoBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.alerts != nil { + b.alerts = make([]*AlertInfoBuilder, len(object.alerts)) + for i, v := range object.alerts { + b.alerts[i] = NewAlertInfo().Copy(v) + } + } else { + b.alerts = nil + } + return b +} + +// Build creates a 'alerts_info' object using the configuration stored in the builder. +func (b *AlertsInfoBuilder) Build() (object *AlertsInfo, err error) { + object = new(AlertsInfo) + object.bitmap_ = b.bitmap_ + if b.alerts != nil { + object.alerts = make([]*AlertInfo, len(b.alerts)) + for i, v := range b.alerts { + object.alerts[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/alerts_info_list_builder.go b/clientapi/clustersmgmt/v1/alerts_info_list_builder.go new file mode 100644 index 00000000..e41fca6c --- /dev/null +++ b/clientapi/clustersmgmt/v1/alerts_info_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AlertsInfoListBuilder contains the data and logic needed to build +// 'alerts_info' objects. +type AlertsInfoListBuilder struct { + items []*AlertsInfoBuilder +} + +// NewAlertsInfoList creates a new builder of 'alerts_info' objects. +func NewAlertsInfoList() *AlertsInfoListBuilder { + return new(AlertsInfoListBuilder) +} + +// Items sets the items of the list. +func (b *AlertsInfoListBuilder) Items(values ...*AlertsInfoBuilder) *AlertsInfoListBuilder { + b.items = make([]*AlertsInfoBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AlertsInfoListBuilder) 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 *AlertsInfoListBuilder) Copy(list *AlertsInfoList) *AlertsInfoListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AlertsInfoBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAlertsInfo().Copy(v) + } + } + return b +} + +// Build creates a list of 'alerts_info' objects using the +// configuration stored in the builder. +func (b *AlertsInfoListBuilder) Build() (list *AlertsInfoList, err error) { + items := make([]*AlertsInfo, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AlertsInfoList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/alerts_info_list_type_json.go b/clientapi/clustersmgmt/v1/alerts_info_list_type_json.go new file mode 100644 index 00000000..0cb40897 --- /dev/null +++ b/clientapi/clustersmgmt/v1/alerts_info_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAlertsInfoList writes a list of values of the 'alerts_info' type to +// the given writer. +func MarshalAlertsInfoList(list []*AlertsInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAlertsInfoList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAlertsInfoList writes a list of value of the 'alerts_info' type to +// the given stream. +func WriteAlertsInfoList(list []*AlertsInfo, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAlertsInfo(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAlertsInfoList reads a list of values of the 'alerts_info' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAlertsInfoList(source interface{}) (items []*AlertsInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAlertsInfoList(iterator) + err = iterator.Error + return +} + +// ReadAlertsInfoList reads list of values of the ”alerts_info' type from +// the given iterator. +func ReadAlertsInfoList(iterator *jsoniter.Iterator) []*AlertsInfo { + list := []*AlertsInfo{} + for iterator.ReadArray() { + item := ReadAlertsInfo(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/alerts_info_type.go b/clientapi/clustersmgmt/v1/alerts_info_type.go new file mode 100644 index 00000000..4ec4c718 --- /dev/null +++ b/clientapi/clustersmgmt/v1/alerts_info_type.go @@ -0,0 +1,161 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AlertsInfo represents the values of the 'alerts_info' type. +// +// Provides information about the alerts firing on the cluster. +type AlertsInfo struct { + bitmap_ uint32 + alerts []*AlertInfo +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AlertsInfo) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Alerts returns the value of the 'alerts' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *AlertsInfo) Alerts() []*AlertInfo { + if o != nil && o.bitmap_&1 != 0 { + return o.alerts + } + return nil +} + +// GetAlerts returns the value of the 'alerts' attribute and +// a flag indicating if the attribute has a value. +func (o *AlertsInfo) GetAlerts() (value []*AlertInfo, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.alerts + } + return +} + +// AlertsInfoListKind is the name of the type used to represent list of objects of +// type 'alerts_info'. +const AlertsInfoListKind = "AlertsInfoList" + +// AlertsInfoListLinkKind is the name of the type used to represent links to list +// of objects of type 'alerts_info'. +const AlertsInfoListLinkKind = "AlertsInfoListLink" + +// AlertsInfoNilKind is the name of the type used to nil lists of objects of +// type 'alerts_info'. +const AlertsInfoListNilKind = "AlertsInfoListNil" + +// AlertsInfoList is a list of values of the 'alerts_info' type. +type AlertsInfoList struct { + href string + link bool + items []*AlertsInfo +} + +// Len returns the length of the list. +func (l *AlertsInfoList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AlertsInfoList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AlertsInfoList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AlertsInfoList) SetItems(items []*AlertsInfo) { + l.items = items +} + +// Items returns the items of the list. +func (l *AlertsInfoList) Items() []*AlertsInfo { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AlertsInfoList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AlertsInfoList) Get(i int) *AlertsInfo { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AlertsInfoList) Slice() []*AlertsInfo { + var slice []*AlertsInfo + if l == nil { + slice = make([]*AlertsInfo, 0) + } else { + slice = make([]*AlertsInfo, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AlertsInfoList) Each(f func(item *AlertsInfo) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AlertsInfoList) Range(f func(index int, item *AlertsInfo) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/alerts_info_type_json.go b/clientapi/clustersmgmt/v1/alerts_info_type_json.go new file mode 100644 index 00000000..ebeff304 --- /dev/null +++ b/clientapi/clustersmgmt/v1/alerts_info_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAlertsInfo writes a value of the 'alerts_info' type to the given writer. +func MarshalAlertsInfo(object *AlertsInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAlertsInfo(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAlertsInfo writes a value of the 'alerts_info' type to the given stream. +func WriteAlertsInfo(object *AlertsInfo, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.alerts != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("alerts") + WriteAlertInfoList(object.alerts, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAlertsInfo reads a value of the 'alerts_info' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAlertsInfo(source interface{}) (object *AlertsInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAlertsInfo(iterator) + err = iterator.Error + return +} + +// ReadAlertsInfo reads a value of the 'alerts_info' type from the given iterator. +func ReadAlertsInfo(iterator *jsoniter.Iterator) *AlertsInfo { + object := &AlertsInfo{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "alerts": + value := ReadAlertInfoList(iterator) + object.alerts = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/ami_override_builder.go b/clientapi/clustersmgmt/v1/ami_override_builder.go new file mode 100644 index 00000000..4e6bc933 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ami_override_builder.go @@ -0,0 +1,139 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AMIOverrideBuilder contains the data and logic needed to build 'AMI_override' objects. +// +// AMIOverride specifies what Amazon Machine Image should be used for a particular product and region. +type AMIOverrideBuilder struct { + bitmap_ uint32 + id string + href string + ami string + product *ProductBuilder + region *CloudRegionBuilder +} + +// NewAMIOverride creates a new builder of 'AMI_override' objects. +func NewAMIOverride() *AMIOverrideBuilder { + return &AMIOverrideBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AMIOverrideBuilder) Link(value bool) *AMIOverrideBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AMIOverrideBuilder) ID(value string) *AMIOverrideBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AMIOverrideBuilder) HREF(value string) *AMIOverrideBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AMIOverrideBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AMI sets the value of the 'AMI' attribute to the given value. +func (b *AMIOverrideBuilder) AMI(value string) *AMIOverrideBuilder { + b.ami = value + b.bitmap_ |= 8 + return b +} + +// Product sets the value of the 'product' attribute to the given value. +// +// Representation of an product that can be selected as a cluster type. +func (b *AMIOverrideBuilder) Product(value *ProductBuilder) *AMIOverrideBuilder { + b.product = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Region sets the value of the 'region' attribute to the given value. +// +// Description of a region of a cloud provider. +func (b *AMIOverrideBuilder) Region(value *CloudRegionBuilder) *AMIOverrideBuilder { + b.region = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AMIOverrideBuilder) Copy(object *AMIOverride) *AMIOverrideBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.ami = object.ami + if object.product != nil { + b.product = NewProduct().Copy(object.product) + } else { + b.product = nil + } + if object.region != nil { + b.region = NewCloudRegion().Copy(object.region) + } else { + b.region = nil + } + return b +} + +// Build creates a 'AMI_override' object using the configuration stored in the builder. +func (b *AMIOverrideBuilder) Build() (object *AMIOverride, err error) { + object = new(AMIOverride) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.ami = b.ami + if b.product != nil { + object.product, err = b.product.Build() + if err != nil { + return + } + } + if b.region != nil { + object.region, err = b.region.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/ami_override_list_builder.go b/clientapi/clustersmgmt/v1/ami_override_list_builder.go new file mode 100644 index 00000000..44709bcd --- /dev/null +++ b/clientapi/clustersmgmt/v1/ami_override_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AMIOverrideListBuilder contains the data and logic needed to build +// 'AMI_override' objects. +type AMIOverrideListBuilder struct { + items []*AMIOverrideBuilder +} + +// NewAMIOverrideList creates a new builder of 'AMI_override' objects. +func NewAMIOverrideList() *AMIOverrideListBuilder { + return new(AMIOverrideListBuilder) +} + +// Items sets the items of the list. +func (b *AMIOverrideListBuilder) Items(values ...*AMIOverrideBuilder) *AMIOverrideListBuilder { + b.items = make([]*AMIOverrideBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AMIOverrideListBuilder) 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 *AMIOverrideListBuilder) Copy(list *AMIOverrideList) *AMIOverrideListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AMIOverrideBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAMIOverride().Copy(v) + } + } + return b +} + +// Build creates a list of 'AMI_override' objects using the +// configuration stored in the builder. +func (b *AMIOverrideListBuilder) Build() (list *AMIOverrideList, err error) { + items := make([]*AMIOverride, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AMIOverrideList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/ami_override_list_type_json.go b/clientapi/clustersmgmt/v1/ami_override_list_type_json.go new file mode 100644 index 00000000..d5739ccf --- /dev/null +++ b/clientapi/clustersmgmt/v1/ami_override_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAMIOverrideList writes a list of values of the 'AMI_override' type to +// the given writer. +func MarshalAMIOverrideList(list []*AMIOverride, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAMIOverrideList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAMIOverrideList writes a list of value of the 'AMI_override' type to +// the given stream. +func WriteAMIOverrideList(list []*AMIOverride, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAMIOverride(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAMIOverrideList reads a list of values of the 'AMI_override' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAMIOverrideList(source interface{}) (items []*AMIOverride, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAMIOverrideList(iterator) + err = iterator.Error + return +} + +// ReadAMIOverrideList reads list of values of the ”AMI_override' type from +// the given iterator. +func ReadAMIOverrideList(iterator *jsoniter.Iterator) []*AMIOverride { + list := []*AMIOverride{} + for iterator.ReadArray() { + item := ReadAMIOverride(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/ami_override_type.go b/clientapi/clustersmgmt/v1/ami_override_type.go new file mode 100644 index 00000000..a6fe27f1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ami_override_type.go @@ -0,0 +1,313 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AMIOverrideKind is the name of the type used to represent objects +// of type 'AMI_override'. +const AMIOverrideKind = "AMIOverride" + +// AMIOverrideLinkKind is the name of the type used to represent links +// to objects of type 'AMI_override'. +const AMIOverrideLinkKind = "AMIOverrideLink" + +// AMIOverrideNilKind is the name of the type used to nil references +// to objects of type 'AMI_override'. +const AMIOverrideNilKind = "AMIOverrideNil" + +// AMIOverride represents the values of the 'AMI_override' type. +// +// AMIOverride specifies what Amazon Machine Image should be used for a particular product and region. +type AMIOverride struct { + bitmap_ uint32 + id string + href string + ami string + product *Product + region *CloudRegion +} + +// Kind returns the name of the type of the object. +func (o *AMIOverride) Kind() string { + if o == nil { + return AMIOverrideNilKind + } + if o.bitmap_&1 != 0 { + return AMIOverrideLinkKind + } + return AMIOverrideKind +} + +// Link returns true if this is a link. +func (o *AMIOverride) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AMIOverride) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AMIOverride) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AMIOverride) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AMIOverride) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AMIOverride) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AMI returns the value of the 'AMI' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AMI is the id of the Amazon Machine Image. +func (o *AMIOverride) AMI() string { + if o != nil && o.bitmap_&8 != 0 { + return o.ami + } + return "" +} + +// GetAMI returns the value of the 'AMI' attribute and +// a flag indicating if the attribute has a value. +// +// AMI is the id of the Amazon Machine Image. +func (o *AMIOverride) GetAMI() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.ami + } + return +} + +// Product returns the value of the 'product' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the product type. +func (o *AMIOverride) Product() *Product { + if o != nil && o.bitmap_&16 != 0 { + return o.product + } + return nil +} + +// GetProduct returns the value of the 'product' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the product type. +func (o *AMIOverride) GetProduct() (value *Product, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.product + } + return +} + +// Region returns the value of the 'region' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the cloud provider region. +func (o *AMIOverride) Region() *CloudRegion { + if o != nil && o.bitmap_&32 != 0 { + return o.region + } + return nil +} + +// GetRegion returns the value of the 'region' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the cloud provider region. +func (o *AMIOverride) GetRegion() (value *CloudRegion, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.region + } + return +} + +// AMIOverrideListKind is the name of the type used to represent list of objects of +// type 'AMI_override'. +const AMIOverrideListKind = "AMIOverrideList" + +// AMIOverrideListLinkKind is the name of the type used to represent links to list +// of objects of type 'AMI_override'. +const AMIOverrideListLinkKind = "AMIOverrideListLink" + +// AMIOverrideNilKind is the name of the type used to nil lists of objects of +// type 'AMI_override'. +const AMIOverrideListNilKind = "AMIOverrideListNil" + +// AMIOverrideList is a list of values of the 'AMI_override' type. +type AMIOverrideList struct { + href string + link bool + items []*AMIOverride +} + +// Kind returns the name of the type of the object. +func (l *AMIOverrideList) Kind() string { + if l == nil { + return AMIOverrideListNilKind + } + if l.link { + return AMIOverrideListLinkKind + } + return AMIOverrideListKind +} + +// Link returns true iif this is a link. +func (l *AMIOverrideList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AMIOverrideList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AMIOverrideList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AMIOverrideList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AMIOverrideList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AMIOverrideList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AMIOverrideList) SetItems(items []*AMIOverride) { + l.items = items +} + +// Items returns the items of the list. +func (l *AMIOverrideList) Items() []*AMIOverride { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AMIOverrideList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AMIOverrideList) Get(i int) *AMIOverride { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AMIOverrideList) Slice() []*AMIOverride { + var slice []*AMIOverride + if l == nil { + slice = make([]*AMIOverride, 0) + } else { + slice = make([]*AMIOverride, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AMIOverrideList) Each(f func(item *AMIOverride) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AMIOverrideList) Range(f func(index int, item *AMIOverride) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/ami_override_type_json.go b/clientapi/clustersmgmt/v1/ami_override_type_json.go new file mode 100644 index 00000000..9cbe3650 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ami_override_type_json.go @@ -0,0 +1,146 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAMIOverride writes a value of the 'AMI_override' type to the given writer. +func MarshalAMIOverride(object *AMIOverride, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAMIOverride(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAMIOverride writes a value of the 'AMI_override' type to the given stream. +func WriteAMIOverride(object *AMIOverride, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AMIOverrideLinkKind) + } else { + stream.WriteString(AMIOverrideKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ami") + stream.WriteString(object.ami) + count++ + } + present_ = object.bitmap_&16 != 0 && object.product != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product") + WriteProduct(object.product, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.region != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region") + WriteCloudRegion(object.region, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAMIOverride reads a value of the 'AMI_override' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAMIOverride(source interface{}) (object *AMIOverride, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAMIOverride(iterator) + err = iterator.Error + return +} + +// ReadAMIOverride reads a value of the 'AMI_override' type from the given iterator. +func ReadAMIOverride(iterator *jsoniter.Iterator) *AMIOverride { + object := &AMIOverride{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AMIOverrideLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "ami": + value := iterator.ReadString() + object.ami = value + object.bitmap_ |= 8 + case "product": + value := ReadProduct(iterator) + object.product = value + object.bitmap_ |= 16 + case "region": + value := ReadCloudRegion(iterator) + object.region = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/audit_log_builder.go b/clientapi/clustersmgmt/v1/audit_log_builder.go new file mode 100644 index 00000000..b6b7ec95 --- /dev/null +++ b/clientapi/clustersmgmt/v1/audit_log_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AuditLogBuilder contains the data and logic needed to build 'audit_log' objects. +// +// Contains the necessary attributes to support audit log forwarding +type AuditLogBuilder struct { + bitmap_ uint32 + roleArn string +} + +// NewAuditLog creates a new builder of 'audit_log' objects. +func NewAuditLog() *AuditLogBuilder { + return &AuditLogBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AuditLogBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// RoleArn sets the value of the 'role_arn' attribute to the given value. +func (b *AuditLogBuilder) RoleArn(value string) *AuditLogBuilder { + b.roleArn = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AuditLogBuilder) Copy(object *AuditLog) *AuditLogBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.roleArn = object.roleArn + return b +} + +// Build creates a 'audit_log' object using the configuration stored in the builder. +func (b *AuditLogBuilder) Build() (object *AuditLog, err error) { + object = new(AuditLog) + object.bitmap_ = b.bitmap_ + object.roleArn = b.roleArn + return +} diff --git a/clientapi/clustersmgmt/v1/audit_log_list_builder.go b/clientapi/clustersmgmt/v1/audit_log_list_builder.go new file mode 100644 index 00000000..4fdcf91b --- /dev/null +++ b/clientapi/clustersmgmt/v1/audit_log_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AuditLogListBuilder contains the data and logic needed to build +// 'audit_log' objects. +type AuditLogListBuilder struct { + items []*AuditLogBuilder +} + +// NewAuditLogList creates a new builder of 'audit_log' objects. +func NewAuditLogList() *AuditLogListBuilder { + return new(AuditLogListBuilder) +} + +// Items sets the items of the list. +func (b *AuditLogListBuilder) Items(values ...*AuditLogBuilder) *AuditLogListBuilder { + b.items = make([]*AuditLogBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AuditLogListBuilder) 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 *AuditLogListBuilder) Copy(list *AuditLogList) *AuditLogListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AuditLogBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAuditLog().Copy(v) + } + } + return b +} + +// Build creates a list of 'audit_log' objects using the +// configuration stored in the builder. +func (b *AuditLogListBuilder) Build() (list *AuditLogList, err error) { + items := make([]*AuditLog, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AuditLogList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/audit_log_list_type_json.go b/clientapi/clustersmgmt/v1/audit_log_list_type_json.go new file mode 100644 index 00000000..95e69923 --- /dev/null +++ b/clientapi/clustersmgmt/v1/audit_log_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAuditLogList writes a list of values of the 'audit_log' type to +// the given writer. +func MarshalAuditLogList(list []*AuditLog, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAuditLogList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAuditLogList writes a list of value of the 'audit_log' type to +// the given stream. +func WriteAuditLogList(list []*AuditLog, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAuditLog(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAuditLogList reads a list of values of the 'audit_log' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAuditLogList(source interface{}) (items []*AuditLog, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAuditLogList(iterator) + err = iterator.Error + return +} + +// ReadAuditLogList reads list of values of the ”audit_log' type from +// the given iterator. +func ReadAuditLogList(iterator *jsoniter.Iterator) []*AuditLog { + list := []*AuditLog{} + for iterator.ReadArray() { + item := ReadAuditLog(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/audit_log_type.go b/clientapi/clustersmgmt/v1/audit_log_type.go new file mode 100644 index 00000000..1e691db5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/audit_log_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AuditLog represents the values of the 'audit_log' type. +// +// Contains the necessary attributes to support audit log forwarding +type AuditLog struct { + bitmap_ uint32 + roleArn string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AuditLog) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// RoleArn returns the value of the 'role_arn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN of the CloudWatch audit log forwarding role +func (o *AuditLog) RoleArn() string { + if o != nil && o.bitmap_&1 != 0 { + return o.roleArn + } + return "" +} + +// GetRoleArn returns the value of the 'role_arn' attribute and +// a flag indicating if the attribute has a value. +// +// ARN of the CloudWatch audit log forwarding role +func (o *AuditLog) GetRoleArn() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.roleArn + } + return +} + +// AuditLogListKind is the name of the type used to represent list of objects of +// type 'audit_log'. +const AuditLogListKind = "AuditLogList" + +// AuditLogListLinkKind is the name of the type used to represent links to list +// of objects of type 'audit_log'. +const AuditLogListLinkKind = "AuditLogListLink" + +// AuditLogNilKind is the name of the type used to nil lists of objects of +// type 'audit_log'. +const AuditLogListNilKind = "AuditLogListNil" + +// AuditLogList is a list of values of the 'audit_log' type. +type AuditLogList struct { + href string + link bool + items []*AuditLog +} + +// Len returns the length of the list. +func (l *AuditLogList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AuditLogList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AuditLogList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AuditLogList) SetItems(items []*AuditLog) { + l.items = items +} + +// Items returns the items of the list. +func (l *AuditLogList) Items() []*AuditLog { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AuditLogList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AuditLogList) Get(i int) *AuditLog { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AuditLogList) Slice() []*AuditLog { + var slice []*AuditLog + if l == nil { + slice = make([]*AuditLog, 0) + } else { + slice = make([]*AuditLog, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AuditLogList) Each(f func(item *AuditLog) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AuditLogList) Range(f func(index int, item *AuditLog) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/audit_log_type_json.go b/clientapi/clustersmgmt/v1/audit_log_type_json.go new file mode 100644 index 00000000..ef3b74c6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/audit_log_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAuditLog writes a value of the 'audit_log' type to the given writer. +func MarshalAuditLog(object *AuditLog, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAuditLog(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAuditLog writes a value of the 'audit_log' type to the given stream. +func WriteAuditLog(object *AuditLog, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role_arn") + stream.WriteString(object.roleArn) + } + stream.WriteObjectEnd() +} + +// UnmarshalAuditLog reads a value of the 'audit_log' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAuditLog(source interface{}) (object *AuditLog, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAuditLog(iterator) + err = iterator.Error + return +} + +// ReadAuditLog reads a value of the 'audit_log' type from the given iterator. +func ReadAuditLog(iterator *jsoniter.Iterator) *AuditLog { + object := &AuditLog{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "role_arn": + value := iterator.ReadString() + object.roleArn = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_resource_limits_builder.go b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_builder.go new file mode 100644 index 00000000..c20293ec --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_builder.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AutoscalerResourceLimitsBuilder contains the data and logic needed to build 'autoscaler_resource_limits' objects. +type AutoscalerResourceLimitsBuilder struct { + bitmap_ uint32 + gpus []*AutoscalerResourceLimitsGPULimitBuilder + cores *ResourceRangeBuilder + maxNodesTotal int + memory *ResourceRangeBuilder +} + +// NewAutoscalerResourceLimits creates a new builder of 'autoscaler_resource_limits' objects. +func NewAutoscalerResourceLimits() *AutoscalerResourceLimitsBuilder { + return &AutoscalerResourceLimitsBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AutoscalerResourceLimitsBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// GPUS sets the value of the 'GPUS' attribute to the given values. +func (b *AutoscalerResourceLimitsBuilder) GPUS(values ...*AutoscalerResourceLimitsGPULimitBuilder) *AutoscalerResourceLimitsBuilder { + b.gpus = make([]*AutoscalerResourceLimitsGPULimitBuilder, len(values)) + copy(b.gpus, values) + b.bitmap_ |= 1 + return b +} + +// Cores sets the value of the 'cores' attribute to the given value. +func (b *AutoscalerResourceLimitsBuilder) Cores(value *ResourceRangeBuilder) *AutoscalerResourceLimitsBuilder { + b.cores = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// MaxNodesTotal sets the value of the 'max_nodes_total' attribute to the given value. +func (b *AutoscalerResourceLimitsBuilder) MaxNodesTotal(value int) *AutoscalerResourceLimitsBuilder { + b.maxNodesTotal = value + b.bitmap_ |= 4 + return b +} + +// Memory sets the value of the 'memory' attribute to the given value. +func (b *AutoscalerResourceLimitsBuilder) Memory(value *ResourceRangeBuilder) *AutoscalerResourceLimitsBuilder { + b.memory = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AutoscalerResourceLimitsBuilder) Copy(object *AutoscalerResourceLimits) *AutoscalerResourceLimitsBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.gpus != nil { + b.gpus = make([]*AutoscalerResourceLimitsGPULimitBuilder, len(object.gpus)) + for i, v := range object.gpus { + b.gpus[i] = NewAutoscalerResourceLimitsGPULimit().Copy(v) + } + } else { + b.gpus = nil + } + if object.cores != nil { + b.cores = NewResourceRange().Copy(object.cores) + } else { + b.cores = nil + } + b.maxNodesTotal = object.maxNodesTotal + if object.memory != nil { + b.memory = NewResourceRange().Copy(object.memory) + } else { + b.memory = nil + } + return b +} + +// Build creates a 'autoscaler_resource_limits' object using the configuration stored in the builder. +func (b *AutoscalerResourceLimitsBuilder) Build() (object *AutoscalerResourceLimits, err error) { + object = new(AutoscalerResourceLimits) + object.bitmap_ = b.bitmap_ + if b.gpus != nil { + object.gpus = make([]*AutoscalerResourceLimitsGPULimit, len(b.gpus)) + for i, v := range b.gpus { + object.gpus[i], err = v.Build() + if err != nil { + return + } + } + } + if b.cores != nil { + object.cores, err = b.cores.Build() + if err != nil { + return + } + } + object.maxNodesTotal = b.maxNodesTotal + if b.memory != nil { + object.memory, err = b.memory.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_builder.go b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_builder.go new file mode 100644 index 00000000..6ca31017 --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_builder.go @@ -0,0 +1,84 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AutoscalerResourceLimitsGPULimitBuilder contains the data and logic needed to build 'autoscaler_resource_limits_GPU_limit' objects. +type AutoscalerResourceLimitsGPULimitBuilder struct { + bitmap_ uint32 + range_ *ResourceRangeBuilder + type_ string +} + +// NewAutoscalerResourceLimitsGPULimit creates a new builder of 'autoscaler_resource_limits_GPU_limit' objects. +func NewAutoscalerResourceLimitsGPULimit() *AutoscalerResourceLimitsGPULimitBuilder { + return &AutoscalerResourceLimitsGPULimitBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AutoscalerResourceLimitsGPULimitBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Range sets the value of the 'range' attribute to the given value. +func (b *AutoscalerResourceLimitsGPULimitBuilder) Range(value *ResourceRangeBuilder) *AutoscalerResourceLimitsGPULimitBuilder { + b.range_ = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *AutoscalerResourceLimitsGPULimitBuilder) Type(value string) *AutoscalerResourceLimitsGPULimitBuilder { + b.type_ = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AutoscalerResourceLimitsGPULimitBuilder) Copy(object *AutoscalerResourceLimitsGPULimit) *AutoscalerResourceLimitsGPULimitBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.range_ != nil { + b.range_ = NewResourceRange().Copy(object.range_) + } else { + b.range_ = nil + } + b.type_ = object.type_ + return b +} + +// Build creates a 'autoscaler_resource_limits_GPU_limit' object using the configuration stored in the builder. +func (b *AutoscalerResourceLimitsGPULimitBuilder) Build() (object *AutoscalerResourceLimitsGPULimit, err error) { + object = new(AutoscalerResourceLimitsGPULimit) + object.bitmap_ = b.bitmap_ + if b.range_ != nil { + object.range_, err = b.range_.Build() + if err != nil { + return + } + } + object.type_ = b.type_ + return +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_list_builder.go b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_list_builder.go new file mode 100644 index 00000000..a055a3a8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AutoscalerResourceLimitsGPULimitListBuilder contains the data and logic needed to build +// 'autoscaler_resource_limits_GPU_limit' objects. +type AutoscalerResourceLimitsGPULimitListBuilder struct { + items []*AutoscalerResourceLimitsGPULimitBuilder +} + +// NewAutoscalerResourceLimitsGPULimitList creates a new builder of 'autoscaler_resource_limits_GPU_limit' objects. +func NewAutoscalerResourceLimitsGPULimitList() *AutoscalerResourceLimitsGPULimitListBuilder { + return new(AutoscalerResourceLimitsGPULimitListBuilder) +} + +// Items sets the items of the list. +func (b *AutoscalerResourceLimitsGPULimitListBuilder) Items(values ...*AutoscalerResourceLimitsGPULimitBuilder) *AutoscalerResourceLimitsGPULimitListBuilder { + b.items = make([]*AutoscalerResourceLimitsGPULimitBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AutoscalerResourceLimitsGPULimitListBuilder) 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 *AutoscalerResourceLimitsGPULimitListBuilder) Copy(list *AutoscalerResourceLimitsGPULimitList) *AutoscalerResourceLimitsGPULimitListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AutoscalerResourceLimitsGPULimitBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAutoscalerResourceLimitsGPULimit().Copy(v) + } + } + return b +} + +// Build creates a list of 'autoscaler_resource_limits_GPU_limit' objects using the +// configuration stored in the builder. +func (b *AutoscalerResourceLimitsGPULimitListBuilder) Build() (list *AutoscalerResourceLimitsGPULimitList, err error) { + items := make([]*AutoscalerResourceLimitsGPULimit, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AutoscalerResourceLimitsGPULimitList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_list_type_json.go b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_list_type_json.go new file mode 100644 index 00000000..3f1eb37e --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAutoscalerResourceLimitsGPULimitList writes a list of values of the 'autoscaler_resource_limits_GPU_limit' type to +// the given writer. +func MarshalAutoscalerResourceLimitsGPULimitList(list []*AutoscalerResourceLimitsGPULimit, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAutoscalerResourceLimitsGPULimitList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAutoscalerResourceLimitsGPULimitList writes a list of value of the 'autoscaler_resource_limits_GPU_limit' type to +// the given stream. +func WriteAutoscalerResourceLimitsGPULimitList(list []*AutoscalerResourceLimitsGPULimit, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAutoscalerResourceLimitsGPULimit(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAutoscalerResourceLimitsGPULimitList reads a list of values of the 'autoscaler_resource_limits_GPU_limit' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAutoscalerResourceLimitsGPULimitList(source interface{}) (items []*AutoscalerResourceLimitsGPULimit, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAutoscalerResourceLimitsGPULimitList(iterator) + err = iterator.Error + return +} + +// ReadAutoscalerResourceLimitsGPULimitList reads list of values of the ”autoscaler_resource_limits_GPU_limit' type from +// the given iterator. +func ReadAutoscalerResourceLimitsGPULimitList(iterator *jsoniter.Iterator) []*AutoscalerResourceLimitsGPULimit { + list := []*AutoscalerResourceLimitsGPULimit{} + for iterator.ReadArray() { + item := ReadAutoscalerResourceLimitsGPULimit(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_type.go b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_type.go new file mode 100644 index 00000000..58070473 --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_type.go @@ -0,0 +1,191 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AutoscalerResourceLimitsGPULimit represents the values of the 'autoscaler_resource_limits_GPU_limit' type. +type AutoscalerResourceLimitsGPULimit struct { + bitmap_ uint32 + range_ *ResourceRange + type_ string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AutoscalerResourceLimitsGPULimit) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Range returns the value of the 'range' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *AutoscalerResourceLimitsGPULimit) Range() *ResourceRange { + if o != nil && o.bitmap_&1 != 0 { + return o.range_ + } + return nil +} + +// GetRange returns the value of the 'range' attribute and +// a flag indicating if the attribute has a value. +func (o *AutoscalerResourceLimitsGPULimit) GetRange() (value *ResourceRange, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.range_ + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The type of GPU to associate with the minimum and maximum limits. +// This value is used by the Cluster Autoscaler to identify Nodes that will have GPU capacity by searching +// for it as a label value on the Node objects. For example, Nodes that carry the label key +// `cluster-api/accelerator` with the label value being the same as the Type field will be counted towards +// the resource limits by the Cluster Autoscaler. +func (o *AutoscalerResourceLimitsGPULimit) Type() string { + if o != nil && o.bitmap_&2 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// The type of GPU to associate with the minimum and maximum limits. +// This value is used by the Cluster Autoscaler to identify Nodes that will have GPU capacity by searching +// for it as a label value on the Node objects. For example, Nodes that carry the label key +// `cluster-api/accelerator` with the label value being the same as the Type field will be counted towards +// the resource limits by the Cluster Autoscaler. +func (o *AutoscalerResourceLimitsGPULimit) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.type_ + } + return +} + +// AutoscalerResourceLimitsGPULimitListKind is the name of the type used to represent list of objects of +// type 'autoscaler_resource_limits_GPU_limit'. +const AutoscalerResourceLimitsGPULimitListKind = "AutoscalerResourceLimitsGPULimitList" + +// AutoscalerResourceLimitsGPULimitListLinkKind is the name of the type used to represent links to list +// of objects of type 'autoscaler_resource_limits_GPU_limit'. +const AutoscalerResourceLimitsGPULimitListLinkKind = "AutoscalerResourceLimitsGPULimitListLink" + +// AutoscalerResourceLimitsGPULimitNilKind is the name of the type used to nil lists of objects of +// type 'autoscaler_resource_limits_GPU_limit'. +const AutoscalerResourceLimitsGPULimitListNilKind = "AutoscalerResourceLimitsGPULimitListNil" + +// AutoscalerResourceLimitsGPULimitList is a list of values of the 'autoscaler_resource_limits_GPU_limit' type. +type AutoscalerResourceLimitsGPULimitList struct { + href string + link bool + items []*AutoscalerResourceLimitsGPULimit +} + +// Len returns the length of the list. +func (l *AutoscalerResourceLimitsGPULimitList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AutoscalerResourceLimitsGPULimitList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AutoscalerResourceLimitsGPULimitList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AutoscalerResourceLimitsGPULimitList) SetItems(items []*AutoscalerResourceLimitsGPULimit) { + l.items = items +} + +// Items returns the items of the list. +func (l *AutoscalerResourceLimitsGPULimitList) Items() []*AutoscalerResourceLimitsGPULimit { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AutoscalerResourceLimitsGPULimitList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AutoscalerResourceLimitsGPULimitList) Get(i int) *AutoscalerResourceLimitsGPULimit { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AutoscalerResourceLimitsGPULimitList) Slice() []*AutoscalerResourceLimitsGPULimit { + var slice []*AutoscalerResourceLimitsGPULimit + if l == nil { + slice = make([]*AutoscalerResourceLimitsGPULimit, 0) + } else { + slice = make([]*AutoscalerResourceLimitsGPULimit, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AutoscalerResourceLimitsGPULimitList) Each(f func(item *AutoscalerResourceLimitsGPULimit) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AutoscalerResourceLimitsGPULimitList) Range(f func(index int, item *AutoscalerResourceLimitsGPULimit) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_type_json.go b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_type_json.go new file mode 100644 index 00000000..08353999 --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_gpu_limit_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAutoscalerResourceLimitsGPULimit writes a value of the 'autoscaler_resource_limits_GPU_limit' type to the given writer. +func MarshalAutoscalerResourceLimitsGPULimit(object *AutoscalerResourceLimitsGPULimit, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAutoscalerResourceLimitsGPULimit(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAutoscalerResourceLimitsGPULimit writes a value of the 'autoscaler_resource_limits_GPU_limit' type to the given stream. +func WriteAutoscalerResourceLimitsGPULimit(object *AutoscalerResourceLimitsGPULimit, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.range_ != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("range") + WriteResourceRange(object.range_, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalAutoscalerResourceLimitsGPULimit reads a value of the 'autoscaler_resource_limits_GPU_limit' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAutoscalerResourceLimitsGPULimit(source interface{}) (object *AutoscalerResourceLimitsGPULimit, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAutoscalerResourceLimitsGPULimit(iterator) + err = iterator.Error + return +} + +// ReadAutoscalerResourceLimitsGPULimit reads a value of the 'autoscaler_resource_limits_GPU_limit' type from the given iterator. +func ReadAutoscalerResourceLimitsGPULimit(iterator *jsoniter.Iterator) *AutoscalerResourceLimitsGPULimit { + object := &AutoscalerResourceLimitsGPULimit{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "range": + value := ReadResourceRange(iterator) + object.range_ = value + object.bitmap_ |= 1 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_resource_limits_list_builder.go b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_list_builder.go new file mode 100644 index 00000000..41736b8f --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AutoscalerResourceLimitsListBuilder contains the data and logic needed to build +// 'autoscaler_resource_limits' objects. +type AutoscalerResourceLimitsListBuilder struct { + items []*AutoscalerResourceLimitsBuilder +} + +// NewAutoscalerResourceLimitsList creates a new builder of 'autoscaler_resource_limits' objects. +func NewAutoscalerResourceLimitsList() *AutoscalerResourceLimitsListBuilder { + return new(AutoscalerResourceLimitsListBuilder) +} + +// Items sets the items of the list. +func (b *AutoscalerResourceLimitsListBuilder) Items(values ...*AutoscalerResourceLimitsBuilder) *AutoscalerResourceLimitsListBuilder { + b.items = make([]*AutoscalerResourceLimitsBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AutoscalerResourceLimitsListBuilder) 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 *AutoscalerResourceLimitsListBuilder) Copy(list *AutoscalerResourceLimitsList) *AutoscalerResourceLimitsListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AutoscalerResourceLimitsBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAutoscalerResourceLimits().Copy(v) + } + } + return b +} + +// Build creates a list of 'autoscaler_resource_limits' objects using the +// configuration stored in the builder. +func (b *AutoscalerResourceLimitsListBuilder) Build() (list *AutoscalerResourceLimitsList, err error) { + items := make([]*AutoscalerResourceLimits, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AutoscalerResourceLimitsList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_resource_limits_list_type_json.go b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_list_type_json.go new file mode 100644 index 00000000..a8967876 --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAutoscalerResourceLimitsList writes a list of values of the 'autoscaler_resource_limits' type to +// the given writer. +func MarshalAutoscalerResourceLimitsList(list []*AutoscalerResourceLimits, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAutoscalerResourceLimitsList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAutoscalerResourceLimitsList writes a list of value of the 'autoscaler_resource_limits' type to +// the given stream. +func WriteAutoscalerResourceLimitsList(list []*AutoscalerResourceLimits, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAutoscalerResourceLimits(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAutoscalerResourceLimitsList reads a list of values of the 'autoscaler_resource_limits' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAutoscalerResourceLimitsList(source interface{}) (items []*AutoscalerResourceLimits, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAutoscalerResourceLimitsList(iterator) + err = iterator.Error + return +} + +// ReadAutoscalerResourceLimitsList reads list of values of the ”autoscaler_resource_limits' type from +// the given iterator. +func ReadAutoscalerResourceLimitsList(iterator *jsoniter.Iterator) []*AutoscalerResourceLimits { + list := []*AutoscalerResourceLimits{} + for iterator.ReadArray() { + item := ReadAutoscalerResourceLimits(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_resource_limits_type.go b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_type.go new file mode 100644 index 00000000..365564fa --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_type.go @@ -0,0 +1,243 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AutoscalerResourceLimits represents the values of the 'autoscaler_resource_limits' type. +type AutoscalerResourceLimits struct { + bitmap_ uint32 + gpus []*AutoscalerResourceLimitsGPULimit + cores *ResourceRange + maxNodesTotal int + memory *ResourceRange +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AutoscalerResourceLimits) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// GPUS returns the value of the 'GPUS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Minimum and maximum number of different GPUs in cluster, in the format ::. +// Cluster autoscaler will not scale the cluster beyond these numbers. Can be passed multiple times. +func (o *AutoscalerResourceLimits) GPUS() []*AutoscalerResourceLimitsGPULimit { + if o != nil && o.bitmap_&1 != 0 { + return o.gpus + } + return nil +} + +// GetGPUS returns the value of the 'GPUS' attribute and +// a flag indicating if the attribute has a value. +// +// Minimum and maximum number of different GPUs in cluster, in the format ::. +// Cluster autoscaler will not scale the cluster beyond these numbers. Can be passed multiple times. +func (o *AutoscalerResourceLimits) GetGPUS() (value []*AutoscalerResourceLimitsGPULimit, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.gpus + } + return +} + +// Cores returns the value of the 'cores' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Minimum and maximum number of cores in cluster, in the format :. +// Cluster autoscaler will not scale the cluster beyond these numbers. +func (o *AutoscalerResourceLimits) Cores() *ResourceRange { + if o != nil && o.bitmap_&2 != 0 { + return o.cores + } + return nil +} + +// GetCores returns the value of the 'cores' attribute and +// a flag indicating if the attribute has a value. +// +// Minimum and maximum number of cores in cluster, in the format :. +// Cluster autoscaler will not scale the cluster beyond these numbers. +func (o *AutoscalerResourceLimits) GetCores() (value *ResourceRange, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.cores + } + return +} + +// MaxNodesTotal returns the value of the 'max_nodes_total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Maximum number of nodes in all node groups. +// Cluster autoscaler will not grow the cluster beyond this number. +func (o *AutoscalerResourceLimits) MaxNodesTotal() int { + if o != nil && o.bitmap_&4 != 0 { + return o.maxNodesTotal + } + return 0 +} + +// GetMaxNodesTotal returns the value of the 'max_nodes_total' attribute and +// a flag indicating if the attribute has a value. +// +// Maximum number of nodes in all node groups. +// Cluster autoscaler will not grow the cluster beyond this number. +func (o *AutoscalerResourceLimits) GetMaxNodesTotal() (value int, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.maxNodesTotal + } + return +} + +// Memory returns the value of the 'memory' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Minimum and maximum number of gigabytes of memory in cluster, in the format :. +// Cluster autoscaler will not scale the cluster beyond these numbers. +func (o *AutoscalerResourceLimits) Memory() *ResourceRange { + if o != nil && o.bitmap_&8 != 0 { + return o.memory + } + return nil +} + +// GetMemory returns the value of the 'memory' attribute and +// a flag indicating if the attribute has a value. +// +// Minimum and maximum number of gigabytes of memory in cluster, in the format :. +// Cluster autoscaler will not scale the cluster beyond these numbers. +func (o *AutoscalerResourceLimits) GetMemory() (value *ResourceRange, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.memory + } + return +} + +// AutoscalerResourceLimitsListKind is the name of the type used to represent list of objects of +// type 'autoscaler_resource_limits'. +const AutoscalerResourceLimitsListKind = "AutoscalerResourceLimitsList" + +// AutoscalerResourceLimitsListLinkKind is the name of the type used to represent links to list +// of objects of type 'autoscaler_resource_limits'. +const AutoscalerResourceLimitsListLinkKind = "AutoscalerResourceLimitsListLink" + +// AutoscalerResourceLimitsNilKind is the name of the type used to nil lists of objects of +// type 'autoscaler_resource_limits'. +const AutoscalerResourceLimitsListNilKind = "AutoscalerResourceLimitsListNil" + +// AutoscalerResourceLimitsList is a list of values of the 'autoscaler_resource_limits' type. +type AutoscalerResourceLimitsList struct { + href string + link bool + items []*AutoscalerResourceLimits +} + +// Len returns the length of the list. +func (l *AutoscalerResourceLimitsList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AutoscalerResourceLimitsList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AutoscalerResourceLimitsList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AutoscalerResourceLimitsList) SetItems(items []*AutoscalerResourceLimits) { + l.items = items +} + +// Items returns the items of the list. +func (l *AutoscalerResourceLimitsList) Items() []*AutoscalerResourceLimits { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AutoscalerResourceLimitsList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AutoscalerResourceLimitsList) Get(i int) *AutoscalerResourceLimits { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AutoscalerResourceLimitsList) Slice() []*AutoscalerResourceLimits { + var slice []*AutoscalerResourceLimits + if l == nil { + slice = make([]*AutoscalerResourceLimits, 0) + } else { + slice = make([]*AutoscalerResourceLimits, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AutoscalerResourceLimitsList) Each(f func(item *AutoscalerResourceLimits) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AutoscalerResourceLimitsList) Range(f func(index int, item *AutoscalerResourceLimits) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_resource_limits_type_json.go b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_type_json.go new file mode 100644 index 00000000..526c32dd --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_resource_limits_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAutoscalerResourceLimits writes a value of the 'autoscaler_resource_limits' type to the given writer. +func MarshalAutoscalerResourceLimits(object *AutoscalerResourceLimits, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAutoscalerResourceLimits(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAutoscalerResourceLimits writes a value of the 'autoscaler_resource_limits' type to the given stream. +func WriteAutoscalerResourceLimits(object *AutoscalerResourceLimits, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.gpus != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gpus") + WriteAutoscalerResourceLimitsGPULimitList(object.gpus, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.cores != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cores") + WriteResourceRange(object.cores, stream) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_nodes_total") + stream.WriteInt(object.maxNodesTotal) + count++ + } + present_ = object.bitmap_&8 != 0 && object.memory != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("memory") + WriteResourceRange(object.memory, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAutoscalerResourceLimits reads a value of the 'autoscaler_resource_limits' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAutoscalerResourceLimits(source interface{}) (object *AutoscalerResourceLimits, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAutoscalerResourceLimits(iterator) + err = iterator.Error + return +} + +// ReadAutoscalerResourceLimits reads a value of the 'autoscaler_resource_limits' type from the given iterator. +func ReadAutoscalerResourceLimits(iterator *jsoniter.Iterator) *AutoscalerResourceLimits { + object := &AutoscalerResourceLimits{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "gpus": + value := ReadAutoscalerResourceLimitsGPULimitList(iterator) + object.gpus = value + object.bitmap_ |= 1 + case "cores": + value := ReadResourceRange(iterator) + object.cores = value + object.bitmap_ |= 2 + case "max_nodes_total": + value := iterator.ReadInt() + object.maxNodesTotal = value + object.bitmap_ |= 4 + case "memory": + value := ReadResourceRange(iterator) + object.memory = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_builder.go b/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_builder.go new file mode 100644 index 00000000..c91591e7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_builder.go @@ -0,0 +1,111 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AutoscalerScaleDownConfigBuilder contains the data and logic needed to build 'autoscaler_scale_down_config' objects. +type AutoscalerScaleDownConfigBuilder struct { + bitmap_ uint32 + delayAfterAdd string + delayAfterDelete string + delayAfterFailure string + unneededTime string + utilizationThreshold string + enabled bool +} + +// NewAutoscalerScaleDownConfig creates a new builder of 'autoscaler_scale_down_config' objects. +func NewAutoscalerScaleDownConfig() *AutoscalerScaleDownConfigBuilder { + return &AutoscalerScaleDownConfigBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AutoscalerScaleDownConfigBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// DelayAfterAdd sets the value of the 'delay_after_add' attribute to the given value. +func (b *AutoscalerScaleDownConfigBuilder) DelayAfterAdd(value string) *AutoscalerScaleDownConfigBuilder { + b.delayAfterAdd = value + b.bitmap_ |= 1 + return b +} + +// DelayAfterDelete sets the value of the 'delay_after_delete' attribute to the given value. +func (b *AutoscalerScaleDownConfigBuilder) DelayAfterDelete(value string) *AutoscalerScaleDownConfigBuilder { + b.delayAfterDelete = value + b.bitmap_ |= 2 + return b +} + +// DelayAfterFailure sets the value of the 'delay_after_failure' attribute to the given value. +func (b *AutoscalerScaleDownConfigBuilder) DelayAfterFailure(value string) *AutoscalerScaleDownConfigBuilder { + b.delayAfterFailure = value + b.bitmap_ |= 4 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *AutoscalerScaleDownConfigBuilder) Enabled(value bool) *AutoscalerScaleDownConfigBuilder { + b.enabled = value + b.bitmap_ |= 8 + return b +} + +// UnneededTime sets the value of the 'unneeded_time' attribute to the given value. +func (b *AutoscalerScaleDownConfigBuilder) UnneededTime(value string) *AutoscalerScaleDownConfigBuilder { + b.unneededTime = value + b.bitmap_ |= 16 + return b +} + +// UtilizationThreshold sets the value of the 'utilization_threshold' attribute to the given value. +func (b *AutoscalerScaleDownConfigBuilder) UtilizationThreshold(value string) *AutoscalerScaleDownConfigBuilder { + b.utilizationThreshold = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AutoscalerScaleDownConfigBuilder) Copy(object *AutoscalerScaleDownConfig) *AutoscalerScaleDownConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.delayAfterAdd = object.delayAfterAdd + b.delayAfterDelete = object.delayAfterDelete + b.delayAfterFailure = object.delayAfterFailure + b.enabled = object.enabled + b.unneededTime = object.unneededTime + b.utilizationThreshold = object.utilizationThreshold + return b +} + +// Build creates a 'autoscaler_scale_down_config' object using the configuration stored in the builder. +func (b *AutoscalerScaleDownConfigBuilder) Build() (object *AutoscalerScaleDownConfig, err error) { + object = new(AutoscalerScaleDownConfig) + object.bitmap_ = b.bitmap_ + object.delayAfterAdd = b.delayAfterAdd + object.delayAfterDelete = b.delayAfterDelete + object.delayAfterFailure = b.delayAfterFailure + object.enabled = b.enabled + object.unneededTime = b.unneededTime + object.utilizationThreshold = b.utilizationThreshold + return +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_list_builder.go b/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_list_builder.go new file mode 100644 index 00000000..cc886697 --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AutoscalerScaleDownConfigListBuilder contains the data and logic needed to build +// 'autoscaler_scale_down_config' objects. +type AutoscalerScaleDownConfigListBuilder struct { + items []*AutoscalerScaleDownConfigBuilder +} + +// NewAutoscalerScaleDownConfigList creates a new builder of 'autoscaler_scale_down_config' objects. +func NewAutoscalerScaleDownConfigList() *AutoscalerScaleDownConfigListBuilder { + return new(AutoscalerScaleDownConfigListBuilder) +} + +// Items sets the items of the list. +func (b *AutoscalerScaleDownConfigListBuilder) Items(values ...*AutoscalerScaleDownConfigBuilder) *AutoscalerScaleDownConfigListBuilder { + b.items = make([]*AutoscalerScaleDownConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AutoscalerScaleDownConfigListBuilder) 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 *AutoscalerScaleDownConfigListBuilder) Copy(list *AutoscalerScaleDownConfigList) *AutoscalerScaleDownConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AutoscalerScaleDownConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAutoscalerScaleDownConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'autoscaler_scale_down_config' objects using the +// configuration stored in the builder. +func (b *AutoscalerScaleDownConfigListBuilder) Build() (list *AutoscalerScaleDownConfigList, err error) { + items := make([]*AutoscalerScaleDownConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AutoscalerScaleDownConfigList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_list_type_json.go b/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_list_type_json.go new file mode 100644 index 00000000..496475d7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAutoscalerScaleDownConfigList writes a list of values of the 'autoscaler_scale_down_config' type to +// the given writer. +func MarshalAutoscalerScaleDownConfigList(list []*AutoscalerScaleDownConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAutoscalerScaleDownConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAutoscalerScaleDownConfigList writes a list of value of the 'autoscaler_scale_down_config' type to +// the given stream. +func WriteAutoscalerScaleDownConfigList(list []*AutoscalerScaleDownConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAutoscalerScaleDownConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAutoscalerScaleDownConfigList reads a list of values of the 'autoscaler_scale_down_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAutoscalerScaleDownConfigList(source interface{}) (items []*AutoscalerScaleDownConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAutoscalerScaleDownConfigList(iterator) + err = iterator.Error + return +} + +// ReadAutoscalerScaleDownConfigList reads list of values of the ”autoscaler_scale_down_config' type from +// the given iterator. +func ReadAutoscalerScaleDownConfigList(iterator *jsoniter.Iterator) []*AutoscalerScaleDownConfig { + list := []*AutoscalerScaleDownConfig{} + for iterator.ReadArray() { + item := ReadAutoscalerScaleDownConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_type.go b/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_type.go new file mode 100644 index 00000000..1d4af2e8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_type.go @@ -0,0 +1,283 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AutoscalerScaleDownConfig represents the values of the 'autoscaler_scale_down_config' type. +type AutoscalerScaleDownConfig struct { + bitmap_ uint32 + delayAfterAdd string + delayAfterDelete string + delayAfterFailure string + unneededTime string + utilizationThreshold string + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AutoscalerScaleDownConfig) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// DelayAfterAdd returns the value of the 'delay_after_add' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// How long after scale up that scale down evaluation resumes. +func (o *AutoscalerScaleDownConfig) DelayAfterAdd() string { + if o != nil && o.bitmap_&1 != 0 { + return o.delayAfterAdd + } + return "" +} + +// GetDelayAfterAdd returns the value of the 'delay_after_add' attribute and +// a flag indicating if the attribute has a value. +// +// How long after scale up that scale down evaluation resumes. +func (o *AutoscalerScaleDownConfig) GetDelayAfterAdd() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.delayAfterAdd + } + return +} + +// DelayAfterDelete returns the value of the 'delay_after_delete' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// How long after node deletion that scale down evaluation resumes, defaults to scan-interval. +func (o *AutoscalerScaleDownConfig) DelayAfterDelete() string { + if o != nil && o.bitmap_&2 != 0 { + return o.delayAfterDelete + } + return "" +} + +// GetDelayAfterDelete returns the value of the 'delay_after_delete' attribute and +// a flag indicating if the attribute has a value. +// +// How long after node deletion that scale down evaluation resumes, defaults to scan-interval. +func (o *AutoscalerScaleDownConfig) GetDelayAfterDelete() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.delayAfterDelete + } + return +} + +// DelayAfterFailure returns the value of the 'delay_after_failure' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// How long after scale down failure that scale down evaluation resumes. +func (o *AutoscalerScaleDownConfig) DelayAfterFailure() string { + if o != nil && o.bitmap_&4 != 0 { + return o.delayAfterFailure + } + return "" +} + +// GetDelayAfterFailure returns the value of the 'delay_after_failure' attribute and +// a flag indicating if the attribute has a value. +// +// How long after scale down failure that scale down evaluation resumes. +func (o *AutoscalerScaleDownConfig) GetDelayAfterFailure() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.delayAfterFailure + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Should cluster-autoscaler scale down the cluster. +func (o *AutoscalerScaleDownConfig) Enabled() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Should cluster-autoscaler scale down the cluster. +func (o *AutoscalerScaleDownConfig) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.enabled + } + return +} + +// UnneededTime returns the value of the 'unneeded_time' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// How long a node should be unneeded before it is eligible for scale down. +func (o *AutoscalerScaleDownConfig) UnneededTime() string { + if o != nil && o.bitmap_&16 != 0 { + return o.unneededTime + } + return "" +} + +// GetUnneededTime returns the value of the 'unneeded_time' attribute and +// a flag indicating if the attribute has a value. +// +// How long a node should be unneeded before it is eligible for scale down. +func (o *AutoscalerScaleDownConfig) GetUnneededTime() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.unneededTime + } + return +} + +// UtilizationThreshold returns the value of the 'utilization_threshold' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Node utilization level, defined as sum of requested resources divided by capacity, below which a node can be considered for scale down. +func (o *AutoscalerScaleDownConfig) UtilizationThreshold() string { + if o != nil && o.bitmap_&32 != 0 { + return o.utilizationThreshold + } + return "" +} + +// GetUtilizationThreshold returns the value of the 'utilization_threshold' attribute and +// a flag indicating if the attribute has a value. +// +// Node utilization level, defined as sum of requested resources divided by capacity, below which a node can be considered for scale down. +func (o *AutoscalerScaleDownConfig) GetUtilizationThreshold() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.utilizationThreshold + } + return +} + +// AutoscalerScaleDownConfigListKind is the name of the type used to represent list of objects of +// type 'autoscaler_scale_down_config'. +const AutoscalerScaleDownConfigListKind = "AutoscalerScaleDownConfigList" + +// AutoscalerScaleDownConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'autoscaler_scale_down_config'. +const AutoscalerScaleDownConfigListLinkKind = "AutoscalerScaleDownConfigListLink" + +// AutoscalerScaleDownConfigNilKind is the name of the type used to nil lists of objects of +// type 'autoscaler_scale_down_config'. +const AutoscalerScaleDownConfigListNilKind = "AutoscalerScaleDownConfigListNil" + +// AutoscalerScaleDownConfigList is a list of values of the 'autoscaler_scale_down_config' type. +type AutoscalerScaleDownConfigList struct { + href string + link bool + items []*AutoscalerScaleDownConfig +} + +// Len returns the length of the list. +func (l *AutoscalerScaleDownConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AutoscalerScaleDownConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AutoscalerScaleDownConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AutoscalerScaleDownConfigList) SetItems(items []*AutoscalerScaleDownConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *AutoscalerScaleDownConfigList) Items() []*AutoscalerScaleDownConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AutoscalerScaleDownConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AutoscalerScaleDownConfigList) Get(i int) *AutoscalerScaleDownConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AutoscalerScaleDownConfigList) Slice() []*AutoscalerScaleDownConfig { + var slice []*AutoscalerScaleDownConfig + if l == nil { + slice = make([]*AutoscalerScaleDownConfig, 0) + } else { + slice = make([]*AutoscalerScaleDownConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AutoscalerScaleDownConfigList) Each(f func(item *AutoscalerScaleDownConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AutoscalerScaleDownConfigList) Range(f func(index int, item *AutoscalerScaleDownConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_type_json.go b/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_type_json.go new file mode 100644 index 00000000..f2d3858e --- /dev/null +++ b/clientapi/clustersmgmt/v1/autoscaler_scale_down_config_type_json.go @@ -0,0 +1,151 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAutoscalerScaleDownConfig writes a value of the 'autoscaler_scale_down_config' type to the given writer. +func MarshalAutoscalerScaleDownConfig(object *AutoscalerScaleDownConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAutoscalerScaleDownConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAutoscalerScaleDownConfig writes a value of the 'autoscaler_scale_down_config' type to the given stream. +func WriteAutoscalerScaleDownConfig(object *AutoscalerScaleDownConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("delay_after_add") + stream.WriteString(object.delayAfterAdd) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("delay_after_delete") + stream.WriteString(object.delayAfterDelete) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("delay_after_failure") + stream.WriteString(object.delayAfterFailure) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("unneeded_time") + stream.WriteString(object.unneededTime) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("utilization_threshold") + stream.WriteString(object.utilizationThreshold) + } + stream.WriteObjectEnd() +} + +// UnmarshalAutoscalerScaleDownConfig reads a value of the 'autoscaler_scale_down_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAutoscalerScaleDownConfig(source interface{}) (object *AutoscalerScaleDownConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAutoscalerScaleDownConfig(iterator) + err = iterator.Error + return +} + +// ReadAutoscalerScaleDownConfig reads a value of the 'autoscaler_scale_down_config' type from the given iterator. +func ReadAutoscalerScaleDownConfig(iterator *jsoniter.Iterator) *AutoscalerScaleDownConfig { + object := &AutoscalerScaleDownConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "delay_after_add": + value := iterator.ReadString() + object.delayAfterAdd = value + object.bitmap_ |= 1 + case "delay_after_delete": + value := iterator.ReadString() + object.delayAfterDelete = value + object.bitmap_ |= 2 + case "delay_after_failure": + value := iterator.ReadString() + object.delayAfterFailure = value + object.bitmap_ |= 4 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 8 + case "unneeded_time": + value := iterator.ReadString() + object.unneededTime = value + object.bitmap_ |= 16 + case "utilization_threshold": + value := iterator.ReadString() + object.utilizationThreshold = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/aws_builder.go b/clientapi/clustersmgmt/v1/aws_builder.go new file mode 100644 index 00000000..a3426ae6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_builder.go @@ -0,0 +1,386 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSBuilder contains the data and logic needed to build 'AWS' objects. +// +// _Amazon Web Services_ specific settings of a cluster. +type AWSBuilder struct { + bitmap_ uint32 + kmsKeyArn string + sts *STSBuilder + accessKeyID string + accountID string + additionalAllowedPrincipals []string + additionalComputeSecurityGroupIds []string + additionalControlPlaneSecurityGroupIds []string + additionalInfraSecurityGroupIds []string + auditLog *AuditLogBuilder + billingAccountID string + ec2MetadataHttpTokens Ec2MetadataHttpTokens + etcdEncryption *AwsEtcdEncryptionBuilder + hcpInternalCommunicationHostedZoneId string + privateHostedZoneID string + privateHostedZoneRoleARN string + privateLinkConfiguration *PrivateLinkClusterConfigurationBuilder + secretAccessKey string + subnetIDs []string + tags map[string]string + vpcEndpointRoleArn string + privateLink bool +} + +// NewAWS creates a new builder of 'AWS' objects. +func NewAWS() *AWSBuilder { + return &AWSBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// KMSKeyArn sets the value of the 'KMS_key_arn' attribute to the given value. +func (b *AWSBuilder) KMSKeyArn(value string) *AWSBuilder { + b.kmsKeyArn = value + b.bitmap_ |= 1 + return b +} + +// STS sets the value of the 'STS' attribute to the given value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (b *AWSBuilder) STS(value *STSBuilder) *AWSBuilder { + b.sts = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// AccessKeyID sets the value of the 'access_key_ID' attribute to the given value. +func (b *AWSBuilder) AccessKeyID(value string) *AWSBuilder { + b.accessKeyID = value + b.bitmap_ |= 4 + return b +} + +// AccountID sets the value of the 'account_ID' attribute to the given value. +func (b *AWSBuilder) AccountID(value string) *AWSBuilder { + b.accountID = value + b.bitmap_ |= 8 + return b +} + +// AdditionalAllowedPrincipals sets the value of the 'additional_allowed_principals' attribute to the given values. +func (b *AWSBuilder) AdditionalAllowedPrincipals(values ...string) *AWSBuilder { + b.additionalAllowedPrincipals = make([]string, len(values)) + copy(b.additionalAllowedPrincipals, values) + b.bitmap_ |= 16 + return b +} + +// AdditionalComputeSecurityGroupIds sets the value of the 'additional_compute_security_group_ids' attribute to the given values. +func (b *AWSBuilder) AdditionalComputeSecurityGroupIds(values ...string) *AWSBuilder { + b.additionalComputeSecurityGroupIds = make([]string, len(values)) + copy(b.additionalComputeSecurityGroupIds, values) + b.bitmap_ |= 32 + return b +} + +// AdditionalControlPlaneSecurityGroupIds sets the value of the 'additional_control_plane_security_group_ids' attribute to the given values. +func (b *AWSBuilder) AdditionalControlPlaneSecurityGroupIds(values ...string) *AWSBuilder { + b.additionalControlPlaneSecurityGroupIds = make([]string, len(values)) + copy(b.additionalControlPlaneSecurityGroupIds, values) + b.bitmap_ |= 64 + return b +} + +// AdditionalInfraSecurityGroupIds sets the value of the 'additional_infra_security_group_ids' attribute to the given values. +func (b *AWSBuilder) AdditionalInfraSecurityGroupIds(values ...string) *AWSBuilder { + b.additionalInfraSecurityGroupIds = make([]string, len(values)) + copy(b.additionalInfraSecurityGroupIds, values) + b.bitmap_ |= 128 + return b +} + +// AuditLog sets the value of the 'audit_log' attribute to the given value. +// +// Contains the necessary attributes to support audit log forwarding +func (b *AWSBuilder) AuditLog(value *AuditLogBuilder) *AWSBuilder { + b.auditLog = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// BillingAccountID sets the value of the 'billing_account_ID' attribute to the given value. +func (b *AWSBuilder) BillingAccountID(value string) *AWSBuilder { + b.billingAccountID = value + b.bitmap_ |= 512 + return b +} + +// Ec2MetadataHttpTokens sets the value of the 'ec_2_metadata_http_tokens' attribute to the given value. +// +// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances +func (b *AWSBuilder) Ec2MetadataHttpTokens(value Ec2MetadataHttpTokens) *AWSBuilder { + b.ec2MetadataHttpTokens = value + b.bitmap_ |= 1024 + return b +} + +// EtcdEncryption sets the value of the 'etcd_encryption' attribute to the given value. +// +// Contains the necessary attributes to support etcd encryption for AWS based clusters. +func (b *AWSBuilder) EtcdEncryption(value *AwsEtcdEncryptionBuilder) *AWSBuilder { + b.etcdEncryption = value + if value != nil { + b.bitmap_ |= 2048 + } else { + b.bitmap_ &^= 2048 + } + return b +} + +// HcpInternalCommunicationHostedZoneId sets the value of the 'hcp_internal_communication_hosted_zone_id' attribute to the given value. +func (b *AWSBuilder) HcpInternalCommunicationHostedZoneId(value string) *AWSBuilder { + b.hcpInternalCommunicationHostedZoneId = value + b.bitmap_ |= 4096 + return b +} + +// PrivateHostedZoneID sets the value of the 'private_hosted_zone_ID' attribute to the given value. +func (b *AWSBuilder) PrivateHostedZoneID(value string) *AWSBuilder { + b.privateHostedZoneID = value + b.bitmap_ |= 8192 + return b +} + +// PrivateHostedZoneRoleARN sets the value of the 'private_hosted_zone_role_ARN' attribute to the given value. +func (b *AWSBuilder) PrivateHostedZoneRoleARN(value string) *AWSBuilder { + b.privateHostedZoneRoleARN = value + b.bitmap_ |= 16384 + return b +} + +// PrivateLink sets the value of the 'private_link' attribute to the given value. +func (b *AWSBuilder) PrivateLink(value bool) *AWSBuilder { + b.privateLink = value + b.bitmap_ |= 32768 + return b +} + +// PrivateLinkConfiguration sets the value of the 'private_link_configuration' attribute to the given value. +// +// Manages the configuration for the Private Links. +func (b *AWSBuilder) PrivateLinkConfiguration(value *PrivateLinkClusterConfigurationBuilder) *AWSBuilder { + b.privateLinkConfiguration = value + if value != nil { + b.bitmap_ |= 65536 + } else { + b.bitmap_ &^= 65536 + } + return b +} + +// SecretAccessKey sets the value of the 'secret_access_key' attribute to the given value. +func (b *AWSBuilder) SecretAccessKey(value string) *AWSBuilder { + b.secretAccessKey = value + b.bitmap_ |= 131072 + return b +} + +// SubnetIDs sets the value of the 'subnet_IDs' attribute to the given values. +func (b *AWSBuilder) SubnetIDs(values ...string) *AWSBuilder { + b.subnetIDs = make([]string, len(values)) + copy(b.subnetIDs, values) + b.bitmap_ |= 262144 + return b +} + +// Tags sets the value of the 'tags' attribute to the given value. +func (b *AWSBuilder) Tags(value map[string]string) *AWSBuilder { + b.tags = value + if value != nil { + b.bitmap_ |= 524288 + } else { + b.bitmap_ &^= 524288 + } + return b +} + +// VpcEndpointRoleArn sets the value of the 'vpc_endpoint_role_arn' attribute to the given value. +func (b *AWSBuilder) VpcEndpointRoleArn(value string) *AWSBuilder { + b.vpcEndpointRoleArn = value + b.bitmap_ |= 1048576 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSBuilder) Copy(object *AWS) *AWSBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.kmsKeyArn = object.kmsKeyArn + if object.sts != nil { + b.sts = NewSTS().Copy(object.sts) + } else { + b.sts = nil + } + b.accessKeyID = object.accessKeyID + b.accountID = object.accountID + if object.additionalAllowedPrincipals != nil { + b.additionalAllowedPrincipals = make([]string, len(object.additionalAllowedPrincipals)) + copy(b.additionalAllowedPrincipals, object.additionalAllowedPrincipals) + } else { + b.additionalAllowedPrincipals = nil + } + if object.additionalComputeSecurityGroupIds != nil { + b.additionalComputeSecurityGroupIds = make([]string, len(object.additionalComputeSecurityGroupIds)) + copy(b.additionalComputeSecurityGroupIds, object.additionalComputeSecurityGroupIds) + } else { + b.additionalComputeSecurityGroupIds = nil + } + if object.additionalControlPlaneSecurityGroupIds != nil { + b.additionalControlPlaneSecurityGroupIds = make([]string, len(object.additionalControlPlaneSecurityGroupIds)) + copy(b.additionalControlPlaneSecurityGroupIds, object.additionalControlPlaneSecurityGroupIds) + } else { + b.additionalControlPlaneSecurityGroupIds = nil + } + if object.additionalInfraSecurityGroupIds != nil { + b.additionalInfraSecurityGroupIds = make([]string, len(object.additionalInfraSecurityGroupIds)) + copy(b.additionalInfraSecurityGroupIds, object.additionalInfraSecurityGroupIds) + } else { + b.additionalInfraSecurityGroupIds = nil + } + if object.auditLog != nil { + b.auditLog = NewAuditLog().Copy(object.auditLog) + } else { + b.auditLog = nil + } + b.billingAccountID = object.billingAccountID + b.ec2MetadataHttpTokens = object.ec2MetadataHttpTokens + if object.etcdEncryption != nil { + b.etcdEncryption = NewAwsEtcdEncryption().Copy(object.etcdEncryption) + } else { + b.etcdEncryption = nil + } + b.hcpInternalCommunicationHostedZoneId = object.hcpInternalCommunicationHostedZoneId + b.privateHostedZoneID = object.privateHostedZoneID + b.privateHostedZoneRoleARN = object.privateHostedZoneRoleARN + b.privateLink = object.privateLink + if object.privateLinkConfiguration != nil { + b.privateLinkConfiguration = NewPrivateLinkClusterConfiguration().Copy(object.privateLinkConfiguration) + } else { + b.privateLinkConfiguration = nil + } + b.secretAccessKey = object.secretAccessKey + if object.subnetIDs != nil { + b.subnetIDs = make([]string, len(object.subnetIDs)) + copy(b.subnetIDs, object.subnetIDs) + } else { + b.subnetIDs = nil + } + if len(object.tags) > 0 { + b.tags = map[string]string{} + for k, v := range object.tags { + b.tags[k] = v + } + } else { + b.tags = nil + } + b.vpcEndpointRoleArn = object.vpcEndpointRoleArn + return b +} + +// Build creates a 'AWS' object using the configuration stored in the builder. +func (b *AWSBuilder) Build() (object *AWS, err error) { + object = new(AWS) + object.bitmap_ = b.bitmap_ + object.kmsKeyArn = b.kmsKeyArn + if b.sts != nil { + object.sts, err = b.sts.Build() + if err != nil { + return + } + } + object.accessKeyID = b.accessKeyID + object.accountID = b.accountID + if b.additionalAllowedPrincipals != nil { + object.additionalAllowedPrincipals = make([]string, len(b.additionalAllowedPrincipals)) + copy(object.additionalAllowedPrincipals, b.additionalAllowedPrincipals) + } + if b.additionalComputeSecurityGroupIds != nil { + object.additionalComputeSecurityGroupIds = make([]string, len(b.additionalComputeSecurityGroupIds)) + copy(object.additionalComputeSecurityGroupIds, b.additionalComputeSecurityGroupIds) + } + if b.additionalControlPlaneSecurityGroupIds != nil { + object.additionalControlPlaneSecurityGroupIds = make([]string, len(b.additionalControlPlaneSecurityGroupIds)) + copy(object.additionalControlPlaneSecurityGroupIds, b.additionalControlPlaneSecurityGroupIds) + } + if b.additionalInfraSecurityGroupIds != nil { + object.additionalInfraSecurityGroupIds = make([]string, len(b.additionalInfraSecurityGroupIds)) + copy(object.additionalInfraSecurityGroupIds, b.additionalInfraSecurityGroupIds) + } + if b.auditLog != nil { + object.auditLog, err = b.auditLog.Build() + if err != nil { + return + } + } + object.billingAccountID = b.billingAccountID + object.ec2MetadataHttpTokens = b.ec2MetadataHttpTokens + if b.etcdEncryption != nil { + object.etcdEncryption, err = b.etcdEncryption.Build() + if err != nil { + return + } + } + object.hcpInternalCommunicationHostedZoneId = b.hcpInternalCommunicationHostedZoneId + object.privateHostedZoneID = b.privateHostedZoneID + object.privateHostedZoneRoleARN = b.privateHostedZoneRoleARN + object.privateLink = b.privateLink + if b.privateLinkConfiguration != nil { + object.privateLinkConfiguration, err = b.privateLinkConfiguration.Build() + if err != nil { + return + } + } + object.secretAccessKey = b.secretAccessKey + if b.subnetIDs != nil { + object.subnetIDs = make([]string, len(b.subnetIDs)) + copy(object.subnetIDs, b.subnetIDs) + } + if b.tags != nil { + object.tags = make(map[string]string) + for k, v := range b.tags { + object.tags[k] = v + } + } + object.vpcEndpointRoleArn = b.vpcEndpointRoleArn + return +} diff --git a/clientapi/clustersmgmt/v1/aws_etcd_encryption_builder.go b/clientapi/clustersmgmt/v1/aws_etcd_encryption_builder.go new file mode 100644 index 00000000..54e8ffe9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_etcd_encryption_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AwsEtcdEncryptionBuilder contains the data and logic needed to build 'aws_etcd_encryption' objects. +// +// Contains the necessary attributes to support etcd encryption for AWS based clusters. +type AwsEtcdEncryptionBuilder struct { + bitmap_ uint32 + kmsKeyARN string +} + +// NewAwsEtcdEncryption creates a new builder of 'aws_etcd_encryption' objects. +func NewAwsEtcdEncryption() *AwsEtcdEncryptionBuilder { + return &AwsEtcdEncryptionBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AwsEtcdEncryptionBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// KMSKeyARN sets the value of the 'KMS_key_ARN' attribute to the given value. +func (b *AwsEtcdEncryptionBuilder) KMSKeyARN(value string) *AwsEtcdEncryptionBuilder { + b.kmsKeyARN = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AwsEtcdEncryptionBuilder) Copy(object *AwsEtcdEncryption) *AwsEtcdEncryptionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.kmsKeyARN = object.kmsKeyARN + return b +} + +// Build creates a 'aws_etcd_encryption' object using the configuration stored in the builder. +func (b *AwsEtcdEncryptionBuilder) Build() (object *AwsEtcdEncryption, err error) { + object = new(AwsEtcdEncryption) + object.bitmap_ = b.bitmap_ + object.kmsKeyARN = b.kmsKeyARN + return +} diff --git a/clientapi/clustersmgmt/v1/aws_etcd_encryption_list_builder.go b/clientapi/clustersmgmt/v1/aws_etcd_encryption_list_builder.go new file mode 100644 index 00000000..ec299f1c --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_etcd_encryption_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AwsEtcdEncryptionListBuilder contains the data and logic needed to build +// 'aws_etcd_encryption' objects. +type AwsEtcdEncryptionListBuilder struct { + items []*AwsEtcdEncryptionBuilder +} + +// NewAwsEtcdEncryptionList creates a new builder of 'aws_etcd_encryption' objects. +func NewAwsEtcdEncryptionList() *AwsEtcdEncryptionListBuilder { + return new(AwsEtcdEncryptionListBuilder) +} + +// Items sets the items of the list. +func (b *AwsEtcdEncryptionListBuilder) Items(values ...*AwsEtcdEncryptionBuilder) *AwsEtcdEncryptionListBuilder { + b.items = make([]*AwsEtcdEncryptionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AwsEtcdEncryptionListBuilder) 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 *AwsEtcdEncryptionListBuilder) Copy(list *AwsEtcdEncryptionList) *AwsEtcdEncryptionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AwsEtcdEncryptionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAwsEtcdEncryption().Copy(v) + } + } + return b +} + +// Build creates a list of 'aws_etcd_encryption' objects using the +// configuration stored in the builder. +func (b *AwsEtcdEncryptionListBuilder) Build() (list *AwsEtcdEncryptionList, err error) { + items := make([]*AwsEtcdEncryption, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AwsEtcdEncryptionList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/aws_etcd_encryption_list_type_json.go b/clientapi/clustersmgmt/v1/aws_etcd_encryption_list_type_json.go new file mode 100644 index 00000000..9853d192 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_etcd_encryption_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAwsEtcdEncryptionList writes a list of values of the 'aws_etcd_encryption' type to +// the given writer. +func MarshalAwsEtcdEncryptionList(list []*AwsEtcdEncryption, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAwsEtcdEncryptionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAwsEtcdEncryptionList writes a list of value of the 'aws_etcd_encryption' type to +// the given stream. +func WriteAwsEtcdEncryptionList(list []*AwsEtcdEncryption, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAwsEtcdEncryption(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAwsEtcdEncryptionList reads a list of values of the 'aws_etcd_encryption' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAwsEtcdEncryptionList(source interface{}) (items []*AwsEtcdEncryption, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAwsEtcdEncryptionList(iterator) + err = iterator.Error + return +} + +// ReadAwsEtcdEncryptionList reads list of values of the ”aws_etcd_encryption' type from +// the given iterator. +func ReadAwsEtcdEncryptionList(iterator *jsoniter.Iterator) []*AwsEtcdEncryption { + list := []*AwsEtcdEncryption{} + for iterator.ReadArray() { + item := ReadAwsEtcdEncryption(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/aws_etcd_encryption_type.go b/clientapi/clustersmgmt/v1/aws_etcd_encryption_type.go new file mode 100644 index 00000000..c6415568 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_etcd_encryption_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AwsEtcdEncryption represents the values of the 'aws_etcd_encryption' type. +// +// Contains the necessary attributes to support etcd encryption for AWS based clusters. +type AwsEtcdEncryption struct { + bitmap_ uint32 + kmsKeyARN string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AwsEtcdEncryption) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// KMSKeyARN returns the value of the 'KMS_key_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN of the KMS to be used for the etcd encryption +func (o *AwsEtcdEncryption) KMSKeyARN() string { + if o != nil && o.bitmap_&1 != 0 { + return o.kmsKeyARN + } + return "" +} + +// GetKMSKeyARN returns the value of the 'KMS_key_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// ARN of the KMS to be used for the etcd encryption +func (o *AwsEtcdEncryption) GetKMSKeyARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.kmsKeyARN + } + return +} + +// AwsEtcdEncryptionListKind is the name of the type used to represent list of objects of +// type 'aws_etcd_encryption'. +const AwsEtcdEncryptionListKind = "AwsEtcdEncryptionList" + +// AwsEtcdEncryptionListLinkKind is the name of the type used to represent links to list +// of objects of type 'aws_etcd_encryption'. +const AwsEtcdEncryptionListLinkKind = "AwsEtcdEncryptionListLink" + +// AwsEtcdEncryptionNilKind is the name of the type used to nil lists of objects of +// type 'aws_etcd_encryption'. +const AwsEtcdEncryptionListNilKind = "AwsEtcdEncryptionListNil" + +// AwsEtcdEncryptionList is a list of values of the 'aws_etcd_encryption' type. +type AwsEtcdEncryptionList struct { + href string + link bool + items []*AwsEtcdEncryption +} + +// Len returns the length of the list. +func (l *AwsEtcdEncryptionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AwsEtcdEncryptionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AwsEtcdEncryptionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AwsEtcdEncryptionList) SetItems(items []*AwsEtcdEncryption) { + l.items = items +} + +// Items returns the items of the list. +func (l *AwsEtcdEncryptionList) Items() []*AwsEtcdEncryption { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AwsEtcdEncryptionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AwsEtcdEncryptionList) Get(i int) *AwsEtcdEncryption { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AwsEtcdEncryptionList) Slice() []*AwsEtcdEncryption { + var slice []*AwsEtcdEncryption + if l == nil { + slice = make([]*AwsEtcdEncryption, 0) + } else { + slice = make([]*AwsEtcdEncryption, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AwsEtcdEncryptionList) Each(f func(item *AwsEtcdEncryption) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AwsEtcdEncryptionList) Range(f func(index int, item *AwsEtcdEncryption) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/aws_etcd_encryption_type_json.go b/clientapi/clustersmgmt/v1/aws_etcd_encryption_type_json.go new file mode 100644 index 00000000..0822938f --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_etcd_encryption_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAwsEtcdEncryption writes a value of the 'aws_etcd_encryption' type to the given writer. +func MarshalAwsEtcdEncryption(object *AwsEtcdEncryption, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAwsEtcdEncryption(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAwsEtcdEncryption writes a value of the 'aws_etcd_encryption' type to the given stream. +func WriteAwsEtcdEncryption(object *AwsEtcdEncryption, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kms_key_arn") + stream.WriteString(object.kmsKeyARN) + } + stream.WriteObjectEnd() +} + +// UnmarshalAwsEtcdEncryption reads a value of the 'aws_etcd_encryption' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAwsEtcdEncryption(source interface{}) (object *AwsEtcdEncryption, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAwsEtcdEncryption(iterator) + err = iterator.Error + return +} + +// ReadAwsEtcdEncryption reads a value of the 'aws_etcd_encryption' type from the given iterator. +func ReadAwsEtcdEncryption(iterator *jsoniter.Iterator) *AwsEtcdEncryption { + object := &AwsEtcdEncryption{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kms_key_arn": + value := iterator.ReadString() + object.kmsKeyARN = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/aws_flavour_builder.go b/clientapi/clustersmgmt/v1/aws_flavour_builder.go new file mode 100644 index 00000000..6d944871 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_flavour_builder.go @@ -0,0 +1,158 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSFlavourBuilder contains the data and logic needed to build 'AWS_flavour' objects. +// +// Specification for different classes of nodes inside a flavour. +type AWSFlavourBuilder struct { + bitmap_ uint32 + computeInstanceType string + infraInstanceType string + infraVolume *AWSVolumeBuilder + masterInstanceType string + masterVolume *AWSVolumeBuilder + workerVolume *AWSVolumeBuilder +} + +// NewAWSFlavour creates a new builder of 'AWS_flavour' objects. +func NewAWSFlavour() *AWSFlavourBuilder { + return &AWSFlavourBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSFlavourBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ComputeInstanceType sets the value of the 'compute_instance_type' attribute to the given value. +func (b *AWSFlavourBuilder) ComputeInstanceType(value string) *AWSFlavourBuilder { + b.computeInstanceType = value + b.bitmap_ |= 1 + return b +} + +// InfraInstanceType sets the value of the 'infra_instance_type' attribute to the given value. +func (b *AWSFlavourBuilder) InfraInstanceType(value string) *AWSFlavourBuilder { + b.infraInstanceType = value + b.bitmap_ |= 2 + return b +} + +// InfraVolume sets the value of the 'infra_volume' attribute to the given value. +// +// Holds settings for an AWS storage volume. +func (b *AWSFlavourBuilder) InfraVolume(value *AWSVolumeBuilder) *AWSFlavourBuilder { + b.infraVolume = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// MasterInstanceType sets the value of the 'master_instance_type' attribute to the given value. +func (b *AWSFlavourBuilder) MasterInstanceType(value string) *AWSFlavourBuilder { + b.masterInstanceType = value + b.bitmap_ |= 8 + return b +} + +// MasterVolume sets the value of the 'master_volume' attribute to the given value. +// +// Holds settings for an AWS storage volume. +func (b *AWSFlavourBuilder) MasterVolume(value *AWSVolumeBuilder) *AWSFlavourBuilder { + b.masterVolume = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// WorkerVolume sets the value of the 'worker_volume' attribute to the given value. +// +// Holds settings for an AWS storage volume. +func (b *AWSFlavourBuilder) WorkerVolume(value *AWSVolumeBuilder) *AWSFlavourBuilder { + b.workerVolume = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSFlavourBuilder) Copy(object *AWSFlavour) *AWSFlavourBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.computeInstanceType = object.computeInstanceType + b.infraInstanceType = object.infraInstanceType + if object.infraVolume != nil { + b.infraVolume = NewAWSVolume().Copy(object.infraVolume) + } else { + b.infraVolume = nil + } + b.masterInstanceType = object.masterInstanceType + if object.masterVolume != nil { + b.masterVolume = NewAWSVolume().Copy(object.masterVolume) + } else { + b.masterVolume = nil + } + if object.workerVolume != nil { + b.workerVolume = NewAWSVolume().Copy(object.workerVolume) + } else { + b.workerVolume = nil + } + return b +} + +// Build creates a 'AWS_flavour' object using the configuration stored in the builder. +func (b *AWSFlavourBuilder) Build() (object *AWSFlavour, err error) { + object = new(AWSFlavour) + object.bitmap_ = b.bitmap_ + object.computeInstanceType = b.computeInstanceType + object.infraInstanceType = b.infraInstanceType + if b.infraVolume != nil { + object.infraVolume, err = b.infraVolume.Build() + if err != nil { + return + } + } + object.masterInstanceType = b.masterInstanceType + if b.masterVolume != nil { + object.masterVolume, err = b.masterVolume.Build() + if err != nil { + return + } + } + if b.workerVolume != nil { + object.workerVolume, err = b.workerVolume.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/aws_flavour_list_builder.go b/clientapi/clustersmgmt/v1/aws_flavour_list_builder.go new file mode 100644 index 00000000..da1a142b --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_flavour_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSFlavourListBuilder contains the data and logic needed to build +// 'AWS_flavour' objects. +type AWSFlavourListBuilder struct { + items []*AWSFlavourBuilder +} + +// NewAWSFlavourList creates a new builder of 'AWS_flavour' objects. +func NewAWSFlavourList() *AWSFlavourListBuilder { + return new(AWSFlavourListBuilder) +} + +// Items sets the items of the list. +func (b *AWSFlavourListBuilder) Items(values ...*AWSFlavourBuilder) *AWSFlavourListBuilder { + b.items = make([]*AWSFlavourBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSFlavourListBuilder) 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 *AWSFlavourListBuilder) Copy(list *AWSFlavourList) *AWSFlavourListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSFlavourBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSFlavour().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS_flavour' objects using the +// configuration stored in the builder. +func (b *AWSFlavourListBuilder) Build() (list *AWSFlavourList, err error) { + items := make([]*AWSFlavour, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSFlavourList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/aws_flavour_list_type_json.go b/clientapi/clustersmgmt/v1/aws_flavour_list_type_json.go new file mode 100644 index 00000000..0cea2be0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_flavour_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSFlavourList writes a list of values of the 'AWS_flavour' type to +// the given writer. +func MarshalAWSFlavourList(list []*AWSFlavour, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSFlavourList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSFlavourList writes a list of value of the 'AWS_flavour' type to +// the given stream. +func WriteAWSFlavourList(list []*AWSFlavour, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSFlavour(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSFlavourList reads a list of values of the 'AWS_flavour' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSFlavourList(source interface{}) (items []*AWSFlavour, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSFlavourList(iterator) + err = iterator.Error + return +} + +// ReadAWSFlavourList reads list of values of the ”AWS_flavour' type from +// the given iterator. +func ReadAWSFlavourList(iterator *jsoniter.Iterator) []*AWSFlavour { + list := []*AWSFlavour{} + for iterator.ReadArray() { + item := ReadAWSFlavour(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/aws_flavour_type.go b/clientapi/clustersmgmt/v1/aws_flavour_type.go new file mode 100644 index 00000000..2176495c --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_flavour_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSFlavour represents the values of the 'AWS_flavour' type. +// +// Specification for different classes of nodes inside a flavour. +type AWSFlavour struct { + bitmap_ uint32 + computeInstanceType string + infraInstanceType string + infraVolume *AWSVolume + masterInstanceType string + masterVolume *AWSVolume + workerVolume *AWSVolume +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSFlavour) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ComputeInstanceType returns the value of the 'compute_instance_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS default instance type for the worker volume. +// +// User can be overridden specifying in the cluster itself a type for compute node. +func (o *AWSFlavour) ComputeInstanceType() string { + if o != nil && o.bitmap_&1 != 0 { + return o.computeInstanceType + } + return "" +} + +// GetComputeInstanceType returns the value of the 'compute_instance_type' attribute and +// a flag indicating if the attribute has a value. +// +// AWS default instance type for the worker volume. +// +// User can be overridden specifying in the cluster itself a type for compute node. +func (o *AWSFlavour) GetComputeInstanceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.computeInstanceType + } + return +} + +// InfraInstanceType returns the value of the 'infra_instance_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS default instance type for the infra volume. +func (o *AWSFlavour) InfraInstanceType() string { + if o != nil && o.bitmap_&2 != 0 { + return o.infraInstanceType + } + return "" +} + +// GetInfraInstanceType returns the value of the 'infra_instance_type' attribute and +// a flag indicating if the attribute has a value. +// +// AWS default instance type for the infra volume. +func (o *AWSFlavour) GetInfraInstanceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.infraInstanceType + } + return +} + +// InfraVolume returns the value of the 'infra_volume' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Infra volume specification. +func (o *AWSFlavour) InfraVolume() *AWSVolume { + if o != nil && o.bitmap_&4 != 0 { + return o.infraVolume + } + return nil +} + +// GetInfraVolume returns the value of the 'infra_volume' attribute and +// a flag indicating if the attribute has a value. +// +// Infra volume specification. +func (o *AWSFlavour) GetInfraVolume() (value *AWSVolume, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.infraVolume + } + return +} + +// MasterInstanceType returns the value of the 'master_instance_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS default instance type for the master volume. +func (o *AWSFlavour) MasterInstanceType() string { + if o != nil && o.bitmap_&8 != 0 { + return o.masterInstanceType + } + return "" +} + +// GetMasterInstanceType returns the value of the 'master_instance_type' attribute and +// a flag indicating if the attribute has a value. +// +// AWS default instance type for the master volume. +func (o *AWSFlavour) GetMasterInstanceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.masterInstanceType + } + return +} + +// MasterVolume returns the value of the 'master_volume' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Master volume specification. +func (o *AWSFlavour) MasterVolume() *AWSVolume { + if o != nil && o.bitmap_&16 != 0 { + return o.masterVolume + } + return nil +} + +// GetMasterVolume returns the value of the 'master_volume' attribute and +// a flag indicating if the attribute has a value. +// +// Master volume specification. +func (o *AWSFlavour) GetMasterVolume() (value *AWSVolume, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.masterVolume + } + return +} + +// WorkerVolume returns the value of the 'worker_volume' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Worker volume specification. +func (o *AWSFlavour) WorkerVolume() *AWSVolume { + if o != nil && o.bitmap_&32 != 0 { + return o.workerVolume + } + return nil +} + +// GetWorkerVolume returns the value of the 'worker_volume' attribute and +// a flag indicating if the attribute has a value. +// +// Worker volume specification. +func (o *AWSFlavour) GetWorkerVolume() (value *AWSVolume, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.workerVolume + } + return +} + +// AWSFlavourListKind is the name of the type used to represent list of objects of +// type 'AWS_flavour'. +const AWSFlavourListKind = "AWSFlavourList" + +// AWSFlavourListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS_flavour'. +const AWSFlavourListLinkKind = "AWSFlavourListLink" + +// AWSFlavourNilKind is the name of the type used to nil lists of objects of +// type 'AWS_flavour'. +const AWSFlavourListNilKind = "AWSFlavourListNil" + +// AWSFlavourList is a list of values of the 'AWS_flavour' type. +type AWSFlavourList struct { + href string + link bool + items []*AWSFlavour +} + +// Len returns the length of the list. +func (l *AWSFlavourList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSFlavourList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSFlavourList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSFlavourList) SetItems(items []*AWSFlavour) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSFlavourList) Items() []*AWSFlavour { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSFlavourList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSFlavourList) Get(i int) *AWSFlavour { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSFlavourList) Slice() []*AWSFlavour { + var slice []*AWSFlavour + if l == nil { + slice = make([]*AWSFlavour, 0) + } else { + slice = make([]*AWSFlavour, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSFlavourList) Each(f func(item *AWSFlavour) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSFlavourList) Range(f func(index int, item *AWSFlavour) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/aws_flavour_type_json.go b/clientapi/clustersmgmt/v1/aws_flavour_type_json.go new file mode 100644 index 00000000..c2e64e3a --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_flavour_type_json.go @@ -0,0 +1,151 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSFlavour writes a value of the 'AWS_flavour' type to the given writer. +func MarshalAWSFlavour(object *AWSFlavour, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSFlavour(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSFlavour writes a value of the 'AWS_flavour' type to the given stream. +func WriteAWSFlavour(object *AWSFlavour, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute_instance_type") + stream.WriteString(object.computeInstanceType) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("infra_instance_type") + stream.WriteString(object.infraInstanceType) + count++ + } + present_ = object.bitmap_&4 != 0 && object.infraVolume != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("infra_volume") + WriteAWSVolume(object.infraVolume, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("master_instance_type") + stream.WriteString(object.masterInstanceType) + count++ + } + present_ = object.bitmap_&16 != 0 && object.masterVolume != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("master_volume") + WriteAWSVolume(object.masterVolume, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.workerVolume != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("worker_volume") + WriteAWSVolume(object.workerVolume, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSFlavour reads a value of the 'AWS_flavour' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSFlavour(source interface{}) (object *AWSFlavour, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSFlavour(iterator) + err = iterator.Error + return +} + +// ReadAWSFlavour reads a value of the 'AWS_flavour' type from the given iterator. +func ReadAWSFlavour(iterator *jsoniter.Iterator) *AWSFlavour { + object := &AWSFlavour{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "compute_instance_type": + value := iterator.ReadString() + object.computeInstanceType = value + object.bitmap_ |= 1 + case "infra_instance_type": + value := iterator.ReadString() + object.infraInstanceType = value + object.bitmap_ |= 2 + case "infra_volume": + value := ReadAWSVolume(iterator) + object.infraVolume = value + object.bitmap_ |= 4 + case "master_instance_type": + value := iterator.ReadString() + object.masterInstanceType = value + object.bitmap_ |= 8 + case "master_volume": + value := ReadAWSVolume(iterator) + object.masterVolume = value + object.bitmap_ |= 16 + case "worker_volume": + value := ReadAWSVolume(iterator) + object.workerVolume = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_builder.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_builder.go new file mode 100644 index 00000000..8b9e6e17 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_builder.go @@ -0,0 +1,111 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSInfrastructureAccessRoleBuilder contains the data and logic needed to build 'AWS_infrastructure_access_role' objects. +// +// A set of acces permissions for AWS resources +type AWSInfrastructureAccessRoleBuilder struct { + bitmap_ uint32 + id string + href string + description string + displayName string + state AWSInfrastructureAccessRoleState +} + +// NewAWSInfrastructureAccessRole creates a new builder of 'AWS_infrastructure_access_role' objects. +func NewAWSInfrastructureAccessRole() *AWSInfrastructureAccessRoleBuilder { + return &AWSInfrastructureAccessRoleBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AWSInfrastructureAccessRoleBuilder) Link(value bool) *AWSInfrastructureAccessRoleBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AWSInfrastructureAccessRoleBuilder) ID(value string) *AWSInfrastructureAccessRoleBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AWSInfrastructureAccessRoleBuilder) HREF(value string) *AWSInfrastructureAccessRoleBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSInfrastructureAccessRoleBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *AWSInfrastructureAccessRoleBuilder) Description(value string) *AWSInfrastructureAccessRoleBuilder { + b.description = value + b.bitmap_ |= 8 + return b +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *AWSInfrastructureAccessRoleBuilder) DisplayName(value string) *AWSInfrastructureAccessRoleBuilder { + b.displayName = value + b.bitmap_ |= 16 + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// State of an AWS infrastructure access role. +func (b *AWSInfrastructureAccessRoleBuilder) State(value AWSInfrastructureAccessRoleState) *AWSInfrastructureAccessRoleBuilder { + b.state = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSInfrastructureAccessRoleBuilder) Copy(object *AWSInfrastructureAccessRole) *AWSInfrastructureAccessRoleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.description = object.description + b.displayName = object.displayName + b.state = object.state + return b +} + +// Build creates a 'AWS_infrastructure_access_role' object using the configuration stored in the builder. +func (b *AWSInfrastructureAccessRoleBuilder) Build() (object *AWSInfrastructureAccessRole, err error) { + object = new(AWSInfrastructureAccessRole) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.description = b.description + object.displayName = b.displayName + object.state = b.state + return +} diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_builder.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_builder.go new file mode 100644 index 00000000..47be3666 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_builder.go @@ -0,0 +1,146 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSInfrastructureAccessRoleGrantBuilder contains the data and logic needed to build 'AWS_infrastructure_access_role_grant' objects. +// +// Representation of an AWS infrastructure access role grant. +type AWSInfrastructureAccessRoleGrantBuilder struct { + bitmap_ uint32 + id string + href string + consoleURL string + role *AWSInfrastructureAccessRoleBuilder + state AWSInfrastructureAccessRoleGrantState + stateDescription string + userARN string +} + +// NewAWSInfrastructureAccessRoleGrant creates a new builder of 'AWS_infrastructure_access_role_grant' objects. +func NewAWSInfrastructureAccessRoleGrant() *AWSInfrastructureAccessRoleGrantBuilder { + return &AWSInfrastructureAccessRoleGrantBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AWSInfrastructureAccessRoleGrantBuilder) Link(value bool) *AWSInfrastructureAccessRoleGrantBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AWSInfrastructureAccessRoleGrantBuilder) ID(value string) *AWSInfrastructureAccessRoleGrantBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AWSInfrastructureAccessRoleGrantBuilder) HREF(value string) *AWSInfrastructureAccessRoleGrantBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSInfrastructureAccessRoleGrantBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// ConsoleURL sets the value of the 'console_URL' attribute to the given value. +func (b *AWSInfrastructureAccessRoleGrantBuilder) ConsoleURL(value string) *AWSInfrastructureAccessRoleGrantBuilder { + b.consoleURL = value + b.bitmap_ |= 8 + return b +} + +// Role sets the value of the 'role' attribute to the given value. +// +// A set of acces permissions for AWS resources +func (b *AWSInfrastructureAccessRoleGrantBuilder) Role(value *AWSInfrastructureAccessRoleBuilder) *AWSInfrastructureAccessRoleGrantBuilder { + b.role = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// State of an AWS infrastructure access role grant. +func (b *AWSInfrastructureAccessRoleGrantBuilder) State(value AWSInfrastructureAccessRoleGrantState) *AWSInfrastructureAccessRoleGrantBuilder { + b.state = value + b.bitmap_ |= 32 + return b +} + +// StateDescription sets the value of the 'state_description' attribute to the given value. +func (b *AWSInfrastructureAccessRoleGrantBuilder) StateDescription(value string) *AWSInfrastructureAccessRoleGrantBuilder { + b.stateDescription = value + b.bitmap_ |= 64 + return b +} + +// UserARN sets the value of the 'user_ARN' attribute to the given value. +func (b *AWSInfrastructureAccessRoleGrantBuilder) UserARN(value string) *AWSInfrastructureAccessRoleGrantBuilder { + b.userARN = value + b.bitmap_ |= 128 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSInfrastructureAccessRoleGrantBuilder) Copy(object *AWSInfrastructureAccessRoleGrant) *AWSInfrastructureAccessRoleGrantBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.consoleURL = object.consoleURL + if object.role != nil { + b.role = NewAWSInfrastructureAccessRole().Copy(object.role) + } else { + b.role = nil + } + b.state = object.state + b.stateDescription = object.stateDescription + b.userARN = object.userARN + return b +} + +// Build creates a 'AWS_infrastructure_access_role_grant' object using the configuration stored in the builder. +func (b *AWSInfrastructureAccessRoleGrantBuilder) Build() (object *AWSInfrastructureAccessRoleGrant, err error) { + object = new(AWSInfrastructureAccessRoleGrant) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.consoleURL = b.consoleURL + if b.role != nil { + object.role, err = b.role.Build() + if err != nil { + return + } + } + object.state = b.state + object.stateDescription = b.stateDescription + object.userARN = b.userARN + return +} diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_list_builder.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_list_builder.go new file mode 100644 index 00000000..84a4819a --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSInfrastructureAccessRoleGrantListBuilder contains the data and logic needed to build +// 'AWS_infrastructure_access_role_grant' objects. +type AWSInfrastructureAccessRoleGrantListBuilder struct { + items []*AWSInfrastructureAccessRoleGrantBuilder +} + +// NewAWSInfrastructureAccessRoleGrantList creates a new builder of 'AWS_infrastructure_access_role_grant' objects. +func NewAWSInfrastructureAccessRoleGrantList() *AWSInfrastructureAccessRoleGrantListBuilder { + return new(AWSInfrastructureAccessRoleGrantListBuilder) +} + +// Items sets the items of the list. +func (b *AWSInfrastructureAccessRoleGrantListBuilder) Items(values ...*AWSInfrastructureAccessRoleGrantBuilder) *AWSInfrastructureAccessRoleGrantListBuilder { + b.items = make([]*AWSInfrastructureAccessRoleGrantBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSInfrastructureAccessRoleGrantListBuilder) 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 *AWSInfrastructureAccessRoleGrantListBuilder) Copy(list *AWSInfrastructureAccessRoleGrantList) *AWSInfrastructureAccessRoleGrantListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSInfrastructureAccessRoleGrantBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSInfrastructureAccessRoleGrant().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS_infrastructure_access_role_grant' objects using the +// configuration stored in the builder. +func (b *AWSInfrastructureAccessRoleGrantListBuilder) Build() (list *AWSInfrastructureAccessRoleGrantList, err error) { + items := make([]*AWSInfrastructureAccessRoleGrant, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSInfrastructureAccessRoleGrantList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_list_type_json.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_list_type_json.go new file mode 100644 index 00000000..c494ac34 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSInfrastructureAccessRoleGrantList writes a list of values of the 'AWS_infrastructure_access_role_grant' type to +// the given writer. +func MarshalAWSInfrastructureAccessRoleGrantList(list []*AWSInfrastructureAccessRoleGrant, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSInfrastructureAccessRoleGrantList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSInfrastructureAccessRoleGrantList writes a list of value of the 'AWS_infrastructure_access_role_grant' type to +// the given stream. +func WriteAWSInfrastructureAccessRoleGrantList(list []*AWSInfrastructureAccessRoleGrant, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSInfrastructureAccessRoleGrant(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSInfrastructureAccessRoleGrantList reads a list of values of the 'AWS_infrastructure_access_role_grant' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSInfrastructureAccessRoleGrantList(source interface{}) (items []*AWSInfrastructureAccessRoleGrant, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSInfrastructureAccessRoleGrantList(iterator) + err = iterator.Error + return +} + +// ReadAWSInfrastructureAccessRoleGrantList reads list of values of the ”AWS_infrastructure_access_role_grant' type from +// the given iterator. +func ReadAWSInfrastructureAccessRoleGrantList(iterator *jsoniter.Iterator) []*AWSInfrastructureAccessRoleGrant { + list := []*AWSInfrastructureAccessRoleGrant{} + for iterator.ReadArray() { + item := ReadAWSInfrastructureAccessRoleGrant(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_state_list_type_json.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_state_list_type_json.go new file mode 100644 index 00000000..eaa74c73 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_state_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSInfrastructureAccessRoleGrantStateList writes a list of values of the 'AWS_infrastructure_access_role_grant_state' type to +// the given writer. +func MarshalAWSInfrastructureAccessRoleGrantStateList(list []AWSInfrastructureAccessRoleGrantState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSInfrastructureAccessRoleGrantStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSInfrastructureAccessRoleGrantStateList writes a list of value of the 'AWS_infrastructure_access_role_grant_state' type to +// the given stream. +func WriteAWSInfrastructureAccessRoleGrantStateList(list []AWSInfrastructureAccessRoleGrantState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSInfrastructureAccessRoleGrantStateList reads a list of values of the 'AWS_infrastructure_access_role_grant_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSInfrastructureAccessRoleGrantStateList(source interface{}) (items []AWSInfrastructureAccessRoleGrantState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSInfrastructureAccessRoleGrantStateList(iterator) + err = iterator.Error + return +} + +// ReadAWSInfrastructureAccessRoleGrantStateList reads list of values of the ”AWS_infrastructure_access_role_grant_state' type from +// the given iterator. +func ReadAWSInfrastructureAccessRoleGrantStateList(iterator *jsoniter.Iterator) []AWSInfrastructureAccessRoleGrantState { + list := []AWSInfrastructureAccessRoleGrantState{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := AWSInfrastructureAccessRoleGrantState(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_state_type.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_state_type.go new file mode 100644 index 00000000..17109214 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_state_type.go @@ -0,0 +1,38 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSInfrastructureAccessRoleGrantState represents the values of the 'AWS_infrastructure_access_role_grant_state' enumerated type. +type AWSInfrastructureAccessRoleGrantState string + +const ( + // The access role grant is in the process of being deleted. + AWSInfrastructureAccessRoleGrantStateDeleting AWSInfrastructureAccessRoleGrantState = "deleting" + // The attempt to grant access role to user ARN failed. + AWSInfrastructureAccessRoleGrantStateFailed AWSInfrastructureAccessRoleGrantState = "failed" + // The access role grant in pending. + AWSInfrastructureAccessRoleGrantStatePending AWSInfrastructureAccessRoleGrantState = "pending" + // Access role has been granted to user. + AWSInfrastructureAccessRoleGrantStateReady AWSInfrastructureAccessRoleGrantState = "ready" + // This ia a special state intended for the user know + // that the access role grant has been removed by SRE. + // The user can delete this grant from the DB. + AWSInfrastructureAccessRoleGrantStateRemoved AWSInfrastructureAccessRoleGrantState = "removed" +) diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_type.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_type.go new file mode 100644 index 00000000..d4a59ffe --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_type.go @@ -0,0 +1,365 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSInfrastructureAccessRoleGrantKind is the name of the type used to represent objects +// of type 'AWS_infrastructure_access_role_grant'. +const AWSInfrastructureAccessRoleGrantKind = "AWSInfrastructureAccessRoleGrant" + +// AWSInfrastructureAccessRoleGrantLinkKind is the name of the type used to represent links +// to objects of type 'AWS_infrastructure_access_role_grant'. +const AWSInfrastructureAccessRoleGrantLinkKind = "AWSInfrastructureAccessRoleGrantLink" + +// AWSInfrastructureAccessRoleGrantNilKind is the name of the type used to nil references +// to objects of type 'AWS_infrastructure_access_role_grant'. +const AWSInfrastructureAccessRoleGrantNilKind = "AWSInfrastructureAccessRoleGrantNil" + +// AWSInfrastructureAccessRoleGrant represents the values of the 'AWS_infrastructure_access_role_grant' type. +// +// Representation of an AWS infrastructure access role grant. +type AWSInfrastructureAccessRoleGrant struct { + bitmap_ uint32 + id string + href string + consoleURL string + role *AWSInfrastructureAccessRole + state AWSInfrastructureAccessRoleGrantState + stateDescription string + userARN string +} + +// Kind returns the name of the type of the object. +func (o *AWSInfrastructureAccessRoleGrant) Kind() string { + if o == nil { + return AWSInfrastructureAccessRoleGrantNilKind + } + if o.bitmap_&1 != 0 { + return AWSInfrastructureAccessRoleGrantLinkKind + } + return AWSInfrastructureAccessRoleGrantKind +} + +// Link returns true if this is a link. +func (o *AWSInfrastructureAccessRoleGrant) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AWSInfrastructureAccessRoleGrant) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AWSInfrastructureAccessRoleGrant) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AWSInfrastructureAccessRoleGrant) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AWSInfrastructureAccessRoleGrant) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSInfrastructureAccessRoleGrant) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// ConsoleURL returns the value of the 'console_URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// URL to switch to the role in AWS console. +func (o *AWSInfrastructureAccessRoleGrant) ConsoleURL() string { + if o != nil && o.bitmap_&8 != 0 { + return o.consoleURL + } + return "" +} + +// GetConsoleURL returns the value of the 'console_URL' attribute and +// a flag indicating if the attribute has a value. +// +// URL to switch to the role in AWS console. +func (o *AWSInfrastructureAccessRoleGrant) GetConsoleURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.consoleURL + } + return +} + +// Role returns the value of the 'role' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to AWS infrastructure access role. +// Grant must use a 'valid' role. +func (o *AWSInfrastructureAccessRoleGrant) Role() *AWSInfrastructureAccessRole { + if o != nil && o.bitmap_&16 != 0 { + return o.role + } + return nil +} + +// GetRole returns the value of the 'role' attribute and +// a flag indicating if the attribute has a value. +// +// Link to AWS infrastructure access role. +// Grant must use a 'valid' role. +func (o *AWSInfrastructureAccessRoleGrant) GetRole() (value *AWSInfrastructureAccessRole, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.role + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// State of the grant. +func (o *AWSInfrastructureAccessRoleGrant) State() AWSInfrastructureAccessRoleGrantState { + if o != nil && o.bitmap_&32 != 0 { + return o.state + } + return AWSInfrastructureAccessRoleGrantState("") +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// State of the grant. +func (o *AWSInfrastructureAccessRoleGrant) GetState() (value AWSInfrastructureAccessRoleGrantState, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.state + } + return +} + +// StateDescription returns the value of the 'state_description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Description of the state. +// Will be empty unless state is 'Failed'. +func (o *AWSInfrastructureAccessRoleGrant) StateDescription() string { + if o != nil && o.bitmap_&64 != 0 { + return o.stateDescription + } + return "" +} + +// GetStateDescription returns the value of the 'state_description' attribute and +// a flag indicating if the attribute has a value. +// +// Description of the state. +// Will be empty unless state is 'Failed'. +func (o *AWSInfrastructureAccessRoleGrant) GetStateDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.stateDescription + } + return +} + +// UserARN returns the value of the 'user_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The user AWS IAM ARN we want to grant the role. +func (o *AWSInfrastructureAccessRoleGrant) UserARN() string { + if o != nil && o.bitmap_&128 != 0 { + return o.userARN + } + return "" +} + +// GetUserARN returns the value of the 'user_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// The user AWS IAM ARN we want to grant the role. +func (o *AWSInfrastructureAccessRoleGrant) GetUserARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.userARN + } + return +} + +// AWSInfrastructureAccessRoleGrantListKind is the name of the type used to represent list of objects of +// type 'AWS_infrastructure_access_role_grant'. +const AWSInfrastructureAccessRoleGrantListKind = "AWSInfrastructureAccessRoleGrantList" + +// AWSInfrastructureAccessRoleGrantListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS_infrastructure_access_role_grant'. +const AWSInfrastructureAccessRoleGrantListLinkKind = "AWSInfrastructureAccessRoleGrantListLink" + +// AWSInfrastructureAccessRoleGrantNilKind is the name of the type used to nil lists of objects of +// type 'AWS_infrastructure_access_role_grant'. +const AWSInfrastructureAccessRoleGrantListNilKind = "AWSInfrastructureAccessRoleGrantListNil" + +// AWSInfrastructureAccessRoleGrantList is a list of values of the 'AWS_infrastructure_access_role_grant' type. +type AWSInfrastructureAccessRoleGrantList struct { + href string + link bool + items []*AWSInfrastructureAccessRoleGrant +} + +// Kind returns the name of the type of the object. +func (l *AWSInfrastructureAccessRoleGrantList) Kind() string { + if l == nil { + return AWSInfrastructureAccessRoleGrantListNilKind + } + if l.link { + return AWSInfrastructureAccessRoleGrantListLinkKind + } + return AWSInfrastructureAccessRoleGrantListKind +} + +// Link returns true iif this is a link. +func (l *AWSInfrastructureAccessRoleGrantList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AWSInfrastructureAccessRoleGrantList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AWSInfrastructureAccessRoleGrantList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AWSInfrastructureAccessRoleGrantList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSInfrastructureAccessRoleGrantList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSInfrastructureAccessRoleGrantList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSInfrastructureAccessRoleGrantList) SetItems(items []*AWSInfrastructureAccessRoleGrant) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSInfrastructureAccessRoleGrantList) Items() []*AWSInfrastructureAccessRoleGrant { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSInfrastructureAccessRoleGrantList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSInfrastructureAccessRoleGrantList) Get(i int) *AWSInfrastructureAccessRoleGrant { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSInfrastructureAccessRoleGrantList) Slice() []*AWSInfrastructureAccessRoleGrant { + var slice []*AWSInfrastructureAccessRoleGrant + if l == nil { + slice = make([]*AWSInfrastructureAccessRoleGrant, 0) + } else { + slice = make([]*AWSInfrastructureAccessRoleGrant, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSInfrastructureAccessRoleGrantList) Each(f func(item *AWSInfrastructureAccessRoleGrant) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSInfrastructureAccessRoleGrantList) Range(f func(index int, item *AWSInfrastructureAccessRoleGrant) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_type_json.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_type_json.go new file mode 100644 index 00000000..3c693270 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_grant_type_json.go @@ -0,0 +1,173 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSInfrastructureAccessRoleGrant writes a value of the 'AWS_infrastructure_access_role_grant' type to the given writer. +func MarshalAWSInfrastructureAccessRoleGrant(object *AWSInfrastructureAccessRoleGrant, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSInfrastructureAccessRoleGrant(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSInfrastructureAccessRoleGrant writes a value of the 'AWS_infrastructure_access_role_grant' type to the given stream. +func WriteAWSInfrastructureAccessRoleGrant(object *AWSInfrastructureAccessRoleGrant, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AWSInfrastructureAccessRoleGrantLinkKind) + } else { + stream.WriteString(AWSInfrastructureAccessRoleGrantKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("console_url") + stream.WriteString(object.consoleURL) + count++ + } + present_ = object.bitmap_&16 != 0 && object.role != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role") + WriteAWSInfrastructureAccessRole(object.role, stream) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(string(object.state)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state_description") + stream.WriteString(object.stateDescription) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("user_arn") + stream.WriteString(object.userARN) + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSInfrastructureAccessRoleGrant reads a value of the 'AWS_infrastructure_access_role_grant' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSInfrastructureAccessRoleGrant(source interface{}) (object *AWSInfrastructureAccessRoleGrant, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSInfrastructureAccessRoleGrant(iterator) + err = iterator.Error + return +} + +// ReadAWSInfrastructureAccessRoleGrant reads a value of the 'AWS_infrastructure_access_role_grant' type from the given iterator. +func ReadAWSInfrastructureAccessRoleGrant(iterator *jsoniter.Iterator) *AWSInfrastructureAccessRoleGrant { + object := &AWSInfrastructureAccessRoleGrant{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AWSInfrastructureAccessRoleGrantLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "console_url": + value := iterator.ReadString() + object.consoleURL = value + object.bitmap_ |= 8 + case "role": + value := ReadAWSInfrastructureAccessRole(iterator) + object.role = value + object.bitmap_ |= 16 + case "state": + text := iterator.ReadString() + value := AWSInfrastructureAccessRoleGrantState(text) + object.state = value + object.bitmap_ |= 32 + case "state_description": + value := iterator.ReadString() + object.stateDescription = value + object.bitmap_ |= 64 + case "user_arn": + value := iterator.ReadString() + object.userARN = value + object.bitmap_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_list_builder.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_list_builder.go new file mode 100644 index 00000000..e0ae169f --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSInfrastructureAccessRoleListBuilder contains the data and logic needed to build +// 'AWS_infrastructure_access_role' objects. +type AWSInfrastructureAccessRoleListBuilder struct { + items []*AWSInfrastructureAccessRoleBuilder +} + +// NewAWSInfrastructureAccessRoleList creates a new builder of 'AWS_infrastructure_access_role' objects. +func NewAWSInfrastructureAccessRoleList() *AWSInfrastructureAccessRoleListBuilder { + return new(AWSInfrastructureAccessRoleListBuilder) +} + +// Items sets the items of the list. +func (b *AWSInfrastructureAccessRoleListBuilder) Items(values ...*AWSInfrastructureAccessRoleBuilder) *AWSInfrastructureAccessRoleListBuilder { + b.items = make([]*AWSInfrastructureAccessRoleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSInfrastructureAccessRoleListBuilder) 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 *AWSInfrastructureAccessRoleListBuilder) Copy(list *AWSInfrastructureAccessRoleList) *AWSInfrastructureAccessRoleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSInfrastructureAccessRoleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSInfrastructureAccessRole().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS_infrastructure_access_role' objects using the +// configuration stored in the builder. +func (b *AWSInfrastructureAccessRoleListBuilder) Build() (list *AWSInfrastructureAccessRoleList, err error) { + items := make([]*AWSInfrastructureAccessRole, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSInfrastructureAccessRoleList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_list_type_json.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_list_type_json.go new file mode 100644 index 00000000..1a6af75e --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSInfrastructureAccessRoleList writes a list of values of the 'AWS_infrastructure_access_role' type to +// the given writer. +func MarshalAWSInfrastructureAccessRoleList(list []*AWSInfrastructureAccessRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSInfrastructureAccessRoleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSInfrastructureAccessRoleList writes a list of value of the 'AWS_infrastructure_access_role' type to +// the given stream. +func WriteAWSInfrastructureAccessRoleList(list []*AWSInfrastructureAccessRole, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSInfrastructureAccessRole(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSInfrastructureAccessRoleList reads a list of values of the 'AWS_infrastructure_access_role' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSInfrastructureAccessRoleList(source interface{}) (items []*AWSInfrastructureAccessRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSInfrastructureAccessRoleList(iterator) + err = iterator.Error + return +} + +// ReadAWSInfrastructureAccessRoleList reads list of values of the ”AWS_infrastructure_access_role' type from +// the given iterator. +func ReadAWSInfrastructureAccessRoleList(iterator *jsoniter.Iterator) []*AWSInfrastructureAccessRole { + list := []*AWSInfrastructureAccessRole{} + for iterator.ReadArray() { + item := ReadAWSInfrastructureAccessRole(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_state_list_type_json.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_state_list_type_json.go new file mode 100644 index 00000000..8d43276e --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_state_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSInfrastructureAccessRoleStateList writes a list of values of the 'AWS_infrastructure_access_role_state' type to +// the given writer. +func MarshalAWSInfrastructureAccessRoleStateList(list []AWSInfrastructureAccessRoleState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSInfrastructureAccessRoleStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSInfrastructureAccessRoleStateList writes a list of value of the 'AWS_infrastructure_access_role_state' type to +// the given stream. +func WriteAWSInfrastructureAccessRoleStateList(list []AWSInfrastructureAccessRoleState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSInfrastructureAccessRoleStateList reads a list of values of the 'AWS_infrastructure_access_role_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSInfrastructureAccessRoleStateList(source interface{}) (items []AWSInfrastructureAccessRoleState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSInfrastructureAccessRoleStateList(iterator) + err = iterator.Error + return +} + +// ReadAWSInfrastructureAccessRoleStateList reads list of values of the ”AWS_infrastructure_access_role_state' type from +// the given iterator. +func ReadAWSInfrastructureAccessRoleStateList(iterator *jsoniter.Iterator) []AWSInfrastructureAccessRoleState { + list := []AWSInfrastructureAccessRoleState{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := AWSInfrastructureAccessRoleState(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_state_type.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_state_type.go new file mode 100644 index 00000000..7ddc3826 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_state_type.go @@ -0,0 +1,36 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSInfrastructureAccessRoleState represents the values of the 'AWS_infrastructure_access_role_state' enumerated type. +type AWSInfrastructureAccessRoleState string + +const ( + // Role definition is invalid. Role can't be used. + AWSInfrastructureAccessRoleStateInvalid AWSInfrastructureAccessRoleState = "invalid" + // This is a special state intended for the user know + // that the access role has been removed by SRE, + // but there are still grants referencing it. + // Role can't be used in a new grant. + AWSInfrastructureAccessRoleStateRemoved AWSInfrastructureAccessRoleState = "removed" + // Access role is valid an can be used. + // Only valid roles can be used in a role grant. + AWSInfrastructureAccessRoleStateValid AWSInfrastructureAccessRoleState = "valid" +) diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_type.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_type.go new file mode 100644 index 00000000..40d7cc82 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_type.go @@ -0,0 +1,313 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSInfrastructureAccessRoleKind is the name of the type used to represent objects +// of type 'AWS_infrastructure_access_role'. +const AWSInfrastructureAccessRoleKind = "AWSInfrastructureAccessRole" + +// AWSInfrastructureAccessRoleLinkKind is the name of the type used to represent links +// to objects of type 'AWS_infrastructure_access_role'. +const AWSInfrastructureAccessRoleLinkKind = "AWSInfrastructureAccessRoleLink" + +// AWSInfrastructureAccessRoleNilKind is the name of the type used to nil references +// to objects of type 'AWS_infrastructure_access_role'. +const AWSInfrastructureAccessRoleNilKind = "AWSInfrastructureAccessRoleNil" + +// AWSInfrastructureAccessRole represents the values of the 'AWS_infrastructure_access_role' type. +// +// A set of acces permissions for AWS resources +type AWSInfrastructureAccessRole struct { + bitmap_ uint32 + id string + href string + description string + displayName string + state AWSInfrastructureAccessRoleState +} + +// Kind returns the name of the type of the object. +func (o *AWSInfrastructureAccessRole) Kind() string { + if o == nil { + return AWSInfrastructureAccessRoleNilKind + } + if o.bitmap_&1 != 0 { + return AWSInfrastructureAccessRoleLinkKind + } + return AWSInfrastructureAccessRoleKind +} + +// Link returns true if this is a link. +func (o *AWSInfrastructureAccessRole) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AWSInfrastructureAccessRole) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AWSInfrastructureAccessRole) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AWSInfrastructureAccessRole) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AWSInfrastructureAccessRole) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSInfrastructureAccessRole) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Description of the role. +func (o *AWSInfrastructureAccessRole) Description() string { + if o != nil && o.bitmap_&8 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Description of the role. +func (o *AWSInfrastructureAccessRole) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.description + } + return +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Human friendly identifier of the role, for example `Read only`. +func (o *AWSInfrastructureAccessRole) DisplayName() string { + if o != nil && o.bitmap_&16 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +// +// Human friendly identifier of the role, for example `Read only`. +func (o *AWSInfrastructureAccessRole) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.displayName + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// State of the role. +func (o *AWSInfrastructureAccessRole) State() AWSInfrastructureAccessRoleState { + if o != nil && o.bitmap_&32 != 0 { + return o.state + } + return AWSInfrastructureAccessRoleState("") +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// State of the role. +func (o *AWSInfrastructureAccessRole) GetState() (value AWSInfrastructureAccessRoleState, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.state + } + return +} + +// AWSInfrastructureAccessRoleListKind is the name of the type used to represent list of objects of +// type 'AWS_infrastructure_access_role'. +const AWSInfrastructureAccessRoleListKind = "AWSInfrastructureAccessRoleList" + +// AWSInfrastructureAccessRoleListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS_infrastructure_access_role'. +const AWSInfrastructureAccessRoleListLinkKind = "AWSInfrastructureAccessRoleListLink" + +// AWSInfrastructureAccessRoleNilKind is the name of the type used to nil lists of objects of +// type 'AWS_infrastructure_access_role'. +const AWSInfrastructureAccessRoleListNilKind = "AWSInfrastructureAccessRoleListNil" + +// AWSInfrastructureAccessRoleList is a list of values of the 'AWS_infrastructure_access_role' type. +type AWSInfrastructureAccessRoleList struct { + href string + link bool + items []*AWSInfrastructureAccessRole +} + +// Kind returns the name of the type of the object. +func (l *AWSInfrastructureAccessRoleList) Kind() string { + if l == nil { + return AWSInfrastructureAccessRoleListNilKind + } + if l.link { + return AWSInfrastructureAccessRoleListLinkKind + } + return AWSInfrastructureAccessRoleListKind +} + +// Link returns true iif this is a link. +func (l *AWSInfrastructureAccessRoleList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AWSInfrastructureAccessRoleList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AWSInfrastructureAccessRoleList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AWSInfrastructureAccessRoleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSInfrastructureAccessRoleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSInfrastructureAccessRoleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSInfrastructureAccessRoleList) SetItems(items []*AWSInfrastructureAccessRole) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSInfrastructureAccessRoleList) Items() []*AWSInfrastructureAccessRole { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSInfrastructureAccessRoleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSInfrastructureAccessRoleList) Get(i int) *AWSInfrastructureAccessRole { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSInfrastructureAccessRoleList) Slice() []*AWSInfrastructureAccessRole { + var slice []*AWSInfrastructureAccessRole + if l == nil { + slice = make([]*AWSInfrastructureAccessRole, 0) + } else { + slice = make([]*AWSInfrastructureAccessRole, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSInfrastructureAccessRoleList) Each(f func(item *AWSInfrastructureAccessRole) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSInfrastructureAccessRoleList) Range(f func(index int, item *AWSInfrastructureAccessRole) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_type_json.go b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_type_json.go new file mode 100644 index 00000000..b04c52aa --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_infrastructure_access_role_type_json.go @@ -0,0 +1,147 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSInfrastructureAccessRole writes a value of the 'AWS_infrastructure_access_role' type to the given writer. +func MarshalAWSInfrastructureAccessRole(object *AWSInfrastructureAccessRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSInfrastructureAccessRole(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSInfrastructureAccessRole writes a value of the 'AWS_infrastructure_access_role' type to the given stream. +func WriteAWSInfrastructureAccessRole(object *AWSInfrastructureAccessRole, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AWSInfrastructureAccessRoleLinkKind) + } else { + stream.WriteString(AWSInfrastructureAccessRoleKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(string(object.state)) + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSInfrastructureAccessRole reads a value of the 'AWS_infrastructure_access_role' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSInfrastructureAccessRole(source interface{}) (object *AWSInfrastructureAccessRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSInfrastructureAccessRole(iterator) + err = iterator.Error + return +} + +// ReadAWSInfrastructureAccessRole reads a value of the 'AWS_infrastructure_access_role' type from the given iterator. +func ReadAWSInfrastructureAccessRole(iterator *jsoniter.Iterator) *AWSInfrastructureAccessRole { + object := &AWSInfrastructureAccessRole{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AWSInfrastructureAccessRoleLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 8 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 16 + case "state": + text := iterator.ReadString() + value := AWSInfrastructureAccessRoleState(text) + object.state = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/aws_list_builder.go b/clientapi/clustersmgmt/v1/aws_list_builder.go new file mode 100644 index 00000000..e9ada12e --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSListBuilder contains the data and logic needed to build +// 'AWS' objects. +type AWSListBuilder struct { + items []*AWSBuilder +} + +// NewAWSList creates a new builder of 'AWS' objects. +func NewAWSList() *AWSListBuilder { + return new(AWSListBuilder) +} + +// Items sets the items of the list. +func (b *AWSListBuilder) Items(values ...*AWSBuilder) *AWSListBuilder { + b.items = make([]*AWSBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSListBuilder) 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 *AWSListBuilder) Copy(list *AWSList) *AWSListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWS().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS' objects using the +// configuration stored in the builder. +func (b *AWSListBuilder) Build() (list *AWSList, err error) { + items := make([]*AWS, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/aws_list_type_json.go b/clientapi/clustersmgmt/v1/aws_list_type_json.go new file mode 100644 index 00000000..44c1af06 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSList writes a list of values of the 'AWS' type to +// the given writer. +func MarshalAWSList(list []*AWS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSList writes a list of value of the 'AWS' type to +// the given stream. +func WriteAWSList(list []*AWS, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWS(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSList reads a list of values of the 'AWS' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSList(source interface{}) (items []*AWS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSList(iterator) + err = iterator.Error + return +} + +// ReadAWSList reads list of values of the ”AWS' type from +// the given iterator. +func ReadAWSList(iterator *jsoniter.Iterator) []*AWS { + list := []*AWS{} + for iterator.ReadArray() { + item := ReadAWS(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/aws_machine_pool_builder.go b/clientapi/clustersmgmt/v1/aws_machine_pool_builder.go new file mode 100644 index 00000000..d54338c0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_machine_pool_builder.go @@ -0,0 +1,201 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSMachinePoolBuilder contains the data and logic needed to build 'AWS_machine_pool' objects. +// +// Representation of aws machine pool specific parameters. +type AWSMachinePoolBuilder struct { + bitmap_ uint32 + id string + href string + additionalSecurityGroupIds []string + availabilityZoneTypes map[string]string + spotMarketOptions *AWSSpotMarketOptionsBuilder + subnetOutposts map[string]string + tags map[string]string +} + +// NewAWSMachinePool creates a new builder of 'AWS_machine_pool' objects. +func NewAWSMachinePool() *AWSMachinePoolBuilder { + return &AWSMachinePoolBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AWSMachinePoolBuilder) Link(value bool) *AWSMachinePoolBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AWSMachinePoolBuilder) ID(value string) *AWSMachinePoolBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AWSMachinePoolBuilder) HREF(value string) *AWSMachinePoolBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSMachinePoolBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AdditionalSecurityGroupIds sets the value of the 'additional_security_group_ids' attribute to the given values. +func (b *AWSMachinePoolBuilder) AdditionalSecurityGroupIds(values ...string) *AWSMachinePoolBuilder { + b.additionalSecurityGroupIds = make([]string, len(values)) + copy(b.additionalSecurityGroupIds, values) + b.bitmap_ |= 8 + return b +} + +// AvailabilityZoneTypes sets the value of the 'availability_zone_types' attribute to the given value. +func (b *AWSMachinePoolBuilder) AvailabilityZoneTypes(value map[string]string) *AWSMachinePoolBuilder { + b.availabilityZoneTypes = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// SpotMarketOptions sets the value of the 'spot_market_options' attribute to the given value. +// +// Spot market options for AWS machine pool. +func (b *AWSMachinePoolBuilder) SpotMarketOptions(value *AWSSpotMarketOptionsBuilder) *AWSMachinePoolBuilder { + b.spotMarketOptions = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// SubnetOutposts sets the value of the 'subnet_outposts' attribute to the given value. +func (b *AWSMachinePoolBuilder) SubnetOutposts(value map[string]string) *AWSMachinePoolBuilder { + b.subnetOutposts = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Tags sets the value of the 'tags' attribute to the given value. +func (b *AWSMachinePoolBuilder) Tags(value map[string]string) *AWSMachinePoolBuilder { + b.tags = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSMachinePoolBuilder) Copy(object *AWSMachinePool) *AWSMachinePoolBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.additionalSecurityGroupIds != nil { + b.additionalSecurityGroupIds = make([]string, len(object.additionalSecurityGroupIds)) + copy(b.additionalSecurityGroupIds, object.additionalSecurityGroupIds) + } else { + b.additionalSecurityGroupIds = nil + } + if len(object.availabilityZoneTypes) > 0 { + b.availabilityZoneTypes = map[string]string{} + for k, v := range object.availabilityZoneTypes { + b.availabilityZoneTypes[k] = v + } + } else { + b.availabilityZoneTypes = nil + } + if object.spotMarketOptions != nil { + b.spotMarketOptions = NewAWSSpotMarketOptions().Copy(object.spotMarketOptions) + } else { + b.spotMarketOptions = nil + } + if len(object.subnetOutposts) > 0 { + b.subnetOutposts = map[string]string{} + for k, v := range object.subnetOutposts { + b.subnetOutposts[k] = v + } + } else { + b.subnetOutposts = nil + } + if len(object.tags) > 0 { + b.tags = map[string]string{} + for k, v := range object.tags { + b.tags[k] = v + } + } else { + b.tags = nil + } + return b +} + +// Build creates a 'AWS_machine_pool' object using the configuration stored in the builder. +func (b *AWSMachinePoolBuilder) Build() (object *AWSMachinePool, err error) { + object = new(AWSMachinePool) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.additionalSecurityGroupIds != nil { + object.additionalSecurityGroupIds = make([]string, len(b.additionalSecurityGroupIds)) + copy(object.additionalSecurityGroupIds, b.additionalSecurityGroupIds) + } + if b.availabilityZoneTypes != nil { + object.availabilityZoneTypes = make(map[string]string) + for k, v := range b.availabilityZoneTypes { + object.availabilityZoneTypes[k] = v + } + } + if b.spotMarketOptions != nil { + object.spotMarketOptions, err = b.spotMarketOptions.Build() + if err != nil { + return + } + } + if b.subnetOutposts != nil { + object.subnetOutposts = make(map[string]string) + for k, v := range b.subnetOutposts { + object.subnetOutposts[k] = v + } + } + if b.tags != nil { + object.tags = make(map[string]string) + for k, v := range b.tags { + object.tags[k] = v + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/aws_machine_pool_list_builder.go b/clientapi/clustersmgmt/v1/aws_machine_pool_list_builder.go new file mode 100644 index 00000000..8d1ca814 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_machine_pool_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSMachinePoolListBuilder contains the data and logic needed to build +// 'AWS_machine_pool' objects. +type AWSMachinePoolListBuilder struct { + items []*AWSMachinePoolBuilder +} + +// NewAWSMachinePoolList creates a new builder of 'AWS_machine_pool' objects. +func NewAWSMachinePoolList() *AWSMachinePoolListBuilder { + return new(AWSMachinePoolListBuilder) +} + +// Items sets the items of the list. +func (b *AWSMachinePoolListBuilder) Items(values ...*AWSMachinePoolBuilder) *AWSMachinePoolListBuilder { + b.items = make([]*AWSMachinePoolBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSMachinePoolListBuilder) 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 *AWSMachinePoolListBuilder) Copy(list *AWSMachinePoolList) *AWSMachinePoolListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSMachinePoolBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSMachinePool().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS_machine_pool' objects using the +// configuration stored in the builder. +func (b *AWSMachinePoolListBuilder) Build() (list *AWSMachinePoolList, err error) { + items := make([]*AWSMachinePool, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSMachinePoolList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/aws_machine_pool_list_type_json.go b/clientapi/clustersmgmt/v1/aws_machine_pool_list_type_json.go new file mode 100644 index 00000000..1debe654 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_machine_pool_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSMachinePoolList writes a list of values of the 'AWS_machine_pool' type to +// the given writer. +func MarshalAWSMachinePoolList(list []*AWSMachinePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSMachinePoolList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSMachinePoolList writes a list of value of the 'AWS_machine_pool' type to +// the given stream. +func WriteAWSMachinePoolList(list []*AWSMachinePool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSMachinePool(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSMachinePoolList reads a list of values of the 'AWS_machine_pool' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSMachinePoolList(source interface{}) (items []*AWSMachinePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSMachinePoolList(iterator) + err = iterator.Error + return +} + +// ReadAWSMachinePoolList reads list of values of the ”AWS_machine_pool' type from +// the given iterator. +func ReadAWSMachinePoolList(iterator *jsoniter.Iterator) []*AWSMachinePool { + list := []*AWSMachinePool{} + for iterator.ReadArray() { + item := ReadAWSMachinePool(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/aws_machine_pool_type.go b/clientapi/clustersmgmt/v1/aws_machine_pool_type.go new file mode 100644 index 00000000..9b6c9fe1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_machine_pool_type.go @@ -0,0 +1,375 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSMachinePoolKind is the name of the type used to represent objects +// of type 'AWS_machine_pool'. +const AWSMachinePoolKind = "AWSMachinePool" + +// AWSMachinePoolLinkKind is the name of the type used to represent links +// to objects of type 'AWS_machine_pool'. +const AWSMachinePoolLinkKind = "AWSMachinePoolLink" + +// AWSMachinePoolNilKind is the name of the type used to nil references +// to objects of type 'AWS_machine_pool'. +const AWSMachinePoolNilKind = "AWSMachinePoolNil" + +// AWSMachinePool represents the values of the 'AWS_machine_pool' type. +// +// Representation of aws machine pool specific parameters. +type AWSMachinePool struct { + bitmap_ uint32 + id string + href string + additionalSecurityGroupIds []string + availabilityZoneTypes map[string]string + spotMarketOptions *AWSSpotMarketOptions + subnetOutposts map[string]string + tags map[string]string +} + +// Kind returns the name of the type of the object. +func (o *AWSMachinePool) Kind() string { + if o == nil { + return AWSMachinePoolNilKind + } + if o.bitmap_&1 != 0 { + return AWSMachinePoolLinkKind + } + return AWSMachinePoolKind +} + +// Link returns true if this is a link. +func (o *AWSMachinePool) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AWSMachinePool) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AWSMachinePool) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AWSMachinePool) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AWSMachinePool) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSMachinePool) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AdditionalSecurityGroupIds returns the value of the 'additional_security_group_ids' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional AWS Security Groups to be added machine pool. Note that machine pools can only be worker node at the time. +func (o *AWSMachinePool) AdditionalSecurityGroupIds() []string { + if o != nil && o.bitmap_&8 != 0 { + return o.additionalSecurityGroupIds + } + return nil +} + +// GetAdditionalSecurityGroupIds returns the value of the 'additional_security_group_ids' attribute and +// a flag indicating if the attribute has a value. +// +// Additional AWS Security Groups to be added machine pool. Note that machine pools can only be worker node at the time. +func (o *AWSMachinePool) GetAdditionalSecurityGroupIds() (value []string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.additionalSecurityGroupIds + } + return +} + +// AvailabilityZoneTypes returns the value of the 'availability_zone_types' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Associates nodepool availability zones with zone types (e.g. wavelength, local). +func (o *AWSMachinePool) AvailabilityZoneTypes() map[string]string { + if o != nil && o.bitmap_&16 != 0 { + return o.availabilityZoneTypes + } + return nil +} + +// GetAvailabilityZoneTypes returns the value of the 'availability_zone_types' attribute and +// a flag indicating if the attribute has a value. +// +// Associates nodepool availability zones with zone types (e.g. wavelength, local). +func (o *AWSMachinePool) GetAvailabilityZoneTypes() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.availabilityZoneTypes + } + return +} + +// SpotMarketOptions returns the value of the 'spot_market_options' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Use spot instances on this machine pool to reduce cost. +func (o *AWSMachinePool) SpotMarketOptions() *AWSSpotMarketOptions { + if o != nil && o.bitmap_&32 != 0 { + return o.spotMarketOptions + } + return nil +} + +// GetSpotMarketOptions returns the value of the 'spot_market_options' attribute and +// a flag indicating if the attribute has a value. +// +// Use spot instances on this machine pool to reduce cost. +func (o *AWSMachinePool) GetSpotMarketOptions() (value *AWSSpotMarketOptions, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.spotMarketOptions + } + return +} + +// SubnetOutposts returns the value of the 'subnet_outposts' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Associates nodepool subnets with AWS Outposts. +func (o *AWSMachinePool) SubnetOutposts() map[string]string { + if o != nil && o.bitmap_&64 != 0 { + return o.subnetOutposts + } + return nil +} + +// GetSubnetOutposts returns the value of the 'subnet_outposts' attribute and +// a flag indicating if the attribute has a value. +// +// Associates nodepool subnets with AWS Outposts. +func (o *AWSMachinePool) GetSubnetOutposts() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.subnetOutposts + } + return +} + +// Tags returns the value of the 'tags' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional keys and values that the machine pool provisioner will add as AWS tags to all AWS resources it creates. +// +// AWS tags must conform to the following standards: +// - Each resource may have a maximum of 25 tags +// - Tags beginning with "aws:" are reserved for system use and may not be set +// - Tag keys may be between 1 and 128 characters in length +// - Tag values may be between 0 and 256 characters in length +// - Tags may only contain letters, numbers, spaces, and the following characters: [_ . : / = + - @] +func (o *AWSMachinePool) Tags() map[string]string { + if o != nil && o.bitmap_&128 != 0 { + return o.tags + } + return nil +} + +// GetTags returns the value of the 'tags' attribute and +// a flag indicating if the attribute has a value. +// +// Optional keys and values that the machine pool provisioner will add as AWS tags to all AWS resources it creates. +// +// AWS tags must conform to the following standards: +// - Each resource may have a maximum of 25 tags +// - Tags beginning with "aws:" are reserved for system use and may not be set +// - Tag keys may be between 1 and 128 characters in length +// - Tag values may be between 0 and 256 characters in length +// - Tags may only contain letters, numbers, spaces, and the following characters: [_ . : / = + - @] +func (o *AWSMachinePool) GetTags() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.tags + } + return +} + +// AWSMachinePoolListKind is the name of the type used to represent list of objects of +// type 'AWS_machine_pool'. +const AWSMachinePoolListKind = "AWSMachinePoolList" + +// AWSMachinePoolListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS_machine_pool'. +const AWSMachinePoolListLinkKind = "AWSMachinePoolListLink" + +// AWSMachinePoolNilKind is the name of the type used to nil lists of objects of +// type 'AWS_machine_pool'. +const AWSMachinePoolListNilKind = "AWSMachinePoolListNil" + +// AWSMachinePoolList is a list of values of the 'AWS_machine_pool' type. +type AWSMachinePoolList struct { + href string + link bool + items []*AWSMachinePool +} + +// Kind returns the name of the type of the object. +func (l *AWSMachinePoolList) Kind() string { + if l == nil { + return AWSMachinePoolListNilKind + } + if l.link { + return AWSMachinePoolListLinkKind + } + return AWSMachinePoolListKind +} + +// Link returns true iif this is a link. +func (l *AWSMachinePoolList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AWSMachinePoolList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AWSMachinePoolList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AWSMachinePoolList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSMachinePoolList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSMachinePoolList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSMachinePoolList) SetItems(items []*AWSMachinePool) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSMachinePoolList) Items() []*AWSMachinePool { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSMachinePoolList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSMachinePoolList) Get(i int) *AWSMachinePool { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSMachinePoolList) Slice() []*AWSMachinePool { + var slice []*AWSMachinePool + if l == nil { + slice = make([]*AWSMachinePool, 0) + } else { + slice = make([]*AWSMachinePool, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSMachinePoolList) Each(f func(item *AWSMachinePool) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSMachinePoolList) Range(f func(index int, item *AWSMachinePool) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/aws_machine_pool_type_json.go b/clientapi/clustersmgmt/v1/aws_machine_pool_type_json.go new file mode 100644 index 00000000..f832cf01 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_machine_pool_type_json.go @@ -0,0 +1,257 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSMachinePool writes a value of the 'AWS_machine_pool' type to the given writer. +func MarshalAWSMachinePool(object *AWSMachinePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSMachinePool(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSMachinePool writes a value of the 'AWS_machine_pool' type to the given stream. +func WriteAWSMachinePool(object *AWSMachinePool, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AWSMachinePoolLinkKind) + } else { + stream.WriteString(AWSMachinePoolKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.additionalSecurityGroupIds != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_security_group_ids") + WriteStringList(object.additionalSecurityGroupIds, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.availabilityZoneTypes != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zone_types") + if object.availabilityZoneTypes != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.availabilityZoneTypes)) + i := 0 + for key := range object.availabilityZoneTypes { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.availabilityZoneTypes[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&32 != 0 && object.spotMarketOptions != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("spot_market_options") + WriteAWSSpotMarketOptions(object.spotMarketOptions, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.subnetOutposts != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnet_outposts") + if object.subnetOutposts != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.subnetOutposts)) + i := 0 + for key := range object.subnetOutposts { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.subnetOutposts[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&128 != 0 && object.tags != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("tags") + if object.tags != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.tags)) + i := 0 + for key := range object.tags { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.tags[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSMachinePool reads a value of the 'AWS_machine_pool' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSMachinePool(source interface{}) (object *AWSMachinePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSMachinePool(iterator) + err = iterator.Error + return +} + +// ReadAWSMachinePool reads a value of the 'AWS_machine_pool' type from the given iterator. +func ReadAWSMachinePool(iterator *jsoniter.Iterator) *AWSMachinePool { + object := &AWSMachinePool{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AWSMachinePoolLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "additional_security_group_ids": + value := ReadStringList(iterator) + object.additionalSecurityGroupIds = value + object.bitmap_ |= 8 + case "availability_zone_types": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.availabilityZoneTypes = value + object.bitmap_ |= 16 + case "spot_market_options": + value := ReadAWSSpotMarketOptions(iterator) + object.spotMarketOptions = value + object.bitmap_ |= 32 + case "subnet_outposts": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.subnetOutposts = value + object.bitmap_ |= 64 + case "tags": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.tags = value + object.bitmap_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/aws_node_pool_builder.go b/clientapi/clustersmgmt/v1/aws_node_pool_builder.go new file mode 100644 index 00000000..9b0a2115 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_node_pool_builder.go @@ -0,0 +1,233 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSNodePoolBuilder contains the data and logic needed to build 'AWS_node_pool' objects. +// +// Representation of aws node pool specific parameters. +type AWSNodePoolBuilder struct { + bitmap_ uint32 + id string + href string + additionalSecurityGroupIds []string + availabilityZoneTypes map[string]string + ec2MetadataHttpTokens Ec2MetadataHttpTokens + instanceProfile string + instanceType string + rootVolume *AWSVolumeBuilder + subnetOutposts map[string]string + tags map[string]string +} + +// NewAWSNodePool creates a new builder of 'AWS_node_pool' objects. +func NewAWSNodePool() *AWSNodePoolBuilder { + return &AWSNodePoolBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AWSNodePoolBuilder) Link(value bool) *AWSNodePoolBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AWSNodePoolBuilder) ID(value string) *AWSNodePoolBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AWSNodePoolBuilder) HREF(value string) *AWSNodePoolBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSNodePoolBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AdditionalSecurityGroupIds sets the value of the 'additional_security_group_ids' attribute to the given values. +func (b *AWSNodePoolBuilder) AdditionalSecurityGroupIds(values ...string) *AWSNodePoolBuilder { + b.additionalSecurityGroupIds = make([]string, len(values)) + copy(b.additionalSecurityGroupIds, values) + b.bitmap_ |= 8 + return b +} + +// AvailabilityZoneTypes sets the value of the 'availability_zone_types' attribute to the given value. +func (b *AWSNodePoolBuilder) AvailabilityZoneTypes(value map[string]string) *AWSNodePoolBuilder { + b.availabilityZoneTypes = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Ec2MetadataHttpTokens sets the value of the 'ec_2_metadata_http_tokens' attribute to the given value. +// +// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances +func (b *AWSNodePoolBuilder) Ec2MetadataHttpTokens(value Ec2MetadataHttpTokens) *AWSNodePoolBuilder { + b.ec2MetadataHttpTokens = value + b.bitmap_ |= 32 + return b +} + +// InstanceProfile sets the value of the 'instance_profile' attribute to the given value. +func (b *AWSNodePoolBuilder) InstanceProfile(value string) *AWSNodePoolBuilder { + b.instanceProfile = value + b.bitmap_ |= 64 + return b +} + +// InstanceType sets the value of the 'instance_type' attribute to the given value. +func (b *AWSNodePoolBuilder) InstanceType(value string) *AWSNodePoolBuilder { + b.instanceType = value + b.bitmap_ |= 128 + return b +} + +// RootVolume sets the value of the 'root_volume' attribute to the given value. +// +// Holds settings for an AWS storage volume. +func (b *AWSNodePoolBuilder) RootVolume(value *AWSVolumeBuilder) *AWSNodePoolBuilder { + b.rootVolume = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// SubnetOutposts sets the value of the 'subnet_outposts' attribute to the given value. +func (b *AWSNodePoolBuilder) SubnetOutposts(value map[string]string) *AWSNodePoolBuilder { + b.subnetOutposts = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// Tags sets the value of the 'tags' attribute to the given value. +func (b *AWSNodePoolBuilder) Tags(value map[string]string) *AWSNodePoolBuilder { + b.tags = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSNodePoolBuilder) Copy(object *AWSNodePool) *AWSNodePoolBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.additionalSecurityGroupIds != nil { + b.additionalSecurityGroupIds = make([]string, len(object.additionalSecurityGroupIds)) + copy(b.additionalSecurityGroupIds, object.additionalSecurityGroupIds) + } else { + b.additionalSecurityGroupIds = nil + } + if len(object.availabilityZoneTypes) > 0 { + b.availabilityZoneTypes = map[string]string{} + for k, v := range object.availabilityZoneTypes { + b.availabilityZoneTypes[k] = v + } + } else { + b.availabilityZoneTypes = nil + } + b.ec2MetadataHttpTokens = object.ec2MetadataHttpTokens + b.instanceProfile = object.instanceProfile + b.instanceType = object.instanceType + if object.rootVolume != nil { + b.rootVolume = NewAWSVolume().Copy(object.rootVolume) + } else { + b.rootVolume = nil + } + if len(object.subnetOutposts) > 0 { + b.subnetOutposts = map[string]string{} + for k, v := range object.subnetOutposts { + b.subnetOutposts[k] = v + } + } else { + b.subnetOutposts = nil + } + if len(object.tags) > 0 { + b.tags = map[string]string{} + for k, v := range object.tags { + b.tags[k] = v + } + } else { + b.tags = nil + } + return b +} + +// Build creates a 'AWS_node_pool' object using the configuration stored in the builder. +func (b *AWSNodePoolBuilder) Build() (object *AWSNodePool, err error) { + object = new(AWSNodePool) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.additionalSecurityGroupIds != nil { + object.additionalSecurityGroupIds = make([]string, len(b.additionalSecurityGroupIds)) + copy(object.additionalSecurityGroupIds, b.additionalSecurityGroupIds) + } + if b.availabilityZoneTypes != nil { + object.availabilityZoneTypes = make(map[string]string) + for k, v := range b.availabilityZoneTypes { + object.availabilityZoneTypes[k] = v + } + } + object.ec2MetadataHttpTokens = b.ec2MetadataHttpTokens + object.instanceProfile = b.instanceProfile + object.instanceType = b.instanceType + if b.rootVolume != nil { + object.rootVolume, err = b.rootVolume.Build() + if err != nil { + return + } + } + if b.subnetOutposts != nil { + object.subnetOutposts = make(map[string]string) + for k, v := range b.subnetOutposts { + object.subnetOutposts[k] = v + } + } + if b.tags != nil { + object.tags = make(map[string]string) + for k, v := range b.tags { + object.tags[k] = v + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/aws_node_pool_list_builder.go b/clientapi/clustersmgmt/v1/aws_node_pool_list_builder.go new file mode 100644 index 00000000..afd698f6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_node_pool_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSNodePoolListBuilder contains the data and logic needed to build +// 'AWS_node_pool' objects. +type AWSNodePoolListBuilder struct { + items []*AWSNodePoolBuilder +} + +// NewAWSNodePoolList creates a new builder of 'AWS_node_pool' objects. +func NewAWSNodePoolList() *AWSNodePoolListBuilder { + return new(AWSNodePoolListBuilder) +} + +// Items sets the items of the list. +func (b *AWSNodePoolListBuilder) Items(values ...*AWSNodePoolBuilder) *AWSNodePoolListBuilder { + b.items = make([]*AWSNodePoolBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSNodePoolListBuilder) 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 *AWSNodePoolListBuilder) Copy(list *AWSNodePoolList) *AWSNodePoolListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSNodePoolBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSNodePool().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS_node_pool' objects using the +// configuration stored in the builder. +func (b *AWSNodePoolListBuilder) Build() (list *AWSNodePoolList, err error) { + items := make([]*AWSNodePool, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSNodePoolList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/aws_node_pool_list_type_json.go b/clientapi/clustersmgmt/v1/aws_node_pool_list_type_json.go new file mode 100644 index 00000000..d79ef984 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_node_pool_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSNodePoolList writes a list of values of the 'AWS_node_pool' type to +// the given writer. +func MarshalAWSNodePoolList(list []*AWSNodePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSNodePoolList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSNodePoolList writes a list of value of the 'AWS_node_pool' type to +// the given stream. +func WriteAWSNodePoolList(list []*AWSNodePool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSNodePool(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSNodePoolList reads a list of values of the 'AWS_node_pool' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSNodePoolList(source interface{}) (items []*AWSNodePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSNodePoolList(iterator) + err = iterator.Error + return +} + +// ReadAWSNodePoolList reads list of values of the ”AWS_node_pool' type from +// the given iterator. +func ReadAWSNodePoolList(iterator *jsoniter.Iterator) []*AWSNodePool { + list := []*AWSNodePool{} + for iterator.ReadArray() { + item := ReadAWSNodePool(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/aws_node_pool_type.go b/clientapi/clustersmgmt/v1/aws_node_pool_type.go new file mode 100644 index 00000000..483a11cb --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_node_pool_type.go @@ -0,0 +1,447 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSNodePoolKind is the name of the type used to represent objects +// of type 'AWS_node_pool'. +const AWSNodePoolKind = "AWSNodePool" + +// AWSNodePoolLinkKind is the name of the type used to represent links +// to objects of type 'AWS_node_pool'. +const AWSNodePoolLinkKind = "AWSNodePoolLink" + +// AWSNodePoolNilKind is the name of the type used to nil references +// to objects of type 'AWS_node_pool'. +const AWSNodePoolNilKind = "AWSNodePoolNil" + +// AWSNodePool represents the values of the 'AWS_node_pool' type. +// +// Representation of aws node pool specific parameters. +type AWSNodePool struct { + bitmap_ uint32 + id string + href string + additionalSecurityGroupIds []string + availabilityZoneTypes map[string]string + ec2MetadataHttpTokens Ec2MetadataHttpTokens + instanceProfile string + instanceType string + rootVolume *AWSVolume + subnetOutposts map[string]string + tags map[string]string +} + +// Kind returns the name of the type of the object. +func (o *AWSNodePool) Kind() string { + if o == nil { + return AWSNodePoolNilKind + } + if o.bitmap_&1 != 0 { + return AWSNodePoolLinkKind + } + return AWSNodePoolKind +} + +// Link returns true if this is a link. +func (o *AWSNodePool) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AWSNodePool) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AWSNodePool) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AWSNodePool) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AWSNodePool) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSNodePool) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AdditionalSecurityGroupIds returns the value of the 'additional_security_group_ids' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional AWS Security Groups to be added node pool. +func (o *AWSNodePool) AdditionalSecurityGroupIds() []string { + if o != nil && o.bitmap_&8 != 0 { + return o.additionalSecurityGroupIds + } + return nil +} + +// GetAdditionalSecurityGroupIds returns the value of the 'additional_security_group_ids' attribute and +// a flag indicating if the attribute has a value. +// +// Additional AWS Security Groups to be added node pool. +func (o *AWSNodePool) GetAdditionalSecurityGroupIds() (value []string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.additionalSecurityGroupIds + } + return +} + +// AvailabilityZoneTypes returns the value of the 'availability_zone_types' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Associates nodepool availability zones with zone types (e.g. wavelength, local). +func (o *AWSNodePool) AvailabilityZoneTypes() map[string]string { + if o != nil && o.bitmap_&16 != 0 { + return o.availabilityZoneTypes + } + return nil +} + +// GetAvailabilityZoneTypes returns the value of the 'availability_zone_types' attribute and +// a flag indicating if the attribute has a value. +// +// Associates nodepool availability zones with zone types (e.g. wavelength, local). +func (o *AWSNodePool) GetAvailabilityZoneTypes() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.availabilityZoneTypes + } + return +} + +// Ec2MetadataHttpTokens returns the value of the 'ec_2_metadata_http_tokens' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances +func (o *AWSNodePool) Ec2MetadataHttpTokens() Ec2MetadataHttpTokens { + if o != nil && o.bitmap_&32 != 0 { + return o.ec2MetadataHttpTokens + } + return Ec2MetadataHttpTokens("") +} + +// GetEc2MetadataHttpTokens returns the value of the 'ec_2_metadata_http_tokens' attribute and +// a flag indicating if the attribute has a value. +// +// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances +func (o *AWSNodePool) GetEc2MetadataHttpTokens() (value Ec2MetadataHttpTokens, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.ec2MetadataHttpTokens + } + return +} + +// InstanceProfile returns the value of the 'instance_profile' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// InstanceProfile is the AWS EC2 instance profile, which is a container for an IAM role that the EC2 instance uses. +func (o *AWSNodePool) InstanceProfile() string { + if o != nil && o.bitmap_&64 != 0 { + return o.instanceProfile + } + return "" +} + +// GetInstanceProfile returns the value of the 'instance_profile' attribute and +// a flag indicating if the attribute has a value. +// +// InstanceProfile is the AWS EC2 instance profile, which is a container for an IAM role that the EC2 instance uses. +func (o *AWSNodePool) GetInstanceProfile() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.instanceProfile + } + return +} + +// InstanceType returns the value of the 'instance_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// InstanceType is an ec2 instance type for node instances (e.g. m5.large). +func (o *AWSNodePool) InstanceType() string { + if o != nil && o.bitmap_&128 != 0 { + return o.instanceType + } + return "" +} + +// GetInstanceType returns the value of the 'instance_type' attribute and +// a flag indicating if the attribute has a value. +// +// InstanceType is an ec2 instance type for node instances (e.g. m5.large). +func (o *AWSNodePool) GetInstanceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.instanceType + } + return +} + +// RootVolume returns the value of the 'root_volume' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS Volume specification to be used to set custom worker disk size +func (o *AWSNodePool) RootVolume() *AWSVolume { + if o != nil && o.bitmap_&256 != 0 { + return o.rootVolume + } + return nil +} + +// GetRootVolume returns the value of the 'root_volume' attribute and +// a flag indicating if the attribute has a value. +// +// AWS Volume specification to be used to set custom worker disk size +func (o *AWSNodePool) GetRootVolume() (value *AWSVolume, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.rootVolume + } + return +} + +// SubnetOutposts returns the value of the 'subnet_outposts' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Associates nodepool subnets with AWS Outposts. +func (o *AWSNodePool) SubnetOutposts() map[string]string { + if o != nil && o.bitmap_&512 != 0 { + return o.subnetOutposts + } + return nil +} + +// GetSubnetOutposts returns the value of the 'subnet_outposts' attribute and +// a flag indicating if the attribute has a value. +// +// Associates nodepool subnets with AWS Outposts. +func (o *AWSNodePool) GetSubnetOutposts() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.subnetOutposts + } + return +} + +// Tags returns the value of the 'tags' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional keys and values that the installer will add as tags to all AWS resources it creates. +// +// AWS tags must conform to the following standards: +// - Each resource may have a maximum of 25 tags +// - Tags beginning with "aws:" are reserved for system use and may not be set +// - Tag keys may be between 1 and 128 characters in length +// - Tag values may be between 0 and 256 characters in length +// - Tags may only contain letters, numbers, spaces, and the following characters: [_ . : / = + - @] +func (o *AWSNodePool) Tags() map[string]string { + if o != nil && o.bitmap_&1024 != 0 { + return o.tags + } + return nil +} + +// GetTags returns the value of the 'tags' attribute and +// a flag indicating if the attribute has a value. +// +// Optional keys and values that the installer will add as tags to all AWS resources it creates. +// +// AWS tags must conform to the following standards: +// - Each resource may have a maximum of 25 tags +// - Tags beginning with "aws:" are reserved for system use and may not be set +// - Tag keys may be between 1 and 128 characters in length +// - Tag values may be between 0 and 256 characters in length +// - Tags may only contain letters, numbers, spaces, and the following characters: [_ . : / = + - @] +func (o *AWSNodePool) GetTags() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.tags + } + return +} + +// AWSNodePoolListKind is the name of the type used to represent list of objects of +// type 'AWS_node_pool'. +const AWSNodePoolListKind = "AWSNodePoolList" + +// AWSNodePoolListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS_node_pool'. +const AWSNodePoolListLinkKind = "AWSNodePoolListLink" + +// AWSNodePoolNilKind is the name of the type used to nil lists of objects of +// type 'AWS_node_pool'. +const AWSNodePoolListNilKind = "AWSNodePoolListNil" + +// AWSNodePoolList is a list of values of the 'AWS_node_pool' type. +type AWSNodePoolList struct { + href string + link bool + items []*AWSNodePool +} + +// Kind returns the name of the type of the object. +func (l *AWSNodePoolList) Kind() string { + if l == nil { + return AWSNodePoolListNilKind + } + if l.link { + return AWSNodePoolListLinkKind + } + return AWSNodePoolListKind +} + +// Link returns true iif this is a link. +func (l *AWSNodePoolList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AWSNodePoolList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AWSNodePoolList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AWSNodePoolList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSNodePoolList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSNodePoolList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSNodePoolList) SetItems(items []*AWSNodePool) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSNodePoolList) Items() []*AWSNodePool { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSNodePoolList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSNodePoolList) Get(i int) *AWSNodePool { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSNodePoolList) Slice() []*AWSNodePool { + var slice []*AWSNodePool + if l == nil { + slice = make([]*AWSNodePool, 0) + } else { + slice = make([]*AWSNodePool, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSNodePoolList) Each(f func(item *AWSNodePool) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSNodePoolList) Range(f func(index int, item *AWSNodePool) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/aws_node_pool_type_json.go b/clientapi/clustersmgmt/v1/aws_node_pool_type_json.go new file mode 100644 index 00000000..f7bb7cc2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_node_pool_type_json.go @@ -0,0 +1,297 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSNodePool writes a value of the 'AWS_node_pool' type to the given writer. +func MarshalAWSNodePool(object *AWSNodePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSNodePool(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSNodePool writes a value of the 'AWS_node_pool' type to the given stream. +func WriteAWSNodePool(object *AWSNodePool, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AWSNodePoolLinkKind) + } else { + stream.WriteString(AWSNodePoolKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.additionalSecurityGroupIds != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_security_group_ids") + WriteStringList(object.additionalSecurityGroupIds, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.availabilityZoneTypes != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zone_types") + if object.availabilityZoneTypes != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.availabilityZoneTypes)) + i := 0 + for key := range object.availabilityZoneTypes { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.availabilityZoneTypes[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ec2_metadata_http_tokens") + stream.WriteString(string(object.ec2MetadataHttpTokens)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("instance_profile") + stream.WriteString(object.instanceProfile) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("instance_type") + stream.WriteString(object.instanceType) + count++ + } + present_ = object.bitmap_&256 != 0 && object.rootVolume != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("root_volume") + WriteAWSVolume(object.rootVolume, stream) + count++ + } + present_ = object.bitmap_&512 != 0 && object.subnetOutposts != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnet_outposts") + if object.subnetOutposts != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.subnetOutposts)) + i := 0 + for key := range object.subnetOutposts { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.subnetOutposts[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&1024 != 0 && object.tags != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("tags") + if object.tags != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.tags)) + i := 0 + for key := range object.tags { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.tags[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSNodePool reads a value of the 'AWS_node_pool' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSNodePool(source interface{}) (object *AWSNodePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSNodePool(iterator) + err = iterator.Error + return +} + +// ReadAWSNodePool reads a value of the 'AWS_node_pool' type from the given iterator. +func ReadAWSNodePool(iterator *jsoniter.Iterator) *AWSNodePool { + object := &AWSNodePool{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AWSNodePoolLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "additional_security_group_ids": + value := ReadStringList(iterator) + object.additionalSecurityGroupIds = value + object.bitmap_ |= 8 + case "availability_zone_types": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.availabilityZoneTypes = value + object.bitmap_ |= 16 + case "ec2_metadata_http_tokens": + text := iterator.ReadString() + value := Ec2MetadataHttpTokens(text) + object.ec2MetadataHttpTokens = value + object.bitmap_ |= 32 + case "instance_profile": + value := iterator.ReadString() + object.instanceProfile = value + object.bitmap_ |= 64 + case "instance_type": + value := iterator.ReadString() + object.instanceType = value + object.bitmap_ |= 128 + case "root_volume": + value := ReadAWSVolume(iterator) + object.rootVolume = value + object.bitmap_ |= 256 + case "subnet_outposts": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.subnetOutposts = value + object.bitmap_ |= 512 + case "tags": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.tags = value + object.bitmap_ |= 1024 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/aws_shard_builder.go b/clientapi/clustersmgmt/v1/aws_shard_builder.go new file mode 100644 index 00000000..cbd32ed2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_shard_builder.go @@ -0,0 +1,72 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSShardBuilder contains the data and logic needed to build 'AWS_shard' objects. +// +// Config for AWS provision shards +type AWSShardBuilder struct { + bitmap_ uint32 + ecrRepositoryURLs []string +} + +// NewAWSShard creates a new builder of 'AWS_shard' objects. +func NewAWSShard() *AWSShardBuilder { + return &AWSShardBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSShardBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ECRRepositoryURLs sets the value of the 'ECR_repository_URLs' attribute to the given values. +func (b *AWSShardBuilder) ECRRepositoryURLs(values ...string) *AWSShardBuilder { + b.ecrRepositoryURLs = make([]string, len(values)) + copy(b.ecrRepositoryURLs, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSShardBuilder) Copy(object *AWSShard) *AWSShardBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.ecrRepositoryURLs != nil { + b.ecrRepositoryURLs = make([]string, len(object.ecrRepositoryURLs)) + copy(b.ecrRepositoryURLs, object.ecrRepositoryURLs) + } else { + b.ecrRepositoryURLs = nil + } + return b +} + +// Build creates a 'AWS_shard' object using the configuration stored in the builder. +func (b *AWSShardBuilder) Build() (object *AWSShard, err error) { + object = new(AWSShard) + object.bitmap_ = b.bitmap_ + if b.ecrRepositoryURLs != nil { + object.ecrRepositoryURLs = make([]string, len(b.ecrRepositoryURLs)) + copy(object.ecrRepositoryURLs, b.ecrRepositoryURLs) + } + return +} diff --git a/clientapi/clustersmgmt/v1/aws_shard_list_builder.go b/clientapi/clustersmgmt/v1/aws_shard_list_builder.go new file mode 100644 index 00000000..54b4b98a --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_shard_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSShardListBuilder contains the data and logic needed to build +// 'AWS_shard' objects. +type AWSShardListBuilder struct { + items []*AWSShardBuilder +} + +// NewAWSShardList creates a new builder of 'AWS_shard' objects. +func NewAWSShardList() *AWSShardListBuilder { + return new(AWSShardListBuilder) +} + +// Items sets the items of the list. +func (b *AWSShardListBuilder) Items(values ...*AWSShardBuilder) *AWSShardListBuilder { + b.items = make([]*AWSShardBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSShardListBuilder) 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 *AWSShardListBuilder) Copy(list *AWSShardList) *AWSShardListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSShardBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSShard().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS_shard' objects using the +// configuration stored in the builder. +func (b *AWSShardListBuilder) Build() (list *AWSShardList, err error) { + items := make([]*AWSShard, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSShardList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/aws_shard_list_type_json.go b/clientapi/clustersmgmt/v1/aws_shard_list_type_json.go new file mode 100644 index 00000000..f2dc40f1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_shard_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSShardList writes a list of values of the 'AWS_shard' type to +// the given writer. +func MarshalAWSShardList(list []*AWSShard, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSShardList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSShardList writes a list of value of the 'AWS_shard' type to +// the given stream. +func WriteAWSShardList(list []*AWSShard, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSShard(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSShardList reads a list of values of the 'AWS_shard' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSShardList(source interface{}) (items []*AWSShard, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSShardList(iterator) + err = iterator.Error + return +} + +// ReadAWSShardList reads list of values of the ”AWS_shard' type from +// the given iterator. +func ReadAWSShardList(iterator *jsoniter.Iterator) []*AWSShard { + list := []*AWSShard{} + for iterator.ReadArray() { + item := ReadAWSShard(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/aws_shard_type.go b/clientapi/clustersmgmt/v1/aws_shard_type.go new file mode 100644 index 00000000..b01e1944 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_shard_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSShard represents the values of the 'AWS_shard' type. +// +// Config for AWS provision shards +type AWSShard struct { + bitmap_ uint32 + ecrRepositoryURLs []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSShard) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ECRRepositoryURLs returns the value of the 'ECR_repository_URLs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ECR repository URLs of the provision shard +func (o *AWSShard) ECRRepositoryURLs() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.ecrRepositoryURLs + } + return nil +} + +// GetECRRepositoryURLs returns the value of the 'ECR_repository_URLs' attribute and +// a flag indicating if the attribute has a value. +// +// ECR repository URLs of the provision shard +func (o *AWSShard) GetECRRepositoryURLs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.ecrRepositoryURLs + } + return +} + +// AWSShardListKind is the name of the type used to represent list of objects of +// type 'AWS_shard'. +const AWSShardListKind = "AWSShardList" + +// AWSShardListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS_shard'. +const AWSShardListLinkKind = "AWSShardListLink" + +// AWSShardNilKind is the name of the type used to nil lists of objects of +// type 'AWS_shard'. +const AWSShardListNilKind = "AWSShardListNil" + +// AWSShardList is a list of values of the 'AWS_shard' type. +type AWSShardList struct { + href string + link bool + items []*AWSShard +} + +// Len returns the length of the list. +func (l *AWSShardList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSShardList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSShardList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSShardList) SetItems(items []*AWSShard) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSShardList) Items() []*AWSShard { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSShardList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSShardList) Get(i int) *AWSShard { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSShardList) Slice() []*AWSShard { + var slice []*AWSShard + if l == nil { + slice = make([]*AWSShard, 0) + } else { + slice = make([]*AWSShard, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSShardList) Each(f func(item *AWSShard) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSShardList) Range(f func(index int, item *AWSShard) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/aws_shard_type_json.go b/clientapi/clustersmgmt/v1/aws_shard_type_json.go new file mode 100644 index 00000000..59be1df4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_shard_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSShard writes a value of the 'AWS_shard' type to the given writer. +func MarshalAWSShard(object *AWSShard, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSShard(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSShard writes a value of the 'AWS_shard' type to the given stream. +func WriteAWSShard(object *AWSShard, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.ecrRepositoryURLs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ecr_repository_urls") + WriteStringList(object.ecrRepositoryURLs, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSShard reads a value of the 'AWS_shard' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSShard(source interface{}) (object *AWSShard, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSShard(iterator) + err = iterator.Error + return +} + +// ReadAWSShard reads a value of the 'AWS_shard' type from the given iterator. +func ReadAWSShard(iterator *jsoniter.Iterator) *AWSShard { + object := &AWSShard{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "ecr_repository_urls": + value := ReadStringList(iterator) + object.ecrRepositoryURLs = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/aws_spot_market_options_builder.go b/clientapi/clustersmgmt/v1/aws_spot_market_options_builder.go new file mode 100644 index 00000000..4e62b6cf --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_spot_market_options_builder.go @@ -0,0 +1,89 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSSpotMarketOptionsBuilder contains the data and logic needed to build 'AWS_spot_market_options' objects. +// +// Spot market options for AWS machine pool. +type AWSSpotMarketOptionsBuilder struct { + bitmap_ uint32 + id string + href string + maxPrice float64 +} + +// NewAWSSpotMarketOptions creates a new builder of 'AWS_spot_market_options' objects. +func NewAWSSpotMarketOptions() *AWSSpotMarketOptionsBuilder { + return &AWSSpotMarketOptionsBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AWSSpotMarketOptionsBuilder) Link(value bool) *AWSSpotMarketOptionsBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AWSSpotMarketOptionsBuilder) ID(value string) *AWSSpotMarketOptionsBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AWSSpotMarketOptionsBuilder) HREF(value string) *AWSSpotMarketOptionsBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSSpotMarketOptionsBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// MaxPrice sets the value of the 'max_price' attribute to the given value. +func (b *AWSSpotMarketOptionsBuilder) MaxPrice(value float64) *AWSSpotMarketOptionsBuilder { + b.maxPrice = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSSpotMarketOptionsBuilder) Copy(object *AWSSpotMarketOptions) *AWSSpotMarketOptionsBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.maxPrice = object.maxPrice + return b +} + +// Build creates a 'AWS_spot_market_options' object using the configuration stored in the builder. +func (b *AWSSpotMarketOptionsBuilder) Build() (object *AWSSpotMarketOptions, err error) { + object = new(AWSSpotMarketOptions) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.maxPrice = b.maxPrice + return +} diff --git a/clientapi/clustersmgmt/v1/aws_spot_market_options_list_builder.go b/clientapi/clustersmgmt/v1/aws_spot_market_options_list_builder.go new file mode 100644 index 00000000..a0a27666 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_spot_market_options_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSSpotMarketOptionsListBuilder contains the data and logic needed to build +// 'AWS_spot_market_options' objects. +type AWSSpotMarketOptionsListBuilder struct { + items []*AWSSpotMarketOptionsBuilder +} + +// NewAWSSpotMarketOptionsList creates a new builder of 'AWS_spot_market_options' objects. +func NewAWSSpotMarketOptionsList() *AWSSpotMarketOptionsListBuilder { + return new(AWSSpotMarketOptionsListBuilder) +} + +// Items sets the items of the list. +func (b *AWSSpotMarketOptionsListBuilder) Items(values ...*AWSSpotMarketOptionsBuilder) *AWSSpotMarketOptionsListBuilder { + b.items = make([]*AWSSpotMarketOptionsBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSSpotMarketOptionsListBuilder) 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 *AWSSpotMarketOptionsListBuilder) Copy(list *AWSSpotMarketOptionsList) *AWSSpotMarketOptionsListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSSpotMarketOptionsBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSSpotMarketOptions().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS_spot_market_options' objects using the +// configuration stored in the builder. +func (b *AWSSpotMarketOptionsListBuilder) Build() (list *AWSSpotMarketOptionsList, err error) { + items := make([]*AWSSpotMarketOptions, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSSpotMarketOptionsList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/aws_spot_market_options_list_type_json.go b/clientapi/clustersmgmt/v1/aws_spot_market_options_list_type_json.go new file mode 100644 index 00000000..e420ba59 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_spot_market_options_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSSpotMarketOptionsList writes a list of values of the 'AWS_spot_market_options' type to +// the given writer. +func MarshalAWSSpotMarketOptionsList(list []*AWSSpotMarketOptions, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSSpotMarketOptionsList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSSpotMarketOptionsList writes a list of value of the 'AWS_spot_market_options' type to +// the given stream. +func WriteAWSSpotMarketOptionsList(list []*AWSSpotMarketOptions, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSSpotMarketOptions(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSSpotMarketOptionsList reads a list of values of the 'AWS_spot_market_options' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSSpotMarketOptionsList(source interface{}) (items []*AWSSpotMarketOptions, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSSpotMarketOptionsList(iterator) + err = iterator.Error + return +} + +// ReadAWSSpotMarketOptionsList reads list of values of the ”AWS_spot_market_options' type from +// the given iterator. +func ReadAWSSpotMarketOptionsList(iterator *jsoniter.Iterator) []*AWSSpotMarketOptions { + list := []*AWSSpotMarketOptions{} + for iterator.ReadArray() { + item := ReadAWSSpotMarketOptions(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/aws_spot_market_options_type.go b/clientapi/clustersmgmt/v1/aws_spot_market_options_type.go new file mode 100644 index 00000000..4e265b5f --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_spot_market_options_type.go @@ -0,0 +1,267 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSSpotMarketOptionsKind is the name of the type used to represent objects +// of type 'AWS_spot_market_options'. +const AWSSpotMarketOptionsKind = "AWSSpotMarketOptions" + +// AWSSpotMarketOptionsLinkKind is the name of the type used to represent links +// to objects of type 'AWS_spot_market_options'. +const AWSSpotMarketOptionsLinkKind = "AWSSpotMarketOptionsLink" + +// AWSSpotMarketOptionsNilKind is the name of the type used to nil references +// to objects of type 'AWS_spot_market_options'. +const AWSSpotMarketOptionsNilKind = "AWSSpotMarketOptionsNil" + +// AWSSpotMarketOptions represents the values of the 'AWS_spot_market_options' type. +// +// Spot market options for AWS machine pool. +type AWSSpotMarketOptions struct { + bitmap_ uint32 + id string + href string + maxPrice float64 +} + +// Kind returns the name of the type of the object. +func (o *AWSSpotMarketOptions) Kind() string { + if o == nil { + return AWSSpotMarketOptionsNilKind + } + if o.bitmap_&1 != 0 { + return AWSSpotMarketOptionsLinkKind + } + return AWSSpotMarketOptionsKind +} + +// Link returns true if this is a link. +func (o *AWSSpotMarketOptions) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *AWSSpotMarketOptions) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *AWSSpotMarketOptions) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *AWSSpotMarketOptions) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *AWSSpotMarketOptions) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSSpotMarketOptions) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// MaxPrice returns the value of the 'max_price' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The max price for spot instance. Optional. +// If not set, use the on-demand price. +func (o *AWSSpotMarketOptions) MaxPrice() float64 { + if o != nil && o.bitmap_&8 != 0 { + return o.maxPrice + } + return 0.0 +} + +// GetMaxPrice returns the value of the 'max_price' attribute and +// a flag indicating if the attribute has a value. +// +// The max price for spot instance. Optional. +// If not set, use the on-demand price. +func (o *AWSSpotMarketOptions) GetMaxPrice() (value float64, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.maxPrice + } + return +} + +// AWSSpotMarketOptionsListKind is the name of the type used to represent list of objects of +// type 'AWS_spot_market_options'. +const AWSSpotMarketOptionsListKind = "AWSSpotMarketOptionsList" + +// AWSSpotMarketOptionsListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS_spot_market_options'. +const AWSSpotMarketOptionsListLinkKind = "AWSSpotMarketOptionsListLink" + +// AWSSpotMarketOptionsNilKind is the name of the type used to nil lists of objects of +// type 'AWS_spot_market_options'. +const AWSSpotMarketOptionsListNilKind = "AWSSpotMarketOptionsListNil" + +// AWSSpotMarketOptionsList is a list of values of the 'AWS_spot_market_options' type. +type AWSSpotMarketOptionsList struct { + href string + link bool + items []*AWSSpotMarketOptions +} + +// Kind returns the name of the type of the object. +func (l *AWSSpotMarketOptionsList) Kind() string { + if l == nil { + return AWSSpotMarketOptionsListNilKind + } + if l.link { + return AWSSpotMarketOptionsListLinkKind + } + return AWSSpotMarketOptionsListKind +} + +// Link returns true iif this is a link. +func (l *AWSSpotMarketOptionsList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AWSSpotMarketOptionsList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AWSSpotMarketOptionsList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AWSSpotMarketOptionsList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSSpotMarketOptionsList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSSpotMarketOptionsList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSSpotMarketOptionsList) SetItems(items []*AWSSpotMarketOptions) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSSpotMarketOptionsList) Items() []*AWSSpotMarketOptions { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSSpotMarketOptionsList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSSpotMarketOptionsList) Get(i int) *AWSSpotMarketOptions { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSSpotMarketOptionsList) Slice() []*AWSSpotMarketOptions { + var slice []*AWSSpotMarketOptions + if l == nil { + slice = make([]*AWSSpotMarketOptions, 0) + } else { + slice = make([]*AWSSpotMarketOptions, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSSpotMarketOptionsList) Each(f func(item *AWSSpotMarketOptions) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSSpotMarketOptionsList) Range(f func(index int, item *AWSSpotMarketOptions) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/aws_spot_market_options_type_json.go b/clientapi/clustersmgmt/v1/aws_spot_market_options_type_json.go new file mode 100644 index 00000000..73063798 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_spot_market_options_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSSpotMarketOptions writes a value of the 'AWS_spot_market_options' type to the given writer. +func MarshalAWSSpotMarketOptions(object *AWSSpotMarketOptions, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSSpotMarketOptions(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSSpotMarketOptions writes a value of the 'AWS_spot_market_options' type to the given stream. +func WriteAWSSpotMarketOptions(object *AWSSpotMarketOptions, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AWSSpotMarketOptionsLinkKind) + } else { + stream.WriteString(AWSSpotMarketOptionsKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_price") + stream.WriteFloat64(object.maxPrice) + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSSpotMarketOptions reads a value of the 'AWS_spot_market_options' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSSpotMarketOptions(source interface{}) (object *AWSSpotMarketOptions, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSSpotMarketOptions(iterator) + err = iterator.Error + return +} + +// ReadAWSSpotMarketOptions reads a value of the 'AWS_spot_market_options' type from the given iterator. +func ReadAWSSpotMarketOptions(iterator *jsoniter.Iterator) *AWSSpotMarketOptions { + object := &AWSSpotMarketOptions{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AWSSpotMarketOptionsLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "max_price": + value := iterator.ReadFloat64() + object.maxPrice = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/aws_type.go b/clientapi/clustersmgmt/v1/aws_type.go new file mode 100644 index 00000000..aab287f2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_type.go @@ -0,0 +1,645 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWS represents the values of the 'AWS' type. +// +// _Amazon Web Services_ specific settings of a cluster. +type AWS struct { + bitmap_ uint32 + kmsKeyArn string + sts *STS + accessKeyID string + accountID string + additionalAllowedPrincipals []string + additionalComputeSecurityGroupIds []string + additionalControlPlaneSecurityGroupIds []string + additionalInfraSecurityGroupIds []string + auditLog *AuditLog + billingAccountID string + ec2MetadataHttpTokens Ec2MetadataHttpTokens + etcdEncryption *AwsEtcdEncryption + hcpInternalCommunicationHostedZoneId string + privateHostedZoneID string + privateHostedZoneRoleARN string + privateLinkConfiguration *PrivateLinkClusterConfiguration + secretAccessKey string + subnetIDs []string + tags map[string]string + vpcEndpointRoleArn string + privateLink bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWS) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// KMSKeyArn returns the value of the 'KMS_key_arn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Customer Managed Key to encrypt EBS Volume +func (o *AWS) KMSKeyArn() string { + if o != nil && o.bitmap_&1 != 0 { + return o.kmsKeyArn + } + return "" +} + +// GetKMSKeyArn returns the value of the 'KMS_key_arn' attribute and +// a flag indicating if the attribute has a value. +// +// Customer Managed Key to encrypt EBS Volume +func (o *AWS) GetKMSKeyArn() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.kmsKeyArn + } + return +} + +// STS returns the value of the 'STS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (o *AWS) STS() *STS { + if o != nil && o.bitmap_&2 != 0 { + return o.sts + } + return nil +} + +// GetSTS returns the value of the 'STS' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (o *AWS) GetSTS() (value *STS, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.sts + } + return +} + +// AccessKeyID returns the value of the 'access_key_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS access key identifier. +func (o *AWS) AccessKeyID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.accessKeyID + } + return "" +} + +// GetAccessKeyID returns the value of the 'access_key_ID' attribute and +// a flag indicating if the attribute has a value. +// +// AWS access key identifier. +func (o *AWS) GetAccessKeyID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.accessKeyID + } + return +} + +// AccountID returns the value of the 'account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS account identifier. +func (o *AWS) AccountID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.accountID + } + return "" +} + +// GetAccountID returns the value of the 'account_ID' attribute and +// a flag indicating if the attribute has a value. +// +// AWS account identifier. +func (o *AWS) GetAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.accountID + } + return +} + +// AdditionalAllowedPrincipals returns the value of the 'additional_allowed_principals' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional allowed principal ARNs to be added to the hosted control plane's VPC Endpoint Service. +func (o *AWS) AdditionalAllowedPrincipals() []string { + if o != nil && o.bitmap_&16 != 0 { + return o.additionalAllowedPrincipals + } + return nil +} + +// GetAdditionalAllowedPrincipals returns the value of the 'additional_allowed_principals' attribute and +// a flag indicating if the attribute has a value. +// +// Additional allowed principal ARNs to be added to the hosted control plane's VPC Endpoint Service. +func (o *AWS) GetAdditionalAllowedPrincipals() (value []string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.additionalAllowedPrincipals + } + return +} + +// AdditionalComputeSecurityGroupIds returns the value of the 'additional_compute_security_group_ids' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional AWS Security Groups to be added to default worker (compute) machine pool. +func (o *AWS) AdditionalComputeSecurityGroupIds() []string { + if o != nil && o.bitmap_&32 != 0 { + return o.additionalComputeSecurityGroupIds + } + return nil +} + +// GetAdditionalComputeSecurityGroupIds returns the value of the 'additional_compute_security_group_ids' attribute and +// a flag indicating if the attribute has a value. +// +// Additional AWS Security Groups to be added to default worker (compute) machine pool. +func (o *AWS) GetAdditionalComputeSecurityGroupIds() (value []string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.additionalComputeSecurityGroupIds + } + return +} + +// AdditionalControlPlaneSecurityGroupIds returns the value of the 'additional_control_plane_security_group_ids' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional AWS Security Groups to be added to default control plane machine pool. +func (o *AWS) AdditionalControlPlaneSecurityGroupIds() []string { + if o != nil && o.bitmap_&64 != 0 { + return o.additionalControlPlaneSecurityGroupIds + } + return nil +} + +// GetAdditionalControlPlaneSecurityGroupIds returns the value of the 'additional_control_plane_security_group_ids' attribute and +// a flag indicating if the attribute has a value. +// +// Additional AWS Security Groups to be added to default control plane machine pool. +func (o *AWS) GetAdditionalControlPlaneSecurityGroupIds() (value []string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.additionalControlPlaneSecurityGroupIds + } + return +} + +// AdditionalInfraSecurityGroupIds returns the value of the 'additional_infra_security_group_ids' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional AWS Security Groups to be added to default infra machine pool. +func (o *AWS) AdditionalInfraSecurityGroupIds() []string { + if o != nil && o.bitmap_&128 != 0 { + return o.additionalInfraSecurityGroupIds + } + return nil +} + +// GetAdditionalInfraSecurityGroupIds returns the value of the 'additional_infra_security_group_ids' attribute and +// a flag indicating if the attribute has a value. +// +// Additional AWS Security Groups to be added to default infra machine pool. +func (o *AWS) GetAdditionalInfraSecurityGroupIds() (value []string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.additionalInfraSecurityGroupIds + } + return +} + +// AuditLog returns the value of the 'audit_log' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Audit log forwarding configuration +func (o *AWS) AuditLog() *AuditLog { + if o != nil && o.bitmap_&256 != 0 { + return o.auditLog + } + return nil +} + +// GetAuditLog returns the value of the 'audit_log' attribute and +// a flag indicating if the attribute has a value. +// +// Audit log forwarding configuration +func (o *AWS) GetAuditLog() (value *AuditLog, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.auditLog + } + return +} + +// BillingAccountID returns the value of the 'billing_account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// BillingAccountID is the account used for billing subscriptions purchased via the marketplace +func (o *AWS) BillingAccountID() string { + if o != nil && o.bitmap_&512 != 0 { + return o.billingAccountID + } + return "" +} + +// GetBillingAccountID returns the value of the 'billing_account_ID' attribute and +// a flag indicating if the attribute has a value. +// +// BillingAccountID is the account used for billing subscriptions purchased via the marketplace +func (o *AWS) GetBillingAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.billingAccountID + } + return +} + +// Ec2MetadataHttpTokens returns the value of the 'ec_2_metadata_http_tokens' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances +func (o *AWS) Ec2MetadataHttpTokens() Ec2MetadataHttpTokens { + if o != nil && o.bitmap_&1024 != 0 { + return o.ec2MetadataHttpTokens + } + return Ec2MetadataHttpTokens("") +} + +// GetEc2MetadataHttpTokens returns the value of the 'ec_2_metadata_http_tokens' attribute and +// a flag indicating if the attribute has a value. +// +// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances +func (o *AWS) GetEc2MetadataHttpTokens() (value Ec2MetadataHttpTokens, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.ec2MetadataHttpTokens + } + return +} + +// EtcdEncryption returns the value of the 'etcd_encryption' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Related etcd encryption configuration +func (o *AWS) EtcdEncryption() *AwsEtcdEncryption { + if o != nil && o.bitmap_&2048 != 0 { + return o.etcdEncryption + } + return nil +} + +// GetEtcdEncryption returns the value of the 'etcd_encryption' attribute and +// a flag indicating if the attribute has a value. +// +// Related etcd encryption configuration +func (o *AWS) GetEtcdEncryption() (value *AwsEtcdEncryption, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.etcdEncryption + } + return +} + +// HcpInternalCommunicationHostedZoneId returns the value of the 'hcp_internal_communication_hosted_zone_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID of local private hosted zone for hypershift internal communication. +func (o *AWS) HcpInternalCommunicationHostedZoneId() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.hcpInternalCommunicationHostedZoneId + } + return "" +} + +// GetHcpInternalCommunicationHostedZoneId returns the value of the 'hcp_internal_communication_hosted_zone_id' attribute and +// a flag indicating if the attribute has a value. +// +// ID of local private hosted zone for hypershift internal communication. +func (o *AWS) GetHcpInternalCommunicationHostedZoneId() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.hcpInternalCommunicationHostedZoneId + } + return +} + +// PrivateHostedZoneID returns the value of the 'private_hosted_zone_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID of private hosted zone. +func (o *AWS) PrivateHostedZoneID() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.privateHostedZoneID + } + return "" +} + +// GetPrivateHostedZoneID returns the value of the 'private_hosted_zone_ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID of private hosted zone. +func (o *AWS) GetPrivateHostedZoneID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.privateHostedZoneID + } + return +} + +// PrivateHostedZoneRoleARN returns the value of the 'private_hosted_zone_role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Role ARN for private hosted zone. +func (o *AWS) PrivateHostedZoneRoleARN() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.privateHostedZoneRoleARN + } + return "" +} + +// GetPrivateHostedZoneRoleARN returns the value of the 'private_hosted_zone_role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// Role ARN for private hosted zone. +func (o *AWS) GetPrivateHostedZoneRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.privateHostedZoneRoleARN + } + return +} + +// PrivateLink returns the value of the 'private_link' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Sets cluster to be inaccessible externally. +func (o *AWS) PrivateLink() bool { + if o != nil && o.bitmap_&32768 != 0 { + return o.privateLink + } + return false +} + +// GetPrivateLink returns the value of the 'private_link' attribute and +// a flag indicating if the attribute has a value. +// +// Sets cluster to be inaccessible externally. +func (o *AWS) GetPrivateLink() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.privateLink + } + return +} + +// PrivateLinkConfiguration returns the value of the 'private_link_configuration' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Manages additional configuration for Private Links. +func (o *AWS) PrivateLinkConfiguration() *PrivateLinkClusterConfiguration { + if o != nil && o.bitmap_&65536 != 0 { + return o.privateLinkConfiguration + } + return nil +} + +// GetPrivateLinkConfiguration returns the value of the 'private_link_configuration' attribute and +// a flag indicating if the attribute has a value. +// +// Manages additional configuration for Private Links. +func (o *AWS) GetPrivateLinkConfiguration() (value *PrivateLinkClusterConfiguration, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.privateLinkConfiguration + } + return +} + +// SecretAccessKey returns the value of the 'secret_access_key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS secret access key. +func (o *AWS) SecretAccessKey() string { + if o != nil && o.bitmap_&131072 != 0 { + return o.secretAccessKey + } + return "" +} + +// GetSecretAccessKey returns the value of the 'secret_access_key' attribute and +// a flag indicating if the attribute has a value. +// +// AWS secret access key. +func (o *AWS) GetSecretAccessKey() (value string, ok bool) { + ok = o != nil && o.bitmap_&131072 != 0 + if ok { + value = o.secretAccessKey + } + return +} + +// SubnetIDs returns the value of the 'subnet_IDs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The subnet ids to be used when installing the cluster. +func (o *AWS) SubnetIDs() []string { + if o != nil && o.bitmap_&262144 != 0 { + return o.subnetIDs + } + return nil +} + +// GetSubnetIDs returns the value of the 'subnet_IDs' attribute and +// a flag indicating if the attribute has a value. +// +// The subnet ids to be used when installing the cluster. +func (o *AWS) GetSubnetIDs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&262144 != 0 + if ok { + value = o.subnetIDs + } + return +} + +// Tags returns the value of the 'tags' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional keys and values that the installer will add as tags to all AWS resources it creates +func (o *AWS) Tags() map[string]string { + if o != nil && o.bitmap_&524288 != 0 { + return o.tags + } + return nil +} + +// GetTags returns the value of the 'tags' attribute and +// a flag indicating if the attribute has a value. +// +// Optional keys and values that the installer will add as tags to all AWS resources it creates +func (o *AWS) GetTags() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&524288 != 0 + if ok { + value = o.tags + } + return +} + +// VpcEndpointRoleArn returns the value of the 'vpc_endpoint_role_arn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Role ARN for VPC Endpoint Service cross account role. +func (o *AWS) VpcEndpointRoleArn() string { + if o != nil && o.bitmap_&1048576 != 0 { + return o.vpcEndpointRoleArn + } + return "" +} + +// GetVpcEndpointRoleArn returns the value of the 'vpc_endpoint_role_arn' attribute and +// a flag indicating if the attribute has a value. +// +// Role ARN for VPC Endpoint Service cross account role. +func (o *AWS) GetVpcEndpointRoleArn() (value string, ok bool) { + ok = o != nil && o.bitmap_&1048576 != 0 + if ok { + value = o.vpcEndpointRoleArn + } + return +} + +// AWSListKind is the name of the type used to represent list of objects of +// type 'AWS'. +const AWSListKind = "AWSList" + +// AWSListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS'. +const AWSListLinkKind = "AWSListLink" + +// AWSNilKind is the name of the type used to nil lists of objects of +// type 'AWS'. +const AWSListNilKind = "AWSListNil" + +// AWSList is a list of values of the 'AWS' type. +type AWSList struct { + href string + link bool + items []*AWS +} + +// Len returns the length of the list. +func (l *AWSList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSList) SetItems(items []*AWS) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSList) Items() []*AWS { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSList) Get(i int) *AWS { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSList) Slice() []*AWS { + var slice []*AWS + if l == nil { + slice = make([]*AWS, 0) + } else { + slice = make([]*AWS, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSList) Each(f func(item *AWS) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSList) Range(f func(index int, item *AWS) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/aws_type_json.go b/clientapi/clustersmgmt/v1/aws_type_json.go new file mode 100644 index 00000000..895f6fa8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_type_json.go @@ -0,0 +1,376 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWS writes a value of the 'AWS' type to the given writer. +func MarshalAWS(object *AWS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWS(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWS writes a value of the 'AWS' type to the given stream. +func WriteAWS(object *AWS, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kms_key_arn") + stream.WriteString(object.kmsKeyArn) + count++ + } + present_ = object.bitmap_&2 != 0 && object.sts != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sts") + WriteSTS(object.sts, stream) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("access_key_id") + stream.WriteString(object.accessKeyID) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_id") + stream.WriteString(object.accountID) + count++ + } + present_ = object.bitmap_&16 != 0 && object.additionalAllowedPrincipals != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_allowed_principals") + WriteStringList(object.additionalAllowedPrincipals, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.additionalComputeSecurityGroupIds != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_compute_security_group_ids") + WriteStringList(object.additionalComputeSecurityGroupIds, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.additionalControlPlaneSecurityGroupIds != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_control_plane_security_group_ids") + WriteStringList(object.additionalControlPlaneSecurityGroupIds, stream) + count++ + } + present_ = object.bitmap_&128 != 0 && object.additionalInfraSecurityGroupIds != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_infra_security_group_ids") + WriteStringList(object.additionalInfraSecurityGroupIds, stream) + count++ + } + present_ = object.bitmap_&256 != 0 && object.auditLog != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("audit_log") + WriteAuditLog(object.auditLog, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_account_id") + stream.WriteString(object.billingAccountID) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ec2_metadata_http_tokens") + stream.WriteString(string(object.ec2MetadataHttpTokens)) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.etcdEncryption != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("etcd_encryption") + WriteAwsEtcdEncryption(object.etcdEncryption, stream) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hcp_internal_communication_hosted_zone_id") + stream.WriteString(object.hcpInternalCommunicationHostedZoneId) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_hosted_zone_id") + stream.WriteString(object.privateHostedZoneID) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_hosted_zone_role_arn") + stream.WriteString(object.privateHostedZoneRoleARN) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_link") + stream.WriteBool(object.privateLink) + count++ + } + present_ = object.bitmap_&65536 != 0 && object.privateLinkConfiguration != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_link_configuration") + WritePrivateLinkClusterConfiguration(object.privateLinkConfiguration, stream) + count++ + } + present_ = object.bitmap_&131072 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("secret_access_key") + stream.WriteString(object.secretAccessKey) + count++ + } + present_ = object.bitmap_&262144 != 0 && object.subnetIDs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnet_ids") + WriteStringList(object.subnetIDs, stream) + count++ + } + present_ = object.bitmap_&524288 != 0 && object.tags != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("tags") + if object.tags != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.tags)) + i := 0 + for key := range object.tags { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.tags[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&1048576 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("vpc_endpoint_role_arn") + stream.WriteString(object.vpcEndpointRoleArn) + } + stream.WriteObjectEnd() +} + +// UnmarshalAWS reads a value of the 'AWS' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWS(source interface{}) (object *AWS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWS(iterator) + err = iterator.Error + return +} + +// ReadAWS reads a value of the 'AWS' type from the given iterator. +func ReadAWS(iterator *jsoniter.Iterator) *AWS { + object := &AWS{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kms_key_arn": + value := iterator.ReadString() + object.kmsKeyArn = value + object.bitmap_ |= 1 + case "sts": + value := ReadSTS(iterator) + object.sts = value + object.bitmap_ |= 2 + case "access_key_id": + value := iterator.ReadString() + object.accessKeyID = value + object.bitmap_ |= 4 + case "account_id": + value := iterator.ReadString() + object.accountID = value + object.bitmap_ |= 8 + case "additional_allowed_principals": + value := ReadStringList(iterator) + object.additionalAllowedPrincipals = value + object.bitmap_ |= 16 + case "additional_compute_security_group_ids": + value := ReadStringList(iterator) + object.additionalComputeSecurityGroupIds = value + object.bitmap_ |= 32 + case "additional_control_plane_security_group_ids": + value := ReadStringList(iterator) + object.additionalControlPlaneSecurityGroupIds = value + object.bitmap_ |= 64 + case "additional_infra_security_group_ids": + value := ReadStringList(iterator) + object.additionalInfraSecurityGroupIds = value + object.bitmap_ |= 128 + case "audit_log": + value := ReadAuditLog(iterator) + object.auditLog = value + object.bitmap_ |= 256 + case "billing_account_id": + value := iterator.ReadString() + object.billingAccountID = value + object.bitmap_ |= 512 + case "ec2_metadata_http_tokens": + text := iterator.ReadString() + value := Ec2MetadataHttpTokens(text) + object.ec2MetadataHttpTokens = value + object.bitmap_ |= 1024 + case "etcd_encryption": + value := ReadAwsEtcdEncryption(iterator) + object.etcdEncryption = value + object.bitmap_ |= 2048 + case "hcp_internal_communication_hosted_zone_id": + value := iterator.ReadString() + object.hcpInternalCommunicationHostedZoneId = value + object.bitmap_ |= 4096 + case "private_hosted_zone_id": + value := iterator.ReadString() + object.privateHostedZoneID = value + object.bitmap_ |= 8192 + case "private_hosted_zone_role_arn": + value := iterator.ReadString() + object.privateHostedZoneRoleARN = value + object.bitmap_ |= 16384 + case "private_link": + value := iterator.ReadBool() + object.privateLink = value + object.bitmap_ |= 32768 + case "private_link_configuration": + value := ReadPrivateLinkClusterConfiguration(iterator) + object.privateLinkConfiguration = value + object.bitmap_ |= 65536 + case "secret_access_key": + value := iterator.ReadString() + object.secretAccessKey = value + object.bitmap_ |= 131072 + case "subnet_ids": + value := ReadStringList(iterator) + object.subnetIDs = value + object.bitmap_ |= 262144 + case "tags": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.tags = value + object.bitmap_ |= 524288 + case "vpc_endpoint_role_arn": + value := iterator.ReadString() + object.vpcEndpointRoleArn = value + object.bitmap_ |= 1048576 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/aws_volume_builder.go b/clientapi/clustersmgmt/v1/aws_volume_builder.go new file mode 100644 index 00000000..a706b5b5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_volume_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSVolumeBuilder contains the data and logic needed to build 'AWS_volume' objects. +// +// Holds settings for an AWS storage volume. +type AWSVolumeBuilder struct { + bitmap_ uint32 + iops int + size int +} + +// NewAWSVolume creates a new builder of 'AWS_volume' objects. +func NewAWSVolume() *AWSVolumeBuilder { + return &AWSVolumeBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSVolumeBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// IOPS sets the value of the 'IOPS' attribute to the given value. +func (b *AWSVolumeBuilder) IOPS(value int) *AWSVolumeBuilder { + b.iops = value + b.bitmap_ |= 1 + return b +} + +// Size sets the value of the 'size' attribute to the given value. +func (b *AWSVolumeBuilder) Size(value int) *AWSVolumeBuilder { + b.size = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSVolumeBuilder) Copy(object *AWSVolume) *AWSVolumeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.iops = object.iops + b.size = object.size + return b +} + +// Build creates a 'AWS_volume' object using the configuration stored in the builder. +func (b *AWSVolumeBuilder) Build() (object *AWSVolume, err error) { + object = new(AWSVolume) + object.bitmap_ = b.bitmap_ + object.iops = b.iops + object.size = b.size + return +} diff --git a/clientapi/clustersmgmt/v1/aws_volume_list_builder.go b/clientapi/clustersmgmt/v1/aws_volume_list_builder.go new file mode 100644 index 00000000..99d431ac --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_volume_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSVolumeListBuilder contains the data and logic needed to build +// 'AWS_volume' objects. +type AWSVolumeListBuilder struct { + items []*AWSVolumeBuilder +} + +// NewAWSVolumeList creates a new builder of 'AWS_volume' objects. +func NewAWSVolumeList() *AWSVolumeListBuilder { + return new(AWSVolumeListBuilder) +} + +// Items sets the items of the list. +func (b *AWSVolumeListBuilder) Items(values ...*AWSVolumeBuilder) *AWSVolumeListBuilder { + b.items = make([]*AWSVolumeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSVolumeListBuilder) 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 *AWSVolumeListBuilder) Copy(list *AWSVolumeList) *AWSVolumeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSVolumeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSVolume().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS_volume' objects using the +// configuration stored in the builder. +func (b *AWSVolumeListBuilder) Build() (list *AWSVolumeList, err error) { + items := make([]*AWSVolume, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSVolumeList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/aws_volume_list_type_json.go b/clientapi/clustersmgmt/v1/aws_volume_list_type_json.go new file mode 100644 index 00000000..c89de9f4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_volume_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSVolumeList writes a list of values of the 'AWS_volume' type to +// the given writer. +func MarshalAWSVolumeList(list []*AWSVolume, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSVolumeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSVolumeList writes a list of value of the 'AWS_volume' type to +// the given stream. +func WriteAWSVolumeList(list []*AWSVolume, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSVolume(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSVolumeList reads a list of values of the 'AWS_volume' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSVolumeList(source interface{}) (items []*AWSVolume, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSVolumeList(iterator) + err = iterator.Error + return +} + +// ReadAWSVolumeList reads list of values of the ”AWS_volume' type from +// the given iterator. +func ReadAWSVolumeList(iterator *jsoniter.Iterator) []*AWSVolume { + list := []*AWSVolume{} + for iterator.ReadArray() { + item := ReadAWSVolume(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/aws_volume_type.go b/clientapi/clustersmgmt/v1/aws_volume_type.go new file mode 100644 index 00000000..3b5023a9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_volume_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSVolume represents the values of the 'AWS_volume' type. +// +// Holds settings for an AWS storage volume. +type AWSVolume struct { + bitmap_ uint32 + iops int + size int +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSVolume) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// IOPS returns the value of the 'IOPS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Volume provisioned IOPS. +func (o *AWSVolume) IOPS() int { + if o != nil && o.bitmap_&1 != 0 { + return o.iops + } + return 0 +} + +// GetIOPS returns the value of the 'IOPS' attribute and +// a flag indicating if the attribute has a value. +// +// Volume provisioned IOPS. +func (o *AWSVolume) GetIOPS() (value int, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.iops + } + return +} + +// Size returns the value of the 'size' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Volume size in Gib. +func (o *AWSVolume) Size() int { + if o != nil && o.bitmap_&2 != 0 { + return o.size + } + return 0 +} + +// GetSize returns the value of the 'size' attribute and +// a flag indicating if the attribute has a value. +// +// Volume size in Gib. +func (o *AWSVolume) GetSize() (value int, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.size + } + return +} + +// AWSVolumeListKind is the name of the type used to represent list of objects of +// type 'AWS_volume'. +const AWSVolumeListKind = "AWSVolumeList" + +// AWSVolumeListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS_volume'. +const AWSVolumeListLinkKind = "AWSVolumeListLink" + +// AWSVolumeNilKind is the name of the type used to nil lists of objects of +// type 'AWS_volume'. +const AWSVolumeListNilKind = "AWSVolumeListNil" + +// AWSVolumeList is a list of values of the 'AWS_volume' type. +type AWSVolumeList struct { + href string + link bool + items []*AWSVolume +} + +// Len returns the length of the list. +func (l *AWSVolumeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSVolumeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSVolumeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSVolumeList) SetItems(items []*AWSVolume) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSVolumeList) Items() []*AWSVolume { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSVolumeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSVolumeList) Get(i int) *AWSVolume { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSVolumeList) Slice() []*AWSVolume { + var slice []*AWSVolume + if l == nil { + slice = make([]*AWSVolume, 0) + } else { + slice = make([]*AWSVolume, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSVolumeList) Each(f func(item *AWSVolume) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSVolumeList) Range(f func(index int, item *AWSVolume) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/aws_volume_type_json.go b/clientapi/clustersmgmt/v1/aws_volume_type_json.go new file mode 100644 index 00000000..65baa6f0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/aws_volume_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSVolume writes a value of the 'AWS_volume' type to the given writer. +func MarshalAWSVolume(object *AWSVolume, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSVolume(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSVolume writes a value of the 'AWS_volume' type to the given stream. +func WriteAWSVolume(object *AWSVolume, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("iops") + stream.WriteInt(object.iops) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("size") + stream.WriteInt(object.size) + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSVolume reads a value of the 'AWS_volume' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSVolume(source interface{}) (object *AWSVolume, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSVolume(iterator) + err = iterator.Error + return +} + +// ReadAWSVolume reads a value of the 'AWS_volume' type from the given iterator. +func ReadAWSVolume(iterator *jsoniter.Iterator) *AWSVolume { + object := &AWSVolume{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "iops": + value := iterator.ReadInt() + object.iops = value + object.bitmap_ |= 1 + case "size": + value := iterator.ReadInt() + object.size = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/awssts_account_role_builder.go b/clientapi/clustersmgmt/v1/awssts_account_role_builder.go new file mode 100644 index 00000000..511c45e7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_account_role_builder.go @@ -0,0 +1,89 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSSTSAccountRoleBuilder contains the data and logic needed to build 'AWSSTS_account_role' objects. +// +// Representation of an sts account role for a rosa cluster +type AWSSTSAccountRoleBuilder struct { + bitmap_ uint32 + items []*AWSSTSRoleBuilder + prefix string +} + +// NewAWSSTSAccountRole creates a new builder of 'AWSSTS_account_role' objects. +func NewAWSSTSAccountRole() *AWSSTSAccountRoleBuilder { + return &AWSSTSAccountRoleBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSSTSAccountRoleBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Items sets the value of the 'items' attribute to the given values. +func (b *AWSSTSAccountRoleBuilder) Items(values ...*AWSSTSRoleBuilder) *AWSSTSAccountRoleBuilder { + b.items = make([]*AWSSTSRoleBuilder, len(values)) + copy(b.items, values) + b.bitmap_ |= 1 + return b +} + +// Prefix sets the value of the 'prefix' attribute to the given value. +func (b *AWSSTSAccountRoleBuilder) Prefix(value string) *AWSSTSAccountRoleBuilder { + b.prefix = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSSTSAccountRoleBuilder) Copy(object *AWSSTSAccountRole) *AWSSTSAccountRoleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.items != nil { + b.items = make([]*AWSSTSRoleBuilder, len(object.items)) + for i, v := range object.items { + b.items[i] = NewAWSSTSRole().Copy(v) + } + } else { + b.items = nil + } + b.prefix = object.prefix + return b +} + +// Build creates a 'AWSSTS_account_role' object using the configuration stored in the builder. +func (b *AWSSTSAccountRoleBuilder) Build() (object *AWSSTSAccountRole, err error) { + object = new(AWSSTSAccountRole) + object.bitmap_ = b.bitmap_ + if b.items != nil { + object.items = make([]*AWSSTSRole, len(b.items)) + for i, v := range b.items { + object.items[i], err = v.Build() + if err != nil { + return + } + } + } + object.prefix = b.prefix + return +} diff --git a/clientapi/clustersmgmt/v1/awssts_account_role_list_builder.go b/clientapi/clustersmgmt/v1/awssts_account_role_list_builder.go new file mode 100644 index 00000000..0831d871 --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_account_role_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSSTSAccountRoleListBuilder contains the data and logic needed to build +// 'AWSSTS_account_role' objects. +type AWSSTSAccountRoleListBuilder struct { + items []*AWSSTSAccountRoleBuilder +} + +// NewAWSSTSAccountRoleList creates a new builder of 'AWSSTS_account_role' objects. +func NewAWSSTSAccountRoleList() *AWSSTSAccountRoleListBuilder { + return new(AWSSTSAccountRoleListBuilder) +} + +// Items sets the items of the list. +func (b *AWSSTSAccountRoleListBuilder) Items(values ...*AWSSTSAccountRoleBuilder) *AWSSTSAccountRoleListBuilder { + b.items = make([]*AWSSTSAccountRoleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSSTSAccountRoleListBuilder) 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 *AWSSTSAccountRoleListBuilder) Copy(list *AWSSTSAccountRoleList) *AWSSTSAccountRoleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSSTSAccountRoleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSSTSAccountRole().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWSSTS_account_role' objects using the +// configuration stored in the builder. +func (b *AWSSTSAccountRoleListBuilder) Build() (list *AWSSTSAccountRoleList, err error) { + items := make([]*AWSSTSAccountRole, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSSTSAccountRoleList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/awssts_account_role_list_type_json.go b/clientapi/clustersmgmt/v1/awssts_account_role_list_type_json.go new file mode 100644 index 00000000..91153584 --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_account_role_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSSTSAccountRoleList writes a list of values of the 'AWSSTS_account_role' type to +// the given writer. +func MarshalAWSSTSAccountRoleList(list []*AWSSTSAccountRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSSTSAccountRoleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSSTSAccountRoleList writes a list of value of the 'AWSSTS_account_role' type to +// the given stream. +func WriteAWSSTSAccountRoleList(list []*AWSSTSAccountRole, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSSTSAccountRole(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSSTSAccountRoleList reads a list of values of the 'AWSSTS_account_role' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSSTSAccountRoleList(source interface{}) (items []*AWSSTSAccountRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSSTSAccountRoleList(iterator) + err = iterator.Error + return +} + +// ReadAWSSTSAccountRoleList reads list of values of the ”AWSSTS_account_role' type from +// the given iterator. +func ReadAWSSTSAccountRoleList(iterator *jsoniter.Iterator) []*AWSSTSAccountRole { + list := []*AWSSTSAccountRole{} + for iterator.ReadArray() { + item := ReadAWSSTSAccountRole(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/awssts_account_role_type.go b/clientapi/clustersmgmt/v1/awssts_account_role_type.go new file mode 100644 index 00000000..d63b552a --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_account_role_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSSTSAccountRole represents the values of the 'AWSSTS_account_role' type. +// +// Representation of an sts account role for a rosa cluster +type AWSSTSAccountRole struct { + bitmap_ uint32 + items []*AWSSTSRole + prefix string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSSTSAccountRole) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Items returns the value of the 'items' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The list of STS Roles for this Account Role +func (o *AWSSTSAccountRole) Items() []*AWSSTSRole { + if o != nil && o.bitmap_&1 != 0 { + return o.items + } + return nil +} + +// GetItems returns the value of the 'items' attribute and +// a flag indicating if the attribute has a value. +// +// The list of STS Roles for this Account Role +func (o *AWSSTSAccountRole) GetItems() (value []*AWSSTSRole, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.items + } + return +} + +// Prefix returns the value of the 'prefix' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Prefix for this Account Role +func (o *AWSSTSAccountRole) Prefix() string { + if o != nil && o.bitmap_&2 != 0 { + return o.prefix + } + return "" +} + +// GetPrefix returns the value of the 'prefix' attribute and +// a flag indicating if the attribute has a value. +// +// The Prefix for this Account Role +func (o *AWSSTSAccountRole) GetPrefix() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.prefix + } + return +} + +// AWSSTSAccountRoleListKind is the name of the type used to represent list of objects of +// type 'AWSSTS_account_role'. +const AWSSTSAccountRoleListKind = "AWSSTSAccountRoleList" + +// AWSSTSAccountRoleListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWSSTS_account_role'. +const AWSSTSAccountRoleListLinkKind = "AWSSTSAccountRoleListLink" + +// AWSSTSAccountRoleNilKind is the name of the type used to nil lists of objects of +// type 'AWSSTS_account_role'. +const AWSSTSAccountRoleListNilKind = "AWSSTSAccountRoleListNil" + +// AWSSTSAccountRoleList is a list of values of the 'AWSSTS_account_role' type. +type AWSSTSAccountRoleList struct { + href string + link bool + items []*AWSSTSAccountRole +} + +// Len returns the length of the list. +func (l *AWSSTSAccountRoleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSSTSAccountRoleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSSTSAccountRoleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSSTSAccountRoleList) SetItems(items []*AWSSTSAccountRole) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSSTSAccountRoleList) Items() []*AWSSTSAccountRole { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSSTSAccountRoleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSSTSAccountRoleList) Get(i int) *AWSSTSAccountRole { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSSTSAccountRoleList) Slice() []*AWSSTSAccountRole { + var slice []*AWSSTSAccountRole + if l == nil { + slice = make([]*AWSSTSAccountRole, 0) + } else { + slice = make([]*AWSSTSAccountRole, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSSTSAccountRoleList) Each(f func(item *AWSSTSAccountRole) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSSTSAccountRoleList) Range(f func(index int, item *AWSSTSAccountRole) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/awssts_account_role_type_json.go b/clientapi/clustersmgmt/v1/awssts_account_role_type_json.go new file mode 100644 index 00000000..6488bc8d --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_account_role_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSSTSAccountRole writes a value of the 'AWSSTS_account_role' type to the given writer. +func MarshalAWSSTSAccountRole(object *AWSSTSAccountRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSSTSAccountRole(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSSTSAccountRole writes a value of the 'AWSSTS_account_role' type to the given stream. +func WriteAWSSTSAccountRole(object *AWSSTSAccountRole, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.items != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("items") + WriteAWSSTSRoleList(object.items, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("prefix") + stream.WriteString(object.prefix) + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSSTSAccountRole reads a value of the 'AWSSTS_account_role' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSSTSAccountRole(source interface{}) (object *AWSSTSAccountRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSSTSAccountRole(iterator) + err = iterator.Error + return +} + +// ReadAWSSTSAccountRole reads a value of the 'AWSSTS_account_role' type from the given iterator. +func ReadAWSSTSAccountRole(iterator *jsoniter.Iterator) *AWSSTSAccountRole { + object := &AWSSTSAccountRole{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "items": + value := ReadAWSSTSRoleList(iterator) + object.items = value + object.bitmap_ |= 1 + case "prefix": + value := iterator.ReadString() + object.prefix = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/awssts_policy_builder.go b/clientapi/clustersmgmt/v1/awssts_policy_builder.go new file mode 100644 index 00000000..d24840d4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_policy_builder.go @@ -0,0 +1,93 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSSTSPolicyBuilder contains the data and logic needed to build 'AWSSTS_policy' objects. +// +// Representation of an sts policies for rosa cluster +type AWSSTSPolicyBuilder struct { + bitmap_ uint32 + arn string + id string + details string + type_ string +} + +// NewAWSSTSPolicy creates a new builder of 'AWSSTS_policy' objects. +func NewAWSSTSPolicy() *AWSSTSPolicyBuilder { + return &AWSSTSPolicyBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSSTSPolicyBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ARN sets the value of the 'ARN' attribute to the given value. +func (b *AWSSTSPolicyBuilder) ARN(value string) *AWSSTSPolicyBuilder { + b.arn = value + b.bitmap_ |= 1 + return b +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *AWSSTSPolicyBuilder) ID(value string) *AWSSTSPolicyBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// Details sets the value of the 'details' attribute to the given value. +func (b *AWSSTSPolicyBuilder) Details(value string) *AWSSTSPolicyBuilder { + b.details = value + b.bitmap_ |= 4 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *AWSSTSPolicyBuilder) Type(value string) *AWSSTSPolicyBuilder { + b.type_ = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSSTSPolicyBuilder) Copy(object *AWSSTSPolicy) *AWSSTSPolicyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.arn = object.arn + b.id = object.id + b.details = object.details + b.type_ = object.type_ + return b +} + +// Build creates a 'AWSSTS_policy' object using the configuration stored in the builder. +func (b *AWSSTSPolicyBuilder) Build() (object *AWSSTSPolicy, err error) { + object = new(AWSSTSPolicy) + object.bitmap_ = b.bitmap_ + object.arn = b.arn + object.id = b.id + object.details = b.details + object.type_ = b.type_ + return +} diff --git a/clientapi/clustersmgmt/v1/awssts_policy_list_builder.go b/clientapi/clustersmgmt/v1/awssts_policy_list_builder.go new file mode 100644 index 00000000..c4171868 --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_policy_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSSTSPolicyListBuilder contains the data and logic needed to build +// 'AWSSTS_policy' objects. +type AWSSTSPolicyListBuilder struct { + items []*AWSSTSPolicyBuilder +} + +// NewAWSSTSPolicyList creates a new builder of 'AWSSTS_policy' objects. +func NewAWSSTSPolicyList() *AWSSTSPolicyListBuilder { + return new(AWSSTSPolicyListBuilder) +} + +// Items sets the items of the list. +func (b *AWSSTSPolicyListBuilder) Items(values ...*AWSSTSPolicyBuilder) *AWSSTSPolicyListBuilder { + b.items = make([]*AWSSTSPolicyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSSTSPolicyListBuilder) 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 *AWSSTSPolicyListBuilder) Copy(list *AWSSTSPolicyList) *AWSSTSPolicyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSSTSPolicyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSSTSPolicy().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWSSTS_policy' objects using the +// configuration stored in the builder. +func (b *AWSSTSPolicyListBuilder) Build() (list *AWSSTSPolicyList, err error) { + items := make([]*AWSSTSPolicy, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSSTSPolicyList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/awssts_policy_list_type_json.go b/clientapi/clustersmgmt/v1/awssts_policy_list_type_json.go new file mode 100644 index 00000000..7506905e --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_policy_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSSTSPolicyList writes a list of values of the 'AWSSTS_policy' type to +// the given writer. +func MarshalAWSSTSPolicyList(list []*AWSSTSPolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSSTSPolicyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSSTSPolicyList writes a list of value of the 'AWSSTS_policy' type to +// the given stream. +func WriteAWSSTSPolicyList(list []*AWSSTSPolicy, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSSTSPolicy(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSSTSPolicyList reads a list of values of the 'AWSSTS_policy' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSSTSPolicyList(source interface{}) (items []*AWSSTSPolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSSTSPolicyList(iterator) + err = iterator.Error + return +} + +// ReadAWSSTSPolicyList reads list of values of the ”AWSSTS_policy' type from +// the given iterator. +func ReadAWSSTSPolicyList(iterator *jsoniter.Iterator) []*AWSSTSPolicy { + list := []*AWSSTSPolicy{} + for iterator.ReadArray() { + item := ReadAWSSTSPolicy(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/awssts_policy_type.go b/clientapi/clustersmgmt/v1/awssts_policy_type.go new file mode 100644 index 00000000..be9025a9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_policy_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSSTSPolicy represents the values of the 'AWSSTS_policy' type. +// +// Representation of an sts policies for rosa cluster +type AWSSTSPolicy struct { + bitmap_ uint32 + arn string + id string + details string + type_ string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSSTSPolicy) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ARN returns the value of the 'ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The ARN of the managed policy +func (o *AWSSTSPolicy) ARN() string { + if o != nil && o.bitmap_&1 != 0 { + return o.arn + } + return "" +} + +// GetARN returns the value of the 'ARN' attribute and +// a flag indicating if the attribute has a value. +// +// The ARN of the managed policy +func (o *AWSSTSPolicy) GetARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.arn + } + return +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Policy ID +func (o *AWSSTSPolicy) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// Policy ID +func (o *AWSSTSPolicy) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// Details returns the value of the 'details' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Policy Details +func (o *AWSSTSPolicy) Details() string { + if o != nil && o.bitmap_&4 != 0 { + return o.details + } + return "" +} + +// GetDetails returns the value of the 'details' attribute and +// a flag indicating if the attribute has a value. +// +// Policy Details +func (o *AWSSTSPolicy) GetDetails() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.details + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of policy operator/account role +func (o *AWSSTSPolicy) Type() string { + if o != nil && o.bitmap_&8 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of policy operator/account role +func (o *AWSSTSPolicy) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.type_ + } + return +} + +// AWSSTSPolicyListKind is the name of the type used to represent list of objects of +// type 'AWSSTS_policy'. +const AWSSTSPolicyListKind = "AWSSTSPolicyList" + +// AWSSTSPolicyListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWSSTS_policy'. +const AWSSTSPolicyListLinkKind = "AWSSTSPolicyListLink" + +// AWSSTSPolicyNilKind is the name of the type used to nil lists of objects of +// type 'AWSSTS_policy'. +const AWSSTSPolicyListNilKind = "AWSSTSPolicyListNil" + +// AWSSTSPolicyList is a list of values of the 'AWSSTS_policy' type. +type AWSSTSPolicyList struct { + href string + link bool + items []*AWSSTSPolicy +} + +// Len returns the length of the list. +func (l *AWSSTSPolicyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSSTSPolicyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSSTSPolicyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSSTSPolicyList) SetItems(items []*AWSSTSPolicy) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSSTSPolicyList) Items() []*AWSSTSPolicy { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSSTSPolicyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSSTSPolicyList) Get(i int) *AWSSTSPolicy { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSSTSPolicyList) Slice() []*AWSSTSPolicy { + var slice []*AWSSTSPolicy + if l == nil { + slice = make([]*AWSSTSPolicy, 0) + } else { + slice = make([]*AWSSTSPolicy, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSSTSPolicyList) Each(f func(item *AWSSTSPolicy) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSSTSPolicyList) Range(f func(index int, item *AWSSTSPolicy) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/awssts_policy_type_json.go b/clientapi/clustersmgmt/v1/awssts_policy_type_json.go new file mode 100644 index 00000000..e4b89ba1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_policy_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSSTSPolicy writes a value of the 'AWSSTS_policy' type to the given writer. +func MarshalAWSSTSPolicy(object *AWSSTSPolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSSTSPolicy(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSSTSPolicy writes a value of the 'AWSSTS_policy' type to the given stream. +func WriteAWSSTSPolicy(object *AWSSTSPolicy, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("arn") + stream.WriteString(object.arn) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("details") + stream.WriteString(object.details) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSSTSPolicy reads a value of the 'AWSSTS_policy' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSSTSPolicy(source interface{}) (object *AWSSTSPolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSSTSPolicy(iterator) + err = iterator.Error + return +} + +// ReadAWSSTSPolicy reads a value of the 'AWSSTS_policy' type from the given iterator. +func ReadAWSSTSPolicy(iterator *jsoniter.Iterator) *AWSSTSPolicy { + object := &AWSSTSPolicy{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "arn": + value := iterator.ReadString() + object.arn = value + object.bitmap_ |= 1 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 2 + case "details": + value := iterator.ReadString() + object.details = value + object.bitmap_ |= 4 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/awssts_role_builder.go b/clientapi/clustersmgmt/v1/awssts_role_builder.go new file mode 100644 index 00000000..56a55645 --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_role_builder.go @@ -0,0 +1,113 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSSTSRoleBuilder contains the data and logic needed to build 'AWSSTS_role' objects. +// +// Representation of an sts role for a rosa cluster +type AWSSTSRoleBuilder struct { + bitmap_ uint32 + roleARN string + roleType string + roleVersion string + hcpManagedPolicies bool + isAdmin bool + managedPolicies bool +} + +// NewAWSSTSRole creates a new builder of 'AWSSTS_role' objects. +func NewAWSSTSRole() *AWSSTSRoleBuilder { + return &AWSSTSRoleBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSSTSRoleBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// HcpManagedPolicies sets the value of the 'hcp_managed_policies' attribute to the given value. +func (b *AWSSTSRoleBuilder) HcpManagedPolicies(value bool) *AWSSTSRoleBuilder { + b.hcpManagedPolicies = value + b.bitmap_ |= 1 + return b +} + +// IsAdmin sets the value of the 'is_admin' attribute to the given value. +func (b *AWSSTSRoleBuilder) IsAdmin(value bool) *AWSSTSRoleBuilder { + b.isAdmin = value + b.bitmap_ |= 2 + return b +} + +// ManagedPolicies sets the value of the 'managed_policies' attribute to the given value. +func (b *AWSSTSRoleBuilder) ManagedPolicies(value bool) *AWSSTSRoleBuilder { + b.managedPolicies = value + b.bitmap_ |= 4 + return b +} + +// RoleARN sets the value of the 'role_ARN' attribute to the given value. +func (b *AWSSTSRoleBuilder) RoleARN(value string) *AWSSTSRoleBuilder { + b.roleARN = value + b.bitmap_ |= 8 + return b +} + +// RoleType sets the value of the 'role_type' attribute to the given value. +func (b *AWSSTSRoleBuilder) RoleType(value string) *AWSSTSRoleBuilder { + b.roleType = value + b.bitmap_ |= 16 + return b +} + +// RoleVersion sets the value of the 'role_version' attribute to the given value. +func (b *AWSSTSRoleBuilder) RoleVersion(value string) *AWSSTSRoleBuilder { + b.roleVersion = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSSTSRoleBuilder) Copy(object *AWSSTSRole) *AWSSTSRoleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.hcpManagedPolicies = object.hcpManagedPolicies + b.isAdmin = object.isAdmin + b.managedPolicies = object.managedPolicies + b.roleARN = object.roleARN + b.roleType = object.roleType + b.roleVersion = object.roleVersion + return b +} + +// Build creates a 'AWSSTS_role' object using the configuration stored in the builder. +func (b *AWSSTSRoleBuilder) Build() (object *AWSSTSRole, err error) { + object = new(AWSSTSRole) + object.bitmap_ = b.bitmap_ + object.hcpManagedPolicies = b.hcpManagedPolicies + object.isAdmin = b.isAdmin + object.managedPolicies = b.managedPolicies + object.roleARN = b.roleARN + object.roleType = b.roleType + object.roleVersion = b.roleVersion + return +} diff --git a/clientapi/clustersmgmt/v1/awssts_role_list_builder.go b/clientapi/clustersmgmt/v1/awssts_role_list_builder.go new file mode 100644 index 00000000..4e3636d4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_role_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSSTSRoleListBuilder contains the data and logic needed to build +// 'AWSSTS_role' objects. +type AWSSTSRoleListBuilder struct { + items []*AWSSTSRoleBuilder +} + +// NewAWSSTSRoleList creates a new builder of 'AWSSTS_role' objects. +func NewAWSSTSRoleList() *AWSSTSRoleListBuilder { + return new(AWSSTSRoleListBuilder) +} + +// Items sets the items of the list. +func (b *AWSSTSRoleListBuilder) Items(values ...*AWSSTSRoleBuilder) *AWSSTSRoleListBuilder { + b.items = make([]*AWSSTSRoleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSSTSRoleListBuilder) 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 *AWSSTSRoleListBuilder) Copy(list *AWSSTSRoleList) *AWSSTSRoleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSSTSRoleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWSSTSRole().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWSSTS_role' objects using the +// configuration stored in the builder. +func (b *AWSSTSRoleListBuilder) Build() (list *AWSSTSRoleList, err error) { + items := make([]*AWSSTSRole, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSSTSRoleList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/awssts_role_list_type_json.go b/clientapi/clustersmgmt/v1/awssts_role_list_type_json.go new file mode 100644 index 00000000..fb818135 --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_role_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSSTSRoleList writes a list of values of the 'AWSSTS_role' type to +// the given writer. +func MarshalAWSSTSRoleList(list []*AWSSTSRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSSTSRoleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSSTSRoleList writes a list of value of the 'AWSSTS_role' type to +// the given stream. +func WriteAWSSTSRoleList(list []*AWSSTSRole, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWSSTSRole(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSSTSRoleList reads a list of values of the 'AWSSTS_role' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSSTSRoleList(source interface{}) (items []*AWSSTSRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSSTSRoleList(iterator) + err = iterator.Error + return +} + +// ReadAWSSTSRoleList reads list of values of the ”AWSSTS_role' type from +// the given iterator. +func ReadAWSSTSRoleList(iterator *jsoniter.Iterator) []*AWSSTSRole { + list := []*AWSSTSRole{} + for iterator.ReadArray() { + item := ReadAWSSTSRole(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/awssts_role_type.go b/clientapi/clustersmgmt/v1/awssts_role_type.go new file mode 100644 index 00000000..139056a0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_role_type.go @@ -0,0 +1,285 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AWSSTSRole represents the values of the 'AWSSTS_role' type. +// +// Representation of an sts role for a rosa cluster +type AWSSTSRole struct { + bitmap_ uint32 + roleARN string + roleType string + roleVersion string + hcpManagedPolicies bool + isAdmin bool + managedPolicies bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWSSTSRole) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// HcpManagedPolicies returns the value of the 'hcp_managed_policies' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Does this Role have HCP Managed Policies? +func (o *AWSSTSRole) HcpManagedPolicies() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.hcpManagedPolicies + } + return false +} + +// GetHcpManagedPolicies returns the value of the 'hcp_managed_policies' attribute and +// a flag indicating if the attribute has a value. +// +// Does this Role have HCP Managed Policies? +func (o *AWSSTSRole) GetHcpManagedPolicies() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.hcpManagedPolicies + } + return +} + +// IsAdmin returns the value of the 'is_admin' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Does this role have Admin permission? +func (o *AWSSTSRole) IsAdmin() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.isAdmin + } + return false +} + +// GetIsAdmin returns the value of the 'is_admin' attribute and +// a flag indicating if the attribute has a value. +// +// Does this role have Admin permission? +func (o *AWSSTSRole) GetIsAdmin() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.isAdmin + } + return +} + +// ManagedPolicies returns the value of the 'managed_policies' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Does this Role have Managed Policies? +func (o *AWSSTSRole) ManagedPolicies() bool { + if o != nil && o.bitmap_&4 != 0 { + return o.managedPolicies + } + return false +} + +// GetManagedPolicies returns the value of the 'managed_policies' attribute and +// a flag indicating if the attribute has a value. +// +// Does this Role have Managed Policies? +func (o *AWSSTSRole) GetManagedPolicies() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.managedPolicies + } + return +} + +// RoleARN returns the value of the 'role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The AWS ARN for this Role +func (o *AWSSTSRole) RoleARN() string { + if o != nil && o.bitmap_&8 != 0 { + return o.roleARN + } + return "" +} + +// GetRoleARN returns the value of the 'role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// The AWS ARN for this Role +func (o *AWSSTSRole) GetRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.roleARN + } + return +} + +// RoleType returns the value of the 'role_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The type of this Role +func (o *AWSSTSRole) RoleType() string { + if o != nil && o.bitmap_&16 != 0 { + return o.roleType + } + return "" +} + +// GetRoleType returns the value of the 'role_type' attribute and +// a flag indicating if the attribute has a value. +// +// The type of this Role +func (o *AWSSTSRole) GetRoleType() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.roleType + } + return +} + +// RoleVersion returns the value of the 'role_version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Openshift Version for this Role +func (o *AWSSTSRole) RoleVersion() string { + if o != nil && o.bitmap_&32 != 0 { + return o.roleVersion + } + return "" +} + +// GetRoleVersion returns the value of the 'role_version' attribute and +// a flag indicating if the attribute has a value. +// +// The Openshift Version for this Role +func (o *AWSSTSRole) GetRoleVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.roleVersion + } + return +} + +// AWSSTSRoleListKind is the name of the type used to represent list of objects of +// type 'AWSSTS_role'. +const AWSSTSRoleListKind = "AWSSTSRoleList" + +// AWSSTSRoleListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWSSTS_role'. +const AWSSTSRoleListLinkKind = "AWSSTSRoleListLink" + +// AWSSTSRoleNilKind is the name of the type used to nil lists of objects of +// type 'AWSSTS_role'. +const AWSSTSRoleListNilKind = "AWSSTSRoleListNil" + +// AWSSTSRoleList is a list of values of the 'AWSSTS_role' type. +type AWSSTSRoleList struct { + href string + link bool + items []*AWSSTSRole +} + +// Len returns the length of the list. +func (l *AWSSTSRoleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSSTSRoleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSSTSRoleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSSTSRoleList) SetItems(items []*AWSSTSRole) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSSTSRoleList) Items() []*AWSSTSRole { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSSTSRoleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSSTSRoleList) Get(i int) *AWSSTSRole { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSSTSRoleList) Slice() []*AWSSTSRole { + var slice []*AWSSTSRole + if l == nil { + slice = make([]*AWSSTSRole, 0) + } else { + slice = make([]*AWSSTSRole, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSSTSRoleList) Each(f func(item *AWSSTSRole) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSSTSRoleList) Range(f func(index int, item *AWSSTSRole) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/awssts_role_type_json.go b/clientapi/clustersmgmt/v1/awssts_role_type_json.go new file mode 100644 index 00000000..98810437 --- /dev/null +++ b/clientapi/clustersmgmt/v1/awssts_role_type_json.go @@ -0,0 +1,151 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSSTSRole writes a value of the 'AWSSTS_role' type to the given writer. +func MarshalAWSSTSRole(object *AWSSTSRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSSTSRole(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSSTSRole writes a value of the 'AWSSTS_role' type to the given stream. +func WriteAWSSTSRole(object *AWSSTSRole, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hcpManagedPolicies") + stream.WriteBool(object.hcpManagedPolicies) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("isAdmin") + stream.WriteBool(object.isAdmin) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managedPolicies") + stream.WriteBool(object.managedPolicies) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("arn") + stream.WriteString(object.roleARN) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.roleType) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("roleVersion") + stream.WriteString(object.roleVersion) + } + stream.WriteObjectEnd() +} + +// UnmarshalAWSSTSRole reads a value of the 'AWSSTS_role' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWSSTSRole(source interface{}) (object *AWSSTSRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWSSTSRole(iterator) + err = iterator.Error + return +} + +// ReadAWSSTSRole reads a value of the 'AWSSTS_role' type from the given iterator. +func ReadAWSSTSRole(iterator *jsoniter.Iterator) *AWSSTSRole { + object := &AWSSTSRole{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "hcpManagedPolicies": + value := iterator.ReadBool() + object.hcpManagedPolicies = value + object.bitmap_ |= 1 + case "isAdmin": + value := iterator.ReadBool() + object.isAdmin = value + object.bitmap_ |= 2 + case "managedPolicies": + value := iterator.ReadBool() + object.managedPolicies = value + object.bitmap_ |= 4 + case "arn": + value := iterator.ReadString() + object.roleARN = value + object.bitmap_ |= 8 + case "type": + value := iterator.ReadString() + object.roleType = value + object.bitmap_ |= 16 + case "roleVersion": + value := iterator.ReadString() + object.roleVersion = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/azure_builder.go b/clientapi/clustersmgmt/v1/azure_builder.go new file mode 100644 index 00000000..7e199955 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_builder.go @@ -0,0 +1,174 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureBuilder contains the data and logic needed to build 'azure' objects. +// +// Microsoft Azure settings of a cluster. +type AzureBuilder struct { + bitmap_ uint32 + managedResourceGroupName string + networkSecurityGroupResourceID string + nodesOutboundConnectivity *AzureNodesOutboundConnectivityBuilder + operatorsAuthentication *AzureOperatorsAuthenticationBuilder + resourceGroupName string + resourceName string + subnetResourceID string + subscriptionID string + tenantID string +} + +// NewAzure creates a new builder of 'azure' objects. +func NewAzure() *AzureBuilder { + return &AzureBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ManagedResourceGroupName sets the value of the 'managed_resource_group_name' attribute to the given value. +func (b *AzureBuilder) ManagedResourceGroupName(value string) *AzureBuilder { + b.managedResourceGroupName = value + b.bitmap_ |= 1 + return b +} + +// NetworkSecurityGroupResourceID sets the value of the 'network_security_group_resource_ID' attribute to the given value. +func (b *AzureBuilder) NetworkSecurityGroupResourceID(value string) *AzureBuilder { + b.networkSecurityGroupResourceID = value + b.bitmap_ |= 2 + return b +} + +// NodesOutboundConnectivity sets the value of the 'nodes_outbound_connectivity' attribute to the given value. +// +// The configuration of the node outbound connectivity +func (b *AzureBuilder) NodesOutboundConnectivity(value *AzureNodesOutboundConnectivityBuilder) *AzureBuilder { + b.nodesOutboundConnectivity = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// OperatorsAuthentication sets the value of the 'operators_authentication' attribute to the given value. +// +// The configuration that the operators of the +// cluster have to authenticate to Azure. +func (b *AzureBuilder) OperatorsAuthentication(value *AzureOperatorsAuthenticationBuilder) *AzureBuilder { + b.operatorsAuthentication = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// ResourceGroupName sets the value of the 'resource_group_name' attribute to the given value. +func (b *AzureBuilder) ResourceGroupName(value string) *AzureBuilder { + b.resourceGroupName = value + b.bitmap_ |= 16 + return b +} + +// ResourceName sets the value of the 'resource_name' attribute to the given value. +func (b *AzureBuilder) ResourceName(value string) *AzureBuilder { + b.resourceName = value + b.bitmap_ |= 32 + return b +} + +// SubnetResourceID sets the value of the 'subnet_resource_ID' attribute to the given value. +func (b *AzureBuilder) SubnetResourceID(value string) *AzureBuilder { + b.subnetResourceID = value + b.bitmap_ |= 64 + return b +} + +// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value. +func (b *AzureBuilder) SubscriptionID(value string) *AzureBuilder { + b.subscriptionID = value + b.bitmap_ |= 128 + return b +} + +// TenantID sets the value of the 'tenant_ID' attribute to the given value. +func (b *AzureBuilder) TenantID(value string) *AzureBuilder { + b.tenantID = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureBuilder) Copy(object *Azure) *AzureBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.managedResourceGroupName = object.managedResourceGroupName + b.networkSecurityGroupResourceID = object.networkSecurityGroupResourceID + if object.nodesOutboundConnectivity != nil { + b.nodesOutboundConnectivity = NewAzureNodesOutboundConnectivity().Copy(object.nodesOutboundConnectivity) + } else { + b.nodesOutboundConnectivity = nil + } + if object.operatorsAuthentication != nil { + b.operatorsAuthentication = NewAzureOperatorsAuthentication().Copy(object.operatorsAuthentication) + } else { + b.operatorsAuthentication = nil + } + b.resourceGroupName = object.resourceGroupName + b.resourceName = object.resourceName + b.subnetResourceID = object.subnetResourceID + b.subscriptionID = object.subscriptionID + b.tenantID = object.tenantID + return b +} + +// Build creates a 'azure' object using the configuration stored in the builder. +func (b *AzureBuilder) Build() (object *Azure, err error) { + object = new(Azure) + object.bitmap_ = b.bitmap_ + object.managedResourceGroupName = b.managedResourceGroupName + object.networkSecurityGroupResourceID = b.networkSecurityGroupResourceID + if b.nodesOutboundConnectivity != nil { + object.nodesOutboundConnectivity, err = b.nodesOutboundConnectivity.Build() + if err != nil { + return + } + } + if b.operatorsAuthentication != nil { + object.operatorsAuthentication, err = b.operatorsAuthentication.Build() + if err != nil { + return + } + } + object.resourceGroupName = b.resourceGroupName + object.resourceName = b.resourceName + object.subnetResourceID = b.subnetResourceID + object.subscriptionID = b.subscriptionID + object.tenantID = b.tenantID + return +} diff --git a/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_builder.go b/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_builder.go new file mode 100644 index 00000000..b70a3275 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_builder.go @@ -0,0 +1,84 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureControlPlaneManagedIdentityBuilder contains the data and logic needed to build 'azure_control_plane_managed_identity' objects. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity belonging to the Control Plane of the cluster. +type AzureControlPlaneManagedIdentityBuilder struct { + bitmap_ uint32 + clientID string + principalID string + resourceID string +} + +// NewAzureControlPlaneManagedIdentity creates a new builder of 'azure_control_plane_managed_identity' objects. +func NewAzureControlPlaneManagedIdentity() *AzureControlPlaneManagedIdentityBuilder { + return &AzureControlPlaneManagedIdentityBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureControlPlaneManagedIdentityBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ClientID sets the value of the 'client_ID' attribute to the given value. +func (b *AzureControlPlaneManagedIdentityBuilder) ClientID(value string) *AzureControlPlaneManagedIdentityBuilder { + b.clientID = value + b.bitmap_ |= 1 + return b +} + +// PrincipalID sets the value of the 'principal_ID' attribute to the given value. +func (b *AzureControlPlaneManagedIdentityBuilder) PrincipalID(value string) *AzureControlPlaneManagedIdentityBuilder { + b.principalID = value + b.bitmap_ |= 2 + return b +} + +// ResourceID sets the value of the 'resource_ID' attribute to the given value. +func (b *AzureControlPlaneManagedIdentityBuilder) ResourceID(value string) *AzureControlPlaneManagedIdentityBuilder { + b.resourceID = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureControlPlaneManagedIdentityBuilder) Copy(object *AzureControlPlaneManagedIdentity) *AzureControlPlaneManagedIdentityBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.clientID = object.clientID + b.principalID = object.principalID + b.resourceID = object.resourceID + return b +} + +// Build creates a 'azure_control_plane_managed_identity' object using the configuration stored in the builder. +func (b *AzureControlPlaneManagedIdentityBuilder) Build() (object *AzureControlPlaneManagedIdentity, err error) { + object = new(AzureControlPlaneManagedIdentity) + object.bitmap_ = b.bitmap_ + object.clientID = b.clientID + object.principalID = b.principalID + object.resourceID = b.resourceID + return +} diff --git a/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_list_builder.go b/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_list_builder.go new file mode 100644 index 00000000..1f794a1f --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureControlPlaneManagedIdentityListBuilder contains the data and logic needed to build +// 'azure_control_plane_managed_identity' objects. +type AzureControlPlaneManagedIdentityListBuilder struct { + items []*AzureControlPlaneManagedIdentityBuilder +} + +// NewAzureControlPlaneManagedIdentityList creates a new builder of 'azure_control_plane_managed_identity' objects. +func NewAzureControlPlaneManagedIdentityList() *AzureControlPlaneManagedIdentityListBuilder { + return new(AzureControlPlaneManagedIdentityListBuilder) +} + +// Items sets the items of the list. +func (b *AzureControlPlaneManagedIdentityListBuilder) Items(values ...*AzureControlPlaneManagedIdentityBuilder) *AzureControlPlaneManagedIdentityListBuilder { + b.items = make([]*AzureControlPlaneManagedIdentityBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureControlPlaneManagedIdentityListBuilder) 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 *AzureControlPlaneManagedIdentityListBuilder) Copy(list *AzureControlPlaneManagedIdentityList) *AzureControlPlaneManagedIdentityListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureControlPlaneManagedIdentityBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureControlPlaneManagedIdentity().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_control_plane_managed_identity' objects using the +// configuration stored in the builder. +func (b *AzureControlPlaneManagedIdentityListBuilder) Build() (list *AzureControlPlaneManagedIdentityList, err error) { + items := make([]*AzureControlPlaneManagedIdentity, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureControlPlaneManagedIdentityList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_list_type_json.go b/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_list_type_json.go new file mode 100644 index 00000000..a28b4518 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureControlPlaneManagedIdentityList writes a list of values of the 'azure_control_plane_managed_identity' type to +// the given writer. +func MarshalAzureControlPlaneManagedIdentityList(list []*AzureControlPlaneManagedIdentity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureControlPlaneManagedIdentityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureControlPlaneManagedIdentityList writes a list of value of the 'azure_control_plane_managed_identity' type to +// the given stream. +func WriteAzureControlPlaneManagedIdentityList(list []*AzureControlPlaneManagedIdentity, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureControlPlaneManagedIdentity(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureControlPlaneManagedIdentityList reads a list of values of the 'azure_control_plane_managed_identity' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureControlPlaneManagedIdentityList(source interface{}) (items []*AzureControlPlaneManagedIdentity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureControlPlaneManagedIdentityList(iterator) + err = iterator.Error + return +} + +// ReadAzureControlPlaneManagedIdentityList reads list of values of the ”azure_control_plane_managed_identity' type from +// the given iterator. +func ReadAzureControlPlaneManagedIdentityList(iterator *jsoniter.Iterator) []*AzureControlPlaneManagedIdentity { + list := []*AzureControlPlaneManagedIdentity{} + for iterator.ReadArray() { + item := ReadAzureControlPlaneManagedIdentity(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_type.go b/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_type.go new file mode 100644 index 00000000..4f118268 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_type.go @@ -0,0 +1,244 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureControlPlaneManagedIdentity represents the values of the 'azure_control_plane_managed_identity' type. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity belonging to the Control Plane of the cluster. +type AzureControlPlaneManagedIdentity struct { + bitmap_ uint32 + clientID string + principalID string + resourceID string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureControlPlaneManagedIdentity) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ClientID returns the value of the 'client_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Client ID associated to the Azure User-Assigned Managed Identity. +// Readonly. +func (o *AzureControlPlaneManagedIdentity) ClientID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.clientID + } + return "" +} + +// GetClientID returns the value of the 'client_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Client ID associated to the Azure User-Assigned Managed Identity. +// Readonly. +func (o *AzureControlPlaneManagedIdentity) GetClientID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.clientID + } + return +} + +// PrincipalID returns the value of the 'principal_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Principal ID associated to the Azure User-Assigned Identity. +// Readonly. +func (o *AzureControlPlaneManagedIdentity) PrincipalID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.principalID + } + return "" +} + +// GetPrincipalID returns the value of the 'principal_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Principal ID associated to the Azure User-Assigned Identity. +// Readonly. +func (o *AzureControlPlaneManagedIdentity) GetPrincipalID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.principalID + } + return +} + +// ResourceID returns the value of the 'resource_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource ID of the Azure User-Assigned Managed +// Identity. The managed identity represented must exist before +// creating the cluster. +// The Azure Resource Group Name specified as part of the Resource ID +// must belong to the Azure Subscription specified in `.azure.subscription_id`, +// and in the same Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of the Resource ID +// must be a different Resource Group Name than the one specified in +// `.azure.managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the Resource ID +// can be the same, or a different one than the one specified in +// `.azure.resource_group_name`. +// Required during creation. +// Immutable. +func (o *AzureControlPlaneManagedIdentity) ResourceID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.resourceID + } + return "" +} + +// GetResourceID returns the value of the 'resource_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource ID of the Azure User-Assigned Managed +// Identity. The managed identity represented must exist before +// creating the cluster. +// The Azure Resource Group Name specified as part of the Resource ID +// must belong to the Azure Subscription specified in `.azure.subscription_id`, +// and in the same Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of the Resource ID +// must be a different Resource Group Name than the one specified in +// `.azure.managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the Resource ID +// can be the same, or a different one than the one specified in +// `.azure.resource_group_name`. +// Required during creation. +// Immutable. +func (o *AzureControlPlaneManagedIdentity) GetResourceID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.resourceID + } + return +} + +// AzureControlPlaneManagedIdentityListKind is the name of the type used to represent list of objects of +// type 'azure_control_plane_managed_identity'. +const AzureControlPlaneManagedIdentityListKind = "AzureControlPlaneManagedIdentityList" + +// AzureControlPlaneManagedIdentityListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_control_plane_managed_identity'. +const AzureControlPlaneManagedIdentityListLinkKind = "AzureControlPlaneManagedIdentityListLink" + +// AzureControlPlaneManagedIdentityNilKind is the name of the type used to nil lists of objects of +// type 'azure_control_plane_managed_identity'. +const AzureControlPlaneManagedIdentityListNilKind = "AzureControlPlaneManagedIdentityListNil" + +// AzureControlPlaneManagedIdentityList is a list of values of the 'azure_control_plane_managed_identity' type. +type AzureControlPlaneManagedIdentityList struct { + href string + link bool + items []*AzureControlPlaneManagedIdentity +} + +// Len returns the length of the list. +func (l *AzureControlPlaneManagedIdentityList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureControlPlaneManagedIdentityList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureControlPlaneManagedIdentityList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureControlPlaneManagedIdentityList) SetItems(items []*AzureControlPlaneManagedIdentity) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureControlPlaneManagedIdentityList) Items() []*AzureControlPlaneManagedIdentity { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureControlPlaneManagedIdentityList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureControlPlaneManagedIdentityList) Get(i int) *AzureControlPlaneManagedIdentity { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureControlPlaneManagedIdentityList) Slice() []*AzureControlPlaneManagedIdentity { + var slice []*AzureControlPlaneManagedIdentity + if l == nil { + slice = make([]*AzureControlPlaneManagedIdentity, 0) + } else { + slice = make([]*AzureControlPlaneManagedIdentity, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureControlPlaneManagedIdentityList) Each(f func(item *AzureControlPlaneManagedIdentity) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureControlPlaneManagedIdentityList) Range(f func(index int, item *AzureControlPlaneManagedIdentity) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_type_json.go b/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_type_json.go new file mode 100644 index 00000000..9a9b64ed --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_control_plane_managed_identity_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureControlPlaneManagedIdentity writes a value of the 'azure_control_plane_managed_identity' type to the given writer. +func MarshalAzureControlPlaneManagedIdentity(object *AzureControlPlaneManagedIdentity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureControlPlaneManagedIdentity(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureControlPlaneManagedIdentity writes a value of the 'azure_control_plane_managed_identity' type to the given stream. +func WriteAzureControlPlaneManagedIdentity(object *AzureControlPlaneManagedIdentity, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_id") + stream.WriteString(object.clientID) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("principal_id") + stream.WriteString(object.principalID) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_id") + stream.WriteString(object.resourceID) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureControlPlaneManagedIdentity reads a value of the 'azure_control_plane_managed_identity' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureControlPlaneManagedIdentity(source interface{}) (object *AzureControlPlaneManagedIdentity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureControlPlaneManagedIdentity(iterator) + err = iterator.Error + return +} + +// ReadAzureControlPlaneManagedIdentity reads a value of the 'azure_control_plane_managed_identity' type from the given iterator. +func ReadAzureControlPlaneManagedIdentity(iterator *jsoniter.Iterator) *AzureControlPlaneManagedIdentity { + object := &AzureControlPlaneManagedIdentity{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "client_id": + value := iterator.ReadString() + object.clientID = value + object.bitmap_ |= 1 + case "principal_id": + value := iterator.ReadString() + object.principalID = value + object.bitmap_ |= 2 + case "resource_id": + value := iterator.ReadString() + object.resourceID = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_builder.go b/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_builder.go new file mode 100644 index 00000000..33c348b5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_builder.go @@ -0,0 +1,64 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureDataPlaneManagedIdentityBuilder contains the data and logic needed to build 'azure_data_plane_managed_identity' objects. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity belonging to the Data Plane of the cluster. +type AzureDataPlaneManagedIdentityBuilder struct { + bitmap_ uint32 + resourceID string +} + +// NewAzureDataPlaneManagedIdentity creates a new builder of 'azure_data_plane_managed_identity' objects. +func NewAzureDataPlaneManagedIdentity() *AzureDataPlaneManagedIdentityBuilder { + return &AzureDataPlaneManagedIdentityBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureDataPlaneManagedIdentityBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ResourceID sets the value of the 'resource_ID' attribute to the given value. +func (b *AzureDataPlaneManagedIdentityBuilder) ResourceID(value string) *AzureDataPlaneManagedIdentityBuilder { + b.resourceID = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureDataPlaneManagedIdentityBuilder) Copy(object *AzureDataPlaneManagedIdentity) *AzureDataPlaneManagedIdentityBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.resourceID = object.resourceID + return b +} + +// Build creates a 'azure_data_plane_managed_identity' object using the configuration stored in the builder. +func (b *AzureDataPlaneManagedIdentityBuilder) Build() (object *AzureDataPlaneManagedIdentity, err error) { + object = new(AzureDataPlaneManagedIdentity) + object.bitmap_ = b.bitmap_ + object.resourceID = b.resourceID + return +} diff --git a/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_list_builder.go b/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_list_builder.go new file mode 100644 index 00000000..48d5e6eb --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureDataPlaneManagedIdentityListBuilder contains the data and logic needed to build +// 'azure_data_plane_managed_identity' objects. +type AzureDataPlaneManagedIdentityListBuilder struct { + items []*AzureDataPlaneManagedIdentityBuilder +} + +// NewAzureDataPlaneManagedIdentityList creates a new builder of 'azure_data_plane_managed_identity' objects. +func NewAzureDataPlaneManagedIdentityList() *AzureDataPlaneManagedIdentityListBuilder { + return new(AzureDataPlaneManagedIdentityListBuilder) +} + +// Items sets the items of the list. +func (b *AzureDataPlaneManagedIdentityListBuilder) Items(values ...*AzureDataPlaneManagedIdentityBuilder) *AzureDataPlaneManagedIdentityListBuilder { + b.items = make([]*AzureDataPlaneManagedIdentityBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureDataPlaneManagedIdentityListBuilder) 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 *AzureDataPlaneManagedIdentityListBuilder) Copy(list *AzureDataPlaneManagedIdentityList) *AzureDataPlaneManagedIdentityListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureDataPlaneManagedIdentityBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureDataPlaneManagedIdentity().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_data_plane_managed_identity' objects using the +// configuration stored in the builder. +func (b *AzureDataPlaneManagedIdentityListBuilder) Build() (list *AzureDataPlaneManagedIdentityList, err error) { + items := make([]*AzureDataPlaneManagedIdentity, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureDataPlaneManagedIdentityList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_list_type_json.go b/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_list_type_json.go new file mode 100644 index 00000000..7118e8f4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureDataPlaneManagedIdentityList writes a list of values of the 'azure_data_plane_managed_identity' type to +// the given writer. +func MarshalAzureDataPlaneManagedIdentityList(list []*AzureDataPlaneManagedIdentity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureDataPlaneManagedIdentityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureDataPlaneManagedIdentityList writes a list of value of the 'azure_data_plane_managed_identity' type to +// the given stream. +func WriteAzureDataPlaneManagedIdentityList(list []*AzureDataPlaneManagedIdentity, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureDataPlaneManagedIdentity(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureDataPlaneManagedIdentityList reads a list of values of the 'azure_data_plane_managed_identity' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureDataPlaneManagedIdentityList(source interface{}) (items []*AzureDataPlaneManagedIdentity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureDataPlaneManagedIdentityList(iterator) + err = iterator.Error + return +} + +// ReadAzureDataPlaneManagedIdentityList reads list of values of the ”azure_data_plane_managed_identity' type from +// the given iterator. +func ReadAzureDataPlaneManagedIdentityList(iterator *jsoniter.Iterator) []*AzureDataPlaneManagedIdentity { + list := []*AzureDataPlaneManagedIdentity{} + for iterator.ReadArray() { + item := ReadAzureDataPlaneManagedIdentity(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_type.go b/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_type.go new file mode 100644 index 00000000..9acb0b24 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_type.go @@ -0,0 +1,192 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureDataPlaneManagedIdentity represents the values of the 'azure_data_plane_managed_identity' type. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity belonging to the Data Plane of the cluster. +type AzureDataPlaneManagedIdentity struct { + bitmap_ uint32 + resourceID string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureDataPlaneManagedIdentity) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ResourceID returns the value of the 'resource_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource ID of the Azure User-Assigned Managed +// Identity. The managed identity represented must exist before +// creating the cluster. +// The Azure Resource Group Name specified as part of the Resource ID +// must belong to the Azure Subscription specified in `.azure.subscription_id`, +// and in the same Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of the Resource ID +// must be a different Resource Group Name than the one specified in +// `.azure.managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the Resource ID +// can be the same, or a different one than the one specified in +// `.azure.resource_group_name`. +// Required during creation. +// Immutable. +func (o *AzureDataPlaneManagedIdentity) ResourceID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.resourceID + } + return "" +} + +// GetResourceID returns the value of the 'resource_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource ID of the Azure User-Assigned Managed +// Identity. The managed identity represented must exist before +// creating the cluster. +// The Azure Resource Group Name specified as part of the Resource ID +// must belong to the Azure Subscription specified in `.azure.subscription_id`, +// and in the same Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of the Resource ID +// must be a different Resource Group Name than the one specified in +// `.azure.managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the Resource ID +// can be the same, or a different one than the one specified in +// `.azure.resource_group_name`. +// Required during creation. +// Immutable. +func (o *AzureDataPlaneManagedIdentity) GetResourceID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.resourceID + } + return +} + +// AzureDataPlaneManagedIdentityListKind is the name of the type used to represent list of objects of +// type 'azure_data_plane_managed_identity'. +const AzureDataPlaneManagedIdentityListKind = "AzureDataPlaneManagedIdentityList" + +// AzureDataPlaneManagedIdentityListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_data_plane_managed_identity'. +const AzureDataPlaneManagedIdentityListLinkKind = "AzureDataPlaneManagedIdentityListLink" + +// AzureDataPlaneManagedIdentityNilKind is the name of the type used to nil lists of objects of +// type 'azure_data_plane_managed_identity'. +const AzureDataPlaneManagedIdentityListNilKind = "AzureDataPlaneManagedIdentityListNil" + +// AzureDataPlaneManagedIdentityList is a list of values of the 'azure_data_plane_managed_identity' type. +type AzureDataPlaneManagedIdentityList struct { + href string + link bool + items []*AzureDataPlaneManagedIdentity +} + +// Len returns the length of the list. +func (l *AzureDataPlaneManagedIdentityList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureDataPlaneManagedIdentityList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureDataPlaneManagedIdentityList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureDataPlaneManagedIdentityList) SetItems(items []*AzureDataPlaneManagedIdentity) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureDataPlaneManagedIdentityList) Items() []*AzureDataPlaneManagedIdentity { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureDataPlaneManagedIdentityList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureDataPlaneManagedIdentityList) Get(i int) *AzureDataPlaneManagedIdentity { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureDataPlaneManagedIdentityList) Slice() []*AzureDataPlaneManagedIdentity { + var slice []*AzureDataPlaneManagedIdentity + if l == nil { + slice = make([]*AzureDataPlaneManagedIdentity, 0) + } else { + slice = make([]*AzureDataPlaneManagedIdentity, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureDataPlaneManagedIdentityList) Each(f func(item *AzureDataPlaneManagedIdentity) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureDataPlaneManagedIdentityList) Range(f func(index int, item *AzureDataPlaneManagedIdentity) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_type_json.go b/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_type_json.go new file mode 100644 index 00000000..d93cecdc --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_data_plane_managed_identity_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureDataPlaneManagedIdentity writes a value of the 'azure_data_plane_managed_identity' type to the given writer. +func MarshalAzureDataPlaneManagedIdentity(object *AzureDataPlaneManagedIdentity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureDataPlaneManagedIdentity(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureDataPlaneManagedIdentity writes a value of the 'azure_data_plane_managed_identity' type to the given stream. +func WriteAzureDataPlaneManagedIdentity(object *AzureDataPlaneManagedIdentity, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_id") + stream.WriteString(object.resourceID) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureDataPlaneManagedIdentity reads a value of the 'azure_data_plane_managed_identity' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureDataPlaneManagedIdentity(source interface{}) (object *AzureDataPlaneManagedIdentity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureDataPlaneManagedIdentity(iterator) + err = iterator.Error + return +} + +// ReadAzureDataPlaneManagedIdentity reads a value of the 'azure_data_plane_managed_identity' type from the given iterator. +func ReadAzureDataPlaneManagedIdentity(iterator *jsoniter.Iterator) *AzureDataPlaneManagedIdentity { + object := &AzureDataPlaneManagedIdentity{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "resource_id": + value := iterator.ReadString() + object.resourceID = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/azure_list_builder.go b/clientapi/clustersmgmt/v1/azure_list_builder.go new file mode 100644 index 00000000..2f1fcd7f --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureListBuilder contains the data and logic needed to build +// 'azure' objects. +type AzureListBuilder struct { + items []*AzureBuilder +} + +// NewAzureList creates a new builder of 'azure' objects. +func NewAzureList() *AzureListBuilder { + return new(AzureListBuilder) +} + +// Items sets the items of the list. +func (b *AzureListBuilder) Items(values ...*AzureBuilder) *AzureListBuilder { + b.items = make([]*AzureBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureListBuilder) 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 *AzureListBuilder) Copy(list *AzureList) *AzureListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzure().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure' objects using the +// configuration stored in the builder. +func (b *AzureListBuilder) Build() (list *AzureList, err error) { + items := make([]*Azure, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/azure_list_type_json.go b/clientapi/clustersmgmt/v1/azure_list_type_json.go new file mode 100644 index 00000000..a395cc0a --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureList writes a list of values of the 'azure' type to +// the given writer. +func MarshalAzureList(list []*Azure, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureList writes a list of value of the 'azure' type to +// the given stream. +func WriteAzureList(list []*Azure, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzure(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureList reads a list of values of the 'azure' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureList(source interface{}) (items []*Azure, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureList(iterator) + err = iterator.Error + return +} + +// ReadAzureList reads list of values of the ”azure' type from +// the given iterator. +func ReadAzureList(iterator *jsoniter.Iterator) []*Azure { + list := []*Azure{} + for iterator.ReadArray() { + item := ReadAzure(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/azure_node_pool_builder.go b/clientapi/clustersmgmt/v1/azure_node_pool_builder.go new file mode 100644 index 00000000..e9bf29b8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_node_pool_builder.go @@ -0,0 +1,103 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureNodePoolBuilder contains the data and logic needed to build 'azure_node_pool' objects. +// +// Representation of azure node pool specific parameters. +type AzureNodePoolBuilder struct { + bitmap_ uint32 + osDiskSizeGibibytes int + osDiskStorageAccountType string + vmSize string + resourceName string + ephemeralOSDiskEnabled bool +} + +// NewAzureNodePool creates a new builder of 'azure_node_pool' objects. +func NewAzureNodePool() *AzureNodePoolBuilder { + return &AzureNodePoolBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureNodePoolBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// OSDiskSizeGibibytes sets the value of the 'OS_disk_size_gibibytes' attribute to the given value. +func (b *AzureNodePoolBuilder) OSDiskSizeGibibytes(value int) *AzureNodePoolBuilder { + b.osDiskSizeGibibytes = value + b.bitmap_ |= 1 + return b +} + +// OSDiskStorageAccountType sets the value of the 'OS_disk_storage_account_type' attribute to the given value. +func (b *AzureNodePoolBuilder) OSDiskStorageAccountType(value string) *AzureNodePoolBuilder { + b.osDiskStorageAccountType = value + b.bitmap_ |= 2 + return b +} + +// VMSize sets the value of the 'VM_size' attribute to the given value. +func (b *AzureNodePoolBuilder) VMSize(value string) *AzureNodePoolBuilder { + b.vmSize = value + b.bitmap_ |= 4 + return b +} + +// EphemeralOSDiskEnabled sets the value of the 'ephemeral_OS_disk_enabled' attribute to the given value. +func (b *AzureNodePoolBuilder) EphemeralOSDiskEnabled(value bool) *AzureNodePoolBuilder { + b.ephemeralOSDiskEnabled = value + b.bitmap_ |= 8 + return b +} + +// ResourceName sets the value of the 'resource_name' attribute to the given value. +func (b *AzureNodePoolBuilder) ResourceName(value string) *AzureNodePoolBuilder { + b.resourceName = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureNodePoolBuilder) Copy(object *AzureNodePool) *AzureNodePoolBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.osDiskSizeGibibytes = object.osDiskSizeGibibytes + b.osDiskStorageAccountType = object.osDiskStorageAccountType + b.vmSize = object.vmSize + b.ephemeralOSDiskEnabled = object.ephemeralOSDiskEnabled + b.resourceName = object.resourceName + return b +} + +// Build creates a 'azure_node_pool' object using the configuration stored in the builder. +func (b *AzureNodePoolBuilder) Build() (object *AzureNodePool, err error) { + object = new(AzureNodePool) + object.bitmap_ = b.bitmap_ + object.osDiskSizeGibibytes = b.osDiskSizeGibibytes + object.osDiskStorageAccountType = b.osDiskStorageAccountType + object.vmSize = b.vmSize + object.ephemeralOSDiskEnabled = b.ephemeralOSDiskEnabled + object.resourceName = b.resourceName + return +} diff --git a/clientapi/clustersmgmt/v1/azure_node_pool_list_builder.go b/clientapi/clustersmgmt/v1/azure_node_pool_list_builder.go new file mode 100644 index 00000000..b01ff84c --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_node_pool_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureNodePoolListBuilder contains the data and logic needed to build +// 'azure_node_pool' objects. +type AzureNodePoolListBuilder struct { + items []*AzureNodePoolBuilder +} + +// NewAzureNodePoolList creates a new builder of 'azure_node_pool' objects. +func NewAzureNodePoolList() *AzureNodePoolListBuilder { + return new(AzureNodePoolListBuilder) +} + +// Items sets the items of the list. +func (b *AzureNodePoolListBuilder) Items(values ...*AzureNodePoolBuilder) *AzureNodePoolListBuilder { + b.items = make([]*AzureNodePoolBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureNodePoolListBuilder) 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 *AzureNodePoolListBuilder) Copy(list *AzureNodePoolList) *AzureNodePoolListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureNodePoolBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureNodePool().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_node_pool' objects using the +// configuration stored in the builder. +func (b *AzureNodePoolListBuilder) Build() (list *AzureNodePoolList, err error) { + items := make([]*AzureNodePool, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureNodePoolList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/azure_node_pool_list_type_json.go b/clientapi/clustersmgmt/v1/azure_node_pool_list_type_json.go new file mode 100644 index 00000000..e4a52706 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_node_pool_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureNodePoolList writes a list of values of the 'azure_node_pool' type to +// the given writer. +func MarshalAzureNodePoolList(list []*AzureNodePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureNodePoolList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureNodePoolList writes a list of value of the 'azure_node_pool' type to +// the given stream. +func WriteAzureNodePoolList(list []*AzureNodePool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureNodePool(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureNodePoolList reads a list of values of the 'azure_node_pool' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureNodePoolList(source interface{}) (items []*AzureNodePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureNodePoolList(iterator) + err = iterator.Error + return +} + +// ReadAzureNodePoolList reads list of values of the ”azure_node_pool' type from +// the given iterator. +func ReadAzureNodePoolList(iterator *jsoniter.Iterator) []*AzureNodePool { + list := []*AzureNodePool{} + for iterator.ReadArray() { + item := ReadAzureNodePool(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/azure_node_pool_type.go b/clientapi/clustersmgmt/v1/azure_node_pool_type.go new file mode 100644 index 00000000..1a7c5a87 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_node_pool_type.go @@ -0,0 +1,311 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureNodePool represents the values of the 'azure_node_pool' type. +// +// Representation of azure node pool specific parameters. +type AzureNodePool struct { + bitmap_ uint32 + osDiskSizeGibibytes int + osDiskStorageAccountType string + vmSize string + resourceName string + ephemeralOSDiskEnabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureNodePool) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// OSDiskSizeGibibytes returns the value of the 'OS_disk_size_gibibytes' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The size in GiB to assign to the OS disks of the +// Nodes in the Node Pool. The property +// is the number of bytes x 1024^3. +// If not specified, OS disk size is 30 GiB. +func (o *AzureNodePool) OSDiskSizeGibibytes() int { + if o != nil && o.bitmap_&1 != 0 { + return o.osDiskSizeGibibytes + } + return 0 +} + +// GetOSDiskSizeGibibytes returns the value of the 'OS_disk_size_gibibytes' attribute and +// a flag indicating if the attribute has a value. +// +// The size in GiB to assign to the OS disks of the +// Nodes in the Node Pool. The property +// is the number of bytes x 1024^3. +// If not specified, OS disk size is 30 GiB. +func (o *AzureNodePool) GetOSDiskSizeGibibytes() (value int, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.osDiskSizeGibibytes + } + return +} + +// OSDiskStorageAccountType returns the value of the 'OS_disk_storage_account_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The disk storage account type to use for the OS disks of the Nodes in the +// Node Pool. Valid values are: +// * Standard_LRS: HDD +// * StandardSSD_LRS: Standard SSD +// * Premium_LRS: Premium SDD +// * UltraSSD_LRS: Ultra SDD +// +// If not specified, `Premium_LRS` is used. +func (o *AzureNodePool) OSDiskStorageAccountType() string { + if o != nil && o.bitmap_&2 != 0 { + return o.osDiskStorageAccountType + } + return "" +} + +// GetOSDiskStorageAccountType returns the value of the 'OS_disk_storage_account_type' attribute and +// a flag indicating if the attribute has a value. +// +// The disk storage account type to use for the OS disks of the Nodes in the +// Node Pool. Valid values are: +// * Standard_LRS: HDD +// * StandardSSD_LRS: Standard SSD +// * Premium_LRS: Premium SDD +// * UltraSSD_LRS: Ultra SDD +// +// If not specified, `Premium_LRS` is used. +func (o *AzureNodePool) GetOSDiskStorageAccountType() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.osDiskStorageAccountType + } + return +} + +// VMSize returns the value of the 'VM_size' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Virtual Machine size identifier used for the +// Nodes of the Node Pool. +// Availability of VM sizes are dependent on the Azure Location +// of the parent Cluster. +// Required during creation. +func (o *AzureNodePool) VMSize() string { + if o != nil && o.bitmap_&4 != 0 { + return o.vmSize + } + return "" +} + +// GetVMSize returns the value of the 'VM_size' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Virtual Machine size identifier used for the +// Nodes of the Node Pool. +// Availability of VM sizes are dependent on the Azure Location +// of the parent Cluster. +// Required during creation. +func (o *AzureNodePool) GetVMSize() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.vmSize + } + return +} + +// EphemeralOSDiskEnabled returns the value of the 'ephemeral_OS_disk_enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Enables Ephemeral OS Disks for the Nodes in the Node Pool. +// If not specified, no Ephemeral OS Disks are used. +func (o *AzureNodePool) EphemeralOSDiskEnabled() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.ephemeralOSDiskEnabled + } + return false +} + +// GetEphemeralOSDiskEnabled returns the value of the 'ephemeral_OS_disk_enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Enables Ephemeral OS Disks for the Nodes in the Node Pool. +// If not specified, no Ephemeral OS Disks are used. +func (o *AzureNodePool) GetEphemeralOSDiskEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.ephemeralOSDiskEnabled + } + return +} + +// ResourceName returns the value of the 'resource_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ResourceName is the Azure Resource Name of the NodePool. +// ResourceName must be within the Azure Resource Group Name of the parent +// Cluster it belongs to. +// ResourceName must be located in the same Azure Location as the parent +// Cluster it belongs to. +// ResourceName must be located in the same Azure Subscription as the parent +// Cluster it belongs to. +// ResourceName must belong to the same Microsoft Entra Tenant ID as the parent +// Cluster it belongs to. +// Required during creation. +// Immutable. +func (o *AzureNodePool) ResourceName() string { + if o != nil && o.bitmap_&16 != 0 { + return o.resourceName + } + return "" +} + +// GetResourceName returns the value of the 'resource_name' attribute and +// a flag indicating if the attribute has a value. +// +// ResourceName is the Azure Resource Name of the NodePool. +// ResourceName must be within the Azure Resource Group Name of the parent +// Cluster it belongs to. +// ResourceName must be located in the same Azure Location as the parent +// Cluster it belongs to. +// ResourceName must be located in the same Azure Subscription as the parent +// Cluster it belongs to. +// ResourceName must belong to the same Microsoft Entra Tenant ID as the parent +// Cluster it belongs to. +// Required during creation. +// Immutable. +func (o *AzureNodePool) GetResourceName() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.resourceName + } + return +} + +// AzureNodePoolListKind is the name of the type used to represent list of objects of +// type 'azure_node_pool'. +const AzureNodePoolListKind = "AzureNodePoolList" + +// AzureNodePoolListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_node_pool'. +const AzureNodePoolListLinkKind = "AzureNodePoolListLink" + +// AzureNodePoolNilKind is the name of the type used to nil lists of objects of +// type 'azure_node_pool'. +const AzureNodePoolListNilKind = "AzureNodePoolListNil" + +// AzureNodePoolList is a list of values of the 'azure_node_pool' type. +type AzureNodePoolList struct { + href string + link bool + items []*AzureNodePool +} + +// Len returns the length of the list. +func (l *AzureNodePoolList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureNodePoolList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureNodePoolList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureNodePoolList) SetItems(items []*AzureNodePool) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureNodePoolList) Items() []*AzureNodePool { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureNodePoolList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureNodePoolList) Get(i int) *AzureNodePool { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureNodePoolList) Slice() []*AzureNodePool { + var slice []*AzureNodePool + if l == nil { + slice = make([]*AzureNodePool, 0) + } else { + slice = make([]*AzureNodePool, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureNodePoolList) Each(f func(item *AzureNodePool) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureNodePoolList) Range(f func(index int, item *AzureNodePool) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/azure_node_pool_type_json.go b/clientapi/clustersmgmt/v1/azure_node_pool_type_json.go new file mode 100644 index 00000000..6977a0a1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_node_pool_type_json.go @@ -0,0 +1,138 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureNodePool writes a value of the 'azure_node_pool' type to the given writer. +func MarshalAzureNodePool(object *AzureNodePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureNodePool(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureNodePool writes a value of the 'azure_node_pool' type to the given stream. +func WriteAzureNodePool(object *AzureNodePool, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("os_disk_size_gibibytes") + stream.WriteInt(object.osDiskSizeGibibytes) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("os_disk_storage_account_type") + stream.WriteString(object.osDiskStorageAccountType) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("vm_size") + stream.WriteString(object.vmSize) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ephemeral_os_disk_enabled") + stream.WriteBool(object.ephemeralOSDiskEnabled) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_name") + stream.WriteString(object.resourceName) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureNodePool reads a value of the 'azure_node_pool' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureNodePool(source interface{}) (object *AzureNodePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureNodePool(iterator) + err = iterator.Error + return +} + +// ReadAzureNodePool reads a value of the 'azure_node_pool' type from the given iterator. +func ReadAzureNodePool(iterator *jsoniter.Iterator) *AzureNodePool { + object := &AzureNodePool{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "os_disk_size_gibibytes": + value := iterator.ReadInt() + object.osDiskSizeGibibytes = value + object.bitmap_ |= 1 + case "os_disk_storage_account_type": + value := iterator.ReadString() + object.osDiskStorageAccountType = value + object.bitmap_ |= 2 + case "vm_size": + value := iterator.ReadString() + object.vmSize = value + object.bitmap_ |= 4 + case "ephemeral_os_disk_enabled": + value := iterator.ReadBool() + object.ephemeralOSDiskEnabled = value + object.bitmap_ |= 8 + case "resource_name": + value := iterator.ReadString() + object.resourceName = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_builder.go b/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_builder.go new file mode 100644 index 00000000..7882f18b --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureNodesOutboundConnectivityBuilder contains the data and logic needed to build 'azure_nodes_outbound_connectivity' objects. +// +// The configuration of the node outbound connectivity +type AzureNodesOutboundConnectivityBuilder struct { + bitmap_ uint32 + outboundType string +} + +// NewAzureNodesOutboundConnectivity creates a new builder of 'azure_nodes_outbound_connectivity' objects. +func NewAzureNodesOutboundConnectivity() *AzureNodesOutboundConnectivityBuilder { + return &AzureNodesOutboundConnectivityBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureNodesOutboundConnectivityBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// OutboundType sets the value of the 'outbound_type' attribute to the given value. +func (b *AzureNodesOutboundConnectivityBuilder) OutboundType(value string) *AzureNodesOutboundConnectivityBuilder { + b.outboundType = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureNodesOutboundConnectivityBuilder) Copy(object *AzureNodesOutboundConnectivity) *AzureNodesOutboundConnectivityBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.outboundType = object.outboundType + return b +} + +// Build creates a 'azure_nodes_outbound_connectivity' object using the configuration stored in the builder. +func (b *AzureNodesOutboundConnectivityBuilder) Build() (object *AzureNodesOutboundConnectivity, err error) { + object = new(AzureNodesOutboundConnectivity) + object.bitmap_ = b.bitmap_ + object.outboundType = b.outboundType + return +} diff --git a/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_list_builder.go b/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_list_builder.go new file mode 100644 index 00000000..6a6a30d6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureNodesOutboundConnectivityListBuilder contains the data and logic needed to build +// 'azure_nodes_outbound_connectivity' objects. +type AzureNodesOutboundConnectivityListBuilder struct { + items []*AzureNodesOutboundConnectivityBuilder +} + +// NewAzureNodesOutboundConnectivityList creates a new builder of 'azure_nodes_outbound_connectivity' objects. +func NewAzureNodesOutboundConnectivityList() *AzureNodesOutboundConnectivityListBuilder { + return new(AzureNodesOutboundConnectivityListBuilder) +} + +// Items sets the items of the list. +func (b *AzureNodesOutboundConnectivityListBuilder) Items(values ...*AzureNodesOutboundConnectivityBuilder) *AzureNodesOutboundConnectivityListBuilder { + b.items = make([]*AzureNodesOutboundConnectivityBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureNodesOutboundConnectivityListBuilder) 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 *AzureNodesOutboundConnectivityListBuilder) Copy(list *AzureNodesOutboundConnectivityList) *AzureNodesOutboundConnectivityListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureNodesOutboundConnectivityBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureNodesOutboundConnectivity().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_nodes_outbound_connectivity' objects using the +// configuration stored in the builder. +func (b *AzureNodesOutboundConnectivityListBuilder) Build() (list *AzureNodesOutboundConnectivityList, err error) { + items := make([]*AzureNodesOutboundConnectivity, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureNodesOutboundConnectivityList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_list_type_json.go b/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_list_type_json.go new file mode 100644 index 00000000..a922ec6a --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureNodesOutboundConnectivityList writes a list of values of the 'azure_nodes_outbound_connectivity' type to +// the given writer. +func MarshalAzureNodesOutboundConnectivityList(list []*AzureNodesOutboundConnectivity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureNodesOutboundConnectivityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureNodesOutboundConnectivityList writes a list of value of the 'azure_nodes_outbound_connectivity' type to +// the given stream. +func WriteAzureNodesOutboundConnectivityList(list []*AzureNodesOutboundConnectivity, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureNodesOutboundConnectivity(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureNodesOutboundConnectivityList reads a list of values of the 'azure_nodes_outbound_connectivity' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureNodesOutboundConnectivityList(source interface{}) (items []*AzureNodesOutboundConnectivity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureNodesOutboundConnectivityList(iterator) + err = iterator.Error + return +} + +// ReadAzureNodesOutboundConnectivityList reads list of values of the ”azure_nodes_outbound_connectivity' type from +// the given iterator. +func ReadAzureNodesOutboundConnectivityList(iterator *jsoniter.Iterator) []*AzureNodesOutboundConnectivity { + list := []*AzureNodesOutboundConnectivity{} + for iterator.ReadArray() { + item := ReadAzureNodesOutboundConnectivity(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_type.go b/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_type.go new file mode 100644 index 00000000..f51670aa --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_type.go @@ -0,0 +1,169 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureNodesOutboundConnectivity represents the values of the 'azure_nodes_outbound_connectivity' type. +// +// The configuration of the node outbound connectivity +type AzureNodesOutboundConnectivity struct { + bitmap_ uint32 + outboundType string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureNodesOutboundConnectivity) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// OutboundType returns the value of the 'outbound_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// OutboundType is the type of network outbound configuration. +// The default and only accepted value is 'load_balancer'. +// This value is immutable. +func (o *AzureNodesOutboundConnectivity) OutboundType() string { + if o != nil && o.bitmap_&1 != 0 { + return o.outboundType + } + return "" +} + +// GetOutboundType returns the value of the 'outbound_type' attribute and +// a flag indicating if the attribute has a value. +// +// OutboundType is the type of network outbound configuration. +// The default and only accepted value is 'load_balancer'. +// This value is immutable. +func (o *AzureNodesOutboundConnectivity) GetOutboundType() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.outboundType + } + return +} + +// AzureNodesOutboundConnectivityListKind is the name of the type used to represent list of objects of +// type 'azure_nodes_outbound_connectivity'. +const AzureNodesOutboundConnectivityListKind = "AzureNodesOutboundConnectivityList" + +// AzureNodesOutboundConnectivityListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_nodes_outbound_connectivity'. +const AzureNodesOutboundConnectivityListLinkKind = "AzureNodesOutboundConnectivityListLink" + +// AzureNodesOutboundConnectivityNilKind is the name of the type used to nil lists of objects of +// type 'azure_nodes_outbound_connectivity'. +const AzureNodesOutboundConnectivityListNilKind = "AzureNodesOutboundConnectivityListNil" + +// AzureNodesOutboundConnectivityList is a list of values of the 'azure_nodes_outbound_connectivity' type. +type AzureNodesOutboundConnectivityList struct { + href string + link bool + items []*AzureNodesOutboundConnectivity +} + +// Len returns the length of the list. +func (l *AzureNodesOutboundConnectivityList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureNodesOutboundConnectivityList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureNodesOutboundConnectivityList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureNodesOutboundConnectivityList) SetItems(items []*AzureNodesOutboundConnectivity) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureNodesOutboundConnectivityList) Items() []*AzureNodesOutboundConnectivity { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureNodesOutboundConnectivityList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureNodesOutboundConnectivityList) Get(i int) *AzureNodesOutboundConnectivity { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureNodesOutboundConnectivityList) Slice() []*AzureNodesOutboundConnectivity { + var slice []*AzureNodesOutboundConnectivity + if l == nil { + slice = make([]*AzureNodesOutboundConnectivity, 0) + } else { + slice = make([]*AzureNodesOutboundConnectivity, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureNodesOutboundConnectivityList) Each(f func(item *AzureNodesOutboundConnectivity) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureNodesOutboundConnectivityList) Range(f func(index int, item *AzureNodesOutboundConnectivity) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_type_json.go b/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_type_json.go new file mode 100644 index 00000000..a5a15407 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_nodes_outbound_connectivity_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureNodesOutboundConnectivity writes a value of the 'azure_nodes_outbound_connectivity' type to the given writer. +func MarshalAzureNodesOutboundConnectivity(object *AzureNodesOutboundConnectivity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureNodesOutboundConnectivity(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureNodesOutboundConnectivity writes a value of the 'azure_nodes_outbound_connectivity' type to the given stream. +func WriteAzureNodesOutboundConnectivity(object *AzureNodesOutboundConnectivity, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("outbound_type") + stream.WriteString(object.outboundType) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureNodesOutboundConnectivity reads a value of the 'azure_nodes_outbound_connectivity' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureNodesOutboundConnectivity(source interface{}) (object *AzureNodesOutboundConnectivity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureNodesOutboundConnectivity(iterator) + err = iterator.Error + return +} + +// ReadAzureNodesOutboundConnectivity reads a value of the 'azure_nodes_outbound_connectivity' type from the given iterator. +func ReadAzureNodesOutboundConnectivity(iterator *jsoniter.Iterator) *AzureNodesOutboundConnectivity { + object := &AzureNodesOutboundConnectivity{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "outbound_type": + value := iterator.ReadString() + object.outboundType = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/azure_operators_authentication_builder.go b/clientapi/clustersmgmt/v1/azure_operators_authentication_builder.go new file mode 100644 index 00000000..d9cad07f --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_operators_authentication_builder.go @@ -0,0 +1,81 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureOperatorsAuthenticationBuilder contains the data and logic needed to build 'azure_operators_authentication' objects. +// +// The configuration that the operators of the +// cluster have to authenticate to Azure. +type AzureOperatorsAuthenticationBuilder struct { + bitmap_ uint32 + managedIdentities *AzureOperatorsAuthenticationManagedIdentitiesBuilder +} + +// NewAzureOperatorsAuthentication creates a new builder of 'azure_operators_authentication' objects. +func NewAzureOperatorsAuthentication() *AzureOperatorsAuthenticationBuilder { + return &AzureOperatorsAuthenticationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureOperatorsAuthenticationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ManagedIdentities sets the value of the 'managed_identities' attribute to the given value. +// +// Represents the information related to Azure User-Assigned managed identities +// needed to perform Operators authentication based on Azure User-Assigned +// Managed Identities +func (b *AzureOperatorsAuthenticationBuilder) ManagedIdentities(value *AzureOperatorsAuthenticationManagedIdentitiesBuilder) *AzureOperatorsAuthenticationBuilder { + b.managedIdentities = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureOperatorsAuthenticationBuilder) Copy(object *AzureOperatorsAuthentication) *AzureOperatorsAuthenticationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.managedIdentities != nil { + b.managedIdentities = NewAzureOperatorsAuthenticationManagedIdentities().Copy(object.managedIdentities) + } else { + b.managedIdentities = nil + } + return b +} + +// Build creates a 'azure_operators_authentication' object using the configuration stored in the builder. +func (b *AzureOperatorsAuthenticationBuilder) Build() (object *AzureOperatorsAuthentication, err error) { + object = new(AzureOperatorsAuthentication) + object.bitmap_ = b.bitmap_ + if b.managedIdentities != nil { + object.managedIdentities, err = b.managedIdentities.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/azure_operators_authentication_list_builder.go b/clientapi/clustersmgmt/v1/azure_operators_authentication_list_builder.go new file mode 100644 index 00000000..ad2ea6c0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_operators_authentication_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureOperatorsAuthenticationListBuilder contains the data and logic needed to build +// 'azure_operators_authentication' objects. +type AzureOperatorsAuthenticationListBuilder struct { + items []*AzureOperatorsAuthenticationBuilder +} + +// NewAzureOperatorsAuthenticationList creates a new builder of 'azure_operators_authentication' objects. +func NewAzureOperatorsAuthenticationList() *AzureOperatorsAuthenticationListBuilder { + return new(AzureOperatorsAuthenticationListBuilder) +} + +// Items sets the items of the list. +func (b *AzureOperatorsAuthenticationListBuilder) Items(values ...*AzureOperatorsAuthenticationBuilder) *AzureOperatorsAuthenticationListBuilder { + b.items = make([]*AzureOperatorsAuthenticationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureOperatorsAuthenticationListBuilder) 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 *AzureOperatorsAuthenticationListBuilder) Copy(list *AzureOperatorsAuthenticationList) *AzureOperatorsAuthenticationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureOperatorsAuthenticationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureOperatorsAuthentication().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_operators_authentication' objects using the +// configuration stored in the builder. +func (b *AzureOperatorsAuthenticationListBuilder) Build() (list *AzureOperatorsAuthenticationList, err error) { + items := make([]*AzureOperatorsAuthentication, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureOperatorsAuthenticationList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/azure_operators_authentication_list_type_json.go b/clientapi/clustersmgmt/v1/azure_operators_authentication_list_type_json.go new file mode 100644 index 00000000..f31477ac --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_operators_authentication_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureOperatorsAuthenticationList writes a list of values of the 'azure_operators_authentication' type to +// the given writer. +func MarshalAzureOperatorsAuthenticationList(list []*AzureOperatorsAuthentication, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureOperatorsAuthenticationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureOperatorsAuthenticationList writes a list of value of the 'azure_operators_authentication' type to +// the given stream. +func WriteAzureOperatorsAuthenticationList(list []*AzureOperatorsAuthentication, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureOperatorsAuthentication(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureOperatorsAuthenticationList reads a list of values of the 'azure_operators_authentication' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureOperatorsAuthenticationList(source interface{}) (items []*AzureOperatorsAuthentication, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureOperatorsAuthenticationList(iterator) + err = iterator.Error + return +} + +// ReadAzureOperatorsAuthenticationList reads list of values of the ”azure_operators_authentication' type from +// the given iterator. +func ReadAzureOperatorsAuthenticationList(iterator *jsoniter.Iterator) []*AzureOperatorsAuthentication { + list := []*AzureOperatorsAuthentication{} + for iterator.ReadArray() { + item := ReadAzureOperatorsAuthentication(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_builder.go b/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_builder.go new file mode 100644 index 00000000..e27b9c26 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_builder.go @@ -0,0 +1,149 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureOperatorsAuthenticationManagedIdentitiesBuilder contains the data and logic needed to build 'azure_operators_authentication_managed_identities' objects. +// +// Represents the information related to Azure User-Assigned managed identities +// needed to perform Operators authentication based on Azure User-Assigned +// Managed Identities +type AzureOperatorsAuthenticationManagedIdentitiesBuilder struct { + bitmap_ uint32 + controlPlaneOperatorsManagedIdentities map[string]*AzureControlPlaneManagedIdentityBuilder + dataPlaneOperatorsManagedIdentities map[string]*AzureDataPlaneManagedIdentityBuilder + managedIdentitiesDataPlaneIdentityUrl string + serviceManagedIdentity *AzureServiceManagedIdentityBuilder +} + +// NewAzureOperatorsAuthenticationManagedIdentities creates a new builder of 'azure_operators_authentication_managed_identities' objects. +func NewAzureOperatorsAuthenticationManagedIdentities() *AzureOperatorsAuthenticationManagedIdentitiesBuilder { + return &AzureOperatorsAuthenticationManagedIdentitiesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ControlPlaneOperatorsManagedIdentities sets the value of the 'control_plane_operators_managed_identities' attribute to the given value. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) ControlPlaneOperatorsManagedIdentities(value map[string]*AzureControlPlaneManagedIdentityBuilder) *AzureOperatorsAuthenticationManagedIdentitiesBuilder { + b.controlPlaneOperatorsManagedIdentities = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// DataPlaneOperatorsManagedIdentities sets the value of the 'data_plane_operators_managed_identities' attribute to the given value. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) DataPlaneOperatorsManagedIdentities(value map[string]*AzureDataPlaneManagedIdentityBuilder) *AzureOperatorsAuthenticationManagedIdentitiesBuilder { + b.dataPlaneOperatorsManagedIdentities = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// ManagedIdentitiesDataPlaneIdentityUrl sets the value of the 'managed_identities_data_plane_identity_url' attribute to the given value. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) ManagedIdentitiesDataPlaneIdentityUrl(value string) *AzureOperatorsAuthenticationManagedIdentitiesBuilder { + b.managedIdentitiesDataPlaneIdentityUrl = value + b.bitmap_ |= 4 + return b +} + +// ServiceManagedIdentity sets the value of the 'service_managed_identity' attribute to the given value. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity whose purpose is to perform service level actions. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) ServiceManagedIdentity(value *AzureServiceManagedIdentityBuilder) *AzureOperatorsAuthenticationManagedIdentitiesBuilder { + b.serviceManagedIdentity = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) Copy(object *AzureOperatorsAuthenticationManagedIdentities) *AzureOperatorsAuthenticationManagedIdentitiesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if len(object.controlPlaneOperatorsManagedIdentities) > 0 { + b.controlPlaneOperatorsManagedIdentities = map[string]*AzureControlPlaneManagedIdentityBuilder{} + for k, v := range object.controlPlaneOperatorsManagedIdentities { + b.controlPlaneOperatorsManagedIdentities[k] = NewAzureControlPlaneManagedIdentity().Copy(v) + } + } else { + b.controlPlaneOperatorsManagedIdentities = nil + } + if len(object.dataPlaneOperatorsManagedIdentities) > 0 { + b.dataPlaneOperatorsManagedIdentities = map[string]*AzureDataPlaneManagedIdentityBuilder{} + for k, v := range object.dataPlaneOperatorsManagedIdentities { + b.dataPlaneOperatorsManagedIdentities[k] = NewAzureDataPlaneManagedIdentity().Copy(v) + } + } else { + b.dataPlaneOperatorsManagedIdentities = nil + } + b.managedIdentitiesDataPlaneIdentityUrl = object.managedIdentitiesDataPlaneIdentityUrl + if object.serviceManagedIdentity != nil { + b.serviceManagedIdentity = NewAzureServiceManagedIdentity().Copy(object.serviceManagedIdentity) + } else { + b.serviceManagedIdentity = nil + } + return b +} + +// Build creates a 'azure_operators_authentication_managed_identities' object using the configuration stored in the builder. +func (b *AzureOperatorsAuthenticationManagedIdentitiesBuilder) Build() (object *AzureOperatorsAuthenticationManagedIdentities, err error) { + object = new(AzureOperatorsAuthenticationManagedIdentities) + object.bitmap_ = b.bitmap_ + if b.controlPlaneOperatorsManagedIdentities != nil { + object.controlPlaneOperatorsManagedIdentities = make(map[string]*AzureControlPlaneManagedIdentity) + for k, v := range b.controlPlaneOperatorsManagedIdentities { + object.controlPlaneOperatorsManagedIdentities[k], err = v.Build() + if err != nil { + return + } + } + } + if b.dataPlaneOperatorsManagedIdentities != nil { + object.dataPlaneOperatorsManagedIdentities = make(map[string]*AzureDataPlaneManagedIdentity) + for k, v := range b.dataPlaneOperatorsManagedIdentities { + object.dataPlaneOperatorsManagedIdentities[k], err = v.Build() + if err != nil { + return + } + } + } + object.managedIdentitiesDataPlaneIdentityUrl = b.managedIdentitiesDataPlaneIdentityUrl + if b.serviceManagedIdentity != nil { + object.serviceManagedIdentity, err = b.serviceManagedIdentity.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_list_builder.go b/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_list_builder.go new file mode 100644 index 00000000..09b39425 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureOperatorsAuthenticationManagedIdentitiesListBuilder contains the data and logic needed to build +// 'azure_operators_authentication_managed_identities' objects. +type AzureOperatorsAuthenticationManagedIdentitiesListBuilder struct { + items []*AzureOperatorsAuthenticationManagedIdentitiesBuilder +} + +// NewAzureOperatorsAuthenticationManagedIdentitiesList creates a new builder of 'azure_operators_authentication_managed_identities' objects. +func NewAzureOperatorsAuthenticationManagedIdentitiesList() *AzureOperatorsAuthenticationManagedIdentitiesListBuilder { + return new(AzureOperatorsAuthenticationManagedIdentitiesListBuilder) +} + +// Items sets the items of the list. +func (b *AzureOperatorsAuthenticationManagedIdentitiesListBuilder) Items(values ...*AzureOperatorsAuthenticationManagedIdentitiesBuilder) *AzureOperatorsAuthenticationManagedIdentitiesListBuilder { + b.items = make([]*AzureOperatorsAuthenticationManagedIdentitiesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureOperatorsAuthenticationManagedIdentitiesListBuilder) 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 *AzureOperatorsAuthenticationManagedIdentitiesListBuilder) Copy(list *AzureOperatorsAuthenticationManagedIdentitiesList) *AzureOperatorsAuthenticationManagedIdentitiesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureOperatorsAuthenticationManagedIdentitiesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureOperatorsAuthenticationManagedIdentities().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_operators_authentication_managed_identities' objects using the +// configuration stored in the builder. +func (b *AzureOperatorsAuthenticationManagedIdentitiesListBuilder) Build() (list *AzureOperatorsAuthenticationManagedIdentitiesList, err error) { + items := make([]*AzureOperatorsAuthenticationManagedIdentities, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureOperatorsAuthenticationManagedIdentitiesList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_list_type_json.go b/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_list_type_json.go new file mode 100644 index 00000000..c3877b0d --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureOperatorsAuthenticationManagedIdentitiesList writes a list of values of the 'azure_operators_authentication_managed_identities' type to +// the given writer. +func MarshalAzureOperatorsAuthenticationManagedIdentitiesList(list []*AzureOperatorsAuthenticationManagedIdentities, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureOperatorsAuthenticationManagedIdentitiesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureOperatorsAuthenticationManagedIdentitiesList writes a list of value of the 'azure_operators_authentication_managed_identities' type to +// the given stream. +func WriteAzureOperatorsAuthenticationManagedIdentitiesList(list []*AzureOperatorsAuthenticationManagedIdentities, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureOperatorsAuthenticationManagedIdentities(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureOperatorsAuthenticationManagedIdentitiesList reads a list of values of the 'azure_operators_authentication_managed_identities' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureOperatorsAuthenticationManagedIdentitiesList(source interface{}) (items []*AzureOperatorsAuthenticationManagedIdentities, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureOperatorsAuthenticationManagedIdentitiesList(iterator) + err = iterator.Error + return +} + +// ReadAzureOperatorsAuthenticationManagedIdentitiesList reads list of values of the ”azure_operators_authentication_managed_identities' type from +// the given iterator. +func ReadAzureOperatorsAuthenticationManagedIdentitiesList(iterator *jsoniter.Iterator) []*AzureOperatorsAuthenticationManagedIdentities { + list := []*AzureOperatorsAuthenticationManagedIdentities{} + for iterator.ReadArray() { + item := ReadAzureOperatorsAuthenticationManagedIdentities(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_type.go b/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_type.go new file mode 100644 index 00000000..03c98d4d --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_type.go @@ -0,0 +1,277 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureOperatorsAuthenticationManagedIdentities represents the values of the 'azure_operators_authentication_managed_identities' type. +// +// Represents the information related to Azure User-Assigned managed identities +// needed to perform Operators authentication based on Azure User-Assigned +// Managed Identities +type AzureOperatorsAuthenticationManagedIdentities struct { + bitmap_ uint32 + controlPlaneOperatorsManagedIdentities map[string]*AzureControlPlaneManagedIdentity + dataPlaneOperatorsManagedIdentities map[string]*AzureDataPlaneManagedIdentity + managedIdentitiesDataPlaneIdentityUrl string + serviceManagedIdentity *AzureServiceManagedIdentity +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureOperatorsAuthenticationManagedIdentities) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ControlPlaneOperatorsManagedIdentities returns the value of the 'control_plane_operators_managed_identities' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The set of Azure User-Assigned Managed Identities leveraged for the +// Control Plane operators of the cluster. The set of required managed +// identities is dependent on the Cluster's OpenShift version. +// Immutable +func (o *AzureOperatorsAuthenticationManagedIdentities) ControlPlaneOperatorsManagedIdentities() map[string]*AzureControlPlaneManagedIdentity { + if o != nil && o.bitmap_&1 != 0 { + return o.controlPlaneOperatorsManagedIdentities + } + return nil +} + +// GetControlPlaneOperatorsManagedIdentities returns the value of the 'control_plane_operators_managed_identities' attribute and +// a flag indicating if the attribute has a value. +// +// The set of Azure User-Assigned Managed Identities leveraged for the +// Control Plane operators of the cluster. The set of required managed +// identities is dependent on the Cluster's OpenShift version. +// Immutable +func (o *AzureOperatorsAuthenticationManagedIdentities) GetControlPlaneOperatorsManagedIdentities() (value map[string]*AzureControlPlaneManagedIdentity, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.controlPlaneOperatorsManagedIdentities + } + return +} + +// DataPlaneOperatorsManagedIdentities returns the value of the 'data_plane_operators_managed_identities' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The set of Azure User-Assigned Managed Identities leveraged for the +// Data Plane operators of the cluster. The set of required managed +// identities is dependent on the Cluster's OpenShift version. +// Immutable. +func (o *AzureOperatorsAuthenticationManagedIdentities) DataPlaneOperatorsManagedIdentities() map[string]*AzureDataPlaneManagedIdentity { + if o != nil && o.bitmap_&2 != 0 { + return o.dataPlaneOperatorsManagedIdentities + } + return nil +} + +// GetDataPlaneOperatorsManagedIdentities returns the value of the 'data_plane_operators_managed_identities' attribute and +// a flag indicating if the attribute has a value. +// +// The set of Azure User-Assigned Managed Identities leveraged for the +// Data Plane operators of the cluster. The set of required managed +// identities is dependent on the Cluster's OpenShift version. +// Immutable. +func (o *AzureOperatorsAuthenticationManagedIdentities) GetDataPlaneOperatorsManagedIdentities() (value map[string]*AzureDataPlaneManagedIdentity, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.dataPlaneOperatorsManagedIdentities + } + return +} + +// ManagedIdentitiesDataPlaneIdentityUrl returns the value of the 'managed_identities_data_plane_identity_url' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Managed Identities Data Plane Identity URL associated with the +// cluster. It is the URL that will be used to communicate with the +// Managed Identities Resource Provider (MI RP). +// Required during creation. +// Immutable. +func (o *AzureOperatorsAuthenticationManagedIdentities) ManagedIdentitiesDataPlaneIdentityUrl() string { + if o != nil && o.bitmap_&4 != 0 { + return o.managedIdentitiesDataPlaneIdentityUrl + } + return "" +} + +// GetManagedIdentitiesDataPlaneIdentityUrl returns the value of the 'managed_identities_data_plane_identity_url' attribute and +// a flag indicating if the attribute has a value. +// +// The Managed Identities Data Plane Identity URL associated with the +// cluster. It is the URL that will be used to communicate with the +// Managed Identities Resource Provider (MI RP). +// Required during creation. +// Immutable. +func (o *AzureOperatorsAuthenticationManagedIdentities) GetManagedIdentitiesDataPlaneIdentityUrl() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.managedIdentitiesDataPlaneIdentityUrl + } + return +} + +// ServiceManagedIdentity returns the value of the 'service_managed_identity' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure User-Assigned Managed Identity used to perform service +// level actions. Specifically: +// - Add Federated Identity Credentials to the identities in +// `data_plane_operators_managed_identities` that belong to Data +// Plane Cluster Operators +// - Perform permissions validation for the BYOVNet related resources +// associated to the Cluster +// +// Required during creation. +// Immutable. +func (o *AzureOperatorsAuthenticationManagedIdentities) ServiceManagedIdentity() *AzureServiceManagedIdentity { + if o != nil && o.bitmap_&8 != 0 { + return o.serviceManagedIdentity + } + return nil +} + +// GetServiceManagedIdentity returns the value of the 'service_managed_identity' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure User-Assigned Managed Identity used to perform service +// level actions. Specifically: +// - Add Federated Identity Credentials to the identities in +// `data_plane_operators_managed_identities` that belong to Data +// Plane Cluster Operators +// - Perform permissions validation for the BYOVNet related resources +// associated to the Cluster +// +// Required during creation. +// Immutable. +func (o *AzureOperatorsAuthenticationManagedIdentities) GetServiceManagedIdentity() (value *AzureServiceManagedIdentity, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.serviceManagedIdentity + } + return +} + +// AzureOperatorsAuthenticationManagedIdentitiesListKind is the name of the type used to represent list of objects of +// type 'azure_operators_authentication_managed_identities'. +const AzureOperatorsAuthenticationManagedIdentitiesListKind = "AzureOperatorsAuthenticationManagedIdentitiesList" + +// AzureOperatorsAuthenticationManagedIdentitiesListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_operators_authentication_managed_identities'. +const AzureOperatorsAuthenticationManagedIdentitiesListLinkKind = "AzureOperatorsAuthenticationManagedIdentitiesListLink" + +// AzureOperatorsAuthenticationManagedIdentitiesNilKind is the name of the type used to nil lists of objects of +// type 'azure_operators_authentication_managed_identities'. +const AzureOperatorsAuthenticationManagedIdentitiesListNilKind = "AzureOperatorsAuthenticationManagedIdentitiesListNil" + +// AzureOperatorsAuthenticationManagedIdentitiesList is a list of values of the 'azure_operators_authentication_managed_identities' type. +type AzureOperatorsAuthenticationManagedIdentitiesList struct { + href string + link bool + items []*AzureOperatorsAuthenticationManagedIdentities +} + +// Len returns the length of the list. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) SetItems(items []*AzureOperatorsAuthenticationManagedIdentities) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Items() []*AzureOperatorsAuthenticationManagedIdentities { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Get(i int) *AzureOperatorsAuthenticationManagedIdentities { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Slice() []*AzureOperatorsAuthenticationManagedIdentities { + var slice []*AzureOperatorsAuthenticationManagedIdentities + if l == nil { + slice = make([]*AzureOperatorsAuthenticationManagedIdentities, 0) + } else { + slice = make([]*AzureOperatorsAuthenticationManagedIdentities, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Each(f func(item *AzureOperatorsAuthenticationManagedIdentities) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureOperatorsAuthenticationManagedIdentitiesList) Range(f func(index int, item *AzureOperatorsAuthenticationManagedIdentities) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_type_json.go b/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_type_json.go new file mode 100644 index 00000000..48723a29 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_operators_authentication_managed_identities_type_json.go @@ -0,0 +1,182 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureOperatorsAuthenticationManagedIdentities writes a value of the 'azure_operators_authentication_managed_identities' type to the given writer. +func MarshalAzureOperatorsAuthenticationManagedIdentities(object *AzureOperatorsAuthenticationManagedIdentities, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureOperatorsAuthenticationManagedIdentities(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureOperatorsAuthenticationManagedIdentities writes a value of the 'azure_operators_authentication_managed_identities' type to the given stream. +func WriteAzureOperatorsAuthenticationManagedIdentities(object *AzureOperatorsAuthenticationManagedIdentities, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.controlPlaneOperatorsManagedIdentities != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("control_plane_operators_managed_identities") + if object.controlPlaneOperatorsManagedIdentities != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.controlPlaneOperatorsManagedIdentities)) + i := 0 + for key := range object.controlPlaneOperatorsManagedIdentities { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.controlPlaneOperatorsManagedIdentities[key] + stream.WriteObjectField(key) + WriteAzureControlPlaneManagedIdentity(item, stream) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&2 != 0 && object.dataPlaneOperatorsManagedIdentities != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("data_plane_operators_managed_identities") + if object.dataPlaneOperatorsManagedIdentities != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.dataPlaneOperatorsManagedIdentities)) + i := 0 + for key := range object.dataPlaneOperatorsManagedIdentities { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.dataPlaneOperatorsManagedIdentities[key] + stream.WriteObjectField(key) + WriteAzureDataPlaneManagedIdentity(item, stream) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_identities_data_plane_identity_url") + stream.WriteString(object.managedIdentitiesDataPlaneIdentityUrl) + count++ + } + present_ = object.bitmap_&8 != 0 && object.serviceManagedIdentity != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_managed_identity") + WriteAzureServiceManagedIdentity(object.serviceManagedIdentity, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureOperatorsAuthenticationManagedIdentities reads a value of the 'azure_operators_authentication_managed_identities' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureOperatorsAuthenticationManagedIdentities(source interface{}) (object *AzureOperatorsAuthenticationManagedIdentities, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureOperatorsAuthenticationManagedIdentities(iterator) + err = iterator.Error + return +} + +// ReadAzureOperatorsAuthenticationManagedIdentities reads a value of the 'azure_operators_authentication_managed_identities' type from the given iterator. +func ReadAzureOperatorsAuthenticationManagedIdentities(iterator *jsoniter.Iterator) *AzureOperatorsAuthenticationManagedIdentities { + object := &AzureOperatorsAuthenticationManagedIdentities{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "control_plane_operators_managed_identities": + value := map[string]*AzureControlPlaneManagedIdentity{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := ReadAzureControlPlaneManagedIdentity(iterator) + value[key] = item + } + object.controlPlaneOperatorsManagedIdentities = value + object.bitmap_ |= 1 + case "data_plane_operators_managed_identities": + value := map[string]*AzureDataPlaneManagedIdentity{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := ReadAzureDataPlaneManagedIdentity(iterator) + value[key] = item + } + object.dataPlaneOperatorsManagedIdentities = value + object.bitmap_ |= 2 + case "managed_identities_data_plane_identity_url": + value := iterator.ReadString() + object.managedIdentitiesDataPlaneIdentityUrl = value + object.bitmap_ |= 4 + case "service_managed_identity": + value := ReadAzureServiceManagedIdentity(iterator) + object.serviceManagedIdentity = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/azure_operators_authentication_type.go b/clientapi/clustersmgmt/v1/azure_operators_authentication_type.go new file mode 100644 index 00000000..a0f402e3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_operators_authentication_type.go @@ -0,0 +1,170 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureOperatorsAuthentication represents the values of the 'azure_operators_authentication' type. +// +// The configuration that the operators of the +// cluster have to authenticate to Azure. +type AzureOperatorsAuthentication struct { + bitmap_ uint32 + managedIdentities *AzureOperatorsAuthenticationManagedIdentities +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureOperatorsAuthentication) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ManagedIdentities returns the value of the 'managed_identities' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The authentication configuration to authenticate +// to Azure using Azure User-Assigned Managed Identities. +// Required during creation. +func (o *AzureOperatorsAuthentication) ManagedIdentities() *AzureOperatorsAuthenticationManagedIdentities { + if o != nil && o.bitmap_&1 != 0 { + return o.managedIdentities + } + return nil +} + +// GetManagedIdentities returns the value of the 'managed_identities' attribute and +// a flag indicating if the attribute has a value. +// +// The authentication configuration to authenticate +// to Azure using Azure User-Assigned Managed Identities. +// Required during creation. +func (o *AzureOperatorsAuthentication) GetManagedIdentities() (value *AzureOperatorsAuthenticationManagedIdentities, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.managedIdentities + } + return +} + +// AzureOperatorsAuthenticationListKind is the name of the type used to represent list of objects of +// type 'azure_operators_authentication'. +const AzureOperatorsAuthenticationListKind = "AzureOperatorsAuthenticationList" + +// AzureOperatorsAuthenticationListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_operators_authentication'. +const AzureOperatorsAuthenticationListLinkKind = "AzureOperatorsAuthenticationListLink" + +// AzureOperatorsAuthenticationNilKind is the name of the type used to nil lists of objects of +// type 'azure_operators_authentication'. +const AzureOperatorsAuthenticationListNilKind = "AzureOperatorsAuthenticationListNil" + +// AzureOperatorsAuthenticationList is a list of values of the 'azure_operators_authentication' type. +type AzureOperatorsAuthenticationList struct { + href string + link bool + items []*AzureOperatorsAuthentication +} + +// Len returns the length of the list. +func (l *AzureOperatorsAuthenticationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureOperatorsAuthenticationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureOperatorsAuthenticationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureOperatorsAuthenticationList) SetItems(items []*AzureOperatorsAuthentication) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureOperatorsAuthenticationList) Items() []*AzureOperatorsAuthentication { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureOperatorsAuthenticationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureOperatorsAuthenticationList) Get(i int) *AzureOperatorsAuthentication { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureOperatorsAuthenticationList) Slice() []*AzureOperatorsAuthentication { + var slice []*AzureOperatorsAuthentication + if l == nil { + slice = make([]*AzureOperatorsAuthentication, 0) + } else { + slice = make([]*AzureOperatorsAuthentication, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureOperatorsAuthenticationList) Each(f func(item *AzureOperatorsAuthentication) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureOperatorsAuthenticationList) Range(f func(index int, item *AzureOperatorsAuthentication) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/azure_operators_authentication_type_json.go b/clientapi/clustersmgmt/v1/azure_operators_authentication_type_json.go new file mode 100644 index 00000000..d7d3362d --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_operators_authentication_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureOperatorsAuthentication writes a value of the 'azure_operators_authentication' type to the given writer. +func MarshalAzureOperatorsAuthentication(object *AzureOperatorsAuthentication, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureOperatorsAuthentication(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureOperatorsAuthentication writes a value of the 'azure_operators_authentication' type to the given stream. +func WriteAzureOperatorsAuthentication(object *AzureOperatorsAuthentication, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.managedIdentities != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_identities") + WriteAzureOperatorsAuthenticationManagedIdentities(object.managedIdentities, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureOperatorsAuthentication reads a value of the 'azure_operators_authentication' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureOperatorsAuthentication(source interface{}) (object *AzureOperatorsAuthentication, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureOperatorsAuthentication(iterator) + err = iterator.Error + return +} + +// ReadAzureOperatorsAuthentication reads a value of the 'azure_operators_authentication' type from the given iterator. +func ReadAzureOperatorsAuthentication(iterator *jsoniter.Iterator) *AzureOperatorsAuthentication { + object := &AzureOperatorsAuthentication{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "managed_identities": + value := ReadAzureOperatorsAuthenticationManagedIdentities(iterator) + object.managedIdentities = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/azure_service_managed_identity_builder.go b/clientapi/clustersmgmt/v1/azure_service_managed_identity_builder.go new file mode 100644 index 00000000..09164f49 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_service_managed_identity_builder.go @@ -0,0 +1,84 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureServiceManagedIdentityBuilder contains the data and logic needed to build 'azure_service_managed_identity' objects. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity whose purpose is to perform service level actions. +type AzureServiceManagedIdentityBuilder struct { + bitmap_ uint32 + clientID string + principalID string + resourceID string +} + +// NewAzureServiceManagedIdentity creates a new builder of 'azure_service_managed_identity' objects. +func NewAzureServiceManagedIdentity() *AzureServiceManagedIdentityBuilder { + return &AzureServiceManagedIdentityBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AzureServiceManagedIdentityBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ClientID sets the value of the 'client_ID' attribute to the given value. +func (b *AzureServiceManagedIdentityBuilder) ClientID(value string) *AzureServiceManagedIdentityBuilder { + b.clientID = value + b.bitmap_ |= 1 + return b +} + +// PrincipalID sets the value of the 'principal_ID' attribute to the given value. +func (b *AzureServiceManagedIdentityBuilder) PrincipalID(value string) *AzureServiceManagedIdentityBuilder { + b.principalID = value + b.bitmap_ |= 2 + return b +} + +// ResourceID sets the value of the 'resource_ID' attribute to the given value. +func (b *AzureServiceManagedIdentityBuilder) ResourceID(value string) *AzureServiceManagedIdentityBuilder { + b.resourceID = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AzureServiceManagedIdentityBuilder) Copy(object *AzureServiceManagedIdentity) *AzureServiceManagedIdentityBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.clientID = object.clientID + b.principalID = object.principalID + b.resourceID = object.resourceID + return b +} + +// Build creates a 'azure_service_managed_identity' object using the configuration stored in the builder. +func (b *AzureServiceManagedIdentityBuilder) Build() (object *AzureServiceManagedIdentity, err error) { + object = new(AzureServiceManagedIdentity) + object.bitmap_ = b.bitmap_ + object.clientID = b.clientID + object.principalID = b.principalID + object.resourceID = b.resourceID + return +} diff --git a/clientapi/clustersmgmt/v1/azure_service_managed_identity_list_builder.go b/clientapi/clustersmgmt/v1/azure_service_managed_identity_list_builder.go new file mode 100644 index 00000000..97263f3d --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_service_managed_identity_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureServiceManagedIdentityListBuilder contains the data and logic needed to build +// 'azure_service_managed_identity' objects. +type AzureServiceManagedIdentityListBuilder struct { + items []*AzureServiceManagedIdentityBuilder +} + +// NewAzureServiceManagedIdentityList creates a new builder of 'azure_service_managed_identity' objects. +func NewAzureServiceManagedIdentityList() *AzureServiceManagedIdentityListBuilder { + return new(AzureServiceManagedIdentityListBuilder) +} + +// Items sets the items of the list. +func (b *AzureServiceManagedIdentityListBuilder) Items(values ...*AzureServiceManagedIdentityBuilder) *AzureServiceManagedIdentityListBuilder { + b.items = make([]*AzureServiceManagedIdentityBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AzureServiceManagedIdentityListBuilder) 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 *AzureServiceManagedIdentityListBuilder) Copy(list *AzureServiceManagedIdentityList) *AzureServiceManagedIdentityListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AzureServiceManagedIdentityBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAzureServiceManagedIdentity().Copy(v) + } + } + return b +} + +// Build creates a list of 'azure_service_managed_identity' objects using the +// configuration stored in the builder. +func (b *AzureServiceManagedIdentityListBuilder) Build() (list *AzureServiceManagedIdentityList, err error) { + items := make([]*AzureServiceManagedIdentity, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AzureServiceManagedIdentityList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/azure_service_managed_identity_list_type_json.go b/clientapi/clustersmgmt/v1/azure_service_managed_identity_list_type_json.go new file mode 100644 index 00000000..10b074e2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_service_managed_identity_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureServiceManagedIdentityList writes a list of values of the 'azure_service_managed_identity' type to +// the given writer. +func MarshalAzureServiceManagedIdentityList(list []*AzureServiceManagedIdentity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureServiceManagedIdentityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureServiceManagedIdentityList writes a list of value of the 'azure_service_managed_identity' type to +// the given stream. +func WriteAzureServiceManagedIdentityList(list []*AzureServiceManagedIdentity, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAzureServiceManagedIdentity(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAzureServiceManagedIdentityList reads a list of values of the 'azure_service_managed_identity' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAzureServiceManagedIdentityList(source interface{}) (items []*AzureServiceManagedIdentity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAzureServiceManagedIdentityList(iterator) + err = iterator.Error + return +} + +// ReadAzureServiceManagedIdentityList reads list of values of the ”azure_service_managed_identity' type from +// the given iterator. +func ReadAzureServiceManagedIdentityList(iterator *jsoniter.Iterator) []*AzureServiceManagedIdentity { + list := []*AzureServiceManagedIdentity{} + for iterator.ReadArray() { + item := ReadAzureServiceManagedIdentity(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/azure_service_managed_identity_type.go b/clientapi/clustersmgmt/v1/azure_service_managed_identity_type.go new file mode 100644 index 00000000..0052c0f8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_service_managed_identity_type.go @@ -0,0 +1,244 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// AzureServiceManagedIdentity represents the values of the 'azure_service_managed_identity' type. +// +// Represents the information associated to an Azure User-Assigned +// Managed Identity whose purpose is to perform service level actions. +type AzureServiceManagedIdentity struct { + bitmap_ uint32 + clientID string + principalID string + resourceID string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AzureServiceManagedIdentity) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ClientID returns the value of the 'client_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Client ID associated to the Azure User-Assigned Managed Identity. +// Readonly. +func (o *AzureServiceManagedIdentity) ClientID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.clientID + } + return "" +} + +// GetClientID returns the value of the 'client_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Client ID associated to the Azure User-Assigned Managed Identity. +// Readonly. +func (o *AzureServiceManagedIdentity) GetClientID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.clientID + } + return +} + +// PrincipalID returns the value of the 'principal_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Principal ID associated to the Azure User-Assigned Managed Identity. +// Readonly. +func (o *AzureServiceManagedIdentity) PrincipalID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.principalID + } + return "" +} + +// GetPrincipalID returns the value of the 'principal_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Principal ID associated to the Azure User-Assigned Managed Identity. +// Readonly. +func (o *AzureServiceManagedIdentity) GetPrincipalID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.principalID + } + return +} + +// ResourceID returns the value of the 'resource_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource ID of the Azure User-Assigned Managed +// Identity. The managed identity represented must exist before +// creating the cluster. +// The Azure Resource Group Name specified as part of the Resource ID +// must belong to the Azure Subscription specified in `.azure.subscription_id`, +// and in the same Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of the Resource ID +// must be a different Resource Group Name than the one specified in +// `.azure.managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the Resource ID +// can be the same, or a different one than the one specified in +// `.azure.resource_group_name`. +// Required during creation. +// Immutable. +func (o *AzureServiceManagedIdentity) ResourceID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.resourceID + } + return "" +} + +// GetResourceID returns the value of the 'resource_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource ID of the Azure User-Assigned Managed +// Identity. The managed identity represented must exist before +// creating the cluster. +// The Azure Resource Group Name specified as part of the Resource ID +// must belong to the Azure Subscription specified in `.azure.subscription_id`, +// and in the same Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of the Resource ID +// must be a different Resource Group Name than the one specified in +// `.azure.managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the Resource ID +// can be the same, or a different one than the one specified in +// `.azure.resource_group_name`. +// Required during creation. +// Immutable. +func (o *AzureServiceManagedIdentity) GetResourceID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.resourceID + } + return +} + +// AzureServiceManagedIdentityListKind is the name of the type used to represent list of objects of +// type 'azure_service_managed_identity'. +const AzureServiceManagedIdentityListKind = "AzureServiceManagedIdentityList" + +// AzureServiceManagedIdentityListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure_service_managed_identity'. +const AzureServiceManagedIdentityListLinkKind = "AzureServiceManagedIdentityListLink" + +// AzureServiceManagedIdentityNilKind is the name of the type used to nil lists of objects of +// type 'azure_service_managed_identity'. +const AzureServiceManagedIdentityListNilKind = "AzureServiceManagedIdentityListNil" + +// AzureServiceManagedIdentityList is a list of values of the 'azure_service_managed_identity' type. +type AzureServiceManagedIdentityList struct { + href string + link bool + items []*AzureServiceManagedIdentity +} + +// Len returns the length of the list. +func (l *AzureServiceManagedIdentityList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureServiceManagedIdentityList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureServiceManagedIdentityList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureServiceManagedIdentityList) SetItems(items []*AzureServiceManagedIdentity) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureServiceManagedIdentityList) Items() []*AzureServiceManagedIdentity { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureServiceManagedIdentityList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureServiceManagedIdentityList) Get(i int) *AzureServiceManagedIdentity { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureServiceManagedIdentityList) Slice() []*AzureServiceManagedIdentity { + var slice []*AzureServiceManagedIdentity + if l == nil { + slice = make([]*AzureServiceManagedIdentity, 0) + } else { + slice = make([]*AzureServiceManagedIdentity, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureServiceManagedIdentityList) Each(f func(item *AzureServiceManagedIdentity) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureServiceManagedIdentityList) Range(f func(index int, item *AzureServiceManagedIdentity) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/azure_service_managed_identity_type_json.go b/clientapi/clustersmgmt/v1/azure_service_managed_identity_type_json.go new file mode 100644 index 00000000..d343ccc5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_service_managed_identity_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzureServiceManagedIdentity writes a value of the 'azure_service_managed_identity' type to the given writer. +func MarshalAzureServiceManagedIdentity(object *AzureServiceManagedIdentity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzureServiceManagedIdentity(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzureServiceManagedIdentity writes a value of the 'azure_service_managed_identity' type to the given stream. +func WriteAzureServiceManagedIdentity(object *AzureServiceManagedIdentity, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_id") + stream.WriteString(object.clientID) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("principal_id") + stream.WriteString(object.principalID) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_id") + stream.WriteString(object.resourceID) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzureServiceManagedIdentity reads a value of the 'azure_service_managed_identity' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzureServiceManagedIdentity(source interface{}) (object *AzureServiceManagedIdentity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzureServiceManagedIdentity(iterator) + err = iterator.Error + return +} + +// ReadAzureServiceManagedIdentity reads a value of the 'azure_service_managed_identity' type from the given iterator. +func ReadAzureServiceManagedIdentity(iterator *jsoniter.Iterator) *AzureServiceManagedIdentity { + object := &AzureServiceManagedIdentity{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "client_id": + value := iterator.ReadString() + object.clientID = value + object.bitmap_ |= 1 + case "principal_id": + value := iterator.ReadString() + object.principalID = value + object.bitmap_ |= 2 + case "resource_id": + value := iterator.ReadString() + object.resourceID = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/azure_type.go b/clientapi/clustersmgmt/v1/azure_type.go new file mode 100644 index 00000000..00c9f178 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_type.go @@ -0,0 +1,485 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// Azure represents the values of the 'azure' type. +// +// Microsoft Azure settings of a cluster. +type Azure struct { + bitmap_ uint32 + managedResourceGroupName string + networkSecurityGroupResourceID string + nodesOutboundConnectivity *AzureNodesOutboundConnectivity + operatorsAuthentication *AzureOperatorsAuthentication + resourceGroupName string + resourceName string + subnetResourceID string + subscriptionID string + tenantID string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Azure) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ManagedResourceGroupName returns the value of the 'managed_resource_group_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The desired name of the Azure Resource Group where the Azure Resources related +// to the cluster are created. It must not previously exist. The Azure Resource +// Group is created with the given value, within the Azure Subscription +// `subscription_id` of the cluster. +// `managed_resource_group_name` cannot be equal to the value of `managed_resource_group`. +// `managed_resource_group_name` is located in the same Azure location as the +// cluster's region. +// Not to be confused with `resource_group_name`, which is the Azure Resource Group Name +// where the own Azure Resource associated to the cluster resides. +// Required during creation. +// Immutable. +func (o *Azure) ManagedResourceGroupName() string { + if o != nil && o.bitmap_&1 != 0 { + return o.managedResourceGroupName + } + return "" +} + +// GetManagedResourceGroupName returns the value of the 'managed_resource_group_name' attribute and +// a flag indicating if the attribute has a value. +// +// The desired name of the Azure Resource Group where the Azure Resources related +// to the cluster are created. It must not previously exist. The Azure Resource +// Group is created with the given value, within the Azure Subscription +// `subscription_id` of the cluster. +// `managed_resource_group_name` cannot be equal to the value of `managed_resource_group`. +// `managed_resource_group_name` is located in the same Azure location as the +// cluster's region. +// Not to be confused with `resource_group_name`, which is the Azure Resource Group Name +// where the own Azure Resource associated to the cluster resides. +// Required during creation. +// Immutable. +func (o *Azure) GetManagedResourceGroupName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.managedResourceGroupName + } + return +} + +// NetworkSecurityGroupResourceID returns the value of the 'network_security_group_resource_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource ID of a pre-existing Azure Network Security Group. +// The Network Security Group specified in network_security_group_resource_id +// must already be associated to the Azure Subnet `subnet_resource_id`. +// It is the Azure Network Security Group associated to the cluster's subnet +// specified in `subnet_resource_id`. +// `network_security_group_resource_id` must be located in the same Azure +// location as the cluster's region. +// The Azure Subscription specified as part of +// `network_security_group_resource_id` must be located in the same Azure +// Subscription as `subscription_id`. +// The Azure Resource Group Name specified as part of `network_security_group_resource_id` +// must belong to the Azure Subscription `subscription_id`, and in the same +// Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of `network_security_group_resource_id` +// must be a different Resource Group Name than the one specified in +// `managed_resource_group_name`. +// The Azure Resource Group Name specified as part of `network_security_group_resource_id` +// can be the same, or a different one than the one specified in +// `resource_group_name`. +// Required during creation. +// Immutable. +func (o *Azure) NetworkSecurityGroupResourceID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.networkSecurityGroupResourceID + } + return "" +} + +// GetNetworkSecurityGroupResourceID returns the value of the 'network_security_group_resource_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource ID of a pre-existing Azure Network Security Group. +// The Network Security Group specified in network_security_group_resource_id +// must already be associated to the Azure Subnet `subnet_resource_id`. +// It is the Azure Network Security Group associated to the cluster's subnet +// specified in `subnet_resource_id`. +// `network_security_group_resource_id` must be located in the same Azure +// location as the cluster's region. +// The Azure Subscription specified as part of +// `network_security_group_resource_id` must be located in the same Azure +// Subscription as `subscription_id`. +// The Azure Resource Group Name specified as part of `network_security_group_resource_id` +// must belong to the Azure Subscription `subscription_id`, and in the same +// Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of `network_security_group_resource_id` +// must be a different Resource Group Name than the one specified in +// `managed_resource_group_name`. +// The Azure Resource Group Name specified as part of `network_security_group_resource_id` +// can be the same, or a different one than the one specified in +// `resource_group_name`. +// Required during creation. +// Immutable. +func (o *Azure) GetNetworkSecurityGroupResourceID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.networkSecurityGroupResourceID + } + return +} + +// NodesOutboundConnectivity returns the value of the 'nodes_outbound_connectivity' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// NodesOutboundConnectivity defines how the network outbound +// configuration of the Cluster's Node Pool's Nodes is performed. +// By default this is configured as Azure Load Balancer. This value is immutable. +func (o *Azure) NodesOutboundConnectivity() *AzureNodesOutboundConnectivity { + if o != nil && o.bitmap_&4 != 0 { + return o.nodesOutboundConnectivity + } + return nil +} + +// GetNodesOutboundConnectivity returns the value of the 'nodes_outbound_connectivity' attribute and +// a flag indicating if the attribute has a value. +// +// NodesOutboundConnectivity defines how the network outbound +// configuration of the Cluster's Node Pool's Nodes is performed. +// By default this is configured as Azure Load Balancer. This value is immutable. +func (o *Azure) GetNodesOutboundConnectivity() (value *AzureNodesOutboundConnectivity, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.nodesOutboundConnectivity + } + return +} + +// OperatorsAuthentication returns the value of the 'operators_authentication' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines how the operators of the cluster authenticate to Azure. +// Required during creation. +// Immutable. +func (o *Azure) OperatorsAuthentication() *AzureOperatorsAuthentication { + if o != nil && o.bitmap_&8 != 0 { + return o.operatorsAuthentication + } + return nil +} + +// GetOperatorsAuthentication returns the value of the 'operators_authentication' attribute and +// a flag indicating if the attribute has a value. +// +// Defines how the operators of the cluster authenticate to Azure. +// Required during creation. +// Immutable. +func (o *Azure) GetOperatorsAuthentication() (value *AzureOperatorsAuthentication, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.operatorsAuthentication + } + return +} + +// ResourceGroupName returns the value of the 'resource_group_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource Group Name of the cluster. It must be a pre-existing +// Azure Resource Group and it must exist within the Azure Subscription +// `subscription_id` of the cluster. +// `resource_group_name` is located in the same Azure location as the +// cluster's region. +// Required during creation. +// Immutable. +func (o *Azure) ResourceGroupName() string { + if o != nil && o.bitmap_&16 != 0 { + return o.resourceGroupName + } + return "" +} + +// GetResourceGroupName returns the value of the 'resource_group_name' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource Group Name of the cluster. It must be a pre-existing +// Azure Resource Group and it must exist within the Azure Subscription +// `subscription_id` of the cluster. +// `resource_group_name` is located in the same Azure location as the +// cluster's region. +// Required during creation. +// Immutable. +func (o *Azure) GetResourceGroupName() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.resourceGroupName + } + return +} + +// ResourceName returns the value of the 'resource_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource Name of the cluster. It must be within the +// Azure Resource Group Name `resource_group_name`. +// `resource_name` is located in the same Azure location as the cluster's region. +// Required during creation. +// Immutable. +func (o *Azure) ResourceName() string { + if o != nil && o.bitmap_&32 != 0 { + return o.resourceName + } + return "" +} + +// GetResourceName returns the value of the 'resource_name' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource Name of the cluster. It must be within the +// Azure Resource Group Name `resource_group_name`. +// `resource_name` is located in the same Azure location as the cluster's region. +// Required during creation. +// Immutable. +func (o *Azure) GetResourceName() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.resourceName + } + return +} + +// SubnetResourceID returns the value of the 'subnet_resource_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Resource ID of a pre-existing Azure Subnet. It is an Azure +// Subnet used for the Data Plane of the cluster. `subnet_resource_id` +// must be located in the same Azure location as the cluster's region. +// The Azure Subscription specified as part of the `subnet_resource_id` +// must be located in the same Azure Subscription as `subscription_id`. +// The Azure Resource Group Name specified as part of `subnet_resource_id` +// must belong to the Azure Subscription `subscription_id`, and in the same +// Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of `subnet_resource_id` +// must be a different Resource Group Name than the one specified in +// `managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the `subnet_resource_id` +// can be the same, or a different one than the one specified in +// `resource_group_name`. +// Required during creation. +// Immutable. +func (o *Azure) SubnetResourceID() string { + if o != nil && o.bitmap_&64 != 0 { + return o.subnetResourceID + } + return "" +} + +// GetSubnetResourceID returns the value of the 'subnet_resource_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Resource ID of a pre-existing Azure Subnet. It is an Azure +// Subnet used for the Data Plane of the cluster. `subnet_resource_id` +// must be located in the same Azure location as the cluster's region. +// The Azure Subscription specified as part of the `subnet_resource_id` +// must be located in the same Azure Subscription as `subscription_id`. +// The Azure Resource Group Name specified as part of `subnet_resource_id` +// must belong to the Azure Subscription `subscription_id`, and in the same +// Azure location as the cluster's region. +// The Azure Resource Group Name specified as part of `subnet_resource_id` +// must be a different Resource Group Name than the one specified in +// `managed_resource_group_name`. +// The Azure Resource Group Name specified as part of the `subnet_resource_id` +// can be the same, or a different one than the one specified in +// `resource_group_name`. +// Required during creation. +// Immutable. +func (o *Azure) GetSubnetResourceID() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.subnetResourceID + } + return +} + +// SubscriptionID returns the value of the 'subscription_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Azure Subscription ID associated with the cluster. It must belong to +// the Microsoft Entra Tenant ID `tenant_id`. +// Required during creation. +// Immutable. +func (o *Azure) SubscriptionID() string { + if o != nil && o.bitmap_&128 != 0 { + return o.subscriptionID + } + return "" +} + +// GetSubscriptionID returns the value of the 'subscription_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Azure Subscription ID associated with the cluster. It must belong to +// the Microsoft Entra Tenant ID `tenant_id`. +// Required during creation. +// Immutable. +func (o *Azure) GetSubscriptionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.subscriptionID + } + return +} + +// TenantID returns the value of the 'tenant_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Microsoft Entra Tenant ID where the cluster belongs. +// Required during creation. +// Immutable. +func (o *Azure) TenantID() string { + if o != nil && o.bitmap_&256 != 0 { + return o.tenantID + } + return "" +} + +// GetTenantID returns the value of the 'tenant_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The Microsoft Entra Tenant ID where the cluster belongs. +// Required during creation. +// Immutable. +func (o *Azure) GetTenantID() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.tenantID + } + return +} + +// AzureListKind is the name of the type used to represent list of objects of +// type 'azure'. +const AzureListKind = "AzureList" + +// AzureListLinkKind is the name of the type used to represent links to list +// of objects of type 'azure'. +const AzureListLinkKind = "AzureListLink" + +// AzureNilKind is the name of the type used to nil lists of objects of +// type 'azure'. +const AzureListNilKind = "AzureListNil" + +// AzureList is a list of values of the 'azure' type. +type AzureList struct { + href string + link bool + items []*Azure +} + +// Len returns the length of the list. +func (l *AzureList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AzureList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AzureList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AzureList) SetItems(items []*Azure) { + l.items = items +} + +// Items returns the items of the list. +func (l *AzureList) Items() []*Azure { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AzureList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AzureList) Get(i int) *Azure { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AzureList) Slice() []*Azure { + var slice []*Azure + if l == nil { + slice = make([]*Azure, 0) + } else { + slice = make([]*Azure, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AzureList) Each(f func(item *Azure) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AzureList) Range(f func(index int, item *Azure) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/azure_type_json.go b/clientapi/clustersmgmt/v1/azure_type_json.go new file mode 100644 index 00000000..104c2255 --- /dev/null +++ b/clientapi/clustersmgmt/v1/azure_type_json.go @@ -0,0 +1,190 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAzure writes a value of the 'azure' type to the given writer. +func MarshalAzure(object *Azure, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAzure(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAzure writes a value of the 'azure' type to the given stream. +func WriteAzure(object *Azure, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_resource_group_name") + stream.WriteString(object.managedResourceGroupName) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("network_security_group_resource_id") + stream.WriteString(object.networkSecurityGroupResourceID) + count++ + } + present_ = object.bitmap_&4 != 0 && object.nodesOutboundConnectivity != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("nodes_outbound_connectivity") + WriteAzureNodesOutboundConnectivity(object.nodesOutboundConnectivity, stream) + count++ + } + present_ = object.bitmap_&8 != 0 && object.operatorsAuthentication != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operators_authentication") + WriteAzureOperatorsAuthentication(object.operatorsAuthentication, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_group_name") + stream.WriteString(object.resourceGroupName) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_name") + stream.WriteString(object.resourceName) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnet_resource_id") + stream.WriteString(object.subnetResourceID) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionID) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("tenant_id") + stream.WriteString(object.tenantID) + } + stream.WriteObjectEnd() +} + +// UnmarshalAzure reads a value of the 'azure' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAzure(source interface{}) (object *Azure, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAzure(iterator) + err = iterator.Error + return +} + +// ReadAzure reads a value of the 'azure' type from the given iterator. +func ReadAzure(iterator *jsoniter.Iterator) *Azure { + object := &Azure{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "managed_resource_group_name": + value := iterator.ReadString() + object.managedResourceGroupName = value + object.bitmap_ |= 1 + case "network_security_group_resource_id": + value := iterator.ReadString() + object.networkSecurityGroupResourceID = value + object.bitmap_ |= 2 + case "nodes_outbound_connectivity": + value := ReadAzureNodesOutboundConnectivity(iterator) + object.nodesOutboundConnectivity = value + object.bitmap_ |= 4 + case "operators_authentication": + value := ReadAzureOperatorsAuthentication(iterator) + object.operatorsAuthentication = value + object.bitmap_ |= 8 + case "resource_group_name": + value := iterator.ReadString() + object.resourceGroupName = value + object.bitmap_ |= 16 + case "resource_name": + value := iterator.ReadString() + object.resourceName = value + object.bitmap_ |= 32 + case "subnet_resource_id": + value := iterator.ReadString() + object.subnetResourceID = value + object.bitmap_ |= 64 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionID = value + object.bitmap_ |= 128 + case "tenant_id": + value := iterator.ReadString() + object.tenantID = value + object.bitmap_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/billing_model_item_builder.go b/clientapi/clustersmgmt/v1/billing_model_item_builder.go new file mode 100644 index 00000000..9386731c --- /dev/null +++ b/clientapi/clustersmgmt/v1/billing_model_item_builder.go @@ -0,0 +1,119 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// BillingModelItemBuilder contains the data and logic needed to build 'billing_model_item' objects. +// +// BillingModelItem represents a billing model +type BillingModelItemBuilder struct { + bitmap_ uint32 + id string + href string + billingModelType string + description string + displayName string + marketplace string +} + +// NewBillingModelItem creates a new builder of 'billing_model_item' objects. +func NewBillingModelItem() *BillingModelItemBuilder { + return &BillingModelItemBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *BillingModelItemBuilder) Link(value bool) *BillingModelItemBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *BillingModelItemBuilder) ID(value string) *BillingModelItemBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *BillingModelItemBuilder) HREF(value string) *BillingModelItemBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *BillingModelItemBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// BillingModelType sets the value of the 'billing_model_type' attribute to the given value. +func (b *BillingModelItemBuilder) BillingModelType(value string) *BillingModelItemBuilder { + b.billingModelType = value + b.bitmap_ |= 8 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *BillingModelItemBuilder) Description(value string) *BillingModelItemBuilder { + b.description = value + b.bitmap_ |= 16 + return b +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *BillingModelItemBuilder) DisplayName(value string) *BillingModelItemBuilder { + b.displayName = value + b.bitmap_ |= 32 + return b +} + +// Marketplace sets the value of the 'marketplace' attribute to the given value. +func (b *BillingModelItemBuilder) Marketplace(value string) *BillingModelItemBuilder { + b.marketplace = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *BillingModelItemBuilder) Copy(object *BillingModelItem) *BillingModelItemBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.billingModelType = object.billingModelType + b.description = object.description + b.displayName = object.displayName + b.marketplace = object.marketplace + return b +} + +// Build creates a 'billing_model_item' object using the configuration stored in the builder. +func (b *BillingModelItemBuilder) Build() (object *BillingModelItem, err error) { + object = new(BillingModelItem) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.billingModelType = b.billingModelType + object.description = b.description + object.displayName = b.displayName + object.marketplace = b.marketplace + return +} diff --git a/clientapi/clustersmgmt/v1/billing_model_item_list_builder.go b/clientapi/clustersmgmt/v1/billing_model_item_list_builder.go new file mode 100644 index 00000000..8fcc967f --- /dev/null +++ b/clientapi/clustersmgmt/v1/billing_model_item_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// BillingModelItemListBuilder contains the data and logic needed to build +// 'billing_model_item' objects. +type BillingModelItemListBuilder struct { + items []*BillingModelItemBuilder +} + +// NewBillingModelItemList creates a new builder of 'billing_model_item' objects. +func NewBillingModelItemList() *BillingModelItemListBuilder { + return new(BillingModelItemListBuilder) +} + +// Items sets the items of the list. +func (b *BillingModelItemListBuilder) Items(values ...*BillingModelItemBuilder) *BillingModelItemListBuilder { + b.items = make([]*BillingModelItemBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *BillingModelItemListBuilder) 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 *BillingModelItemListBuilder) Copy(list *BillingModelItemList) *BillingModelItemListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*BillingModelItemBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewBillingModelItem().Copy(v) + } + } + return b +} + +// Build creates a list of 'billing_model_item' objects using the +// configuration stored in the builder. +func (b *BillingModelItemListBuilder) Build() (list *BillingModelItemList, err error) { + items := make([]*BillingModelItem, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(BillingModelItemList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/billing_model_item_list_type_json.go b/clientapi/clustersmgmt/v1/billing_model_item_list_type_json.go new file mode 100644 index 00000000..df9c3f08 --- /dev/null +++ b/clientapi/clustersmgmt/v1/billing_model_item_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBillingModelItemList writes a list of values of the 'billing_model_item' type to +// the given writer. +func MarshalBillingModelItemList(list []*BillingModelItem, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBillingModelItemList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBillingModelItemList writes a list of value of the 'billing_model_item' type to +// the given stream. +func WriteBillingModelItemList(list []*BillingModelItem, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteBillingModelItem(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalBillingModelItemList reads a list of values of the 'billing_model_item' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBillingModelItemList(source interface{}) (items []*BillingModelItem, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBillingModelItemList(iterator) + err = iterator.Error + return +} + +// ReadBillingModelItemList reads list of values of the ”billing_model_item' type from +// the given iterator. +func ReadBillingModelItemList(iterator *jsoniter.Iterator) []*BillingModelItem { + list := []*BillingModelItem{} + for iterator.ReadArray() { + item := ReadBillingModelItem(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/billing_model_item_type.go b/clientapi/clustersmgmt/v1/billing_model_item_type.go new file mode 100644 index 00000000..cbc90993 --- /dev/null +++ b/clientapi/clustersmgmt/v1/billing_model_item_type.go @@ -0,0 +1,337 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// BillingModelItemKind is the name of the type used to represent objects +// of type 'billing_model_item'. +const BillingModelItemKind = "BillingModelItem" + +// BillingModelItemLinkKind is the name of the type used to represent links +// to objects of type 'billing_model_item'. +const BillingModelItemLinkKind = "BillingModelItemLink" + +// BillingModelItemNilKind is the name of the type used to nil references +// to objects of type 'billing_model_item'. +const BillingModelItemNilKind = "BillingModelItemNil" + +// BillingModelItem represents the values of the 'billing_model_item' type. +// +// BillingModelItem represents a billing model +type BillingModelItem struct { + bitmap_ uint32 + id string + href string + billingModelType string + description string + displayName string + marketplace string +} + +// Kind returns the name of the type of the object. +func (o *BillingModelItem) Kind() string { + if o == nil { + return BillingModelItemNilKind + } + if o.bitmap_&1 != 0 { + return BillingModelItemLinkKind + } + return BillingModelItemKind +} + +// Link returns true if this is a link. +func (o *BillingModelItem) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *BillingModelItem) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *BillingModelItem) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *BillingModelItem) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *BillingModelItem) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *BillingModelItem) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// BillingModelType returns the value of the 'billing_model_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// BillingModelType is the type of the BillingModel. e.g. standard, marketplace. +func (o *BillingModelItem) BillingModelType() string { + if o != nil && o.bitmap_&8 != 0 { + return o.billingModelType + } + return "" +} + +// GetBillingModelType returns the value of the 'billing_model_type' attribute and +// a flag indicating if the attribute has a value. +// +// BillingModelType is the type of the BillingModel. e.g. standard, marketplace. +func (o *BillingModelItem) GetBillingModelType() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.billingModelType + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Single line description of the billing model. +func (o *BillingModelItem) Description() string { + if o != nil && o.bitmap_&16 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Single line description of the billing model. +func (o *BillingModelItem) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.description + } + return +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// User friendly display name of the billing model. +func (o *BillingModelItem) DisplayName() string { + if o != nil && o.bitmap_&32 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +// +// User friendly display name of the billing model. +func (o *BillingModelItem) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.displayName + } + return +} + +// Marketplace returns the value of the 'marketplace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the marketplace of the billing model. e.g. gcp, aws, etc. +func (o *BillingModelItem) Marketplace() string { + if o != nil && o.bitmap_&64 != 0 { + return o.marketplace + } + return "" +} + +// GetMarketplace returns the value of the 'marketplace' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the marketplace of the billing model. e.g. gcp, aws, etc. +func (o *BillingModelItem) GetMarketplace() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.marketplace + } + return +} + +// BillingModelItemListKind is the name of the type used to represent list of objects of +// type 'billing_model_item'. +const BillingModelItemListKind = "BillingModelItemList" + +// BillingModelItemListLinkKind is the name of the type used to represent links to list +// of objects of type 'billing_model_item'. +const BillingModelItemListLinkKind = "BillingModelItemListLink" + +// BillingModelItemNilKind is the name of the type used to nil lists of objects of +// type 'billing_model_item'. +const BillingModelItemListNilKind = "BillingModelItemListNil" + +// BillingModelItemList is a list of values of the 'billing_model_item' type. +type BillingModelItemList struct { + href string + link bool + items []*BillingModelItem +} + +// Kind returns the name of the type of the object. +func (l *BillingModelItemList) Kind() string { + if l == nil { + return BillingModelItemListNilKind + } + if l.link { + return BillingModelItemListLinkKind + } + return BillingModelItemListKind +} + +// Link returns true iif this is a link. +func (l *BillingModelItemList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *BillingModelItemList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *BillingModelItemList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *BillingModelItemList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *BillingModelItemList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *BillingModelItemList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *BillingModelItemList) SetItems(items []*BillingModelItem) { + l.items = items +} + +// Items returns the items of the list. +func (l *BillingModelItemList) Items() []*BillingModelItem { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *BillingModelItemList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *BillingModelItemList) Get(i int) *BillingModelItem { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *BillingModelItemList) Slice() []*BillingModelItem { + var slice []*BillingModelItem + if l == nil { + slice = make([]*BillingModelItem, 0) + } else { + slice = make([]*BillingModelItem, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *BillingModelItemList) Each(f func(item *BillingModelItem) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *BillingModelItemList) Range(f func(index int, item *BillingModelItem) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/billing_model_item_type_json.go b/clientapi/clustersmgmt/v1/billing_model_item_type_json.go new file mode 100644 index 00000000..4e2ae678 --- /dev/null +++ b/clientapi/clustersmgmt/v1/billing_model_item_type_json.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBillingModelItem writes a value of the 'billing_model_item' type to the given writer. +func MarshalBillingModelItem(object *BillingModelItem, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBillingModelItem(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBillingModelItem writes a value of the 'billing_model_item' type to the given stream. +func WriteBillingModelItem(object *BillingModelItem, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(BillingModelItemLinkKind) + } else { + stream.WriteString(BillingModelItemKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_model_type") + stream.WriteString(object.billingModelType) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("marketplace") + stream.WriteString(object.marketplace) + } + stream.WriteObjectEnd() +} + +// UnmarshalBillingModelItem reads a value of the 'billing_model_item' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalBillingModelItem(source interface{}) (object *BillingModelItem, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadBillingModelItem(iterator) + err = iterator.Error + return +} + +// ReadBillingModelItem reads a value of the 'billing_model_item' type from the given iterator. +func ReadBillingModelItem(iterator *jsoniter.Iterator) *BillingModelItem { + object := &BillingModelItem{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == BillingModelItemLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "billing_model_type": + value := iterator.ReadString() + object.billingModelType = value + object.bitmap_ |= 8 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 16 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 32 + case "marketplace": + value := iterator.ReadString() + object.marketplace = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/billing_model_list_type_json.go b/clientapi/clustersmgmt/v1/billing_model_list_type_json.go new file mode 100644 index 00000000..302d1c78 --- /dev/null +++ b/clientapi/clustersmgmt/v1/billing_model_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBillingModelList writes a list of values of the 'billing_model' type to +// the given writer. +func MarshalBillingModelList(list []BillingModel, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBillingModelList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBillingModelList writes a list of value of the 'billing_model' type to +// the given stream. +func WriteBillingModelList(list []BillingModel, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalBillingModelList reads a list of values of the 'billing_model' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBillingModelList(source interface{}) (items []BillingModel, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBillingModelList(iterator) + err = iterator.Error + return +} + +// ReadBillingModelList reads list of values of the ”billing_model' type from +// the given iterator. +func ReadBillingModelList(iterator *jsoniter.Iterator) []BillingModel { + list := []BillingModel{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := BillingModel(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/billing_model_type.go b/clientapi/clustersmgmt/v1/billing_model_type.go new file mode 100644 index 00000000..86f05151 --- /dev/null +++ b/clientapi/clustersmgmt/v1/billing_model_type.go @@ -0,0 +1,38 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// BillingModel represents the values of the 'billing_model' enumerated type. +type BillingModel string + +const ( + // BillingModel Marketplace Legacy Marketplace billing model. Currently only used for tests. Use cloud-provider specific billing models instead. + BillingModelMarketplace BillingModel = "marketplace" + // AWS Marketplace billing model. + BillingModelMarketplaceAWS BillingModel = "marketplace-aws" + // GCP Marketplace billing model. + BillingModelMarketplaceGCP BillingModel = "marketplace-gcp" + // RH Marketplace billing model. + BillingModelMarketplaceRHM BillingModel = "marketplace-rhm" + // Azure Marketplace billing model. + BillingModelMarketplaceAzure BillingModel = "marketplace-azure" + // Standard. This is the default billing model + BillingModelStandard BillingModel = "standard" +) diff --git a/clientapi/clustersmgmt/v1/boolean_list_type_json.go b/clientapi/clustersmgmt/v1/boolean_list_type_json.go new file mode 100644 index 00000000..be259195 --- /dev/null +++ b/clientapi/clustersmgmt/v1/boolean_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBooleanList writes a list of values of the 'boolean' type to +// the given writer. +func MarshalBooleanList(list []bool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBooleanList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBooleanList writes a list of value of the 'boolean' type to +// the given stream. +func WriteBooleanList(list []bool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteBool(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalBooleanList reads a list of values of the 'boolean' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBooleanList(source interface{}) (items []bool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBooleanList(iterator) + err = iterator.Error + return +} + +// ReadBooleanList reads list of values of the ”boolean' type from +// the given iterator. +func ReadBooleanList(iterator *jsoniter.Iterator) []bool { + list := []bool{} + for iterator.ReadArray() { + item := iterator.ReadBool() + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/break_glass_credential_builder.go b/clientapi/clustersmgmt/v1/break_glass_credential_builder.go new file mode 100644 index 00000000..98a63e69 --- /dev/null +++ b/clientapi/clustersmgmt/v1/break_glass_credential_builder.go @@ -0,0 +1,135 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// BreakGlassCredentialBuilder contains the data and logic needed to build 'break_glass_credential' objects. +// +// Representation of a break glass credential. +type BreakGlassCredentialBuilder struct { + bitmap_ uint32 + id string + href string + expirationTimestamp time.Time + kubeconfig string + revocationTimestamp time.Time + status BreakGlassCredentialStatus + username string +} + +// NewBreakGlassCredential creates a new builder of 'break_glass_credential' objects. +func NewBreakGlassCredential() *BreakGlassCredentialBuilder { + return &BreakGlassCredentialBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *BreakGlassCredentialBuilder) Link(value bool) *BreakGlassCredentialBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *BreakGlassCredentialBuilder) ID(value string) *BreakGlassCredentialBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *BreakGlassCredentialBuilder) HREF(value string) *BreakGlassCredentialBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *BreakGlassCredentialBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// ExpirationTimestamp sets the value of the 'expiration_timestamp' attribute to the given value. +func (b *BreakGlassCredentialBuilder) ExpirationTimestamp(value time.Time) *BreakGlassCredentialBuilder { + b.expirationTimestamp = value + b.bitmap_ |= 8 + return b +} + +// Kubeconfig sets the value of the 'kubeconfig' attribute to the given value. +func (b *BreakGlassCredentialBuilder) Kubeconfig(value string) *BreakGlassCredentialBuilder { + b.kubeconfig = value + b.bitmap_ |= 16 + return b +} + +// RevocationTimestamp sets the value of the 'revocation_timestamp' attribute to the given value. +func (b *BreakGlassCredentialBuilder) RevocationTimestamp(value time.Time) *BreakGlassCredentialBuilder { + b.revocationTimestamp = value + b.bitmap_ |= 32 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +// +// Status of the break glass credential. +func (b *BreakGlassCredentialBuilder) Status(value BreakGlassCredentialStatus) *BreakGlassCredentialBuilder { + b.status = value + b.bitmap_ |= 64 + return b +} + +// Username sets the value of the 'username' attribute to the given value. +func (b *BreakGlassCredentialBuilder) Username(value string) *BreakGlassCredentialBuilder { + b.username = value + b.bitmap_ |= 128 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *BreakGlassCredentialBuilder) Copy(object *BreakGlassCredential) *BreakGlassCredentialBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.expirationTimestamp = object.expirationTimestamp + b.kubeconfig = object.kubeconfig + b.revocationTimestamp = object.revocationTimestamp + b.status = object.status + b.username = object.username + return b +} + +// Build creates a 'break_glass_credential' object using the configuration stored in the builder. +func (b *BreakGlassCredentialBuilder) Build() (object *BreakGlassCredential, err error) { + object = new(BreakGlassCredential) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.expirationTimestamp = b.expirationTimestamp + object.kubeconfig = b.kubeconfig + object.revocationTimestamp = b.revocationTimestamp + object.status = b.status + object.username = b.username + return +} diff --git a/clientapi/clustersmgmt/v1/break_glass_credential_list_builder.go b/clientapi/clustersmgmt/v1/break_glass_credential_list_builder.go new file mode 100644 index 00000000..34f87bf5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/break_glass_credential_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// BreakGlassCredentialListBuilder contains the data and logic needed to build +// 'break_glass_credential' objects. +type BreakGlassCredentialListBuilder struct { + items []*BreakGlassCredentialBuilder +} + +// NewBreakGlassCredentialList creates a new builder of 'break_glass_credential' objects. +func NewBreakGlassCredentialList() *BreakGlassCredentialListBuilder { + return new(BreakGlassCredentialListBuilder) +} + +// Items sets the items of the list. +func (b *BreakGlassCredentialListBuilder) Items(values ...*BreakGlassCredentialBuilder) *BreakGlassCredentialListBuilder { + b.items = make([]*BreakGlassCredentialBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *BreakGlassCredentialListBuilder) 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 *BreakGlassCredentialListBuilder) Copy(list *BreakGlassCredentialList) *BreakGlassCredentialListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*BreakGlassCredentialBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewBreakGlassCredential().Copy(v) + } + } + return b +} + +// Build creates a list of 'break_glass_credential' objects using the +// configuration stored in the builder. +func (b *BreakGlassCredentialListBuilder) Build() (list *BreakGlassCredentialList, err error) { + items := make([]*BreakGlassCredential, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(BreakGlassCredentialList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/break_glass_credential_list_type_json.go b/clientapi/clustersmgmt/v1/break_glass_credential_list_type_json.go new file mode 100644 index 00000000..df9c426b --- /dev/null +++ b/clientapi/clustersmgmt/v1/break_glass_credential_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBreakGlassCredentialList writes a list of values of the 'break_glass_credential' type to +// the given writer. +func MarshalBreakGlassCredentialList(list []*BreakGlassCredential, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBreakGlassCredentialList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBreakGlassCredentialList writes a list of value of the 'break_glass_credential' type to +// the given stream. +func WriteBreakGlassCredentialList(list []*BreakGlassCredential, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteBreakGlassCredential(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalBreakGlassCredentialList reads a list of values of the 'break_glass_credential' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBreakGlassCredentialList(source interface{}) (items []*BreakGlassCredential, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBreakGlassCredentialList(iterator) + err = iterator.Error + return +} + +// ReadBreakGlassCredentialList reads list of values of the ”break_glass_credential' type from +// the given iterator. +func ReadBreakGlassCredentialList(iterator *jsoniter.Iterator) []*BreakGlassCredential { + list := []*BreakGlassCredential{} + for iterator.ReadArray() { + item := ReadBreakGlassCredential(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/break_glass_credential_status_list_type_json.go b/clientapi/clustersmgmt/v1/break_glass_credential_status_list_type_json.go new file mode 100644 index 00000000..53f6a131 --- /dev/null +++ b/clientapi/clustersmgmt/v1/break_glass_credential_status_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBreakGlassCredentialStatusList writes a list of values of the 'break_glass_credential_status' type to +// the given writer. +func MarshalBreakGlassCredentialStatusList(list []BreakGlassCredentialStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBreakGlassCredentialStatusList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBreakGlassCredentialStatusList writes a list of value of the 'break_glass_credential_status' type to +// the given stream. +func WriteBreakGlassCredentialStatusList(list []BreakGlassCredentialStatus, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalBreakGlassCredentialStatusList reads a list of values of the 'break_glass_credential_status' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBreakGlassCredentialStatusList(source interface{}) (items []BreakGlassCredentialStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBreakGlassCredentialStatusList(iterator) + err = iterator.Error + return +} + +// ReadBreakGlassCredentialStatusList reads list of values of the ”break_glass_credential_status' type from +// the given iterator. +func ReadBreakGlassCredentialStatusList(iterator *jsoniter.Iterator) []BreakGlassCredentialStatus { + list := []BreakGlassCredentialStatus{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := BreakGlassCredentialStatus(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/break_glass_credential_status_type.go b/clientapi/clustersmgmt/v1/break_glass_credential_status_type.go new file mode 100644 index 00000000..81fa8862 --- /dev/null +++ b/clientapi/clustersmgmt/v1/break_glass_credential_status_type.go @@ -0,0 +1,38 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// BreakGlassCredentialStatus represents the values of the 'break_glass_credential_status' enumerated type. +type BreakGlassCredentialStatus string + +const ( + // + BreakGlassCredentialStatusAwaitingRevocation BreakGlassCredentialStatus = "awaiting_revocation" + // + BreakGlassCredentialStatusCreated BreakGlassCredentialStatus = "created" + // + BreakGlassCredentialStatusExpired BreakGlassCredentialStatus = "expired" + // + BreakGlassCredentialStatusFailed BreakGlassCredentialStatus = "failed" + // + BreakGlassCredentialStatusIssued BreakGlassCredentialStatus = "issued" + // + BreakGlassCredentialStatusRevoked BreakGlassCredentialStatus = "revoked" +) diff --git a/clientapi/clustersmgmt/v1/break_glass_credential_type.go b/clientapi/clustersmgmt/v1/break_glass_credential_type.go new file mode 100644 index 00000000..9d716e82 --- /dev/null +++ b/clientapi/clustersmgmt/v1/break_glass_credential_type.go @@ -0,0 +1,365 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// BreakGlassCredentialKind is the name of the type used to represent objects +// of type 'break_glass_credential'. +const BreakGlassCredentialKind = "BreakGlassCredential" + +// BreakGlassCredentialLinkKind is the name of the type used to represent links +// to objects of type 'break_glass_credential'. +const BreakGlassCredentialLinkKind = "BreakGlassCredentialLink" + +// BreakGlassCredentialNilKind is the name of the type used to nil references +// to objects of type 'break_glass_credential'. +const BreakGlassCredentialNilKind = "BreakGlassCredentialNil" + +// BreakGlassCredential represents the values of the 'break_glass_credential' type. +// +// Representation of a break glass credential. +type BreakGlassCredential struct { + bitmap_ uint32 + id string + href string + expirationTimestamp time.Time + kubeconfig string + revocationTimestamp time.Time + status BreakGlassCredentialStatus + username string +} + +// Kind returns the name of the type of the object. +func (o *BreakGlassCredential) Kind() string { + if o == nil { + return BreakGlassCredentialNilKind + } + if o.bitmap_&1 != 0 { + return BreakGlassCredentialLinkKind + } + return BreakGlassCredentialKind +} + +// Link returns true if this is a link. +func (o *BreakGlassCredential) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *BreakGlassCredential) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *BreakGlassCredential) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *BreakGlassCredential) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *BreakGlassCredential) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *BreakGlassCredential) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// ExpirationTimestamp returns the value of the 'expiration_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ExpirationTimestamp is the date and time when the credential will expire. +func (o *BreakGlassCredential) ExpirationTimestamp() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.expirationTimestamp + } + return time.Time{} +} + +// GetExpirationTimestamp returns the value of the 'expiration_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// ExpirationTimestamp is the date and time when the credential will expire. +func (o *BreakGlassCredential) GetExpirationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.expirationTimestamp + } + return +} + +// Kubeconfig returns the value of the 'kubeconfig' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Kubeconfig is the generated kubeconfig for this credential. It is only stored in memory +func (o *BreakGlassCredential) Kubeconfig() string { + if o != nil && o.bitmap_&16 != 0 { + return o.kubeconfig + } + return "" +} + +// GetKubeconfig returns the value of the 'kubeconfig' attribute and +// a flag indicating if the attribute has a value. +// +// Kubeconfig is the generated kubeconfig for this credential. It is only stored in memory +func (o *BreakGlassCredential) GetKubeconfig() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.kubeconfig + } + return +} + +// RevocationTimestamp returns the value of the 'revocation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// RevocationTimestamp is the date and time when the credential has been revoked. +func (o *BreakGlassCredential) RevocationTimestamp() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.revocationTimestamp + } + return time.Time{} +} + +// GetRevocationTimestamp returns the value of the 'revocation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// RevocationTimestamp is the date and time when the credential has been revoked. +func (o *BreakGlassCredential) GetRevocationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.revocationTimestamp + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Status is the status of this credential +func (o *BreakGlassCredential) Status() BreakGlassCredentialStatus { + if o != nil && o.bitmap_&64 != 0 { + return o.status + } + return BreakGlassCredentialStatus("") +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// Status is the status of this credential +func (o *BreakGlassCredential) GetStatus() (value BreakGlassCredentialStatus, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.status + } + return +} + +// Username returns the value of the 'username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Username is the user which will be used for this credential. +func (o *BreakGlassCredential) Username() string { + if o != nil && o.bitmap_&128 != 0 { + return o.username + } + return "" +} + +// GetUsername returns the value of the 'username' attribute and +// a flag indicating if the attribute has a value. +// +// Username is the user which will be used for this credential. +func (o *BreakGlassCredential) GetUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.username + } + return +} + +// BreakGlassCredentialListKind is the name of the type used to represent list of objects of +// type 'break_glass_credential'. +const BreakGlassCredentialListKind = "BreakGlassCredentialList" + +// BreakGlassCredentialListLinkKind is the name of the type used to represent links to list +// of objects of type 'break_glass_credential'. +const BreakGlassCredentialListLinkKind = "BreakGlassCredentialListLink" + +// BreakGlassCredentialNilKind is the name of the type used to nil lists of objects of +// type 'break_glass_credential'. +const BreakGlassCredentialListNilKind = "BreakGlassCredentialListNil" + +// BreakGlassCredentialList is a list of values of the 'break_glass_credential' type. +type BreakGlassCredentialList struct { + href string + link bool + items []*BreakGlassCredential +} + +// Kind returns the name of the type of the object. +func (l *BreakGlassCredentialList) Kind() string { + if l == nil { + return BreakGlassCredentialListNilKind + } + if l.link { + return BreakGlassCredentialListLinkKind + } + return BreakGlassCredentialListKind +} + +// Link returns true iif this is a link. +func (l *BreakGlassCredentialList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *BreakGlassCredentialList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *BreakGlassCredentialList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *BreakGlassCredentialList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *BreakGlassCredentialList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *BreakGlassCredentialList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *BreakGlassCredentialList) SetItems(items []*BreakGlassCredential) { + l.items = items +} + +// Items returns the items of the list. +func (l *BreakGlassCredentialList) Items() []*BreakGlassCredential { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *BreakGlassCredentialList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *BreakGlassCredentialList) Get(i int) *BreakGlassCredential { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *BreakGlassCredentialList) Slice() []*BreakGlassCredential { + var slice []*BreakGlassCredential + if l == nil { + slice = make([]*BreakGlassCredential, 0) + } else { + slice = make([]*BreakGlassCredential, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *BreakGlassCredentialList) Each(f func(item *BreakGlassCredential) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *BreakGlassCredentialList) Range(f func(index int, item *BreakGlassCredential) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/break_glass_credential_type_json.go b/clientapi/clustersmgmt/v1/break_glass_credential_type_json.go new file mode 100644 index 00000000..a1af9be6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/break_glass_credential_type_json.go @@ -0,0 +1,182 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBreakGlassCredential writes a value of the 'break_glass_credential' type to the given writer. +func MarshalBreakGlassCredential(object *BreakGlassCredential, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBreakGlassCredential(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBreakGlassCredential writes a value of the 'break_glass_credential' type to the given stream. +func WriteBreakGlassCredential(object *BreakGlassCredential, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(BreakGlassCredentialLinkKind) + } else { + stream.WriteString(BreakGlassCredentialKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("expiration_timestamp") + stream.WriteString((object.expirationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kubeconfig") + stream.WriteString(object.kubeconfig) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("revocation_timestamp") + stream.WriteString((object.revocationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteString(string(object.status)) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("username") + stream.WriteString(object.username) + } + stream.WriteObjectEnd() +} + +// UnmarshalBreakGlassCredential reads a value of the 'break_glass_credential' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalBreakGlassCredential(source interface{}) (object *BreakGlassCredential, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadBreakGlassCredential(iterator) + err = iterator.Error + return +} + +// ReadBreakGlassCredential reads a value of the 'break_glass_credential' type from the given iterator. +func ReadBreakGlassCredential(iterator *jsoniter.Iterator) *BreakGlassCredential { + object := &BreakGlassCredential{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == BreakGlassCredentialLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "expiration_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.expirationTimestamp = value + object.bitmap_ |= 8 + case "kubeconfig": + value := iterator.ReadString() + object.kubeconfig = value + object.bitmap_ |= 16 + case "revocation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.revocationTimestamp = value + object.bitmap_ |= 32 + case "status": + text := iterator.ReadString() + value := BreakGlassCredentialStatus(text) + object.status = value + object.bitmap_ |= 64 + case "username": + value := iterator.ReadString() + object.username = value + object.bitmap_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/byo_oidc_builder.go b/clientapi/clustersmgmt/v1/byo_oidc_builder.go new file mode 100644 index 00000000..7b107eb5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/byo_oidc_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ByoOidcBuilder contains the data and logic needed to build 'byo_oidc' objects. +// +// ByoOidc configuration. +type ByoOidcBuilder struct { + bitmap_ uint32 + enabled bool +} + +// NewByoOidc creates a new builder of 'byo_oidc' objects. +func NewByoOidc() *ByoOidcBuilder { + return &ByoOidcBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ByoOidcBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *ByoOidcBuilder) Enabled(value bool) *ByoOidcBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ByoOidcBuilder) Copy(object *ByoOidc) *ByoOidcBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + return b +} + +// Build creates a 'byo_oidc' object using the configuration stored in the builder. +func (b *ByoOidcBuilder) Build() (object *ByoOidc, err error) { + object = new(ByoOidc) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + return +} diff --git a/clientapi/clustersmgmt/v1/byo_oidc_list_builder.go b/clientapi/clustersmgmt/v1/byo_oidc_list_builder.go new file mode 100644 index 00000000..530fb101 --- /dev/null +++ b/clientapi/clustersmgmt/v1/byo_oidc_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ByoOidcListBuilder contains the data and logic needed to build +// 'byo_oidc' objects. +type ByoOidcListBuilder struct { + items []*ByoOidcBuilder +} + +// NewByoOidcList creates a new builder of 'byo_oidc' objects. +func NewByoOidcList() *ByoOidcListBuilder { + return new(ByoOidcListBuilder) +} + +// Items sets the items of the list. +func (b *ByoOidcListBuilder) Items(values ...*ByoOidcBuilder) *ByoOidcListBuilder { + b.items = make([]*ByoOidcBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ByoOidcListBuilder) 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 *ByoOidcListBuilder) Copy(list *ByoOidcList) *ByoOidcListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ByoOidcBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewByoOidc().Copy(v) + } + } + return b +} + +// Build creates a list of 'byo_oidc' objects using the +// configuration stored in the builder. +func (b *ByoOidcListBuilder) Build() (list *ByoOidcList, err error) { + items := make([]*ByoOidc, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ByoOidcList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/byo_oidc_list_type_json.go b/clientapi/clustersmgmt/v1/byo_oidc_list_type_json.go new file mode 100644 index 00000000..4a57615e --- /dev/null +++ b/clientapi/clustersmgmt/v1/byo_oidc_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalByoOidcList writes a list of values of the 'byo_oidc' type to +// the given writer. +func MarshalByoOidcList(list []*ByoOidc, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteByoOidcList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteByoOidcList writes a list of value of the 'byo_oidc' type to +// the given stream. +func WriteByoOidcList(list []*ByoOidc, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteByoOidc(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalByoOidcList reads a list of values of the 'byo_oidc' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalByoOidcList(source interface{}) (items []*ByoOidc, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadByoOidcList(iterator) + err = iterator.Error + return +} + +// ReadByoOidcList reads list of values of the ”byo_oidc' type from +// the given iterator. +func ReadByoOidcList(iterator *jsoniter.Iterator) []*ByoOidc { + list := []*ByoOidc{} + for iterator.ReadArray() { + item := ReadByoOidc(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/byo_oidc_type.go b/clientapi/clustersmgmt/v1/byo_oidc_type.go new file mode 100644 index 00000000..63e75a3a --- /dev/null +++ b/clientapi/clustersmgmt/v1/byo_oidc_type.go @@ -0,0 +1,175 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ByoOidc represents the values of the 'byo_oidc' type. +// +// ByoOidc configuration. +type ByoOidc struct { + bitmap_ uint32 + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ByoOidc) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Boolean flag indicating if the cluster should be creating using _ByoOidc_. +// +// By default this is `false`. +// +// To enable it the cluster needs to be ROSA cluster and the organization of the user needs +// to have the `byo-oidc` feature toggle enabled. +func (o *ByoOidc) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Boolean flag indicating if the cluster should be creating using _ByoOidc_. +// +// By default this is `false`. +// +// To enable it the cluster needs to be ROSA cluster and the organization of the user needs +// to have the `byo-oidc` feature toggle enabled. +func (o *ByoOidc) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// ByoOidcListKind is the name of the type used to represent list of objects of +// type 'byo_oidc'. +const ByoOidcListKind = "ByoOidcList" + +// ByoOidcListLinkKind is the name of the type used to represent links to list +// of objects of type 'byo_oidc'. +const ByoOidcListLinkKind = "ByoOidcListLink" + +// ByoOidcNilKind is the name of the type used to nil lists of objects of +// type 'byo_oidc'. +const ByoOidcListNilKind = "ByoOidcListNil" + +// ByoOidcList is a list of values of the 'byo_oidc' type. +type ByoOidcList struct { + href string + link bool + items []*ByoOidc +} + +// Len returns the length of the list. +func (l *ByoOidcList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ByoOidcList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ByoOidcList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ByoOidcList) SetItems(items []*ByoOidc) { + l.items = items +} + +// Items returns the items of the list. +func (l *ByoOidcList) Items() []*ByoOidc { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ByoOidcList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ByoOidcList) Get(i int) *ByoOidc { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ByoOidcList) Slice() []*ByoOidc { + var slice []*ByoOidc + if l == nil { + slice = make([]*ByoOidc, 0) + } else { + slice = make([]*ByoOidc, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ByoOidcList) Each(f func(item *ByoOidc) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ByoOidcList) Range(f func(index int, item *ByoOidc) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/byo_oidc_type_json.go b/clientapi/clustersmgmt/v1/byo_oidc_type_json.go new file mode 100644 index 00000000..ef9bc6d6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/byo_oidc_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalByoOidc writes a value of the 'byo_oidc' type to the given writer. +func MarshalByoOidc(object *ByoOidc, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteByoOidc(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteByoOidc writes a value of the 'byo_oidc' type to the given stream. +func WriteByoOidc(object *ByoOidc, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalByoOidc reads a value of the 'byo_oidc' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalByoOidc(source interface{}) (object *ByoOidc, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadByoOidc(iterator) + err = iterator.Error + return +} + +// ReadByoOidc reads a value of the 'byo_oidc' type from the given iterator. +func ReadByoOidc(iterator *jsoniter.Iterator) *ByoOidc { + object := &ByoOidc{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/ccs_builder.go b/clientapi/clustersmgmt/v1/ccs_builder.go new file mode 100644 index 00000000..2dddebe9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ccs_builder.go @@ -0,0 +1,97 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CCSBuilder contains the data and logic needed to build 'CCS' objects. +type CCSBuilder struct { + bitmap_ uint32 + id string + href string + disableSCPChecks bool + enabled bool +} + +// NewCCS creates a new builder of 'CCS' objects. +func NewCCS() *CCSBuilder { + return &CCSBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *CCSBuilder) Link(value bool) *CCSBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *CCSBuilder) ID(value string) *CCSBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *CCSBuilder) HREF(value string) *CCSBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CCSBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// DisableSCPChecks sets the value of the 'disable_SCP_checks' attribute to the given value. +func (b *CCSBuilder) DisableSCPChecks(value bool) *CCSBuilder { + b.disableSCPChecks = value + b.bitmap_ |= 8 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *CCSBuilder) Enabled(value bool) *CCSBuilder { + b.enabled = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CCSBuilder) Copy(object *CCS) *CCSBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.disableSCPChecks = object.disableSCPChecks + b.enabled = object.enabled + return b +} + +// Build creates a 'CCS' object using the configuration stored in the builder. +func (b *CCSBuilder) Build() (object *CCS, err error) { + object = new(CCS) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.disableSCPChecks = b.disableSCPChecks + object.enabled = b.enabled + return +} diff --git a/clientapi/clustersmgmt/v1/ccs_list_builder.go b/clientapi/clustersmgmt/v1/ccs_list_builder.go new file mode 100644 index 00000000..651419de --- /dev/null +++ b/clientapi/clustersmgmt/v1/ccs_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CCSListBuilder contains the data and logic needed to build +// 'CCS' objects. +type CCSListBuilder struct { + items []*CCSBuilder +} + +// NewCCSList creates a new builder of 'CCS' objects. +func NewCCSList() *CCSListBuilder { + return new(CCSListBuilder) +} + +// Items sets the items of the list. +func (b *CCSListBuilder) Items(values ...*CCSBuilder) *CCSListBuilder { + b.items = make([]*CCSBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CCSListBuilder) 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 *CCSListBuilder) Copy(list *CCSList) *CCSListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CCSBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCCS().Copy(v) + } + } + return b +} + +// Build creates a list of 'CCS' objects using the +// configuration stored in the builder. +func (b *CCSListBuilder) Build() (list *CCSList, err error) { + items := make([]*CCS, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CCSList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/ccs_list_type_json.go b/clientapi/clustersmgmt/v1/ccs_list_type_json.go new file mode 100644 index 00000000..3dab9cd8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ccs_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCCSList writes a list of values of the 'CCS' type to +// the given writer. +func MarshalCCSList(list []*CCS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCCSList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCCSList writes a list of value of the 'CCS' type to +// the given stream. +func WriteCCSList(list []*CCS, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCCS(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCCSList reads a list of values of the 'CCS' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCCSList(source interface{}) (items []*CCS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCCSList(iterator) + err = iterator.Error + return +} + +// ReadCCSList reads list of values of the ”CCS' type from +// the given iterator. +func ReadCCSList(iterator *jsoniter.Iterator) []*CCS { + list := []*CCS{} + for iterator.ReadArray() { + item := ReadCCS(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/ccs_type.go b/clientapi/clustersmgmt/v1/ccs_type.go new file mode 100644 index 00000000..3e6f9fc8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ccs_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CCSKind is the name of the type used to represent objects +// of type 'CCS'. +const CCSKind = "CCS" + +// CCSLinkKind is the name of the type used to represent links +// to objects of type 'CCS'. +const CCSLinkKind = "CCSLink" + +// CCSNilKind is the name of the type used to nil references +// to objects of type 'CCS'. +const CCSNilKind = "CCSNil" + +// CCS represents the values of the 'CCS' type. +type CCS struct { + bitmap_ uint32 + id string + href string + disableSCPChecks bool + enabled bool +} + +// Kind returns the name of the type of the object. +func (o *CCS) Kind() string { + if o == nil { + return CCSNilKind + } + if o.bitmap_&1 != 0 { + return CCSLinkKind + } + return CCSKind +} + +// Link returns true if this is a link. +func (o *CCS) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *CCS) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *CCS) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *CCS) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *CCS) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CCS) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// DisableSCPChecks returns the value of the 'disable_SCP_checks' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if cloud permissions checks are disabled, +// when attempting installation of the cluster. +func (o *CCS) DisableSCPChecks() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.disableSCPChecks + } + return false +} + +// GetDisableSCPChecks returns the value of the 'disable_SCP_checks' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if cloud permissions checks are disabled, +// when attempting installation of the cluster. +func (o *CCS) GetDisableSCPChecks() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.disableSCPChecks + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if Customer Cloud Subscription is enabled on the cluster. +func (o *CCS) Enabled() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if Customer Cloud Subscription is enabled on the cluster. +func (o *CCS) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.enabled + } + return +} + +// CCSListKind is the name of the type used to represent list of objects of +// type 'CCS'. +const CCSListKind = "CCSList" + +// CCSListLinkKind is the name of the type used to represent links to list +// of objects of type 'CCS'. +const CCSListLinkKind = "CCSListLink" + +// CCSNilKind is the name of the type used to nil lists of objects of +// type 'CCS'. +const CCSListNilKind = "CCSListNil" + +// CCSList is a list of values of the 'CCS' type. +type CCSList struct { + href string + link bool + items []*CCS +} + +// Kind returns the name of the type of the object. +func (l *CCSList) Kind() string { + if l == nil { + return CCSListNilKind + } + if l.link { + return CCSListLinkKind + } + return CCSListKind +} + +// Link returns true iif this is a link. +func (l *CCSList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *CCSList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *CCSList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *CCSList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CCSList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CCSList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CCSList) SetItems(items []*CCS) { + l.items = items +} + +// Items returns the items of the list. +func (l *CCSList) Items() []*CCS { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CCSList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CCSList) Get(i int) *CCS { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CCSList) Slice() []*CCS { + var slice []*CCS + if l == nil { + slice = make([]*CCS, 0) + } else { + slice = make([]*CCS, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CCSList) Each(f func(item *CCS) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CCSList) Range(f func(index int, item *CCS) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/ccs_type_json.go b/clientapi/clustersmgmt/v1/ccs_type_json.go new file mode 100644 index 00000000..35d52075 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ccs_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCCS writes a value of the 'CCS' type to the given writer. +func MarshalCCS(object *CCS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCCS(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCCS writes a value of the 'CCS' type to the given stream. +func WriteCCS(object *CCS, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(CCSLinkKind) + } else { + stream.WriteString(CCSKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("disable_scp_checks") + stream.WriteBool(object.disableSCPChecks) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalCCS reads a value of the 'CCS' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCCS(source interface{}) (object *CCS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCCS(iterator) + err = iterator.Error + return +} + +// ReadCCS reads a value of the 'CCS' type from the given iterator. +func ReadCCS(iterator *jsoniter.Iterator) *CCS { + object := &CCS{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == CCSLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "disable_scp_checks": + value := iterator.ReadBool() + object.disableSCPChecks = value + object.bitmap_ |= 8 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/client_component_builder.go b/clientapi/clustersmgmt/v1/client_component_builder.go new file mode 100644 index 00000000..f82781bd --- /dev/null +++ b/clientapi/clustersmgmt/v1/client_component_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClientComponentBuilder contains the data and logic needed to build 'client_component' objects. +// +// The reference of a component that will consume the client configuration. +type ClientComponentBuilder struct { + bitmap_ uint32 + name string + namespace string +} + +// NewClientComponent creates a new builder of 'client_component' objects. +func NewClientComponent() *ClientComponentBuilder { + return &ClientComponentBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClientComponentBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ClientComponentBuilder) Name(value string) *ClientComponentBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Namespace sets the value of the 'namespace' attribute to the given value. +func (b *ClientComponentBuilder) Namespace(value string) *ClientComponentBuilder { + b.namespace = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClientComponentBuilder) Copy(object *ClientComponent) *ClientComponentBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + b.namespace = object.namespace + return b +} + +// Build creates a 'client_component' object using the configuration stored in the builder. +func (b *ClientComponentBuilder) Build() (object *ClientComponent, err error) { + object = new(ClientComponent) + object.bitmap_ = b.bitmap_ + object.name = b.name + object.namespace = b.namespace + return +} diff --git a/clientapi/clustersmgmt/v1/client_component_list_builder.go b/clientapi/clustersmgmt/v1/client_component_list_builder.go new file mode 100644 index 00000000..e9e87199 --- /dev/null +++ b/clientapi/clustersmgmt/v1/client_component_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClientComponentListBuilder contains the data and logic needed to build +// 'client_component' objects. +type ClientComponentListBuilder struct { + items []*ClientComponentBuilder +} + +// NewClientComponentList creates a new builder of 'client_component' objects. +func NewClientComponentList() *ClientComponentListBuilder { + return new(ClientComponentListBuilder) +} + +// Items sets the items of the list. +func (b *ClientComponentListBuilder) Items(values ...*ClientComponentBuilder) *ClientComponentListBuilder { + b.items = make([]*ClientComponentBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClientComponentListBuilder) 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 *ClientComponentListBuilder) Copy(list *ClientComponentList) *ClientComponentListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClientComponentBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClientComponent().Copy(v) + } + } + return b +} + +// Build creates a list of 'client_component' objects using the +// configuration stored in the builder. +func (b *ClientComponentListBuilder) Build() (list *ClientComponentList, err error) { + items := make([]*ClientComponent, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClientComponentList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/client_component_list_type_json.go b/clientapi/clustersmgmt/v1/client_component_list_type_json.go new file mode 100644 index 00000000..11531438 --- /dev/null +++ b/clientapi/clustersmgmt/v1/client_component_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClientComponentList writes a list of values of the 'client_component' type to +// the given writer. +func MarshalClientComponentList(list []*ClientComponent, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClientComponentList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClientComponentList writes a list of value of the 'client_component' type to +// the given stream. +func WriteClientComponentList(list []*ClientComponent, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClientComponent(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClientComponentList reads a list of values of the 'client_component' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClientComponentList(source interface{}) (items []*ClientComponent, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClientComponentList(iterator) + err = iterator.Error + return +} + +// ReadClientComponentList reads list of values of the ”client_component' type from +// the given iterator. +func ReadClientComponentList(iterator *jsoniter.Iterator) []*ClientComponent { + list := []*ClientComponent{} + for iterator.ReadArray() { + item := ReadClientComponent(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/client_component_type.go b/clientapi/clustersmgmt/v1/client_component_type.go new file mode 100644 index 00000000..7e2df702 --- /dev/null +++ b/clientapi/clustersmgmt/v1/client_component_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClientComponent represents the values of the 'client_component' type. +// +// The reference of a component that will consume the client configuration. +type ClientComponent struct { + bitmap_ uint32 + name string + namespace string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClientComponent) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the component. +func (o *ClientComponent) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the component. +func (o *ClientComponent) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Namespace returns the value of the 'namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The namespace of the component. +func (o *ClientComponent) Namespace() string { + if o != nil && o.bitmap_&2 != 0 { + return o.namespace + } + return "" +} + +// GetNamespace returns the value of the 'namespace' attribute and +// a flag indicating if the attribute has a value. +// +// The namespace of the component. +func (o *ClientComponent) GetNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.namespace + } + return +} + +// ClientComponentListKind is the name of the type used to represent list of objects of +// type 'client_component'. +const ClientComponentListKind = "ClientComponentList" + +// ClientComponentListLinkKind is the name of the type used to represent links to list +// of objects of type 'client_component'. +const ClientComponentListLinkKind = "ClientComponentListLink" + +// ClientComponentNilKind is the name of the type used to nil lists of objects of +// type 'client_component'. +const ClientComponentListNilKind = "ClientComponentListNil" + +// ClientComponentList is a list of values of the 'client_component' type. +type ClientComponentList struct { + href string + link bool + items []*ClientComponent +} + +// Len returns the length of the list. +func (l *ClientComponentList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClientComponentList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClientComponentList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClientComponentList) SetItems(items []*ClientComponent) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClientComponentList) Items() []*ClientComponent { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClientComponentList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClientComponentList) Get(i int) *ClientComponent { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClientComponentList) Slice() []*ClientComponent { + var slice []*ClientComponent + if l == nil { + slice = make([]*ClientComponent, 0) + } else { + slice = make([]*ClientComponent, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClientComponentList) Each(f func(item *ClientComponent) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClientComponentList) Range(f func(index int, item *ClientComponent) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/client_component_type_json.go b/clientapi/clustersmgmt/v1/client_component_type_json.go new file mode 100644 index 00000000..20dd98f2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/client_component_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClientComponent writes a value of the 'client_component' type to the given writer. +func MarshalClientComponent(object *ClientComponent, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClientComponent(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClientComponent writes a value of the 'client_component' type to the given stream. +func WriteClientComponent(object *ClientComponent, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("namespace") + stream.WriteString(object.namespace) + } + stream.WriteObjectEnd() +} + +// UnmarshalClientComponent reads a value of the 'client_component' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClientComponent(source interface{}) (object *ClientComponent, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClientComponent(iterator) + err = iterator.Error + return +} + +// ReadClientComponent reads a value of the 'client_component' type from the given iterator. +func ReadClientComponent(iterator *jsoniter.Iterator) *ClientComponent { + object := &ClientComponent{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "namespace": + value := iterator.ReadString() + object.namespace = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cloud_provider_builder.go b/clientapi/clustersmgmt/v1/cloud_provider_builder.go new file mode 100644 index 00000000..309316e4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_provider_builder.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CloudProviderBuilder contains the data and logic needed to build 'cloud_provider' objects. +// +// Cloud provider. +type CloudProviderBuilder struct { + bitmap_ uint32 + id string + href string + displayName string + name string + regions []*CloudRegionBuilder +} + +// NewCloudProvider creates a new builder of 'cloud_provider' objects. +func NewCloudProvider() *CloudProviderBuilder { + return &CloudProviderBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *CloudProviderBuilder) Link(value bool) *CloudProviderBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *CloudProviderBuilder) ID(value string) *CloudProviderBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *CloudProviderBuilder) HREF(value string) *CloudProviderBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CloudProviderBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *CloudProviderBuilder) DisplayName(value string) *CloudProviderBuilder { + b.displayName = value + b.bitmap_ |= 8 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *CloudProviderBuilder) Name(value string) *CloudProviderBuilder { + b.name = value + b.bitmap_ |= 16 + return b +} + +// Regions sets the value of the 'regions' attribute to the given values. +func (b *CloudProviderBuilder) Regions(values ...*CloudRegionBuilder) *CloudProviderBuilder { + b.regions = make([]*CloudRegionBuilder, len(values)) + copy(b.regions, values) + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CloudProviderBuilder) Copy(object *CloudProvider) *CloudProviderBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.displayName = object.displayName + b.name = object.name + if object.regions != nil { + b.regions = make([]*CloudRegionBuilder, len(object.regions)) + for i, v := range object.regions { + b.regions[i] = NewCloudRegion().Copy(v) + } + } else { + b.regions = nil + } + return b +} + +// Build creates a 'cloud_provider' object using the configuration stored in the builder. +func (b *CloudProviderBuilder) Build() (object *CloudProvider, err error) { + object = new(CloudProvider) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.displayName = b.displayName + object.name = b.name + if b.regions != nil { + object.regions = make([]*CloudRegion, len(b.regions)) + for i, v := range b.regions { + object.regions[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/cloud_provider_data_builder.go b/clientapi/clustersmgmt/v1/cloud_provider_data_builder.go new file mode 100644 index 00000000..8fadd1fe --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_provider_data_builder.go @@ -0,0 +1,230 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CloudProviderDataBuilder contains the data and logic needed to build 'cloud_provider_data' objects. +// +// Description of a cloud provider data used for cloud provider inquiries. +type CloudProviderDataBuilder struct { + bitmap_ uint32 + aws *AWSBuilder + gcp *GCPBuilder + availabilityZones []string + keyLocation string + keyRingName string + region *CloudRegionBuilder + subnets []string + version *VersionBuilder + vpcIds []string +} + +// NewCloudProviderData creates a new builder of 'cloud_provider_data' objects. +func NewCloudProviderData() *CloudProviderDataBuilder { + return &CloudProviderDataBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CloudProviderDataBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AWS sets the value of the 'AWS' attribute to the given value. +// +// _Amazon Web Services_ specific settings of a cluster. +func (b *CloudProviderDataBuilder) AWS(value *AWSBuilder) *CloudProviderDataBuilder { + b.aws = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// GCP sets the value of the 'GCP' attribute to the given value. +// +// Google cloud platform settings of a cluster. +func (b *CloudProviderDataBuilder) GCP(value *GCPBuilder) *CloudProviderDataBuilder { + b.gcp = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// AvailabilityZones sets the value of the 'availability_zones' attribute to the given values. +func (b *CloudProviderDataBuilder) AvailabilityZones(values ...string) *CloudProviderDataBuilder { + b.availabilityZones = make([]string, len(values)) + copy(b.availabilityZones, values) + b.bitmap_ |= 4 + return b +} + +// KeyLocation sets the value of the 'key_location' attribute to the given value. +func (b *CloudProviderDataBuilder) KeyLocation(value string) *CloudProviderDataBuilder { + b.keyLocation = value + b.bitmap_ |= 8 + return b +} + +// KeyRingName sets the value of the 'key_ring_name' attribute to the given value. +func (b *CloudProviderDataBuilder) KeyRingName(value string) *CloudProviderDataBuilder { + b.keyRingName = value + b.bitmap_ |= 16 + return b +} + +// Region sets the value of the 'region' attribute to the given value. +// +// Description of a region of a cloud provider. +func (b *CloudProviderDataBuilder) Region(value *CloudRegionBuilder) *CloudProviderDataBuilder { + b.region = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Subnets sets the value of the 'subnets' attribute to the given values. +func (b *CloudProviderDataBuilder) Subnets(values ...string) *CloudProviderDataBuilder { + b.subnets = make([]string, len(values)) + copy(b.subnets, values) + b.bitmap_ |= 64 + return b +} + +// Version sets the value of the 'version' attribute to the given value. +// +// Representation of an _OpenShift_ version. +func (b *CloudProviderDataBuilder) Version(value *VersionBuilder) *CloudProviderDataBuilder { + b.version = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// VpcIds sets the value of the 'vpc_ids' attribute to the given values. +func (b *CloudProviderDataBuilder) VpcIds(values ...string) *CloudProviderDataBuilder { + b.vpcIds = make([]string, len(values)) + copy(b.vpcIds, values) + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CloudProviderDataBuilder) Copy(object *CloudProviderData) *CloudProviderDataBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.aws != nil { + b.aws = NewAWS().Copy(object.aws) + } else { + b.aws = nil + } + if object.gcp != nil { + b.gcp = NewGCP().Copy(object.gcp) + } else { + b.gcp = nil + } + if object.availabilityZones != nil { + b.availabilityZones = make([]string, len(object.availabilityZones)) + copy(b.availabilityZones, object.availabilityZones) + } else { + b.availabilityZones = nil + } + b.keyLocation = object.keyLocation + b.keyRingName = object.keyRingName + if object.region != nil { + b.region = NewCloudRegion().Copy(object.region) + } else { + b.region = nil + } + if object.subnets != nil { + b.subnets = make([]string, len(object.subnets)) + copy(b.subnets, object.subnets) + } else { + b.subnets = nil + } + if object.version != nil { + b.version = NewVersion().Copy(object.version) + } else { + b.version = nil + } + if object.vpcIds != nil { + b.vpcIds = make([]string, len(object.vpcIds)) + copy(b.vpcIds, object.vpcIds) + } else { + b.vpcIds = nil + } + return b +} + +// Build creates a 'cloud_provider_data' object using the configuration stored in the builder. +func (b *CloudProviderDataBuilder) Build() (object *CloudProviderData, err error) { + object = new(CloudProviderData) + object.bitmap_ = b.bitmap_ + if b.aws != nil { + object.aws, err = b.aws.Build() + if err != nil { + return + } + } + if b.gcp != nil { + object.gcp, err = b.gcp.Build() + if err != nil { + return + } + } + if b.availabilityZones != nil { + object.availabilityZones = make([]string, len(b.availabilityZones)) + copy(object.availabilityZones, b.availabilityZones) + } + object.keyLocation = b.keyLocation + object.keyRingName = b.keyRingName + if b.region != nil { + object.region, err = b.region.Build() + if err != nil { + return + } + } + if b.subnets != nil { + object.subnets = make([]string, len(b.subnets)) + copy(object.subnets, b.subnets) + } + if b.version != nil { + object.version, err = b.version.Build() + if err != nil { + return + } + } + if b.vpcIds != nil { + object.vpcIds = make([]string, len(b.vpcIds)) + copy(object.vpcIds, b.vpcIds) + } + return +} diff --git a/clientapi/clustersmgmt/v1/cloud_provider_data_list_builder.go b/clientapi/clustersmgmt/v1/cloud_provider_data_list_builder.go new file mode 100644 index 00000000..529dcf2f --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_provider_data_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CloudProviderDataListBuilder contains the data and logic needed to build +// 'cloud_provider_data' objects. +type CloudProviderDataListBuilder struct { + items []*CloudProviderDataBuilder +} + +// NewCloudProviderDataList creates a new builder of 'cloud_provider_data' objects. +func NewCloudProviderDataList() *CloudProviderDataListBuilder { + return new(CloudProviderDataListBuilder) +} + +// Items sets the items of the list. +func (b *CloudProviderDataListBuilder) Items(values ...*CloudProviderDataBuilder) *CloudProviderDataListBuilder { + b.items = make([]*CloudProviderDataBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CloudProviderDataListBuilder) 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 *CloudProviderDataListBuilder) Copy(list *CloudProviderDataList) *CloudProviderDataListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CloudProviderDataBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCloudProviderData().Copy(v) + } + } + return b +} + +// Build creates a list of 'cloud_provider_data' objects using the +// configuration stored in the builder. +func (b *CloudProviderDataListBuilder) Build() (list *CloudProviderDataList, err error) { + items := make([]*CloudProviderData, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CloudProviderDataList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cloud_provider_data_list_type_json.go b/clientapi/clustersmgmt/v1/cloud_provider_data_list_type_json.go new file mode 100644 index 00000000..2b7c266e --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_provider_data_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudProviderDataList writes a list of values of the 'cloud_provider_data' type to +// the given writer. +func MarshalCloudProviderDataList(list []*CloudProviderData, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudProviderDataList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudProviderDataList writes a list of value of the 'cloud_provider_data' type to +// the given stream. +func WriteCloudProviderDataList(list []*CloudProviderData, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCloudProviderData(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCloudProviderDataList reads a list of values of the 'cloud_provider_data' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCloudProviderDataList(source interface{}) (items []*CloudProviderData, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCloudProviderDataList(iterator) + err = iterator.Error + return +} + +// ReadCloudProviderDataList reads list of values of the ”cloud_provider_data' type from +// the given iterator. +func ReadCloudProviderDataList(iterator *jsoniter.Iterator) []*CloudProviderData { + list := []*CloudProviderData{} + for iterator.ReadArray() { + item := ReadCloudProviderData(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cloud_provider_data_type.go b/clientapi/clustersmgmt/v1/cloud_provider_data_type.go new file mode 100644 index 00000000..d9ba66a1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_provider_data_type.go @@ -0,0 +1,357 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CloudProviderData represents the values of the 'cloud_provider_data' type. +// +// Description of a cloud provider data used for cloud provider inquiries. +type CloudProviderData struct { + bitmap_ uint32 + aws *AWS + gcp *GCP + availabilityZones []string + keyLocation string + keyRingName string + region *CloudRegion + subnets []string + version *Version + vpcIds []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CloudProviderData) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AWS returns the value of the 'AWS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Amazon Web Services settings. +func (o *CloudProviderData) AWS() *AWS { + if o != nil && o.bitmap_&1 != 0 { + return o.aws + } + return nil +} + +// GetAWS returns the value of the 'AWS' attribute and +// a flag indicating if the attribute has a value. +// +// Amazon Web Services settings. +func (o *CloudProviderData) GetAWS() (value *AWS, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.aws + } + return +} + +// GCP returns the value of the 'GCP' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Google cloud platform settings. +func (o *CloudProviderData) GCP() *GCP { + if o != nil && o.bitmap_&2 != 0 { + return o.gcp + } + return nil +} + +// GetGCP returns the value of the 'GCP' attribute and +// a flag indicating if the attribute has a value. +// +// Google cloud platform settings. +func (o *CloudProviderData) GetGCP() (value *GCP, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.gcp + } + return +} + +// AvailabilityZones returns the value of the 'availability_zones' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Availability zone +func (o *CloudProviderData) AvailabilityZones() []string { + if o != nil && o.bitmap_&4 != 0 { + return o.availabilityZones + } + return nil +} + +// GetAvailabilityZones returns the value of the 'availability_zones' attribute and +// a flag indicating if the attribute has a value. +// +// Availability zone +func (o *CloudProviderData) GetAvailabilityZones() (value []string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.availabilityZones + } + return +} + +// KeyLocation returns the value of the 'key_location' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Key location +func (o *CloudProviderData) KeyLocation() string { + if o != nil && o.bitmap_&8 != 0 { + return o.keyLocation + } + return "" +} + +// GetKeyLocation returns the value of the 'key_location' attribute and +// a flag indicating if the attribute has a value. +// +// Key location +func (o *CloudProviderData) GetKeyLocation() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.keyLocation + } + return +} + +// KeyRingName returns the value of the 'key_ring_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Key ring name +func (o *CloudProviderData) KeyRingName() string { + if o != nil && o.bitmap_&16 != 0 { + return o.keyRingName + } + return "" +} + +// GetKeyRingName returns the value of the 'key_ring_name' attribute and +// a flag indicating if the attribute has a value. +// +// Key ring name +func (o *CloudProviderData) GetKeyRingName() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.keyRingName + } + return +} + +// Region returns the value of the 'region' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Region +func (o *CloudProviderData) Region() *CloudRegion { + if o != nil && o.bitmap_&32 != 0 { + return o.region + } + return nil +} + +// GetRegion returns the value of the 'region' attribute and +// a flag indicating if the attribute has a value. +// +// Region +func (o *CloudProviderData) GetRegion() (value *CloudRegion, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.region + } + return +} + +// Subnets returns the value of the 'subnets' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Subnets +func (o *CloudProviderData) Subnets() []string { + if o != nil && o.bitmap_&64 != 0 { + return o.subnets + } + return nil +} + +// GetSubnets returns the value of the 'subnets' attribute and +// a flag indicating if the attribute has a value. +// +// Subnets +func (o *CloudProviderData) GetSubnets() (value []string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.subnets + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Openshift version +func (o *CloudProviderData) Version() *Version { + if o != nil && o.bitmap_&128 != 0 { + return o.version + } + return nil +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +// +// Openshift version +func (o *CloudProviderData) GetVersion() (value *Version, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.version + } + return +} + +// VpcIds returns the value of the 'vpc_ids' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// VPC ids +func (o *CloudProviderData) VpcIds() []string { + if o != nil && o.bitmap_&256 != 0 { + return o.vpcIds + } + return nil +} + +// GetVpcIds returns the value of the 'vpc_ids' attribute and +// a flag indicating if the attribute has a value. +// +// VPC ids +func (o *CloudProviderData) GetVpcIds() (value []string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.vpcIds + } + return +} + +// CloudProviderDataListKind is the name of the type used to represent list of objects of +// type 'cloud_provider_data'. +const CloudProviderDataListKind = "CloudProviderDataList" + +// CloudProviderDataListLinkKind is the name of the type used to represent links to list +// of objects of type 'cloud_provider_data'. +const CloudProviderDataListLinkKind = "CloudProviderDataListLink" + +// CloudProviderDataNilKind is the name of the type used to nil lists of objects of +// type 'cloud_provider_data'. +const CloudProviderDataListNilKind = "CloudProviderDataListNil" + +// CloudProviderDataList is a list of values of the 'cloud_provider_data' type. +type CloudProviderDataList struct { + href string + link bool + items []*CloudProviderData +} + +// Len returns the length of the list. +func (l *CloudProviderDataList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CloudProviderDataList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CloudProviderDataList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CloudProviderDataList) SetItems(items []*CloudProviderData) { + l.items = items +} + +// Items returns the items of the list. +func (l *CloudProviderDataList) Items() []*CloudProviderData { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CloudProviderDataList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CloudProviderDataList) Get(i int) *CloudProviderData { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CloudProviderDataList) Slice() []*CloudProviderData { + var slice []*CloudProviderData + if l == nil { + slice = make([]*CloudProviderData, 0) + } else { + slice = make([]*CloudProviderData, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CloudProviderDataList) Each(f func(item *CloudProviderData) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CloudProviderDataList) Range(f func(index int, item *CloudProviderData) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cloud_provider_data_type_json.go b/clientapi/clustersmgmt/v1/cloud_provider_data_type_json.go new file mode 100644 index 00000000..4f08c6d9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_provider_data_type_json.go @@ -0,0 +1,190 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudProviderData writes a value of the 'cloud_provider_data' type to the given writer. +func MarshalCloudProviderData(object *CloudProviderData, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudProviderData(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudProviderData writes a value of the 'cloud_provider_data' type to the given stream. +func WriteCloudProviderData(object *CloudProviderData, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.aws != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws") + WriteAWS(object.aws, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.gcp != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp") + WriteGCP(object.gcp, stream) + count++ + } + present_ = object.bitmap_&4 != 0 && object.availabilityZones != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zones") + WriteStringList(object.availabilityZones, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key_location") + stream.WriteString(object.keyLocation) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key_ring_name") + stream.WriteString(object.keyRingName) + count++ + } + present_ = object.bitmap_&32 != 0 && object.region != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region") + WriteCloudRegion(object.region, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.subnets != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnets") + WriteStringList(object.subnets, stream) + count++ + } + present_ = object.bitmap_&128 != 0 && object.version != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + WriteVersion(object.version, stream) + count++ + } + present_ = object.bitmap_&256 != 0 && object.vpcIds != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("vpc_ids") + WriteStringList(object.vpcIds, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalCloudProviderData reads a value of the 'cloud_provider_data' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCloudProviderData(source interface{}) (object *CloudProviderData, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCloudProviderData(iterator) + err = iterator.Error + return +} + +// ReadCloudProviderData reads a value of the 'cloud_provider_data' type from the given iterator. +func ReadCloudProviderData(iterator *jsoniter.Iterator) *CloudProviderData { + object := &CloudProviderData{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "aws": + value := ReadAWS(iterator) + object.aws = value + object.bitmap_ |= 1 + case "gcp": + value := ReadGCP(iterator) + object.gcp = value + object.bitmap_ |= 2 + case "availability_zones": + value := ReadStringList(iterator) + object.availabilityZones = value + object.bitmap_ |= 4 + case "key_location": + value := iterator.ReadString() + object.keyLocation = value + object.bitmap_ |= 8 + case "key_ring_name": + value := iterator.ReadString() + object.keyRingName = value + object.bitmap_ |= 16 + case "region": + value := ReadCloudRegion(iterator) + object.region = value + object.bitmap_ |= 32 + case "subnets": + value := ReadStringList(iterator) + object.subnets = value + object.bitmap_ |= 64 + case "version": + value := ReadVersion(iterator) + object.version = value + object.bitmap_ |= 128 + case "vpc_ids": + value := ReadStringList(iterator) + object.vpcIds = value + object.bitmap_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cloud_provider_list_builder.go b/clientapi/clustersmgmt/v1/cloud_provider_list_builder.go new file mode 100644 index 00000000..2153bc0e --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_provider_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CloudProviderListBuilder contains the data and logic needed to build +// 'cloud_provider' objects. +type CloudProviderListBuilder struct { + items []*CloudProviderBuilder +} + +// NewCloudProviderList creates a new builder of 'cloud_provider' objects. +func NewCloudProviderList() *CloudProviderListBuilder { + return new(CloudProviderListBuilder) +} + +// Items sets the items of the list. +func (b *CloudProviderListBuilder) Items(values ...*CloudProviderBuilder) *CloudProviderListBuilder { + b.items = make([]*CloudProviderBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CloudProviderListBuilder) 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 *CloudProviderListBuilder) Copy(list *CloudProviderList) *CloudProviderListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CloudProviderBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCloudProvider().Copy(v) + } + } + return b +} + +// Build creates a list of 'cloud_provider' objects using the +// configuration stored in the builder. +func (b *CloudProviderListBuilder) Build() (list *CloudProviderList, err error) { + items := make([]*CloudProvider, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CloudProviderList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cloud_provider_list_type_json.go b/clientapi/clustersmgmt/v1/cloud_provider_list_type_json.go new file mode 100644 index 00000000..623092fa --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_provider_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudProviderList writes a list of values of the 'cloud_provider' type to +// the given writer. +func MarshalCloudProviderList(list []*CloudProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudProviderList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudProviderList writes a list of value of the 'cloud_provider' type to +// the given stream. +func WriteCloudProviderList(list []*CloudProvider, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCloudProvider(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCloudProviderList reads a list of values of the 'cloud_provider' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCloudProviderList(source interface{}) (items []*CloudProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCloudProviderList(iterator) + err = iterator.Error + return +} + +// ReadCloudProviderList reads list of values of the ”cloud_provider' type from +// the given iterator. +func ReadCloudProviderList(iterator *jsoniter.Iterator) []*CloudProvider { + list := []*CloudProvider{} + for iterator.ReadArray() { + item := ReadCloudProvider(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cloud_provider_type.go b/clientapi/clustersmgmt/v1/cloud_provider_type.go new file mode 100644 index 00000000..f16cd396 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_provider_type.go @@ -0,0 +1,315 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CloudProviderKind is the name of the type used to represent objects +// of type 'cloud_provider'. +const CloudProviderKind = "CloudProvider" + +// CloudProviderLinkKind is the name of the type used to represent links +// to objects of type 'cloud_provider'. +const CloudProviderLinkKind = "CloudProviderLink" + +// CloudProviderNilKind is the name of the type used to nil references +// to objects of type 'cloud_provider'. +const CloudProviderNilKind = "CloudProviderNil" + +// CloudProvider represents the values of the 'cloud_provider' type. +// +// Cloud provider. +type CloudProvider struct { + bitmap_ uint32 + id string + href string + displayName string + name string + regions []*CloudRegion +} + +// Kind returns the name of the type of the object. +func (o *CloudProvider) Kind() string { + if o == nil { + return CloudProviderNilKind + } + if o.bitmap_&1 != 0 { + return CloudProviderLinkKind + } + return CloudProviderKind +} + +// Link returns true if this is a link. +func (o *CloudProvider) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *CloudProvider) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *CloudProvider) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *CloudProvider) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *CloudProvider) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CloudProvider) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the cloud provider for display purposes. It can contain any characters, +// including spaces. +func (o *CloudProvider) DisplayName() string { + if o != nil && o.bitmap_&8 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the cloud provider for display purposes. It can contain any characters, +// including spaces. +func (o *CloudProvider) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.displayName + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Human friendly identifier of the cloud provider, for example `aws`. +func (o *CloudProvider) Name() string { + if o != nil && o.bitmap_&16 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Human friendly identifier of the cloud provider, for example `aws`. +func (o *CloudProvider) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.name + } + return +} + +// Regions returns the value of the 'regions' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// (optional) Provider's regions - only included when listing providers with `fetchRegions=true`. +func (o *CloudProvider) Regions() []*CloudRegion { + if o != nil && o.bitmap_&32 != 0 { + return o.regions + } + return nil +} + +// GetRegions returns the value of the 'regions' attribute and +// a flag indicating if the attribute has a value. +// +// (optional) Provider's regions - only included when listing providers with `fetchRegions=true`. +func (o *CloudProvider) GetRegions() (value []*CloudRegion, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.regions + } + return +} + +// CloudProviderListKind is the name of the type used to represent list of objects of +// type 'cloud_provider'. +const CloudProviderListKind = "CloudProviderList" + +// CloudProviderListLinkKind is the name of the type used to represent links to list +// of objects of type 'cloud_provider'. +const CloudProviderListLinkKind = "CloudProviderListLink" + +// CloudProviderNilKind is the name of the type used to nil lists of objects of +// type 'cloud_provider'. +const CloudProviderListNilKind = "CloudProviderListNil" + +// CloudProviderList is a list of values of the 'cloud_provider' type. +type CloudProviderList struct { + href string + link bool + items []*CloudProvider +} + +// Kind returns the name of the type of the object. +func (l *CloudProviderList) Kind() string { + if l == nil { + return CloudProviderListNilKind + } + if l.link { + return CloudProviderListLinkKind + } + return CloudProviderListKind +} + +// Link returns true iif this is a link. +func (l *CloudProviderList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *CloudProviderList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *CloudProviderList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *CloudProviderList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CloudProviderList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CloudProviderList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CloudProviderList) SetItems(items []*CloudProvider) { + l.items = items +} + +// Items returns the items of the list. +func (l *CloudProviderList) Items() []*CloudProvider { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CloudProviderList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CloudProviderList) Get(i int) *CloudProvider { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CloudProviderList) Slice() []*CloudProvider { + var slice []*CloudProvider + if l == nil { + slice = make([]*CloudProvider, 0) + } else { + slice = make([]*CloudProvider, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CloudProviderList) Each(f func(item *CloudProvider) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CloudProviderList) Range(f func(index int, item *CloudProvider) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cloud_provider_type_json.go b/clientapi/clustersmgmt/v1/cloud_provider_type_json.go new file mode 100644 index 00000000..bba67df0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_provider_type_json.go @@ -0,0 +1,146 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudProvider writes a value of the 'cloud_provider' type to the given writer. +func MarshalCloudProvider(object *CloudProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudProvider(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudProvider writes a value of the 'cloud_provider' type to the given stream. +func WriteCloudProvider(object *CloudProvider, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(CloudProviderLinkKind) + } else { + stream.WriteString(CloudProviderKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&32 != 0 && object.regions != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("regions") + WriteCloudRegionList(object.regions, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalCloudProvider reads a value of the 'cloud_provider' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCloudProvider(source interface{}) (object *CloudProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCloudProvider(iterator) + err = iterator.Error + return +} + +// ReadCloudProvider reads a value of the 'cloud_provider' type from the given iterator. +func ReadCloudProvider(iterator *jsoniter.Iterator) *CloudProvider { + object := &CloudProvider{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == CloudProviderLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 8 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 16 + case "regions": + value := ReadCloudRegionList(iterator) + object.regions = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cloud_region_builder.go b/clientapi/clustersmgmt/v1/cloud_region_builder.go new file mode 100644 index 00000000..418529fa --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_region_builder.go @@ -0,0 +1,194 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CloudRegionBuilder contains the data and logic needed to build 'cloud_region' objects. +// +// Description of a region of a cloud provider. +type CloudRegionBuilder struct { + bitmap_ uint32 + id string + href string + kmsLocationID string + kmsLocationName string + cloudProvider *CloudProviderBuilder + displayName string + name string + ccsOnly bool + enabled bool + govCloud bool + supportsHypershift bool + supportsMultiAZ bool +} + +// NewCloudRegion creates a new builder of 'cloud_region' objects. +func NewCloudRegion() *CloudRegionBuilder { + return &CloudRegionBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *CloudRegionBuilder) Link(value bool) *CloudRegionBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *CloudRegionBuilder) ID(value string) *CloudRegionBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *CloudRegionBuilder) HREF(value string) *CloudRegionBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CloudRegionBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CCSOnly sets the value of the 'CCS_only' attribute to the given value. +func (b *CloudRegionBuilder) CCSOnly(value bool) *CloudRegionBuilder { + b.ccsOnly = value + b.bitmap_ |= 8 + return b +} + +// KMSLocationID sets the value of the 'KMS_location_ID' attribute to the given value. +func (b *CloudRegionBuilder) KMSLocationID(value string) *CloudRegionBuilder { + b.kmsLocationID = value + b.bitmap_ |= 16 + return b +} + +// KMSLocationName sets the value of the 'KMS_location_name' attribute to the given value. +func (b *CloudRegionBuilder) KMSLocationName(value string) *CloudRegionBuilder { + b.kmsLocationName = value + b.bitmap_ |= 32 + return b +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +// +// Cloud provider. +func (b *CloudRegionBuilder) CloudProvider(value *CloudProviderBuilder) *CloudRegionBuilder { + b.cloudProvider = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *CloudRegionBuilder) DisplayName(value string) *CloudRegionBuilder { + b.displayName = value + b.bitmap_ |= 128 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *CloudRegionBuilder) Enabled(value bool) *CloudRegionBuilder { + b.enabled = value + b.bitmap_ |= 256 + return b +} + +// GovCloud sets the value of the 'gov_cloud' attribute to the given value. +func (b *CloudRegionBuilder) GovCloud(value bool) *CloudRegionBuilder { + b.govCloud = value + b.bitmap_ |= 512 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *CloudRegionBuilder) Name(value string) *CloudRegionBuilder { + b.name = value + b.bitmap_ |= 1024 + return b +} + +// SupportsHypershift sets the value of the 'supports_hypershift' attribute to the given value. +func (b *CloudRegionBuilder) SupportsHypershift(value bool) *CloudRegionBuilder { + b.supportsHypershift = value + b.bitmap_ |= 2048 + return b +} + +// SupportsMultiAZ sets the value of the 'supports_multi_AZ' attribute to the given value. +func (b *CloudRegionBuilder) SupportsMultiAZ(value bool) *CloudRegionBuilder { + b.supportsMultiAZ = value + b.bitmap_ |= 4096 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CloudRegionBuilder) Copy(object *CloudRegion) *CloudRegionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.ccsOnly = object.ccsOnly + b.kmsLocationID = object.kmsLocationID + b.kmsLocationName = object.kmsLocationName + if object.cloudProvider != nil { + b.cloudProvider = NewCloudProvider().Copy(object.cloudProvider) + } else { + b.cloudProvider = nil + } + b.displayName = object.displayName + b.enabled = object.enabled + b.govCloud = object.govCloud + b.name = object.name + b.supportsHypershift = object.supportsHypershift + b.supportsMultiAZ = object.supportsMultiAZ + return b +} + +// Build creates a 'cloud_region' object using the configuration stored in the builder. +func (b *CloudRegionBuilder) Build() (object *CloudRegion, err error) { + object = new(CloudRegion) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.ccsOnly = b.ccsOnly + object.kmsLocationID = b.kmsLocationID + object.kmsLocationName = b.kmsLocationName + if b.cloudProvider != nil { + object.cloudProvider, err = b.cloudProvider.Build() + if err != nil { + return + } + } + object.displayName = b.displayName + object.enabled = b.enabled + object.govCloud = b.govCloud + object.name = b.name + object.supportsHypershift = b.supportsHypershift + object.supportsMultiAZ = b.supportsMultiAZ + return +} diff --git a/clientapi/clustersmgmt/v1/cloud_region_list_builder.go b/clientapi/clustersmgmt/v1/cloud_region_list_builder.go new file mode 100644 index 00000000..ae5a0648 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_region_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CloudRegionListBuilder contains the data and logic needed to build +// 'cloud_region' objects. +type CloudRegionListBuilder struct { + items []*CloudRegionBuilder +} + +// NewCloudRegionList creates a new builder of 'cloud_region' objects. +func NewCloudRegionList() *CloudRegionListBuilder { + return new(CloudRegionListBuilder) +} + +// Items sets the items of the list. +func (b *CloudRegionListBuilder) Items(values ...*CloudRegionBuilder) *CloudRegionListBuilder { + b.items = make([]*CloudRegionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CloudRegionListBuilder) 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 *CloudRegionListBuilder) Copy(list *CloudRegionList) *CloudRegionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CloudRegionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCloudRegion().Copy(v) + } + } + return b +} + +// Build creates a list of 'cloud_region' objects using the +// configuration stored in the builder. +func (b *CloudRegionListBuilder) Build() (list *CloudRegionList, err error) { + items := make([]*CloudRegion, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CloudRegionList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cloud_region_list_type_json.go b/clientapi/clustersmgmt/v1/cloud_region_list_type_json.go new file mode 100644 index 00000000..38d3c05c --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_region_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudRegionList writes a list of values of the 'cloud_region' type to +// the given writer. +func MarshalCloudRegionList(list []*CloudRegion, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudRegionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudRegionList writes a list of value of the 'cloud_region' type to +// the given stream. +func WriteCloudRegionList(list []*CloudRegion, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCloudRegion(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCloudRegionList reads a list of values of the 'cloud_region' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCloudRegionList(source interface{}) (items []*CloudRegion, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCloudRegionList(iterator) + err = iterator.Error + return +} + +// ReadCloudRegionList reads list of values of the ”cloud_region' type from +// the given iterator. +func ReadCloudRegionList(iterator *jsoniter.Iterator) []*CloudRegion { + list := []*CloudRegion{} + for iterator.ReadArray() { + item := ReadCloudRegion(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cloud_region_type.go b/clientapi/clustersmgmt/v1/cloud_region_type.go new file mode 100644 index 00000000..88154618 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_region_type.go @@ -0,0 +1,493 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CloudRegionKind is the name of the type used to represent objects +// of type 'cloud_region'. +const CloudRegionKind = "CloudRegion" + +// CloudRegionLinkKind is the name of the type used to represent links +// to objects of type 'cloud_region'. +const CloudRegionLinkKind = "CloudRegionLink" + +// CloudRegionNilKind is the name of the type used to nil references +// to objects of type 'cloud_region'. +const CloudRegionNilKind = "CloudRegionNil" + +// CloudRegion represents the values of the 'cloud_region' type. +// +// Description of a region of a cloud provider. +type CloudRegion struct { + bitmap_ uint32 + id string + href string + kmsLocationID string + kmsLocationName string + cloudProvider *CloudProvider + displayName string + name string + ccsOnly bool + enabled bool + govCloud bool + supportsHypershift bool + supportsMultiAZ bool +} + +// Kind returns the name of the type of the object. +func (o *CloudRegion) Kind() string { + if o == nil { + return CloudRegionNilKind + } + if o.bitmap_&1 != 0 { + return CloudRegionLinkKind + } + return CloudRegionKind +} + +// Link returns true if this is a link. +func (o *CloudRegion) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *CloudRegion) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *CloudRegion) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *CloudRegion) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *CloudRegion) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CloudRegion) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CCSOnly returns the value of the 'CCS_only' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// 'true' if the region is supported only for CCS clusters, 'false' otherwise. +func (o *CloudRegion) CCSOnly() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.ccsOnly + } + return false +} + +// GetCCSOnly returns the value of the 'CCS_only' attribute and +// a flag indicating if the attribute has a value. +// +// 'true' if the region is supported only for CCS clusters, 'false' otherwise. +func (o *CloudRegion) GetCCSOnly() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.ccsOnly + } + return +} + +// KMSLocationID returns the value of the 'KMS_location_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// (GCP only) Comma-separated list of KMS location IDs that can be used with this region. +// E.g. "global,nam4,us". Order is not guaranteed. +func (o *CloudRegion) KMSLocationID() string { + if o != nil && o.bitmap_&16 != 0 { + return o.kmsLocationID + } + return "" +} + +// GetKMSLocationID returns the value of the 'KMS_location_ID' attribute and +// a flag indicating if the attribute has a value. +// +// (GCP only) Comma-separated list of KMS location IDs that can be used with this region. +// E.g. "global,nam4,us". Order is not guaranteed. +func (o *CloudRegion) GetKMSLocationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.kmsLocationID + } + return +} + +// KMSLocationName returns the value of the 'KMS_location_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// (GCP only) Comma-separated list of display names corresponding to KMSLocationID. +// E.g. "Global,nam4 (Iowa, South Carolina, and Oklahoma),US". Order is not guaranteed but will match KMSLocationID. +// Unfortunately, this API doesn't allow robust splitting - Contact ocm-feedback@redhat.com if you want to rely on this. +func (o *CloudRegion) KMSLocationName() string { + if o != nil && o.bitmap_&32 != 0 { + return o.kmsLocationName + } + return "" +} + +// GetKMSLocationName returns the value of the 'KMS_location_name' attribute and +// a flag indicating if the attribute has a value. +// +// (GCP only) Comma-separated list of display names corresponding to KMSLocationID. +// E.g. "Global,nam4 (Iowa, South Carolina, and Oklahoma),US". Order is not guaranteed but will match KMSLocationID. +// Unfortunately, this API doesn't allow robust splitting - Contact ocm-feedback@redhat.com if you want to rely on this. +func (o *CloudRegion) GetKMSLocationName() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.kmsLocationName + } + return +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the cloud provider that the region belongs to. +func (o *CloudRegion) CloudProvider() *CloudProvider { + if o != nil && o.bitmap_&64 != 0 { + return o.cloudProvider + } + return nil +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the cloud provider that the region belongs to. +func (o *CloudRegion) GetCloudProvider() (value *CloudProvider, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the region for display purposes, for example `N. Virginia`. +func (o *CloudRegion) DisplayName() string { + if o != nil && o.bitmap_&128 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the region for display purposes, for example `N. Virginia`. +func (o *CloudRegion) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.displayName + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Whether the region is enabled for deploying a managed cluster. +func (o *CloudRegion) Enabled() bool { + if o != nil && o.bitmap_&256 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Whether the region is enabled for deploying a managed cluster. +func (o *CloudRegion) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.enabled + } + return +} + +// GovCloud returns the value of the 'gov_cloud' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Whether the region is an AWS GovCloud region. +func (o *CloudRegion) GovCloud() bool { + if o != nil && o.bitmap_&512 != 0 { + return o.govCloud + } + return false +} + +// GetGovCloud returns the value of the 'gov_cloud' attribute and +// a flag indicating if the attribute has a value. +// +// Whether the region is an AWS GovCloud region. +func (o *CloudRegion) GetGovCloud() (value bool, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.govCloud + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Human friendly identifier of the region, for example `us-east-1`. +// +// NOTE: Currently for all cloud providers and all regions `id` and `name` have exactly +// the same values. +func (o *CloudRegion) Name() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Human friendly identifier of the region, for example `us-east-1`. +// +// NOTE: Currently for all cloud providers and all regions `id` and `name` have exactly +// the same values. +func (o *CloudRegion) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.name + } + return +} + +// SupportsHypershift returns the value of the 'supports_hypershift' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// 'true' if the region is supported for Hypershift deployments, 'false' otherwise. +func (o *CloudRegion) SupportsHypershift() bool { + if o != nil && o.bitmap_&2048 != 0 { + return o.supportsHypershift + } + return false +} + +// GetSupportsHypershift returns the value of the 'supports_hypershift' attribute and +// a flag indicating if the attribute has a value. +// +// 'true' if the region is supported for Hypershift deployments, 'false' otherwise. +func (o *CloudRegion) GetSupportsHypershift() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.supportsHypershift + } + return +} + +// SupportsMultiAZ returns the value of the 'supports_multi_AZ' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Whether the region supports multiple availability zones. +func (o *CloudRegion) SupportsMultiAZ() bool { + if o != nil && o.bitmap_&4096 != 0 { + return o.supportsMultiAZ + } + return false +} + +// GetSupportsMultiAZ returns the value of the 'supports_multi_AZ' attribute and +// a flag indicating if the attribute has a value. +// +// Whether the region supports multiple availability zones. +func (o *CloudRegion) GetSupportsMultiAZ() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.supportsMultiAZ + } + return +} + +// CloudRegionListKind is the name of the type used to represent list of objects of +// type 'cloud_region'. +const CloudRegionListKind = "CloudRegionList" + +// CloudRegionListLinkKind is the name of the type used to represent links to list +// of objects of type 'cloud_region'. +const CloudRegionListLinkKind = "CloudRegionListLink" + +// CloudRegionNilKind is the name of the type used to nil lists of objects of +// type 'cloud_region'. +const CloudRegionListNilKind = "CloudRegionListNil" + +// CloudRegionList is a list of values of the 'cloud_region' type. +type CloudRegionList struct { + href string + link bool + items []*CloudRegion +} + +// Kind returns the name of the type of the object. +func (l *CloudRegionList) Kind() string { + if l == nil { + return CloudRegionListNilKind + } + if l.link { + return CloudRegionListLinkKind + } + return CloudRegionListKind +} + +// Link returns true iif this is a link. +func (l *CloudRegionList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *CloudRegionList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *CloudRegionList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *CloudRegionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CloudRegionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CloudRegionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CloudRegionList) SetItems(items []*CloudRegion) { + l.items = items +} + +// Items returns the items of the list. +func (l *CloudRegionList) Items() []*CloudRegion { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CloudRegionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CloudRegionList) Get(i int) *CloudRegion { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CloudRegionList) Slice() []*CloudRegion { + var slice []*CloudRegion + if l == nil { + slice = make([]*CloudRegion, 0) + } else { + slice = make([]*CloudRegion, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CloudRegionList) Each(f func(item *CloudRegion) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CloudRegionList) Range(f func(index int, item *CloudRegion) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cloud_region_type_json.go b/clientapi/clustersmgmt/v1/cloud_region_type_json.go new file mode 100644 index 00000000..09443e11 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_region_type_json.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudRegion writes a value of the 'cloud_region' type to the given writer. +func MarshalCloudRegion(object *CloudRegion, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudRegion(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudRegion writes a value of the 'cloud_region' type to the given stream. +func WriteCloudRegion(object *CloudRegion, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(CloudRegionLinkKind) + } else { + stream.WriteString(CloudRegionKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ccs_only") + stream.WriteBool(object.ccsOnly) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kms_location_id") + stream.WriteString(object.kmsLocationID) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kms_location_name") + stream.WriteString(object.kmsLocationName) + count++ + } + present_ = object.bitmap_&64 != 0 && object.cloudProvider != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + WriteCloudProvider(object.cloudProvider, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("govcloud") + stream.WriteBool(object.govCloud) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("supports_hypershift") + stream.WriteBool(object.supportsHypershift) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("supports_multi_az") + stream.WriteBool(object.supportsMultiAZ) + } + stream.WriteObjectEnd() +} + +// UnmarshalCloudRegion reads a value of the 'cloud_region' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCloudRegion(source interface{}) (object *CloudRegion, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCloudRegion(iterator) + err = iterator.Error + return +} + +// ReadCloudRegion reads a value of the 'cloud_region' type from the given iterator. +func ReadCloudRegion(iterator *jsoniter.Iterator) *CloudRegion { + object := &CloudRegion{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == CloudRegionLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "ccs_only": + value := iterator.ReadBool() + object.ccsOnly = value + object.bitmap_ |= 8 + case "kms_location_id": + value := iterator.ReadString() + object.kmsLocationID = value + object.bitmap_ |= 16 + case "kms_location_name": + value := iterator.ReadString() + object.kmsLocationName = value + object.bitmap_ |= 32 + case "cloud_provider": + value := ReadCloudProvider(iterator) + object.cloudProvider = value + object.bitmap_ |= 64 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 128 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 256 + case "govcloud": + value := iterator.ReadBool() + object.govCloud = value + object.bitmap_ |= 512 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1024 + case "supports_hypershift": + value := iterator.ReadBool() + object.supportsHypershift = value + object.bitmap_ |= 2048 + case "supports_multi_az": + value := iterator.ReadBool() + object.supportsMultiAZ = value + object.bitmap_ |= 4096 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cloud_vpc_builder.go b/clientapi/clustersmgmt/v1/cloud_vpc_builder.go new file mode 100644 index 00000000..fbadb16f --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_vpc_builder.go @@ -0,0 +1,164 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CloudVPCBuilder contains the data and logic needed to build 'cloud_VPC' objects. +// +// Description of a cloud provider virtual private cloud. +type CloudVPCBuilder struct { + bitmap_ uint32 + awsSecurityGroups []*SecurityGroupBuilder + awsSubnets []*SubnetworkBuilder + cidrBlock string + id string + name string + subnets []string + redHatManaged bool +} + +// NewCloudVPC creates a new builder of 'cloud_VPC' objects. +func NewCloudVPC() *CloudVPCBuilder { + return &CloudVPCBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CloudVPCBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AWSSecurityGroups sets the value of the 'AWS_security_groups' attribute to the given values. +func (b *CloudVPCBuilder) AWSSecurityGroups(values ...*SecurityGroupBuilder) *CloudVPCBuilder { + b.awsSecurityGroups = make([]*SecurityGroupBuilder, len(values)) + copy(b.awsSecurityGroups, values) + b.bitmap_ |= 1 + return b +} + +// AWSSubnets sets the value of the 'AWS_subnets' attribute to the given values. +func (b *CloudVPCBuilder) AWSSubnets(values ...*SubnetworkBuilder) *CloudVPCBuilder { + b.awsSubnets = make([]*SubnetworkBuilder, len(values)) + copy(b.awsSubnets, values) + b.bitmap_ |= 2 + return b +} + +// CIDRBlock sets the value of the 'CIDR_block' attribute to the given value. +func (b *CloudVPCBuilder) CIDRBlock(value string) *CloudVPCBuilder { + b.cidrBlock = value + b.bitmap_ |= 4 + return b +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *CloudVPCBuilder) ID(value string) *CloudVPCBuilder { + b.id = value + b.bitmap_ |= 8 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *CloudVPCBuilder) Name(value string) *CloudVPCBuilder { + b.name = value + b.bitmap_ |= 16 + return b +} + +// RedHatManaged sets the value of the 'red_hat_managed' attribute to the given value. +func (b *CloudVPCBuilder) RedHatManaged(value bool) *CloudVPCBuilder { + b.redHatManaged = value + b.bitmap_ |= 32 + return b +} + +// Subnets sets the value of the 'subnets' attribute to the given values. +func (b *CloudVPCBuilder) Subnets(values ...string) *CloudVPCBuilder { + b.subnets = make([]string, len(values)) + copy(b.subnets, values) + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CloudVPCBuilder) Copy(object *CloudVPC) *CloudVPCBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.awsSecurityGroups != nil { + b.awsSecurityGroups = make([]*SecurityGroupBuilder, len(object.awsSecurityGroups)) + for i, v := range object.awsSecurityGroups { + b.awsSecurityGroups[i] = NewSecurityGroup().Copy(v) + } + } else { + b.awsSecurityGroups = nil + } + if object.awsSubnets != nil { + b.awsSubnets = make([]*SubnetworkBuilder, len(object.awsSubnets)) + for i, v := range object.awsSubnets { + b.awsSubnets[i] = NewSubnetwork().Copy(v) + } + } else { + b.awsSubnets = nil + } + b.cidrBlock = object.cidrBlock + b.id = object.id + b.name = object.name + b.redHatManaged = object.redHatManaged + if object.subnets != nil { + b.subnets = make([]string, len(object.subnets)) + copy(b.subnets, object.subnets) + } else { + b.subnets = nil + } + return b +} + +// Build creates a 'cloud_VPC' object using the configuration stored in the builder. +func (b *CloudVPCBuilder) Build() (object *CloudVPC, err error) { + object = new(CloudVPC) + object.bitmap_ = b.bitmap_ + if b.awsSecurityGroups != nil { + object.awsSecurityGroups = make([]*SecurityGroup, len(b.awsSecurityGroups)) + for i, v := range b.awsSecurityGroups { + object.awsSecurityGroups[i], err = v.Build() + if err != nil { + return + } + } + } + if b.awsSubnets != nil { + object.awsSubnets = make([]*Subnetwork, len(b.awsSubnets)) + for i, v := range b.awsSubnets { + object.awsSubnets[i], err = v.Build() + if err != nil { + return + } + } + } + object.cidrBlock = b.cidrBlock + object.id = b.id + object.name = b.name + object.redHatManaged = b.redHatManaged + if b.subnets != nil { + object.subnets = make([]string, len(b.subnets)) + copy(object.subnets, b.subnets) + } + return +} diff --git a/clientapi/clustersmgmt/v1/cloud_vpc_list_builder.go b/clientapi/clustersmgmt/v1/cloud_vpc_list_builder.go new file mode 100644 index 00000000..1ed365ea --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_vpc_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CloudVPCListBuilder contains the data and logic needed to build +// 'cloud_VPC' objects. +type CloudVPCListBuilder struct { + items []*CloudVPCBuilder +} + +// NewCloudVPCList creates a new builder of 'cloud_VPC' objects. +func NewCloudVPCList() *CloudVPCListBuilder { + return new(CloudVPCListBuilder) +} + +// Items sets the items of the list. +func (b *CloudVPCListBuilder) Items(values ...*CloudVPCBuilder) *CloudVPCListBuilder { + b.items = make([]*CloudVPCBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CloudVPCListBuilder) 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 *CloudVPCListBuilder) Copy(list *CloudVPCList) *CloudVPCListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CloudVPCBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCloudVPC().Copy(v) + } + } + return b +} + +// Build creates a list of 'cloud_VPC' objects using the +// configuration stored in the builder. +func (b *CloudVPCListBuilder) Build() (list *CloudVPCList, err error) { + items := make([]*CloudVPC, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CloudVPCList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cloud_vpc_list_type_json.go b/clientapi/clustersmgmt/v1/cloud_vpc_list_type_json.go new file mode 100644 index 00000000..6838ecce --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_vpc_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudVPCList writes a list of values of the 'cloud_VPC' type to +// the given writer. +func MarshalCloudVPCList(list []*CloudVPC, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudVPCList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudVPCList writes a list of value of the 'cloud_VPC' type to +// the given stream. +func WriteCloudVPCList(list []*CloudVPC, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCloudVPC(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCloudVPCList reads a list of values of the 'cloud_VPC' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCloudVPCList(source interface{}) (items []*CloudVPC, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCloudVPCList(iterator) + err = iterator.Error + return +} + +// ReadCloudVPCList reads list of values of the ”cloud_VPC' type from +// the given iterator. +func ReadCloudVPCList(iterator *jsoniter.Iterator) []*CloudVPC { + list := []*CloudVPC{} + for iterator.ReadArray() { + item := ReadCloudVPC(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cloud_vpc_type.go b/clientapi/clustersmgmt/v1/cloud_vpc_type.go new file mode 100644 index 00000000..03136de6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_vpc_type.go @@ -0,0 +1,309 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CloudVPC represents the values of the 'cloud_VPC' type. +// +// Description of a cloud provider virtual private cloud. +type CloudVPC struct { + bitmap_ uint32 + awsSecurityGroups []*SecurityGroup + awsSubnets []*Subnetwork + cidrBlock string + id string + name string + subnets []string + redHatManaged bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CloudVPC) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AWSSecurityGroups returns the value of the 'AWS_security_groups' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of AWS security groups with details. +func (o *CloudVPC) AWSSecurityGroups() []*SecurityGroup { + if o != nil && o.bitmap_&1 != 0 { + return o.awsSecurityGroups + } + return nil +} + +// GetAWSSecurityGroups returns the value of the 'AWS_security_groups' attribute and +// a flag indicating if the attribute has a value. +// +// List of AWS security groups with details. +func (o *CloudVPC) GetAWSSecurityGroups() (value []*SecurityGroup, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.awsSecurityGroups + } + return +} + +// AWSSubnets returns the value of the 'AWS_subnets' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of AWS subnetworks with details. +func (o *CloudVPC) AWSSubnets() []*Subnetwork { + if o != nil && o.bitmap_&2 != 0 { + return o.awsSubnets + } + return nil +} + +// GetAWSSubnets returns the value of the 'AWS_subnets' attribute and +// a flag indicating if the attribute has a value. +// +// List of AWS subnetworks with details. +func (o *CloudVPC) GetAWSSubnets() (value []*Subnetwork, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.awsSubnets + } + return +} + +// CIDRBlock returns the value of the 'CIDR_block' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// CIDR block of the virtual private cloud. +func (o *CloudVPC) CIDRBlock() string { + if o != nil && o.bitmap_&4 != 0 { + return o.cidrBlock + } + return "" +} + +// GetCIDRBlock returns the value of the 'CIDR_block' attribute and +// a flag indicating if the attribute has a value. +// +// CIDR block of the virtual private cloud. +func (o *CloudVPC) GetCIDRBlock() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.cidrBlock + } + return +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID of virtual private cloud. +func (o *CloudVPC) ID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID of virtual private cloud. +func (o *CloudVPC) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.id + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of virtual private cloud according to its `Name` tag on AWS. +func (o *CloudVPC) Name() string { + if o != nil && o.bitmap_&16 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of virtual private cloud according to its `Name` tag on AWS. +func (o *CloudVPC) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.name + } + return +} + +// RedHatManaged returns the value of the 'red_hat_managed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// If the resource is RH managed. +func (o *CloudVPC) RedHatManaged() bool { + if o != nil && o.bitmap_&32 != 0 { + return o.redHatManaged + } + return false +} + +// GetRedHatManaged returns the value of the 'red_hat_managed' attribute and +// a flag indicating if the attribute has a value. +// +// If the resource is RH managed. +func (o *CloudVPC) GetRedHatManaged() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.redHatManaged + } + return +} + +// Subnets returns the value of the 'subnets' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of subnets used by the virtual private cloud. +func (o *CloudVPC) Subnets() []string { + if o != nil && o.bitmap_&64 != 0 { + return o.subnets + } + return nil +} + +// GetSubnets returns the value of the 'subnets' attribute and +// a flag indicating if the attribute has a value. +// +// List of subnets used by the virtual private cloud. +func (o *CloudVPC) GetSubnets() (value []string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.subnets + } + return +} + +// CloudVPCListKind is the name of the type used to represent list of objects of +// type 'cloud_VPC'. +const CloudVPCListKind = "CloudVPCList" + +// CloudVPCListLinkKind is the name of the type used to represent links to list +// of objects of type 'cloud_VPC'. +const CloudVPCListLinkKind = "CloudVPCListLink" + +// CloudVPCNilKind is the name of the type used to nil lists of objects of +// type 'cloud_VPC'. +const CloudVPCListNilKind = "CloudVPCListNil" + +// CloudVPCList is a list of values of the 'cloud_VPC' type. +type CloudVPCList struct { + href string + link bool + items []*CloudVPC +} + +// Len returns the length of the list. +func (l *CloudVPCList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CloudVPCList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CloudVPCList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CloudVPCList) SetItems(items []*CloudVPC) { + l.items = items +} + +// Items returns the items of the list. +func (l *CloudVPCList) Items() []*CloudVPC { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CloudVPCList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CloudVPCList) Get(i int) *CloudVPC { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CloudVPCList) Slice() []*CloudVPC { + var slice []*CloudVPC + if l == nil { + slice = make([]*CloudVPC, 0) + } else { + slice = make([]*CloudVPC, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CloudVPCList) Each(f func(item *CloudVPC) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CloudVPCList) Range(f func(index int, item *CloudVPC) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cloud_vpc_type_json.go b/clientapi/clustersmgmt/v1/cloud_vpc_type_json.go new file mode 100644 index 00000000..ca6b6bca --- /dev/null +++ b/clientapi/clustersmgmt/v1/cloud_vpc_type_json.go @@ -0,0 +1,164 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudVPC writes a value of the 'cloud_VPC' type to the given writer. +func MarshalCloudVPC(object *CloudVPC, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudVPC(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudVPC writes a value of the 'cloud_VPC' type to the given stream. +func WriteCloudVPC(object *CloudVPC, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.awsSecurityGroups != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws_security_groups") + WriteSecurityGroupList(object.awsSecurityGroups, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.awsSubnets != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws_subnets") + WriteSubnetworkList(object.awsSubnets, stream) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cidr_block") + stream.WriteString(object.cidrBlock) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("red_hat_managed") + stream.WriteBool(object.redHatManaged) + count++ + } + present_ = object.bitmap_&64 != 0 && object.subnets != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnets") + WriteStringList(object.subnets, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalCloudVPC reads a value of the 'cloud_VPC' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCloudVPC(source interface{}) (object *CloudVPC, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCloudVPC(iterator) + err = iterator.Error + return +} + +// ReadCloudVPC reads a value of the 'cloud_VPC' type from the given iterator. +func ReadCloudVPC(iterator *jsoniter.Iterator) *CloudVPC { + object := &CloudVPC{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "aws_security_groups": + value := ReadSecurityGroupList(iterator) + object.awsSecurityGroups = value + object.bitmap_ |= 1 + case "aws_subnets": + value := ReadSubnetworkList(iterator) + object.awsSubnets = value + object.bitmap_ |= 2 + case "cidr_block": + value := iterator.ReadString() + object.cidrBlock = value + object.bitmap_ |= 4 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 8 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 16 + case "red_hat_managed": + value := iterator.ReadBool() + object.redHatManaged = value + object.bitmap_ |= 32 + case "subnets": + value := ReadStringList(iterator) + object.subnets = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_api_builder.go b/clientapi/clustersmgmt/v1/cluster_api_builder.go new file mode 100644 index 00000000..a3f27b8d --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_api_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterAPIBuilder contains the data and logic needed to build 'cluster_API' objects. +// +// Information about the API of a cluster. +type ClusterAPIBuilder struct { + bitmap_ uint32 + url string + listening ListeningMethod +} + +// NewClusterAPI creates a new builder of 'cluster_API' objects. +func NewClusterAPI() *ClusterAPIBuilder { + return &ClusterAPIBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterAPIBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// URL sets the value of the 'URL' attribute to the given value. +func (b *ClusterAPIBuilder) URL(value string) *ClusterAPIBuilder { + b.url = value + b.bitmap_ |= 1 + return b +} + +// Listening sets the value of the 'listening' attribute to the given value. +// +// Cluster components listening method. +func (b *ClusterAPIBuilder) Listening(value ListeningMethod) *ClusterAPIBuilder { + b.listening = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterAPIBuilder) Copy(object *ClusterAPI) *ClusterAPIBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.url = object.url + b.listening = object.listening + return b +} + +// Build creates a 'cluster_API' object using the configuration stored in the builder. +func (b *ClusterAPIBuilder) Build() (object *ClusterAPI, err error) { + object = new(ClusterAPI) + object.bitmap_ = b.bitmap_ + object.url = b.url + object.listening = b.listening + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_api_list_builder.go b/clientapi/clustersmgmt/v1/cluster_api_list_builder.go new file mode 100644 index 00000000..d49c8583 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_api_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterAPIListBuilder contains the data and logic needed to build +// 'cluster_API' objects. +type ClusterAPIListBuilder struct { + items []*ClusterAPIBuilder +} + +// NewClusterAPIList creates a new builder of 'cluster_API' objects. +func NewClusterAPIList() *ClusterAPIListBuilder { + return new(ClusterAPIListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterAPIListBuilder) Items(values ...*ClusterAPIBuilder) *ClusterAPIListBuilder { + b.items = make([]*ClusterAPIBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterAPIListBuilder) 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 *ClusterAPIListBuilder) Copy(list *ClusterAPIList) *ClusterAPIListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterAPIBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterAPI().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_API' objects using the +// configuration stored in the builder. +func (b *ClusterAPIListBuilder) Build() (list *ClusterAPIList, err error) { + items := make([]*ClusterAPI, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterAPIList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_api_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_api_list_type_json.go new file mode 100644 index 00000000..6ae62c6e --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_api_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterAPIList writes a list of values of the 'cluster_API' type to +// the given writer. +func MarshalClusterAPIList(list []*ClusterAPI, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterAPIList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterAPIList writes a list of value of the 'cluster_API' type to +// the given stream. +func WriteClusterAPIList(list []*ClusterAPI, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterAPI(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterAPIList reads a list of values of the 'cluster_API' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterAPIList(source interface{}) (items []*ClusterAPI, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterAPIList(iterator) + err = iterator.Error + return +} + +// ReadClusterAPIList reads list of values of the ”cluster_API' type from +// the given iterator. +func ReadClusterAPIList(iterator *jsoniter.Iterator) []*ClusterAPI { + list := []*ClusterAPI{} + for iterator.ReadArray() { + item := ReadClusterAPI(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_api_type.go b/clientapi/clustersmgmt/v1/cluster_api_type.go new file mode 100644 index 00000000..fb1d719c --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_api_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterAPI represents the values of the 'cluster_API' type. +// +// Information about the API of a cluster. +type ClusterAPI struct { + bitmap_ uint32 + url string + listening ListeningMethod +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterAPI) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// URL returns the value of the 'URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The URL of the API server of the cluster. +func (o *ClusterAPI) URL() string { + if o != nil && o.bitmap_&1 != 0 { + return o.url + } + return "" +} + +// GetURL returns the value of the 'URL' attribute and +// a flag indicating if the attribute has a value. +// +// The URL of the API server of the cluster. +func (o *ClusterAPI) GetURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.url + } + return +} + +// Listening returns the value of the 'listening' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The listening method of the API server. +func (o *ClusterAPI) Listening() ListeningMethod { + if o != nil && o.bitmap_&2 != 0 { + return o.listening + } + return ListeningMethod("") +} + +// GetListening returns the value of the 'listening' attribute and +// a flag indicating if the attribute has a value. +// +// The listening method of the API server. +func (o *ClusterAPI) GetListening() (value ListeningMethod, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.listening + } + return +} + +// ClusterAPIListKind is the name of the type used to represent list of objects of +// type 'cluster_API'. +const ClusterAPIListKind = "ClusterAPIList" + +// ClusterAPIListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_API'. +const ClusterAPIListLinkKind = "ClusterAPIListLink" + +// ClusterAPINilKind is the name of the type used to nil lists of objects of +// type 'cluster_API'. +const ClusterAPIListNilKind = "ClusterAPIListNil" + +// ClusterAPIList is a list of values of the 'cluster_API' type. +type ClusterAPIList struct { + href string + link bool + items []*ClusterAPI +} + +// Len returns the length of the list. +func (l *ClusterAPIList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterAPIList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterAPIList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterAPIList) SetItems(items []*ClusterAPI) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterAPIList) Items() []*ClusterAPI { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterAPIList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterAPIList) Get(i int) *ClusterAPI { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterAPIList) Slice() []*ClusterAPI { + var slice []*ClusterAPI + if l == nil { + slice = make([]*ClusterAPI, 0) + } else { + slice = make([]*ClusterAPI, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterAPIList) Each(f func(item *ClusterAPI) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterAPIList) Range(f func(index int, item *ClusterAPI) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_api_type_json.go b/clientapi/clustersmgmt/v1/cluster_api_type_json.go new file mode 100644 index 00000000..06f5354d --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_api_type_json.go @@ -0,0 +1,100 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterAPI writes a value of the 'cluster_API' type to the given writer. +func MarshalClusterAPI(object *ClusterAPI, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterAPI(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterAPI writes a value of the 'cluster_API' type to the given stream. +func WriteClusterAPI(object *ClusterAPI, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("url") + stream.WriteString(object.url) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("listening") + stream.WriteString(string(object.listening)) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterAPI reads a value of the 'cluster_API' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterAPI(source interface{}) (object *ClusterAPI, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterAPI(iterator) + err = iterator.Error + return +} + +// ReadClusterAPI reads a value of the 'cluster_API' type from the given iterator. +func ReadClusterAPI(iterator *jsoniter.Iterator) *ClusterAPI { + object := &ClusterAPI{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "url": + value := iterator.ReadString() + object.url = value + object.bitmap_ |= 1 + case "listening": + text := iterator.ReadString() + value := ListeningMethod(text) + object.listening = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_architecture_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_architecture_list_type_json.go new file mode 100644 index 00000000..c8c55fb4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_architecture_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterArchitectureList writes a list of values of the 'cluster_architecture' type to +// the given writer. +func MarshalClusterArchitectureList(list []ClusterArchitecture, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterArchitectureList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterArchitectureList writes a list of value of the 'cluster_architecture' type to +// the given stream. +func WriteClusterArchitectureList(list []ClusterArchitecture, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterArchitectureList reads a list of values of the 'cluster_architecture' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterArchitectureList(source interface{}) (items []ClusterArchitecture, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterArchitectureList(iterator) + err = iterator.Error + return +} + +// ReadClusterArchitectureList reads list of values of the ”cluster_architecture' type from +// the given iterator. +func ReadClusterArchitectureList(iterator *jsoniter.Iterator) []ClusterArchitecture { + list := []ClusterArchitecture{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ClusterArchitecture(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_architecture_type.go b/clientapi/clustersmgmt/v1/cluster_architecture_type.go new file mode 100644 index 00000000..838969ba --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_architecture_type.go @@ -0,0 +1,30 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterArchitecture represents the values of the 'cluster_architecture' enumerated type. +type ClusterArchitecture string + +const ( + // + ClusterArchitectureClassic ClusterArchitecture = "classic" + // + ClusterArchitectureHcp ClusterArchitecture = "hcp" +) diff --git a/clientapi/clustersmgmt/v1/cluster_autoscaler_builder.go b/clientapi/clustersmgmt/v1/cluster_autoscaler_builder.go new file mode 100644 index 00000000..cc885bde --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_autoscaler_builder.go @@ -0,0 +1,214 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterAutoscalerBuilder contains the data and logic needed to build 'cluster_autoscaler' objects. +// +// Cluster-wide autoscaling configuration. +type ClusterAutoscalerBuilder struct { + bitmap_ uint32 + id string + href string + balancingIgnoredLabels []string + logVerbosity int + maxNodeProvisionTime string + maxPodGracePeriod int + podPriorityThreshold int + resourceLimits *AutoscalerResourceLimitsBuilder + scaleDown *AutoscalerScaleDownConfigBuilder + balanceSimilarNodeGroups bool + ignoreDaemonsetsUtilization bool + skipNodesWithLocalStorage bool +} + +// NewClusterAutoscaler creates a new builder of 'cluster_autoscaler' objects. +func NewClusterAutoscaler() *ClusterAutoscalerBuilder { + return &ClusterAutoscalerBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ClusterAutoscalerBuilder) Link(value bool) *ClusterAutoscalerBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ClusterAutoscalerBuilder) ID(value string) *ClusterAutoscalerBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ClusterAutoscalerBuilder) HREF(value string) *ClusterAutoscalerBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterAutoscalerBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// BalanceSimilarNodeGroups sets the value of the 'balance_similar_node_groups' attribute to the given value. +func (b *ClusterAutoscalerBuilder) BalanceSimilarNodeGroups(value bool) *ClusterAutoscalerBuilder { + b.balanceSimilarNodeGroups = value + b.bitmap_ |= 8 + return b +} + +// BalancingIgnoredLabels sets the value of the 'balancing_ignored_labels' attribute to the given values. +func (b *ClusterAutoscalerBuilder) BalancingIgnoredLabels(values ...string) *ClusterAutoscalerBuilder { + b.balancingIgnoredLabels = make([]string, len(values)) + copy(b.balancingIgnoredLabels, values) + b.bitmap_ |= 16 + return b +} + +// IgnoreDaemonsetsUtilization sets the value of the 'ignore_daemonsets_utilization' attribute to the given value. +func (b *ClusterAutoscalerBuilder) IgnoreDaemonsetsUtilization(value bool) *ClusterAutoscalerBuilder { + b.ignoreDaemonsetsUtilization = value + b.bitmap_ |= 32 + return b +} + +// LogVerbosity sets the value of the 'log_verbosity' attribute to the given value. +func (b *ClusterAutoscalerBuilder) LogVerbosity(value int) *ClusterAutoscalerBuilder { + b.logVerbosity = value + b.bitmap_ |= 64 + return b +} + +// MaxNodeProvisionTime sets the value of the 'max_node_provision_time' attribute to the given value. +func (b *ClusterAutoscalerBuilder) MaxNodeProvisionTime(value string) *ClusterAutoscalerBuilder { + b.maxNodeProvisionTime = value + b.bitmap_ |= 128 + return b +} + +// MaxPodGracePeriod sets the value of the 'max_pod_grace_period' attribute to the given value. +func (b *ClusterAutoscalerBuilder) MaxPodGracePeriod(value int) *ClusterAutoscalerBuilder { + b.maxPodGracePeriod = value + b.bitmap_ |= 256 + return b +} + +// PodPriorityThreshold sets the value of the 'pod_priority_threshold' attribute to the given value. +func (b *ClusterAutoscalerBuilder) PodPriorityThreshold(value int) *ClusterAutoscalerBuilder { + b.podPriorityThreshold = value + b.bitmap_ |= 512 + return b +} + +// ResourceLimits sets the value of the 'resource_limits' attribute to the given value. +func (b *ClusterAutoscalerBuilder) ResourceLimits(value *AutoscalerResourceLimitsBuilder) *ClusterAutoscalerBuilder { + b.resourceLimits = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// ScaleDown sets the value of the 'scale_down' attribute to the given value. +func (b *ClusterAutoscalerBuilder) ScaleDown(value *AutoscalerScaleDownConfigBuilder) *ClusterAutoscalerBuilder { + b.scaleDown = value + if value != nil { + b.bitmap_ |= 2048 + } else { + b.bitmap_ &^= 2048 + } + return b +} + +// SkipNodesWithLocalStorage sets the value of the 'skip_nodes_with_local_storage' attribute to the given value. +func (b *ClusterAutoscalerBuilder) SkipNodesWithLocalStorage(value bool) *ClusterAutoscalerBuilder { + b.skipNodesWithLocalStorage = value + b.bitmap_ |= 4096 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterAutoscalerBuilder) Copy(object *ClusterAutoscaler) *ClusterAutoscalerBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.balanceSimilarNodeGroups = object.balanceSimilarNodeGroups + if object.balancingIgnoredLabels != nil { + b.balancingIgnoredLabels = make([]string, len(object.balancingIgnoredLabels)) + copy(b.balancingIgnoredLabels, object.balancingIgnoredLabels) + } else { + b.balancingIgnoredLabels = nil + } + b.ignoreDaemonsetsUtilization = object.ignoreDaemonsetsUtilization + b.logVerbosity = object.logVerbosity + b.maxNodeProvisionTime = object.maxNodeProvisionTime + b.maxPodGracePeriod = object.maxPodGracePeriod + b.podPriorityThreshold = object.podPriorityThreshold + if object.resourceLimits != nil { + b.resourceLimits = NewAutoscalerResourceLimits().Copy(object.resourceLimits) + } else { + b.resourceLimits = nil + } + if object.scaleDown != nil { + b.scaleDown = NewAutoscalerScaleDownConfig().Copy(object.scaleDown) + } else { + b.scaleDown = nil + } + b.skipNodesWithLocalStorage = object.skipNodesWithLocalStorage + return b +} + +// Build creates a 'cluster_autoscaler' object using the configuration stored in the builder. +func (b *ClusterAutoscalerBuilder) Build() (object *ClusterAutoscaler, err error) { + object = new(ClusterAutoscaler) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.balanceSimilarNodeGroups = b.balanceSimilarNodeGroups + if b.balancingIgnoredLabels != nil { + object.balancingIgnoredLabels = make([]string, len(b.balancingIgnoredLabels)) + copy(object.balancingIgnoredLabels, b.balancingIgnoredLabels) + } + object.ignoreDaemonsetsUtilization = b.ignoreDaemonsetsUtilization + object.logVerbosity = b.logVerbosity + object.maxNodeProvisionTime = b.maxNodeProvisionTime + object.maxPodGracePeriod = b.maxPodGracePeriod + object.podPriorityThreshold = b.podPriorityThreshold + if b.resourceLimits != nil { + object.resourceLimits, err = b.resourceLimits.Build() + if err != nil { + return + } + } + if b.scaleDown != nil { + object.scaleDown, err = b.scaleDown.Build() + if err != nil { + return + } + } + object.skipNodesWithLocalStorage = b.skipNodesWithLocalStorage + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_autoscaler_list_builder.go b/clientapi/clustersmgmt/v1/cluster_autoscaler_list_builder.go new file mode 100644 index 00000000..78a269d5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_autoscaler_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterAutoscalerListBuilder contains the data and logic needed to build +// 'cluster_autoscaler' objects. +type ClusterAutoscalerListBuilder struct { + items []*ClusterAutoscalerBuilder +} + +// NewClusterAutoscalerList creates a new builder of 'cluster_autoscaler' objects. +func NewClusterAutoscalerList() *ClusterAutoscalerListBuilder { + return new(ClusterAutoscalerListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterAutoscalerListBuilder) Items(values ...*ClusterAutoscalerBuilder) *ClusterAutoscalerListBuilder { + b.items = make([]*ClusterAutoscalerBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterAutoscalerListBuilder) 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 *ClusterAutoscalerListBuilder) Copy(list *ClusterAutoscalerList) *ClusterAutoscalerListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterAutoscalerBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterAutoscaler().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_autoscaler' objects using the +// configuration stored in the builder. +func (b *ClusterAutoscalerListBuilder) Build() (list *ClusterAutoscalerList, err error) { + items := make([]*ClusterAutoscaler, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterAutoscalerList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_autoscaler_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_autoscaler_list_type_json.go new file mode 100644 index 00000000..86a59307 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_autoscaler_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterAutoscalerList writes a list of values of the 'cluster_autoscaler' type to +// the given writer. +func MarshalClusterAutoscalerList(list []*ClusterAutoscaler, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterAutoscalerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterAutoscalerList writes a list of value of the 'cluster_autoscaler' type to +// the given stream. +func WriteClusterAutoscalerList(list []*ClusterAutoscaler, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterAutoscaler(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterAutoscalerList reads a list of values of the 'cluster_autoscaler' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterAutoscalerList(source interface{}) (items []*ClusterAutoscaler, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterAutoscalerList(iterator) + err = iterator.Error + return +} + +// ReadClusterAutoscalerList reads list of values of the ”cluster_autoscaler' type from +// the given iterator. +func ReadClusterAutoscalerList(iterator *jsoniter.Iterator) []*ClusterAutoscaler { + list := []*ClusterAutoscaler{} + for iterator.ReadArray() { + item := ReadClusterAutoscaler(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_autoscaler_type.go b/clientapi/clustersmgmt/v1/cluster_autoscaler_type.go new file mode 100644 index 00000000..973e8912 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_autoscaler_type.go @@ -0,0 +1,499 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterAutoscalerKind is the name of the type used to represent objects +// of type 'cluster_autoscaler'. +const ClusterAutoscalerKind = "ClusterAutoscaler" + +// ClusterAutoscalerLinkKind is the name of the type used to represent links +// to objects of type 'cluster_autoscaler'. +const ClusterAutoscalerLinkKind = "ClusterAutoscalerLink" + +// ClusterAutoscalerNilKind is the name of the type used to nil references +// to objects of type 'cluster_autoscaler'. +const ClusterAutoscalerNilKind = "ClusterAutoscalerNil" + +// ClusterAutoscaler represents the values of the 'cluster_autoscaler' type. +// +// Cluster-wide autoscaling configuration. +type ClusterAutoscaler struct { + bitmap_ uint32 + id string + href string + balancingIgnoredLabels []string + logVerbosity int + maxNodeProvisionTime string + maxPodGracePeriod int + podPriorityThreshold int + resourceLimits *AutoscalerResourceLimits + scaleDown *AutoscalerScaleDownConfig + balanceSimilarNodeGroups bool + ignoreDaemonsetsUtilization bool + skipNodesWithLocalStorage bool +} + +// Kind returns the name of the type of the object. +func (o *ClusterAutoscaler) Kind() string { + if o == nil { + return ClusterAutoscalerNilKind + } + if o.bitmap_&1 != 0 { + return ClusterAutoscalerLinkKind + } + return ClusterAutoscalerKind +} + +// Link returns true if this is a link. +func (o *ClusterAutoscaler) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ClusterAutoscaler) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ClusterAutoscaler) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ClusterAutoscaler) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ClusterAutoscaler) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterAutoscaler) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// BalanceSimilarNodeGroups returns the value of the 'balance_similar_node_groups' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// BalanceSimilarNodeGroups enables/disables the +// `--balance-similar-node-groups` cluster-autoscaler feature. +// This feature will automatically identify node groups with +// the same instance type and the same set of labels and try +// to keep the respective sizes of those node groups balanced. +func (o *ClusterAutoscaler) BalanceSimilarNodeGroups() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.balanceSimilarNodeGroups + } + return false +} + +// GetBalanceSimilarNodeGroups returns the value of the 'balance_similar_node_groups' attribute and +// a flag indicating if the attribute has a value. +// +// BalanceSimilarNodeGroups enables/disables the +// `--balance-similar-node-groups` cluster-autoscaler feature. +// This feature will automatically identify node groups with +// the same instance type and the same set of labels and try +// to keep the respective sizes of those node groups balanced. +func (o *ClusterAutoscaler) GetBalanceSimilarNodeGroups() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.balanceSimilarNodeGroups + } + return +} + +// BalancingIgnoredLabels returns the value of the 'balancing_ignored_labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// This option specifies labels that cluster autoscaler should ignore when considering node group similarity. +// For example, if you have nodes with "topology.ebs.csi.aws.com/zone" label, you can add name of this label here +// to prevent cluster autoscaler from splitting nodes into different node groups based on its value. +func (o *ClusterAutoscaler) BalancingIgnoredLabels() []string { + if o != nil && o.bitmap_&16 != 0 { + return o.balancingIgnoredLabels + } + return nil +} + +// GetBalancingIgnoredLabels returns the value of the 'balancing_ignored_labels' attribute and +// a flag indicating if the attribute has a value. +// +// This option specifies labels that cluster autoscaler should ignore when considering node group similarity. +// For example, if you have nodes with "topology.ebs.csi.aws.com/zone" label, you can add name of this label here +// to prevent cluster autoscaler from splitting nodes into different node groups based on its value. +func (o *ClusterAutoscaler) GetBalancingIgnoredLabels() (value []string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.balancingIgnoredLabels + } + return +} + +// IgnoreDaemonsetsUtilization returns the value of the 'ignore_daemonsets_utilization' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Should CA ignore DaemonSet pods when calculating resource utilization for scaling down. false by default. +func (o *ClusterAutoscaler) IgnoreDaemonsetsUtilization() bool { + if o != nil && o.bitmap_&32 != 0 { + return o.ignoreDaemonsetsUtilization + } + return false +} + +// GetIgnoreDaemonsetsUtilization returns the value of the 'ignore_daemonsets_utilization' attribute and +// a flag indicating if the attribute has a value. +// +// Should CA ignore DaemonSet pods when calculating resource utilization for scaling down. false by default. +func (o *ClusterAutoscaler) GetIgnoreDaemonsetsUtilization() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.ignoreDaemonsetsUtilization + } + return +} + +// LogVerbosity returns the value of the 'log_verbosity' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Sets the autoscaler log level. +// Default value is 1, level 4 is recommended for DEBUGGING and level 6 will enable almost everything. +func (o *ClusterAutoscaler) LogVerbosity() int { + if o != nil && o.bitmap_&64 != 0 { + return o.logVerbosity + } + return 0 +} + +// GetLogVerbosity returns the value of the 'log_verbosity' attribute and +// a flag indicating if the attribute has a value. +// +// Sets the autoscaler log level. +// Default value is 1, level 4 is recommended for DEBUGGING and level 6 will enable almost everything. +func (o *ClusterAutoscaler) GetLogVerbosity() (value int, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.logVerbosity + } + return +} + +// MaxNodeProvisionTime returns the value of the 'max_node_provision_time' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Maximum time CA waits for node to be provisioned. +func (o *ClusterAutoscaler) MaxNodeProvisionTime() string { + if o != nil && o.bitmap_&128 != 0 { + return o.maxNodeProvisionTime + } + return "" +} + +// GetMaxNodeProvisionTime returns the value of the 'max_node_provision_time' attribute and +// a flag indicating if the attribute has a value. +// +// Maximum time CA waits for node to be provisioned. +func (o *ClusterAutoscaler) GetMaxNodeProvisionTime() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.maxNodeProvisionTime + } + return +} + +// MaxPodGracePeriod returns the value of the 'max_pod_grace_period' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Gives pods graceful termination time before scaling down. +func (o *ClusterAutoscaler) MaxPodGracePeriod() int { + if o != nil && o.bitmap_&256 != 0 { + return o.maxPodGracePeriod + } + return 0 +} + +// GetMaxPodGracePeriod returns the value of the 'max_pod_grace_period' attribute and +// a flag indicating if the attribute has a value. +// +// Gives pods graceful termination time before scaling down. +func (o *ClusterAutoscaler) GetMaxPodGracePeriod() (value int, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.maxPodGracePeriod + } + return +} + +// PodPriorityThreshold returns the value of the 'pod_priority_threshold' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// To allow users to schedule "best-effort" pods, which shouldn't trigger +// Cluster Autoscaler actions, but only run when there are spare resources available, +// More info: https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#how-does-cluster-autoscaler-work-with-pod-priority-and-preemption. +func (o *ClusterAutoscaler) PodPriorityThreshold() int { + if o != nil && o.bitmap_&512 != 0 { + return o.podPriorityThreshold + } + return 0 +} + +// GetPodPriorityThreshold returns the value of the 'pod_priority_threshold' attribute and +// a flag indicating if the attribute has a value. +// +// To allow users to schedule "best-effort" pods, which shouldn't trigger +// Cluster Autoscaler actions, but only run when there are spare resources available, +// More info: https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#how-does-cluster-autoscaler-work-with-pod-priority-and-preemption. +func (o *ClusterAutoscaler) GetPodPriorityThreshold() (value int, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.podPriorityThreshold + } + return +} + +// ResourceLimits returns the value of the 'resource_limits' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Constraints of autoscaling resources. +func (o *ClusterAutoscaler) ResourceLimits() *AutoscalerResourceLimits { + if o != nil && o.bitmap_&1024 != 0 { + return o.resourceLimits + } + return nil +} + +// GetResourceLimits returns the value of the 'resource_limits' attribute and +// a flag indicating if the attribute has a value. +// +// Constraints of autoscaling resources. +func (o *ClusterAutoscaler) GetResourceLimits() (value *AutoscalerResourceLimits, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.resourceLimits + } + return +} + +// ScaleDown returns the value of the 'scale_down' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Configuration of scale down operation. +func (o *ClusterAutoscaler) ScaleDown() *AutoscalerScaleDownConfig { + if o != nil && o.bitmap_&2048 != 0 { + return o.scaleDown + } + return nil +} + +// GetScaleDown returns the value of the 'scale_down' attribute and +// a flag indicating if the attribute has a value. +// +// Configuration of scale down operation. +func (o *ClusterAutoscaler) GetScaleDown() (value *AutoscalerScaleDownConfig, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.scaleDown + } + return +} + +// SkipNodesWithLocalStorage returns the value of the 'skip_nodes_with_local_storage' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Enables/Disables `--skip-nodes-with-local-storage` CA feature flag. If true cluster autoscaler will never delete nodes with pods with local storage, e.g. EmptyDir or HostPath. true by default at autoscaler. +func (o *ClusterAutoscaler) SkipNodesWithLocalStorage() bool { + if o != nil && o.bitmap_&4096 != 0 { + return o.skipNodesWithLocalStorage + } + return false +} + +// GetSkipNodesWithLocalStorage returns the value of the 'skip_nodes_with_local_storage' attribute and +// a flag indicating if the attribute has a value. +// +// Enables/Disables `--skip-nodes-with-local-storage` CA feature flag. If true cluster autoscaler will never delete nodes with pods with local storage, e.g. EmptyDir or HostPath. true by default at autoscaler. +func (o *ClusterAutoscaler) GetSkipNodesWithLocalStorage() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.skipNodesWithLocalStorage + } + return +} + +// ClusterAutoscalerListKind is the name of the type used to represent list of objects of +// type 'cluster_autoscaler'. +const ClusterAutoscalerListKind = "ClusterAutoscalerList" + +// ClusterAutoscalerListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_autoscaler'. +const ClusterAutoscalerListLinkKind = "ClusterAutoscalerListLink" + +// ClusterAutoscalerNilKind is the name of the type used to nil lists of objects of +// type 'cluster_autoscaler'. +const ClusterAutoscalerListNilKind = "ClusterAutoscalerListNil" + +// ClusterAutoscalerList is a list of values of the 'cluster_autoscaler' type. +type ClusterAutoscalerList struct { + href string + link bool + items []*ClusterAutoscaler +} + +// Kind returns the name of the type of the object. +func (l *ClusterAutoscalerList) Kind() string { + if l == nil { + return ClusterAutoscalerListNilKind + } + if l.link { + return ClusterAutoscalerListLinkKind + } + return ClusterAutoscalerListKind +} + +// Link returns true iif this is a link. +func (l *ClusterAutoscalerList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ClusterAutoscalerList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ClusterAutoscalerList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ClusterAutoscalerList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterAutoscalerList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterAutoscalerList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterAutoscalerList) SetItems(items []*ClusterAutoscaler) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterAutoscalerList) Items() []*ClusterAutoscaler { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterAutoscalerList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterAutoscalerList) Get(i int) *ClusterAutoscaler { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterAutoscalerList) Slice() []*ClusterAutoscaler { + var slice []*ClusterAutoscaler + if l == nil { + slice = make([]*ClusterAutoscaler, 0) + } else { + slice = make([]*ClusterAutoscaler, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterAutoscalerList) Each(f func(item *ClusterAutoscaler) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterAutoscalerList) Range(f func(index int, item *ClusterAutoscaler) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_autoscaler_type_json.go b/clientapi/clustersmgmt/v1/cluster_autoscaler_type_json.go new file mode 100644 index 00000000..890ab8b9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_autoscaler_type_json.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterAutoscaler writes a value of the 'cluster_autoscaler' type to the given writer. +func MarshalClusterAutoscaler(object *ClusterAutoscaler, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterAutoscaler(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterAutoscaler writes a value of the 'cluster_autoscaler' type to the given stream. +func WriteClusterAutoscaler(object *ClusterAutoscaler, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ClusterAutoscalerLinkKind) + } else { + stream.WriteString(ClusterAutoscalerKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("balance_similar_node_groups") + stream.WriteBool(object.balanceSimilarNodeGroups) + count++ + } + present_ = object.bitmap_&16 != 0 && object.balancingIgnoredLabels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("balancing_ignored_labels") + WriteStringList(object.balancingIgnoredLabels, stream) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ignore_daemonsets_utilization") + stream.WriteBool(object.ignoreDaemonsetsUtilization) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("log_verbosity") + stream.WriteInt(object.logVerbosity) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_node_provision_time") + stream.WriteString(object.maxNodeProvisionTime) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_pod_grace_period") + stream.WriteInt(object.maxPodGracePeriod) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("pod_priority_threshold") + stream.WriteInt(object.podPriorityThreshold) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.resourceLimits != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resource_limits") + WriteAutoscalerResourceLimits(object.resourceLimits, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.scaleDown != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("scale_down") + WriteAutoscalerScaleDownConfig(object.scaleDown, stream) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("skip_nodes_with_local_storage") + stream.WriteBool(object.skipNodesWithLocalStorage) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterAutoscaler reads a value of the 'cluster_autoscaler' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterAutoscaler(source interface{}) (object *ClusterAutoscaler, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterAutoscaler(iterator) + err = iterator.Error + return +} + +// ReadClusterAutoscaler reads a value of the 'cluster_autoscaler' type from the given iterator. +func ReadClusterAutoscaler(iterator *jsoniter.Iterator) *ClusterAutoscaler { + object := &ClusterAutoscaler{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ClusterAutoscalerLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "balance_similar_node_groups": + value := iterator.ReadBool() + object.balanceSimilarNodeGroups = value + object.bitmap_ |= 8 + case "balancing_ignored_labels": + value := ReadStringList(iterator) + object.balancingIgnoredLabels = value + object.bitmap_ |= 16 + case "ignore_daemonsets_utilization": + value := iterator.ReadBool() + object.ignoreDaemonsetsUtilization = value + object.bitmap_ |= 32 + case "log_verbosity": + value := iterator.ReadInt() + object.logVerbosity = value + object.bitmap_ |= 64 + case "max_node_provision_time": + value := iterator.ReadString() + object.maxNodeProvisionTime = value + object.bitmap_ |= 128 + case "max_pod_grace_period": + value := iterator.ReadInt() + object.maxPodGracePeriod = value + object.bitmap_ |= 256 + case "pod_priority_threshold": + value := iterator.ReadInt() + object.podPriorityThreshold = value + object.bitmap_ |= 512 + case "resource_limits": + value := ReadAutoscalerResourceLimits(iterator) + object.resourceLimits = value + object.bitmap_ |= 1024 + case "scale_down": + value := ReadAutoscalerScaleDownConfig(iterator) + object.scaleDown = value + object.bitmap_ |= 2048 + case "skip_nodes_with_local_storage": + value := iterator.ReadBool() + object.skipNodesWithLocalStorage = value + object.bitmap_ |= 4096 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_builder.go b/clientapi/clustersmgmt/v1/cluster_builder.go new file mode 100644 index 00000000..c45b23c7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_builder.go @@ -0,0 +1,1358 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ClusterBuilder contains the data and logic needed to build 'cluster' objects. +// +// Definition of an _OpenShift_ cluster. +// +// The `cloud_provider` attribute is a reference to the cloud provider. When a +// cluster is retrieved it will be a link to the cloud provider, containing only +// the kind, id and href attributes: +// +// ```json +// +// { +// "cloud_provider": { +// "kind": "CloudProviderLink", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/cloud_providers/123" +// } +// } +// +// ``` +// +// When a cluster is created this is optional, and if used it should contain the +// identifier of the cloud provider to use: +// +// ```json +// +// { +// "cloud_provider": { +// "id": "123", +// } +// } +// +// ``` +// +// If not included, then the cluster will be created using the default cloud +// provider, which is currently Amazon Web Services. +// +// The region attribute is mandatory when a cluster is created. +// +// The `aws.access_key_id`, `aws.secret_access_key` and `dns.base_domain` +// attributes are mandatory when creation a cluster with your own Amazon Web +// Services account. +type ClusterBuilder struct { + bitmap_ uint64 + id string + href string + api *ClusterAPIBuilder + aws *AWSBuilder + awsInfrastructureAccessRoleGrants *AWSInfrastructureAccessRoleGrantListBuilder + ccs *CCSBuilder + dns *DNSBuilder + gcp *GCPBuilder + gcpEncryptionKey *GCPEncryptionKeyBuilder + gcpNetwork *GCPNetworkBuilder + additionalTrustBundle string + addons *AddOnInstallationListBuilder + autoscaler *ClusterAutoscalerBuilder + azure *AzureBuilder + billingModel BillingModel + byoOidc *ByoOidcBuilder + capabilities *ClusterCapabilitiesBuilder + cloudProvider *CloudProviderBuilder + console *ClusterConsoleBuilder + creationTimestamp time.Time + deleteProtection *DeleteProtectionBuilder + domainPrefix string + expirationTimestamp time.Time + externalID string + externalAuthConfig *ExternalAuthConfigBuilder + externalConfiguration *ExternalConfigurationBuilder + flavour *FlavourBuilder + groups *GroupListBuilder + healthState ClusterHealthState + htpasswd *HTPasswdIdentityProviderBuilder + hypershift *HypershiftBuilder + identityProviders *IdentityProviderListBuilder + inflightChecks *InflightCheckListBuilder + infraID string + ingresses *IngressListBuilder + kubeletConfig *KubeletConfigBuilder + loadBalancerQuota int + machinePools *MachinePoolListBuilder + managedService *ManagedServiceBuilder + name string + network *NetworkBuilder + nodeDrainGracePeriod *ValueBuilder + nodePools *NodePoolListBuilder + nodes *ClusterNodesBuilder + openshiftVersion string + product *ProductBuilder + properties map[string]string + provisionShard *ProvisionShardBuilder + proxy *ProxyBuilder + region *CloudRegionBuilder + registryConfig *ClusterRegistryConfigBuilder + state ClusterState + status *ClusterStatusBuilder + storageQuota *ValueBuilder + subscription *SubscriptionBuilder + version *VersionBuilder + fips bool + disableUserWorkloadMonitoring bool + etcdEncryption bool + managed bool + multiAZ bool + multiArchEnabled bool +} + +// NewCluster creates a new builder of 'cluster' objects. +func NewCluster() *ClusterBuilder { + return &ClusterBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ClusterBuilder) Link(value bool) *ClusterBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ClusterBuilder) ID(value string) *ClusterBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ClusterBuilder) HREF(value string) *ClusterBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// API sets the value of the 'API' attribute to the given value. +// +// Information about the API of a cluster. +func (b *ClusterBuilder) API(value *ClusterAPIBuilder) *ClusterBuilder { + b.api = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// AWS sets the value of the 'AWS' attribute to the given value. +// +// _Amazon Web Services_ specific settings of a cluster. +func (b *ClusterBuilder) AWS(value *AWSBuilder) *ClusterBuilder { + b.aws = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// AWSInfrastructureAccessRoleGrants sets the value of the 'AWS_infrastructure_access_role_grants' attribute to the given values. +func (b *ClusterBuilder) AWSInfrastructureAccessRoleGrants(value *AWSInfrastructureAccessRoleGrantListBuilder) *ClusterBuilder { + b.awsInfrastructureAccessRoleGrants = value + b.bitmap_ |= 32 + return b +} + +// CCS sets the value of the 'CCS' attribute to the given value. +func (b *ClusterBuilder) CCS(value *CCSBuilder) *ClusterBuilder { + b.ccs = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// DNS sets the value of the 'DNS' attribute to the given value. +// +// DNS settings of the cluster. +func (b *ClusterBuilder) DNS(value *DNSBuilder) *ClusterBuilder { + b.dns = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// FIPS sets the value of the 'FIPS' attribute to the given value. +func (b *ClusterBuilder) FIPS(value bool) *ClusterBuilder { + b.fips = value + b.bitmap_ |= 256 + return b +} + +// GCP sets the value of the 'GCP' attribute to the given value. +// +// Google cloud platform settings of a cluster. +func (b *ClusterBuilder) GCP(value *GCPBuilder) *ClusterBuilder { + b.gcp = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// GCPEncryptionKey sets the value of the 'GCP_encryption_key' attribute to the given value. +// +// GCP Encryption Key for CCS clusters. +func (b *ClusterBuilder) GCPEncryptionKey(value *GCPEncryptionKeyBuilder) *ClusterBuilder { + b.gcpEncryptionKey = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// GCPNetwork sets the value of the 'GCP_network' attribute to the given value. +// +// GCP Network configuration of a cluster. +func (b *ClusterBuilder) GCPNetwork(value *GCPNetworkBuilder) *ClusterBuilder { + b.gcpNetwork = value + if value != nil { + b.bitmap_ |= 2048 + } else { + b.bitmap_ &^= 2048 + } + return b +} + +// AdditionalTrustBundle sets the value of the 'additional_trust_bundle' attribute to the given value. +func (b *ClusterBuilder) AdditionalTrustBundle(value string) *ClusterBuilder { + b.additionalTrustBundle = value + b.bitmap_ |= 4096 + return b +} + +// Addons sets the value of the 'addons' attribute to the given values. +func (b *ClusterBuilder) Addons(value *AddOnInstallationListBuilder) *ClusterBuilder { + b.addons = value + b.bitmap_ |= 8192 + return b +} + +// Autoscaler sets the value of the 'autoscaler' attribute to the given value. +// +// Cluster-wide autoscaling configuration. +func (b *ClusterBuilder) Autoscaler(value *ClusterAutoscalerBuilder) *ClusterBuilder { + b.autoscaler = value + if value != nil { + b.bitmap_ |= 16384 + } else { + b.bitmap_ &^= 16384 + } + return b +} + +// Azure sets the value of the 'azure' attribute to the given value. +// +// Microsoft Azure settings of a cluster. +func (b *ClusterBuilder) Azure(value *AzureBuilder) *ClusterBuilder { + b.azure = value + if value != nil { + b.bitmap_ |= 32768 + } else { + b.bitmap_ &^= 32768 + } + return b +} + +// BillingModel sets the value of the 'billing_model' attribute to the given value. +// +// Billing model for cluster resources. +func (b *ClusterBuilder) BillingModel(value BillingModel) *ClusterBuilder { + b.billingModel = value + b.bitmap_ |= 65536 + return b +} + +// ByoOidc sets the value of the 'byo_oidc' attribute to the given value. +// +// ByoOidc configuration. +func (b *ClusterBuilder) ByoOidc(value *ByoOidcBuilder) *ClusterBuilder { + b.byoOidc = value + if value != nil { + b.bitmap_ |= 131072 + } else { + b.bitmap_ &^= 131072 + } + return b +} + +// Capabilities sets the value of the 'capabilities' attribute to the given value. +func (b *ClusterBuilder) Capabilities(value *ClusterCapabilitiesBuilder) *ClusterBuilder { + b.capabilities = value + if value != nil { + b.bitmap_ |= 262144 + } else { + b.bitmap_ &^= 262144 + } + return b +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +// +// Cloud provider. +func (b *ClusterBuilder) CloudProvider(value *CloudProviderBuilder) *ClusterBuilder { + b.cloudProvider = value + if value != nil { + b.bitmap_ |= 524288 + } else { + b.bitmap_ &^= 524288 + } + return b +} + +// Console sets the value of the 'console' attribute to the given value. +// +// Information about the console of a cluster. +func (b *ClusterBuilder) Console(value *ClusterConsoleBuilder) *ClusterBuilder { + b.console = value + if value != nil { + b.bitmap_ |= 1048576 + } else { + b.bitmap_ &^= 1048576 + } + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *ClusterBuilder) CreationTimestamp(value time.Time) *ClusterBuilder { + b.creationTimestamp = value + b.bitmap_ |= 2097152 + return b +} + +// DeleteProtection sets the value of the 'delete_protection' attribute to the given value. +// +// DeleteProtection configuration. +func (b *ClusterBuilder) DeleteProtection(value *DeleteProtectionBuilder) *ClusterBuilder { + b.deleteProtection = value + if value != nil { + b.bitmap_ |= 4194304 + } else { + b.bitmap_ &^= 4194304 + } + return b +} + +// DisableUserWorkloadMonitoring sets the value of the 'disable_user_workload_monitoring' attribute to the given value. +func (b *ClusterBuilder) DisableUserWorkloadMonitoring(value bool) *ClusterBuilder { + b.disableUserWorkloadMonitoring = value + b.bitmap_ |= 8388608 + return b +} + +// DomainPrefix sets the value of the 'domain_prefix' attribute to the given value. +func (b *ClusterBuilder) DomainPrefix(value string) *ClusterBuilder { + b.domainPrefix = value + b.bitmap_ |= 16777216 + return b +} + +// EtcdEncryption sets the value of the 'etcd_encryption' attribute to the given value. +func (b *ClusterBuilder) EtcdEncryption(value bool) *ClusterBuilder { + b.etcdEncryption = value + b.bitmap_ |= 33554432 + return b +} + +// ExpirationTimestamp sets the value of the 'expiration_timestamp' attribute to the given value. +func (b *ClusterBuilder) ExpirationTimestamp(value time.Time) *ClusterBuilder { + b.expirationTimestamp = value + b.bitmap_ |= 67108864 + return b +} + +// ExternalID sets the value of the 'external_ID' attribute to the given value. +func (b *ClusterBuilder) ExternalID(value string) *ClusterBuilder { + b.externalID = value + b.bitmap_ |= 134217728 + return b +} + +// ExternalAuthConfig sets the value of the 'external_auth_config' attribute to the given value. +// +// ExternalAuthConfig configuration +func (b *ClusterBuilder) ExternalAuthConfig(value *ExternalAuthConfigBuilder) *ClusterBuilder { + b.externalAuthConfig = value + if value != nil { + b.bitmap_ |= 268435456 + } else { + b.bitmap_ &^= 268435456 + } + return b +} + +// ExternalConfiguration sets the value of the 'external_configuration' attribute to the given value. +// +// Representation of cluster external configuration. +func (b *ClusterBuilder) ExternalConfiguration(value *ExternalConfigurationBuilder) *ClusterBuilder { + b.externalConfiguration = value + if value != nil { + b.bitmap_ |= 536870912 + } else { + b.bitmap_ &^= 536870912 + } + return b +} + +// Flavour sets the value of the 'flavour' attribute to the given value. +// +// Set of predefined properties of a cluster. For example, a _huge_ flavour can be a cluster +// with 10 infra nodes and 1000 compute nodes. +func (b *ClusterBuilder) Flavour(value *FlavourBuilder) *ClusterBuilder { + b.flavour = value + if value != nil { + b.bitmap_ |= 1073741824 + } else { + b.bitmap_ &^= 1073741824 + } + return b +} + +// Groups sets the value of the 'groups' attribute to the given values. +func (b *ClusterBuilder) Groups(value *GroupListBuilder) *ClusterBuilder { + b.groups = value + b.bitmap_ |= 2147483648 + return b +} + +// HealthState sets the value of the 'health_state' attribute to the given value. +// +// ClusterHealthState indicates the health of a cluster. +func (b *ClusterBuilder) HealthState(value ClusterHealthState) *ClusterBuilder { + b.healthState = value + b.bitmap_ |= 4294967296 + return b +} + +// Htpasswd sets the value of the 'htpasswd' attribute to the given value. +// +// Details for `htpasswd` identity providers. +func (b *ClusterBuilder) Htpasswd(value *HTPasswdIdentityProviderBuilder) *ClusterBuilder { + b.htpasswd = value + if value != nil { + b.bitmap_ |= 8589934592 + } else { + b.bitmap_ &^= 8589934592 + } + return b +} + +// Hypershift sets the value of the 'hypershift' attribute to the given value. +// +// Hypershift configuration. +func (b *ClusterBuilder) Hypershift(value *HypershiftBuilder) *ClusterBuilder { + b.hypershift = value + if value != nil { + b.bitmap_ |= 17179869184 + } else { + b.bitmap_ &^= 17179869184 + } + return b +} + +// IdentityProviders sets the value of the 'identity_providers' attribute to the given values. +func (b *ClusterBuilder) IdentityProviders(value *IdentityProviderListBuilder) *ClusterBuilder { + b.identityProviders = value + b.bitmap_ |= 34359738368 + return b +} + +// InflightChecks sets the value of the 'inflight_checks' attribute to the given values. +func (b *ClusterBuilder) InflightChecks(value *InflightCheckListBuilder) *ClusterBuilder { + b.inflightChecks = value + b.bitmap_ |= 68719476736 + return b +} + +// InfraID sets the value of the 'infra_ID' attribute to the given value. +func (b *ClusterBuilder) InfraID(value string) *ClusterBuilder { + b.infraID = value + b.bitmap_ |= 137438953472 + return b +} + +// Ingresses sets the value of the 'ingresses' attribute to the given values. +func (b *ClusterBuilder) Ingresses(value *IngressListBuilder) *ClusterBuilder { + b.ingresses = value + b.bitmap_ |= 274877906944 + return b +} + +// KubeletConfig sets the value of the 'kubelet_config' attribute to the given value. +// +// OCM representation of KubeletConfig, exposing the fields of Kubernetes +// KubeletConfig that can be managed by users +func (b *ClusterBuilder) KubeletConfig(value *KubeletConfigBuilder) *ClusterBuilder { + b.kubeletConfig = value + if value != nil { + b.bitmap_ |= 549755813888 + } else { + b.bitmap_ &^= 549755813888 + } + return b +} + +// LoadBalancerQuota sets the value of the 'load_balancer_quota' attribute to the given value. +func (b *ClusterBuilder) LoadBalancerQuota(value int) *ClusterBuilder { + b.loadBalancerQuota = value + b.bitmap_ |= 1099511627776 + return b +} + +// MachinePools sets the value of the 'machine_pools' attribute to the given values. +func (b *ClusterBuilder) MachinePools(value *MachinePoolListBuilder) *ClusterBuilder { + b.machinePools = value + b.bitmap_ |= 2199023255552 + return b +} + +// Managed sets the value of the 'managed' attribute to the given value. +func (b *ClusterBuilder) Managed(value bool) *ClusterBuilder { + b.managed = value + b.bitmap_ |= 4398046511104 + return b +} + +// ManagedService sets the value of the 'managed_service' attribute to the given value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (b *ClusterBuilder) ManagedService(value *ManagedServiceBuilder) *ClusterBuilder { + b.managedService = value + if value != nil { + b.bitmap_ |= 8796093022208 + } else { + b.bitmap_ &^= 8796093022208 + } + return b +} + +// MultiAZ sets the value of the 'multi_AZ' attribute to the given value. +func (b *ClusterBuilder) MultiAZ(value bool) *ClusterBuilder { + b.multiAZ = value + b.bitmap_ |= 17592186044416 + return b +} + +// MultiArchEnabled sets the value of the 'multi_arch_enabled' attribute to the given value. +func (b *ClusterBuilder) MultiArchEnabled(value bool) *ClusterBuilder { + b.multiArchEnabled = value + b.bitmap_ |= 35184372088832 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ClusterBuilder) Name(value string) *ClusterBuilder { + b.name = value + b.bitmap_ |= 70368744177664 + return b +} + +// Network sets the value of the 'network' attribute to the given value. +// +// Network configuration of a cluster. +func (b *ClusterBuilder) Network(value *NetworkBuilder) *ClusterBuilder { + b.network = value + if value != nil { + b.bitmap_ |= 140737488355328 + } else { + b.bitmap_ &^= 140737488355328 + } + return b +} + +// NodeDrainGracePeriod sets the value of the 'node_drain_grace_period' attribute to the given value. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +func (b *ClusterBuilder) NodeDrainGracePeriod(value *ValueBuilder) *ClusterBuilder { + b.nodeDrainGracePeriod = value + if value != nil { + b.bitmap_ |= 281474976710656 + } else { + b.bitmap_ &^= 281474976710656 + } + return b +} + +// NodePools sets the value of the 'node_pools' attribute to the given values. +func (b *ClusterBuilder) NodePools(value *NodePoolListBuilder) *ClusterBuilder { + b.nodePools = value + b.bitmap_ |= 562949953421312 + return b +} + +// Nodes sets the value of the 'nodes' attribute to the given value. +// +// Counts of different classes of nodes inside a cluster. +func (b *ClusterBuilder) Nodes(value *ClusterNodesBuilder) *ClusterBuilder { + b.nodes = value + if value != nil { + b.bitmap_ |= 1125899906842624 + } else { + b.bitmap_ &^= 1125899906842624 + } + return b +} + +// OpenshiftVersion sets the value of the 'openshift_version' attribute to the given value. +func (b *ClusterBuilder) OpenshiftVersion(value string) *ClusterBuilder { + b.openshiftVersion = value + b.bitmap_ |= 2251799813685248 + return b +} + +// Product sets the value of the 'product' attribute to the given value. +// +// Representation of an product that can be selected as a cluster type. +func (b *ClusterBuilder) Product(value *ProductBuilder) *ClusterBuilder { + b.product = value + if value != nil { + b.bitmap_ |= 4503599627370496 + } else { + b.bitmap_ &^= 4503599627370496 + } + return b +} + +// Properties sets the value of the 'properties' attribute to the given value. +func (b *ClusterBuilder) Properties(value map[string]string) *ClusterBuilder { + b.properties = value + if value != nil { + b.bitmap_ |= 9007199254740992 + } else { + b.bitmap_ &^= 9007199254740992 + } + return b +} + +// ProvisionShard sets the value of the 'provision_shard' attribute to the given value. +// +// Contains the properties of the provision shard, including AWS and GCP related configurations +func (b *ClusterBuilder) ProvisionShard(value *ProvisionShardBuilder) *ClusterBuilder { + b.provisionShard = value + if value != nil { + b.bitmap_ |= 18014398509481984 + } else { + b.bitmap_ &^= 18014398509481984 + } + return b +} + +// Proxy sets the value of the 'proxy' attribute to the given value. +// +// Proxy configuration of a cluster. +func (b *ClusterBuilder) Proxy(value *ProxyBuilder) *ClusterBuilder { + b.proxy = value + if value != nil { + b.bitmap_ |= 36028797018963968 + } else { + b.bitmap_ &^= 36028797018963968 + } + return b +} + +// Region sets the value of the 'region' attribute to the given value. +// +// Description of a region of a cloud provider. +func (b *ClusterBuilder) Region(value *CloudRegionBuilder) *ClusterBuilder { + b.region = value + if value != nil { + b.bitmap_ |= 72057594037927936 + } else { + b.bitmap_ &^= 72057594037927936 + } + return b +} + +// RegistryConfig sets the value of the 'registry_config' attribute to the given value. +// +// ClusterRegistryConfig describes the configuration of registries for the cluster. +// Its format reflects the OpenShift Image Configuration, for which docs are available on +// [docs.openshift.com](https://docs.openshift.com/container-platform/4.16/openshift_images/image-configuration.html) +// ```json +// +// { +// "registry_config": { +// "registry_sources": { +// "blocked_registries": [ +// "badregistry.io", +// "badregistry8.io" +// ] +// } +// } +// } +// +// ``` +func (b *ClusterBuilder) RegistryConfig(value *ClusterRegistryConfigBuilder) *ClusterBuilder { + b.registryConfig = value + if value != nil { + b.bitmap_ |= 144115188075855872 + } else { + b.bitmap_ &^= 144115188075855872 + } + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// Overall state of a cluster. +func (b *ClusterBuilder) State(value ClusterState) *ClusterBuilder { + b.state = value + b.bitmap_ |= 288230376151711744 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +// +// Detailed status of a cluster. +func (b *ClusterBuilder) Status(value *ClusterStatusBuilder) *ClusterBuilder { + b.status = value + if value != nil { + b.bitmap_ |= 576460752303423488 + } else { + b.bitmap_ &^= 576460752303423488 + } + return b +} + +// StorageQuota sets the value of the 'storage_quota' attribute to the given value. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +func (b *ClusterBuilder) StorageQuota(value *ValueBuilder) *ClusterBuilder { + b.storageQuota = value + if value != nil { + b.bitmap_ |= 1152921504606846976 + } else { + b.bitmap_ &^= 1152921504606846976 + } + return b +} + +// Subscription sets the value of the 'subscription' attribute to the given value. +// +// Definition of a subscription. +func (b *ClusterBuilder) Subscription(value *SubscriptionBuilder) *ClusterBuilder { + b.subscription = value + if value != nil { + b.bitmap_ |= 2305843009213693952 + } else { + b.bitmap_ &^= 2305843009213693952 + } + return b +} + +// Version sets the value of the 'version' attribute to the given value. +// +// Representation of an _OpenShift_ version. +func (b *ClusterBuilder) Version(value *VersionBuilder) *ClusterBuilder { + b.version = value + if value != nil { + b.bitmap_ |= 4611686018427387904 + } else { + b.bitmap_ &^= 4611686018427387904 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterBuilder) Copy(object *Cluster) *ClusterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.api != nil { + b.api = NewClusterAPI().Copy(object.api) + } else { + b.api = nil + } + if object.aws != nil { + b.aws = NewAWS().Copy(object.aws) + } else { + b.aws = nil + } + if object.awsInfrastructureAccessRoleGrants != nil { + b.awsInfrastructureAccessRoleGrants = NewAWSInfrastructureAccessRoleGrantList().Copy(object.awsInfrastructureAccessRoleGrants) + } else { + b.awsInfrastructureAccessRoleGrants = nil + } + if object.ccs != nil { + b.ccs = NewCCS().Copy(object.ccs) + } else { + b.ccs = nil + } + if object.dns != nil { + b.dns = NewDNS().Copy(object.dns) + } else { + b.dns = nil + } + b.fips = object.fips + if object.gcp != nil { + b.gcp = NewGCP().Copy(object.gcp) + } else { + b.gcp = nil + } + if object.gcpEncryptionKey != nil { + b.gcpEncryptionKey = NewGCPEncryptionKey().Copy(object.gcpEncryptionKey) + } else { + b.gcpEncryptionKey = nil + } + if object.gcpNetwork != nil { + b.gcpNetwork = NewGCPNetwork().Copy(object.gcpNetwork) + } else { + b.gcpNetwork = nil + } + b.additionalTrustBundle = object.additionalTrustBundle + if object.addons != nil { + b.addons = NewAddOnInstallationList().Copy(object.addons) + } else { + b.addons = nil + } + if object.autoscaler != nil { + b.autoscaler = NewClusterAutoscaler().Copy(object.autoscaler) + } else { + b.autoscaler = nil + } + if object.azure != nil { + b.azure = NewAzure().Copy(object.azure) + } else { + b.azure = nil + } + b.billingModel = object.billingModel + if object.byoOidc != nil { + b.byoOidc = NewByoOidc().Copy(object.byoOidc) + } else { + b.byoOidc = nil + } + if object.capabilities != nil { + b.capabilities = NewClusterCapabilities().Copy(object.capabilities) + } else { + b.capabilities = nil + } + if object.cloudProvider != nil { + b.cloudProvider = NewCloudProvider().Copy(object.cloudProvider) + } else { + b.cloudProvider = nil + } + if object.console != nil { + b.console = NewClusterConsole().Copy(object.console) + } else { + b.console = nil + } + b.creationTimestamp = object.creationTimestamp + if object.deleteProtection != nil { + b.deleteProtection = NewDeleteProtection().Copy(object.deleteProtection) + } else { + b.deleteProtection = nil + } + b.disableUserWorkloadMonitoring = object.disableUserWorkloadMonitoring + b.domainPrefix = object.domainPrefix + b.etcdEncryption = object.etcdEncryption + b.expirationTimestamp = object.expirationTimestamp + b.externalID = object.externalID + if object.externalAuthConfig != nil { + b.externalAuthConfig = NewExternalAuthConfig().Copy(object.externalAuthConfig) + } else { + b.externalAuthConfig = nil + } + if object.externalConfiguration != nil { + b.externalConfiguration = NewExternalConfiguration().Copy(object.externalConfiguration) + } else { + b.externalConfiguration = nil + } + if object.flavour != nil { + b.flavour = NewFlavour().Copy(object.flavour) + } else { + b.flavour = nil + } + if object.groups != nil { + b.groups = NewGroupList().Copy(object.groups) + } else { + b.groups = nil + } + b.healthState = object.healthState + if object.htpasswd != nil { + b.htpasswd = NewHTPasswdIdentityProvider().Copy(object.htpasswd) + } else { + b.htpasswd = nil + } + if object.hypershift != nil { + b.hypershift = NewHypershift().Copy(object.hypershift) + } else { + b.hypershift = nil + } + if object.identityProviders != nil { + b.identityProviders = NewIdentityProviderList().Copy(object.identityProviders) + } else { + b.identityProviders = nil + } + if object.inflightChecks != nil { + b.inflightChecks = NewInflightCheckList().Copy(object.inflightChecks) + } else { + b.inflightChecks = nil + } + b.infraID = object.infraID + if object.ingresses != nil { + b.ingresses = NewIngressList().Copy(object.ingresses) + } else { + b.ingresses = nil + } + if object.kubeletConfig != nil { + b.kubeletConfig = NewKubeletConfig().Copy(object.kubeletConfig) + } else { + b.kubeletConfig = nil + } + b.loadBalancerQuota = object.loadBalancerQuota + if object.machinePools != nil { + b.machinePools = NewMachinePoolList().Copy(object.machinePools) + } else { + b.machinePools = nil + } + b.managed = object.managed + if object.managedService != nil { + b.managedService = NewManagedService().Copy(object.managedService) + } else { + b.managedService = nil + } + b.multiAZ = object.multiAZ + b.multiArchEnabled = object.multiArchEnabled + b.name = object.name + if object.network != nil { + b.network = NewNetwork().Copy(object.network) + } else { + b.network = nil + } + if object.nodeDrainGracePeriod != nil { + b.nodeDrainGracePeriod = NewValue().Copy(object.nodeDrainGracePeriod) + } else { + b.nodeDrainGracePeriod = nil + } + if object.nodePools != nil { + b.nodePools = NewNodePoolList().Copy(object.nodePools) + } else { + b.nodePools = nil + } + if object.nodes != nil { + b.nodes = NewClusterNodes().Copy(object.nodes) + } else { + b.nodes = nil + } + b.openshiftVersion = object.openshiftVersion + if object.product != nil { + b.product = NewProduct().Copy(object.product) + } else { + b.product = nil + } + if len(object.properties) > 0 { + b.properties = map[string]string{} + for k, v := range object.properties { + b.properties[k] = v + } + } else { + b.properties = nil + } + if object.provisionShard != nil { + b.provisionShard = NewProvisionShard().Copy(object.provisionShard) + } else { + b.provisionShard = nil + } + if object.proxy != nil { + b.proxy = NewProxy().Copy(object.proxy) + } else { + b.proxy = nil + } + if object.region != nil { + b.region = NewCloudRegion().Copy(object.region) + } else { + b.region = nil + } + if object.registryConfig != nil { + b.registryConfig = NewClusterRegistryConfig().Copy(object.registryConfig) + } else { + b.registryConfig = nil + } + b.state = object.state + if object.status != nil { + b.status = NewClusterStatus().Copy(object.status) + } else { + b.status = nil + } + if object.storageQuota != nil { + b.storageQuota = NewValue().Copy(object.storageQuota) + } else { + b.storageQuota = nil + } + if object.subscription != nil { + b.subscription = NewSubscription().Copy(object.subscription) + } else { + b.subscription = nil + } + if object.version != nil { + b.version = NewVersion().Copy(object.version) + } else { + b.version = nil + } + return b +} + +// Build creates a 'cluster' object using the configuration stored in the builder. +func (b *ClusterBuilder) Build() (object *Cluster, err error) { + object = new(Cluster) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.api != nil { + object.api, err = b.api.Build() + if err != nil { + return + } + } + if b.aws != nil { + object.aws, err = b.aws.Build() + if err != nil { + return + } + } + if b.awsInfrastructureAccessRoleGrants != nil { + object.awsInfrastructureAccessRoleGrants, err = b.awsInfrastructureAccessRoleGrants.Build() + if err != nil { + return + } + } + if b.ccs != nil { + object.ccs, err = b.ccs.Build() + if err != nil { + return + } + } + if b.dns != nil { + object.dns, err = b.dns.Build() + if err != nil { + return + } + } + object.fips = b.fips + if b.gcp != nil { + object.gcp, err = b.gcp.Build() + if err != nil { + return + } + } + if b.gcpEncryptionKey != nil { + object.gcpEncryptionKey, err = b.gcpEncryptionKey.Build() + if err != nil { + return + } + } + if b.gcpNetwork != nil { + object.gcpNetwork, err = b.gcpNetwork.Build() + if err != nil { + return + } + } + object.additionalTrustBundle = b.additionalTrustBundle + if b.addons != nil { + object.addons, err = b.addons.Build() + if err != nil { + return + } + } + if b.autoscaler != nil { + object.autoscaler, err = b.autoscaler.Build() + if err != nil { + return + } + } + if b.azure != nil { + object.azure, err = b.azure.Build() + if err != nil { + return + } + } + object.billingModel = b.billingModel + if b.byoOidc != nil { + object.byoOidc, err = b.byoOidc.Build() + if err != nil { + return + } + } + if b.capabilities != nil { + object.capabilities, err = b.capabilities.Build() + if err != nil { + return + } + } + if b.cloudProvider != nil { + object.cloudProvider, err = b.cloudProvider.Build() + if err != nil { + return + } + } + if b.console != nil { + object.console, err = b.console.Build() + if err != nil { + return + } + } + object.creationTimestamp = b.creationTimestamp + if b.deleteProtection != nil { + object.deleteProtection, err = b.deleteProtection.Build() + if err != nil { + return + } + } + object.disableUserWorkloadMonitoring = b.disableUserWorkloadMonitoring + object.domainPrefix = b.domainPrefix + object.etcdEncryption = b.etcdEncryption + object.expirationTimestamp = b.expirationTimestamp + object.externalID = b.externalID + if b.externalAuthConfig != nil { + object.externalAuthConfig, err = b.externalAuthConfig.Build() + if err != nil { + return + } + } + if b.externalConfiguration != nil { + object.externalConfiguration, err = b.externalConfiguration.Build() + if err != nil { + return + } + } + if b.flavour != nil { + object.flavour, err = b.flavour.Build() + if err != nil { + return + } + } + if b.groups != nil { + object.groups, err = b.groups.Build() + if err != nil { + return + } + } + object.healthState = b.healthState + if b.htpasswd != nil { + object.htpasswd, err = b.htpasswd.Build() + if err != nil { + return + } + } + if b.hypershift != nil { + object.hypershift, err = b.hypershift.Build() + if err != nil { + return + } + } + if b.identityProviders != nil { + object.identityProviders, err = b.identityProviders.Build() + if err != nil { + return + } + } + if b.inflightChecks != nil { + object.inflightChecks, err = b.inflightChecks.Build() + if err != nil { + return + } + } + object.infraID = b.infraID + if b.ingresses != nil { + object.ingresses, err = b.ingresses.Build() + if err != nil { + return + } + } + if b.kubeletConfig != nil { + object.kubeletConfig, err = b.kubeletConfig.Build() + if err != nil { + return + } + } + object.loadBalancerQuota = b.loadBalancerQuota + if b.machinePools != nil { + object.machinePools, err = b.machinePools.Build() + if err != nil { + return + } + } + object.managed = b.managed + if b.managedService != nil { + object.managedService, err = b.managedService.Build() + if err != nil { + return + } + } + object.multiAZ = b.multiAZ + object.multiArchEnabled = b.multiArchEnabled + object.name = b.name + if b.network != nil { + object.network, err = b.network.Build() + if err != nil { + return + } + } + if b.nodeDrainGracePeriod != nil { + object.nodeDrainGracePeriod, err = b.nodeDrainGracePeriod.Build() + if err != nil { + return + } + } + if b.nodePools != nil { + object.nodePools, err = b.nodePools.Build() + if err != nil { + return + } + } + if b.nodes != nil { + object.nodes, err = b.nodes.Build() + if err != nil { + return + } + } + object.openshiftVersion = b.openshiftVersion + if b.product != nil { + object.product, err = b.product.Build() + if err != nil { + return + } + } + if b.properties != nil { + object.properties = make(map[string]string) + for k, v := range b.properties { + object.properties[k] = v + } + } + if b.provisionShard != nil { + object.provisionShard, err = b.provisionShard.Build() + if err != nil { + return + } + } + if b.proxy != nil { + object.proxy, err = b.proxy.Build() + if err != nil { + return + } + } + if b.region != nil { + object.region, err = b.region.Build() + if err != nil { + return + } + } + if b.registryConfig != nil { + object.registryConfig, err = b.registryConfig.Build() + if err != nil { + return + } + } + object.state = b.state + if b.status != nil { + object.status, err = b.status.Build() + if err != nil { + return + } + } + if b.storageQuota != nil { + object.storageQuota, err = b.storageQuota.Build() + if err != nil { + return + } + } + if b.subscription != nil { + object.subscription, err = b.subscription.Build() + if err != nil { + return + } + } + if b.version != nil { + object.version, err = b.version.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_capabilities_builder.go b/clientapi/clustersmgmt/v1/cluster_capabilities_builder.go new file mode 100644 index 00000000..00dcbc44 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_capabilities_builder.go @@ -0,0 +1,70 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterCapabilitiesBuilder contains the data and logic needed to build 'cluster_capabilities' objects. +type ClusterCapabilitiesBuilder struct { + bitmap_ uint32 + disabled []string +} + +// NewClusterCapabilities creates a new builder of 'cluster_capabilities' objects. +func NewClusterCapabilities() *ClusterCapabilitiesBuilder { + return &ClusterCapabilitiesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterCapabilitiesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Disabled sets the value of the 'disabled' attribute to the given values. +func (b *ClusterCapabilitiesBuilder) Disabled(values ...string) *ClusterCapabilitiesBuilder { + b.disabled = make([]string, len(values)) + copy(b.disabled, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterCapabilitiesBuilder) Copy(object *ClusterCapabilities) *ClusterCapabilitiesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.disabled != nil { + b.disabled = make([]string, len(object.disabled)) + copy(b.disabled, object.disabled) + } else { + b.disabled = nil + } + return b +} + +// Build creates a 'cluster_capabilities' object using the configuration stored in the builder. +func (b *ClusterCapabilitiesBuilder) Build() (object *ClusterCapabilities, err error) { + object = new(ClusterCapabilities) + object.bitmap_ = b.bitmap_ + if b.disabled != nil { + object.disabled = make([]string, len(b.disabled)) + copy(object.disabled, b.disabled) + } + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_capabilities_list_builder.go b/clientapi/clustersmgmt/v1/cluster_capabilities_list_builder.go new file mode 100644 index 00000000..d33a4e7d --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_capabilities_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterCapabilitiesListBuilder contains the data and logic needed to build +// 'cluster_capabilities' objects. +type ClusterCapabilitiesListBuilder struct { + items []*ClusterCapabilitiesBuilder +} + +// NewClusterCapabilitiesList creates a new builder of 'cluster_capabilities' objects. +func NewClusterCapabilitiesList() *ClusterCapabilitiesListBuilder { + return new(ClusterCapabilitiesListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterCapabilitiesListBuilder) Items(values ...*ClusterCapabilitiesBuilder) *ClusterCapabilitiesListBuilder { + b.items = make([]*ClusterCapabilitiesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterCapabilitiesListBuilder) 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 *ClusterCapabilitiesListBuilder) Copy(list *ClusterCapabilitiesList) *ClusterCapabilitiesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterCapabilitiesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterCapabilities().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_capabilities' objects using the +// configuration stored in the builder. +func (b *ClusterCapabilitiesListBuilder) Build() (list *ClusterCapabilitiesList, err error) { + items := make([]*ClusterCapabilities, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterCapabilitiesList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_capabilities_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_capabilities_list_type_json.go new file mode 100644 index 00000000..553b3029 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_capabilities_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterCapabilitiesList writes a list of values of the 'cluster_capabilities' type to +// the given writer. +func MarshalClusterCapabilitiesList(list []*ClusterCapabilities, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterCapabilitiesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterCapabilitiesList writes a list of value of the 'cluster_capabilities' type to +// the given stream. +func WriteClusterCapabilitiesList(list []*ClusterCapabilities, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterCapabilities(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterCapabilitiesList reads a list of values of the 'cluster_capabilities' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterCapabilitiesList(source interface{}) (items []*ClusterCapabilities, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterCapabilitiesList(iterator) + err = iterator.Error + return +} + +// ReadClusterCapabilitiesList reads list of values of the ”cluster_capabilities' type from +// the given iterator. +func ReadClusterCapabilitiesList(iterator *jsoniter.Iterator) []*ClusterCapabilities { + list := []*ClusterCapabilities{} + for iterator.ReadArray() { + item := ReadClusterCapabilities(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_capabilities_type.go b/clientapi/clustersmgmt/v1/cluster_capabilities_type.go new file mode 100644 index 00000000..6df31bd4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_capabilities_type.go @@ -0,0 +1,167 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterCapabilities represents the values of the 'cluster_capabilities' type. +type ClusterCapabilities struct { + bitmap_ uint32 + disabled []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterCapabilities) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Disabled returns the value of the 'disabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Immutable list of disabled capabilities. May only contain "ImageRegistry" at +// this time. Additional capabilities may be available in the future. Clients +// should expect to handle additional values. +func (o *ClusterCapabilities) Disabled() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.disabled + } + return nil +} + +// GetDisabled returns the value of the 'disabled' attribute and +// a flag indicating if the attribute has a value. +// +// Immutable list of disabled capabilities. May only contain "ImageRegistry" at +// this time. Additional capabilities may be available in the future. Clients +// should expect to handle additional values. +func (o *ClusterCapabilities) GetDisabled() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.disabled + } + return +} + +// ClusterCapabilitiesListKind is the name of the type used to represent list of objects of +// type 'cluster_capabilities'. +const ClusterCapabilitiesListKind = "ClusterCapabilitiesList" + +// ClusterCapabilitiesListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_capabilities'. +const ClusterCapabilitiesListLinkKind = "ClusterCapabilitiesListLink" + +// ClusterCapabilitiesNilKind is the name of the type used to nil lists of objects of +// type 'cluster_capabilities'. +const ClusterCapabilitiesListNilKind = "ClusterCapabilitiesListNil" + +// ClusterCapabilitiesList is a list of values of the 'cluster_capabilities' type. +type ClusterCapabilitiesList struct { + href string + link bool + items []*ClusterCapabilities +} + +// Len returns the length of the list. +func (l *ClusterCapabilitiesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterCapabilitiesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterCapabilitiesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterCapabilitiesList) SetItems(items []*ClusterCapabilities) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterCapabilitiesList) Items() []*ClusterCapabilities { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterCapabilitiesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterCapabilitiesList) Get(i int) *ClusterCapabilities { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterCapabilitiesList) Slice() []*ClusterCapabilities { + var slice []*ClusterCapabilities + if l == nil { + slice = make([]*ClusterCapabilities, 0) + } else { + slice = make([]*ClusterCapabilities, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterCapabilitiesList) Each(f func(item *ClusterCapabilities) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterCapabilitiesList) Range(f func(index int, item *ClusterCapabilities) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_capabilities_type_json.go b/clientapi/clustersmgmt/v1/cluster_capabilities_type_json.go new file mode 100644 index 00000000..c86d6332 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_capabilities_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterCapabilities writes a value of the 'cluster_capabilities' type to the given writer. +func MarshalClusterCapabilities(object *ClusterCapabilities, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterCapabilities(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterCapabilities writes a value of the 'cluster_capabilities' type to the given stream. +func WriteClusterCapabilities(object *ClusterCapabilities, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.disabled != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("disabled") + WriteStringList(object.disabled, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterCapabilities reads a value of the 'cluster_capabilities' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterCapabilities(source interface{}) (object *ClusterCapabilities, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterCapabilities(iterator) + err = iterator.Error + return +} + +// ReadClusterCapabilities reads a value of the 'cluster_capabilities' type from the given iterator. +func ReadClusterCapabilities(iterator *jsoniter.Iterator) *ClusterCapabilities { + object := &ClusterCapabilities{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "disabled": + value := ReadStringList(iterator) + object.disabled = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_configuration_mode_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_configuration_mode_list_type_json.go new file mode 100644 index 00000000..27b47efc --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_configuration_mode_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterConfigurationModeList writes a list of values of the 'cluster_configuration_mode' type to +// the given writer. +func MarshalClusterConfigurationModeList(list []ClusterConfigurationMode, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterConfigurationModeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterConfigurationModeList writes a list of value of the 'cluster_configuration_mode' type to +// the given stream. +func WriteClusterConfigurationModeList(list []ClusterConfigurationMode, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterConfigurationModeList reads a list of values of the 'cluster_configuration_mode' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterConfigurationModeList(source interface{}) (items []ClusterConfigurationMode, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterConfigurationModeList(iterator) + err = iterator.Error + return +} + +// ReadClusterConfigurationModeList reads list of values of the ”cluster_configuration_mode' type from +// the given iterator. +func ReadClusterConfigurationModeList(iterator *jsoniter.Iterator) []ClusterConfigurationMode { + list := []ClusterConfigurationMode{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ClusterConfigurationMode(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_configuration_mode_type.go b/clientapi/clustersmgmt/v1/cluster_configuration_mode_type.go new file mode 100644 index 00000000..cd2d59f3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_configuration_mode_type.go @@ -0,0 +1,31 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterConfigurationMode represents the values of the 'cluster_configuration_mode' enumerated type. +type ClusterConfigurationMode string + +const ( + // Full configuration (default). + ClusterConfigurationModeFull ClusterConfigurationMode = "full" + // Only read configuration operations are supported. + // The cluster can't be deleted, reshaped, configure IDPs, add/remove users, etc. + ClusterConfigurationModeReadOnly ClusterConfigurationMode = "read_only" +) diff --git a/clientapi/clustersmgmt/v1/cluster_console_builder.go b/clientapi/clustersmgmt/v1/cluster_console_builder.go new file mode 100644 index 00000000..1bd9d432 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_console_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterConsoleBuilder contains the data and logic needed to build 'cluster_console' objects. +// +// Information about the console of a cluster. +type ClusterConsoleBuilder struct { + bitmap_ uint32 + url string +} + +// NewClusterConsole creates a new builder of 'cluster_console' objects. +func NewClusterConsole() *ClusterConsoleBuilder { + return &ClusterConsoleBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterConsoleBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// URL sets the value of the 'URL' attribute to the given value. +func (b *ClusterConsoleBuilder) URL(value string) *ClusterConsoleBuilder { + b.url = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterConsoleBuilder) Copy(object *ClusterConsole) *ClusterConsoleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.url = object.url + return b +} + +// Build creates a 'cluster_console' object using the configuration stored in the builder. +func (b *ClusterConsoleBuilder) Build() (object *ClusterConsole, err error) { + object = new(ClusterConsole) + object.bitmap_ = b.bitmap_ + object.url = b.url + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_console_list_builder.go b/clientapi/clustersmgmt/v1/cluster_console_list_builder.go new file mode 100644 index 00000000..48e6e731 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_console_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterConsoleListBuilder contains the data and logic needed to build +// 'cluster_console' objects. +type ClusterConsoleListBuilder struct { + items []*ClusterConsoleBuilder +} + +// NewClusterConsoleList creates a new builder of 'cluster_console' objects. +func NewClusterConsoleList() *ClusterConsoleListBuilder { + return new(ClusterConsoleListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterConsoleListBuilder) Items(values ...*ClusterConsoleBuilder) *ClusterConsoleListBuilder { + b.items = make([]*ClusterConsoleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterConsoleListBuilder) 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 *ClusterConsoleListBuilder) Copy(list *ClusterConsoleList) *ClusterConsoleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterConsoleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterConsole().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_console' objects using the +// configuration stored in the builder. +func (b *ClusterConsoleListBuilder) Build() (list *ClusterConsoleList, err error) { + items := make([]*ClusterConsole, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterConsoleList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_console_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_console_list_type_json.go new file mode 100644 index 00000000..1da0748e --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_console_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterConsoleList writes a list of values of the 'cluster_console' type to +// the given writer. +func MarshalClusterConsoleList(list []*ClusterConsole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterConsoleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterConsoleList writes a list of value of the 'cluster_console' type to +// the given stream. +func WriteClusterConsoleList(list []*ClusterConsole, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterConsole(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterConsoleList reads a list of values of the 'cluster_console' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterConsoleList(source interface{}) (items []*ClusterConsole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterConsoleList(iterator) + err = iterator.Error + return +} + +// ReadClusterConsoleList reads list of values of the ”cluster_console' type from +// the given iterator. +func ReadClusterConsoleList(iterator *jsoniter.Iterator) []*ClusterConsole { + list := []*ClusterConsole{} + for iterator.ReadArray() { + item := ReadClusterConsole(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_console_type.go b/clientapi/clustersmgmt/v1/cluster_console_type.go new file mode 100644 index 00000000..fe6d74cf --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_console_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterConsole represents the values of the 'cluster_console' type. +// +// Information about the console of a cluster. +type ClusterConsole struct { + bitmap_ uint32 + url string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterConsole) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// URL returns the value of the 'URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The URL of the console of the cluster. +func (o *ClusterConsole) URL() string { + if o != nil && o.bitmap_&1 != 0 { + return o.url + } + return "" +} + +// GetURL returns the value of the 'URL' attribute and +// a flag indicating if the attribute has a value. +// +// The URL of the console of the cluster. +func (o *ClusterConsole) GetURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.url + } + return +} + +// ClusterConsoleListKind is the name of the type used to represent list of objects of +// type 'cluster_console'. +const ClusterConsoleListKind = "ClusterConsoleList" + +// ClusterConsoleListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_console'. +const ClusterConsoleListLinkKind = "ClusterConsoleListLink" + +// ClusterConsoleNilKind is the name of the type used to nil lists of objects of +// type 'cluster_console'. +const ClusterConsoleListNilKind = "ClusterConsoleListNil" + +// ClusterConsoleList is a list of values of the 'cluster_console' type. +type ClusterConsoleList struct { + href string + link bool + items []*ClusterConsole +} + +// Len returns the length of the list. +func (l *ClusterConsoleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterConsoleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterConsoleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterConsoleList) SetItems(items []*ClusterConsole) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterConsoleList) Items() []*ClusterConsole { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterConsoleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterConsoleList) Get(i int) *ClusterConsole { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterConsoleList) Slice() []*ClusterConsole { + var slice []*ClusterConsole + if l == nil { + slice = make([]*ClusterConsole, 0) + } else { + slice = make([]*ClusterConsole, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterConsoleList) Each(f func(item *ClusterConsole) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterConsoleList) Range(f func(index int, item *ClusterConsole) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_console_type_json.go b/clientapi/clustersmgmt/v1/cluster_console_type_json.go new file mode 100644 index 00000000..319a375f --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_console_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterConsole writes a value of the 'cluster_console' type to the given writer. +func MarshalClusterConsole(object *ClusterConsole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterConsole(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterConsole writes a value of the 'cluster_console' type to the given stream. +func WriteClusterConsole(object *ClusterConsole, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("url") + stream.WriteString(object.url) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterConsole reads a value of the 'cluster_console' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterConsole(source interface{}) (object *ClusterConsole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterConsole(iterator) + err = iterator.Error + return +} + +// ReadClusterConsole reads a value of the 'cluster_console' type from the given iterator. +func ReadClusterConsole(iterator *jsoniter.Iterator) *ClusterConsole { + object := &ClusterConsole{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "url": + value := iterator.ReadString() + object.url = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_credentials_builder.go b/clientapi/clustersmgmt/v1/cluster_credentials_builder.go new file mode 100644 index 00000000..a1bd2a4d --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_credentials_builder.go @@ -0,0 +1,89 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterCredentialsBuilder contains the data and logic needed to build 'cluster_credentials' objects. +// +// Credentials of the a cluster. +type ClusterCredentialsBuilder struct { + bitmap_ uint32 + id string + href string + kubeconfig string +} + +// NewClusterCredentials creates a new builder of 'cluster_credentials' objects. +func NewClusterCredentials() *ClusterCredentialsBuilder { + return &ClusterCredentialsBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ClusterCredentialsBuilder) Link(value bool) *ClusterCredentialsBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ClusterCredentialsBuilder) ID(value string) *ClusterCredentialsBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ClusterCredentialsBuilder) HREF(value string) *ClusterCredentialsBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterCredentialsBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Kubeconfig sets the value of the 'kubeconfig' attribute to the given value. +func (b *ClusterCredentialsBuilder) Kubeconfig(value string) *ClusterCredentialsBuilder { + b.kubeconfig = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterCredentialsBuilder) Copy(object *ClusterCredentials) *ClusterCredentialsBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.kubeconfig = object.kubeconfig + return b +} + +// Build creates a 'cluster_credentials' object using the configuration stored in the builder. +func (b *ClusterCredentialsBuilder) Build() (object *ClusterCredentials, err error) { + object = new(ClusterCredentials) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.kubeconfig = b.kubeconfig + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_credentials_list_builder.go b/clientapi/clustersmgmt/v1/cluster_credentials_list_builder.go new file mode 100644 index 00000000..0cb36ec4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_credentials_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterCredentialsListBuilder contains the data and logic needed to build +// 'cluster_credentials' objects. +type ClusterCredentialsListBuilder struct { + items []*ClusterCredentialsBuilder +} + +// NewClusterCredentialsList creates a new builder of 'cluster_credentials' objects. +func NewClusterCredentialsList() *ClusterCredentialsListBuilder { + return new(ClusterCredentialsListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterCredentialsListBuilder) Items(values ...*ClusterCredentialsBuilder) *ClusterCredentialsListBuilder { + b.items = make([]*ClusterCredentialsBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterCredentialsListBuilder) 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 *ClusterCredentialsListBuilder) Copy(list *ClusterCredentialsList) *ClusterCredentialsListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterCredentialsBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterCredentials().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_credentials' objects using the +// configuration stored in the builder. +func (b *ClusterCredentialsListBuilder) Build() (list *ClusterCredentialsList, err error) { + items := make([]*ClusterCredentials, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterCredentialsList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_credentials_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_credentials_list_type_json.go new file mode 100644 index 00000000..4796cdb2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_credentials_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterCredentialsList writes a list of values of the 'cluster_credentials' type to +// the given writer. +func MarshalClusterCredentialsList(list []*ClusterCredentials, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterCredentialsList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterCredentialsList writes a list of value of the 'cluster_credentials' type to +// the given stream. +func WriteClusterCredentialsList(list []*ClusterCredentials, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterCredentials(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterCredentialsList reads a list of values of the 'cluster_credentials' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterCredentialsList(source interface{}) (items []*ClusterCredentials, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterCredentialsList(iterator) + err = iterator.Error + return +} + +// ReadClusterCredentialsList reads list of values of the ”cluster_credentials' type from +// the given iterator. +func ReadClusterCredentialsList(iterator *jsoniter.Iterator) []*ClusterCredentials { + list := []*ClusterCredentials{} + for iterator.ReadArray() { + item := ReadClusterCredentials(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_credentials_type.go b/clientapi/clustersmgmt/v1/cluster_credentials_type.go new file mode 100644 index 00000000..e05049f7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_credentials_type.go @@ -0,0 +1,265 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterCredentialsKind is the name of the type used to represent objects +// of type 'cluster_credentials'. +const ClusterCredentialsKind = "ClusterCredentials" + +// ClusterCredentialsLinkKind is the name of the type used to represent links +// to objects of type 'cluster_credentials'. +const ClusterCredentialsLinkKind = "ClusterCredentialsLink" + +// ClusterCredentialsNilKind is the name of the type used to nil references +// to objects of type 'cluster_credentials'. +const ClusterCredentialsNilKind = "ClusterCredentialsNil" + +// ClusterCredentials represents the values of the 'cluster_credentials' type. +// +// Credentials of the a cluster. +type ClusterCredentials struct { + bitmap_ uint32 + id string + href string + kubeconfig string +} + +// Kind returns the name of the type of the object. +func (o *ClusterCredentials) Kind() string { + if o == nil { + return ClusterCredentialsNilKind + } + if o.bitmap_&1 != 0 { + return ClusterCredentialsLinkKind + } + return ClusterCredentialsKind +} + +// Link returns true if this is a link. +func (o *ClusterCredentials) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ClusterCredentials) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ClusterCredentials) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ClusterCredentials) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ClusterCredentials) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterCredentials) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Kubeconfig returns the value of the 'kubeconfig' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Administrator _kubeconfig_ file for the cluster. +func (o *ClusterCredentials) Kubeconfig() string { + if o != nil && o.bitmap_&8 != 0 { + return o.kubeconfig + } + return "" +} + +// GetKubeconfig returns the value of the 'kubeconfig' attribute and +// a flag indicating if the attribute has a value. +// +// Administrator _kubeconfig_ file for the cluster. +func (o *ClusterCredentials) GetKubeconfig() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.kubeconfig + } + return +} + +// ClusterCredentialsListKind is the name of the type used to represent list of objects of +// type 'cluster_credentials'. +const ClusterCredentialsListKind = "ClusterCredentialsList" + +// ClusterCredentialsListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_credentials'. +const ClusterCredentialsListLinkKind = "ClusterCredentialsListLink" + +// ClusterCredentialsNilKind is the name of the type used to nil lists of objects of +// type 'cluster_credentials'. +const ClusterCredentialsListNilKind = "ClusterCredentialsListNil" + +// ClusterCredentialsList is a list of values of the 'cluster_credentials' type. +type ClusterCredentialsList struct { + href string + link bool + items []*ClusterCredentials +} + +// Kind returns the name of the type of the object. +func (l *ClusterCredentialsList) Kind() string { + if l == nil { + return ClusterCredentialsListNilKind + } + if l.link { + return ClusterCredentialsListLinkKind + } + return ClusterCredentialsListKind +} + +// Link returns true iif this is a link. +func (l *ClusterCredentialsList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ClusterCredentialsList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ClusterCredentialsList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ClusterCredentialsList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterCredentialsList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterCredentialsList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterCredentialsList) SetItems(items []*ClusterCredentials) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterCredentialsList) Items() []*ClusterCredentials { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterCredentialsList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterCredentialsList) Get(i int) *ClusterCredentials { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterCredentialsList) Slice() []*ClusterCredentials { + var slice []*ClusterCredentials + if l == nil { + slice = make([]*ClusterCredentials, 0) + } else { + slice = make([]*ClusterCredentials, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterCredentialsList) Each(f func(item *ClusterCredentials) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterCredentialsList) Range(f func(index int, item *ClusterCredentials) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_credentials_type_json.go b/clientapi/clustersmgmt/v1/cluster_credentials_type_json.go new file mode 100644 index 00000000..dd268328 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_credentials_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterCredentials writes a value of the 'cluster_credentials' type to the given writer. +func MarshalClusterCredentials(object *ClusterCredentials, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterCredentials(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterCredentials writes a value of the 'cluster_credentials' type to the given stream. +func WriteClusterCredentials(object *ClusterCredentials, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ClusterCredentialsLinkKind) + } else { + stream.WriteString(ClusterCredentialsKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kubeconfig") + stream.WriteString(object.kubeconfig) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterCredentials reads a value of the 'cluster_credentials' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterCredentials(source interface{}) (object *ClusterCredentials, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterCredentials(iterator) + err = iterator.Error + return +} + +// ReadClusterCredentials reads a value of the 'cluster_credentials' type from the given iterator. +func ReadClusterCredentials(iterator *jsoniter.Iterator) *ClusterCredentials { + object := &ClusterCredentials{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ClusterCredentialsLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "kubeconfig": + value := iterator.ReadString() + object.kubeconfig = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_deployment_builder.go b/clientapi/clustersmgmt/v1/cluster_deployment_builder.go new file mode 100644 index 00000000..18427c23 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_deployment_builder.go @@ -0,0 +1,89 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterDeploymentBuilder contains the data and logic needed to build 'cluster_deployment' objects. +// +// Representation of a clusterdeployment. +type ClusterDeploymentBuilder struct { + bitmap_ uint32 + id string + href string + content interface{} +} + +// NewClusterDeployment creates a new builder of 'cluster_deployment' objects. +func NewClusterDeployment() *ClusterDeploymentBuilder { + return &ClusterDeploymentBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ClusterDeploymentBuilder) Link(value bool) *ClusterDeploymentBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ClusterDeploymentBuilder) ID(value string) *ClusterDeploymentBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ClusterDeploymentBuilder) HREF(value string) *ClusterDeploymentBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterDeploymentBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Content sets the value of the 'content' attribute to the given value. +func (b *ClusterDeploymentBuilder) Content(value interface{}) *ClusterDeploymentBuilder { + b.content = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterDeploymentBuilder) Copy(object *ClusterDeployment) *ClusterDeploymentBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.content = object.content + return b +} + +// Build creates a 'cluster_deployment' object using the configuration stored in the builder. +func (b *ClusterDeploymentBuilder) Build() (object *ClusterDeployment, err error) { + object = new(ClusterDeployment) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.content = b.content + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_deployment_list_builder.go b/clientapi/clustersmgmt/v1/cluster_deployment_list_builder.go new file mode 100644 index 00000000..b52bd85b --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_deployment_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterDeploymentListBuilder contains the data and logic needed to build +// 'cluster_deployment' objects. +type ClusterDeploymentListBuilder struct { + items []*ClusterDeploymentBuilder +} + +// NewClusterDeploymentList creates a new builder of 'cluster_deployment' objects. +func NewClusterDeploymentList() *ClusterDeploymentListBuilder { + return new(ClusterDeploymentListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterDeploymentListBuilder) Items(values ...*ClusterDeploymentBuilder) *ClusterDeploymentListBuilder { + b.items = make([]*ClusterDeploymentBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterDeploymentListBuilder) 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 *ClusterDeploymentListBuilder) Copy(list *ClusterDeploymentList) *ClusterDeploymentListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterDeploymentBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterDeployment().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_deployment' objects using the +// configuration stored in the builder. +func (b *ClusterDeploymentListBuilder) Build() (list *ClusterDeploymentList, err error) { + items := make([]*ClusterDeployment, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterDeploymentList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_deployment_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_deployment_list_type_json.go new file mode 100644 index 00000000..feb05dad --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_deployment_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterDeploymentList writes a list of values of the 'cluster_deployment' type to +// the given writer. +func MarshalClusterDeploymentList(list []*ClusterDeployment, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterDeploymentList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterDeploymentList writes a list of value of the 'cluster_deployment' type to +// the given stream. +func WriteClusterDeploymentList(list []*ClusterDeployment, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterDeployment(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterDeploymentList reads a list of values of the 'cluster_deployment' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterDeploymentList(source interface{}) (items []*ClusterDeployment, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterDeploymentList(iterator) + err = iterator.Error + return +} + +// ReadClusterDeploymentList reads list of values of the ”cluster_deployment' type from +// the given iterator. +func ReadClusterDeploymentList(iterator *jsoniter.Iterator) []*ClusterDeployment { + list := []*ClusterDeployment{} + for iterator.ReadArray() { + item := ReadClusterDeployment(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_deployment_type.go b/clientapi/clustersmgmt/v1/cluster_deployment_type.go new file mode 100644 index 00000000..6403176a --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_deployment_type.go @@ -0,0 +1,265 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterDeploymentKind is the name of the type used to represent objects +// of type 'cluster_deployment'. +const ClusterDeploymentKind = "ClusterDeployment" + +// ClusterDeploymentLinkKind is the name of the type used to represent links +// to objects of type 'cluster_deployment'. +const ClusterDeploymentLinkKind = "ClusterDeploymentLink" + +// ClusterDeploymentNilKind is the name of the type used to nil references +// to objects of type 'cluster_deployment'. +const ClusterDeploymentNilKind = "ClusterDeploymentNil" + +// ClusterDeployment represents the values of the 'cluster_deployment' type. +// +// Representation of a clusterdeployment. +type ClusterDeployment struct { + bitmap_ uint32 + id string + href string + content interface{} +} + +// Kind returns the name of the type of the object. +func (o *ClusterDeployment) Kind() string { + if o == nil { + return ClusterDeploymentNilKind + } + if o.bitmap_&1 != 0 { + return ClusterDeploymentLinkKind + } + return ClusterDeploymentKind +} + +// Link returns true if this is a link. +func (o *ClusterDeployment) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ClusterDeployment) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ClusterDeployment) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ClusterDeployment) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ClusterDeployment) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterDeployment) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Content returns the value of the 'content' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Content of the clusterdeployment. +func (o *ClusterDeployment) Content() interface{} { + if o != nil && o.bitmap_&8 != 0 { + return o.content + } + return nil +} + +// GetContent returns the value of the 'content' attribute and +// a flag indicating if the attribute has a value. +// +// Content of the clusterdeployment. +func (o *ClusterDeployment) GetContent() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.content + } + return +} + +// ClusterDeploymentListKind is the name of the type used to represent list of objects of +// type 'cluster_deployment'. +const ClusterDeploymentListKind = "ClusterDeploymentList" + +// ClusterDeploymentListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_deployment'. +const ClusterDeploymentListLinkKind = "ClusterDeploymentListLink" + +// ClusterDeploymentNilKind is the name of the type used to nil lists of objects of +// type 'cluster_deployment'. +const ClusterDeploymentListNilKind = "ClusterDeploymentListNil" + +// ClusterDeploymentList is a list of values of the 'cluster_deployment' type. +type ClusterDeploymentList struct { + href string + link bool + items []*ClusterDeployment +} + +// Kind returns the name of the type of the object. +func (l *ClusterDeploymentList) Kind() string { + if l == nil { + return ClusterDeploymentListNilKind + } + if l.link { + return ClusterDeploymentListLinkKind + } + return ClusterDeploymentListKind +} + +// Link returns true iif this is a link. +func (l *ClusterDeploymentList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ClusterDeploymentList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ClusterDeploymentList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ClusterDeploymentList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterDeploymentList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterDeploymentList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterDeploymentList) SetItems(items []*ClusterDeployment) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterDeploymentList) Items() []*ClusterDeployment { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterDeploymentList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterDeploymentList) Get(i int) *ClusterDeployment { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterDeploymentList) Slice() []*ClusterDeployment { + var slice []*ClusterDeployment + if l == nil { + slice = make([]*ClusterDeployment, 0) + } else { + slice = make([]*ClusterDeployment, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterDeploymentList) Each(f func(item *ClusterDeployment) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterDeploymentList) Range(f func(index int, item *ClusterDeployment) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_deployment_type_json.go b/clientapi/clustersmgmt/v1/cluster_deployment_type_json.go new file mode 100644 index 00000000..173c2a6e --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_deployment_type_json.go @@ -0,0 +1,121 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterDeployment writes a value of the 'cluster_deployment' type to the given writer. +func MarshalClusterDeployment(object *ClusterDeployment, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterDeployment(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterDeployment writes a value of the 'cluster_deployment' type to the given stream. +func WriteClusterDeployment(object *ClusterDeployment, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ClusterDeploymentLinkKind) + } else { + stream.WriteString(ClusterDeploymentKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("content") + stream.WriteVal(object.content) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterDeployment reads a value of the 'cluster_deployment' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterDeployment(source interface{}) (object *ClusterDeployment, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterDeployment(iterator) + err = iterator.Error + return +} + +// ReadClusterDeployment reads a value of the 'cluster_deployment' type from the given iterator. +func ReadClusterDeployment(iterator *jsoniter.Iterator) *ClusterDeployment { + object := &ClusterDeployment{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ClusterDeploymentLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "content": + var value interface{} + iterator.ReadVal(&value) + object.content = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_health_state_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_health_state_list_type_json.go new file mode 100644 index 00000000..b050a6b5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_health_state_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterHealthStateList writes a list of values of the 'cluster_health_state' type to +// the given writer. +func MarshalClusterHealthStateList(list []ClusterHealthState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterHealthStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterHealthStateList writes a list of value of the 'cluster_health_state' type to +// the given stream. +func WriteClusterHealthStateList(list []ClusterHealthState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterHealthStateList reads a list of values of the 'cluster_health_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterHealthStateList(source interface{}) (items []ClusterHealthState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterHealthStateList(iterator) + err = iterator.Error + return +} + +// ReadClusterHealthStateList reads list of values of the ”cluster_health_state' type from +// the given iterator. +func ReadClusterHealthStateList(iterator *jsoniter.Iterator) []ClusterHealthState { + list := []ClusterHealthState{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ClusterHealthState(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_health_state_type.go b/clientapi/clustersmgmt/v1/cluster_health_state_type.go new file mode 100644 index 00000000..5d529443 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_health_state_type.go @@ -0,0 +1,32 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterHealthState represents the values of the 'cluster_health_state' enumerated type. +type ClusterHealthState string + +const ( + // Cluster is Ready and healthy. + ClusterHealthStateHealthy ClusterHealthState = "healthy" + // Cluster is Ready and unhealthy. + ClusterHealthStateUnhealthy ClusterHealthState = "unhealthy" + // Cluster health is unknown. + ClusterHealthStateUnknown ClusterHealthState = "unknown" +) diff --git a/clientapi/clustersmgmt/v1/cluster_link_builder.go b/clientapi/clustersmgmt/v1/cluster_link_builder.go new file mode 100644 index 00000000..987b6998 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_link_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterLinkBuilder contains the data and logic needed to build 'cluster_link' objects. +// +// Definition of a cluster link. +type ClusterLinkBuilder struct { + bitmap_ uint32 + href string + id string +} + +// NewClusterLink creates a new builder of 'cluster_link' objects. +func NewClusterLink() *ClusterLinkBuilder { + return &ClusterLinkBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterLinkBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// HREF sets the value of the 'HREF' attribute to the given value. +func (b *ClusterLinkBuilder) HREF(value string) *ClusterLinkBuilder { + b.href = value + b.bitmap_ |= 1 + return b +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *ClusterLinkBuilder) ID(value string) *ClusterLinkBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterLinkBuilder) Copy(object *ClusterLink) *ClusterLinkBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.href = object.href + b.id = object.id + return b +} + +// Build creates a 'cluster_link' object using the configuration stored in the builder. +func (b *ClusterLinkBuilder) Build() (object *ClusterLink, err error) { + object = new(ClusterLink) + object.bitmap_ = b.bitmap_ + object.href = b.href + object.id = b.id + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_link_list_builder.go b/clientapi/clustersmgmt/v1/cluster_link_list_builder.go new file mode 100644 index 00000000..8b854e1d --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_link_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterLinkListBuilder contains the data and logic needed to build +// 'cluster_link' objects. +type ClusterLinkListBuilder struct { + items []*ClusterLinkBuilder +} + +// NewClusterLinkList creates a new builder of 'cluster_link' objects. +func NewClusterLinkList() *ClusterLinkListBuilder { + return new(ClusterLinkListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterLinkListBuilder) Items(values ...*ClusterLinkBuilder) *ClusterLinkListBuilder { + b.items = make([]*ClusterLinkBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterLinkListBuilder) 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 *ClusterLinkListBuilder) Copy(list *ClusterLinkList) *ClusterLinkListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterLinkBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterLink().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_link' objects using the +// configuration stored in the builder. +func (b *ClusterLinkListBuilder) Build() (list *ClusterLinkList, err error) { + items := make([]*ClusterLink, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterLinkList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_link_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_link_list_type_json.go new file mode 100644 index 00000000..d553dd06 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_link_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterLinkList writes a list of values of the 'cluster_link' type to +// the given writer. +func MarshalClusterLinkList(list []*ClusterLink, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterLinkList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterLinkList writes a list of value of the 'cluster_link' type to +// the given stream. +func WriteClusterLinkList(list []*ClusterLink, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterLink(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterLinkList reads a list of values of the 'cluster_link' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterLinkList(source interface{}) (items []*ClusterLink, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterLinkList(iterator) + err = iterator.Error + return +} + +// ReadClusterLinkList reads list of values of the ”cluster_link' type from +// the given iterator. +func ReadClusterLinkList(iterator *jsoniter.Iterator) []*ClusterLink { + list := []*ClusterLink{} + for iterator.ReadArray() { + item := ReadClusterLink(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_link_type.go b/clientapi/clustersmgmt/v1/cluster_link_type.go new file mode 100644 index 00000000..ddc66a76 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_link_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterLink represents the values of the 'cluster_link' type. +// +// Definition of a cluster link. +type ClusterLink struct { + bitmap_ uint32 + href string + id string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterLink) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// HREF returns the value of the 'HREF' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HREF for the cluster, filled in response. +func (o *ClusterLink) HREF() string { + if o != nil && o.bitmap_&1 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the value of the 'HREF' attribute and +// a flag indicating if the attribute has a value. +// +// HREF for the cluster, filled in response. +func (o *ClusterLink) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.href + } + return +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The cluster's ID. +func (o *ClusterLink) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// The cluster's ID. +func (o *ClusterLink) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// ClusterLinkListKind is the name of the type used to represent list of objects of +// type 'cluster_link'. +const ClusterLinkListKind = "ClusterLinkList" + +// ClusterLinkListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_link'. +const ClusterLinkListLinkKind = "ClusterLinkListLink" + +// ClusterLinkNilKind is the name of the type used to nil lists of objects of +// type 'cluster_link'. +const ClusterLinkListNilKind = "ClusterLinkListNil" + +// ClusterLinkList is a list of values of the 'cluster_link' type. +type ClusterLinkList struct { + href string + link bool + items []*ClusterLink +} + +// Len returns the length of the list. +func (l *ClusterLinkList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterLinkList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterLinkList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterLinkList) SetItems(items []*ClusterLink) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterLinkList) Items() []*ClusterLink { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterLinkList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterLinkList) Get(i int) *ClusterLink { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterLinkList) Slice() []*ClusterLink { + var slice []*ClusterLink + if l == nil { + slice = make([]*ClusterLink, 0) + } else { + slice = make([]*ClusterLink, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterLinkList) Each(f func(item *ClusterLink) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterLinkList) Range(f func(index int, item *ClusterLink) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_link_type_json.go b/clientapi/clustersmgmt/v1/cluster_link_type_json.go new file mode 100644 index 00000000..7e6984d7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_link_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterLink writes a value of the 'cluster_link' type to the given writer. +func MarshalClusterLink(object *ClusterLink, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterLink(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterLink writes a value of the 'cluster_link' type to the given stream. +func WriteClusterLink(object *ClusterLink, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterLink reads a value of the 'cluster_link' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterLink(source interface{}) (object *ClusterLink, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterLink(iterator) + err = iterator.Error + return +} + +// ReadClusterLink reads a value of the 'cluster_link' type from the given iterator. +func ReadClusterLink(iterator *jsoniter.Iterator) *ClusterLink { + object := &ClusterLink{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 1 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_list_builder.go b/clientapi/clustersmgmt/v1/cluster_list_builder.go new file mode 100644 index 00000000..5916c9d4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterListBuilder contains the data and logic needed to build +// 'cluster' objects. +type ClusterListBuilder struct { + items []*ClusterBuilder +} + +// NewClusterList creates a new builder of 'cluster' objects. +func NewClusterList() *ClusterListBuilder { + return new(ClusterListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterListBuilder) Items(values ...*ClusterBuilder) *ClusterListBuilder { + b.items = make([]*ClusterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterListBuilder) 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 *ClusterListBuilder) Copy(list *ClusterList) *ClusterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCluster().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster' objects using the +// configuration stored in the builder. +func (b *ClusterListBuilder) Build() (list *ClusterList, err error) { + items := make([]*Cluster, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_list_type_json.go new file mode 100644 index 00000000..5c98bd37 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterList writes a list of values of the 'cluster' type to +// the given writer. +func MarshalClusterList(list []*Cluster, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterList writes a list of value of the 'cluster' type to +// the given stream. +func WriteClusterList(list []*Cluster, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCluster(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterList reads a list of values of the 'cluster' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterList(source interface{}) (items []*Cluster, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterList(iterator) + err = iterator.Error + return +} + +// ReadClusterList reads list of values of the ”cluster' type from +// the given iterator. +func ReadClusterList(iterator *jsoniter.Iterator) []*Cluster { + list := []*Cluster{} + for iterator.ReadArray() { + item := ReadCluster(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_migration_builder.go b/clientapi/clustersmgmt/v1/cluster_migration_builder.go new file mode 100644 index 00000000..a4f35bc5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_builder.go @@ -0,0 +1,175 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ClusterMigrationBuilder contains the data and logic needed to build 'cluster_migration' objects. +// +// Representation of a cluster migration. +type ClusterMigrationBuilder struct { + bitmap_ uint32 + id string + href string + clusterID string + creationTimestamp time.Time + sdnToOvn *SdnToOvnClusterMigrationBuilder + state *ClusterMigrationStateBuilder + type_ ClusterMigrationType + updatedTimestamp time.Time +} + +// NewClusterMigration creates a new builder of 'cluster_migration' objects. +func NewClusterMigration() *ClusterMigrationBuilder { + return &ClusterMigrationBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ClusterMigrationBuilder) Link(value bool) *ClusterMigrationBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ClusterMigrationBuilder) ID(value string) *ClusterMigrationBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ClusterMigrationBuilder) HREF(value string) *ClusterMigrationBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterMigrationBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *ClusterMigrationBuilder) ClusterID(value string) *ClusterMigrationBuilder { + b.clusterID = value + b.bitmap_ |= 8 + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *ClusterMigrationBuilder) CreationTimestamp(value time.Time) *ClusterMigrationBuilder { + b.creationTimestamp = value + b.bitmap_ |= 16 + return b +} + +// SdnToOvn sets the value of the 'sdn_to_ovn' attribute to the given value. +// +// Details for `SdnToOvn` cluster migrations. +func (b *ClusterMigrationBuilder) SdnToOvn(value *SdnToOvnClusterMigrationBuilder) *ClusterMigrationBuilder { + b.sdnToOvn = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// Representation of a cluster migration state. +func (b *ClusterMigrationBuilder) State(value *ClusterMigrationStateBuilder) *ClusterMigrationBuilder { + b.state = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Type sets the value of the 'type' attribute to the given value. +// +// Type of cluster migration. +func (b *ClusterMigrationBuilder) Type(value ClusterMigrationType) *ClusterMigrationBuilder { + b.type_ = value + b.bitmap_ |= 128 + return b +} + +// UpdatedTimestamp sets the value of the 'updated_timestamp' attribute to the given value. +func (b *ClusterMigrationBuilder) UpdatedTimestamp(value time.Time) *ClusterMigrationBuilder { + b.updatedTimestamp = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterMigrationBuilder) Copy(object *ClusterMigration) *ClusterMigrationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.clusterID = object.clusterID + b.creationTimestamp = object.creationTimestamp + if object.sdnToOvn != nil { + b.sdnToOvn = NewSdnToOvnClusterMigration().Copy(object.sdnToOvn) + } else { + b.sdnToOvn = nil + } + if object.state != nil { + b.state = NewClusterMigrationState().Copy(object.state) + } else { + b.state = nil + } + b.type_ = object.type_ + b.updatedTimestamp = object.updatedTimestamp + return b +} + +// Build creates a 'cluster_migration' object using the configuration stored in the builder. +func (b *ClusterMigrationBuilder) Build() (object *ClusterMigration, err error) { + object = new(ClusterMigration) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.clusterID = b.clusterID + object.creationTimestamp = b.creationTimestamp + if b.sdnToOvn != nil { + object.sdnToOvn, err = b.sdnToOvn.Build() + if err != nil { + return + } + } + if b.state != nil { + object.state, err = b.state.Build() + if err != nil { + return + } + } + object.type_ = b.type_ + object.updatedTimestamp = b.updatedTimestamp + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_migration_list_builder.go b/clientapi/clustersmgmt/v1/cluster_migration_list_builder.go new file mode 100644 index 00000000..5780164f --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterMigrationListBuilder contains the data and logic needed to build +// 'cluster_migration' objects. +type ClusterMigrationListBuilder struct { + items []*ClusterMigrationBuilder +} + +// NewClusterMigrationList creates a new builder of 'cluster_migration' objects. +func NewClusterMigrationList() *ClusterMigrationListBuilder { + return new(ClusterMigrationListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterMigrationListBuilder) Items(values ...*ClusterMigrationBuilder) *ClusterMigrationListBuilder { + b.items = make([]*ClusterMigrationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterMigrationListBuilder) 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 *ClusterMigrationListBuilder) Copy(list *ClusterMigrationList) *ClusterMigrationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterMigrationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterMigration().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_migration' objects using the +// configuration stored in the builder. +func (b *ClusterMigrationListBuilder) Build() (list *ClusterMigrationList, err error) { + items := make([]*ClusterMigration, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterMigrationList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_migration_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_migration_list_type_json.go new file mode 100644 index 00000000..0d41c5e0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterMigrationList writes a list of values of the 'cluster_migration' type to +// the given writer. +func MarshalClusterMigrationList(list []*ClusterMigration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterMigrationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterMigrationList writes a list of value of the 'cluster_migration' type to +// the given stream. +func WriteClusterMigrationList(list []*ClusterMigration, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterMigration(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterMigrationList reads a list of values of the 'cluster_migration' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterMigrationList(source interface{}) (items []*ClusterMigration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterMigrationList(iterator) + err = iterator.Error + return +} + +// ReadClusterMigrationList reads list of values of the ”cluster_migration' type from +// the given iterator. +func ReadClusterMigrationList(iterator *jsoniter.Iterator) []*ClusterMigration { + list := []*ClusterMigration{} + for iterator.ReadArray() { + item := ReadClusterMigration(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_migration_state_builder.go b/clientapi/clustersmgmt/v1/cluster_migration_state_builder.go new file mode 100644 index 00000000..17c4bca7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_state_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterMigrationStateBuilder contains the data and logic needed to build 'cluster_migration_state' objects. +// +// Representation of a cluster migration state. +type ClusterMigrationStateBuilder struct { + bitmap_ uint32 + description string + value ClusterMigrationStateValue +} + +// NewClusterMigrationState creates a new builder of 'cluster_migration_state' objects. +func NewClusterMigrationState() *ClusterMigrationStateBuilder { + return &ClusterMigrationStateBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterMigrationStateBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *ClusterMigrationStateBuilder) Description(value string) *ClusterMigrationStateBuilder { + b.description = value + b.bitmap_ |= 1 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +// +// The state of the cluster migration. +func (b *ClusterMigrationStateBuilder) Value(value ClusterMigrationStateValue) *ClusterMigrationStateBuilder { + b.value = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterMigrationStateBuilder) Copy(object *ClusterMigrationState) *ClusterMigrationStateBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.description = object.description + b.value = object.value + return b +} + +// Build creates a 'cluster_migration_state' object using the configuration stored in the builder. +func (b *ClusterMigrationStateBuilder) Build() (object *ClusterMigrationState, err error) { + object = new(ClusterMigrationState) + object.bitmap_ = b.bitmap_ + object.description = b.description + object.value = b.value + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_migration_state_list_builder.go b/clientapi/clustersmgmt/v1/cluster_migration_state_list_builder.go new file mode 100644 index 00000000..8c7fe918 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_state_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterMigrationStateListBuilder contains the data and logic needed to build +// 'cluster_migration_state' objects. +type ClusterMigrationStateListBuilder struct { + items []*ClusterMigrationStateBuilder +} + +// NewClusterMigrationStateList creates a new builder of 'cluster_migration_state' objects. +func NewClusterMigrationStateList() *ClusterMigrationStateListBuilder { + return new(ClusterMigrationStateListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterMigrationStateListBuilder) Items(values ...*ClusterMigrationStateBuilder) *ClusterMigrationStateListBuilder { + b.items = make([]*ClusterMigrationStateBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterMigrationStateListBuilder) 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 *ClusterMigrationStateListBuilder) Copy(list *ClusterMigrationStateList) *ClusterMigrationStateListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterMigrationStateBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterMigrationState().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_migration_state' objects using the +// configuration stored in the builder. +func (b *ClusterMigrationStateListBuilder) Build() (list *ClusterMigrationStateList, err error) { + items := make([]*ClusterMigrationState, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterMigrationStateList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_migration_state_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_migration_state_list_type_json.go new file mode 100644 index 00000000..5b931f46 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_state_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterMigrationStateList writes a list of values of the 'cluster_migration_state' type to +// the given writer. +func MarshalClusterMigrationStateList(list []*ClusterMigrationState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterMigrationStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterMigrationStateList writes a list of value of the 'cluster_migration_state' type to +// the given stream. +func WriteClusterMigrationStateList(list []*ClusterMigrationState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterMigrationState(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterMigrationStateList reads a list of values of the 'cluster_migration_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterMigrationStateList(source interface{}) (items []*ClusterMigrationState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterMigrationStateList(iterator) + err = iterator.Error + return +} + +// ReadClusterMigrationStateList reads list of values of the ”cluster_migration_state' type from +// the given iterator. +func ReadClusterMigrationStateList(iterator *jsoniter.Iterator) []*ClusterMigrationState { + list := []*ClusterMigrationState{} + for iterator.ReadArray() { + item := ReadClusterMigrationState(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_migration_state_type.go b/clientapi/clustersmgmt/v1/cluster_migration_state_type.go new file mode 100644 index 00000000..bec47144 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_state_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterMigrationState represents the values of the 'cluster_migration_state' type. +// +// Representation of a cluster migration state. +type ClusterMigrationState struct { + bitmap_ uint32 + description string + value ClusterMigrationStateValue +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterMigrationState) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// A longer description of the current state of the cluster migration. +func (o *ClusterMigrationState) Description() string { + if o != nil && o.bitmap_&1 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// A longer description of the current state of the cluster migration. +func (o *ClusterMigrationState) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.description + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The current state of the cluster migration. +func (o *ClusterMigrationState) Value() ClusterMigrationStateValue { + if o != nil && o.bitmap_&2 != 0 { + return o.value + } + return ClusterMigrationStateValue("") +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// The current state of the cluster migration. +func (o *ClusterMigrationState) GetValue() (value ClusterMigrationStateValue, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.value + } + return +} + +// ClusterMigrationStateListKind is the name of the type used to represent list of objects of +// type 'cluster_migration_state'. +const ClusterMigrationStateListKind = "ClusterMigrationStateList" + +// ClusterMigrationStateListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_migration_state'. +const ClusterMigrationStateListLinkKind = "ClusterMigrationStateListLink" + +// ClusterMigrationStateNilKind is the name of the type used to nil lists of objects of +// type 'cluster_migration_state'. +const ClusterMigrationStateListNilKind = "ClusterMigrationStateListNil" + +// ClusterMigrationStateList is a list of values of the 'cluster_migration_state' type. +type ClusterMigrationStateList struct { + href string + link bool + items []*ClusterMigrationState +} + +// Len returns the length of the list. +func (l *ClusterMigrationStateList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterMigrationStateList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterMigrationStateList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterMigrationStateList) SetItems(items []*ClusterMigrationState) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterMigrationStateList) Items() []*ClusterMigrationState { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterMigrationStateList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterMigrationStateList) Get(i int) *ClusterMigrationState { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterMigrationStateList) Slice() []*ClusterMigrationState { + var slice []*ClusterMigrationState + if l == nil { + slice = make([]*ClusterMigrationState, 0) + } else { + slice = make([]*ClusterMigrationState, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterMigrationStateList) Each(f func(item *ClusterMigrationState) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterMigrationStateList) Range(f func(index int, item *ClusterMigrationState) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_migration_state_type_json.go b/clientapi/clustersmgmt/v1/cluster_migration_state_type_json.go new file mode 100644 index 00000000..00623cbb --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_state_type_json.go @@ -0,0 +1,100 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterMigrationState writes a value of the 'cluster_migration_state' type to the given writer. +func MarshalClusterMigrationState(object *ClusterMigrationState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterMigrationState(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterMigrationState writes a value of the 'cluster_migration_state' type to the given stream. +func WriteClusterMigrationState(object *ClusterMigrationState, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(string(object.value)) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterMigrationState reads a value of the 'cluster_migration_state' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterMigrationState(source interface{}) (object *ClusterMigrationState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterMigrationState(iterator) + err = iterator.Error + return +} + +// ReadClusterMigrationState reads a value of the 'cluster_migration_state' type from the given iterator. +func ReadClusterMigrationState(iterator *jsoniter.Iterator) *ClusterMigrationState { + object := &ClusterMigrationState{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 1 + case "value": + text := iterator.ReadString() + value := ClusterMigrationStateValue(text) + object.value = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_migration_state_value_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_migration_state_value_list_type_json.go new file mode 100644 index 00000000..97ecad42 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_state_value_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterMigrationStateValueList writes a list of values of the 'cluster_migration_state_value' type to +// the given writer. +func MarshalClusterMigrationStateValueList(list []ClusterMigrationStateValue, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterMigrationStateValueList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterMigrationStateValueList writes a list of value of the 'cluster_migration_state_value' type to +// the given stream. +func WriteClusterMigrationStateValueList(list []ClusterMigrationStateValue, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterMigrationStateValueList reads a list of values of the 'cluster_migration_state_value' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterMigrationStateValueList(source interface{}) (items []ClusterMigrationStateValue, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterMigrationStateValueList(iterator) + err = iterator.Error + return +} + +// ReadClusterMigrationStateValueList reads list of values of the ”cluster_migration_state_value' type from +// the given iterator. +func ReadClusterMigrationStateValueList(iterator *jsoniter.Iterator) []ClusterMigrationStateValue { + list := []ClusterMigrationStateValue{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ClusterMigrationStateValue(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_migration_state_value_type.go b/clientapi/clustersmgmt/v1/cluster_migration_state_value_type.go new file mode 100644 index 00000000..56b3425a --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_state_value_type.go @@ -0,0 +1,32 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterMigrationStateValue represents the values of the 'cluster_migration_state_value' enumerated type. +type ClusterMigrationStateValue string + +const ( + // + ClusterMigrationStateValueCompleted ClusterMigrationStateValue = "completed" + // + ClusterMigrationStateValueInProgress ClusterMigrationStateValue = "in progress" + // + ClusterMigrationStateValueScheduled ClusterMigrationStateValue = "scheduled" +) diff --git a/clientapi/clustersmgmt/v1/cluster_migration_type.go b/clientapi/clustersmgmt/v1/cluster_migration_type.go new file mode 100644 index 00000000..2751085a --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_type.go @@ -0,0 +1,397 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ClusterMigrationKind is the name of the type used to represent objects +// of type 'cluster_migration'. +const ClusterMigrationKind = "ClusterMigration" + +// ClusterMigrationLinkKind is the name of the type used to represent links +// to objects of type 'cluster_migration'. +const ClusterMigrationLinkKind = "ClusterMigrationLink" + +// ClusterMigrationNilKind is the name of the type used to nil references +// to objects of type 'cluster_migration'. +const ClusterMigrationNilKind = "ClusterMigrationNil" + +// ClusterMigration represents the values of the 'cluster_migration' type. +// +// Representation of a cluster migration. +type ClusterMigration struct { + bitmap_ uint32 + id string + href string + clusterID string + creationTimestamp time.Time + sdnToOvn *SdnToOvnClusterMigration + state *ClusterMigrationState + type_ ClusterMigrationType + updatedTimestamp time.Time +} + +// Kind returns the name of the type of the object. +func (o *ClusterMigration) Kind() string { + if o == nil { + return ClusterMigrationNilKind + } + if o.bitmap_&1 != 0 { + return ClusterMigrationLinkKind + } + return ClusterMigrationKind +} + +// Link returns true if this is a link. +func (o *ClusterMigration) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ClusterMigration) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ClusterMigration) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ClusterMigration) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ClusterMigration) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterMigration) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Internal cluster ID. +func (o *ClusterMigration) ClusterID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Internal cluster ID. +func (o *ClusterMigration) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clusterID + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the cluster migration was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *ClusterMigration) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the cluster migration was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *ClusterMigration) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// SdnToOvn returns the value of the 'sdn_to_ovn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for `SdnToOvn` cluster migrations. +func (o *ClusterMigration) SdnToOvn() *SdnToOvnClusterMigration { + if o != nil && o.bitmap_&32 != 0 { + return o.sdnToOvn + } + return nil +} + +// GetSdnToOvn returns the value of the 'sdn_to_ovn' attribute and +// a flag indicating if the attribute has a value. +// +// Details for `SdnToOvn` cluster migrations. +func (o *ClusterMigration) GetSdnToOvn() (value *SdnToOvnClusterMigration, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.sdnToOvn + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The state of the cluster migration. +func (o *ClusterMigration) State() *ClusterMigrationState { + if o != nil && o.bitmap_&64 != 0 { + return o.state + } + return nil +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// The state of the cluster migration. +func (o *ClusterMigration) GetState() (value *ClusterMigrationState, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.state + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of cluster migration. The rest of the attributes will be populated according to this +// value. For example, if the type is `sdnToOvn` then only the `SdnToOvn` attribute will be +// populated. +func (o *ClusterMigration) Type() ClusterMigrationType { + if o != nil && o.bitmap_&128 != 0 { + return o.type_ + } + return ClusterMigrationType("") +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of cluster migration. The rest of the attributes will be populated according to this +// value. For example, if the type is `sdnToOvn` then only the `SdnToOvn` attribute will be +// populated. +func (o *ClusterMigration) GetType() (value ClusterMigrationType, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.type_ + } + return +} + +// UpdatedTimestamp returns the value of the 'updated_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the cluster migration was last updated, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *ClusterMigration) UpdatedTimestamp() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.updatedTimestamp + } + return time.Time{} +} + +// GetUpdatedTimestamp returns the value of the 'updated_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the cluster migration was last updated, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *ClusterMigration) GetUpdatedTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.updatedTimestamp + } + return +} + +// ClusterMigrationListKind is the name of the type used to represent list of objects of +// type 'cluster_migration'. +const ClusterMigrationListKind = "ClusterMigrationList" + +// ClusterMigrationListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_migration'. +const ClusterMigrationListLinkKind = "ClusterMigrationListLink" + +// ClusterMigrationNilKind is the name of the type used to nil lists of objects of +// type 'cluster_migration'. +const ClusterMigrationListNilKind = "ClusterMigrationListNil" + +// ClusterMigrationList is a list of values of the 'cluster_migration' type. +type ClusterMigrationList struct { + href string + link bool + items []*ClusterMigration +} + +// Kind returns the name of the type of the object. +func (l *ClusterMigrationList) Kind() string { + if l == nil { + return ClusterMigrationListNilKind + } + if l.link { + return ClusterMigrationListLinkKind + } + return ClusterMigrationListKind +} + +// Link returns true iif this is a link. +func (l *ClusterMigrationList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ClusterMigrationList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ClusterMigrationList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ClusterMigrationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterMigrationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterMigrationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterMigrationList) SetItems(items []*ClusterMigration) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterMigrationList) Items() []*ClusterMigration { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterMigrationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterMigrationList) Get(i int) *ClusterMigration { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterMigrationList) Slice() []*ClusterMigration { + var slice []*ClusterMigration + if l == nil { + slice = make([]*ClusterMigration, 0) + } else { + slice = make([]*ClusterMigration, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterMigrationList) Each(f func(item *ClusterMigration) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterMigrationList) Range(f func(index int, item *ClusterMigration) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_migration_type_json.go b/clientapi/clustersmgmt/v1/cluster_migration_type_json.go new file mode 100644 index 00000000..2318bfa5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_type_json.go @@ -0,0 +1,195 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterMigration writes a value of the 'cluster_migration' type to the given writer. +func MarshalClusterMigration(object *ClusterMigration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterMigration(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterMigration writes a value of the 'cluster_migration' type to the given stream. +func WriteClusterMigration(object *ClusterMigration, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ClusterMigrationLinkKind) + } else { + stream.WriteString(ClusterMigrationKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 && object.sdnToOvn != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sdn_to_ovn") + WriteSdnToOvnClusterMigration(object.sdnToOvn, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.state != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + WriteClusterMigrationState(object.state, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(string(object.type_)) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_timestamp") + stream.WriteString((object.updatedTimestamp).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterMigration reads a value of the 'cluster_migration' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterMigration(source interface{}) (object *ClusterMigration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterMigration(iterator) + err = iterator.Error + return +} + +// ReadClusterMigration reads a value of the 'cluster_migration' type from the given iterator. +func ReadClusterMigration(iterator *jsoniter.Iterator) *ClusterMigration { + object := &ClusterMigration{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ClusterMigrationLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 8 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 16 + case "sdn_to_ovn": + value := ReadSdnToOvnClusterMigration(iterator) + object.sdnToOvn = value + object.bitmap_ |= 32 + case "state": + value := ReadClusterMigrationState(iterator) + object.state = value + object.bitmap_ |= 64 + case "type": + text := iterator.ReadString() + value := ClusterMigrationType(text) + object.type_ = value + object.bitmap_ |= 128 + case "updated_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.updatedTimestamp = value + object.bitmap_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_migration_type_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_migration_type_list_type_json.go new file mode 100644 index 00000000..ee0cad1a --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_type_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterMigrationTypeList writes a list of values of the 'cluster_migration_type' type to +// the given writer. +func MarshalClusterMigrationTypeList(list []ClusterMigrationType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterMigrationTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterMigrationTypeList writes a list of value of the 'cluster_migration_type' type to +// the given stream. +func WriteClusterMigrationTypeList(list []ClusterMigrationType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterMigrationTypeList reads a list of values of the 'cluster_migration_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterMigrationTypeList(source interface{}) (items []ClusterMigrationType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterMigrationTypeList(iterator) + err = iterator.Error + return +} + +// ReadClusterMigrationTypeList reads list of values of the ”cluster_migration_type' type from +// the given iterator. +func ReadClusterMigrationTypeList(iterator *jsoniter.Iterator) []ClusterMigrationType { + list := []ClusterMigrationType{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ClusterMigrationType(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_migration_type_type.go b/clientapi/clustersmgmt/v1/cluster_migration_type_type.go new file mode 100644 index 00000000..5a82c791 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_migration_type_type.go @@ -0,0 +1,28 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterMigrationType represents the values of the 'cluster_migration_type' enumerated type. +type ClusterMigrationType string + +const ( + // + ClusterMigrationTypeSdnToOvn ClusterMigrationType = "sdnToOvn" +) diff --git a/clientapi/clustersmgmt/v1/cluster_nodes_builder.go b/clientapi/clustersmgmt/v1/cluster_nodes_builder.go new file mode 100644 index 00000000..fafeb509 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_nodes_builder.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterNodesBuilder contains the data and logic needed to build 'cluster_nodes' objects. +// +// Counts of different classes of nodes inside a cluster. +type ClusterNodesBuilder struct { + bitmap_ uint32 + autoscaleCompute *MachinePoolAutoscalingBuilder + availabilityZones []string + compute int + computeLabels map[string]string + computeMachineType *MachineTypeBuilder + computeRootVolume *RootVolumeBuilder + infra int + infraMachineType *MachineTypeBuilder + master int + masterMachineType *MachineTypeBuilder + securityGroupFilters []*MachinePoolSecurityGroupFilterBuilder + total int +} + +// NewClusterNodes creates a new builder of 'cluster_nodes' objects. +func NewClusterNodes() *ClusterNodesBuilder { + return &ClusterNodesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterNodesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AutoscaleCompute sets the value of the 'autoscale_compute' attribute to the given value. +// +// Representation of a autoscaling in a machine pool. +func (b *ClusterNodesBuilder) AutoscaleCompute(value *MachinePoolAutoscalingBuilder) *ClusterNodesBuilder { + b.autoscaleCompute = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// AvailabilityZones sets the value of the 'availability_zones' attribute to the given values. +func (b *ClusterNodesBuilder) AvailabilityZones(values ...string) *ClusterNodesBuilder { + b.availabilityZones = make([]string, len(values)) + copy(b.availabilityZones, values) + b.bitmap_ |= 2 + return b +} + +// Compute sets the value of the 'compute' attribute to the given value. +func (b *ClusterNodesBuilder) Compute(value int) *ClusterNodesBuilder { + b.compute = value + b.bitmap_ |= 4 + return b +} + +// ComputeLabels sets the value of the 'compute_labels' attribute to the given value. +func (b *ClusterNodesBuilder) ComputeLabels(value map[string]string) *ClusterNodesBuilder { + b.computeLabels = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// ComputeMachineType sets the value of the 'compute_machine_type' attribute to the given value. +// +// Machine type. +func (b *ClusterNodesBuilder) ComputeMachineType(value *MachineTypeBuilder) *ClusterNodesBuilder { + b.computeMachineType = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// ComputeRootVolume sets the value of the 'compute_root_volume' attribute to the given value. +// +// Root volume capabilities. +func (b *ClusterNodesBuilder) ComputeRootVolume(value *RootVolumeBuilder) *ClusterNodesBuilder { + b.computeRootVolume = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Infra sets the value of the 'infra' attribute to the given value. +func (b *ClusterNodesBuilder) Infra(value int) *ClusterNodesBuilder { + b.infra = value + b.bitmap_ |= 64 + return b +} + +// InfraMachineType sets the value of the 'infra_machine_type' attribute to the given value. +// +// Machine type. +func (b *ClusterNodesBuilder) InfraMachineType(value *MachineTypeBuilder) *ClusterNodesBuilder { + b.infraMachineType = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// Master sets the value of the 'master' attribute to the given value. +func (b *ClusterNodesBuilder) Master(value int) *ClusterNodesBuilder { + b.master = value + b.bitmap_ |= 256 + return b +} + +// MasterMachineType sets the value of the 'master_machine_type' attribute to the given value. +// +// Machine type. +func (b *ClusterNodesBuilder) MasterMachineType(value *MachineTypeBuilder) *ClusterNodesBuilder { + b.masterMachineType = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// SecurityGroupFilters sets the value of the 'security_group_filters' attribute to the given values. +func (b *ClusterNodesBuilder) SecurityGroupFilters(values ...*MachinePoolSecurityGroupFilterBuilder) *ClusterNodesBuilder { + b.securityGroupFilters = make([]*MachinePoolSecurityGroupFilterBuilder, len(values)) + copy(b.securityGroupFilters, values) + b.bitmap_ |= 1024 + return b +} + +// Total sets the value of the 'total' attribute to the given value. +func (b *ClusterNodesBuilder) Total(value int) *ClusterNodesBuilder { + b.total = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterNodesBuilder) Copy(object *ClusterNodes) *ClusterNodesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.autoscaleCompute != nil { + b.autoscaleCompute = NewMachinePoolAutoscaling().Copy(object.autoscaleCompute) + } else { + b.autoscaleCompute = nil + } + if object.availabilityZones != nil { + b.availabilityZones = make([]string, len(object.availabilityZones)) + copy(b.availabilityZones, object.availabilityZones) + } else { + b.availabilityZones = nil + } + b.compute = object.compute + if len(object.computeLabels) > 0 { + b.computeLabels = map[string]string{} + for k, v := range object.computeLabels { + b.computeLabels[k] = v + } + } else { + b.computeLabels = nil + } + if object.computeMachineType != nil { + b.computeMachineType = NewMachineType().Copy(object.computeMachineType) + } else { + b.computeMachineType = nil + } + if object.computeRootVolume != nil { + b.computeRootVolume = NewRootVolume().Copy(object.computeRootVolume) + } else { + b.computeRootVolume = nil + } + b.infra = object.infra + if object.infraMachineType != nil { + b.infraMachineType = NewMachineType().Copy(object.infraMachineType) + } else { + b.infraMachineType = nil + } + b.master = object.master + if object.masterMachineType != nil { + b.masterMachineType = NewMachineType().Copy(object.masterMachineType) + } else { + b.masterMachineType = nil + } + if object.securityGroupFilters != nil { + b.securityGroupFilters = make([]*MachinePoolSecurityGroupFilterBuilder, len(object.securityGroupFilters)) + for i, v := range object.securityGroupFilters { + b.securityGroupFilters[i] = NewMachinePoolSecurityGroupFilter().Copy(v) + } + } else { + b.securityGroupFilters = nil + } + b.total = object.total + return b +} + +// Build creates a 'cluster_nodes' object using the configuration stored in the builder. +func (b *ClusterNodesBuilder) Build() (object *ClusterNodes, err error) { + object = new(ClusterNodes) + object.bitmap_ = b.bitmap_ + if b.autoscaleCompute != nil { + object.autoscaleCompute, err = b.autoscaleCompute.Build() + if err != nil { + return + } + } + if b.availabilityZones != nil { + object.availabilityZones = make([]string, len(b.availabilityZones)) + copy(object.availabilityZones, b.availabilityZones) + } + object.compute = b.compute + if b.computeLabels != nil { + object.computeLabels = make(map[string]string) + for k, v := range b.computeLabels { + object.computeLabels[k] = v + } + } + if b.computeMachineType != nil { + object.computeMachineType, err = b.computeMachineType.Build() + if err != nil { + return + } + } + if b.computeRootVolume != nil { + object.computeRootVolume, err = b.computeRootVolume.Build() + if err != nil { + return + } + } + object.infra = b.infra + if b.infraMachineType != nil { + object.infraMachineType, err = b.infraMachineType.Build() + if err != nil { + return + } + } + object.master = b.master + if b.masterMachineType != nil { + object.masterMachineType, err = b.masterMachineType.Build() + if err != nil { + return + } + } + if b.securityGroupFilters != nil { + object.securityGroupFilters = make([]*MachinePoolSecurityGroupFilter, len(b.securityGroupFilters)) + for i, v := range b.securityGroupFilters { + object.securityGroupFilters[i], err = v.Build() + if err != nil { + return + } + } + } + object.total = b.total + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_nodes_list_builder.go b/clientapi/clustersmgmt/v1/cluster_nodes_list_builder.go new file mode 100644 index 00000000..6cbbdedd --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_nodes_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterNodesListBuilder contains the data and logic needed to build +// 'cluster_nodes' objects. +type ClusterNodesListBuilder struct { + items []*ClusterNodesBuilder +} + +// NewClusterNodesList creates a new builder of 'cluster_nodes' objects. +func NewClusterNodesList() *ClusterNodesListBuilder { + return new(ClusterNodesListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterNodesListBuilder) Items(values ...*ClusterNodesBuilder) *ClusterNodesListBuilder { + b.items = make([]*ClusterNodesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterNodesListBuilder) 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 *ClusterNodesListBuilder) Copy(list *ClusterNodesList) *ClusterNodesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterNodesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterNodes().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_nodes' objects using the +// configuration stored in the builder. +func (b *ClusterNodesListBuilder) Build() (list *ClusterNodesList, err error) { + items := make([]*ClusterNodes, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterNodesList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_nodes_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_nodes_list_type_json.go new file mode 100644 index 00000000..7133f6ff --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_nodes_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterNodesList writes a list of values of the 'cluster_nodes' type to +// the given writer. +func MarshalClusterNodesList(list []*ClusterNodes, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterNodesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterNodesList writes a list of value of the 'cluster_nodes' type to +// the given stream. +func WriteClusterNodesList(list []*ClusterNodes, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterNodes(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterNodesList reads a list of values of the 'cluster_nodes' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterNodesList(source interface{}) (items []*ClusterNodes, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterNodesList(iterator) + err = iterator.Error + return +} + +// ReadClusterNodesList reads list of values of the ”cluster_nodes' type from +// the given iterator. +func ReadClusterNodesList(iterator *jsoniter.Iterator) []*ClusterNodes { + list := []*ClusterNodes{} + for iterator.ReadArray() { + item := ReadClusterNodes(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_nodes_type.go b/clientapi/clustersmgmt/v1/cluster_nodes_type.go new file mode 100644 index 00000000..b8b667a9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_nodes_type.go @@ -0,0 +1,433 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterNodes represents the values of the 'cluster_nodes' type. +// +// Counts of different classes of nodes inside a cluster. +type ClusterNodes struct { + bitmap_ uint32 + autoscaleCompute *MachinePoolAutoscaling + availabilityZones []string + compute int + computeLabels map[string]string + computeMachineType *MachineType + computeRootVolume *RootVolume + infra int + infraMachineType *MachineType + master int + masterMachineType *MachineType + securityGroupFilters []*MachinePoolSecurityGroupFilter + total int +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterNodes) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AutoscaleCompute returns the value of the 'autoscale_compute' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for auto-scaling the compute machine pool. +// Compute and AutoscaleCompute cannot be used together. +func (o *ClusterNodes) AutoscaleCompute() *MachinePoolAutoscaling { + if o != nil && o.bitmap_&1 != 0 { + return o.autoscaleCompute + } + return nil +} + +// GetAutoscaleCompute returns the value of the 'autoscale_compute' attribute and +// a flag indicating if the attribute has a value. +// +// Details for auto-scaling the compute machine pool. +// Compute and AutoscaleCompute cannot be used together. +func (o *ClusterNodes) GetAutoscaleCompute() (value *MachinePoolAutoscaling, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.autoscaleCompute + } + return +} + +// AvailabilityZones returns the value of the 'availability_zones' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The availability zones upon which the nodes are created. +func (o *ClusterNodes) AvailabilityZones() []string { + if o != nil && o.bitmap_&2 != 0 { + return o.availabilityZones + } + return nil +} + +// GetAvailabilityZones returns the value of the 'availability_zones' attribute and +// a flag indicating if the attribute has a value. +// +// The availability zones upon which the nodes are created. +func (o *ClusterNodes) GetAvailabilityZones() (value []string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.availabilityZones + } + return +} + +// Compute returns the value of the 'compute' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Number of compute nodes of the cluster. +// Compute and AutoscaleCompute cannot be used together. +func (o *ClusterNodes) Compute() int { + if o != nil && o.bitmap_&4 != 0 { + return o.compute + } + return 0 +} + +// GetCompute returns the value of the 'compute' attribute and +// a flag indicating if the attribute has a value. +// +// Number of compute nodes of the cluster. +// Compute and AutoscaleCompute cannot be used together. +func (o *ClusterNodes) GetCompute() (value int, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.compute + } + return +} + +// ComputeLabels returns the value of the 'compute_labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The labels set on the "default" compute machine pool. +func (o *ClusterNodes) ComputeLabels() map[string]string { + if o != nil && o.bitmap_&8 != 0 { + return o.computeLabels + } + return nil +} + +// GetComputeLabels returns the value of the 'compute_labels' attribute and +// a flag indicating if the attribute has a value. +// +// The labels set on the "default" compute machine pool. +func (o *ClusterNodes) GetComputeLabels() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.computeLabels + } + return +} + +// ComputeMachineType returns the value of the 'compute_machine_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The compute machine type to use, for example `r5.xlarge`. +func (o *ClusterNodes) ComputeMachineType() *MachineType { + if o != nil && o.bitmap_&16 != 0 { + return o.computeMachineType + } + return nil +} + +// GetComputeMachineType returns the value of the 'compute_machine_type' attribute and +// a flag indicating if the attribute has a value. +// +// The compute machine type to use, for example `r5.xlarge`. +func (o *ClusterNodes) GetComputeMachineType() (value *MachineType, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.computeMachineType + } + return +} + +// ComputeRootVolume returns the value of the 'compute_root_volume' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The compute machine root volume capabilities. +func (o *ClusterNodes) ComputeRootVolume() *RootVolume { + if o != nil && o.bitmap_&32 != 0 { + return o.computeRootVolume + } + return nil +} + +// GetComputeRootVolume returns the value of the 'compute_root_volume' attribute and +// a flag indicating if the attribute has a value. +// +// The compute machine root volume capabilities. +func (o *ClusterNodes) GetComputeRootVolume() (value *RootVolume, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.computeRootVolume + } + return +} + +// Infra returns the value of the 'infra' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Number of infrastructure nodes of the cluster. +func (o *ClusterNodes) Infra() int { + if o != nil && o.bitmap_&64 != 0 { + return o.infra + } + return 0 +} + +// GetInfra returns the value of the 'infra' attribute and +// a flag indicating if the attribute has a value. +// +// Number of infrastructure nodes of the cluster. +func (o *ClusterNodes) GetInfra() (value int, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.infra + } + return +} + +// InfraMachineType returns the value of the 'infra_machine_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The infra machine type to use, for example `r5.xlarge` (Optional). +func (o *ClusterNodes) InfraMachineType() *MachineType { + if o != nil && o.bitmap_&128 != 0 { + return o.infraMachineType + } + return nil +} + +// GetInfraMachineType returns the value of the 'infra_machine_type' attribute and +// a flag indicating if the attribute has a value. +// +// The infra machine type to use, for example `r5.xlarge` (Optional). +func (o *ClusterNodes) GetInfraMachineType() (value *MachineType, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.infraMachineType + } + return +} + +// Master returns the value of the 'master' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Number of master nodes of the cluster. +func (o *ClusterNodes) Master() int { + if o != nil && o.bitmap_&256 != 0 { + return o.master + } + return 0 +} + +// GetMaster returns the value of the 'master' attribute and +// a flag indicating if the attribute has a value. +// +// Number of master nodes of the cluster. +func (o *ClusterNodes) GetMaster() (value int, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.master + } + return +} + +// MasterMachineType returns the value of the 'master_machine_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The master machine type to use, for example `r5.xlarge` (Optional). +func (o *ClusterNodes) MasterMachineType() *MachineType { + if o != nil && o.bitmap_&512 != 0 { + return o.masterMachineType + } + return nil +} + +// GetMasterMachineType returns the value of the 'master_machine_type' attribute and +// a flag indicating if the attribute has a value. +// +// The master machine type to use, for example `r5.xlarge` (Optional). +func (o *ClusterNodes) GetMasterMachineType() (value *MachineType, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.masterMachineType + } + return +} + +// SecurityGroupFilters returns the value of the 'security_group_filters' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of security groups to be applied to nodes (Optional). +func (o *ClusterNodes) SecurityGroupFilters() []*MachinePoolSecurityGroupFilter { + if o != nil && o.bitmap_&1024 != 0 { + return o.securityGroupFilters + } + return nil +} + +// GetSecurityGroupFilters returns the value of the 'security_group_filters' attribute and +// a flag indicating if the attribute has a value. +// +// List of security groups to be applied to nodes (Optional). +func (o *ClusterNodes) GetSecurityGroupFilters() (value []*MachinePoolSecurityGroupFilter, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.securityGroupFilters + } + return +} + +// Total returns the value of the 'total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Total number of nodes of the cluster. +func (o *ClusterNodes) Total() int { + if o != nil && o.bitmap_&2048 != 0 { + return o.total + } + return 0 +} + +// GetTotal returns the value of the 'total' attribute and +// a flag indicating if the attribute has a value. +// +// Total number of nodes of the cluster. +func (o *ClusterNodes) GetTotal() (value int, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.total + } + return +} + +// ClusterNodesListKind is the name of the type used to represent list of objects of +// type 'cluster_nodes'. +const ClusterNodesListKind = "ClusterNodesList" + +// ClusterNodesListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_nodes'. +const ClusterNodesListLinkKind = "ClusterNodesListLink" + +// ClusterNodesNilKind is the name of the type used to nil lists of objects of +// type 'cluster_nodes'. +const ClusterNodesListNilKind = "ClusterNodesListNil" + +// ClusterNodesList is a list of values of the 'cluster_nodes' type. +type ClusterNodesList struct { + href string + link bool + items []*ClusterNodes +} + +// Len returns the length of the list. +func (l *ClusterNodesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterNodesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterNodesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterNodesList) SetItems(items []*ClusterNodes) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterNodesList) Items() []*ClusterNodes { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterNodesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterNodesList) Get(i int) *ClusterNodes { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterNodesList) Slice() []*ClusterNodes { + var slice []*ClusterNodes + if l == nil { + slice = make([]*ClusterNodes, 0) + } else { + slice = make([]*ClusterNodes, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterNodesList) Each(f func(item *ClusterNodes) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterNodesList) Range(f func(index int, item *ClusterNodes) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_nodes_type_json.go b/clientapi/clustersmgmt/v1/cluster_nodes_type_json.go new file mode 100644 index 00000000..d12eb11d --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_nodes_type_json.go @@ -0,0 +1,258 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterNodes writes a value of the 'cluster_nodes' type to the given writer. +func MarshalClusterNodes(object *ClusterNodes, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterNodes(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterNodes writes a value of the 'cluster_nodes' type to the given stream. +func WriteClusterNodes(object *ClusterNodes, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.autoscaleCompute != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("autoscale_compute") + WriteMachinePoolAutoscaling(object.autoscaleCompute, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.availabilityZones != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zones") + WriteStringList(object.availabilityZones, stream) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute") + stream.WriteInt(object.compute) + count++ + } + present_ = object.bitmap_&8 != 0 && object.computeLabels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute_labels") + if object.computeLabels != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.computeLabels)) + i := 0 + for key := range object.computeLabels { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.computeLabels[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&16 != 0 && object.computeMachineType != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute_machine_type") + WriteMachineType(object.computeMachineType, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.computeRootVolume != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute_root_volume") + WriteRootVolume(object.computeRootVolume, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("infra") + stream.WriteInt(object.infra) + count++ + } + present_ = object.bitmap_&128 != 0 && object.infraMachineType != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("infra_machine_type") + WriteMachineType(object.infraMachineType, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("master") + stream.WriteInt(object.master) + count++ + } + present_ = object.bitmap_&512 != 0 && object.masterMachineType != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("master_machine_type") + WriteMachineType(object.masterMachineType, stream) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.securityGroupFilters != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("security_group_filters") + WriteMachinePoolSecurityGroupFilterList(object.securityGroupFilters, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("total") + stream.WriteInt(object.total) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterNodes reads a value of the 'cluster_nodes' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterNodes(source interface{}) (object *ClusterNodes, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterNodes(iterator) + err = iterator.Error + return +} + +// ReadClusterNodes reads a value of the 'cluster_nodes' type from the given iterator. +func ReadClusterNodes(iterator *jsoniter.Iterator) *ClusterNodes { + object := &ClusterNodes{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "autoscale_compute": + value := ReadMachinePoolAutoscaling(iterator) + object.autoscaleCompute = value + object.bitmap_ |= 1 + case "availability_zones": + value := ReadStringList(iterator) + object.availabilityZones = value + object.bitmap_ |= 2 + case "compute": + value := iterator.ReadInt() + object.compute = value + object.bitmap_ |= 4 + case "compute_labels": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.computeLabels = value + object.bitmap_ |= 8 + case "compute_machine_type": + value := ReadMachineType(iterator) + object.computeMachineType = value + object.bitmap_ |= 16 + case "compute_root_volume": + value := ReadRootVolume(iterator) + object.computeRootVolume = value + object.bitmap_ |= 32 + case "infra": + value := iterator.ReadInt() + object.infra = value + object.bitmap_ |= 64 + case "infra_machine_type": + value := ReadMachineType(iterator) + object.infraMachineType = value + object.bitmap_ |= 128 + case "master": + value := iterator.ReadInt() + object.master = value + object.bitmap_ |= 256 + case "master_machine_type": + value := ReadMachineType(iterator) + object.masterMachineType = value + object.bitmap_ |= 512 + case "security_group_filters": + value := ReadMachinePoolSecurityGroupFilterList(iterator) + object.securityGroupFilters = value + object.bitmap_ |= 1024 + case "total": + value := iterator.ReadInt() + object.total = value + object.bitmap_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_operator_info_builder.go b/clientapi/clustersmgmt/v1/cluster_operator_info_builder.go new file mode 100644 index 00000000..0b2fde2a --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_operator_info_builder.go @@ -0,0 +1,107 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ClusterOperatorInfoBuilder contains the data and logic needed to build 'cluster_operator_info' objects. +type ClusterOperatorInfoBuilder struct { + bitmap_ uint32 + condition ClusterOperatorState + name string + reason string + time time.Time + version string +} + +// NewClusterOperatorInfo creates a new builder of 'cluster_operator_info' objects. +func NewClusterOperatorInfo() *ClusterOperatorInfoBuilder { + return &ClusterOperatorInfoBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterOperatorInfoBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Condition sets the value of the 'condition' attribute to the given value. +// +// Overall state of a cluster operator. +func (b *ClusterOperatorInfoBuilder) Condition(value ClusterOperatorState) *ClusterOperatorInfoBuilder { + b.condition = value + b.bitmap_ |= 1 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ClusterOperatorInfoBuilder) Name(value string) *ClusterOperatorInfoBuilder { + b.name = value + b.bitmap_ |= 2 + return b +} + +// Reason sets the value of the 'reason' attribute to the given value. +func (b *ClusterOperatorInfoBuilder) Reason(value string) *ClusterOperatorInfoBuilder { + b.reason = value + b.bitmap_ |= 4 + return b +} + +// Time sets the value of the 'time' attribute to the given value. +func (b *ClusterOperatorInfoBuilder) Time(value time.Time) *ClusterOperatorInfoBuilder { + b.time = value + b.bitmap_ |= 8 + return b +} + +// Version sets the value of the 'version' attribute to the given value. +func (b *ClusterOperatorInfoBuilder) Version(value string) *ClusterOperatorInfoBuilder { + b.version = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterOperatorInfoBuilder) Copy(object *ClusterOperatorInfo) *ClusterOperatorInfoBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.condition = object.condition + b.name = object.name + b.reason = object.reason + b.time = object.time + b.version = object.version + return b +} + +// Build creates a 'cluster_operator_info' object using the configuration stored in the builder. +func (b *ClusterOperatorInfoBuilder) Build() (object *ClusterOperatorInfo, err error) { + object = new(ClusterOperatorInfo) + object.bitmap_ = b.bitmap_ + object.condition = b.condition + object.name = b.name + object.reason = b.reason + object.time = b.time + object.version = b.version + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_operator_info_list_builder.go b/clientapi/clustersmgmt/v1/cluster_operator_info_list_builder.go new file mode 100644 index 00000000..197f5c0e --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_operator_info_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterOperatorInfoListBuilder contains the data and logic needed to build +// 'cluster_operator_info' objects. +type ClusterOperatorInfoListBuilder struct { + items []*ClusterOperatorInfoBuilder +} + +// NewClusterOperatorInfoList creates a new builder of 'cluster_operator_info' objects. +func NewClusterOperatorInfoList() *ClusterOperatorInfoListBuilder { + return new(ClusterOperatorInfoListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterOperatorInfoListBuilder) Items(values ...*ClusterOperatorInfoBuilder) *ClusterOperatorInfoListBuilder { + b.items = make([]*ClusterOperatorInfoBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterOperatorInfoListBuilder) 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 *ClusterOperatorInfoListBuilder) Copy(list *ClusterOperatorInfoList) *ClusterOperatorInfoListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterOperatorInfoBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterOperatorInfo().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_operator_info' objects using the +// configuration stored in the builder. +func (b *ClusterOperatorInfoListBuilder) Build() (list *ClusterOperatorInfoList, err error) { + items := make([]*ClusterOperatorInfo, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterOperatorInfoList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_operator_info_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_operator_info_list_type_json.go new file mode 100644 index 00000000..3ed5dce5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_operator_info_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterOperatorInfoList writes a list of values of the 'cluster_operator_info' type to +// the given writer. +func MarshalClusterOperatorInfoList(list []*ClusterOperatorInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterOperatorInfoList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterOperatorInfoList writes a list of value of the 'cluster_operator_info' type to +// the given stream. +func WriteClusterOperatorInfoList(list []*ClusterOperatorInfo, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterOperatorInfo(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterOperatorInfoList reads a list of values of the 'cluster_operator_info' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterOperatorInfoList(source interface{}) (items []*ClusterOperatorInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterOperatorInfoList(iterator) + err = iterator.Error + return +} + +// ReadClusterOperatorInfoList reads list of values of the ”cluster_operator_info' type from +// the given iterator. +func ReadClusterOperatorInfoList(iterator *jsoniter.Iterator) []*ClusterOperatorInfo { + list := []*ClusterOperatorInfo{} + for iterator.ReadArray() { + item := ReadClusterOperatorInfo(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_operator_info_type.go b/clientapi/clustersmgmt/v1/cluster_operator_info_type.go new file mode 100644 index 00000000..a5c74b91 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_operator_info_type.go @@ -0,0 +1,263 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ClusterOperatorInfo represents the values of the 'cluster_operator_info' type. +type ClusterOperatorInfo struct { + bitmap_ uint32 + condition ClusterOperatorState + name string + reason string + time time.Time + version string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterOperatorInfo) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Condition returns the value of the 'condition' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Operator status. Empty string if unknown. +func (o *ClusterOperatorInfo) Condition() ClusterOperatorState { + if o != nil && o.bitmap_&1 != 0 { + return o.condition + } + return ClusterOperatorState("") +} + +// GetCondition returns the value of the 'condition' attribute and +// a flag indicating if the attribute has a value. +// +// Operator status. Empty string if unknown. +func (o *ClusterOperatorInfo) GetCondition() (value ClusterOperatorState, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.condition + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the operator. +func (o *ClusterOperatorInfo) Name() string { + if o != nil && o.bitmap_&2 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the operator. +func (o *ClusterOperatorInfo) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.name + } + return +} + +// Reason returns the value of the 'reason' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Extra detail on condition, if available. Empty string if unknown. +func (o *ClusterOperatorInfo) Reason() string { + if o != nil && o.bitmap_&4 != 0 { + return o.reason + } + return "" +} + +// GetReason returns the value of the 'reason' attribute and +// a flag indicating if the attribute has a value. +// +// Extra detail on condition, if available. Empty string if unknown. +func (o *ClusterOperatorInfo) GetReason() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.reason + } + return +} + +// Time returns the value of the 'time' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Time when the sample was obtained, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format. +func (o *ClusterOperatorInfo) Time() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.time + } + return time.Time{} +} + +// GetTime returns the value of the 'time' attribute and +// a flag indicating if the attribute has a value. +// +// Time when the sample was obtained, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format. +func (o *ClusterOperatorInfo) GetTime() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.time + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Current version of the operator. Empty string if unknown. +func (o *ClusterOperatorInfo) Version() string { + if o != nil && o.bitmap_&16 != 0 { + return o.version + } + return "" +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +// +// Current version of the operator. Empty string if unknown. +func (o *ClusterOperatorInfo) GetVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.version + } + return +} + +// ClusterOperatorInfoListKind is the name of the type used to represent list of objects of +// type 'cluster_operator_info'. +const ClusterOperatorInfoListKind = "ClusterOperatorInfoList" + +// ClusterOperatorInfoListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_operator_info'. +const ClusterOperatorInfoListLinkKind = "ClusterOperatorInfoListLink" + +// ClusterOperatorInfoNilKind is the name of the type used to nil lists of objects of +// type 'cluster_operator_info'. +const ClusterOperatorInfoListNilKind = "ClusterOperatorInfoListNil" + +// ClusterOperatorInfoList is a list of values of the 'cluster_operator_info' type. +type ClusterOperatorInfoList struct { + href string + link bool + items []*ClusterOperatorInfo +} + +// Len returns the length of the list. +func (l *ClusterOperatorInfoList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterOperatorInfoList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterOperatorInfoList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterOperatorInfoList) SetItems(items []*ClusterOperatorInfo) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterOperatorInfoList) Items() []*ClusterOperatorInfo { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterOperatorInfoList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterOperatorInfoList) Get(i int) *ClusterOperatorInfo { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterOperatorInfoList) Slice() []*ClusterOperatorInfo { + var slice []*ClusterOperatorInfo + if l == nil { + slice = make([]*ClusterOperatorInfo, 0) + } else { + slice = make([]*ClusterOperatorInfo, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterOperatorInfoList) Each(f func(item *ClusterOperatorInfo) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterOperatorInfoList) Range(f func(index int, item *ClusterOperatorInfo) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_operator_info_type_json.go b/clientapi/clustersmgmt/v1/cluster_operator_info_type_json.go new file mode 100644 index 00000000..4b6c1b78 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_operator_info_type_json.go @@ -0,0 +1,144 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterOperatorInfo writes a value of the 'cluster_operator_info' type to the given writer. +func MarshalClusterOperatorInfo(object *ClusterOperatorInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterOperatorInfo(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterOperatorInfo writes a value of the 'cluster_operator_info' type to the given stream. +func WriteClusterOperatorInfo(object *ClusterOperatorInfo, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("condition") + stream.WriteString(string(object.condition)) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("reason") + stream.WriteString(object.reason) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("time") + stream.WriteString((object.time).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + stream.WriteString(object.version) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterOperatorInfo reads a value of the 'cluster_operator_info' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterOperatorInfo(source interface{}) (object *ClusterOperatorInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterOperatorInfo(iterator) + err = iterator.Error + return +} + +// ReadClusterOperatorInfo reads a value of the 'cluster_operator_info' type from the given iterator. +func ReadClusterOperatorInfo(iterator *jsoniter.Iterator) *ClusterOperatorInfo { + object := &ClusterOperatorInfo{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "condition": + text := iterator.ReadString() + value := ClusterOperatorState(text) + object.condition = value + object.bitmap_ |= 1 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 2 + case "reason": + value := iterator.ReadString() + object.reason = value + object.bitmap_ |= 4 + case "time": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.time = value + object.bitmap_ |= 8 + case "version": + value := iterator.ReadString() + object.version = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_operator_state_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_operator_state_list_type_json.go new file mode 100644 index 00000000..7cb1bca2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_operator_state_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterOperatorStateList writes a list of values of the 'cluster_operator_state' type to +// the given writer. +func MarshalClusterOperatorStateList(list []ClusterOperatorState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterOperatorStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterOperatorStateList writes a list of value of the 'cluster_operator_state' type to +// the given stream. +func WriteClusterOperatorStateList(list []ClusterOperatorState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterOperatorStateList reads a list of values of the 'cluster_operator_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterOperatorStateList(source interface{}) (items []ClusterOperatorState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterOperatorStateList(iterator) + err = iterator.Error + return +} + +// ReadClusterOperatorStateList reads list of values of the ”cluster_operator_state' type from +// the given iterator. +func ReadClusterOperatorStateList(iterator *jsoniter.Iterator) []ClusterOperatorState { + list := []ClusterOperatorState{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ClusterOperatorState(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_operator_state_type.go b/clientapi/clustersmgmt/v1/cluster_operator_state_type.go new file mode 100644 index 00000000..abe05d86 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_operator_state_type.go @@ -0,0 +1,34 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterOperatorState represents the values of the 'cluster_operator_state' enumerated type. +type ClusterOperatorState string + +const ( + // Operator is working normally. + ClusterOperatorStateAvailable ClusterOperatorState = "available" + // Operator is partially working, there is an issue. + ClusterOperatorStateDegraded ClusterOperatorState = "degraded" + // Operator is not running or not working. + ClusterOperatorStateFailing ClusterOperatorState = "failing" + // Operator is upgrading to newer version, possibly degraded until upgrade completes. + ClusterOperatorStateUpgrading ClusterOperatorState = "upgrading" +) diff --git a/clientapi/clustersmgmt/v1/cluster_operators_info_builder.go b/clientapi/clustersmgmt/v1/cluster_operators_info_builder.go new file mode 100644 index 00000000..8b0d2f5d --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_operators_info_builder.go @@ -0,0 +1,79 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterOperatorsInfoBuilder contains the data and logic needed to build 'cluster_operators_info' objects. +// +// Provides detailed information about the operators installed on the cluster. +type ClusterOperatorsInfoBuilder struct { + bitmap_ uint32 + operators []*ClusterOperatorInfoBuilder +} + +// NewClusterOperatorsInfo creates a new builder of 'cluster_operators_info' objects. +func NewClusterOperatorsInfo() *ClusterOperatorsInfoBuilder { + return &ClusterOperatorsInfoBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterOperatorsInfoBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Operators sets the value of the 'operators' attribute to the given values. +func (b *ClusterOperatorsInfoBuilder) Operators(values ...*ClusterOperatorInfoBuilder) *ClusterOperatorsInfoBuilder { + b.operators = make([]*ClusterOperatorInfoBuilder, len(values)) + copy(b.operators, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterOperatorsInfoBuilder) Copy(object *ClusterOperatorsInfo) *ClusterOperatorsInfoBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.operators != nil { + b.operators = make([]*ClusterOperatorInfoBuilder, len(object.operators)) + for i, v := range object.operators { + b.operators[i] = NewClusterOperatorInfo().Copy(v) + } + } else { + b.operators = nil + } + return b +} + +// Build creates a 'cluster_operators_info' object using the configuration stored in the builder. +func (b *ClusterOperatorsInfoBuilder) Build() (object *ClusterOperatorsInfo, err error) { + object = new(ClusterOperatorsInfo) + object.bitmap_ = b.bitmap_ + if b.operators != nil { + object.operators = make([]*ClusterOperatorInfo, len(b.operators)) + for i, v := range b.operators { + object.operators[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_operators_info_list_builder.go b/clientapi/clustersmgmt/v1/cluster_operators_info_list_builder.go new file mode 100644 index 00000000..7fbd2a1e --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_operators_info_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterOperatorsInfoListBuilder contains the data and logic needed to build +// 'cluster_operators_info' objects. +type ClusterOperatorsInfoListBuilder struct { + items []*ClusterOperatorsInfoBuilder +} + +// NewClusterOperatorsInfoList creates a new builder of 'cluster_operators_info' objects. +func NewClusterOperatorsInfoList() *ClusterOperatorsInfoListBuilder { + return new(ClusterOperatorsInfoListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterOperatorsInfoListBuilder) Items(values ...*ClusterOperatorsInfoBuilder) *ClusterOperatorsInfoListBuilder { + b.items = make([]*ClusterOperatorsInfoBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterOperatorsInfoListBuilder) 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 *ClusterOperatorsInfoListBuilder) Copy(list *ClusterOperatorsInfoList) *ClusterOperatorsInfoListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterOperatorsInfoBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterOperatorsInfo().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_operators_info' objects using the +// configuration stored in the builder. +func (b *ClusterOperatorsInfoListBuilder) Build() (list *ClusterOperatorsInfoList, err error) { + items := make([]*ClusterOperatorsInfo, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterOperatorsInfoList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_operators_info_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_operators_info_list_type_json.go new file mode 100644 index 00000000..c8c9a619 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_operators_info_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterOperatorsInfoList writes a list of values of the 'cluster_operators_info' type to +// the given writer. +func MarshalClusterOperatorsInfoList(list []*ClusterOperatorsInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterOperatorsInfoList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterOperatorsInfoList writes a list of value of the 'cluster_operators_info' type to +// the given stream. +func WriteClusterOperatorsInfoList(list []*ClusterOperatorsInfo, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterOperatorsInfo(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterOperatorsInfoList reads a list of values of the 'cluster_operators_info' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterOperatorsInfoList(source interface{}) (items []*ClusterOperatorsInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterOperatorsInfoList(iterator) + err = iterator.Error + return +} + +// ReadClusterOperatorsInfoList reads list of values of the ”cluster_operators_info' type from +// the given iterator. +func ReadClusterOperatorsInfoList(iterator *jsoniter.Iterator) []*ClusterOperatorsInfo { + list := []*ClusterOperatorsInfo{} + for iterator.ReadArray() { + item := ReadClusterOperatorsInfo(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_operators_info_type.go b/clientapi/clustersmgmt/v1/cluster_operators_info_type.go new file mode 100644 index 00000000..5c298cc1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_operators_info_type.go @@ -0,0 +1,161 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterOperatorsInfo represents the values of the 'cluster_operators_info' type. +// +// Provides detailed information about the operators installed on the cluster. +type ClusterOperatorsInfo struct { + bitmap_ uint32 + operators []*ClusterOperatorInfo +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterOperatorsInfo) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Operators returns the value of the 'operators' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterOperatorsInfo) Operators() []*ClusterOperatorInfo { + if o != nil && o.bitmap_&1 != 0 { + return o.operators + } + return nil +} + +// GetOperators returns the value of the 'operators' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterOperatorsInfo) GetOperators() (value []*ClusterOperatorInfo, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.operators + } + return +} + +// ClusterOperatorsInfoListKind is the name of the type used to represent list of objects of +// type 'cluster_operators_info'. +const ClusterOperatorsInfoListKind = "ClusterOperatorsInfoList" + +// ClusterOperatorsInfoListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_operators_info'. +const ClusterOperatorsInfoListLinkKind = "ClusterOperatorsInfoListLink" + +// ClusterOperatorsInfoNilKind is the name of the type used to nil lists of objects of +// type 'cluster_operators_info'. +const ClusterOperatorsInfoListNilKind = "ClusterOperatorsInfoListNil" + +// ClusterOperatorsInfoList is a list of values of the 'cluster_operators_info' type. +type ClusterOperatorsInfoList struct { + href string + link bool + items []*ClusterOperatorsInfo +} + +// Len returns the length of the list. +func (l *ClusterOperatorsInfoList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterOperatorsInfoList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterOperatorsInfoList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterOperatorsInfoList) SetItems(items []*ClusterOperatorsInfo) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterOperatorsInfoList) Items() []*ClusterOperatorsInfo { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterOperatorsInfoList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterOperatorsInfoList) Get(i int) *ClusterOperatorsInfo { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterOperatorsInfoList) Slice() []*ClusterOperatorsInfo { + var slice []*ClusterOperatorsInfo + if l == nil { + slice = make([]*ClusterOperatorsInfo, 0) + } else { + slice = make([]*ClusterOperatorsInfo, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterOperatorsInfoList) Each(f func(item *ClusterOperatorsInfo) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterOperatorsInfoList) Range(f func(index int, item *ClusterOperatorsInfo) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_operators_info_type_json.go b/clientapi/clustersmgmt/v1/cluster_operators_info_type_json.go new file mode 100644 index 00000000..fa3fbc04 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_operators_info_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterOperatorsInfo writes a value of the 'cluster_operators_info' type to the given writer. +func MarshalClusterOperatorsInfo(object *ClusterOperatorsInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterOperatorsInfo(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterOperatorsInfo writes a value of the 'cluster_operators_info' type to the given stream. +func WriteClusterOperatorsInfo(object *ClusterOperatorsInfo, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.operators != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operators") + WriteClusterOperatorInfoList(object.operators, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterOperatorsInfo reads a value of the 'cluster_operators_info' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterOperatorsInfo(source interface{}) (object *ClusterOperatorsInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterOperatorsInfo(iterator) + err = iterator.Error + return +} + +// ReadClusterOperatorsInfo reads a value of the 'cluster_operators_info' type from the given iterator. +func ReadClusterOperatorsInfo(iterator *jsoniter.Iterator) *ClusterOperatorsInfo { + object := &ClusterOperatorsInfo{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "operators": + value := ReadClusterOperatorInfoList(iterator) + object.operators = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_registration_builder.go b/clientapi/clustersmgmt/v1/cluster_registration_builder.go new file mode 100644 index 00000000..904a484f --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_registration_builder.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterRegistrationBuilder contains the data and logic needed to build 'cluster_registration' objects. +// +// Registration of a new cluster to the service. +// +// For example, to register a cluster that has been provisioned outside +// of this service, send a a request like this: +// +// ```http +// POST /api/clusters_mgmt/v1/register_cluster HTTP/1.1 +// ``` +// +// With a request body like this: +// +// ```json +// +// { +// "external_id": "d656aecf-11a6-4782-ad86-8f72638449ba", +// "subscription_id": "...", +// "organization_id": "..." +// } +// +// ``` +type ClusterRegistrationBuilder struct { + bitmap_ uint32 + consoleUrl string + externalID string + organizationID string + subscriptionID string +} + +// NewClusterRegistration creates a new builder of 'cluster_registration' objects. +func NewClusterRegistration() *ClusterRegistrationBuilder { + return &ClusterRegistrationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterRegistrationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ConsoleUrl sets the value of the 'console_url' attribute to the given value. +func (b *ClusterRegistrationBuilder) ConsoleUrl(value string) *ClusterRegistrationBuilder { + b.consoleUrl = value + b.bitmap_ |= 1 + return b +} + +// ExternalID sets the value of the 'external_ID' attribute to the given value. +func (b *ClusterRegistrationBuilder) ExternalID(value string) *ClusterRegistrationBuilder { + b.externalID = value + b.bitmap_ |= 2 + return b +} + +// OrganizationID sets the value of the 'organization_ID' attribute to the given value. +func (b *ClusterRegistrationBuilder) OrganizationID(value string) *ClusterRegistrationBuilder { + b.organizationID = value + b.bitmap_ |= 4 + return b +} + +// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value. +func (b *ClusterRegistrationBuilder) SubscriptionID(value string) *ClusterRegistrationBuilder { + b.subscriptionID = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterRegistrationBuilder) Copy(object *ClusterRegistration) *ClusterRegistrationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.consoleUrl = object.consoleUrl + b.externalID = object.externalID + b.organizationID = object.organizationID + b.subscriptionID = object.subscriptionID + return b +} + +// Build creates a 'cluster_registration' object using the configuration stored in the builder. +func (b *ClusterRegistrationBuilder) Build() (object *ClusterRegistration, err error) { + object = new(ClusterRegistration) + object.bitmap_ = b.bitmap_ + object.consoleUrl = b.consoleUrl + object.externalID = b.externalID + object.organizationID = b.organizationID + object.subscriptionID = b.subscriptionID + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_registration_list_builder.go b/clientapi/clustersmgmt/v1/cluster_registration_list_builder.go new file mode 100644 index 00000000..e6336cfa --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_registration_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterRegistrationListBuilder contains the data and logic needed to build +// 'cluster_registration' objects. +type ClusterRegistrationListBuilder struct { + items []*ClusterRegistrationBuilder +} + +// NewClusterRegistrationList creates a new builder of 'cluster_registration' objects. +func NewClusterRegistrationList() *ClusterRegistrationListBuilder { + return new(ClusterRegistrationListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterRegistrationListBuilder) Items(values ...*ClusterRegistrationBuilder) *ClusterRegistrationListBuilder { + b.items = make([]*ClusterRegistrationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterRegistrationListBuilder) 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 *ClusterRegistrationListBuilder) Copy(list *ClusterRegistrationList) *ClusterRegistrationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterRegistrationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterRegistration().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_registration' objects using the +// configuration stored in the builder. +func (b *ClusterRegistrationListBuilder) Build() (list *ClusterRegistrationList, err error) { + items := make([]*ClusterRegistration, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterRegistrationList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_registration_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_registration_list_type_json.go new file mode 100644 index 00000000..23bbaf11 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_registration_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterRegistrationList writes a list of values of the 'cluster_registration' type to +// the given writer. +func MarshalClusterRegistrationList(list []*ClusterRegistration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterRegistrationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterRegistrationList writes a list of value of the 'cluster_registration' type to +// the given stream. +func WriteClusterRegistrationList(list []*ClusterRegistration, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterRegistration(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterRegistrationList reads a list of values of the 'cluster_registration' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterRegistrationList(source interface{}) (items []*ClusterRegistration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterRegistrationList(iterator) + err = iterator.Error + return +} + +// ReadClusterRegistrationList reads list of values of the ”cluster_registration' type from +// the given iterator. +func ReadClusterRegistrationList(iterator *jsoniter.Iterator) []*ClusterRegistration { + list := []*ClusterRegistration{} + for iterator.ReadArray() { + item := ReadClusterRegistration(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_registration_type.go b/clientapi/clustersmgmt/v1/cluster_registration_type.go new file mode 100644 index 00000000..17fcdae0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_registration_type.go @@ -0,0 +1,260 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterRegistration represents the values of the 'cluster_registration' type. +// +// Registration of a new cluster to the service. +// +// For example, to register a cluster that has been provisioned outside +// of this service, send a a request like this: +// +// ```http +// POST /api/clusters_mgmt/v1/register_cluster HTTP/1.1 +// ``` +// +// With a request body like this: +// +// ```json +// +// { +// "external_id": "d656aecf-11a6-4782-ad86-8f72638449ba", +// "subscription_id": "...", +// "organization_id": "..." +// } +// +// ``` +type ClusterRegistration struct { + bitmap_ uint32 + consoleUrl string + externalID string + organizationID string + subscriptionID string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterRegistration) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ConsoleUrl returns the value of the 'console_url' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional Console URL of the cluster. +func (o *ClusterRegistration) ConsoleUrl() string { + if o != nil && o.bitmap_&1 != 0 { + return o.consoleUrl + } + return "" +} + +// GetConsoleUrl returns the value of the 'console_url' attribute and +// a flag indicating if the attribute has a value. +// +// Optional Console URL of the cluster. +func (o *ClusterRegistration) GetConsoleUrl() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.consoleUrl + } + return +} + +// ExternalID returns the value of the 'external_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Identifier of the cluster generated by the installer. +func (o *ClusterRegistration) ExternalID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.externalID + } + return "" +} + +// GetExternalID returns the value of the 'external_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Identifier of the cluster generated by the installer. +func (o *ClusterRegistration) GetExternalID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.externalID + } + return +} + +// OrganizationID returns the value of the 'organization_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Organization identifier of the cluster generated by the +// account manager. +func (o *ClusterRegistration) OrganizationID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.organizationID + } + return "" +} + +// GetOrganizationID returns the value of the 'organization_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Organization identifier of the cluster generated by the +// account manager. +func (o *ClusterRegistration) GetOrganizationID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.organizationID + } + return +} + +// SubscriptionID returns the value of the 'subscription_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Subscription identifier of the cluster generated by the account +// manager. +func (o *ClusterRegistration) SubscriptionID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.subscriptionID + } + return "" +} + +// GetSubscriptionID returns the value of the 'subscription_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Subscription identifier of the cluster generated by the account +// manager. +func (o *ClusterRegistration) GetSubscriptionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.subscriptionID + } + return +} + +// ClusterRegistrationListKind is the name of the type used to represent list of objects of +// type 'cluster_registration'. +const ClusterRegistrationListKind = "ClusterRegistrationList" + +// ClusterRegistrationListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_registration'. +const ClusterRegistrationListLinkKind = "ClusterRegistrationListLink" + +// ClusterRegistrationNilKind is the name of the type used to nil lists of objects of +// type 'cluster_registration'. +const ClusterRegistrationListNilKind = "ClusterRegistrationListNil" + +// ClusterRegistrationList is a list of values of the 'cluster_registration' type. +type ClusterRegistrationList struct { + href string + link bool + items []*ClusterRegistration +} + +// Len returns the length of the list. +func (l *ClusterRegistrationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterRegistrationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterRegistrationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterRegistrationList) SetItems(items []*ClusterRegistration) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterRegistrationList) Items() []*ClusterRegistration { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterRegistrationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterRegistrationList) Get(i int) *ClusterRegistration { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterRegistrationList) Slice() []*ClusterRegistration { + var slice []*ClusterRegistration + if l == nil { + slice = make([]*ClusterRegistration, 0) + } else { + slice = make([]*ClusterRegistration, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterRegistrationList) Each(f func(item *ClusterRegistration) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterRegistrationList) Range(f func(index int, item *ClusterRegistration) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_registration_type_json.go b/clientapi/clustersmgmt/v1/cluster_registration_type_json.go new file mode 100644 index 00000000..18eb67dc --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_registration_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterRegistration writes a value of the 'cluster_registration' type to the given writer. +func MarshalClusterRegistration(object *ClusterRegistration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterRegistration(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterRegistration writes a value of the 'cluster_registration' type to the given stream. +func WriteClusterRegistration(object *ClusterRegistration, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("console_url") + stream.WriteString(object.consoleUrl) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_id") + stream.WriteString(object.externalID) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationID) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionID) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterRegistration reads a value of the 'cluster_registration' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterRegistration(source interface{}) (object *ClusterRegistration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterRegistration(iterator) + err = iterator.Error + return +} + +// ReadClusterRegistration reads a value of the 'cluster_registration' type from the given iterator. +func ReadClusterRegistration(iterator *jsoniter.Iterator) *ClusterRegistration { + object := &ClusterRegistration{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "console_url": + value := iterator.ReadString() + object.consoleUrl = value + object.bitmap_ |= 1 + case "external_id": + value := iterator.ReadString() + object.externalID = value + object.bitmap_ |= 2 + case "organization_id": + value := iterator.ReadString() + object.organizationID = value + object.bitmap_ |= 4 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionID = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_registry_config_builder.go b/clientapi/clustersmgmt/v1/cluster_registry_config_builder.go new file mode 100644 index 00000000..1c3817db --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_registry_config_builder.go @@ -0,0 +1,173 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterRegistryConfigBuilder contains the data and logic needed to build 'cluster_registry_config' objects. +// +// ClusterRegistryConfig describes the configuration of registries for the cluster. +// Its format reflects the OpenShift Image Configuration, for which docs are available on +// [docs.openshift.com](https://docs.openshift.com/container-platform/4.16/openshift_images/image-configuration.html) +// ```json +// +// { +// "registry_config": { +// "registry_sources": { +// "blocked_registries": [ +// "badregistry.io", +// "badregistry8.io" +// ] +// } +// } +// } +// +// ``` +type ClusterRegistryConfigBuilder struct { + bitmap_ uint32 + additionalTrustedCa map[string]string + allowedRegistriesForImport []*RegistryLocationBuilder + platformAllowlist *RegistryAllowlistBuilder + registrySources *RegistrySourcesBuilder +} + +// NewClusterRegistryConfig creates a new builder of 'cluster_registry_config' objects. +func NewClusterRegistryConfig() *ClusterRegistryConfigBuilder { + return &ClusterRegistryConfigBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterRegistryConfigBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AdditionalTrustedCa sets the value of the 'additional_trusted_ca' attribute to the given value. +func (b *ClusterRegistryConfigBuilder) AdditionalTrustedCa(value map[string]string) *ClusterRegistryConfigBuilder { + b.additionalTrustedCa = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// AllowedRegistriesForImport sets the value of the 'allowed_registries_for_import' attribute to the given values. +func (b *ClusterRegistryConfigBuilder) AllowedRegistriesForImport(values ...*RegistryLocationBuilder) *ClusterRegistryConfigBuilder { + b.allowedRegistriesForImport = make([]*RegistryLocationBuilder, len(values)) + copy(b.allowedRegistriesForImport, values) + b.bitmap_ |= 2 + return b +} + +// PlatformAllowlist sets the value of the 'platform_allowlist' attribute to the given value. +// +// RegistryAllowlist represents a single registry allowlist. +func (b *ClusterRegistryConfigBuilder) PlatformAllowlist(value *RegistryAllowlistBuilder) *ClusterRegistryConfigBuilder { + b.platformAllowlist = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// RegistrySources sets the value of the 'registry_sources' attribute to the given value. +// +// RegistrySources contains configuration that determines how the container runtime should treat individual +// registries when accessing images for builds and pods. For instance, whether or not to allow insecure access. +// It does not contain configuration for the internal cluster registry. +func (b *ClusterRegistryConfigBuilder) RegistrySources(value *RegistrySourcesBuilder) *ClusterRegistryConfigBuilder { + b.registrySources = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterRegistryConfigBuilder) Copy(object *ClusterRegistryConfig) *ClusterRegistryConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if len(object.additionalTrustedCa) > 0 { + b.additionalTrustedCa = map[string]string{} + for k, v := range object.additionalTrustedCa { + b.additionalTrustedCa[k] = v + } + } else { + b.additionalTrustedCa = nil + } + if object.allowedRegistriesForImport != nil { + b.allowedRegistriesForImport = make([]*RegistryLocationBuilder, len(object.allowedRegistriesForImport)) + for i, v := range object.allowedRegistriesForImport { + b.allowedRegistriesForImport[i] = NewRegistryLocation().Copy(v) + } + } else { + b.allowedRegistriesForImport = nil + } + if object.platformAllowlist != nil { + b.platformAllowlist = NewRegistryAllowlist().Copy(object.platformAllowlist) + } else { + b.platformAllowlist = nil + } + if object.registrySources != nil { + b.registrySources = NewRegistrySources().Copy(object.registrySources) + } else { + b.registrySources = nil + } + return b +} + +// Build creates a 'cluster_registry_config' object using the configuration stored in the builder. +func (b *ClusterRegistryConfigBuilder) Build() (object *ClusterRegistryConfig, err error) { + object = new(ClusterRegistryConfig) + object.bitmap_ = b.bitmap_ + if b.additionalTrustedCa != nil { + object.additionalTrustedCa = make(map[string]string) + for k, v := range b.additionalTrustedCa { + object.additionalTrustedCa[k] = v + } + } + if b.allowedRegistriesForImport != nil { + object.allowedRegistriesForImport = make([]*RegistryLocation, len(b.allowedRegistriesForImport)) + for i, v := range b.allowedRegistriesForImport { + object.allowedRegistriesForImport[i], err = v.Build() + if err != nil { + return + } + } + } + if b.platformAllowlist != nil { + object.platformAllowlist, err = b.platformAllowlist.Build() + if err != nil { + return + } + } + if b.registrySources != nil { + object.registrySources, err = b.registrySources.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_registry_config_list_builder.go b/clientapi/clustersmgmt/v1/cluster_registry_config_list_builder.go new file mode 100644 index 00000000..21acb5e5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_registry_config_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterRegistryConfigListBuilder contains the data and logic needed to build +// 'cluster_registry_config' objects. +type ClusterRegistryConfigListBuilder struct { + items []*ClusterRegistryConfigBuilder +} + +// NewClusterRegistryConfigList creates a new builder of 'cluster_registry_config' objects. +func NewClusterRegistryConfigList() *ClusterRegistryConfigListBuilder { + return new(ClusterRegistryConfigListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterRegistryConfigListBuilder) Items(values ...*ClusterRegistryConfigBuilder) *ClusterRegistryConfigListBuilder { + b.items = make([]*ClusterRegistryConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterRegistryConfigListBuilder) 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 *ClusterRegistryConfigListBuilder) Copy(list *ClusterRegistryConfigList) *ClusterRegistryConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterRegistryConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterRegistryConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_registry_config' objects using the +// configuration stored in the builder. +func (b *ClusterRegistryConfigListBuilder) Build() (list *ClusterRegistryConfigList, err error) { + items := make([]*ClusterRegistryConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterRegistryConfigList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_registry_config_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_registry_config_list_type_json.go new file mode 100644 index 00000000..ea52ec7a --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_registry_config_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterRegistryConfigList writes a list of values of the 'cluster_registry_config' type to +// the given writer. +func MarshalClusterRegistryConfigList(list []*ClusterRegistryConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterRegistryConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterRegistryConfigList writes a list of value of the 'cluster_registry_config' type to +// the given stream. +func WriteClusterRegistryConfigList(list []*ClusterRegistryConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterRegistryConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterRegistryConfigList reads a list of values of the 'cluster_registry_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterRegistryConfigList(source interface{}) (items []*ClusterRegistryConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterRegistryConfigList(iterator) + err = iterator.Error + return +} + +// ReadClusterRegistryConfigList reads list of values of the ”cluster_registry_config' type from +// the given iterator. +func ReadClusterRegistryConfigList(iterator *jsoniter.Iterator) []*ClusterRegistryConfig { + list := []*ClusterRegistryConfig{} + for iterator.ReadArray() { + item := ReadClusterRegistryConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_registry_config_type.go b/clientapi/clustersmgmt/v1/cluster_registry_config_type.go new file mode 100644 index 00000000..b82ef294 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_registry_config_type.go @@ -0,0 +1,275 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterRegistryConfig represents the values of the 'cluster_registry_config' type. +// +// ClusterRegistryConfig describes the configuration of registries for the cluster. +// Its format reflects the OpenShift Image Configuration, for which docs are available on +// [docs.openshift.com](https://docs.openshift.com/container-platform/4.16/openshift_images/image-configuration.html) +// ```json +// +// { +// "registry_config": { +// "registry_sources": { +// "blocked_registries": [ +// "badregistry.io", +// "badregistry8.io" +// ] +// } +// } +// } +// +// ``` +type ClusterRegistryConfig struct { + bitmap_ uint32 + additionalTrustedCa map[string]string + allowedRegistriesForImport []*RegistryLocation + platformAllowlist *RegistryAllowlist + registrySources *RegistrySources +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterRegistryConfig) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AdditionalTrustedCa returns the value of the 'additional_trusted_ca' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// A map containing the registry hostname as the key, and the PEM-encoded certificate as the value, +// for each additional registry CA to trust. +func (o *ClusterRegistryConfig) AdditionalTrustedCa() map[string]string { + if o != nil && o.bitmap_&1 != 0 { + return o.additionalTrustedCa + } + return nil +} + +// GetAdditionalTrustedCa returns the value of the 'additional_trusted_ca' attribute and +// a flag indicating if the attribute has a value. +// +// A map containing the registry hostname as the key, and the PEM-encoded certificate as the value, +// for each additional registry CA to trust. +func (o *ClusterRegistryConfig) GetAdditionalTrustedCa() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.additionalTrustedCa + } + return +} + +// AllowedRegistriesForImport returns the value of the 'allowed_registries_for_import' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AllowedRegistriesForImport limits the container image registries that normal users may import +// images from. Set this list to the registries that you trust to contain valid Docker +// images and that you want applications to be able to import from. Users with +// permission to create Images or ImageStreamMappings via the API are not affected by +// this policy - typically only administrators or system integrations will have those +// permissions. +func (o *ClusterRegistryConfig) AllowedRegistriesForImport() []*RegistryLocation { + if o != nil && o.bitmap_&2 != 0 { + return o.allowedRegistriesForImport + } + return nil +} + +// GetAllowedRegistriesForImport returns the value of the 'allowed_registries_for_import' attribute and +// a flag indicating if the attribute has a value. +// +// AllowedRegistriesForImport limits the container image registries that normal users may import +// images from. Set this list to the registries that you trust to contain valid Docker +// images and that you want applications to be able to import from. Users with +// permission to create Images or ImageStreamMappings via the API are not affected by +// this policy - typically only administrators or system integrations will have those +// permissions. +func (o *ClusterRegistryConfig) GetAllowedRegistriesForImport() (value []*RegistryLocation, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.allowedRegistriesForImport + } + return +} + +// PlatformAllowlist returns the value of the 'platform_allowlist' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// PlatformAllowlist contains a reference to a RegistryAllowlist which is a list of internal registries +// which needs to be whitelisted for the platform to work. It can be omitted at creation and +// updating and its lifecycle can be managed separately if needed. +func (o *ClusterRegistryConfig) PlatformAllowlist() *RegistryAllowlist { + if o != nil && o.bitmap_&4 != 0 { + return o.platformAllowlist + } + return nil +} + +// GetPlatformAllowlist returns the value of the 'platform_allowlist' attribute and +// a flag indicating if the attribute has a value. +// +// PlatformAllowlist contains a reference to a RegistryAllowlist which is a list of internal registries +// which needs to be whitelisted for the platform to work. It can be omitted at creation and +// updating and its lifecycle can be managed separately if needed. +func (o *ClusterRegistryConfig) GetPlatformAllowlist() (value *RegistryAllowlist, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.platformAllowlist + } + return +} + +// RegistrySources returns the value of the 'registry_sources' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// RegistrySources contains configuration that determines how the container runtime +// should treat individual registries when accessing images for builds+pods. (e.g. +// whether or not to allow insecure access). It does not contain configuration for the +// internal cluster registry. +func (o *ClusterRegistryConfig) RegistrySources() *RegistrySources { + if o != nil && o.bitmap_&8 != 0 { + return o.registrySources + } + return nil +} + +// GetRegistrySources returns the value of the 'registry_sources' attribute and +// a flag indicating if the attribute has a value. +// +// RegistrySources contains configuration that determines how the container runtime +// should treat individual registries when accessing images for builds+pods. (e.g. +// whether or not to allow insecure access). It does not contain configuration for the +// internal cluster registry. +func (o *ClusterRegistryConfig) GetRegistrySources() (value *RegistrySources, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.registrySources + } + return +} + +// ClusterRegistryConfigListKind is the name of the type used to represent list of objects of +// type 'cluster_registry_config'. +const ClusterRegistryConfigListKind = "ClusterRegistryConfigList" + +// ClusterRegistryConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_registry_config'. +const ClusterRegistryConfigListLinkKind = "ClusterRegistryConfigListLink" + +// ClusterRegistryConfigNilKind is the name of the type used to nil lists of objects of +// type 'cluster_registry_config'. +const ClusterRegistryConfigListNilKind = "ClusterRegistryConfigListNil" + +// ClusterRegistryConfigList is a list of values of the 'cluster_registry_config' type. +type ClusterRegistryConfigList struct { + href string + link bool + items []*ClusterRegistryConfig +} + +// Len returns the length of the list. +func (l *ClusterRegistryConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterRegistryConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterRegistryConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterRegistryConfigList) SetItems(items []*ClusterRegistryConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterRegistryConfigList) Items() []*ClusterRegistryConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterRegistryConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterRegistryConfigList) Get(i int) *ClusterRegistryConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterRegistryConfigList) Slice() []*ClusterRegistryConfig { + var slice []*ClusterRegistryConfig + if l == nil { + slice = make([]*ClusterRegistryConfig, 0) + } else { + slice = make([]*ClusterRegistryConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterRegistryConfigList) Each(f func(item *ClusterRegistryConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterRegistryConfigList) Range(f func(index int, item *ClusterRegistryConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_registry_config_type_json.go b/clientapi/clustersmgmt/v1/cluster_registry_config_type_json.go new file mode 100644 index 00000000..83e63a07 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_registry_config_type_json.go @@ -0,0 +1,154 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterRegistryConfig writes a value of the 'cluster_registry_config' type to the given writer. +func MarshalClusterRegistryConfig(object *ClusterRegistryConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterRegistryConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterRegistryConfig writes a value of the 'cluster_registry_config' type to the given stream. +func WriteClusterRegistryConfig(object *ClusterRegistryConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.additionalTrustedCa != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_trusted_ca") + if object.additionalTrustedCa != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.additionalTrustedCa)) + i := 0 + for key := range object.additionalTrustedCa { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.additionalTrustedCa[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&2 != 0 && object.allowedRegistriesForImport != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("allowed_registries_for_import") + WriteRegistryLocationList(object.allowedRegistriesForImport, stream) + count++ + } + present_ = object.bitmap_&4 != 0 && object.platformAllowlist != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("platform_allowlist") + WriteRegistryAllowlist(object.platformAllowlist, stream) + count++ + } + present_ = object.bitmap_&8 != 0 && object.registrySources != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("registry_sources") + WriteRegistrySources(object.registrySources, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterRegistryConfig reads a value of the 'cluster_registry_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterRegistryConfig(source interface{}) (object *ClusterRegistryConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterRegistryConfig(iterator) + err = iterator.Error + return +} + +// ReadClusterRegistryConfig reads a value of the 'cluster_registry_config' type from the given iterator. +func ReadClusterRegistryConfig(iterator *jsoniter.Iterator) *ClusterRegistryConfig { + object := &ClusterRegistryConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "additional_trusted_ca": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.additionalTrustedCa = value + object.bitmap_ |= 1 + case "allowed_registries_for_import": + value := ReadRegistryLocationList(iterator) + object.allowedRegistriesForImport = value + object.bitmap_ |= 2 + case "platform_allowlist": + value := ReadRegistryAllowlist(iterator) + object.platformAllowlist = value + object.bitmap_ |= 4 + case "registry_sources": + value := ReadRegistrySources(iterator) + object.registrySources = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_resources_builder.go b/clientapi/clustersmgmt/v1/cluster_resources_builder.go new file mode 100644 index 00000000..971a181a --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_resources_builder.go @@ -0,0 +1,129 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ClusterResourcesBuilder contains the data and logic needed to build 'cluster_resources' objects. +// +// Cluster Resource which belongs to a cluster, example Cluster Deployment. +type ClusterResourcesBuilder struct { + bitmap_ uint32 + id string + href string + clusterID string + creationTimestamp time.Time + resources map[string]string +} + +// NewClusterResources creates a new builder of 'cluster_resources' objects. +func NewClusterResources() *ClusterResourcesBuilder { + return &ClusterResourcesBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ClusterResourcesBuilder) Link(value bool) *ClusterResourcesBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ClusterResourcesBuilder) ID(value string) *ClusterResourcesBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ClusterResourcesBuilder) HREF(value string) *ClusterResourcesBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterResourcesBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *ClusterResourcesBuilder) ClusterID(value string) *ClusterResourcesBuilder { + b.clusterID = value + b.bitmap_ |= 8 + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *ClusterResourcesBuilder) CreationTimestamp(value time.Time) *ClusterResourcesBuilder { + b.creationTimestamp = value + b.bitmap_ |= 16 + return b +} + +// Resources sets the value of the 'resources' attribute to the given value. +func (b *ClusterResourcesBuilder) Resources(value map[string]string) *ClusterResourcesBuilder { + b.resources = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterResourcesBuilder) Copy(object *ClusterResources) *ClusterResourcesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.clusterID = object.clusterID + b.creationTimestamp = object.creationTimestamp + if len(object.resources) > 0 { + b.resources = map[string]string{} + for k, v := range object.resources { + b.resources[k] = v + } + } else { + b.resources = nil + } + return b +} + +// Build creates a 'cluster_resources' object using the configuration stored in the builder. +func (b *ClusterResourcesBuilder) Build() (object *ClusterResources, err error) { + object = new(ClusterResources) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.clusterID = b.clusterID + object.creationTimestamp = b.creationTimestamp + if b.resources != nil { + object.resources = make(map[string]string) + for k, v := range b.resources { + object.resources[k] = v + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_resources_list_builder.go b/clientapi/clustersmgmt/v1/cluster_resources_list_builder.go new file mode 100644 index 00000000..e2f45935 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_resources_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterResourcesListBuilder contains the data and logic needed to build +// 'cluster_resources' objects. +type ClusterResourcesListBuilder struct { + items []*ClusterResourcesBuilder +} + +// NewClusterResourcesList creates a new builder of 'cluster_resources' objects. +func NewClusterResourcesList() *ClusterResourcesListBuilder { + return new(ClusterResourcesListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterResourcesListBuilder) Items(values ...*ClusterResourcesBuilder) *ClusterResourcesListBuilder { + b.items = make([]*ClusterResourcesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterResourcesListBuilder) 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 *ClusterResourcesListBuilder) Copy(list *ClusterResourcesList) *ClusterResourcesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterResourcesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterResources().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_resources' objects using the +// configuration stored in the builder. +func (b *ClusterResourcesListBuilder) Build() (list *ClusterResourcesList, err error) { + items := make([]*ClusterResources, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterResourcesList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_resources_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_resources_list_type_json.go new file mode 100644 index 00000000..20ddd1ef --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_resources_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterResourcesList writes a list of values of the 'cluster_resources' type to +// the given writer. +func MarshalClusterResourcesList(list []*ClusterResources, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterResourcesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterResourcesList writes a list of value of the 'cluster_resources' type to +// the given stream. +func WriteClusterResourcesList(list []*ClusterResources, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterResources(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterResourcesList reads a list of values of the 'cluster_resources' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterResourcesList(source interface{}) (items []*ClusterResources, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterResourcesList(iterator) + err = iterator.Error + return +} + +// ReadClusterResourcesList reads list of values of the ”cluster_resources' type from +// the given iterator. +func ReadClusterResourcesList(iterator *jsoniter.Iterator) []*ClusterResources { + list := []*ClusterResources{} + for iterator.ReadArray() { + item := ReadClusterResources(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_resources_type.go b/clientapi/clustersmgmt/v1/cluster_resources_type.go new file mode 100644 index 00000000..56f94a56 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_resources_type.go @@ -0,0 +1,317 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ClusterResourcesKind is the name of the type used to represent objects +// of type 'cluster_resources'. +const ClusterResourcesKind = "ClusterResources" + +// ClusterResourcesLinkKind is the name of the type used to represent links +// to objects of type 'cluster_resources'. +const ClusterResourcesLinkKind = "ClusterResourcesLink" + +// ClusterResourcesNilKind is the name of the type used to nil references +// to objects of type 'cluster_resources'. +const ClusterResourcesNilKind = "ClusterResourcesNil" + +// ClusterResources represents the values of the 'cluster_resources' type. +// +// Cluster Resource which belongs to a cluster, example Cluster Deployment. +type ClusterResources struct { + bitmap_ uint32 + id string + href string + clusterID string + creationTimestamp time.Time + resources map[string]string +} + +// Kind returns the name of the type of the object. +func (o *ClusterResources) Kind() string { + if o == nil { + return ClusterResourcesNilKind + } + if o.bitmap_&1 != 0 { + return ClusterResourcesLinkKind + } + return ClusterResourcesKind +} + +// Link returns true if this is a link. +func (o *ClusterResources) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ClusterResources) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ClusterResources) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ClusterResources) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ClusterResources) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterResources) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster ID for the fetched resources +func (o *ClusterResources) ClusterID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster ID for the fetched resources +func (o *ClusterResources) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clusterID + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the resources were fetched. +func (o *ClusterResources) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the resources were fetched. +func (o *ClusterResources) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// Resources returns the value of the 'resources' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Returned map of cluster resources fetched. +func (o *ClusterResources) Resources() map[string]string { + if o != nil && o.bitmap_&32 != 0 { + return o.resources + } + return nil +} + +// GetResources returns the value of the 'resources' attribute and +// a flag indicating if the attribute has a value. +// +// Returned map of cluster resources fetched. +func (o *ClusterResources) GetResources() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.resources + } + return +} + +// ClusterResourcesListKind is the name of the type used to represent list of objects of +// type 'cluster_resources'. +const ClusterResourcesListKind = "ClusterResourcesList" + +// ClusterResourcesListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_resources'. +const ClusterResourcesListLinkKind = "ClusterResourcesListLink" + +// ClusterResourcesNilKind is the name of the type used to nil lists of objects of +// type 'cluster_resources'. +const ClusterResourcesListNilKind = "ClusterResourcesListNil" + +// ClusterResourcesList is a list of values of the 'cluster_resources' type. +type ClusterResourcesList struct { + href string + link bool + items []*ClusterResources +} + +// Kind returns the name of the type of the object. +func (l *ClusterResourcesList) Kind() string { + if l == nil { + return ClusterResourcesListNilKind + } + if l.link { + return ClusterResourcesListLinkKind + } + return ClusterResourcesListKind +} + +// Link returns true iif this is a link. +func (l *ClusterResourcesList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ClusterResourcesList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ClusterResourcesList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ClusterResourcesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterResourcesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterResourcesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterResourcesList) SetItems(items []*ClusterResources) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterResourcesList) Items() []*ClusterResources { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterResourcesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterResourcesList) Get(i int) *ClusterResources { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterResourcesList) Slice() []*ClusterResources { + var slice []*ClusterResources + if l == nil { + slice = make([]*ClusterResources, 0) + } else { + slice = make([]*ClusterResources, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterResourcesList) Each(f func(item *ClusterResources) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterResourcesList) Range(f func(index int, item *ClusterResources) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_resources_type_json.go b/clientapi/clustersmgmt/v1/cluster_resources_type_json.go new file mode 100644 index 00000000..268ce7d9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_resources_type_json.go @@ -0,0 +1,180 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterResources writes a value of the 'cluster_resources' type to the given writer. +func MarshalClusterResources(object *ClusterResources, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterResources(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterResources writes a value of the 'cluster_resources' type to the given stream. +func WriteClusterResources(object *ClusterResources, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ClusterResourcesLinkKind) + } else { + stream.WriteString(ClusterResourcesKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 && object.resources != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resources") + if object.resources != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.resources)) + i := 0 + for key := range object.resources { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.resources[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterResources reads a value of the 'cluster_resources' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterResources(source interface{}) (object *ClusterResources, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterResources(iterator) + err = iterator.Error + return +} + +// ReadClusterResources reads a value of the 'cluster_resources' type from the given iterator. +func ReadClusterResources(iterator *jsoniter.Iterator) *ClusterResources { + object := &ClusterResources{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ClusterResourcesLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 8 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 16 + case "resources": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.resources = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_state_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_state_list_type_json.go new file mode 100644 index 00000000..9f782a3c --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_state_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterStateList writes a list of values of the 'cluster_state' type to +// the given writer. +func MarshalClusterStateList(list []ClusterState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterStateList writes a list of value of the 'cluster_state' type to +// the given stream. +func WriteClusterStateList(list []ClusterState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterStateList reads a list of values of the 'cluster_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterStateList(source interface{}) (items []ClusterState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterStateList(iterator) + err = iterator.Error + return +} + +// ReadClusterStateList reads list of values of the ”cluster_state' type from +// the given iterator. +func ReadClusterStateList(iterator *jsoniter.Iterator) []ClusterState { + list := []ClusterState{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ClusterState(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_state_type.go b/clientapi/clustersmgmt/v1/cluster_state_type.go new file mode 100644 index 00000000..2b66c07f --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_state_type.go @@ -0,0 +1,48 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterState represents the values of the 'cluster_state' enumerated type. +type ClusterState string + +const ( + // Error during installation. + ClusterStateError ClusterState = "error" + // The cluster will consume marginal cloud provider infrastructure but will be counted for quota. + ClusterStateHibernating ClusterState = "hibernating" + // The cluster is still being installed. + ClusterStateInstalling ClusterState = "installing" + // The cluster is pending resources before being provisioned. + ClusterStatePending ClusterState = "pending" + // The cluster is moving from 'Ready' state to 'Hibernating'. + ClusterStatePoweringDown ClusterState = "powering_down" + // The cluster is ready to use. + ClusterStateReady ClusterState = "ready" + // The cluster is moving from 'Hibernating' state to 'Ready'. + ClusterStateResuming ClusterState = "resuming" + // The cluster is being uninstalled. + ClusterStateUninstalling ClusterState = "uninstalling" + // The state of the cluster is unknown. + ClusterStateUnknown ClusterState = "unknown" + // The cluster is validating user input. + ClusterStateValidating ClusterState = "validating" + // The cluster is waiting for user action. + ClusterStateWaiting ClusterState = "waiting" +) diff --git a/clientapi/clustersmgmt/v1/cluster_status_builder.go b/clientapi/clustersmgmt/v1/cluster_status_builder.go new file mode 100644 index 00000000..fba7a73c --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_status_builder.go @@ -0,0 +1,173 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterStatusBuilder contains the data and logic needed to build 'cluster_status' objects. +// +// Detailed status of a cluster. +type ClusterStatusBuilder struct { + bitmap_ uint32 + id string + href string + configurationMode ClusterConfigurationMode + currentCompute int + description string + limitedSupportReasonCount int + provisionErrorCode string + provisionErrorMessage string + state ClusterState + dnsReady bool + oidcReady bool +} + +// NewClusterStatus creates a new builder of 'cluster_status' objects. +func NewClusterStatus() *ClusterStatusBuilder { + return &ClusterStatusBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ClusterStatusBuilder) Link(value bool) *ClusterStatusBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ClusterStatusBuilder) ID(value string) *ClusterStatusBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ClusterStatusBuilder) HREF(value string) *ClusterStatusBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterStatusBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// DNSReady sets the value of the 'DNS_ready' attribute to the given value. +func (b *ClusterStatusBuilder) DNSReady(value bool) *ClusterStatusBuilder { + b.dnsReady = value + b.bitmap_ |= 8 + return b +} + +// OIDCReady sets the value of the 'OIDC_ready' attribute to the given value. +func (b *ClusterStatusBuilder) OIDCReady(value bool) *ClusterStatusBuilder { + b.oidcReady = value + b.bitmap_ |= 16 + return b +} + +// ConfigurationMode sets the value of the 'configuration_mode' attribute to the given value. +// +// Configuration mode of a cluster. +func (b *ClusterStatusBuilder) ConfigurationMode(value ClusterConfigurationMode) *ClusterStatusBuilder { + b.configurationMode = value + b.bitmap_ |= 32 + return b +} + +// CurrentCompute sets the value of the 'current_compute' attribute to the given value. +func (b *ClusterStatusBuilder) CurrentCompute(value int) *ClusterStatusBuilder { + b.currentCompute = value + b.bitmap_ |= 64 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *ClusterStatusBuilder) Description(value string) *ClusterStatusBuilder { + b.description = value + b.bitmap_ |= 128 + return b +} + +// LimitedSupportReasonCount sets the value of the 'limited_support_reason_count' attribute to the given value. +func (b *ClusterStatusBuilder) LimitedSupportReasonCount(value int) *ClusterStatusBuilder { + b.limitedSupportReasonCount = value + b.bitmap_ |= 256 + return b +} + +// ProvisionErrorCode sets the value of the 'provision_error_code' attribute to the given value. +func (b *ClusterStatusBuilder) ProvisionErrorCode(value string) *ClusterStatusBuilder { + b.provisionErrorCode = value + b.bitmap_ |= 512 + return b +} + +// ProvisionErrorMessage sets the value of the 'provision_error_message' attribute to the given value. +func (b *ClusterStatusBuilder) ProvisionErrorMessage(value string) *ClusterStatusBuilder { + b.provisionErrorMessage = value + b.bitmap_ |= 1024 + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// Overall state of a cluster. +func (b *ClusterStatusBuilder) State(value ClusterState) *ClusterStatusBuilder { + b.state = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterStatusBuilder) Copy(object *ClusterStatus) *ClusterStatusBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.dnsReady = object.dnsReady + b.oidcReady = object.oidcReady + b.configurationMode = object.configurationMode + b.currentCompute = object.currentCompute + b.description = object.description + b.limitedSupportReasonCount = object.limitedSupportReasonCount + b.provisionErrorCode = object.provisionErrorCode + b.provisionErrorMessage = object.provisionErrorMessage + b.state = object.state + return b +} + +// Build creates a 'cluster_status' object using the configuration stored in the builder. +func (b *ClusterStatusBuilder) Build() (object *ClusterStatus, err error) { + object = new(ClusterStatus) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.dnsReady = b.dnsReady + object.oidcReady = b.oidcReady + object.configurationMode = b.configurationMode + object.currentCompute = b.currentCompute + object.description = b.description + object.limitedSupportReasonCount = b.limitedSupportReasonCount + object.provisionErrorCode = b.provisionErrorCode + object.provisionErrorMessage = b.provisionErrorMessage + object.state = b.state + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_status_list_builder.go b/clientapi/clustersmgmt/v1/cluster_status_list_builder.go new file mode 100644 index 00000000..8fe7aadd --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_status_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterStatusListBuilder contains the data and logic needed to build +// 'cluster_status' objects. +type ClusterStatusListBuilder struct { + items []*ClusterStatusBuilder +} + +// NewClusterStatusList creates a new builder of 'cluster_status' objects. +func NewClusterStatusList() *ClusterStatusListBuilder { + return new(ClusterStatusListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterStatusListBuilder) Items(values ...*ClusterStatusBuilder) *ClusterStatusListBuilder { + b.items = make([]*ClusterStatusBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterStatusListBuilder) 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 *ClusterStatusListBuilder) Copy(list *ClusterStatusList) *ClusterStatusListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterStatusBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterStatus().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_status' objects using the +// configuration stored in the builder. +func (b *ClusterStatusListBuilder) Build() (list *ClusterStatusList, err error) { + items := make([]*ClusterStatus, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterStatusList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cluster_status_list_type_json.go b/clientapi/clustersmgmt/v1/cluster_status_list_type_json.go new file mode 100644 index 00000000..f15da500 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_status_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterStatusList writes a list of values of the 'cluster_status' type to +// the given writer. +func MarshalClusterStatusList(list []*ClusterStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterStatusList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterStatusList writes a list of value of the 'cluster_status' type to +// the given stream. +func WriteClusterStatusList(list []*ClusterStatus, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterStatus(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterStatusList reads a list of values of the 'cluster_status' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterStatusList(source interface{}) (items []*ClusterStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterStatusList(iterator) + err = iterator.Error + return +} + +// ReadClusterStatusList reads list of values of the ”cluster_status' type from +// the given iterator. +func ReadClusterStatusList(iterator *jsoniter.Iterator) []*ClusterStatus { + list := []*ClusterStatus{} + for iterator.ReadArray() { + item := ReadClusterStatus(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cluster_status_type.go b/clientapi/clustersmgmt/v1/cluster_status_type.go new file mode 100644 index 00000000..c07ead84 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_status_type.go @@ -0,0 +1,457 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ClusterStatusKind is the name of the type used to represent objects +// of type 'cluster_status'. +const ClusterStatusKind = "ClusterStatus" + +// ClusterStatusLinkKind is the name of the type used to represent links +// to objects of type 'cluster_status'. +const ClusterStatusLinkKind = "ClusterStatusLink" + +// ClusterStatusNilKind is the name of the type used to nil references +// to objects of type 'cluster_status'. +const ClusterStatusNilKind = "ClusterStatusNil" + +// ClusterStatus represents the values of the 'cluster_status' type. +// +// Detailed status of a cluster. +type ClusterStatus struct { + bitmap_ uint32 + id string + href string + configurationMode ClusterConfigurationMode + currentCompute int + description string + limitedSupportReasonCount int + provisionErrorCode string + provisionErrorMessage string + state ClusterState + dnsReady bool + oidcReady bool +} + +// Kind returns the name of the type of the object. +func (o *ClusterStatus) Kind() string { + if o == nil { + return ClusterStatusNilKind + } + if o.bitmap_&1 != 0 { + return ClusterStatusLinkKind + } + return ClusterStatusKind +} + +// Link returns true if this is a link. +func (o *ClusterStatus) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ClusterStatus) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ClusterStatus) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ClusterStatus) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ClusterStatus) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterStatus) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// DNSReady returns the value of the 'DNS_ready' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DNSReady from Provisioner +func (o *ClusterStatus) DNSReady() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.dnsReady + } + return false +} + +// GetDNSReady returns the value of the 'DNS_ready' attribute and +// a flag indicating if the attribute has a value. +// +// DNSReady from Provisioner +func (o *ClusterStatus) GetDNSReady() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.dnsReady + } + return +} + +// OIDCReady returns the value of the 'OIDC_ready' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// OIDCReady from user configuration. +func (o *ClusterStatus) OIDCReady() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.oidcReady + } + return false +} + +// GetOIDCReady returns the value of the 'OIDC_ready' attribute and +// a flag indicating if the attribute has a value. +// +// OIDCReady from user configuration. +func (o *ClusterStatus) GetOIDCReady() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.oidcReady + } + return +} + +// ConfigurationMode returns the value of the 'configuration_mode' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Configuration mode +func (o *ClusterStatus) ConfigurationMode() ClusterConfigurationMode { + if o != nil && o.bitmap_&32 != 0 { + return o.configurationMode + } + return ClusterConfigurationMode("") +} + +// GetConfigurationMode returns the value of the 'configuration_mode' attribute and +// a flag indicating if the attribute has a value. +// +// Configuration mode +func (o *ClusterStatus) GetConfigurationMode() (value ClusterConfigurationMode, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.configurationMode + } + return +} + +// CurrentCompute returns the value of the 'current_compute' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Current Replicas available for a Hosted Cluster +func (o *ClusterStatus) CurrentCompute() int { + if o != nil && o.bitmap_&64 != 0 { + return o.currentCompute + } + return 0 +} + +// GetCurrentCompute returns the value of the 'current_compute' attribute and +// a flag indicating if the attribute has a value. +// +// Current Replicas available for a Hosted Cluster +func (o *ClusterStatus) GetCurrentCompute() (value int, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.currentCompute + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Detailed description of the cluster status. +func (o *ClusterStatus) Description() string { + if o != nil && o.bitmap_&128 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Detailed description of the cluster status. +func (o *ClusterStatus) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.description + } + return +} + +// LimitedSupportReasonCount returns the value of the 'limited_support_reason_count' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Limited Support Reason Count +func (o *ClusterStatus) LimitedSupportReasonCount() int { + if o != nil && o.bitmap_&256 != 0 { + return o.limitedSupportReasonCount + } + return 0 +} + +// GetLimitedSupportReasonCount returns the value of the 'limited_support_reason_count' attribute and +// a flag indicating if the attribute has a value. +// +// Limited Support Reason Count +func (o *ClusterStatus) GetLimitedSupportReasonCount() (value int, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.limitedSupportReasonCount + } + return +} + +// ProvisionErrorCode returns the value of the 'provision_error_code' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Provisioning Error Code +func (o *ClusterStatus) ProvisionErrorCode() string { + if o != nil && o.bitmap_&512 != 0 { + return o.provisionErrorCode + } + return "" +} + +// GetProvisionErrorCode returns the value of the 'provision_error_code' attribute and +// a flag indicating if the attribute has a value. +// +// Provisioning Error Code +func (o *ClusterStatus) GetProvisionErrorCode() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.provisionErrorCode + } + return +} + +// ProvisionErrorMessage returns the value of the 'provision_error_message' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Provisioning Error Message +func (o *ClusterStatus) ProvisionErrorMessage() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.provisionErrorMessage + } + return "" +} + +// GetProvisionErrorMessage returns the value of the 'provision_error_message' attribute and +// a flag indicating if the attribute has a value. +// +// Provisioning Error Message +func (o *ClusterStatus) GetProvisionErrorMessage() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.provisionErrorMessage + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The overall state of the cluster. +func (o *ClusterStatus) State() ClusterState { + if o != nil && o.bitmap_&2048 != 0 { + return o.state + } + return ClusterState("") +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// The overall state of the cluster. +func (o *ClusterStatus) GetState() (value ClusterState, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.state + } + return +} + +// ClusterStatusListKind is the name of the type used to represent list of objects of +// type 'cluster_status'. +const ClusterStatusListKind = "ClusterStatusList" + +// ClusterStatusListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_status'. +const ClusterStatusListLinkKind = "ClusterStatusListLink" + +// ClusterStatusNilKind is the name of the type used to nil lists of objects of +// type 'cluster_status'. +const ClusterStatusListNilKind = "ClusterStatusListNil" + +// ClusterStatusList is a list of values of the 'cluster_status' type. +type ClusterStatusList struct { + href string + link bool + items []*ClusterStatus +} + +// Kind returns the name of the type of the object. +func (l *ClusterStatusList) Kind() string { + if l == nil { + return ClusterStatusListNilKind + } + if l.link { + return ClusterStatusListLinkKind + } + return ClusterStatusListKind +} + +// Link returns true iif this is a link. +func (l *ClusterStatusList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ClusterStatusList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ClusterStatusList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ClusterStatusList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterStatusList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterStatusList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterStatusList) SetItems(items []*ClusterStatus) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterStatusList) Items() []*ClusterStatus { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterStatusList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterStatusList) Get(i int) *ClusterStatus { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterStatusList) Slice() []*ClusterStatus { + var slice []*ClusterStatus + if l == nil { + slice = make([]*ClusterStatus, 0) + } else { + slice = make([]*ClusterStatus, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterStatusList) Each(f func(item *ClusterStatus) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterStatusList) Range(f func(index int, item *ClusterStatus) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_status_type_json.go b/clientapi/clustersmgmt/v1/cluster_status_type_json.go new file mode 100644 index 00000000..a00c25ae --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_status_type_json.go @@ -0,0 +1,226 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterStatus writes a value of the 'cluster_status' type to the given writer. +func MarshalClusterStatus(object *ClusterStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterStatus(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterStatus writes a value of the 'cluster_status' type to the given stream. +func WriteClusterStatus(object *ClusterStatus, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ClusterStatusLinkKind) + } else { + stream.WriteString(ClusterStatusKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("dns_ready") + stream.WriteBool(object.dnsReady) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("oidc_ready") + stream.WriteBool(object.oidcReady) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("configuration_mode") + stream.WriteString(string(object.configurationMode)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("current_compute") + stream.WriteInt(object.currentCompute) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("limited_support_reason_count") + stream.WriteInt(object.limitedSupportReasonCount) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("provision_error_code") + stream.WriteString(object.provisionErrorCode) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("provision_error_message") + stream.WriteString(object.provisionErrorMessage) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(string(object.state)) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterStatus reads a value of the 'cluster_status' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterStatus(source interface{}) (object *ClusterStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterStatus(iterator) + err = iterator.Error + return +} + +// ReadClusterStatus reads a value of the 'cluster_status' type from the given iterator. +func ReadClusterStatus(iterator *jsoniter.Iterator) *ClusterStatus { + object := &ClusterStatus{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ClusterStatusLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "dns_ready": + value := iterator.ReadBool() + object.dnsReady = value + object.bitmap_ |= 8 + case "oidc_ready": + value := iterator.ReadBool() + object.oidcReady = value + object.bitmap_ |= 16 + case "configuration_mode": + text := iterator.ReadString() + value := ClusterConfigurationMode(text) + object.configurationMode = value + object.bitmap_ |= 32 + case "current_compute": + value := iterator.ReadInt() + object.currentCompute = value + object.bitmap_ |= 64 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 128 + case "limited_support_reason_count": + value := iterator.ReadInt() + object.limitedSupportReasonCount = value + object.bitmap_ |= 256 + case "provision_error_code": + value := iterator.ReadString() + object.provisionErrorCode = value + object.bitmap_ |= 512 + case "provision_error_message": + value := iterator.ReadString() + object.provisionErrorMessage = value + object.bitmap_ |= 1024 + case "state": + text := iterator.ReadString() + value := ClusterState(text) + object.state = value + object.bitmap_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cluster_type.go b/clientapi/clustersmgmt/v1/cluster_type.go new file mode 100644 index 00000000..9bd1c599 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_type.go @@ -0,0 +1,1761 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ClusterKind is the name of the type used to represent objects +// of type 'cluster'. +const ClusterKind = "Cluster" + +// ClusterLinkKind is the name of the type used to represent links +// to objects of type 'cluster'. +const ClusterLinkKind = "ClusterLink" + +// ClusterNilKind is the name of the type used to nil references +// to objects of type 'cluster'. +const ClusterNilKind = "ClusterNil" + +// Cluster represents the values of the 'cluster' type. +// +// Definition of an _OpenShift_ cluster. +// +// The `cloud_provider` attribute is a reference to the cloud provider. When a +// cluster is retrieved it will be a link to the cloud provider, containing only +// the kind, id and href attributes: +// +// ```json +// +// { +// "cloud_provider": { +// "kind": "CloudProviderLink", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/cloud_providers/123" +// } +// } +// +// ``` +// +// When a cluster is created this is optional, and if used it should contain the +// identifier of the cloud provider to use: +// +// ```json +// +// { +// "cloud_provider": { +// "id": "123", +// } +// } +// +// ``` +// +// If not included, then the cluster will be created using the default cloud +// provider, which is currently Amazon Web Services. +// +// The region attribute is mandatory when a cluster is created. +// +// The `aws.access_key_id`, `aws.secret_access_key` and `dns.base_domain` +// attributes are mandatory when creation a cluster with your own Amazon Web +// Services account. +type Cluster struct { + bitmap_ uint64 + id string + href string + api *ClusterAPI + aws *AWS + awsInfrastructureAccessRoleGrants *AWSInfrastructureAccessRoleGrantList + ccs *CCS + dns *DNS + gcp *GCP + gcpEncryptionKey *GCPEncryptionKey + gcpNetwork *GCPNetwork + additionalTrustBundle string + addons *AddOnInstallationList + autoscaler *ClusterAutoscaler + azure *Azure + billingModel BillingModel + byoOidc *ByoOidc + capabilities *ClusterCapabilities + cloudProvider *CloudProvider + console *ClusterConsole + creationTimestamp time.Time + deleteProtection *DeleteProtection + domainPrefix string + expirationTimestamp time.Time + externalID string + externalAuthConfig *ExternalAuthConfig + externalConfiguration *ExternalConfiguration + flavour *Flavour + groups *GroupList + healthState ClusterHealthState + htpasswd *HTPasswdIdentityProvider + hypershift *Hypershift + identityProviders *IdentityProviderList + inflightChecks *InflightCheckList + infraID string + ingresses *IngressList + kubeletConfig *KubeletConfig + loadBalancerQuota int + machinePools *MachinePoolList + managedService *ManagedService + name string + network *Network + nodeDrainGracePeriod *Value + nodePools *NodePoolList + nodes *ClusterNodes + openshiftVersion string + product *Product + properties map[string]string + provisionShard *ProvisionShard + proxy *Proxy + region *CloudRegion + registryConfig *ClusterRegistryConfig + state ClusterState + status *ClusterStatus + storageQuota *Value + subscription *Subscription + version *Version + fips bool + disableUserWorkloadMonitoring bool + etcdEncryption bool + managed bool + multiAZ bool + multiArchEnabled bool +} + +// Kind returns the name of the type of the object. +func (o *Cluster) Kind() string { + if o == nil { + return ClusterNilKind + } + if o.bitmap_&1 != 0 { + return ClusterLinkKind + } + return ClusterKind +} + +// Link returns true if this is a link. +func (o *Cluster) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Cluster) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Cluster) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Cluster) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Cluster) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Cluster) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// API returns the value of the 'API' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Information about the API of the cluster. +func (o *Cluster) API() *ClusterAPI { + if o != nil && o.bitmap_&8 != 0 { + return o.api + } + return nil +} + +// GetAPI returns the value of the 'API' attribute and +// a flag indicating if the attribute has a value. +// +// Information about the API of the cluster. +func (o *Cluster) GetAPI() (value *ClusterAPI, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.api + } + return +} + +// AWS returns the value of the 'AWS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Amazon Web Services settings of the cluster. +func (o *Cluster) AWS() *AWS { + if o != nil && o.bitmap_&16 != 0 { + return o.aws + } + return nil +} + +// GetAWS returns the value of the 'AWS' attribute and +// a flag indicating if the attribute has a value. +// +// Amazon Web Services settings of the cluster. +func (o *Cluster) GetAWS() (value *AWS, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.aws + } + return +} + +// AWSInfrastructureAccessRoleGrants returns the value of the 'AWS_infrastructure_access_role_grants' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of AWS infrastructure access role grants on this cluster. +func (o *Cluster) AWSInfrastructureAccessRoleGrants() *AWSInfrastructureAccessRoleGrantList { + if o != nil && o.bitmap_&32 != 0 { + return o.awsInfrastructureAccessRoleGrants + } + return nil +} + +// GetAWSInfrastructureAccessRoleGrants returns the value of the 'AWS_infrastructure_access_role_grants' attribute and +// a flag indicating if the attribute has a value. +// +// List of AWS infrastructure access role grants on this cluster. +func (o *Cluster) GetAWSInfrastructureAccessRoleGrants() (value *AWSInfrastructureAccessRoleGrantList, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.awsInfrastructureAccessRoleGrants + } + return +} + +// CCS returns the value of the 'CCS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains configuration of a Customer Cloud Subscription cluster. +func (o *Cluster) CCS() *CCS { + if o != nil && o.bitmap_&64 != 0 { + return o.ccs + } + return nil +} + +// GetCCS returns the value of the 'CCS' attribute and +// a flag indicating if the attribute has a value. +// +// Contains configuration of a Customer Cloud Subscription cluster. +func (o *Cluster) GetCCS() (value *CCS, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.ccs + } + return +} + +// DNS returns the value of the 'DNS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DNS settings of the cluster. +func (o *Cluster) DNS() *DNS { + if o != nil && o.bitmap_&128 != 0 { + return o.dns + } + return nil +} + +// GetDNS returns the value of the 'DNS' attribute and +// a flag indicating if the attribute has a value. +// +// DNS settings of the cluster. +func (o *Cluster) GetDNS() (value *DNS, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.dns + } + return +} + +// FIPS returns the value of the 'FIPS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Create cluster that uses FIPS Validated / Modules in Process cryptographic libraries. +func (o *Cluster) FIPS() bool { + if o != nil && o.bitmap_&256 != 0 { + return o.fips + } + return false +} + +// GetFIPS returns the value of the 'FIPS' attribute and +// a flag indicating if the attribute has a value. +// +// Create cluster that uses FIPS Validated / Modules in Process cryptographic libraries. +func (o *Cluster) GetFIPS() (value bool, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.fips + } + return +} + +// GCP returns the value of the 'GCP' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Google cloud platform settings of the cluster. +func (o *Cluster) GCP() *GCP { + if o != nil && o.bitmap_&512 != 0 { + return o.gcp + } + return nil +} + +// GetGCP returns the value of the 'GCP' attribute and +// a flag indicating if the attribute has a value. +// +// Google cloud platform settings of the cluster. +func (o *Cluster) GetGCP() (value *GCP, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.gcp + } + return +} + +// GCPEncryptionKey returns the value of the 'GCP_encryption_key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Key used for encryption of GCP cluster nodes. +func (o *Cluster) GCPEncryptionKey() *GCPEncryptionKey { + if o != nil && o.bitmap_&1024 != 0 { + return o.gcpEncryptionKey + } + return nil +} + +// GetGCPEncryptionKey returns the value of the 'GCP_encryption_key' attribute and +// a flag indicating if the attribute has a value. +// +// Key used for encryption of GCP cluster nodes. +func (o *Cluster) GetGCPEncryptionKey() (value *GCPEncryptionKey, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.gcpEncryptionKey + } + return +} + +// GCPNetwork returns the value of the 'GCP_network' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP Network. +func (o *Cluster) GCPNetwork() *GCPNetwork { + if o != nil && o.bitmap_&2048 != 0 { + return o.gcpNetwork + } + return nil +} + +// GetGCPNetwork returns the value of the 'GCP_network' attribute and +// a flag indicating if the attribute has a value. +// +// GCP Network. +func (o *Cluster) GetGCPNetwork() (value *GCPNetwork, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.gcpNetwork + } + return +} + +// AdditionalTrustBundle returns the value of the 'additional_trust_bundle' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional trust bundle. +func (o *Cluster) AdditionalTrustBundle() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.additionalTrustBundle + } + return "" +} + +// GetAdditionalTrustBundle returns the value of the 'additional_trust_bundle' attribute and +// a flag indicating if the attribute has a value. +// +// Additional trust bundle. +func (o *Cluster) GetAdditionalTrustBundle() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.additionalTrustBundle + } + return +} + +// Addons returns the value of the 'addons' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of add-ons on this cluster. +func (o *Cluster) Addons() *AddOnInstallationList { + if o != nil && o.bitmap_&8192 != 0 { + return o.addons + } + return nil +} + +// GetAddons returns the value of the 'addons' attribute and +// a flag indicating if the attribute has a value. +// +// List of add-ons on this cluster. +func (o *Cluster) GetAddons() (value *AddOnInstallationList, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.addons + } + return +} + +// Autoscaler returns the value of the 'autoscaler' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to an optional _ClusterAutoscaler_ that is coupled with the cluster. +func (o *Cluster) Autoscaler() *ClusterAutoscaler { + if o != nil && o.bitmap_&16384 != 0 { + return o.autoscaler + } + return nil +} + +// GetAutoscaler returns the value of the 'autoscaler' attribute and +// a flag indicating if the attribute has a value. +// +// Link to an optional _ClusterAutoscaler_ that is coupled with the cluster. +func (o *Cluster) GetAutoscaler() (value *ClusterAutoscaler, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.autoscaler + } + return +} + +// Azure returns the value of the 'azure' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Microsoft Azure settings of the cluster. +func (o *Cluster) Azure() *Azure { + if o != nil && o.bitmap_&32768 != 0 { + return o.azure + } + return nil +} + +// GetAzure returns the value of the 'azure' attribute and +// a flag indicating if the attribute has a value. +// +// Microsoft Azure settings of the cluster. +func (o *Cluster) GetAzure() (value *Azure, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.azure + } + return +} + +// BillingModel returns the value of the 'billing_model' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Billing model for cluster resources. +func (o *Cluster) BillingModel() BillingModel { + if o != nil && o.bitmap_&65536 != 0 { + return o.billingModel + } + return BillingModel("") +} + +// GetBillingModel returns the value of the 'billing_model' attribute and +// a flag indicating if the attribute has a value. +// +// Billing model for cluster resources. +func (o *Cluster) GetBillingModel() (value BillingModel, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.billingModel + } + return +} + +// ByoOidc returns the value of the 'byo_oidc' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains information about BYO OIDC. +func (o *Cluster) ByoOidc() *ByoOidc { + if o != nil && o.bitmap_&131072 != 0 { + return o.byoOidc + } + return nil +} + +// GetByoOidc returns the value of the 'byo_oidc' attribute and +// a flag indicating if the attribute has a value. +// +// Contains information about BYO OIDC. +func (o *Cluster) GetByoOidc() (value *ByoOidc, ok bool) { + ok = o != nil && o.bitmap_&131072 != 0 + if ok { + value = o.byoOidc + } + return +} + +// Capabilities returns the value of the 'capabilities' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// OpenShift Cluster Capabilities configuration +func (o *Cluster) Capabilities() *ClusterCapabilities { + if o != nil && o.bitmap_&262144 != 0 { + return o.capabilities + } + return nil +} + +// GetCapabilities returns the value of the 'capabilities' attribute and +// a flag indicating if the attribute has a value. +// +// OpenShift Cluster Capabilities configuration +func (o *Cluster) GetCapabilities() (value *ClusterCapabilities, ok bool) { + ok = o != nil && o.bitmap_&262144 != 0 + if ok { + value = o.capabilities + } + return +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the cloud provider where the cluster is installed. +func (o *Cluster) CloudProvider() *CloudProvider { + if o != nil && o.bitmap_&524288 != 0 { + return o.cloudProvider + } + return nil +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the cloud provider where the cluster is installed. +func (o *Cluster) GetCloudProvider() (value *CloudProvider, ok bool) { + ok = o != nil && o.bitmap_&524288 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// Console returns the value of the 'console' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Information about the console of the cluster. +func (o *Cluster) Console() *ClusterConsole { + if o != nil && o.bitmap_&1048576 != 0 { + return o.console + } + return nil +} + +// GetConsole returns the value of the 'console' attribute and +// a flag indicating if the attribute has a value. +// +// Information about the console of the cluster. +func (o *Cluster) GetConsole() (value *ClusterConsole, ok bool) { + ok = o != nil && o.bitmap_&1048576 != 0 + if ok { + value = o.console + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the cluster was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *Cluster) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&2097152 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the cluster was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *Cluster) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&2097152 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// DeleteProtection returns the value of the 'delete_protection' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Delete protection +func (o *Cluster) DeleteProtection() *DeleteProtection { + if o != nil && o.bitmap_&4194304 != 0 { + return o.deleteProtection + } + return nil +} + +// GetDeleteProtection returns the value of the 'delete_protection' attribute and +// a flag indicating if the attribute has a value. +// +// Delete protection +func (o *Cluster) GetDeleteProtection() (value *DeleteProtection, ok bool) { + ok = o != nil && o.bitmap_&4194304 != 0 + if ok { + value = o.deleteProtection + } + return +} + +// DisableUserWorkloadMonitoring returns the value of the 'disable_user_workload_monitoring' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates whether the User workload monitoring is enabled or not +// It is enabled by default +func (o *Cluster) DisableUserWorkloadMonitoring() bool { + if o != nil && o.bitmap_&8388608 != 0 { + return o.disableUserWorkloadMonitoring + } + return false +} + +// GetDisableUserWorkloadMonitoring returns the value of the 'disable_user_workload_monitoring' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates whether the User workload monitoring is enabled or not +// It is enabled by default +func (o *Cluster) GetDisableUserWorkloadMonitoring() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8388608 != 0 + if ok { + value = o.disableUserWorkloadMonitoring + } + return +} + +// DomainPrefix returns the value of the 'domain_prefix' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DomainPrefix of the cluster. This prefix is optionally assigned by the user when the +// cluster is created. It will appear in the Cluster's domain when the cluster is provisioned. +func (o *Cluster) DomainPrefix() string { + if o != nil && o.bitmap_&16777216 != 0 { + return o.domainPrefix + } + return "" +} + +// GetDomainPrefix returns the value of the 'domain_prefix' attribute and +// a flag indicating if the attribute has a value. +// +// DomainPrefix of the cluster. This prefix is optionally assigned by the user when the +// cluster is created. It will appear in the Cluster's domain when the cluster is provisioned. +func (o *Cluster) GetDomainPrefix() (value string, ok bool) { + ok = o != nil && o.bitmap_&16777216 != 0 + if ok { + value = o.domainPrefix + } + return +} + +// EtcdEncryption returns the value of the 'etcd_encryption' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates whether that etcd is encrypted or not. +// This is set only during cluster creation. +func (o *Cluster) EtcdEncryption() bool { + if o != nil && o.bitmap_&33554432 != 0 { + return o.etcdEncryption + } + return false +} + +// GetEtcdEncryption returns the value of the 'etcd_encryption' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates whether that etcd is encrypted or not. +// This is set only during cluster creation. +func (o *Cluster) GetEtcdEncryption() (value bool, ok bool) { + ok = o != nil && o.bitmap_&33554432 != 0 + if ok { + value = o.etcdEncryption + } + return +} + +// ExpirationTimestamp returns the value of the 'expiration_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the cluster will be automatically deleted, using the format defined in +// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). If no timestamp is provided, the cluster +// will never expire. +// +// This option is unsupported. +func (o *Cluster) ExpirationTimestamp() time.Time { + if o != nil && o.bitmap_&67108864 != 0 { + return o.expirationTimestamp + } + return time.Time{} +} + +// GetExpirationTimestamp returns the value of the 'expiration_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the cluster will be automatically deleted, using the format defined in +// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). If no timestamp is provided, the cluster +// will never expire. +// +// This option is unsupported. +func (o *Cluster) GetExpirationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&67108864 != 0 + if ok { + value = o.expirationTimestamp + } + return +} + +// ExternalID returns the value of the 'external_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// External identifier of the cluster, generated by the installer. +func (o *Cluster) ExternalID() string { + if o != nil && o.bitmap_&134217728 != 0 { + return o.externalID + } + return "" +} + +// GetExternalID returns the value of the 'external_ID' attribute and +// a flag indicating if the attribute has a value. +// +// External identifier of the cluster, generated by the installer. +func (o *Cluster) GetExternalID() (value string, ok bool) { + ok = o != nil && o.bitmap_&134217728 != 0 + if ok { + value = o.externalID + } + return +} + +// ExternalAuthConfig returns the value of the 'external_auth_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// External authentication configuration +func (o *Cluster) ExternalAuthConfig() *ExternalAuthConfig { + if o != nil && o.bitmap_&268435456 != 0 { + return o.externalAuthConfig + } + return nil +} + +// GetExternalAuthConfig returns the value of the 'external_auth_config' attribute and +// a flag indicating if the attribute has a value. +// +// External authentication configuration +func (o *Cluster) GetExternalAuthConfig() (value *ExternalAuthConfig, ok bool) { + ok = o != nil && o.bitmap_&268435456 != 0 + if ok { + value = o.externalAuthConfig + } + return +} + +// ExternalConfiguration returns the value of the 'external_configuration' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ExternalConfiguration shows external configuration on the cluster. +func (o *Cluster) ExternalConfiguration() *ExternalConfiguration { + if o != nil && o.bitmap_&536870912 != 0 { + return o.externalConfiguration + } + return nil +} + +// GetExternalConfiguration returns the value of the 'external_configuration' attribute and +// a flag indicating if the attribute has a value. +// +// ExternalConfiguration shows external configuration on the cluster. +func (o *Cluster) GetExternalConfiguration() (value *ExternalConfiguration, ok bool) { + ok = o != nil && o.bitmap_&536870912 != 0 + if ok { + value = o.externalConfiguration + } + return +} + +// Flavour returns the value of the 'flavour' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the _flavour_ that was used to create the cluster. +func (o *Cluster) Flavour() *Flavour { + if o != nil && o.bitmap_&1073741824 != 0 { + return o.flavour + } + return nil +} + +// GetFlavour returns the value of the 'flavour' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the _flavour_ that was used to create the cluster. +func (o *Cluster) GetFlavour() (value *Flavour, ok bool) { + ok = o != nil && o.bitmap_&1073741824 != 0 + if ok { + value = o.flavour + } + return +} + +// Groups returns the value of the 'groups' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the collection of groups of user of the cluster. +func (o *Cluster) Groups() *GroupList { + if o != nil && o.bitmap_&2147483648 != 0 { + return o.groups + } + return nil +} + +// GetGroups returns the value of the 'groups' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the collection of groups of user of the cluster. +func (o *Cluster) GetGroups() (value *GroupList, ok bool) { + ok = o != nil && o.bitmap_&2147483648 != 0 + if ok { + value = o.groups + } + return +} + +// HealthState returns the value of the 'health_state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HealthState indicates the overall health state of the cluster. +func (o *Cluster) HealthState() ClusterHealthState { + if o != nil && o.bitmap_&4294967296 != 0 { + return o.healthState + } + return ClusterHealthState("") +} + +// GetHealthState returns the value of the 'health_state' attribute and +// a flag indicating if the attribute has a value. +// +// HealthState indicates the overall health state of the cluster. +func (o *Cluster) GetHealthState() (value ClusterHealthState, ok bool) { + ok = o != nil && o.bitmap_&4294967296 != 0 + if ok { + value = o.healthState + } + return +} + +// Htpasswd returns the value of the 'htpasswd' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for `htpasswd` identity provider. +func (o *Cluster) Htpasswd() *HTPasswdIdentityProvider { + if o != nil && o.bitmap_&8589934592 != 0 { + return o.htpasswd + } + return nil +} + +// GetHtpasswd returns the value of the 'htpasswd' attribute and +// a flag indicating if the attribute has a value. +// +// Details for `htpasswd` identity provider. +func (o *Cluster) GetHtpasswd() (value *HTPasswdIdentityProvider, ok bool) { + ok = o != nil && o.bitmap_&8589934592 != 0 + if ok { + value = o.htpasswd + } + return +} + +// Hypershift returns the value of the 'hypershift' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Hypershift configuration. +func (o *Cluster) Hypershift() *Hypershift { + if o != nil && o.bitmap_&17179869184 != 0 { + return o.hypershift + } + return nil +} + +// GetHypershift returns the value of the 'hypershift' attribute and +// a flag indicating if the attribute has a value. +// +// Hypershift configuration. +func (o *Cluster) GetHypershift() (value *Hypershift, ok bool) { + ok = o != nil && o.bitmap_&17179869184 != 0 + if ok { + value = o.hypershift + } + return +} + +// IdentityProviders returns the value of the 'identity_providers' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the collection of identity providers of the cluster. +func (o *Cluster) IdentityProviders() *IdentityProviderList { + if o != nil && o.bitmap_&34359738368 != 0 { + return o.identityProviders + } + return nil +} + +// GetIdentityProviders returns the value of the 'identity_providers' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the collection of identity providers of the cluster. +func (o *Cluster) GetIdentityProviders() (value *IdentityProviderList, ok bool) { + ok = o != nil && o.bitmap_&34359738368 != 0 + if ok { + value = o.identityProviders + } + return +} + +// InflightChecks returns the value of the 'inflight_checks' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of inflight checks on this cluster. +func (o *Cluster) InflightChecks() *InflightCheckList { + if o != nil && o.bitmap_&68719476736 != 0 { + return o.inflightChecks + } + return nil +} + +// GetInflightChecks returns the value of the 'inflight_checks' attribute and +// a flag indicating if the attribute has a value. +// +// List of inflight checks on this cluster. +func (o *Cluster) GetInflightChecks() (value *InflightCheckList, ok bool) { + ok = o != nil && o.bitmap_&68719476736 != 0 + if ok { + value = o.inflightChecks + } + return +} + +// InfraID returns the value of the 'infra_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// InfraID is used for example to name the VPCs. +func (o *Cluster) InfraID() string { + if o != nil && o.bitmap_&137438953472 != 0 { + return o.infraID + } + return "" +} + +// GetInfraID returns the value of the 'infra_ID' attribute and +// a flag indicating if the attribute has a value. +// +// InfraID is used for example to name the VPCs. +func (o *Cluster) GetInfraID() (value string, ok bool) { + ok = o != nil && o.bitmap_&137438953472 != 0 + if ok { + value = o.infraID + } + return +} + +// Ingresses returns the value of the 'ingresses' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of ingresses on this cluster. +func (o *Cluster) Ingresses() *IngressList { + if o != nil && o.bitmap_&274877906944 != 0 { + return o.ingresses + } + return nil +} + +// GetIngresses returns the value of the 'ingresses' attribute and +// a flag indicating if the attribute has a value. +// +// List of ingresses on this cluster. +func (o *Cluster) GetIngresses() (value *IngressList, ok bool) { + ok = o != nil && o.bitmap_&274877906944 != 0 + if ok { + value = o.ingresses + } + return +} + +// KubeletConfig returns the value of the 'kubelet_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details of cluster-wide KubeletConfig +func (o *Cluster) KubeletConfig() *KubeletConfig { + if o != nil && o.bitmap_&549755813888 != 0 { + return o.kubeletConfig + } + return nil +} + +// GetKubeletConfig returns the value of the 'kubelet_config' attribute and +// a flag indicating if the attribute has a value. +// +// Details of cluster-wide KubeletConfig +func (o *Cluster) GetKubeletConfig() (value *KubeletConfig, ok bool) { + ok = o != nil && o.bitmap_&549755813888 != 0 + if ok { + value = o.kubeletConfig + } + return +} + +// LoadBalancerQuota returns the value of the 'load_balancer_quota' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Load Balancer quota to be assigned to the cluster. +func (o *Cluster) LoadBalancerQuota() int { + if o != nil && o.bitmap_&1099511627776 != 0 { + return o.loadBalancerQuota + } + return 0 +} + +// GetLoadBalancerQuota returns the value of the 'load_balancer_quota' attribute and +// a flag indicating if the attribute has a value. +// +// Load Balancer quota to be assigned to the cluster. +func (o *Cluster) GetLoadBalancerQuota() (value int, ok bool) { + ok = o != nil && o.bitmap_&1099511627776 != 0 + if ok { + value = o.loadBalancerQuota + } + return +} + +// MachinePools returns the value of the 'machine_pools' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of machine pools on this cluster. +func (o *Cluster) MachinePools() *MachinePoolList { + if o != nil && o.bitmap_&2199023255552 != 0 { + return o.machinePools + } + return nil +} + +// GetMachinePools returns the value of the 'machine_pools' attribute and +// a flag indicating if the attribute has a value. +// +// List of machine pools on this cluster. +func (o *Cluster) GetMachinePools() (value *MachinePoolList, ok bool) { + ok = o != nil && o.bitmap_&2199023255552 != 0 + if ok { + value = o.machinePools + } + return +} + +// Managed returns the value of the 'managed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Flag indicating if the cluster is managed (by Red Hat) or +// self-managed by the user. +func (o *Cluster) Managed() bool { + if o != nil && o.bitmap_&4398046511104 != 0 { + return o.managed + } + return false +} + +// GetManaged returns the value of the 'managed' attribute and +// a flag indicating if the attribute has a value. +// +// Flag indicating if the cluster is managed (by Red Hat) or +// self-managed by the user. +func (o *Cluster) GetManaged() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4398046511104 != 0 + if ok { + value = o.managed + } + return +} + +// ManagedService returns the value of the 'managed_service' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains information about Managed Service +func (o *Cluster) ManagedService() *ManagedService { + if o != nil && o.bitmap_&8796093022208 != 0 { + return o.managedService + } + return nil +} + +// GetManagedService returns the value of the 'managed_service' attribute and +// a flag indicating if the attribute has a value. +// +// Contains information about Managed Service +func (o *Cluster) GetManagedService() (value *ManagedService, ok bool) { + ok = o != nil && o.bitmap_&8796093022208 != 0 + if ok { + value = o.managedService + } + return +} + +// MultiAZ returns the value of the 'multi_AZ' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Flag indicating if the cluster should be created with nodes in +// different availability zones or all the nodes in a single one +// randomly selected. +func (o *Cluster) MultiAZ() bool { + if o != nil && o.bitmap_&17592186044416 != 0 { + return o.multiAZ + } + return false +} + +// GetMultiAZ returns the value of the 'multi_AZ' attribute and +// a flag indicating if the attribute has a value. +// +// Flag indicating if the cluster should be created with nodes in +// different availability zones or all the nodes in a single one +// randomly selected. +func (o *Cluster) GetMultiAZ() (value bool, ok bool) { + ok = o != nil && o.bitmap_&17592186044416 != 0 + if ok { + value = o.multiAZ + } + return +} + +// MultiArchEnabled returns the value of the 'multi_arch_enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicate whether the cluster is enabled for multi arch workers +func (o *Cluster) MultiArchEnabled() bool { + if o != nil && o.bitmap_&35184372088832 != 0 { + return o.multiArchEnabled + } + return false +} + +// GetMultiArchEnabled returns the value of the 'multi_arch_enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicate whether the cluster is enabled for multi arch workers +func (o *Cluster) GetMultiArchEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&35184372088832 != 0 + if ok { + value = o.multiArchEnabled + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the cluster. This name is assigned by the user when the +// cluster is created. This is used to uniquely identify the cluster +func (o *Cluster) Name() string { + if o != nil && o.bitmap_&70368744177664 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the cluster. This name is assigned by the user when the +// cluster is created. This is used to uniquely identify the cluster +func (o *Cluster) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&70368744177664 != 0 + if ok { + value = o.name + } + return +} + +// Network returns the value of the 'network' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Network settings of the cluster. +func (o *Cluster) Network() *Network { + if o != nil && o.bitmap_&140737488355328 != 0 { + return o.network + } + return nil +} + +// GetNetwork returns the value of the 'network' attribute and +// a flag indicating if the attribute has a value. +// +// Network settings of the cluster. +func (o *Cluster) GetNetwork() (value *Network, ok bool) { + ok = o != nil && o.bitmap_&140737488355328 != 0 + if ok { + value = o.network + } + return +} + +// NodeDrainGracePeriod returns the value of the 'node_drain_grace_period' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Node drain grace period. +func (o *Cluster) NodeDrainGracePeriod() *Value { + if o != nil && o.bitmap_&281474976710656 != 0 { + return o.nodeDrainGracePeriod + } + return nil +} + +// GetNodeDrainGracePeriod returns the value of the 'node_drain_grace_period' attribute and +// a flag indicating if the attribute has a value. +// +// Node drain grace period. +func (o *Cluster) GetNodeDrainGracePeriod() (value *Value, ok bool) { + ok = o != nil && o.bitmap_&281474976710656 != 0 + if ok { + value = o.nodeDrainGracePeriod + } + return +} + +// NodePools returns the value of the 'node_pools' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of node pools on this cluster. +// NodePool is a scalable set of worker nodes attached to a hosted cluster. +func (o *Cluster) NodePools() *NodePoolList { + if o != nil && o.bitmap_&562949953421312 != 0 { + return o.nodePools + } + return nil +} + +// GetNodePools returns the value of the 'node_pools' attribute and +// a flag indicating if the attribute has a value. +// +// List of node pools on this cluster. +// NodePool is a scalable set of worker nodes attached to a hosted cluster. +func (o *Cluster) GetNodePools() (value *NodePoolList, ok bool) { + ok = o != nil && o.bitmap_&562949953421312 != 0 + if ok { + value = o.nodePools + } + return +} + +// Nodes returns the value of the 'nodes' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Information about the nodes of the cluster. +func (o *Cluster) Nodes() *ClusterNodes { + if o != nil && o.bitmap_&1125899906842624 != 0 { + return o.nodes + } + return nil +} + +// GetNodes returns the value of the 'nodes' attribute and +// a flag indicating if the attribute has a value. +// +// Information about the nodes of the cluster. +func (o *Cluster) GetNodes() (value *ClusterNodes, ok bool) { + ok = o != nil && o.bitmap_&1125899906842624 != 0 + if ok { + value = o.nodes + } + return +} + +// OpenshiftVersion returns the value of the 'openshift_version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Version of _OpenShift_ installed in the cluster, for example `4.0.0-0.2`. +// +// When retrieving a cluster this will always be reported. +// +// When provisioning a cluster this will be ignored, as the version to +// deploy will be determined internally. +func (o *Cluster) OpenshiftVersion() string { + if o != nil && o.bitmap_&2251799813685248 != 0 { + return o.openshiftVersion + } + return "" +} + +// GetOpenshiftVersion returns the value of the 'openshift_version' attribute and +// a flag indicating if the attribute has a value. +// +// Version of _OpenShift_ installed in the cluster, for example `4.0.0-0.2`. +// +// When retrieving a cluster this will always be reported. +// +// When provisioning a cluster this will be ignored, as the version to +// deploy will be determined internally. +func (o *Cluster) GetOpenshiftVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&2251799813685248 != 0 + if ok { + value = o.openshiftVersion + } + return +} + +// Product returns the value of the 'product' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the product type of this cluster. +func (o *Cluster) Product() *Product { + if o != nil && o.bitmap_&4503599627370496 != 0 { + return o.product + } + return nil +} + +// GetProduct returns the value of the 'product' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the product type of this cluster. +func (o *Cluster) GetProduct() (value *Product, ok bool) { + ok = o != nil && o.bitmap_&4503599627370496 != 0 + if ok { + value = o.product + } + return +} + +// Properties returns the value of the 'properties' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// User defined properties for tagging and querying. +func (o *Cluster) Properties() map[string]string { + if o != nil && o.bitmap_&9007199254740992 != 0 { + return o.properties + } + return nil +} + +// GetProperties returns the value of the 'properties' attribute and +// a flag indicating if the attribute has a value. +// +// User defined properties for tagging and querying. +func (o *Cluster) GetProperties() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&9007199254740992 != 0 + if ok { + value = o.properties + } + return +} + +// ProvisionShard returns the value of the 'provision_shard' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ProvisionShard contains the properties of the provision shard, including AWS and GCP related configurations +func (o *Cluster) ProvisionShard() *ProvisionShard { + if o != nil && o.bitmap_&18014398509481984 != 0 { + return o.provisionShard + } + return nil +} + +// GetProvisionShard returns the value of the 'provision_shard' attribute and +// a flag indicating if the attribute has a value. +// +// ProvisionShard contains the properties of the provision shard, including AWS and GCP related configurations +func (o *Cluster) GetProvisionShard() (value *ProvisionShard, ok bool) { + ok = o != nil && o.bitmap_&18014398509481984 != 0 + if ok { + value = o.provisionShard + } + return +} + +// Proxy returns the value of the 'proxy' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Proxy. +func (o *Cluster) Proxy() *Proxy { + if o != nil && o.bitmap_&36028797018963968 != 0 { + return o.proxy + } + return nil +} + +// GetProxy returns the value of the 'proxy' attribute and +// a flag indicating if the attribute has a value. +// +// Proxy. +func (o *Cluster) GetProxy() (value *Proxy, ok bool) { + ok = o != nil && o.bitmap_&36028797018963968 != 0 + if ok { + value = o.proxy + } + return +} + +// Region returns the value of the 'region' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the cloud provider region where the cluster is installed. +func (o *Cluster) Region() *CloudRegion { + if o != nil && o.bitmap_&72057594037927936 != 0 { + return o.region + } + return nil +} + +// GetRegion returns the value of the 'region' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the cloud provider region where the cluster is installed. +func (o *Cluster) GetRegion() (value *CloudRegion, ok bool) { + ok = o != nil && o.bitmap_&72057594037927936 != 0 + if ok { + value = o.region + } + return +} + +// RegistryConfig returns the value of the 'registry_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Registry configuration for the cluster +func (o *Cluster) RegistryConfig() *ClusterRegistryConfig { + if o != nil && o.bitmap_&144115188075855872 != 0 { + return o.registryConfig + } + return nil +} + +// GetRegistryConfig returns the value of the 'registry_config' attribute and +// a flag indicating if the attribute has a value. +// +// Registry configuration for the cluster +func (o *Cluster) GetRegistryConfig() (value *ClusterRegistryConfig, ok bool) { + ok = o != nil && o.bitmap_&144115188075855872 != 0 + if ok { + value = o.registryConfig + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Overall state of the cluster. +func (o *Cluster) State() ClusterState { + if o != nil && o.bitmap_&288230376151711744 != 0 { + return o.state + } + return ClusterState("") +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// Overall state of the cluster. +func (o *Cluster) GetState() (value ClusterState, ok bool) { + ok = o != nil && o.bitmap_&288230376151711744 != 0 + if ok { + value = o.state + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Status of cluster +func (o *Cluster) Status() *ClusterStatus { + if o != nil && o.bitmap_&576460752303423488 != 0 { + return o.status + } + return nil +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// Status of cluster +func (o *Cluster) GetStatus() (value *ClusterStatus, ok bool) { + ok = o != nil && o.bitmap_&576460752303423488 != 0 + if ok { + value = o.status + } + return +} + +// StorageQuota returns the value of the 'storage_quota' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Storage quota to be assigned to the cluster. +func (o *Cluster) StorageQuota() *Value { + if o != nil && o.bitmap_&1152921504606846976 != 0 { + return o.storageQuota + } + return nil +} + +// GetStorageQuota returns the value of the 'storage_quota' attribute and +// a flag indicating if the attribute has a value. +// +// Storage quota to be assigned to the cluster. +func (o *Cluster) GetStorageQuota() (value *Value, ok bool) { + ok = o != nil && o.bitmap_&1152921504606846976 != 0 + if ok { + value = o.storageQuota + } + return +} + +// Subscription returns the value of the 'subscription' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the subscription that comes from the account management service when the cluster +// is registered. +func (o *Cluster) Subscription() *Subscription { + if o != nil && o.bitmap_&2305843009213693952 != 0 { + return o.subscription + } + return nil +} + +// GetSubscription returns the value of the 'subscription' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the subscription that comes from the account management service when the cluster +// is registered. +func (o *Cluster) GetSubscription() (value *Subscription, ok bool) { + ok = o != nil && o.bitmap_&2305843009213693952 != 0 + if ok { + value = o.subscription + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the version of _OpenShift_ that will be used to install the cluster. +func (o *Cluster) Version() *Version { + if o != nil && o.bitmap_&4611686018427387904 != 0 { + return o.version + } + return nil +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the version of _OpenShift_ that will be used to install the cluster. +func (o *Cluster) GetVersion() (value *Version, ok bool) { + ok = o != nil && o.bitmap_&4611686018427387904 != 0 + if ok { + value = o.version + } + return +} + +// ClusterListKind is the name of the type used to represent list of objects of +// type 'cluster'. +const ClusterListKind = "ClusterList" + +// ClusterListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster'. +const ClusterListLinkKind = "ClusterListLink" + +// ClusterNilKind is the name of the type used to nil lists of objects of +// type 'cluster'. +const ClusterListNilKind = "ClusterListNil" + +// ClusterList is a list of values of the 'cluster' type. +type ClusterList struct { + href string + link bool + items []*Cluster +} + +// Kind returns the name of the type of the object. +func (l *ClusterList) Kind() string { + if l == nil { + return ClusterListNilKind + } + if l.link { + return ClusterListLinkKind + } + return ClusterListKind +} + +// Link returns true iif this is a link. +func (l *ClusterList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ClusterList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ClusterList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ClusterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterList) SetItems(items []*Cluster) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterList) Items() []*Cluster { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterList) Get(i int) *Cluster { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterList) Slice() []*Cluster { + var slice []*Cluster + if l == nil { + slice = make([]*Cluster, 0) + } else { + slice = make([]*Cluster, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterList) Each(f func(item *Cluster) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterList) Range(f func(index int, item *Cluster) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cluster_type_json.go b/clientapi/clustersmgmt/v1/cluster_type_json.go new file mode 100644 index 00000000..bbede6de --- /dev/null +++ b/clientapi/clustersmgmt/v1/cluster_type_json.go @@ -0,0 +1,1088 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCluster writes a value of the 'cluster' type to the given writer. +func MarshalCluster(object *Cluster, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCluster(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCluster writes a value of the 'cluster' type to the given stream. +func WriteCluster(object *Cluster, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ClusterLinkKind) + } else { + stream.WriteString(ClusterKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.api != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("api") + WriteClusterAPI(object.api, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.aws != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws") + WriteAWS(object.aws, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.awsInfrastructureAccessRoleGrants != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws_infrastructure_access_role_grants") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteAWSInfrastructureAccessRoleGrantList(object.awsInfrastructureAccessRoleGrants.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&64 != 0 && object.ccs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ccs") + WriteCCS(object.ccs, stream) + count++ + } + present_ = object.bitmap_&128 != 0 && object.dns != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("dns") + WriteDNS(object.dns, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("fips") + stream.WriteBool(object.fips) + count++ + } + present_ = object.bitmap_&512 != 0 && object.gcp != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp") + WriteGCP(object.gcp, stream) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.gcpEncryptionKey != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp_encryption_key") + WriteGCPEncryptionKey(object.gcpEncryptionKey, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.gcpNetwork != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp_network") + WriteGCPNetwork(object.gcpNetwork, stream) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_trust_bundle") + stream.WriteString(object.additionalTrustBundle) + count++ + } + present_ = object.bitmap_&8192 != 0 && object.addons != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("addons") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteAddOnInstallationList(object.addons.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&16384 != 0 && object.autoscaler != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("autoscaler") + WriteClusterAutoscaler(object.autoscaler, stream) + count++ + } + present_ = object.bitmap_&32768 != 0 && object.azure != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("azure") + WriteAzure(object.azure, stream) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_model") + stream.WriteString(string(object.billingModel)) + count++ + } + present_ = object.bitmap_&131072 != 0 && object.byoOidc != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("byo_oidc") + WriteByoOidc(object.byoOidc, stream) + count++ + } + present_ = object.bitmap_&262144 != 0 && object.capabilities != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("capabilities") + WriteClusterCapabilities(object.capabilities, stream) + count++ + } + present_ = object.bitmap_&524288 != 0 && object.cloudProvider != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + WriteCloudProvider(object.cloudProvider, stream) + count++ + } + present_ = object.bitmap_&1048576 != 0 && object.console != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("console") + WriteClusterConsole(object.console, stream) + count++ + } + present_ = object.bitmap_&2097152 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&4194304 != 0 && object.deleteProtection != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("delete_protection") + WriteDeleteProtection(object.deleteProtection, stream) + count++ + } + present_ = object.bitmap_&8388608 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("disable_user_workload_monitoring") + stream.WriteBool(object.disableUserWorkloadMonitoring) + count++ + } + present_ = object.bitmap_&16777216 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("domain_prefix") + stream.WriteString(object.domainPrefix) + count++ + } + present_ = object.bitmap_&33554432 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("etcd_encryption") + stream.WriteBool(object.etcdEncryption) + count++ + } + present_ = object.bitmap_&67108864 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("expiration_timestamp") + stream.WriteString((object.expirationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&134217728 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_id") + stream.WriteString(object.externalID) + count++ + } + present_ = object.bitmap_&268435456 != 0 && object.externalAuthConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_auth_config") + WriteExternalAuthConfig(object.externalAuthConfig, stream) + count++ + } + present_ = object.bitmap_&536870912 != 0 && object.externalConfiguration != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_configuration") + WriteExternalConfiguration(object.externalConfiguration, stream) + count++ + } + present_ = object.bitmap_&1073741824 != 0 && object.flavour != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("flavour") + WriteFlavour(object.flavour, stream) + count++ + } + present_ = object.bitmap_&2147483648 != 0 && object.groups != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("groups") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteGroupList(object.groups.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&4294967296 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("health_state") + stream.WriteString(string(object.healthState)) + count++ + } + present_ = object.bitmap_&8589934592 != 0 && object.htpasswd != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("htpasswd") + WriteHTPasswdIdentityProvider(object.htpasswd, stream) + count++ + } + present_ = object.bitmap_&17179869184 != 0 && object.hypershift != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hypershift") + WriteHypershift(object.hypershift, stream) + count++ + } + present_ = object.bitmap_&34359738368 != 0 && object.identityProviders != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("identity_providers") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteIdentityProviderList(object.identityProviders.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&68719476736 != 0 && object.inflightChecks != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("inflight_checks") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteInflightCheckList(object.inflightChecks.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&137438953472 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("infra_id") + stream.WriteString(object.infraID) + count++ + } + present_ = object.bitmap_&274877906944 != 0 && object.ingresses != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ingresses") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteIngressList(object.ingresses.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&549755813888 != 0 && object.kubeletConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kubelet_config") + WriteKubeletConfig(object.kubeletConfig, stream) + count++ + } + present_ = object.bitmap_&1099511627776 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("load_balancer_quota") + stream.WriteInt(object.loadBalancerQuota) + count++ + } + present_ = object.bitmap_&2199023255552 != 0 && object.machinePools != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("machine_pools") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteMachinePoolList(object.machinePools.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&4398046511104 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed") + stream.WriteBool(object.managed) + count++ + } + present_ = object.bitmap_&8796093022208 != 0 && object.managedService != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_service") + WriteManagedService(object.managedService, stream) + count++ + } + present_ = object.bitmap_&17592186044416 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("multi_az") + stream.WriteBool(object.multiAZ) + count++ + } + present_ = object.bitmap_&35184372088832 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("multi_arch_enabled") + stream.WriteBool(object.multiArchEnabled) + count++ + } + present_ = object.bitmap_&70368744177664 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&140737488355328 != 0 && object.network != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("network") + WriteNetwork(object.network, stream) + count++ + } + present_ = object.bitmap_&281474976710656 != 0 && object.nodeDrainGracePeriod != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("node_drain_grace_period") + WriteValue(object.nodeDrainGracePeriod, stream) + count++ + } + present_ = object.bitmap_&562949953421312 != 0 && object.nodePools != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("node_pools") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteNodePoolList(object.nodePools.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&1125899906842624 != 0 && object.nodes != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("nodes") + WriteClusterNodes(object.nodes, stream) + count++ + } + present_ = object.bitmap_&2251799813685248 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("openshift_version") + stream.WriteString(object.openshiftVersion) + count++ + } + present_ = object.bitmap_&4503599627370496 != 0 && object.product != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product") + WriteProduct(object.product, stream) + count++ + } + present_ = object.bitmap_&9007199254740992 != 0 && object.properties != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("properties") + if object.properties != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.properties)) + i := 0 + for key := range object.properties { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.properties[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&18014398509481984 != 0 && object.provisionShard != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("provision_shard") + WriteProvisionShard(object.provisionShard, stream) + count++ + } + present_ = object.bitmap_&36028797018963968 != 0 && object.proxy != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("proxy") + WriteProxy(object.proxy, stream) + count++ + } + present_ = object.bitmap_&72057594037927936 != 0 && object.region != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region") + WriteCloudRegion(object.region, stream) + count++ + } + present_ = object.bitmap_&144115188075855872 != 0 && object.registryConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("registry_config") + WriteClusterRegistryConfig(object.registryConfig, stream) + count++ + } + present_ = object.bitmap_&288230376151711744 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(string(object.state)) + count++ + } + present_ = object.bitmap_&576460752303423488 != 0 && object.status != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + WriteClusterStatus(object.status, stream) + count++ + } + present_ = object.bitmap_&1152921504606846976 != 0 && object.storageQuota != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("storage_quota") + WriteValue(object.storageQuota, stream) + count++ + } + present_ = object.bitmap_&2305843009213693952 != 0 && object.subscription != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription") + WriteSubscription(object.subscription, stream) + count++ + } + present_ = object.bitmap_&4611686018427387904 != 0 && object.version != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + WriteVersion(object.version, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalCluster reads a value of the 'cluster' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCluster(source interface{}) (object *Cluster, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCluster(iterator) + err = iterator.Error + return +} + +// ReadCluster reads a value of the 'cluster' type from the given iterator. +func ReadCluster(iterator *jsoniter.Iterator) *Cluster { + object := &Cluster{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ClusterLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "api": + value := ReadClusterAPI(iterator) + object.api = value + object.bitmap_ |= 8 + case "aws": + value := ReadAWS(iterator) + object.aws = value + object.bitmap_ |= 16 + case "aws_infrastructure_access_role_grants": + value := &AWSInfrastructureAccessRoleGrantList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == AWSInfrastructureAccessRoleGrantListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadAWSInfrastructureAccessRoleGrantList(iterator)) + default: + iterator.ReadAny() + } + } + object.awsInfrastructureAccessRoleGrants = value + object.bitmap_ |= 32 + case "ccs": + value := ReadCCS(iterator) + object.ccs = value + object.bitmap_ |= 64 + case "dns": + value := ReadDNS(iterator) + object.dns = value + object.bitmap_ |= 128 + case "fips": + value := iterator.ReadBool() + object.fips = value + object.bitmap_ |= 256 + case "gcp": + value := ReadGCP(iterator) + object.gcp = value + object.bitmap_ |= 512 + case "gcp_encryption_key": + value := ReadGCPEncryptionKey(iterator) + object.gcpEncryptionKey = value + object.bitmap_ |= 1024 + case "gcp_network": + value := ReadGCPNetwork(iterator) + object.gcpNetwork = value + object.bitmap_ |= 2048 + case "additional_trust_bundle": + value := iterator.ReadString() + object.additionalTrustBundle = value + object.bitmap_ |= 4096 + case "addons": + value := &AddOnInstallationList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == AddOnInstallationListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadAddOnInstallationList(iterator)) + default: + iterator.ReadAny() + } + } + object.addons = value + object.bitmap_ |= 8192 + case "autoscaler": + value := ReadClusterAutoscaler(iterator) + object.autoscaler = value + object.bitmap_ |= 16384 + case "azure": + value := ReadAzure(iterator) + object.azure = value + object.bitmap_ |= 32768 + case "billing_model": + text := iterator.ReadString() + value := BillingModel(text) + object.billingModel = value + object.bitmap_ |= 65536 + case "byo_oidc": + value := ReadByoOidc(iterator) + object.byoOidc = value + object.bitmap_ |= 131072 + case "capabilities": + value := ReadClusterCapabilities(iterator) + object.capabilities = value + object.bitmap_ |= 262144 + case "cloud_provider": + value := ReadCloudProvider(iterator) + object.cloudProvider = value + object.bitmap_ |= 524288 + case "console": + value := ReadClusterConsole(iterator) + object.console = value + object.bitmap_ |= 1048576 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 2097152 + case "delete_protection": + value := ReadDeleteProtection(iterator) + object.deleteProtection = value + object.bitmap_ |= 4194304 + case "disable_user_workload_monitoring": + value := iterator.ReadBool() + object.disableUserWorkloadMonitoring = value + object.bitmap_ |= 8388608 + case "domain_prefix": + value := iterator.ReadString() + object.domainPrefix = value + object.bitmap_ |= 16777216 + case "etcd_encryption": + value := iterator.ReadBool() + object.etcdEncryption = value + object.bitmap_ |= 33554432 + case "expiration_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.expirationTimestamp = value + object.bitmap_ |= 67108864 + case "external_id": + value := iterator.ReadString() + object.externalID = value + object.bitmap_ |= 134217728 + case "external_auth_config": + value := ReadExternalAuthConfig(iterator) + object.externalAuthConfig = value + object.bitmap_ |= 268435456 + case "external_configuration": + value := ReadExternalConfiguration(iterator) + object.externalConfiguration = value + object.bitmap_ |= 536870912 + case "flavour": + value := ReadFlavour(iterator) + object.flavour = value + object.bitmap_ |= 1073741824 + case "groups": + value := &GroupList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == GroupListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadGroupList(iterator)) + default: + iterator.ReadAny() + } + } + object.groups = value + object.bitmap_ |= 2147483648 + case "health_state": + text := iterator.ReadString() + value := ClusterHealthState(text) + object.healthState = value + object.bitmap_ |= 4294967296 + case "htpasswd": + value := ReadHTPasswdIdentityProvider(iterator) + object.htpasswd = value + object.bitmap_ |= 8589934592 + case "hypershift": + value := ReadHypershift(iterator) + object.hypershift = value + object.bitmap_ |= 17179869184 + case "identity_providers": + value := &IdentityProviderList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == IdentityProviderListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadIdentityProviderList(iterator)) + default: + iterator.ReadAny() + } + } + object.identityProviders = value + object.bitmap_ |= 34359738368 + case "inflight_checks": + value := &InflightCheckList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == InflightCheckListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadInflightCheckList(iterator)) + default: + iterator.ReadAny() + } + } + object.inflightChecks = value + object.bitmap_ |= 68719476736 + case "infra_id": + value := iterator.ReadString() + object.infraID = value + object.bitmap_ |= 137438953472 + case "ingresses": + value := &IngressList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == IngressListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadIngressList(iterator)) + default: + iterator.ReadAny() + } + } + object.ingresses = value + object.bitmap_ |= 274877906944 + case "kubelet_config": + value := ReadKubeletConfig(iterator) + object.kubeletConfig = value + object.bitmap_ |= 549755813888 + case "load_balancer_quota": + value := iterator.ReadInt() + object.loadBalancerQuota = value + object.bitmap_ |= 1099511627776 + case "machine_pools": + value := &MachinePoolList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == MachinePoolListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadMachinePoolList(iterator)) + default: + iterator.ReadAny() + } + } + object.machinePools = value + object.bitmap_ |= 2199023255552 + case "managed": + value := iterator.ReadBool() + object.managed = value + object.bitmap_ |= 4398046511104 + case "managed_service": + value := ReadManagedService(iterator) + object.managedService = value + object.bitmap_ |= 8796093022208 + case "multi_az": + value := iterator.ReadBool() + object.multiAZ = value + object.bitmap_ |= 17592186044416 + case "multi_arch_enabled": + value := iterator.ReadBool() + object.multiArchEnabled = value + object.bitmap_ |= 35184372088832 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 70368744177664 + case "network": + value := ReadNetwork(iterator) + object.network = value + object.bitmap_ |= 140737488355328 + case "node_drain_grace_period": + value := ReadValue(iterator) + object.nodeDrainGracePeriod = value + object.bitmap_ |= 281474976710656 + case "node_pools": + value := &NodePoolList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == NodePoolListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadNodePoolList(iterator)) + default: + iterator.ReadAny() + } + } + object.nodePools = value + object.bitmap_ |= 562949953421312 + case "nodes": + value := ReadClusterNodes(iterator) + object.nodes = value + object.bitmap_ |= 1125899906842624 + case "openshift_version": + value := iterator.ReadString() + object.openshiftVersion = value + object.bitmap_ |= 2251799813685248 + case "product": + value := ReadProduct(iterator) + object.product = value + object.bitmap_ |= 4503599627370496 + case "properties": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.properties = value + object.bitmap_ |= 9007199254740992 + case "provision_shard": + value := ReadProvisionShard(iterator) + object.provisionShard = value + object.bitmap_ |= 18014398509481984 + case "proxy": + value := ReadProxy(iterator) + object.proxy = value + object.bitmap_ |= 36028797018963968 + case "region": + value := ReadCloudRegion(iterator) + object.region = value + object.bitmap_ |= 72057594037927936 + case "registry_config": + value := ReadClusterRegistryConfig(iterator) + object.registryConfig = value + object.bitmap_ |= 144115188075855872 + case "state": + text := iterator.ReadString() + value := ClusterState(text) + object.state = value + object.bitmap_ |= 288230376151711744 + case "status": + value := ReadClusterStatus(iterator) + object.status = value + object.bitmap_ |= 576460752303423488 + case "storage_quota": + value := ReadValue(iterator) + object.storageQuota = value + object.bitmap_ |= 1152921504606846976 + case "subscription": + value := ReadSubscription(iterator) + object.subscription = value + object.bitmap_ |= 2305843009213693952 + case "version": + value := ReadVersion(iterator) + object.version = value + object.bitmap_ |= 4611686018427387904 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/component_route_builder.go b/clientapi/clustersmgmt/v1/component_route_builder.go new file mode 100644 index 00000000..570e5955 --- /dev/null +++ b/clientapi/clustersmgmt/v1/component_route_builder.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ComponentRouteBuilder contains the data and logic needed to build 'component_route' objects. +// +// Representation of a Component Route. +type ComponentRouteBuilder struct { + bitmap_ uint32 + id string + href string + hostname string + tlsSecretRef string +} + +// NewComponentRoute creates a new builder of 'component_route' objects. +func NewComponentRoute() *ComponentRouteBuilder { + return &ComponentRouteBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ComponentRouteBuilder) Link(value bool) *ComponentRouteBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ComponentRouteBuilder) ID(value string) *ComponentRouteBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ComponentRouteBuilder) HREF(value string) *ComponentRouteBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ComponentRouteBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Hostname sets the value of the 'hostname' attribute to the given value. +func (b *ComponentRouteBuilder) Hostname(value string) *ComponentRouteBuilder { + b.hostname = value + b.bitmap_ |= 8 + return b +} + +// TlsSecretRef sets the value of the 'tls_secret_ref' attribute to the given value. +func (b *ComponentRouteBuilder) TlsSecretRef(value string) *ComponentRouteBuilder { + b.tlsSecretRef = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ComponentRouteBuilder) Copy(object *ComponentRoute) *ComponentRouteBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.hostname = object.hostname + b.tlsSecretRef = object.tlsSecretRef + return b +} + +// Build creates a 'component_route' object using the configuration stored in the builder. +func (b *ComponentRouteBuilder) Build() (object *ComponentRoute, err error) { + object = new(ComponentRoute) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.hostname = b.hostname + object.tlsSecretRef = b.tlsSecretRef + return +} diff --git a/clientapi/clustersmgmt/v1/component_route_list_builder.go b/clientapi/clustersmgmt/v1/component_route_list_builder.go new file mode 100644 index 00000000..0d181a77 --- /dev/null +++ b/clientapi/clustersmgmt/v1/component_route_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ComponentRouteListBuilder contains the data and logic needed to build +// 'component_route' objects. +type ComponentRouteListBuilder struct { + items []*ComponentRouteBuilder +} + +// NewComponentRouteList creates a new builder of 'component_route' objects. +func NewComponentRouteList() *ComponentRouteListBuilder { + return new(ComponentRouteListBuilder) +} + +// Items sets the items of the list. +func (b *ComponentRouteListBuilder) Items(values ...*ComponentRouteBuilder) *ComponentRouteListBuilder { + b.items = make([]*ComponentRouteBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ComponentRouteListBuilder) 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 *ComponentRouteListBuilder) Copy(list *ComponentRouteList) *ComponentRouteListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ComponentRouteBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewComponentRoute().Copy(v) + } + } + return b +} + +// Build creates a list of 'component_route' objects using the +// configuration stored in the builder. +func (b *ComponentRouteListBuilder) Build() (list *ComponentRouteList, err error) { + items := make([]*ComponentRoute, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ComponentRouteList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/component_route_list_type_json.go b/clientapi/clustersmgmt/v1/component_route_list_type_json.go new file mode 100644 index 00000000..f10c84c5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/component_route_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalComponentRouteList writes a list of values of the 'component_route' type to +// the given writer. +func MarshalComponentRouteList(list []*ComponentRoute, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteComponentRouteList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteComponentRouteList writes a list of value of the 'component_route' type to +// the given stream. +func WriteComponentRouteList(list []*ComponentRoute, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteComponentRoute(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalComponentRouteList reads a list of values of the 'component_route' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalComponentRouteList(source interface{}) (items []*ComponentRoute, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadComponentRouteList(iterator) + err = iterator.Error + return +} + +// ReadComponentRouteList reads list of values of the ”component_route' type from +// the given iterator. +func ReadComponentRouteList(iterator *jsoniter.Iterator) []*ComponentRoute { + list := []*ComponentRoute{} + for iterator.ReadArray() { + item := ReadComponentRoute(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/component_route_type.go b/clientapi/clustersmgmt/v1/component_route_type.go new file mode 100644 index 00000000..c7a5318d --- /dev/null +++ b/clientapi/clustersmgmt/v1/component_route_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ComponentRouteKind is the name of the type used to represent objects +// of type 'component_route'. +const ComponentRouteKind = "ComponentRoute" + +// ComponentRouteLinkKind is the name of the type used to represent links +// to objects of type 'component_route'. +const ComponentRouteLinkKind = "ComponentRouteLink" + +// ComponentRouteNilKind is the name of the type used to nil references +// to objects of type 'component_route'. +const ComponentRouteNilKind = "ComponentRouteNil" + +// ComponentRoute represents the values of the 'component_route' type. +// +// Representation of a Component Route. +type ComponentRoute struct { + bitmap_ uint32 + id string + href string + hostname string + tlsSecretRef string +} + +// Kind returns the name of the type of the object. +func (o *ComponentRoute) Kind() string { + if o == nil { + return ComponentRouteNilKind + } + if o.bitmap_&1 != 0 { + return ComponentRouteLinkKind + } + return ComponentRouteKind +} + +// Link returns true if this is a link. +func (o *ComponentRoute) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ComponentRoute) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ComponentRoute) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ComponentRoute) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ComponentRoute) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ComponentRoute) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Hostname returns the value of the 'hostname' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Hostname of the route. +func (o *ComponentRoute) Hostname() string { + if o != nil && o.bitmap_&8 != 0 { + return o.hostname + } + return "" +} + +// GetHostname returns the value of the 'hostname' attribute and +// a flag indicating if the attribute has a value. +// +// Hostname of the route. +func (o *ComponentRoute) GetHostname() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.hostname + } + return +} + +// TlsSecretRef returns the value of the 'tls_secret_ref' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// TLS Secret reference of the route. +func (o *ComponentRoute) TlsSecretRef() string { + if o != nil && o.bitmap_&16 != 0 { + return o.tlsSecretRef + } + return "" +} + +// GetTlsSecretRef returns the value of the 'tls_secret_ref' attribute and +// a flag indicating if the attribute has a value. +// +// TLS Secret reference of the route. +func (o *ComponentRoute) GetTlsSecretRef() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.tlsSecretRef + } + return +} + +// ComponentRouteListKind is the name of the type used to represent list of objects of +// type 'component_route'. +const ComponentRouteListKind = "ComponentRouteList" + +// ComponentRouteListLinkKind is the name of the type used to represent links to list +// of objects of type 'component_route'. +const ComponentRouteListLinkKind = "ComponentRouteListLink" + +// ComponentRouteNilKind is the name of the type used to nil lists of objects of +// type 'component_route'. +const ComponentRouteListNilKind = "ComponentRouteListNil" + +// ComponentRouteList is a list of values of the 'component_route' type. +type ComponentRouteList struct { + href string + link bool + items []*ComponentRoute +} + +// Kind returns the name of the type of the object. +func (l *ComponentRouteList) Kind() string { + if l == nil { + return ComponentRouteListNilKind + } + if l.link { + return ComponentRouteListLinkKind + } + return ComponentRouteListKind +} + +// Link returns true iif this is a link. +func (l *ComponentRouteList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ComponentRouteList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ComponentRouteList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ComponentRouteList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ComponentRouteList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ComponentRouteList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ComponentRouteList) SetItems(items []*ComponentRoute) { + l.items = items +} + +// Items returns the items of the list. +func (l *ComponentRouteList) Items() []*ComponentRoute { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ComponentRouteList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ComponentRouteList) Get(i int) *ComponentRoute { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ComponentRouteList) Slice() []*ComponentRoute { + var slice []*ComponentRoute + if l == nil { + slice = make([]*ComponentRoute, 0) + } else { + slice = make([]*ComponentRoute, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ComponentRouteList) Each(f func(item *ComponentRoute) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ComponentRouteList) Range(f func(index int, item *ComponentRoute) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/component_route_type_json.go b/clientapi/clustersmgmt/v1/component_route_type_json.go new file mode 100644 index 00000000..7d8ae001 --- /dev/null +++ b/clientapi/clustersmgmt/v1/component_route_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalComponentRoute writes a value of the 'component_route' type to the given writer. +func MarshalComponentRoute(object *ComponentRoute, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteComponentRoute(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteComponentRoute writes a value of the 'component_route' type to the given stream. +func WriteComponentRoute(object *ComponentRoute, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ComponentRouteLinkKind) + } else { + stream.WriteString(ComponentRouteKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hostname") + stream.WriteString(object.hostname) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("tls_secret_ref") + stream.WriteString(object.tlsSecretRef) + } + stream.WriteObjectEnd() +} + +// UnmarshalComponentRoute reads a value of the 'component_route' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalComponentRoute(source interface{}) (object *ComponentRoute, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadComponentRoute(iterator) + err = iterator.Error + return +} + +// ReadComponentRoute reads a value of the 'component_route' type from the given iterator. +func ReadComponentRoute(iterator *jsoniter.Iterator) *ComponentRoute { + object := &ComponentRoute{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ComponentRouteLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "hostname": + value := iterator.ReadString() + object.hostname = value + object.bitmap_ |= 8 + case "tls_secret_ref": + value := iterator.ReadString() + object.tlsSecretRef = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/component_route_type_list_type_json.go b/clientapi/clustersmgmt/v1/component_route_type_list_type_json.go new file mode 100644 index 00000000..867ac579 --- /dev/null +++ b/clientapi/clustersmgmt/v1/component_route_type_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalComponentRouteTypeList writes a list of values of the 'component_route_type' type to +// the given writer. +func MarshalComponentRouteTypeList(list []ComponentRouteType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteComponentRouteTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteComponentRouteTypeList writes a list of value of the 'component_route_type' type to +// the given stream. +func WriteComponentRouteTypeList(list []ComponentRouteType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalComponentRouteTypeList reads a list of values of the 'component_route_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalComponentRouteTypeList(source interface{}) (items []ComponentRouteType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadComponentRouteTypeList(iterator) + err = iterator.Error + return +} + +// ReadComponentRouteTypeList reads list of values of the ”component_route_type' type from +// the given iterator. +func ReadComponentRouteTypeList(iterator *jsoniter.Iterator) []ComponentRouteType { + list := []ComponentRouteType{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ComponentRouteType(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/component_route_type_type.go b/clientapi/clustersmgmt/v1/component_route_type_type.go new file mode 100644 index 00000000..7da6d36d --- /dev/null +++ b/clientapi/clustersmgmt/v1/component_route_type_type.go @@ -0,0 +1,32 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ComponentRouteType represents the values of the 'component_route_type' enumerated type. +type ComponentRouteType string + +const ( + // + ComponentRouteTypeConsole ComponentRouteType = "console" + // + ComponentRouteTypeDownloads ComponentRouteType = "downloads" + // + ComponentRouteTypeOauth ComponentRouteType = "oauth" +) diff --git a/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_builder.go b/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_builder.go new file mode 100644 index 00000000..227204f9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_builder.go @@ -0,0 +1,202 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ControlPlaneUpgradePolicyBuilder contains the data and logic needed to build 'control_plane_upgrade_policy' objects. +// +// Representation of an upgrade policy that can be set for a cluster. +type ControlPlaneUpgradePolicyBuilder struct { + bitmap_ uint32 + id string + href string + clusterID string + creationTimestamp time.Time + lastUpdateTimestamp time.Time + nextRun time.Time + schedule string + scheduleType ScheduleType + state *UpgradePolicyStateBuilder + upgradeType UpgradeType + version string + enableMinorVersionUpgrades bool +} + +// NewControlPlaneUpgradePolicy creates a new builder of 'control_plane_upgrade_policy' objects. +func NewControlPlaneUpgradePolicy() *ControlPlaneUpgradePolicyBuilder { + return &ControlPlaneUpgradePolicyBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ControlPlaneUpgradePolicyBuilder) Link(value bool) *ControlPlaneUpgradePolicyBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ControlPlaneUpgradePolicyBuilder) ID(value string) *ControlPlaneUpgradePolicyBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ControlPlaneUpgradePolicyBuilder) HREF(value string) *ControlPlaneUpgradePolicyBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ControlPlaneUpgradePolicyBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *ControlPlaneUpgradePolicyBuilder) ClusterID(value string) *ControlPlaneUpgradePolicyBuilder { + b.clusterID = value + b.bitmap_ |= 8 + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *ControlPlaneUpgradePolicyBuilder) CreationTimestamp(value time.Time) *ControlPlaneUpgradePolicyBuilder { + b.creationTimestamp = value + b.bitmap_ |= 16 + return b +} + +// EnableMinorVersionUpgrades sets the value of the 'enable_minor_version_upgrades' attribute to the given value. +func (b *ControlPlaneUpgradePolicyBuilder) EnableMinorVersionUpgrades(value bool) *ControlPlaneUpgradePolicyBuilder { + b.enableMinorVersionUpgrades = value + b.bitmap_ |= 32 + return b +} + +// LastUpdateTimestamp sets the value of the 'last_update_timestamp' attribute to the given value. +func (b *ControlPlaneUpgradePolicyBuilder) LastUpdateTimestamp(value time.Time) *ControlPlaneUpgradePolicyBuilder { + b.lastUpdateTimestamp = value + b.bitmap_ |= 64 + return b +} + +// NextRun sets the value of the 'next_run' attribute to the given value. +func (b *ControlPlaneUpgradePolicyBuilder) NextRun(value time.Time) *ControlPlaneUpgradePolicyBuilder { + b.nextRun = value + b.bitmap_ |= 128 + return b +} + +// Schedule sets the value of the 'schedule' attribute to the given value. +func (b *ControlPlaneUpgradePolicyBuilder) Schedule(value string) *ControlPlaneUpgradePolicyBuilder { + b.schedule = value + b.bitmap_ |= 256 + return b +} + +// ScheduleType sets the value of the 'schedule_type' attribute to the given value. +// +// ScheduleType defines which type of scheduling should be used for the upgrade policy. +func (b *ControlPlaneUpgradePolicyBuilder) ScheduleType(value ScheduleType) *ControlPlaneUpgradePolicyBuilder { + b.scheduleType = value + b.bitmap_ |= 512 + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// Representation of an upgrade policy state that that is set for a cluster. +func (b *ControlPlaneUpgradePolicyBuilder) State(value *UpgradePolicyStateBuilder) *ControlPlaneUpgradePolicyBuilder { + b.state = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// UpgradeType sets the value of the 'upgrade_type' attribute to the given value. +// +// UpgradeType defines which type of upgrade should be used. +func (b *ControlPlaneUpgradePolicyBuilder) UpgradeType(value UpgradeType) *ControlPlaneUpgradePolicyBuilder { + b.upgradeType = value + b.bitmap_ |= 2048 + return b +} + +// Version sets the value of the 'version' attribute to the given value. +func (b *ControlPlaneUpgradePolicyBuilder) Version(value string) *ControlPlaneUpgradePolicyBuilder { + b.version = value + b.bitmap_ |= 4096 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ControlPlaneUpgradePolicyBuilder) Copy(object *ControlPlaneUpgradePolicy) *ControlPlaneUpgradePolicyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.clusterID = object.clusterID + b.creationTimestamp = object.creationTimestamp + b.enableMinorVersionUpgrades = object.enableMinorVersionUpgrades + b.lastUpdateTimestamp = object.lastUpdateTimestamp + b.nextRun = object.nextRun + b.schedule = object.schedule + b.scheduleType = object.scheduleType + if object.state != nil { + b.state = NewUpgradePolicyState().Copy(object.state) + } else { + b.state = nil + } + b.upgradeType = object.upgradeType + b.version = object.version + return b +} + +// Build creates a 'control_plane_upgrade_policy' object using the configuration stored in the builder. +func (b *ControlPlaneUpgradePolicyBuilder) Build() (object *ControlPlaneUpgradePolicy, err error) { + object = new(ControlPlaneUpgradePolicy) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.clusterID = b.clusterID + object.creationTimestamp = b.creationTimestamp + object.enableMinorVersionUpgrades = b.enableMinorVersionUpgrades + object.lastUpdateTimestamp = b.lastUpdateTimestamp + object.nextRun = b.nextRun + object.schedule = b.schedule + object.scheduleType = b.scheduleType + if b.state != nil { + object.state, err = b.state.Build() + if err != nil { + return + } + } + object.upgradeType = b.upgradeType + object.version = b.version + return +} diff --git a/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_list_builder.go b/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_list_builder.go new file mode 100644 index 00000000..84800df8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ControlPlaneUpgradePolicyListBuilder contains the data and logic needed to build +// 'control_plane_upgrade_policy' objects. +type ControlPlaneUpgradePolicyListBuilder struct { + items []*ControlPlaneUpgradePolicyBuilder +} + +// NewControlPlaneUpgradePolicyList creates a new builder of 'control_plane_upgrade_policy' objects. +func NewControlPlaneUpgradePolicyList() *ControlPlaneUpgradePolicyListBuilder { + return new(ControlPlaneUpgradePolicyListBuilder) +} + +// Items sets the items of the list. +func (b *ControlPlaneUpgradePolicyListBuilder) Items(values ...*ControlPlaneUpgradePolicyBuilder) *ControlPlaneUpgradePolicyListBuilder { + b.items = make([]*ControlPlaneUpgradePolicyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ControlPlaneUpgradePolicyListBuilder) 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 *ControlPlaneUpgradePolicyListBuilder) Copy(list *ControlPlaneUpgradePolicyList) *ControlPlaneUpgradePolicyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ControlPlaneUpgradePolicyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewControlPlaneUpgradePolicy().Copy(v) + } + } + return b +} + +// Build creates a list of 'control_plane_upgrade_policy' objects using the +// configuration stored in the builder. +func (b *ControlPlaneUpgradePolicyListBuilder) Build() (list *ControlPlaneUpgradePolicyList, err error) { + items := make([]*ControlPlaneUpgradePolicy, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ControlPlaneUpgradePolicyList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_list_type_json.go b/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_list_type_json.go new file mode 100644 index 00000000..7cd64da1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalControlPlaneUpgradePolicyList writes a list of values of the 'control_plane_upgrade_policy' type to +// the given writer. +func MarshalControlPlaneUpgradePolicyList(list []*ControlPlaneUpgradePolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteControlPlaneUpgradePolicyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteControlPlaneUpgradePolicyList writes a list of value of the 'control_plane_upgrade_policy' type to +// the given stream. +func WriteControlPlaneUpgradePolicyList(list []*ControlPlaneUpgradePolicy, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteControlPlaneUpgradePolicy(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalControlPlaneUpgradePolicyList reads a list of values of the 'control_plane_upgrade_policy' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalControlPlaneUpgradePolicyList(source interface{}) (items []*ControlPlaneUpgradePolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadControlPlaneUpgradePolicyList(iterator) + err = iterator.Error + return +} + +// ReadControlPlaneUpgradePolicyList reads list of values of the ”control_plane_upgrade_policy' type from +// the given iterator. +func ReadControlPlaneUpgradePolicyList(iterator *jsoniter.Iterator) []*ControlPlaneUpgradePolicy { + list := []*ControlPlaneUpgradePolicy{} + for iterator.ReadArray() { + item := ReadControlPlaneUpgradePolicy(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_type.go b/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_type.go new file mode 100644 index 00000000..4ba1f263 --- /dev/null +++ b/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_type.go @@ -0,0 +1,485 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ControlPlaneUpgradePolicyKind is the name of the type used to represent objects +// of type 'control_plane_upgrade_policy'. +const ControlPlaneUpgradePolicyKind = "ControlPlaneUpgradePolicy" + +// ControlPlaneUpgradePolicyLinkKind is the name of the type used to represent links +// to objects of type 'control_plane_upgrade_policy'. +const ControlPlaneUpgradePolicyLinkKind = "ControlPlaneUpgradePolicyLink" + +// ControlPlaneUpgradePolicyNilKind is the name of the type used to nil references +// to objects of type 'control_plane_upgrade_policy'. +const ControlPlaneUpgradePolicyNilKind = "ControlPlaneUpgradePolicyNil" + +// ControlPlaneUpgradePolicy represents the values of the 'control_plane_upgrade_policy' type. +// +// Representation of an upgrade policy that can be set for a cluster. +type ControlPlaneUpgradePolicy struct { + bitmap_ uint32 + id string + href string + clusterID string + creationTimestamp time.Time + lastUpdateTimestamp time.Time + nextRun time.Time + schedule string + scheduleType ScheduleType + state *UpgradePolicyState + upgradeType UpgradeType + version string + enableMinorVersionUpgrades bool +} + +// Kind returns the name of the type of the object. +func (o *ControlPlaneUpgradePolicy) Kind() string { + if o == nil { + return ControlPlaneUpgradePolicyNilKind + } + if o.bitmap_&1 != 0 { + return ControlPlaneUpgradePolicyLinkKind + } + return ControlPlaneUpgradePolicyKind +} + +// Link returns true if this is a link. +func (o *ControlPlaneUpgradePolicy) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ControlPlaneUpgradePolicy) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ControlPlaneUpgradePolicy) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ControlPlaneUpgradePolicy) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ControlPlaneUpgradePolicy) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ControlPlaneUpgradePolicy) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster ID this upgrade policy for control plane is defined for. +func (o *ControlPlaneUpgradePolicy) ClusterID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster ID this upgrade policy for control plane is defined for. +func (o *ControlPlaneUpgradePolicy) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clusterID + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Timestamp for creation of resource. +func (o *ControlPlaneUpgradePolicy) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Timestamp for creation of resource. +func (o *ControlPlaneUpgradePolicy) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// EnableMinorVersionUpgrades returns the value of the 'enable_minor_version_upgrades' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if minor version upgrades are allowed for automatic upgrades (for manual it's always allowed). +func (o *ControlPlaneUpgradePolicy) EnableMinorVersionUpgrades() bool { + if o != nil && o.bitmap_&32 != 0 { + return o.enableMinorVersionUpgrades + } + return false +} + +// GetEnableMinorVersionUpgrades returns the value of the 'enable_minor_version_upgrades' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if minor version upgrades are allowed for automatic upgrades (for manual it's always allowed). +func (o *ControlPlaneUpgradePolicy) GetEnableMinorVersionUpgrades() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.enableMinorVersionUpgrades + } + return +} + +// LastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Timestamp for last update that happened to resource. +func (o *ControlPlaneUpgradePolicy) LastUpdateTimestamp() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.lastUpdateTimestamp + } + return time.Time{} +} + +// GetLastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Timestamp for last update that happened to resource. +func (o *ControlPlaneUpgradePolicy) GetLastUpdateTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.lastUpdateTimestamp + } + return +} + +// NextRun returns the value of the 'next_run' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Next time the upgrade should run. +func (o *ControlPlaneUpgradePolicy) NextRun() time.Time { + if o != nil && o.bitmap_&128 != 0 { + return o.nextRun + } + return time.Time{} +} + +// GetNextRun returns the value of the 'next_run' attribute and +// a flag indicating if the attribute has a value. +// +// Next time the upgrade should run. +func (o *ControlPlaneUpgradePolicy) GetNextRun() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.nextRun + } + return +} + +// Schedule returns the value of the 'schedule' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Schedule cron expression that defines automatic upgrade scheduling. +func (o *ControlPlaneUpgradePolicy) Schedule() string { + if o != nil && o.bitmap_&256 != 0 { + return o.schedule + } + return "" +} + +// GetSchedule returns the value of the 'schedule' attribute and +// a flag indicating if the attribute has a value. +// +// Schedule cron expression that defines automatic upgrade scheduling. +func (o *ControlPlaneUpgradePolicy) GetSchedule() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.schedule + } + return +} + +// ScheduleType returns the value of the 'schedule_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Schedule type of the control plane upgrade. +func (o *ControlPlaneUpgradePolicy) ScheduleType() ScheduleType { + if o != nil && o.bitmap_&512 != 0 { + return o.scheduleType + } + return ScheduleType("") +} + +// GetScheduleType returns the value of the 'schedule_type' attribute and +// a flag indicating if the attribute has a value. +// +// Schedule type of the control plane upgrade. +func (o *ControlPlaneUpgradePolicy) GetScheduleType() (value ScheduleType, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.scheduleType + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// State of the upgrade policy for the hosted control plane. +func (o *ControlPlaneUpgradePolicy) State() *UpgradePolicyState { + if o != nil && o.bitmap_&1024 != 0 { + return o.state + } + return nil +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// State of the upgrade policy for the hosted control plane. +func (o *ControlPlaneUpgradePolicy) GetState() (value *UpgradePolicyState, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.state + } + return +} + +// UpgradeType returns the value of the 'upgrade_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Upgrade type of the control plane. +func (o *ControlPlaneUpgradePolicy) UpgradeType() UpgradeType { + if o != nil && o.bitmap_&2048 != 0 { + return o.upgradeType + } + return UpgradeType("") +} + +// GetUpgradeType returns the value of the 'upgrade_type' attribute and +// a flag indicating if the attribute has a value. +// +// Upgrade type of the control plane. +func (o *ControlPlaneUpgradePolicy) GetUpgradeType() (value UpgradeType, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.upgradeType + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Version is the desired upgrade version. +func (o *ControlPlaneUpgradePolicy) Version() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.version + } + return "" +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +// +// Version is the desired upgrade version. +func (o *ControlPlaneUpgradePolicy) GetVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.version + } + return +} + +// ControlPlaneUpgradePolicyListKind is the name of the type used to represent list of objects of +// type 'control_plane_upgrade_policy'. +const ControlPlaneUpgradePolicyListKind = "ControlPlaneUpgradePolicyList" + +// ControlPlaneUpgradePolicyListLinkKind is the name of the type used to represent links to list +// of objects of type 'control_plane_upgrade_policy'. +const ControlPlaneUpgradePolicyListLinkKind = "ControlPlaneUpgradePolicyListLink" + +// ControlPlaneUpgradePolicyNilKind is the name of the type used to nil lists of objects of +// type 'control_plane_upgrade_policy'. +const ControlPlaneUpgradePolicyListNilKind = "ControlPlaneUpgradePolicyListNil" + +// ControlPlaneUpgradePolicyList is a list of values of the 'control_plane_upgrade_policy' type. +type ControlPlaneUpgradePolicyList struct { + href string + link bool + items []*ControlPlaneUpgradePolicy +} + +// Kind returns the name of the type of the object. +func (l *ControlPlaneUpgradePolicyList) Kind() string { + if l == nil { + return ControlPlaneUpgradePolicyListNilKind + } + if l.link { + return ControlPlaneUpgradePolicyListLinkKind + } + return ControlPlaneUpgradePolicyListKind +} + +// Link returns true iif this is a link. +func (l *ControlPlaneUpgradePolicyList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ControlPlaneUpgradePolicyList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ControlPlaneUpgradePolicyList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ControlPlaneUpgradePolicyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ControlPlaneUpgradePolicyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ControlPlaneUpgradePolicyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ControlPlaneUpgradePolicyList) SetItems(items []*ControlPlaneUpgradePolicy) { + l.items = items +} + +// Items returns the items of the list. +func (l *ControlPlaneUpgradePolicyList) Items() []*ControlPlaneUpgradePolicy { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ControlPlaneUpgradePolicyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ControlPlaneUpgradePolicyList) Get(i int) *ControlPlaneUpgradePolicy { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ControlPlaneUpgradePolicyList) Slice() []*ControlPlaneUpgradePolicy { + var slice []*ControlPlaneUpgradePolicy + if l == nil { + slice = make([]*ControlPlaneUpgradePolicy, 0) + } else { + slice = make([]*ControlPlaneUpgradePolicy, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ControlPlaneUpgradePolicyList) Each(f func(item *ControlPlaneUpgradePolicy) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ControlPlaneUpgradePolicyList) Range(f func(index int, item *ControlPlaneUpgradePolicy) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_type_json.go b/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_type_json.go new file mode 100644 index 00000000..2094a0f3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/control_plane_upgrade_policy_type_json.go @@ -0,0 +1,252 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalControlPlaneUpgradePolicy writes a value of the 'control_plane_upgrade_policy' type to the given writer. +func MarshalControlPlaneUpgradePolicy(object *ControlPlaneUpgradePolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteControlPlaneUpgradePolicy(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteControlPlaneUpgradePolicy writes a value of the 'control_plane_upgrade_policy' type to the given stream. +func WriteControlPlaneUpgradePolicy(object *ControlPlaneUpgradePolicy, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ControlPlaneUpgradePolicyLinkKind) + } else { + stream.WriteString(ControlPlaneUpgradePolicyKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enable_minor_version_upgrades") + stream.WriteBool(object.enableMinorVersionUpgrades) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_update_timestamp") + stream.WriteString((object.lastUpdateTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("next_run") + stream.WriteString((object.nextRun).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("schedule") + stream.WriteString(object.schedule) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("schedule_type") + stream.WriteString(string(object.scheduleType)) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.state != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + WriteUpgradePolicyState(object.state, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("upgrade_type") + stream.WriteString(string(object.upgradeType)) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + stream.WriteString(object.version) + } + stream.WriteObjectEnd() +} + +// UnmarshalControlPlaneUpgradePolicy reads a value of the 'control_plane_upgrade_policy' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalControlPlaneUpgradePolicy(source interface{}) (object *ControlPlaneUpgradePolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadControlPlaneUpgradePolicy(iterator) + err = iterator.Error + return +} + +// ReadControlPlaneUpgradePolicy reads a value of the 'control_plane_upgrade_policy' type from the given iterator. +func ReadControlPlaneUpgradePolicy(iterator *jsoniter.Iterator) *ControlPlaneUpgradePolicy { + object := &ControlPlaneUpgradePolicy{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ControlPlaneUpgradePolicyLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 8 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 16 + case "enable_minor_version_upgrades": + value := iterator.ReadBool() + object.enableMinorVersionUpgrades = value + object.bitmap_ |= 32 + case "last_update_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastUpdateTimestamp = value + object.bitmap_ |= 64 + case "next_run": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.nextRun = value + object.bitmap_ |= 128 + case "schedule": + value := iterator.ReadString() + object.schedule = value + object.bitmap_ |= 256 + case "schedule_type": + text := iterator.ReadString() + value := ScheduleType(text) + object.scheduleType = value + object.bitmap_ |= 512 + case "state": + value := ReadUpgradePolicyState(iterator) + object.state = value + object.bitmap_ |= 1024 + case "upgrade_type": + text := iterator.ReadString() + value := UpgradeType(text) + object.upgradeType = value + object.bitmap_ |= 2048 + case "version": + value := iterator.ReadString() + object.version = value + object.bitmap_ |= 4096 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_builder.go b/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_builder.go new file mode 100644 index 00000000..fd325fb4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_builder.go @@ -0,0 +1,106 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// CPUTotalNodeRoleOSMetricNodeBuilder contains the data and logic needed to build 'CPU_total_node_role_OS_metric_node' objects. +// +// Representation of information from telemetry about a the CPU capacity by node role and OS. +type CPUTotalNodeRoleOSMetricNodeBuilder struct { + bitmap_ uint32 + cpuTotal float64 + nodeRoles []string + operatingSystem string + time time.Time +} + +// NewCPUTotalNodeRoleOSMetricNode creates a new builder of 'CPU_total_node_role_OS_metric_node' objects. +func NewCPUTotalNodeRoleOSMetricNode() *CPUTotalNodeRoleOSMetricNodeBuilder { + return &CPUTotalNodeRoleOSMetricNodeBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CPUTotalNodeRoleOSMetricNodeBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// CPUTotal sets the value of the 'CPU_total' attribute to the given value. +func (b *CPUTotalNodeRoleOSMetricNodeBuilder) CPUTotal(value float64) *CPUTotalNodeRoleOSMetricNodeBuilder { + b.cpuTotal = value + b.bitmap_ |= 1 + return b +} + +// NodeRoles sets the value of the 'node_roles' attribute to the given values. +func (b *CPUTotalNodeRoleOSMetricNodeBuilder) NodeRoles(values ...string) *CPUTotalNodeRoleOSMetricNodeBuilder { + b.nodeRoles = make([]string, len(values)) + copy(b.nodeRoles, values) + b.bitmap_ |= 2 + return b +} + +// OperatingSystem sets the value of the 'operating_system' attribute to the given value. +func (b *CPUTotalNodeRoleOSMetricNodeBuilder) OperatingSystem(value string) *CPUTotalNodeRoleOSMetricNodeBuilder { + b.operatingSystem = value + b.bitmap_ |= 4 + return b +} + +// Time sets the value of the 'time' attribute to the given value. +func (b *CPUTotalNodeRoleOSMetricNodeBuilder) Time(value time.Time) *CPUTotalNodeRoleOSMetricNodeBuilder { + b.time = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CPUTotalNodeRoleOSMetricNodeBuilder) Copy(object *CPUTotalNodeRoleOSMetricNode) *CPUTotalNodeRoleOSMetricNodeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.cpuTotal = object.cpuTotal + if object.nodeRoles != nil { + b.nodeRoles = make([]string, len(object.nodeRoles)) + copy(b.nodeRoles, object.nodeRoles) + } else { + b.nodeRoles = nil + } + b.operatingSystem = object.operatingSystem + b.time = object.time + return b +} + +// Build creates a 'CPU_total_node_role_OS_metric_node' object using the configuration stored in the builder. +func (b *CPUTotalNodeRoleOSMetricNodeBuilder) Build() (object *CPUTotalNodeRoleOSMetricNode, err error) { + object = new(CPUTotalNodeRoleOSMetricNode) + object.bitmap_ = b.bitmap_ + object.cpuTotal = b.cpuTotal + if b.nodeRoles != nil { + object.nodeRoles = make([]string, len(b.nodeRoles)) + copy(object.nodeRoles, b.nodeRoles) + } + object.operatingSystem = b.operatingSystem + object.time = b.time + return +} diff --git a/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_list_builder.go b/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_list_builder.go new file mode 100644 index 00000000..c7252f8b --- /dev/null +++ b/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CPUTotalNodeRoleOSMetricNodeListBuilder contains the data and logic needed to build +// 'CPU_total_node_role_OS_metric_node' objects. +type CPUTotalNodeRoleOSMetricNodeListBuilder struct { + items []*CPUTotalNodeRoleOSMetricNodeBuilder +} + +// NewCPUTotalNodeRoleOSMetricNodeList creates a new builder of 'CPU_total_node_role_OS_metric_node' objects. +func NewCPUTotalNodeRoleOSMetricNodeList() *CPUTotalNodeRoleOSMetricNodeListBuilder { + return new(CPUTotalNodeRoleOSMetricNodeListBuilder) +} + +// Items sets the items of the list. +func (b *CPUTotalNodeRoleOSMetricNodeListBuilder) Items(values ...*CPUTotalNodeRoleOSMetricNodeBuilder) *CPUTotalNodeRoleOSMetricNodeListBuilder { + b.items = make([]*CPUTotalNodeRoleOSMetricNodeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CPUTotalNodeRoleOSMetricNodeListBuilder) 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 *CPUTotalNodeRoleOSMetricNodeListBuilder) Copy(list *CPUTotalNodeRoleOSMetricNodeList) *CPUTotalNodeRoleOSMetricNodeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CPUTotalNodeRoleOSMetricNodeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCPUTotalNodeRoleOSMetricNode().Copy(v) + } + } + return b +} + +// Build creates a list of 'CPU_total_node_role_OS_metric_node' objects using the +// configuration stored in the builder. +func (b *CPUTotalNodeRoleOSMetricNodeListBuilder) Build() (list *CPUTotalNodeRoleOSMetricNodeList, err error) { + items := make([]*CPUTotalNodeRoleOSMetricNode, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CPUTotalNodeRoleOSMetricNodeList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_list_type_json.go b/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_list_type_json.go new file mode 100644 index 00000000..6869b92a --- /dev/null +++ b/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCPUTotalNodeRoleOSMetricNodeList writes a list of values of the 'CPU_total_node_role_OS_metric_node' type to +// the given writer. +func MarshalCPUTotalNodeRoleOSMetricNodeList(list []*CPUTotalNodeRoleOSMetricNode, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCPUTotalNodeRoleOSMetricNodeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCPUTotalNodeRoleOSMetricNodeList writes a list of value of the 'CPU_total_node_role_OS_metric_node' type to +// the given stream. +func WriteCPUTotalNodeRoleOSMetricNodeList(list []*CPUTotalNodeRoleOSMetricNode, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCPUTotalNodeRoleOSMetricNode(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCPUTotalNodeRoleOSMetricNodeList reads a list of values of the 'CPU_total_node_role_OS_metric_node' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCPUTotalNodeRoleOSMetricNodeList(source interface{}) (items []*CPUTotalNodeRoleOSMetricNode, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCPUTotalNodeRoleOSMetricNodeList(iterator) + err = iterator.Error + return +} + +// ReadCPUTotalNodeRoleOSMetricNodeList reads list of values of the ”CPU_total_node_role_OS_metric_node' type from +// the given iterator. +func ReadCPUTotalNodeRoleOSMetricNodeList(iterator *jsoniter.Iterator) []*CPUTotalNodeRoleOSMetricNode { + list := []*CPUTotalNodeRoleOSMetricNode{} + for iterator.ReadArray() { + item := ReadCPUTotalNodeRoleOSMetricNode(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_type.go b/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_type.go new file mode 100644 index 00000000..93a3f7b9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// CPUTotalNodeRoleOSMetricNode represents the values of the 'CPU_total_node_role_OS_metric_node' type. +// +// Representation of information from telemetry about a the CPU capacity by node role and OS. +type CPUTotalNodeRoleOSMetricNode struct { + bitmap_ uint32 + cpuTotal float64 + nodeRoles []string + operatingSystem string + time time.Time +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CPUTotalNodeRoleOSMetricNode) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// CPUTotal returns the value of the 'CPU_total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The total CPU capacity of nodes with this set of roles and operating system. +func (o *CPUTotalNodeRoleOSMetricNode) CPUTotal() float64 { + if o != nil && o.bitmap_&1 != 0 { + return o.cpuTotal + } + return 0.0 +} + +// GetCPUTotal returns the value of the 'CPU_total' attribute and +// a flag indicating if the attribute has a value. +// +// The total CPU capacity of nodes with this set of roles and operating system. +func (o *CPUTotalNodeRoleOSMetricNode) GetCPUTotal() (value float64, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.cpuTotal + } + return +} + +// NodeRoles returns the value of the 'node_roles' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Representation of the node role for a cluster. +func (o *CPUTotalNodeRoleOSMetricNode) NodeRoles() []string { + if o != nil && o.bitmap_&2 != 0 { + return o.nodeRoles + } + return nil +} + +// GetNodeRoles returns the value of the 'node_roles' attribute and +// a flag indicating if the attribute has a value. +// +// Representation of the node role for a cluster. +func (o *CPUTotalNodeRoleOSMetricNode) GetNodeRoles() (value []string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.nodeRoles + } + return +} + +// OperatingSystem returns the value of the 'operating_system' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The operating system. +func (o *CPUTotalNodeRoleOSMetricNode) OperatingSystem() string { + if o != nil && o.bitmap_&4 != 0 { + return o.operatingSystem + } + return "" +} + +// GetOperatingSystem returns the value of the 'operating_system' attribute and +// a flag indicating if the attribute has a value. +// +// The operating system. +func (o *CPUTotalNodeRoleOSMetricNode) GetOperatingSystem() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.operatingSystem + } + return +} + +// Time returns the value of the 'time' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CPUTotalNodeRoleOSMetricNode) Time() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.time + } + return time.Time{} +} + +// GetTime returns the value of the 'time' attribute and +// a flag indicating if the attribute has a value. +func (o *CPUTotalNodeRoleOSMetricNode) GetTime() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.time + } + return +} + +// CPUTotalNodeRoleOSMetricNodeListKind is the name of the type used to represent list of objects of +// type 'CPU_total_node_role_OS_metric_node'. +const CPUTotalNodeRoleOSMetricNodeListKind = "CPUTotalNodeRoleOSMetricNodeList" + +// CPUTotalNodeRoleOSMetricNodeListLinkKind is the name of the type used to represent links to list +// of objects of type 'CPU_total_node_role_OS_metric_node'. +const CPUTotalNodeRoleOSMetricNodeListLinkKind = "CPUTotalNodeRoleOSMetricNodeListLink" + +// CPUTotalNodeRoleOSMetricNodeNilKind is the name of the type used to nil lists of objects of +// type 'CPU_total_node_role_OS_metric_node'. +const CPUTotalNodeRoleOSMetricNodeListNilKind = "CPUTotalNodeRoleOSMetricNodeListNil" + +// CPUTotalNodeRoleOSMetricNodeList is a list of values of the 'CPU_total_node_role_OS_metric_node' type. +type CPUTotalNodeRoleOSMetricNodeList struct { + href string + link bool + items []*CPUTotalNodeRoleOSMetricNode +} + +// Len returns the length of the list. +func (l *CPUTotalNodeRoleOSMetricNodeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CPUTotalNodeRoleOSMetricNodeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CPUTotalNodeRoleOSMetricNodeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CPUTotalNodeRoleOSMetricNodeList) SetItems(items []*CPUTotalNodeRoleOSMetricNode) { + l.items = items +} + +// Items returns the items of the list. +func (l *CPUTotalNodeRoleOSMetricNodeList) Items() []*CPUTotalNodeRoleOSMetricNode { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CPUTotalNodeRoleOSMetricNodeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CPUTotalNodeRoleOSMetricNodeList) Get(i int) *CPUTotalNodeRoleOSMetricNode { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CPUTotalNodeRoleOSMetricNodeList) Slice() []*CPUTotalNodeRoleOSMetricNode { + var slice []*CPUTotalNodeRoleOSMetricNode + if l == nil { + slice = make([]*CPUTotalNodeRoleOSMetricNode, 0) + } else { + slice = make([]*CPUTotalNodeRoleOSMetricNode, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CPUTotalNodeRoleOSMetricNodeList) Each(f func(item *CPUTotalNodeRoleOSMetricNode) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CPUTotalNodeRoleOSMetricNodeList) Range(f func(index int, item *CPUTotalNodeRoleOSMetricNode) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_type_json.go b/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_type_json.go new file mode 100644 index 00000000..e78f0099 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cpu_total_node_role_os_metric_node_type_json.go @@ -0,0 +1,130 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCPUTotalNodeRoleOSMetricNode writes a value of the 'CPU_total_node_role_OS_metric_node' type to the given writer. +func MarshalCPUTotalNodeRoleOSMetricNode(object *CPUTotalNodeRoleOSMetricNode, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCPUTotalNodeRoleOSMetricNode(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCPUTotalNodeRoleOSMetricNode writes a value of the 'CPU_total_node_role_OS_metric_node' type to the given stream. +func WriteCPUTotalNodeRoleOSMetricNode(object *CPUTotalNodeRoleOSMetricNode, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cpu_total") + stream.WriteFloat64(object.cpuTotal) + count++ + } + present_ = object.bitmap_&2 != 0 && object.nodeRoles != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("node_roles") + WriteStringList(object.nodeRoles, stream) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operating_system") + stream.WriteString(object.operatingSystem) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("time") + stream.WriteString((object.time).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalCPUTotalNodeRoleOSMetricNode reads a value of the 'CPU_total_node_role_OS_metric_node' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCPUTotalNodeRoleOSMetricNode(source interface{}) (object *CPUTotalNodeRoleOSMetricNode, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCPUTotalNodeRoleOSMetricNode(iterator) + err = iterator.Error + return +} + +// ReadCPUTotalNodeRoleOSMetricNode reads a value of the 'CPU_total_node_role_OS_metric_node' type from the given iterator. +func ReadCPUTotalNodeRoleOSMetricNode(iterator *jsoniter.Iterator) *CPUTotalNodeRoleOSMetricNode { + object := &CPUTotalNodeRoleOSMetricNode{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "cpu_total": + value := iterator.ReadFloat64() + object.cpuTotal = value + object.bitmap_ |= 1 + case "node_roles": + value := ReadStringList(iterator) + object.nodeRoles = value + object.bitmap_ |= 2 + case "operating_system": + value := iterator.ReadString() + object.operatingSystem = value + object.bitmap_ |= 4 + case "time": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.time = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_builder.go b/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_builder.go new file mode 100644 index 00000000..d47ea998 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_builder.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CPUTotalsNodeRoleOSMetricNodeBuilder contains the data and logic needed to build 'CPU_totals_node_role_OS_metric_node' objects. +// +// Representation of information from telemetry about the CPU capacity by node +// role and OS of a cluster. +type CPUTotalsNodeRoleOSMetricNodeBuilder struct { + bitmap_ uint32 + cpuTotals []*CPUTotalNodeRoleOSMetricNodeBuilder +} + +// NewCPUTotalsNodeRoleOSMetricNode creates a new builder of 'CPU_totals_node_role_OS_metric_node' objects. +func NewCPUTotalsNodeRoleOSMetricNode() *CPUTotalsNodeRoleOSMetricNodeBuilder { + return &CPUTotalsNodeRoleOSMetricNodeBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CPUTotalsNodeRoleOSMetricNodeBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// CPUTotals sets the value of the 'CPU_totals' attribute to the given values. +func (b *CPUTotalsNodeRoleOSMetricNodeBuilder) CPUTotals(values ...*CPUTotalNodeRoleOSMetricNodeBuilder) *CPUTotalsNodeRoleOSMetricNodeBuilder { + b.cpuTotals = make([]*CPUTotalNodeRoleOSMetricNodeBuilder, len(values)) + copy(b.cpuTotals, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CPUTotalsNodeRoleOSMetricNodeBuilder) Copy(object *CPUTotalsNodeRoleOSMetricNode) *CPUTotalsNodeRoleOSMetricNodeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.cpuTotals != nil { + b.cpuTotals = make([]*CPUTotalNodeRoleOSMetricNodeBuilder, len(object.cpuTotals)) + for i, v := range object.cpuTotals { + b.cpuTotals[i] = NewCPUTotalNodeRoleOSMetricNode().Copy(v) + } + } else { + b.cpuTotals = nil + } + return b +} + +// Build creates a 'CPU_totals_node_role_OS_metric_node' object using the configuration stored in the builder. +func (b *CPUTotalsNodeRoleOSMetricNodeBuilder) Build() (object *CPUTotalsNodeRoleOSMetricNode, err error) { + object = new(CPUTotalsNodeRoleOSMetricNode) + object.bitmap_ = b.bitmap_ + if b.cpuTotals != nil { + object.cpuTotals = make([]*CPUTotalNodeRoleOSMetricNode, len(b.cpuTotals)) + for i, v := range b.cpuTotals { + object.cpuTotals[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_list_builder.go b/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_list_builder.go new file mode 100644 index 00000000..2cb1d13f --- /dev/null +++ b/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CPUTotalsNodeRoleOSMetricNodeListBuilder contains the data and logic needed to build +// 'CPU_totals_node_role_OS_metric_node' objects. +type CPUTotalsNodeRoleOSMetricNodeListBuilder struct { + items []*CPUTotalsNodeRoleOSMetricNodeBuilder +} + +// NewCPUTotalsNodeRoleOSMetricNodeList creates a new builder of 'CPU_totals_node_role_OS_metric_node' objects. +func NewCPUTotalsNodeRoleOSMetricNodeList() *CPUTotalsNodeRoleOSMetricNodeListBuilder { + return new(CPUTotalsNodeRoleOSMetricNodeListBuilder) +} + +// Items sets the items of the list. +func (b *CPUTotalsNodeRoleOSMetricNodeListBuilder) Items(values ...*CPUTotalsNodeRoleOSMetricNodeBuilder) *CPUTotalsNodeRoleOSMetricNodeListBuilder { + b.items = make([]*CPUTotalsNodeRoleOSMetricNodeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CPUTotalsNodeRoleOSMetricNodeListBuilder) 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 *CPUTotalsNodeRoleOSMetricNodeListBuilder) Copy(list *CPUTotalsNodeRoleOSMetricNodeList) *CPUTotalsNodeRoleOSMetricNodeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CPUTotalsNodeRoleOSMetricNodeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCPUTotalsNodeRoleOSMetricNode().Copy(v) + } + } + return b +} + +// Build creates a list of 'CPU_totals_node_role_OS_metric_node' objects using the +// configuration stored in the builder. +func (b *CPUTotalsNodeRoleOSMetricNodeListBuilder) Build() (list *CPUTotalsNodeRoleOSMetricNodeList, err error) { + items := make([]*CPUTotalsNodeRoleOSMetricNode, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CPUTotalsNodeRoleOSMetricNodeList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_list_type_json.go b/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_list_type_json.go new file mode 100644 index 00000000..f5740e53 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCPUTotalsNodeRoleOSMetricNodeList writes a list of values of the 'CPU_totals_node_role_OS_metric_node' type to +// the given writer. +func MarshalCPUTotalsNodeRoleOSMetricNodeList(list []*CPUTotalsNodeRoleOSMetricNode, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCPUTotalsNodeRoleOSMetricNodeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCPUTotalsNodeRoleOSMetricNodeList writes a list of value of the 'CPU_totals_node_role_OS_metric_node' type to +// the given stream. +func WriteCPUTotalsNodeRoleOSMetricNodeList(list []*CPUTotalsNodeRoleOSMetricNode, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCPUTotalsNodeRoleOSMetricNode(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCPUTotalsNodeRoleOSMetricNodeList reads a list of values of the 'CPU_totals_node_role_OS_metric_node' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCPUTotalsNodeRoleOSMetricNodeList(source interface{}) (items []*CPUTotalsNodeRoleOSMetricNode, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCPUTotalsNodeRoleOSMetricNodeList(iterator) + err = iterator.Error + return +} + +// ReadCPUTotalsNodeRoleOSMetricNodeList reads list of values of the ”CPU_totals_node_role_OS_metric_node' type from +// the given iterator. +func ReadCPUTotalsNodeRoleOSMetricNodeList(iterator *jsoniter.Iterator) []*CPUTotalsNodeRoleOSMetricNode { + list := []*CPUTotalsNodeRoleOSMetricNode{} + for iterator.ReadArray() { + item := ReadCPUTotalsNodeRoleOSMetricNode(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_type.go b/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_type.go new file mode 100644 index 00000000..68aae764 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_type.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CPUTotalsNodeRoleOSMetricNode represents the values of the 'CPU_totals_node_role_OS_metric_node' type. +// +// Representation of information from telemetry about the CPU capacity by node +// role and OS of a cluster. +type CPUTotalsNodeRoleOSMetricNode struct { + bitmap_ uint32 + cpuTotals []*CPUTotalNodeRoleOSMetricNode +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CPUTotalsNodeRoleOSMetricNode) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// CPUTotals returns the value of the 'CPU_totals' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *CPUTotalsNodeRoleOSMetricNode) CPUTotals() []*CPUTotalNodeRoleOSMetricNode { + if o != nil && o.bitmap_&1 != 0 { + return o.cpuTotals + } + return nil +} + +// GetCPUTotals returns the value of the 'CPU_totals' attribute and +// a flag indicating if the attribute has a value. +func (o *CPUTotalsNodeRoleOSMetricNode) GetCPUTotals() (value []*CPUTotalNodeRoleOSMetricNode, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.cpuTotals + } + return +} + +// CPUTotalsNodeRoleOSMetricNodeListKind is the name of the type used to represent list of objects of +// type 'CPU_totals_node_role_OS_metric_node'. +const CPUTotalsNodeRoleOSMetricNodeListKind = "CPUTotalsNodeRoleOSMetricNodeList" + +// CPUTotalsNodeRoleOSMetricNodeListLinkKind is the name of the type used to represent links to list +// of objects of type 'CPU_totals_node_role_OS_metric_node'. +const CPUTotalsNodeRoleOSMetricNodeListLinkKind = "CPUTotalsNodeRoleOSMetricNodeListLink" + +// CPUTotalsNodeRoleOSMetricNodeNilKind is the name of the type used to nil lists of objects of +// type 'CPU_totals_node_role_OS_metric_node'. +const CPUTotalsNodeRoleOSMetricNodeListNilKind = "CPUTotalsNodeRoleOSMetricNodeListNil" + +// CPUTotalsNodeRoleOSMetricNodeList is a list of values of the 'CPU_totals_node_role_OS_metric_node' type. +type CPUTotalsNodeRoleOSMetricNodeList struct { + href string + link bool + items []*CPUTotalsNodeRoleOSMetricNode +} + +// Len returns the length of the list. +func (l *CPUTotalsNodeRoleOSMetricNodeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CPUTotalsNodeRoleOSMetricNodeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CPUTotalsNodeRoleOSMetricNodeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CPUTotalsNodeRoleOSMetricNodeList) SetItems(items []*CPUTotalsNodeRoleOSMetricNode) { + l.items = items +} + +// Items returns the items of the list. +func (l *CPUTotalsNodeRoleOSMetricNodeList) Items() []*CPUTotalsNodeRoleOSMetricNode { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CPUTotalsNodeRoleOSMetricNodeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CPUTotalsNodeRoleOSMetricNodeList) Get(i int) *CPUTotalsNodeRoleOSMetricNode { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CPUTotalsNodeRoleOSMetricNodeList) Slice() []*CPUTotalsNodeRoleOSMetricNode { + var slice []*CPUTotalsNodeRoleOSMetricNode + if l == nil { + slice = make([]*CPUTotalsNodeRoleOSMetricNode, 0) + } else { + slice = make([]*CPUTotalsNodeRoleOSMetricNode, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CPUTotalsNodeRoleOSMetricNodeList) Each(f func(item *CPUTotalsNodeRoleOSMetricNode) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CPUTotalsNodeRoleOSMetricNodeList) Range(f func(index int, item *CPUTotalsNodeRoleOSMetricNode) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_type_json.go b/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_type_json.go new file mode 100644 index 00000000..47965ec1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/cpu_totals_node_role_os_metric_node_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCPUTotalsNodeRoleOSMetricNode writes a value of the 'CPU_totals_node_role_OS_metric_node' type to the given writer. +func MarshalCPUTotalsNodeRoleOSMetricNode(object *CPUTotalsNodeRoleOSMetricNode, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCPUTotalsNodeRoleOSMetricNode(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCPUTotalsNodeRoleOSMetricNode writes a value of the 'CPU_totals_node_role_OS_metric_node' type to the given stream. +func WriteCPUTotalsNodeRoleOSMetricNode(object *CPUTotalsNodeRoleOSMetricNode, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.cpuTotals != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cpu_totals") + WriteCPUTotalNodeRoleOSMetricNodeList(object.cpuTotals, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalCPUTotalsNodeRoleOSMetricNode reads a value of the 'CPU_totals_node_role_OS_metric_node' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCPUTotalsNodeRoleOSMetricNode(source interface{}) (object *CPUTotalsNodeRoleOSMetricNode, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCPUTotalsNodeRoleOSMetricNode(iterator) + err = iterator.Error + return +} + +// ReadCPUTotalsNodeRoleOSMetricNode reads a value of the 'CPU_totals_node_role_OS_metric_node' type from the given iterator. +func ReadCPUTotalsNodeRoleOSMetricNode(iterator *jsoniter.Iterator) *CPUTotalsNodeRoleOSMetricNode { + object := &CPUTotalsNodeRoleOSMetricNode{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "cpu_totals": + value := ReadCPUTotalNodeRoleOSMetricNodeList(iterator) + object.cpuTotals = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/credential_request_builder.go b/clientapi/clustersmgmt/v1/credential_request_builder.go new file mode 100644 index 00000000..ee47608f --- /dev/null +++ b/clientapi/clustersmgmt/v1/credential_request_builder.go @@ -0,0 +1,102 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CredentialRequestBuilder contains the data and logic needed to build 'credential_request' objects. +// +// Contains the necessary attributes to allow each operator to access the necessary AWS resources +type CredentialRequestBuilder struct { + bitmap_ uint32 + name string + namespace string + policyPermissions []string + serviceAccount string +} + +// NewCredentialRequest creates a new builder of 'credential_request' objects. +func NewCredentialRequest() *CredentialRequestBuilder { + return &CredentialRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CredentialRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *CredentialRequestBuilder) Name(value string) *CredentialRequestBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Namespace sets the value of the 'namespace' attribute to the given value. +func (b *CredentialRequestBuilder) Namespace(value string) *CredentialRequestBuilder { + b.namespace = value + b.bitmap_ |= 2 + return b +} + +// PolicyPermissions sets the value of the 'policy_permissions' attribute to the given values. +func (b *CredentialRequestBuilder) PolicyPermissions(values ...string) *CredentialRequestBuilder { + b.policyPermissions = make([]string, len(values)) + copy(b.policyPermissions, values) + b.bitmap_ |= 4 + return b +} + +// ServiceAccount sets the value of the 'service_account' attribute to the given value. +func (b *CredentialRequestBuilder) ServiceAccount(value string) *CredentialRequestBuilder { + b.serviceAccount = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CredentialRequestBuilder) Copy(object *CredentialRequest) *CredentialRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + b.namespace = object.namespace + if object.policyPermissions != nil { + b.policyPermissions = make([]string, len(object.policyPermissions)) + copy(b.policyPermissions, object.policyPermissions) + } else { + b.policyPermissions = nil + } + b.serviceAccount = object.serviceAccount + return b +} + +// Build creates a 'credential_request' object using the configuration stored in the builder. +func (b *CredentialRequestBuilder) Build() (object *CredentialRequest, err error) { + object = new(CredentialRequest) + object.bitmap_ = b.bitmap_ + object.name = b.name + object.namespace = b.namespace + if b.policyPermissions != nil { + object.policyPermissions = make([]string, len(b.policyPermissions)) + copy(object.policyPermissions, b.policyPermissions) + } + object.serviceAccount = b.serviceAccount + return +} diff --git a/clientapi/clustersmgmt/v1/credential_request_list_builder.go b/clientapi/clustersmgmt/v1/credential_request_list_builder.go new file mode 100644 index 00000000..57590151 --- /dev/null +++ b/clientapi/clustersmgmt/v1/credential_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CredentialRequestListBuilder contains the data and logic needed to build +// 'credential_request' objects. +type CredentialRequestListBuilder struct { + items []*CredentialRequestBuilder +} + +// NewCredentialRequestList creates a new builder of 'credential_request' objects. +func NewCredentialRequestList() *CredentialRequestListBuilder { + return new(CredentialRequestListBuilder) +} + +// Items sets the items of the list. +func (b *CredentialRequestListBuilder) Items(values ...*CredentialRequestBuilder) *CredentialRequestListBuilder { + b.items = make([]*CredentialRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CredentialRequestListBuilder) 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 *CredentialRequestListBuilder) Copy(list *CredentialRequestList) *CredentialRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CredentialRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCredentialRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'credential_request' objects using the +// configuration stored in the builder. +func (b *CredentialRequestListBuilder) Build() (list *CredentialRequestList, err error) { + items := make([]*CredentialRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CredentialRequestList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/credential_request_list_type_json.go b/clientapi/clustersmgmt/v1/credential_request_list_type_json.go new file mode 100644 index 00000000..01044d2f --- /dev/null +++ b/clientapi/clustersmgmt/v1/credential_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCredentialRequestList writes a list of values of the 'credential_request' type to +// the given writer. +func MarshalCredentialRequestList(list []*CredentialRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCredentialRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCredentialRequestList writes a list of value of the 'credential_request' type to +// the given stream. +func WriteCredentialRequestList(list []*CredentialRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCredentialRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCredentialRequestList reads a list of values of the 'credential_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCredentialRequestList(source interface{}) (items []*CredentialRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCredentialRequestList(iterator) + err = iterator.Error + return +} + +// ReadCredentialRequestList reads list of values of the ”credential_request' type from +// the given iterator. +func ReadCredentialRequestList(iterator *jsoniter.Iterator) []*CredentialRequest { + list := []*CredentialRequest{} + for iterator.ReadArray() { + item := ReadCredentialRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/credential_request_type.go b/clientapi/clustersmgmt/v1/credential_request_type.go new file mode 100644 index 00000000..0e5cb3a3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/credential_request_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// CredentialRequest represents the values of the 'credential_request' type. +// +// Contains the necessary attributes to allow each operator to access the necessary AWS resources +type CredentialRequest struct { + bitmap_ uint32 + name string + namespace string + policyPermissions []string + serviceAccount string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CredentialRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the credentials secret used to access cloud resources +func (o *CredentialRequest) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the credentials secret used to access cloud resources +func (o *CredentialRequest) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Namespace returns the value of the 'namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Namespace where the credentials secret lives in the cluster +func (o *CredentialRequest) Namespace() string { + if o != nil && o.bitmap_&2 != 0 { + return o.namespace + } + return "" +} + +// GetNamespace returns the value of the 'namespace' attribute and +// a flag indicating if the attribute has a value. +// +// Namespace where the credentials secret lives in the cluster +func (o *CredentialRequest) GetNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.namespace + } + return +} + +// PolicyPermissions returns the value of the 'policy_permissions' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of policy permissions needed to access cloud resources +func (o *CredentialRequest) PolicyPermissions() []string { + if o != nil && o.bitmap_&4 != 0 { + return o.policyPermissions + } + return nil +} + +// GetPolicyPermissions returns the value of the 'policy_permissions' attribute and +// a flag indicating if the attribute has a value. +// +// List of policy permissions needed to access cloud resources +func (o *CredentialRequest) GetPolicyPermissions() (value []string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.policyPermissions + } + return +} + +// ServiceAccount returns the value of the 'service_account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Service account name to use when authenticating +func (o *CredentialRequest) ServiceAccount() string { + if o != nil && o.bitmap_&8 != 0 { + return o.serviceAccount + } + return "" +} + +// GetServiceAccount returns the value of the 'service_account' attribute and +// a flag indicating if the attribute has a value. +// +// Service account name to use when authenticating +func (o *CredentialRequest) GetServiceAccount() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.serviceAccount + } + return +} + +// CredentialRequestListKind is the name of the type used to represent list of objects of +// type 'credential_request'. +const CredentialRequestListKind = "CredentialRequestList" + +// CredentialRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'credential_request'. +const CredentialRequestListLinkKind = "CredentialRequestListLink" + +// CredentialRequestNilKind is the name of the type used to nil lists of objects of +// type 'credential_request'. +const CredentialRequestListNilKind = "CredentialRequestListNil" + +// CredentialRequestList is a list of values of the 'credential_request' type. +type CredentialRequestList struct { + href string + link bool + items []*CredentialRequest +} + +// Len returns the length of the list. +func (l *CredentialRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CredentialRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CredentialRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CredentialRequestList) SetItems(items []*CredentialRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *CredentialRequestList) Items() []*CredentialRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CredentialRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CredentialRequestList) Get(i int) *CredentialRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CredentialRequestList) Slice() []*CredentialRequest { + var slice []*CredentialRequest + if l == nil { + slice = make([]*CredentialRequest, 0) + } else { + slice = make([]*CredentialRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CredentialRequestList) Each(f func(item *CredentialRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CredentialRequestList) Range(f func(index int, item *CredentialRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/credential_request_type_json.go b/clientapi/clustersmgmt/v1/credential_request_type_json.go new file mode 100644 index 00000000..f41e8fd2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/credential_request_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCredentialRequest writes a value of the 'credential_request' type to the given writer. +func MarshalCredentialRequest(object *CredentialRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCredentialRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCredentialRequest writes a value of the 'credential_request' type to the given stream. +func WriteCredentialRequest(object *CredentialRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("namespace") + stream.WriteString(object.namespace) + count++ + } + present_ = object.bitmap_&4 != 0 && object.policyPermissions != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("policy_permissions") + WriteStringList(object.policyPermissions, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_account") + stream.WriteString(object.serviceAccount) + } + stream.WriteObjectEnd() +} + +// UnmarshalCredentialRequest reads a value of the 'credential_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCredentialRequest(source interface{}) (object *CredentialRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCredentialRequest(iterator) + err = iterator.Error + return +} + +// ReadCredentialRequest reads a value of the 'credential_request' type from the given iterator. +func ReadCredentialRequest(iterator *jsoniter.Iterator) *CredentialRequest { + object := &CredentialRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "namespace": + value := iterator.ReadString() + object.namespace = value + object.bitmap_ |= 2 + case "policy_permissions": + value := ReadStringList(iterator) + object.policyPermissions = value + object.bitmap_ |= 4 + case "service_account": + value := iterator.ReadString() + object.serviceAccount = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/date_list_type_json.go b/clientapi/clustersmgmt/v1/date_list_type_json.go new file mode 100644 index 00000000..ae4b41a4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/date_list_type_json.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDateList writes a list of values of the 'date' type to +// the given writer. +func MarshalDateList(list []time.Time, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDateList writes a list of value of the 'date' type to +// the given stream. +func WriteDateList(list []time.Time, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString((value).Format(time.RFC3339)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDateList reads a list of values of the 'date' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDateList(source interface{}) (items []time.Time, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDateList(iterator) + err = iterator.Error + return +} + +// ReadDateList reads list of values of the ”date' type from +// the given iterator. +func ReadDateList(iterator *jsoniter.Iterator) []time.Time { + list := []time.Time{} + for iterator.ReadArray() { + text := iterator.ReadString() + item, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/delete_protection_builder.go b/clientapi/clustersmgmt/v1/delete_protection_builder.go new file mode 100644 index 00000000..dec359c5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/delete_protection_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// DeleteProtectionBuilder contains the data and logic needed to build 'delete_protection' objects. +// +// DeleteProtection configuration. +type DeleteProtectionBuilder struct { + bitmap_ uint32 + enabled bool +} + +// NewDeleteProtection creates a new builder of 'delete_protection' objects. +func NewDeleteProtection() *DeleteProtectionBuilder { + return &DeleteProtectionBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *DeleteProtectionBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *DeleteProtectionBuilder) Enabled(value bool) *DeleteProtectionBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *DeleteProtectionBuilder) Copy(object *DeleteProtection) *DeleteProtectionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + return b +} + +// Build creates a 'delete_protection' object using the configuration stored in the builder. +func (b *DeleteProtectionBuilder) Build() (object *DeleteProtection, err error) { + object = new(DeleteProtection) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + return +} diff --git a/clientapi/clustersmgmt/v1/delete_protection_list_builder.go b/clientapi/clustersmgmt/v1/delete_protection_list_builder.go new file mode 100644 index 00000000..1eb6da07 --- /dev/null +++ b/clientapi/clustersmgmt/v1/delete_protection_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// DeleteProtectionListBuilder contains the data and logic needed to build +// 'delete_protection' objects. +type DeleteProtectionListBuilder struct { + items []*DeleteProtectionBuilder +} + +// NewDeleteProtectionList creates a new builder of 'delete_protection' objects. +func NewDeleteProtectionList() *DeleteProtectionListBuilder { + return new(DeleteProtectionListBuilder) +} + +// Items sets the items of the list. +func (b *DeleteProtectionListBuilder) Items(values ...*DeleteProtectionBuilder) *DeleteProtectionListBuilder { + b.items = make([]*DeleteProtectionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *DeleteProtectionListBuilder) 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 *DeleteProtectionListBuilder) Copy(list *DeleteProtectionList) *DeleteProtectionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*DeleteProtectionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewDeleteProtection().Copy(v) + } + } + return b +} + +// Build creates a list of 'delete_protection' objects using the +// configuration stored in the builder. +func (b *DeleteProtectionListBuilder) Build() (list *DeleteProtectionList, err error) { + items := make([]*DeleteProtection, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(DeleteProtectionList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/delete_protection_list_type_json.go b/clientapi/clustersmgmt/v1/delete_protection_list_type_json.go new file mode 100644 index 00000000..4ff5e687 --- /dev/null +++ b/clientapi/clustersmgmt/v1/delete_protection_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDeleteProtectionList writes a list of values of the 'delete_protection' type to +// the given writer. +func MarshalDeleteProtectionList(list []*DeleteProtection, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDeleteProtectionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDeleteProtectionList writes a list of value of the 'delete_protection' type to +// the given stream. +func WriteDeleteProtectionList(list []*DeleteProtection, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteDeleteProtection(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalDeleteProtectionList reads a list of values of the 'delete_protection' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDeleteProtectionList(source interface{}) (items []*DeleteProtection, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDeleteProtectionList(iterator) + err = iterator.Error + return +} + +// ReadDeleteProtectionList reads list of values of the ”delete_protection' type from +// the given iterator. +func ReadDeleteProtectionList(iterator *jsoniter.Iterator) []*DeleteProtection { + list := []*DeleteProtection{} + for iterator.ReadArray() { + item := ReadDeleteProtection(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/delete_protection_type.go b/clientapi/clustersmgmt/v1/delete_protection_type.go new file mode 100644 index 00000000..b7bc6b19 --- /dev/null +++ b/clientapi/clustersmgmt/v1/delete_protection_type.go @@ -0,0 +1,173 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// DeleteProtection represents the values of the 'delete_protection' type. +// +// DeleteProtection configuration. +type DeleteProtection struct { + bitmap_ uint32 + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *DeleteProtection) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Boolean flag indicating if the cluster should be be using _DeleteProtection_. +// +// By default this is `false`. +// +// To enable it a SREP needs to patch the value through OCM API +func (o *DeleteProtection) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Boolean flag indicating if the cluster should be be using _DeleteProtection_. +// +// By default this is `false`. +// +// To enable it a SREP needs to patch the value through OCM API +func (o *DeleteProtection) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// DeleteProtectionListKind is the name of the type used to represent list of objects of +// type 'delete_protection'. +const DeleteProtectionListKind = "DeleteProtectionList" + +// DeleteProtectionListLinkKind is the name of the type used to represent links to list +// of objects of type 'delete_protection'. +const DeleteProtectionListLinkKind = "DeleteProtectionListLink" + +// DeleteProtectionNilKind is the name of the type used to nil lists of objects of +// type 'delete_protection'. +const DeleteProtectionListNilKind = "DeleteProtectionListNil" + +// DeleteProtectionList is a list of values of the 'delete_protection' type. +type DeleteProtectionList struct { + href string + link bool + items []*DeleteProtection +} + +// Len returns the length of the list. +func (l *DeleteProtectionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *DeleteProtectionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *DeleteProtectionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *DeleteProtectionList) SetItems(items []*DeleteProtection) { + l.items = items +} + +// Items returns the items of the list. +func (l *DeleteProtectionList) Items() []*DeleteProtection { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *DeleteProtectionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *DeleteProtectionList) Get(i int) *DeleteProtection { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *DeleteProtectionList) Slice() []*DeleteProtection { + var slice []*DeleteProtection + if l == nil { + slice = make([]*DeleteProtection, 0) + } else { + slice = make([]*DeleteProtection, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *DeleteProtectionList) Each(f func(item *DeleteProtection) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *DeleteProtectionList) Range(f func(index int, item *DeleteProtection) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/delete_protection_type_json.go b/clientapi/clustersmgmt/v1/delete_protection_type_json.go new file mode 100644 index 00000000..4b032125 --- /dev/null +++ b/clientapi/clustersmgmt/v1/delete_protection_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDeleteProtection writes a value of the 'delete_protection' type to the given writer. +func MarshalDeleteProtection(object *DeleteProtection, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDeleteProtection(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDeleteProtection writes a value of the 'delete_protection' type to the given stream. +func WriteDeleteProtection(object *DeleteProtection, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalDeleteProtection reads a value of the 'delete_protection' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalDeleteProtection(source interface{}) (object *DeleteProtection, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadDeleteProtection(iterator) + err = iterator.Error + return +} + +// ReadDeleteProtection reads a value of the 'delete_protection' type from the given iterator. +func ReadDeleteProtection(iterator *jsoniter.Iterator) *DeleteProtection { + object := &DeleteProtection{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/detection_type_list_type_json.go b/clientapi/clustersmgmt/v1/detection_type_list_type_json.go new file mode 100644 index 00000000..d79c619a --- /dev/null +++ b/clientapi/clustersmgmt/v1/detection_type_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDetectionTypeList writes a list of values of the 'detection_type' type to +// the given writer. +func MarshalDetectionTypeList(list []DetectionType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDetectionTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDetectionTypeList writes a list of value of the 'detection_type' type to +// the given stream. +func WriteDetectionTypeList(list []DetectionType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDetectionTypeList reads a list of values of the 'detection_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDetectionTypeList(source interface{}) (items []DetectionType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDetectionTypeList(iterator) + err = iterator.Error + return +} + +// ReadDetectionTypeList reads list of values of the ”detection_type' type from +// the given iterator. +func ReadDetectionTypeList(iterator *jsoniter.Iterator) []DetectionType { + list := []DetectionType{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := DetectionType(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/detection_type_type.go b/clientapi/clustersmgmt/v1/detection_type_type.go new file mode 100644 index 00000000..0425737a --- /dev/null +++ b/clientapi/clustersmgmt/v1/detection_type_type.go @@ -0,0 +1,30 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// DetectionType represents the values of the 'detection_type' enumerated type. +type DetectionType string + +const ( + // + DetectionTypeAuto DetectionType = "auto" + // + DetectionTypeManual DetectionType = "manual" +) diff --git a/clientapi/clustersmgmt/v1/dns_builder.go b/clientapi/clustersmgmt/v1/dns_builder.go new file mode 100644 index 00000000..4ea494b3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/dns_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// DNSBuilder contains the data and logic needed to build 'DNS' objects. +// +// DNS settings of the cluster. +type DNSBuilder struct { + bitmap_ uint32 + baseDomain string +} + +// NewDNS creates a new builder of 'DNS' objects. +func NewDNS() *DNSBuilder { + return &DNSBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *DNSBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// BaseDomain sets the value of the 'base_domain' attribute to the given value. +func (b *DNSBuilder) BaseDomain(value string) *DNSBuilder { + b.baseDomain = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *DNSBuilder) Copy(object *DNS) *DNSBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.baseDomain = object.baseDomain + return b +} + +// Build creates a 'DNS' object using the configuration stored in the builder. +func (b *DNSBuilder) Build() (object *DNS, err error) { + object = new(DNS) + object.bitmap_ = b.bitmap_ + object.baseDomain = b.baseDomain + return +} diff --git a/clientapi/clustersmgmt/v1/dns_domain_builder.go b/clientapi/clustersmgmt/v1/dns_domain_builder.go new file mode 100644 index 00000000..2b8a7ba8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/dns_domain_builder.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// DNSDomainBuilder contains the data and logic needed to build 'DNS_domain' objects. +// +// Contains the properties of a DNS domain. +type DNSDomainBuilder struct { + bitmap_ uint32 + id string + href string + cluster *ClusterLinkBuilder + clusterArch ClusterArchitecture + organization *OrganizationLinkBuilder + reservedAtTimestamp time.Time + userDefined bool +} + +// NewDNSDomain creates a new builder of 'DNS_domain' objects. +func NewDNSDomain() *DNSDomainBuilder { + return &DNSDomainBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *DNSDomainBuilder) Link(value bool) *DNSDomainBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *DNSDomainBuilder) ID(value string) *DNSDomainBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *DNSDomainBuilder) HREF(value string) *DNSDomainBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *DNSDomainBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Cluster sets the value of the 'cluster' attribute to the given value. +// +// Definition of a cluster link. +func (b *DNSDomainBuilder) Cluster(value *ClusterLinkBuilder) *DNSDomainBuilder { + b.cluster = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// ClusterArch sets the value of the 'cluster_arch' attribute to the given value. +// +// Possible cluster architectures. +func (b *DNSDomainBuilder) ClusterArch(value ClusterArchitecture) *DNSDomainBuilder { + b.clusterArch = value + b.bitmap_ |= 16 + return b +} + +// Organization sets the value of the 'organization' attribute to the given value. +// +// Definition of an organization link. +func (b *DNSDomainBuilder) Organization(value *OrganizationLinkBuilder) *DNSDomainBuilder { + b.organization = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// ReservedAtTimestamp sets the value of the 'reserved_at_timestamp' attribute to the given value. +func (b *DNSDomainBuilder) ReservedAtTimestamp(value time.Time) *DNSDomainBuilder { + b.reservedAtTimestamp = value + b.bitmap_ |= 64 + return b +} + +// UserDefined sets the value of the 'user_defined' attribute to the given value. +func (b *DNSDomainBuilder) UserDefined(value bool) *DNSDomainBuilder { + b.userDefined = value + b.bitmap_ |= 128 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *DNSDomainBuilder) Copy(object *DNSDomain) *DNSDomainBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.cluster != nil { + b.cluster = NewClusterLink().Copy(object.cluster) + } else { + b.cluster = nil + } + b.clusterArch = object.clusterArch + if object.organization != nil { + b.organization = NewOrganizationLink().Copy(object.organization) + } else { + b.organization = nil + } + b.reservedAtTimestamp = object.reservedAtTimestamp + b.userDefined = object.userDefined + return b +} + +// Build creates a 'DNS_domain' object using the configuration stored in the builder. +func (b *DNSDomainBuilder) Build() (object *DNSDomain, err error) { + object = new(DNSDomain) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.cluster != nil { + object.cluster, err = b.cluster.Build() + if err != nil { + return + } + } + object.clusterArch = b.clusterArch + if b.organization != nil { + object.organization, err = b.organization.Build() + if err != nil { + return + } + } + object.reservedAtTimestamp = b.reservedAtTimestamp + object.userDefined = b.userDefined + return +} diff --git a/clientapi/clustersmgmt/v1/dns_domain_list_builder.go b/clientapi/clustersmgmt/v1/dns_domain_list_builder.go new file mode 100644 index 00000000..5232d34d --- /dev/null +++ b/clientapi/clustersmgmt/v1/dns_domain_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// DNSDomainListBuilder contains the data and logic needed to build +// 'DNS_domain' objects. +type DNSDomainListBuilder struct { + items []*DNSDomainBuilder +} + +// NewDNSDomainList creates a new builder of 'DNS_domain' objects. +func NewDNSDomainList() *DNSDomainListBuilder { + return new(DNSDomainListBuilder) +} + +// Items sets the items of the list. +func (b *DNSDomainListBuilder) Items(values ...*DNSDomainBuilder) *DNSDomainListBuilder { + b.items = make([]*DNSDomainBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *DNSDomainListBuilder) 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 *DNSDomainListBuilder) Copy(list *DNSDomainList) *DNSDomainListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*DNSDomainBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewDNSDomain().Copy(v) + } + } + return b +} + +// Build creates a list of 'DNS_domain' objects using the +// configuration stored in the builder. +func (b *DNSDomainListBuilder) Build() (list *DNSDomainList, err error) { + items := make([]*DNSDomain, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(DNSDomainList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/dns_domain_list_type_json.go b/clientapi/clustersmgmt/v1/dns_domain_list_type_json.go new file mode 100644 index 00000000..70187924 --- /dev/null +++ b/clientapi/clustersmgmt/v1/dns_domain_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDNSDomainList writes a list of values of the 'DNS_domain' type to +// the given writer. +func MarshalDNSDomainList(list []*DNSDomain, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDNSDomainList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDNSDomainList writes a list of value of the 'DNS_domain' type to +// the given stream. +func WriteDNSDomainList(list []*DNSDomain, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteDNSDomain(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalDNSDomainList reads a list of values of the 'DNS_domain' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDNSDomainList(source interface{}) (items []*DNSDomain, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDNSDomainList(iterator) + err = iterator.Error + return +} + +// ReadDNSDomainList reads list of values of the ”DNS_domain' type from +// the given iterator. +func ReadDNSDomainList(iterator *jsoniter.Iterator) []*DNSDomain { + list := []*DNSDomain{} + for iterator.ReadArray() { + item := ReadDNSDomain(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/dns_domain_type.go b/clientapi/clustersmgmt/v1/dns_domain_type.go new file mode 100644 index 00000000..b6c3ab12 --- /dev/null +++ b/clientapi/clustersmgmt/v1/dns_domain_type.go @@ -0,0 +1,365 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// DNSDomainKind is the name of the type used to represent objects +// of type 'DNS_domain'. +const DNSDomainKind = "DNSDomain" + +// DNSDomainLinkKind is the name of the type used to represent links +// to objects of type 'DNS_domain'. +const DNSDomainLinkKind = "DNSDomainLink" + +// DNSDomainNilKind is the name of the type used to nil references +// to objects of type 'DNS_domain'. +const DNSDomainNilKind = "DNSDomainNil" + +// DNSDomain represents the values of the 'DNS_domain' type. +// +// Contains the properties of a DNS domain. +type DNSDomain struct { + bitmap_ uint32 + id string + href string + cluster *ClusterLink + clusterArch ClusterArchitecture + organization *OrganizationLink + reservedAtTimestamp time.Time + userDefined bool +} + +// Kind returns the name of the type of the object. +func (o *DNSDomain) Kind() string { + if o == nil { + return DNSDomainNilKind + } + if o.bitmap_&1 != 0 { + return DNSDomainLinkKind + } + return DNSDomainKind +} + +// Link returns true if this is a link. +func (o *DNSDomain) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *DNSDomain) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *DNSDomain) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *DNSDomain) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *DNSDomain) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *DNSDomain) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Cluster returns the value of the 'cluster' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the cluster that is registered with the DNS domain (optional). +func (o *DNSDomain) Cluster() *ClusterLink { + if o != nil && o.bitmap_&8 != 0 { + return o.cluster + } + return nil +} + +// GetCluster returns the value of the 'cluster' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the cluster that is registered with the DNS domain (optional). +func (o *DNSDomain) GetCluster() (value *ClusterLink, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.cluster + } + return +} + +// ClusterArch returns the value of the 'cluster_arch' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Signals which cluster architecture the domain is ready for. +func (o *DNSDomain) ClusterArch() ClusterArchitecture { + if o != nil && o.bitmap_&16 != 0 { + return o.clusterArch + } + return ClusterArchitecture("") +} + +// GetClusterArch returns the value of the 'cluster_arch' attribute and +// a flag indicating if the attribute has a value. +// +// Signals which cluster architecture the domain is ready for. +func (o *DNSDomain) GetClusterArch() (value ClusterArchitecture, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.clusterArch + } + return +} + +// Organization returns the value of the 'organization' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the organization that reserved the DNS domain. +func (o *DNSDomain) Organization() *OrganizationLink { + if o != nil && o.bitmap_&32 != 0 { + return o.organization + } + return nil +} + +// GetOrganization returns the value of the 'organization' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the organization that reserved the DNS domain. +func (o *DNSDomain) GetOrganization() (value *OrganizationLink, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.organization + } + return +} + +// ReservedAtTimestamp returns the value of the 'reserved_at_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the DNS domain was reserved. +func (o *DNSDomain) ReservedAtTimestamp() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.reservedAtTimestamp + } + return time.Time{} +} + +// GetReservedAtTimestamp returns the value of the 'reserved_at_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the DNS domain was reserved. +func (o *DNSDomain) GetReservedAtTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.reservedAtTimestamp + } + return +} + +// UserDefined returns the value of the 'user_defined' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this dns domain is user defined. +func (o *DNSDomain) UserDefined() bool { + if o != nil && o.bitmap_&128 != 0 { + return o.userDefined + } + return false +} + +// GetUserDefined returns the value of the 'user_defined' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this dns domain is user defined. +func (o *DNSDomain) GetUserDefined() (value bool, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.userDefined + } + return +} + +// DNSDomainListKind is the name of the type used to represent list of objects of +// type 'DNS_domain'. +const DNSDomainListKind = "DNSDomainList" + +// DNSDomainListLinkKind is the name of the type used to represent links to list +// of objects of type 'DNS_domain'. +const DNSDomainListLinkKind = "DNSDomainListLink" + +// DNSDomainNilKind is the name of the type used to nil lists of objects of +// type 'DNS_domain'. +const DNSDomainListNilKind = "DNSDomainListNil" + +// DNSDomainList is a list of values of the 'DNS_domain' type. +type DNSDomainList struct { + href string + link bool + items []*DNSDomain +} + +// Kind returns the name of the type of the object. +func (l *DNSDomainList) Kind() string { + if l == nil { + return DNSDomainListNilKind + } + if l.link { + return DNSDomainListLinkKind + } + return DNSDomainListKind +} + +// Link returns true iif this is a link. +func (l *DNSDomainList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *DNSDomainList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *DNSDomainList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *DNSDomainList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *DNSDomainList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *DNSDomainList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *DNSDomainList) SetItems(items []*DNSDomain) { + l.items = items +} + +// Items returns the items of the list. +func (l *DNSDomainList) Items() []*DNSDomain { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *DNSDomainList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *DNSDomainList) Get(i int) *DNSDomain { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *DNSDomainList) Slice() []*DNSDomain { + var slice []*DNSDomain + if l == nil { + slice = make([]*DNSDomain, 0) + } else { + slice = make([]*DNSDomain, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *DNSDomainList) Each(f func(item *DNSDomain) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *DNSDomainList) Range(f func(index int, item *DNSDomain) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/dns_domain_type_json.go b/clientapi/clustersmgmt/v1/dns_domain_type_json.go new file mode 100644 index 00000000..48855259 --- /dev/null +++ b/clientapi/clustersmgmt/v1/dns_domain_type_json.go @@ -0,0 +1,178 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDNSDomain writes a value of the 'DNS_domain' type to the given writer. +func MarshalDNSDomain(object *DNSDomain, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDNSDomain(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDNSDomain writes a value of the 'DNS_domain' type to the given stream. +func WriteDNSDomain(object *DNSDomain, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(DNSDomainLinkKind) + } else { + stream.WriteString(DNSDomainKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.cluster != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster") + WriteClusterLink(object.cluster, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_arch") + stream.WriteString(string(object.clusterArch)) + count++ + } + present_ = object.bitmap_&32 != 0 && object.organization != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization") + WriteOrganizationLink(object.organization, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("reserved_at_timestamp") + stream.WriteString((object.reservedAtTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("user_defined") + stream.WriteBool(object.userDefined) + } + stream.WriteObjectEnd() +} + +// UnmarshalDNSDomain reads a value of the 'DNS_domain' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalDNSDomain(source interface{}) (object *DNSDomain, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadDNSDomain(iterator) + err = iterator.Error + return +} + +// ReadDNSDomain reads a value of the 'DNS_domain' type from the given iterator. +func ReadDNSDomain(iterator *jsoniter.Iterator) *DNSDomain { + object := &DNSDomain{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == DNSDomainLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "cluster": + value := ReadClusterLink(iterator) + object.cluster = value + object.bitmap_ |= 8 + case "cluster_arch": + text := iterator.ReadString() + value := ClusterArchitecture(text) + object.clusterArch = value + object.bitmap_ |= 16 + case "organization": + value := ReadOrganizationLink(iterator) + object.organization = value + object.bitmap_ |= 32 + case "reserved_at_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.reservedAtTimestamp = value + object.bitmap_ |= 64 + case "user_defined": + value := iterator.ReadBool() + object.userDefined = value + object.bitmap_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/dns_list_builder.go b/clientapi/clustersmgmt/v1/dns_list_builder.go new file mode 100644 index 00000000..06f8ee06 --- /dev/null +++ b/clientapi/clustersmgmt/v1/dns_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// DNSListBuilder contains the data and logic needed to build +// 'DNS' objects. +type DNSListBuilder struct { + items []*DNSBuilder +} + +// NewDNSList creates a new builder of 'DNS' objects. +func NewDNSList() *DNSListBuilder { + return new(DNSListBuilder) +} + +// Items sets the items of the list. +func (b *DNSListBuilder) Items(values ...*DNSBuilder) *DNSListBuilder { + b.items = make([]*DNSBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *DNSListBuilder) 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 *DNSListBuilder) Copy(list *DNSList) *DNSListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*DNSBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewDNS().Copy(v) + } + } + return b +} + +// Build creates a list of 'DNS' objects using the +// configuration stored in the builder. +func (b *DNSListBuilder) Build() (list *DNSList, err error) { + items := make([]*DNS, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(DNSList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/dns_list_type_json.go b/clientapi/clustersmgmt/v1/dns_list_type_json.go new file mode 100644 index 00000000..d1e7ed88 --- /dev/null +++ b/clientapi/clustersmgmt/v1/dns_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDNSList writes a list of values of the 'DNS' type to +// the given writer. +func MarshalDNSList(list []*DNS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDNSList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDNSList writes a list of value of the 'DNS' type to +// the given stream. +func WriteDNSList(list []*DNS, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteDNS(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalDNSList reads a list of values of the 'DNS' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDNSList(source interface{}) (items []*DNS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDNSList(iterator) + err = iterator.Error + return +} + +// ReadDNSList reads list of values of the ”DNS' type from +// the given iterator. +func ReadDNSList(iterator *jsoniter.Iterator) []*DNS { + list := []*DNS{} + for iterator.ReadArray() { + item := ReadDNS(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/dns_type.go b/clientapi/clustersmgmt/v1/dns_type.go new file mode 100644 index 00000000..3c2ba426 --- /dev/null +++ b/clientapi/clustersmgmt/v1/dns_type.go @@ -0,0 +1,251 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// DNS represents the values of the 'DNS' type. +// +// DNS settings of the cluster. +type DNS struct { + bitmap_ uint32 + baseDomain string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *DNS) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// BaseDomain returns the value of the 'base_domain' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Base DNS domain of the cluster. +// +// During the installation of the cluster it is necessary to create multiple DNS records. +// They will be created as sub-domains of this domain. For example, if the domain_prefix of the +// cluster is `mycluster` and the base domain is `example.com` then the following DNS +// records will be created: +// +// ``` +// mycluster-api.example.com +// mycluster-etcd-0.example.com +// mycluster-etcd-1.example.com +// mycluster-etcd-3.example.com +// ``` +// +// The exact number, type and names of the created DNS record depends on the characteristics +// of the cluster, and may be different for different versions of _OpenShift_. Please don't +// rely on them. For example, to find what is the URL of the Kubernetes API server of the +// cluster don't assume that it will be `mycluster-api.example.com`. Instead of that use +// this API to retrieve the description of the cluster, and get it from the `api.url` +// attribute. For example, if the identifier of the cluster is `123` send a request like +// this: +// +// ```http +// GET /api/clusters_mgmt/v1/clusters/123 HTTP/1.1 +// ``` +// +// That will return a response like this, including the `api.url` attribute: +// +// ```json +// +// { +// "kind": "Cluster", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/clusters/123", +// "api": { +// "url": "https://mycluster-api.example.com:6443" +// }, +// ... +// } +// +// ``` +// +// When the cluster is created in Amazon Web Services it is necessary to create this base +// DNS domain in advance, using AWS Route53 (https://console.aws.amazon.com/route53). +func (o *DNS) BaseDomain() string { + if o != nil && o.bitmap_&1 != 0 { + return o.baseDomain + } + return "" +} + +// GetBaseDomain returns the value of the 'base_domain' attribute and +// a flag indicating if the attribute has a value. +// +// Base DNS domain of the cluster. +// +// During the installation of the cluster it is necessary to create multiple DNS records. +// They will be created as sub-domains of this domain. For example, if the domain_prefix of the +// cluster is `mycluster` and the base domain is `example.com` then the following DNS +// records will be created: +// +// ``` +// mycluster-api.example.com +// mycluster-etcd-0.example.com +// mycluster-etcd-1.example.com +// mycluster-etcd-3.example.com +// ``` +// +// The exact number, type and names of the created DNS record depends on the characteristics +// of the cluster, and may be different for different versions of _OpenShift_. Please don't +// rely on them. For example, to find what is the URL of the Kubernetes API server of the +// cluster don't assume that it will be `mycluster-api.example.com`. Instead of that use +// this API to retrieve the description of the cluster, and get it from the `api.url` +// attribute. For example, if the identifier of the cluster is `123` send a request like +// this: +// +// ```http +// GET /api/clusters_mgmt/v1/clusters/123 HTTP/1.1 +// ``` +// +// That will return a response like this, including the `api.url` attribute: +// +// ```json +// +// { +// "kind": "Cluster", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/clusters/123", +// "api": { +// "url": "https://mycluster-api.example.com:6443" +// }, +// ... +// } +// +// ``` +// +// When the cluster is created in Amazon Web Services it is necessary to create this base +// DNS domain in advance, using AWS Route53 (https://console.aws.amazon.com/route53). +func (o *DNS) GetBaseDomain() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.baseDomain + } + return +} + +// DNSListKind is the name of the type used to represent list of objects of +// type 'DNS'. +const DNSListKind = "DNSList" + +// DNSListLinkKind is the name of the type used to represent links to list +// of objects of type 'DNS'. +const DNSListLinkKind = "DNSListLink" + +// DNSNilKind is the name of the type used to nil lists of objects of +// type 'DNS'. +const DNSListNilKind = "DNSListNil" + +// DNSList is a list of values of the 'DNS' type. +type DNSList struct { + href string + link bool + items []*DNS +} + +// Len returns the length of the list. +func (l *DNSList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *DNSList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *DNSList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *DNSList) SetItems(items []*DNS) { + l.items = items +} + +// Items returns the items of the list. +func (l *DNSList) Items() []*DNS { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *DNSList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *DNSList) Get(i int) *DNS { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *DNSList) Slice() []*DNS { + var slice []*DNS + if l == nil { + slice = make([]*DNS, 0) + } else { + slice = make([]*DNS, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *DNSList) Each(f func(item *DNS) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *DNSList) Range(f func(index int, item *DNS) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/dns_type_json.go b/clientapi/clustersmgmt/v1/dns_type_json.go new file mode 100644 index 00000000..9615b20e --- /dev/null +++ b/clientapi/clustersmgmt/v1/dns_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDNS writes a value of the 'DNS' type to the given writer. +func MarshalDNS(object *DNS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDNS(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDNS writes a value of the 'DNS' type to the given stream. +func WriteDNS(object *DNS, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("base_domain") + stream.WriteString(object.baseDomain) + } + stream.WriteObjectEnd() +} + +// UnmarshalDNS reads a value of the 'DNS' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalDNS(source interface{}) (object *DNS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadDNS(iterator) + err = iterator.Error + return +} + +// ReadDNS reads a value of the 'DNS' type from the given iterator. +func ReadDNS(iterator *jsoniter.Iterator) *DNS { + object := &DNS{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "base_domain": + value := iterator.ReadString() + object.baseDomain = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/ec_2_metadata_http_tokens_list_type_json.go b/clientapi/clustersmgmt/v1/ec_2_metadata_http_tokens_list_type_json.go new file mode 100644 index 00000000..9b29f8f3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ec_2_metadata_http_tokens_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalEc2MetadataHttpTokensList writes a list of values of the 'ec_2_metadata_http_tokens' type to +// the given writer. +func MarshalEc2MetadataHttpTokensList(list []Ec2MetadataHttpTokens, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteEc2MetadataHttpTokensList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteEc2MetadataHttpTokensList writes a list of value of the 'ec_2_metadata_http_tokens' type to +// the given stream. +func WriteEc2MetadataHttpTokensList(list []Ec2MetadataHttpTokens, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalEc2MetadataHttpTokensList reads a list of values of the 'ec_2_metadata_http_tokens' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalEc2MetadataHttpTokensList(source interface{}) (items []Ec2MetadataHttpTokens, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadEc2MetadataHttpTokensList(iterator) + err = iterator.Error + return +} + +// ReadEc2MetadataHttpTokensList reads list of values of the ”ec_2_metadata_http_tokens' type from +// the given iterator. +func ReadEc2MetadataHttpTokensList(iterator *jsoniter.Iterator) []Ec2MetadataHttpTokens { + list := []Ec2MetadataHttpTokens{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := Ec2MetadataHttpTokens(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/ec_2_metadata_http_tokens_type.go b/clientapi/clustersmgmt/v1/ec_2_metadata_http_tokens_type.go new file mode 100644 index 00000000..b5cd88f2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ec_2_metadata_http_tokens_type.go @@ -0,0 +1,30 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// Ec2MetadataHttpTokens represents the values of the 'ec_2_metadata_http_tokens' enumerated type. +type Ec2MetadataHttpTokens string + +const ( + // imdsv2 is optional + Ec2MetadataHttpTokensOptional Ec2MetadataHttpTokens = "optional" + // imdsv2 is required + Ec2MetadataHttpTokensRequired Ec2MetadataHttpTokens = "required" +) diff --git a/clientapi/clustersmgmt/v1/encryption_key_builder.go b/clientapi/clustersmgmt/v1/encryption_key_builder.go new file mode 100644 index 00000000..7152db15 --- /dev/null +++ b/clientapi/clustersmgmt/v1/encryption_key_builder.go @@ -0,0 +1,89 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// EncryptionKeyBuilder contains the data and logic needed to build 'encryption_key' objects. +// +// Description of a cloud provider encryption key. +type EncryptionKeyBuilder struct { + bitmap_ uint32 + id string + href string + name string +} + +// NewEncryptionKey creates a new builder of 'encryption_key' objects. +func NewEncryptionKey() *EncryptionKeyBuilder { + return &EncryptionKeyBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *EncryptionKeyBuilder) Link(value bool) *EncryptionKeyBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *EncryptionKeyBuilder) ID(value string) *EncryptionKeyBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *EncryptionKeyBuilder) HREF(value string) *EncryptionKeyBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *EncryptionKeyBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *EncryptionKeyBuilder) Name(value string) *EncryptionKeyBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *EncryptionKeyBuilder) Copy(object *EncryptionKey) *EncryptionKeyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.name = object.name + return b +} + +// Build creates a 'encryption_key' object using the configuration stored in the builder. +func (b *EncryptionKeyBuilder) Build() (object *EncryptionKey, err error) { + object = new(EncryptionKey) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.name = b.name + return +} diff --git a/clientapi/clustersmgmt/v1/encryption_key_list_builder.go b/clientapi/clustersmgmt/v1/encryption_key_list_builder.go new file mode 100644 index 00000000..4bf121ec --- /dev/null +++ b/clientapi/clustersmgmt/v1/encryption_key_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// EncryptionKeyListBuilder contains the data and logic needed to build +// 'encryption_key' objects. +type EncryptionKeyListBuilder struct { + items []*EncryptionKeyBuilder +} + +// NewEncryptionKeyList creates a new builder of 'encryption_key' objects. +func NewEncryptionKeyList() *EncryptionKeyListBuilder { + return new(EncryptionKeyListBuilder) +} + +// Items sets the items of the list. +func (b *EncryptionKeyListBuilder) Items(values ...*EncryptionKeyBuilder) *EncryptionKeyListBuilder { + b.items = make([]*EncryptionKeyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *EncryptionKeyListBuilder) 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 *EncryptionKeyListBuilder) Copy(list *EncryptionKeyList) *EncryptionKeyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*EncryptionKeyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewEncryptionKey().Copy(v) + } + } + return b +} + +// Build creates a list of 'encryption_key' objects using the +// configuration stored in the builder. +func (b *EncryptionKeyListBuilder) Build() (list *EncryptionKeyList, err error) { + items := make([]*EncryptionKey, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(EncryptionKeyList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/encryption_key_list_type_json.go b/clientapi/clustersmgmt/v1/encryption_key_list_type_json.go new file mode 100644 index 00000000..5347a46a --- /dev/null +++ b/clientapi/clustersmgmt/v1/encryption_key_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalEncryptionKeyList writes a list of values of the 'encryption_key' type to +// the given writer. +func MarshalEncryptionKeyList(list []*EncryptionKey, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteEncryptionKeyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteEncryptionKeyList writes a list of value of the 'encryption_key' type to +// the given stream. +func WriteEncryptionKeyList(list []*EncryptionKey, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteEncryptionKey(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalEncryptionKeyList reads a list of values of the 'encryption_key' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalEncryptionKeyList(source interface{}) (items []*EncryptionKey, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadEncryptionKeyList(iterator) + err = iterator.Error + return +} + +// ReadEncryptionKeyList reads list of values of the ”encryption_key' type from +// the given iterator. +func ReadEncryptionKeyList(iterator *jsoniter.Iterator) []*EncryptionKey { + list := []*EncryptionKey{} + for iterator.ReadArray() { + item := ReadEncryptionKey(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/encryption_key_type.go b/clientapi/clustersmgmt/v1/encryption_key_type.go new file mode 100644 index 00000000..083017ae --- /dev/null +++ b/clientapi/clustersmgmt/v1/encryption_key_type.go @@ -0,0 +1,265 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// EncryptionKeyKind is the name of the type used to represent objects +// of type 'encryption_key'. +const EncryptionKeyKind = "EncryptionKey" + +// EncryptionKeyLinkKind is the name of the type used to represent links +// to objects of type 'encryption_key'. +const EncryptionKeyLinkKind = "EncryptionKeyLink" + +// EncryptionKeyNilKind is the name of the type used to nil references +// to objects of type 'encryption_key'. +const EncryptionKeyNilKind = "EncryptionKeyNil" + +// EncryptionKey represents the values of the 'encryption_key' type. +// +// Description of a cloud provider encryption key. +type EncryptionKey struct { + bitmap_ uint32 + id string + href string + name string +} + +// Kind returns the name of the type of the object. +func (o *EncryptionKey) Kind() string { + if o == nil { + return EncryptionKeyNilKind + } + if o.bitmap_&1 != 0 { + return EncryptionKeyLinkKind + } + return EncryptionKeyKind +} + +// Link returns true if this is a link. +func (o *EncryptionKey) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *EncryptionKey) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *EncryptionKey) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *EncryptionKey) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *EncryptionKey) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *EncryptionKey) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the encryption key. +func (o *EncryptionKey) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the encryption key. +func (o *EncryptionKey) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// EncryptionKeyListKind is the name of the type used to represent list of objects of +// type 'encryption_key'. +const EncryptionKeyListKind = "EncryptionKeyList" + +// EncryptionKeyListLinkKind is the name of the type used to represent links to list +// of objects of type 'encryption_key'. +const EncryptionKeyListLinkKind = "EncryptionKeyListLink" + +// EncryptionKeyNilKind is the name of the type used to nil lists of objects of +// type 'encryption_key'. +const EncryptionKeyListNilKind = "EncryptionKeyListNil" + +// EncryptionKeyList is a list of values of the 'encryption_key' type. +type EncryptionKeyList struct { + href string + link bool + items []*EncryptionKey +} + +// Kind returns the name of the type of the object. +func (l *EncryptionKeyList) Kind() string { + if l == nil { + return EncryptionKeyListNilKind + } + if l.link { + return EncryptionKeyListLinkKind + } + return EncryptionKeyListKind +} + +// Link returns true iif this is a link. +func (l *EncryptionKeyList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *EncryptionKeyList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *EncryptionKeyList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *EncryptionKeyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *EncryptionKeyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *EncryptionKeyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *EncryptionKeyList) SetItems(items []*EncryptionKey) { + l.items = items +} + +// Items returns the items of the list. +func (l *EncryptionKeyList) Items() []*EncryptionKey { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *EncryptionKeyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *EncryptionKeyList) Get(i int) *EncryptionKey { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *EncryptionKeyList) Slice() []*EncryptionKey { + var slice []*EncryptionKey + if l == nil { + slice = make([]*EncryptionKey, 0) + } else { + slice = make([]*EncryptionKey, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *EncryptionKeyList) Each(f func(item *EncryptionKey) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *EncryptionKeyList) Range(f func(index int, item *EncryptionKey) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/encryption_key_type_json.go b/clientapi/clustersmgmt/v1/encryption_key_type_json.go new file mode 100644 index 00000000..520ac76c --- /dev/null +++ b/clientapi/clustersmgmt/v1/encryption_key_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalEncryptionKey writes a value of the 'encryption_key' type to the given writer. +func MarshalEncryptionKey(object *EncryptionKey, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteEncryptionKey(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteEncryptionKey writes a value of the 'encryption_key' type to the given stream. +func WriteEncryptionKey(object *EncryptionKey, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(EncryptionKeyLinkKind) + } else { + stream.WriteString(EncryptionKeyKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + } + stream.WriteObjectEnd() +} + +// UnmarshalEncryptionKey reads a value of the 'encryption_key' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalEncryptionKey(source interface{}) (object *EncryptionKey, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadEncryptionKey(iterator) + err = iterator.Error + return +} + +// ReadEncryptionKey reads a value of the 'encryption_key' type from the given iterator. +func ReadEncryptionKey(iterator *jsoniter.Iterator) *EncryptionKey { + object := &EncryptionKey{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == EncryptionKeyLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/environment_builder.go b/clientapi/clustersmgmt/v1/environment_builder.go new file mode 100644 index 00000000..da82999d --- /dev/null +++ b/clientapi/clustersmgmt/v1/environment_builder.go @@ -0,0 +1,97 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// EnvironmentBuilder contains the data and logic needed to build 'environment' objects. +// +// Description of an environment +type EnvironmentBuilder struct { + bitmap_ uint32 + backplaneURL string + lastLimitedSupportCheck time.Time + lastUpgradeAvailableCheck time.Time + name string +} + +// NewEnvironment creates a new builder of 'environment' objects. +func NewEnvironment() *EnvironmentBuilder { + return &EnvironmentBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *EnvironmentBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// BackplaneURL sets the value of the 'backplane_URL' attribute to the given value. +func (b *EnvironmentBuilder) BackplaneURL(value string) *EnvironmentBuilder { + b.backplaneURL = value + b.bitmap_ |= 1 + return b +} + +// LastLimitedSupportCheck sets the value of the 'last_limited_support_check' attribute to the given value. +func (b *EnvironmentBuilder) LastLimitedSupportCheck(value time.Time) *EnvironmentBuilder { + b.lastLimitedSupportCheck = value + b.bitmap_ |= 2 + return b +} + +// LastUpgradeAvailableCheck sets the value of the 'last_upgrade_available_check' attribute to the given value. +func (b *EnvironmentBuilder) LastUpgradeAvailableCheck(value time.Time) *EnvironmentBuilder { + b.lastUpgradeAvailableCheck = value + b.bitmap_ |= 4 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *EnvironmentBuilder) Name(value string) *EnvironmentBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *EnvironmentBuilder) Copy(object *Environment) *EnvironmentBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.backplaneURL = object.backplaneURL + b.lastLimitedSupportCheck = object.lastLimitedSupportCheck + b.lastUpgradeAvailableCheck = object.lastUpgradeAvailableCheck + b.name = object.name + return b +} + +// Build creates a 'environment' object using the configuration stored in the builder. +func (b *EnvironmentBuilder) Build() (object *Environment, err error) { + object = new(Environment) + object.bitmap_ = b.bitmap_ + object.backplaneURL = b.backplaneURL + object.lastLimitedSupportCheck = b.lastLimitedSupportCheck + object.lastUpgradeAvailableCheck = b.lastUpgradeAvailableCheck + object.name = b.name + return +} diff --git a/clientapi/clustersmgmt/v1/environment_list_builder.go b/clientapi/clustersmgmt/v1/environment_list_builder.go new file mode 100644 index 00000000..dcf53118 --- /dev/null +++ b/clientapi/clustersmgmt/v1/environment_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// EnvironmentListBuilder contains the data and logic needed to build +// 'environment' objects. +type EnvironmentListBuilder struct { + items []*EnvironmentBuilder +} + +// NewEnvironmentList creates a new builder of 'environment' objects. +func NewEnvironmentList() *EnvironmentListBuilder { + return new(EnvironmentListBuilder) +} + +// Items sets the items of the list. +func (b *EnvironmentListBuilder) Items(values ...*EnvironmentBuilder) *EnvironmentListBuilder { + b.items = make([]*EnvironmentBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *EnvironmentListBuilder) 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 *EnvironmentListBuilder) Copy(list *EnvironmentList) *EnvironmentListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*EnvironmentBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewEnvironment().Copy(v) + } + } + return b +} + +// Build creates a list of 'environment' objects using the +// configuration stored in the builder. +func (b *EnvironmentListBuilder) Build() (list *EnvironmentList, err error) { + items := make([]*Environment, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(EnvironmentList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/environment_list_type_json.go b/clientapi/clustersmgmt/v1/environment_list_type_json.go new file mode 100644 index 00000000..857187fe --- /dev/null +++ b/clientapi/clustersmgmt/v1/environment_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalEnvironmentList writes a list of values of the 'environment' type to +// the given writer. +func MarshalEnvironmentList(list []*Environment, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteEnvironmentList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteEnvironmentList writes a list of value of the 'environment' type to +// the given stream. +func WriteEnvironmentList(list []*Environment, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteEnvironment(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalEnvironmentList reads a list of values of the 'environment' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalEnvironmentList(source interface{}) (items []*Environment, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadEnvironmentList(iterator) + err = iterator.Error + return +} + +// ReadEnvironmentList reads list of values of the ”environment' type from +// the given iterator. +func ReadEnvironmentList(iterator *jsoniter.Iterator) []*Environment { + list := []*Environment{} + for iterator.ReadArray() { + item := ReadEnvironment(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/environment_type.go b/clientapi/clustersmgmt/v1/environment_type.go new file mode 100644 index 00000000..53435a70 --- /dev/null +++ b/clientapi/clustersmgmt/v1/environment_type.go @@ -0,0 +1,241 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// Environment represents the values of the 'environment' type. +// +// Description of an environment +type Environment struct { + bitmap_ uint32 + backplaneURL string + lastLimitedSupportCheck time.Time + lastUpgradeAvailableCheck time.Time + name string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Environment) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// BackplaneURL returns the value of the 'backplane_URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// the backplane url for the environment +func (o *Environment) BackplaneURL() string { + if o != nil && o.bitmap_&1 != 0 { + return o.backplaneURL + } + return "" +} + +// GetBackplaneURL returns the value of the 'backplane_URL' attribute and +// a flag indicating if the attribute has a value. +// +// the backplane url for the environment +func (o *Environment) GetBackplaneURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.backplaneURL + } + return +} + +// LastLimitedSupportCheck returns the value of the 'last_limited_support_check' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// last time that the worker checked for limited support clusters +func (o *Environment) LastLimitedSupportCheck() time.Time { + if o != nil && o.bitmap_&2 != 0 { + return o.lastLimitedSupportCheck + } + return time.Time{} +} + +// GetLastLimitedSupportCheck returns the value of the 'last_limited_support_check' attribute and +// a flag indicating if the attribute has a value. +// +// last time that the worker checked for limited support clusters +func (o *Environment) GetLastLimitedSupportCheck() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.lastLimitedSupportCheck + } + return +} + +// LastUpgradeAvailableCheck returns the value of the 'last_upgrade_available_check' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// last time that the worker checked for available upgrades +func (o *Environment) LastUpgradeAvailableCheck() time.Time { + if o != nil && o.bitmap_&4 != 0 { + return o.lastUpgradeAvailableCheck + } + return time.Time{} +} + +// GetLastUpgradeAvailableCheck returns the value of the 'last_upgrade_available_check' attribute and +// a flag indicating if the attribute has a value. +// +// last time that the worker checked for available upgrades +func (o *Environment) GetLastUpgradeAvailableCheck() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.lastUpgradeAvailableCheck + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// environment name +func (o *Environment) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// environment name +func (o *Environment) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// EnvironmentListKind is the name of the type used to represent list of objects of +// type 'environment'. +const EnvironmentListKind = "EnvironmentList" + +// EnvironmentListLinkKind is the name of the type used to represent links to list +// of objects of type 'environment'. +const EnvironmentListLinkKind = "EnvironmentListLink" + +// EnvironmentNilKind is the name of the type used to nil lists of objects of +// type 'environment'. +const EnvironmentListNilKind = "EnvironmentListNil" + +// EnvironmentList is a list of values of the 'environment' type. +type EnvironmentList struct { + href string + link bool + items []*Environment +} + +// Len returns the length of the list. +func (l *EnvironmentList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *EnvironmentList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *EnvironmentList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *EnvironmentList) SetItems(items []*Environment) { + l.items = items +} + +// Items returns the items of the list. +func (l *EnvironmentList) Items() []*Environment { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *EnvironmentList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *EnvironmentList) Get(i int) *Environment { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *EnvironmentList) Slice() []*Environment { + var slice []*Environment + if l == nil { + slice = make([]*Environment, 0) + } else { + slice = make([]*Environment, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *EnvironmentList) Each(f func(item *Environment) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *EnvironmentList) Range(f func(index int, item *Environment) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/environment_type_json.go b/clientapi/clustersmgmt/v1/environment_type_json.go new file mode 100644 index 00000000..6259bb0c --- /dev/null +++ b/clientapi/clustersmgmt/v1/environment_type_json.go @@ -0,0 +1,134 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalEnvironment writes a value of the 'environment' type to the given writer. +func MarshalEnvironment(object *Environment, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteEnvironment(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteEnvironment writes a value of the 'environment' type to the given stream. +func WriteEnvironment(object *Environment, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("backplane_url") + stream.WriteString(object.backplaneURL) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_limited_support_check") + stream.WriteString((object.lastLimitedSupportCheck).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_upgrade_available_check") + stream.WriteString((object.lastUpgradeAvailableCheck).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + } + stream.WriteObjectEnd() +} + +// UnmarshalEnvironment reads a value of the 'environment' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalEnvironment(source interface{}) (object *Environment, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadEnvironment(iterator) + err = iterator.Error + return +} + +// ReadEnvironment reads a value of the 'environment' type from the given iterator. +func ReadEnvironment(iterator *jsoniter.Iterator) *Environment { + object := &Environment{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "backplane_url": + value := iterator.ReadString() + object.backplaneURL = value + object.bitmap_ |= 1 + case "last_limited_support_check": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastLimitedSupportCheck = value + object.bitmap_ |= 2 + case "last_upgrade_available_check": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastUpgradeAvailableCheck = value + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/event_builder.go b/clientapi/clustersmgmt/v1/event_builder.go new file mode 100644 index 00000000..aa8e74aa --- /dev/null +++ b/clientapi/clustersmgmt/v1/event_builder.go @@ -0,0 +1,89 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// EventBuilder contains the data and logic needed to build 'event' objects. +// +// Representation of a trackable event. +type EventBuilder struct { + bitmap_ uint32 + body map[string]string + key string +} + +// NewEvent creates a new builder of 'event' objects. +func NewEvent() *EventBuilder { + return &EventBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *EventBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Body sets the value of the 'body' attribute to the given value. +func (b *EventBuilder) Body(value map[string]string) *EventBuilder { + b.body = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// Key sets the value of the 'key' attribute to the given value. +func (b *EventBuilder) Key(value string) *EventBuilder { + b.key = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *EventBuilder) Copy(object *Event) *EventBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if len(object.body) > 0 { + b.body = map[string]string{} + for k, v := range object.body { + b.body[k] = v + } + } else { + b.body = nil + } + b.key = object.key + return b +} + +// Build creates a 'event' object using the configuration stored in the builder. +func (b *EventBuilder) Build() (object *Event, err error) { + object = new(Event) + object.bitmap_ = b.bitmap_ + if b.body != nil { + object.body = make(map[string]string) + for k, v := range b.body { + object.body[k] = v + } + } + object.key = b.key + return +} diff --git a/clientapi/clustersmgmt/v1/event_list_builder.go b/clientapi/clustersmgmt/v1/event_list_builder.go new file mode 100644 index 00000000..1099700b --- /dev/null +++ b/clientapi/clustersmgmt/v1/event_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// EventListBuilder contains the data and logic needed to build +// 'event' objects. +type EventListBuilder struct { + items []*EventBuilder +} + +// NewEventList creates a new builder of 'event' objects. +func NewEventList() *EventListBuilder { + return new(EventListBuilder) +} + +// Items sets the items of the list. +func (b *EventListBuilder) Items(values ...*EventBuilder) *EventListBuilder { + b.items = make([]*EventBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *EventListBuilder) 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 *EventListBuilder) Copy(list *EventList) *EventListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*EventBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewEvent().Copy(v) + } + } + return b +} + +// Build creates a list of 'event' objects using the +// configuration stored in the builder. +func (b *EventListBuilder) Build() (list *EventList, err error) { + items := make([]*Event, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(EventList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/event_list_type_json.go b/clientapi/clustersmgmt/v1/event_list_type_json.go new file mode 100644 index 00000000..04f86c21 --- /dev/null +++ b/clientapi/clustersmgmt/v1/event_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalEventList writes a list of values of the 'event' type to +// the given writer. +func MarshalEventList(list []*Event, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteEventList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteEventList writes a list of value of the 'event' type to +// the given stream. +func WriteEventList(list []*Event, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteEvent(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalEventList reads a list of values of the 'event' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalEventList(source interface{}) (items []*Event, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadEventList(iterator) + err = iterator.Error + return +} + +// ReadEventList reads list of values of the ”event' type from +// the given iterator. +func ReadEventList(iterator *jsoniter.Iterator) []*Event { + list := []*Event{} + for iterator.ReadArray() { + item := ReadEvent(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/event_type.go b/clientapi/clustersmgmt/v1/event_type.go new file mode 100644 index 00000000..7e1331e6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/event_type.go @@ -0,0 +1,193 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// Event represents the values of the 'event' type. +// +// Representation of a trackable event. +type Event struct { + bitmap_ uint32 + body map[string]string + key string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Event) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Body returns the value of the 'body' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Body of the event to track the details of the tracking event as Key value pair +func (o *Event) Body() map[string]string { + if o != nil && o.bitmap_&1 != 0 { + return o.body + } + return nil +} + +// GetBody returns the value of the 'body' attribute and +// a flag indicating if the attribute has a value. +// +// Body of the event to track the details of the tracking event as Key value pair +func (o *Event) GetBody() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.body + } + return +} + +// Key returns the value of the 'key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Key of the event to be tracked. This key should start with an +// uppercase letter followed by alphanumeric characters or +// underscores. The entire key needs to be smaller than 64 characters. +func (o *Event) Key() string { + if o != nil && o.bitmap_&2 != 0 { + return o.key + } + return "" +} + +// GetKey returns the value of the 'key' attribute and +// a flag indicating if the attribute has a value. +// +// Key of the event to be tracked. This key should start with an +// uppercase letter followed by alphanumeric characters or +// underscores. The entire key needs to be smaller than 64 characters. +func (o *Event) GetKey() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.key + } + return +} + +// EventListKind is the name of the type used to represent list of objects of +// type 'event'. +const EventListKind = "EventList" + +// EventListLinkKind is the name of the type used to represent links to list +// of objects of type 'event'. +const EventListLinkKind = "EventListLink" + +// EventNilKind is the name of the type used to nil lists of objects of +// type 'event'. +const EventListNilKind = "EventListNil" + +// EventList is a list of values of the 'event' type. +type EventList struct { + href string + link bool + items []*Event +} + +// Len returns the length of the list. +func (l *EventList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *EventList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *EventList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *EventList) SetItems(items []*Event) { + l.items = items +} + +// Items returns the items of the list. +func (l *EventList) Items() []*Event { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *EventList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *EventList) Get(i int) *Event { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *EventList) Slice() []*Event { + var slice []*Event + if l == nil { + slice = make([]*Event, 0) + } else { + slice = make([]*Event, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *EventList) Each(f func(item *Event) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *EventList) Range(f func(index int, item *Event) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/event_type_json.go b/clientapi/clustersmgmt/v1/event_type_json.go new file mode 100644 index 00000000..d9e78741 --- /dev/null +++ b/clientapi/clustersmgmt/v1/event_type_json.go @@ -0,0 +1,128 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalEvent writes a value of the 'event' type to the given writer. +func MarshalEvent(object *Event, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteEvent(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteEvent writes a value of the 'event' type to the given stream. +func WriteEvent(object *Event, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.body != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("body") + if object.body != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.body)) + i := 0 + for key := range object.body { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.body[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key") + stream.WriteString(object.key) + } + stream.WriteObjectEnd() +} + +// UnmarshalEvent reads a value of the 'event' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalEvent(source interface{}) (object *Event, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadEvent(iterator) + err = iterator.Error + return +} + +// ReadEvent reads a value of the 'event' type from the given iterator. +func ReadEvent(iterator *jsoniter.Iterator) *Event { + object := &Event{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "body": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.body = value + object.bitmap_ |= 1 + case "key": + value := iterator.ReadString() + object.key = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/external_auth_builder.go b/clientapi/clustersmgmt/v1/external_auth_builder.go new file mode 100644 index 00000000..fe9ff559 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_builder.go @@ -0,0 +1,155 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalAuthBuilder contains the data and logic needed to build 'external_auth' objects. +// +// Representation of an external authentication provider. +type ExternalAuthBuilder struct { + bitmap_ uint32 + id string + href string + claim *ExternalAuthClaimBuilder + clients []*ExternalAuthClientConfigBuilder + issuer *TokenIssuerBuilder +} + +// NewExternalAuth creates a new builder of 'external_auth' objects. +func NewExternalAuth() *ExternalAuthBuilder { + return &ExternalAuthBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ExternalAuthBuilder) Link(value bool) *ExternalAuthBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ExternalAuthBuilder) ID(value string) *ExternalAuthBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ExternalAuthBuilder) HREF(value string) *ExternalAuthBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ExternalAuthBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Claim sets the value of the 'claim' attribute to the given value. +// +// The claims and validation rules used in the configuration of the external authentication. +func (b *ExternalAuthBuilder) Claim(value *ExternalAuthClaimBuilder) *ExternalAuthBuilder { + b.claim = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// Clients sets the value of the 'clients' attribute to the given values. +func (b *ExternalAuthBuilder) Clients(values ...*ExternalAuthClientConfigBuilder) *ExternalAuthBuilder { + b.clients = make([]*ExternalAuthClientConfigBuilder, len(values)) + copy(b.clients, values) + b.bitmap_ |= 16 + return b +} + +// Issuer sets the value of the 'issuer' attribute to the given value. +// +// Representation of a token issuer used in an external authentication. +func (b *ExternalAuthBuilder) Issuer(value *TokenIssuerBuilder) *ExternalAuthBuilder { + b.issuer = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ExternalAuthBuilder) Copy(object *ExternalAuth) *ExternalAuthBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.claim != nil { + b.claim = NewExternalAuthClaim().Copy(object.claim) + } else { + b.claim = nil + } + if object.clients != nil { + b.clients = make([]*ExternalAuthClientConfigBuilder, len(object.clients)) + for i, v := range object.clients { + b.clients[i] = NewExternalAuthClientConfig().Copy(v) + } + } else { + b.clients = nil + } + if object.issuer != nil { + b.issuer = NewTokenIssuer().Copy(object.issuer) + } else { + b.issuer = nil + } + return b +} + +// Build creates a 'external_auth' object using the configuration stored in the builder. +func (b *ExternalAuthBuilder) Build() (object *ExternalAuth, err error) { + object = new(ExternalAuth) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.claim != nil { + object.claim, err = b.claim.Build() + if err != nil { + return + } + } + if b.clients != nil { + object.clients = make([]*ExternalAuthClientConfig, len(b.clients)) + for i, v := range b.clients { + object.clients[i], err = v.Build() + if err != nil { + return + } + } + } + if b.issuer != nil { + object.issuer, err = b.issuer.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/external_auth_claim_builder.go b/clientapi/clustersmgmt/v1/external_auth_claim_builder.go new file mode 100644 index 00000000..d4b63417 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_claim_builder.go @@ -0,0 +1,104 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalAuthClaimBuilder contains the data and logic needed to build 'external_auth_claim' objects. +// +// The claims and validation rules used in the configuration of the external authentication. +type ExternalAuthClaimBuilder struct { + bitmap_ uint32 + mappings *TokenClaimMappingsBuilder + validationRules []*TokenClaimValidationRuleBuilder +} + +// NewExternalAuthClaim creates a new builder of 'external_auth_claim' objects. +func NewExternalAuthClaim() *ExternalAuthClaimBuilder { + return &ExternalAuthClaimBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ExternalAuthClaimBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Mappings sets the value of the 'mappings' attribute to the given value. +// +// The claim mappings defined for users and groups. +func (b *ExternalAuthClaimBuilder) Mappings(value *TokenClaimMappingsBuilder) *ExternalAuthClaimBuilder { + b.mappings = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// ValidationRules sets the value of the 'validation_rules' attribute to the given values. +func (b *ExternalAuthClaimBuilder) ValidationRules(values ...*TokenClaimValidationRuleBuilder) *ExternalAuthClaimBuilder { + b.validationRules = make([]*TokenClaimValidationRuleBuilder, len(values)) + copy(b.validationRules, values) + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ExternalAuthClaimBuilder) Copy(object *ExternalAuthClaim) *ExternalAuthClaimBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.mappings != nil { + b.mappings = NewTokenClaimMappings().Copy(object.mappings) + } else { + b.mappings = nil + } + if object.validationRules != nil { + b.validationRules = make([]*TokenClaimValidationRuleBuilder, len(object.validationRules)) + for i, v := range object.validationRules { + b.validationRules[i] = NewTokenClaimValidationRule().Copy(v) + } + } else { + b.validationRules = nil + } + return b +} + +// Build creates a 'external_auth_claim' object using the configuration stored in the builder. +func (b *ExternalAuthClaimBuilder) Build() (object *ExternalAuthClaim, err error) { + object = new(ExternalAuthClaim) + object.bitmap_ = b.bitmap_ + if b.mappings != nil { + object.mappings, err = b.mappings.Build() + if err != nil { + return + } + } + if b.validationRules != nil { + object.validationRules = make([]*TokenClaimValidationRule, len(b.validationRules)) + for i, v := range b.validationRules { + object.validationRules[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/external_auth_claim_list_builder.go b/clientapi/clustersmgmt/v1/external_auth_claim_list_builder.go new file mode 100644 index 00000000..5a1f95fa --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_claim_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalAuthClaimListBuilder contains the data and logic needed to build +// 'external_auth_claim' objects. +type ExternalAuthClaimListBuilder struct { + items []*ExternalAuthClaimBuilder +} + +// NewExternalAuthClaimList creates a new builder of 'external_auth_claim' objects. +func NewExternalAuthClaimList() *ExternalAuthClaimListBuilder { + return new(ExternalAuthClaimListBuilder) +} + +// Items sets the items of the list. +func (b *ExternalAuthClaimListBuilder) Items(values ...*ExternalAuthClaimBuilder) *ExternalAuthClaimListBuilder { + b.items = make([]*ExternalAuthClaimBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ExternalAuthClaimListBuilder) 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 *ExternalAuthClaimListBuilder) Copy(list *ExternalAuthClaimList) *ExternalAuthClaimListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ExternalAuthClaimBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewExternalAuthClaim().Copy(v) + } + } + return b +} + +// Build creates a list of 'external_auth_claim' objects using the +// configuration stored in the builder. +func (b *ExternalAuthClaimListBuilder) Build() (list *ExternalAuthClaimList, err error) { + items := make([]*ExternalAuthClaim, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ExternalAuthClaimList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/external_auth_claim_list_type_json.go b/clientapi/clustersmgmt/v1/external_auth_claim_list_type_json.go new file mode 100644 index 00000000..002bf40e --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_claim_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExternalAuthClaimList writes a list of values of the 'external_auth_claim' type to +// the given writer. +func MarshalExternalAuthClaimList(list []*ExternalAuthClaim, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalAuthClaimList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalAuthClaimList writes a list of value of the 'external_auth_claim' type to +// the given stream. +func WriteExternalAuthClaimList(list []*ExternalAuthClaim, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteExternalAuthClaim(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalExternalAuthClaimList reads a list of values of the 'external_auth_claim' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalExternalAuthClaimList(source interface{}) (items []*ExternalAuthClaim, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadExternalAuthClaimList(iterator) + err = iterator.Error + return +} + +// ReadExternalAuthClaimList reads list of values of the ”external_auth_claim' type from +// the given iterator. +func ReadExternalAuthClaimList(iterator *jsoniter.Iterator) []*ExternalAuthClaim { + list := []*ExternalAuthClaim{} + for iterator.ReadArray() { + item := ReadExternalAuthClaim(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/external_auth_claim_type.go b/clientapi/clustersmgmt/v1/external_auth_claim_type.go new file mode 100644 index 00000000..9ca482d1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_claim_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalAuthClaim represents the values of the 'external_auth_claim' type. +// +// The claims and validation rules used in the configuration of the external authentication. +type ExternalAuthClaim struct { + bitmap_ uint32 + mappings *TokenClaimMappings + validationRules []*TokenClaimValidationRule +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ExternalAuthClaim) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Mappings returns the value of the 'mappings' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Mapping describes rules on how to transform information from an ID token into a cluster identity. +func (o *ExternalAuthClaim) Mappings() *TokenClaimMappings { + if o != nil && o.bitmap_&1 != 0 { + return o.mappings + } + return nil +} + +// GetMappings returns the value of the 'mappings' attribute and +// a flag indicating if the attribute has a value. +// +// Mapping describes rules on how to transform information from an ID token into a cluster identity. +func (o *ExternalAuthClaim) GetMappings() (value *TokenClaimMappings, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.mappings + } + return +} + +// ValidationRules returns the value of the 'validation_rules' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ValidationRules are rules that are applied to validate token claims to authenticate users. +func (o *ExternalAuthClaim) ValidationRules() []*TokenClaimValidationRule { + if o != nil && o.bitmap_&2 != 0 { + return o.validationRules + } + return nil +} + +// GetValidationRules returns the value of the 'validation_rules' attribute and +// a flag indicating if the attribute has a value. +// +// ValidationRules are rules that are applied to validate token claims to authenticate users. +func (o *ExternalAuthClaim) GetValidationRules() (value []*TokenClaimValidationRule, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.validationRules + } + return +} + +// ExternalAuthClaimListKind is the name of the type used to represent list of objects of +// type 'external_auth_claim'. +const ExternalAuthClaimListKind = "ExternalAuthClaimList" + +// ExternalAuthClaimListLinkKind is the name of the type used to represent links to list +// of objects of type 'external_auth_claim'. +const ExternalAuthClaimListLinkKind = "ExternalAuthClaimListLink" + +// ExternalAuthClaimNilKind is the name of the type used to nil lists of objects of +// type 'external_auth_claim'. +const ExternalAuthClaimListNilKind = "ExternalAuthClaimListNil" + +// ExternalAuthClaimList is a list of values of the 'external_auth_claim' type. +type ExternalAuthClaimList struct { + href string + link bool + items []*ExternalAuthClaim +} + +// Len returns the length of the list. +func (l *ExternalAuthClaimList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ExternalAuthClaimList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ExternalAuthClaimList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ExternalAuthClaimList) SetItems(items []*ExternalAuthClaim) { + l.items = items +} + +// Items returns the items of the list. +func (l *ExternalAuthClaimList) Items() []*ExternalAuthClaim { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ExternalAuthClaimList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ExternalAuthClaimList) Get(i int) *ExternalAuthClaim { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ExternalAuthClaimList) Slice() []*ExternalAuthClaim { + var slice []*ExternalAuthClaim + if l == nil { + slice = make([]*ExternalAuthClaim, 0) + } else { + slice = make([]*ExternalAuthClaim, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ExternalAuthClaimList) Each(f func(item *ExternalAuthClaim) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ExternalAuthClaimList) Range(f func(index int, item *ExternalAuthClaim) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/external_auth_claim_type_json.go b/clientapi/clustersmgmt/v1/external_auth_claim_type_json.go new file mode 100644 index 00000000..b3f1dd68 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_claim_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExternalAuthClaim writes a value of the 'external_auth_claim' type to the given writer. +func MarshalExternalAuthClaim(object *ExternalAuthClaim, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalAuthClaim(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalAuthClaim writes a value of the 'external_auth_claim' type to the given stream. +func WriteExternalAuthClaim(object *ExternalAuthClaim, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.mappings != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("mappings") + WriteTokenClaimMappings(object.mappings, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.validationRules != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("validation_rules") + WriteTokenClaimValidationRuleList(object.validationRules, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalExternalAuthClaim reads a value of the 'external_auth_claim' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalExternalAuthClaim(source interface{}) (object *ExternalAuthClaim, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadExternalAuthClaim(iterator) + err = iterator.Error + return +} + +// ReadExternalAuthClaim reads a value of the 'external_auth_claim' type from the given iterator. +func ReadExternalAuthClaim(iterator *jsoniter.Iterator) *ExternalAuthClaim { + object := &ExternalAuthClaim{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "mappings": + value := ReadTokenClaimMappings(iterator) + object.mappings = value + object.bitmap_ |= 1 + case "validation_rules": + value := ReadTokenClaimValidationRuleList(iterator) + object.validationRules = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/external_auth_client_config_builder.go b/clientapi/clustersmgmt/v1/external_auth_client_config_builder.go new file mode 100644 index 00000000..d649c94a --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_client_config_builder.go @@ -0,0 +1,118 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalAuthClientConfigBuilder contains the data and logic needed to build 'external_auth_client_config' objects. +// +// ExternalAuthClientConfig contains configuration for the platform's clients that +// need to request tokens from the issuer. +type ExternalAuthClientConfigBuilder struct { + bitmap_ uint32 + id string + component *ClientComponentBuilder + extraScopes []string + secret string +} + +// NewExternalAuthClientConfig creates a new builder of 'external_auth_client_config' objects. +func NewExternalAuthClientConfig() *ExternalAuthClientConfigBuilder { + return &ExternalAuthClientConfigBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ExternalAuthClientConfigBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *ExternalAuthClientConfigBuilder) ID(value string) *ExternalAuthClientConfigBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// Component sets the value of the 'component' attribute to the given value. +// +// The reference of a component that will consume the client configuration. +func (b *ExternalAuthClientConfigBuilder) Component(value *ClientComponentBuilder) *ExternalAuthClientConfigBuilder { + b.component = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// ExtraScopes sets the value of the 'extra_scopes' attribute to the given values. +func (b *ExternalAuthClientConfigBuilder) ExtraScopes(values ...string) *ExternalAuthClientConfigBuilder { + b.extraScopes = make([]string, len(values)) + copy(b.extraScopes, values) + b.bitmap_ |= 4 + return b +} + +// Secret sets the value of the 'secret' attribute to the given value. +func (b *ExternalAuthClientConfigBuilder) Secret(value string) *ExternalAuthClientConfigBuilder { + b.secret = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ExternalAuthClientConfigBuilder) Copy(object *ExternalAuthClientConfig) *ExternalAuthClientConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + if object.component != nil { + b.component = NewClientComponent().Copy(object.component) + } else { + b.component = nil + } + if object.extraScopes != nil { + b.extraScopes = make([]string, len(object.extraScopes)) + copy(b.extraScopes, object.extraScopes) + } else { + b.extraScopes = nil + } + b.secret = object.secret + return b +} + +// Build creates a 'external_auth_client_config' object using the configuration stored in the builder. +func (b *ExternalAuthClientConfigBuilder) Build() (object *ExternalAuthClientConfig, err error) { + object = new(ExternalAuthClientConfig) + object.bitmap_ = b.bitmap_ + object.id = b.id + if b.component != nil { + object.component, err = b.component.Build() + if err != nil { + return + } + } + if b.extraScopes != nil { + object.extraScopes = make([]string, len(b.extraScopes)) + copy(object.extraScopes, b.extraScopes) + } + object.secret = b.secret + return +} diff --git a/clientapi/clustersmgmt/v1/external_auth_client_config_list_builder.go b/clientapi/clustersmgmt/v1/external_auth_client_config_list_builder.go new file mode 100644 index 00000000..4ad4d525 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_client_config_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalAuthClientConfigListBuilder contains the data and logic needed to build +// 'external_auth_client_config' objects. +type ExternalAuthClientConfigListBuilder struct { + items []*ExternalAuthClientConfigBuilder +} + +// NewExternalAuthClientConfigList creates a new builder of 'external_auth_client_config' objects. +func NewExternalAuthClientConfigList() *ExternalAuthClientConfigListBuilder { + return new(ExternalAuthClientConfigListBuilder) +} + +// Items sets the items of the list. +func (b *ExternalAuthClientConfigListBuilder) Items(values ...*ExternalAuthClientConfigBuilder) *ExternalAuthClientConfigListBuilder { + b.items = make([]*ExternalAuthClientConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ExternalAuthClientConfigListBuilder) 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 *ExternalAuthClientConfigListBuilder) Copy(list *ExternalAuthClientConfigList) *ExternalAuthClientConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ExternalAuthClientConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewExternalAuthClientConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'external_auth_client_config' objects using the +// configuration stored in the builder. +func (b *ExternalAuthClientConfigListBuilder) Build() (list *ExternalAuthClientConfigList, err error) { + items := make([]*ExternalAuthClientConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ExternalAuthClientConfigList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/external_auth_client_config_list_type_json.go b/clientapi/clustersmgmt/v1/external_auth_client_config_list_type_json.go new file mode 100644 index 00000000..c4a5735a --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_client_config_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExternalAuthClientConfigList writes a list of values of the 'external_auth_client_config' type to +// the given writer. +func MarshalExternalAuthClientConfigList(list []*ExternalAuthClientConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalAuthClientConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalAuthClientConfigList writes a list of value of the 'external_auth_client_config' type to +// the given stream. +func WriteExternalAuthClientConfigList(list []*ExternalAuthClientConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteExternalAuthClientConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalExternalAuthClientConfigList reads a list of values of the 'external_auth_client_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalExternalAuthClientConfigList(source interface{}) (items []*ExternalAuthClientConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadExternalAuthClientConfigList(iterator) + err = iterator.Error + return +} + +// ReadExternalAuthClientConfigList reads list of values of the ”external_auth_client_config' type from +// the given iterator. +func ReadExternalAuthClientConfigList(iterator *jsoniter.Iterator) []*ExternalAuthClientConfig { + list := []*ExternalAuthClientConfig{} + for iterator.ReadArray() { + item := ReadExternalAuthClientConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/external_auth_client_config_type.go b/clientapi/clustersmgmt/v1/external_auth_client_config_type.go new file mode 100644 index 00000000..5f256af4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_client_config_type.go @@ -0,0 +1,238 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalAuthClientConfig represents the values of the 'external_auth_client_config' type. +// +// ExternalAuthClientConfig contains configuration for the platform's clients that +// need to request tokens from the issuer. +type ExternalAuthClientConfig struct { + bitmap_ uint32 + id string + component *ClientComponent + extraScopes []string + secret string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ExternalAuthClientConfig) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The identifier of the OIDC client from the OIDC provider. +func (o *ExternalAuthClientConfig) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// The identifier of the OIDC client from the OIDC provider. +func (o *ExternalAuthClientConfig) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// Component returns the value of the 'component' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The component that is supposed to consume this client configuration. +func (o *ExternalAuthClientConfig) Component() *ClientComponent { + if o != nil && o.bitmap_&2 != 0 { + return o.component + } + return nil +} + +// GetComponent returns the value of the 'component' attribute and +// a flag indicating if the attribute has a value. +// +// The component that is supposed to consume this client configuration. +func (o *ExternalAuthClientConfig) GetComponent() (value *ClientComponent, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.component + } + return +} + +// ExtraScopes returns the value of the 'extra_scopes' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ExtraScopes is an optional set of scopes to request tokens with. +func (o *ExternalAuthClientConfig) ExtraScopes() []string { + if o != nil && o.bitmap_&4 != 0 { + return o.extraScopes + } + return nil +} + +// GetExtraScopes returns the value of the 'extra_scopes' attribute and +// a flag indicating if the attribute has a value. +// +// ExtraScopes is an optional set of scopes to request tokens with. +func (o *ExternalAuthClientConfig) GetExtraScopes() (value []string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.extraScopes + } + return +} + +// Secret returns the value of the 'secret' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The secret of the OIDC client from the OIDC provider. +func (o *ExternalAuthClientConfig) Secret() string { + if o != nil && o.bitmap_&8 != 0 { + return o.secret + } + return "" +} + +// GetSecret returns the value of the 'secret' attribute and +// a flag indicating if the attribute has a value. +// +// The secret of the OIDC client from the OIDC provider. +func (o *ExternalAuthClientConfig) GetSecret() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.secret + } + return +} + +// ExternalAuthClientConfigListKind is the name of the type used to represent list of objects of +// type 'external_auth_client_config'. +const ExternalAuthClientConfigListKind = "ExternalAuthClientConfigList" + +// ExternalAuthClientConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'external_auth_client_config'. +const ExternalAuthClientConfigListLinkKind = "ExternalAuthClientConfigListLink" + +// ExternalAuthClientConfigNilKind is the name of the type used to nil lists of objects of +// type 'external_auth_client_config'. +const ExternalAuthClientConfigListNilKind = "ExternalAuthClientConfigListNil" + +// ExternalAuthClientConfigList is a list of values of the 'external_auth_client_config' type. +type ExternalAuthClientConfigList struct { + href string + link bool + items []*ExternalAuthClientConfig +} + +// Len returns the length of the list. +func (l *ExternalAuthClientConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ExternalAuthClientConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ExternalAuthClientConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ExternalAuthClientConfigList) SetItems(items []*ExternalAuthClientConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *ExternalAuthClientConfigList) Items() []*ExternalAuthClientConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ExternalAuthClientConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ExternalAuthClientConfigList) Get(i int) *ExternalAuthClientConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ExternalAuthClientConfigList) Slice() []*ExternalAuthClientConfig { + var slice []*ExternalAuthClientConfig + if l == nil { + slice = make([]*ExternalAuthClientConfig, 0) + } else { + slice = make([]*ExternalAuthClientConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ExternalAuthClientConfigList) Each(f func(item *ExternalAuthClientConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ExternalAuthClientConfigList) Range(f func(index int, item *ExternalAuthClientConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/external_auth_client_config_type_json.go b/clientapi/clustersmgmt/v1/external_auth_client_config_type_json.go new file mode 100644 index 00000000..8298e4a5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_client_config_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExternalAuthClientConfig writes a value of the 'external_auth_client_config' type to the given writer. +func MarshalExternalAuthClientConfig(object *ExternalAuthClientConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalAuthClientConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalAuthClientConfig writes a value of the 'external_auth_client_config' type to the given stream. +func WriteExternalAuthClientConfig(object *ExternalAuthClientConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 && object.component != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("component") + WriteClientComponent(object.component, stream) + count++ + } + present_ = object.bitmap_&4 != 0 && object.extraScopes != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("extra_scopes") + WriteStringList(object.extraScopes, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("secret") + stream.WriteString(object.secret) + } + stream.WriteObjectEnd() +} + +// UnmarshalExternalAuthClientConfig reads a value of the 'external_auth_client_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalExternalAuthClientConfig(source interface{}) (object *ExternalAuthClientConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadExternalAuthClientConfig(iterator) + err = iterator.Error + return +} + +// ReadExternalAuthClientConfig reads a value of the 'external_auth_client_config' type from the given iterator. +func ReadExternalAuthClientConfig(iterator *jsoniter.Iterator) *ExternalAuthClientConfig { + object := &ExternalAuthClientConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "component": + value := ReadClientComponent(iterator) + object.component = value + object.bitmap_ |= 2 + case "extra_scopes": + value := ReadStringList(iterator) + object.extraScopes = value + object.bitmap_ |= 4 + case "secret": + value := iterator.ReadString() + object.secret = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/external_auth_config_builder.go b/clientapi/clustersmgmt/v1/external_auth_config_builder.go new file mode 100644 index 00000000..a5cf9fb5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_config_builder.go @@ -0,0 +1,82 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalAuthConfigBuilder contains the data and logic needed to build 'external_auth_config' objects. +// +// ExternalAuthConfig configuration +type ExternalAuthConfigBuilder struct { + bitmap_ uint32 + externalAuths *ExternalAuthListBuilder + enabled bool +} + +// NewExternalAuthConfig creates a new builder of 'external_auth_config' objects. +func NewExternalAuthConfig() *ExternalAuthConfigBuilder { + return &ExternalAuthConfigBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ExternalAuthConfigBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *ExternalAuthConfigBuilder) Enabled(value bool) *ExternalAuthConfigBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// ExternalAuths sets the value of the 'external_auths' attribute to the given values. +func (b *ExternalAuthConfigBuilder) ExternalAuths(value *ExternalAuthListBuilder) *ExternalAuthConfigBuilder { + b.externalAuths = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ExternalAuthConfigBuilder) Copy(object *ExternalAuthConfig) *ExternalAuthConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + if object.externalAuths != nil { + b.externalAuths = NewExternalAuthList().Copy(object.externalAuths) + } else { + b.externalAuths = nil + } + return b +} + +// Build creates a 'external_auth_config' object using the configuration stored in the builder. +func (b *ExternalAuthConfigBuilder) Build() (object *ExternalAuthConfig, err error) { + object = new(ExternalAuthConfig) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + if b.externalAuths != nil { + object.externalAuths, err = b.externalAuths.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/external_auth_config_list_builder.go b/clientapi/clustersmgmt/v1/external_auth_config_list_builder.go new file mode 100644 index 00000000..074e6614 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_config_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalAuthConfigListBuilder contains the data and logic needed to build +// 'external_auth_config' objects. +type ExternalAuthConfigListBuilder struct { + items []*ExternalAuthConfigBuilder +} + +// NewExternalAuthConfigList creates a new builder of 'external_auth_config' objects. +func NewExternalAuthConfigList() *ExternalAuthConfigListBuilder { + return new(ExternalAuthConfigListBuilder) +} + +// Items sets the items of the list. +func (b *ExternalAuthConfigListBuilder) Items(values ...*ExternalAuthConfigBuilder) *ExternalAuthConfigListBuilder { + b.items = make([]*ExternalAuthConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ExternalAuthConfigListBuilder) 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 *ExternalAuthConfigListBuilder) Copy(list *ExternalAuthConfigList) *ExternalAuthConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ExternalAuthConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewExternalAuthConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'external_auth_config' objects using the +// configuration stored in the builder. +func (b *ExternalAuthConfigListBuilder) Build() (list *ExternalAuthConfigList, err error) { + items := make([]*ExternalAuthConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ExternalAuthConfigList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/external_auth_config_list_type_json.go b/clientapi/clustersmgmt/v1/external_auth_config_list_type_json.go new file mode 100644 index 00000000..385f91b3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_config_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExternalAuthConfigList writes a list of values of the 'external_auth_config' type to +// the given writer. +func MarshalExternalAuthConfigList(list []*ExternalAuthConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalAuthConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalAuthConfigList writes a list of value of the 'external_auth_config' type to +// the given stream. +func WriteExternalAuthConfigList(list []*ExternalAuthConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteExternalAuthConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalExternalAuthConfigList reads a list of values of the 'external_auth_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalExternalAuthConfigList(source interface{}) (items []*ExternalAuthConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadExternalAuthConfigList(iterator) + err = iterator.Error + return +} + +// ReadExternalAuthConfigList reads list of values of the ”external_auth_config' type from +// the given iterator. +func ReadExternalAuthConfigList(iterator *jsoniter.Iterator) []*ExternalAuthConfig { + list := []*ExternalAuthConfig{} + for iterator.ReadArray() { + item := ReadExternalAuthConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/external_auth_config_type.go b/clientapi/clustersmgmt/v1/external_auth_config_type.go new file mode 100644 index 00000000..ad318f24 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_config_type.go @@ -0,0 +1,195 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalAuthConfig represents the values of the 'external_auth_config' type. +// +// ExternalAuthConfig configuration +type ExternalAuthConfig struct { + bitmap_ uint32 + externalAuths *ExternalAuthList + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ExternalAuthConfig) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Boolean flag indicating if the cluster should use an external authentication configuration. +// +// By default this is false. +// +// To enable it the cluster needs to be ROSA HCP cluster and the organization of the user needs +// to have the `external-authentication` feature toggle enabled. +func (o *ExternalAuthConfig) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Boolean flag indicating if the cluster should use an external authentication configuration. +// +// By default this is false. +// +// To enable it the cluster needs to be ROSA HCP cluster and the organization of the user needs +// to have the `external-authentication` feature toggle enabled. +func (o *ExternalAuthConfig) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// ExternalAuths returns the value of the 'external_auths' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ExternalAuthConfig) ExternalAuths() *ExternalAuthList { + if o != nil && o.bitmap_&2 != 0 { + return o.externalAuths + } + return nil +} + +// GetExternalAuths returns the value of the 'external_auths' attribute and +// a flag indicating if the attribute has a value. +func (o *ExternalAuthConfig) GetExternalAuths() (value *ExternalAuthList, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.externalAuths + } + return +} + +// ExternalAuthConfigListKind is the name of the type used to represent list of objects of +// type 'external_auth_config'. +const ExternalAuthConfigListKind = "ExternalAuthConfigList" + +// ExternalAuthConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'external_auth_config'. +const ExternalAuthConfigListLinkKind = "ExternalAuthConfigListLink" + +// ExternalAuthConfigNilKind is the name of the type used to nil lists of objects of +// type 'external_auth_config'. +const ExternalAuthConfigListNilKind = "ExternalAuthConfigListNil" + +// ExternalAuthConfigList is a list of values of the 'external_auth_config' type. +type ExternalAuthConfigList struct { + href string + link bool + items []*ExternalAuthConfig +} + +// Len returns the length of the list. +func (l *ExternalAuthConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ExternalAuthConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ExternalAuthConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ExternalAuthConfigList) SetItems(items []*ExternalAuthConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *ExternalAuthConfigList) Items() []*ExternalAuthConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ExternalAuthConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ExternalAuthConfigList) Get(i int) *ExternalAuthConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ExternalAuthConfigList) Slice() []*ExternalAuthConfig { + var slice []*ExternalAuthConfig + if l == nil { + slice = make([]*ExternalAuthConfig, 0) + } else { + slice = make([]*ExternalAuthConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ExternalAuthConfigList) Each(f func(item *ExternalAuthConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ExternalAuthConfigList) Range(f func(index int, item *ExternalAuthConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/external_auth_config_type_json.go b/clientapi/clustersmgmt/v1/external_auth_config_type_json.go new file mode 100644 index 00000000..78b055c2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_config_type_json.go @@ -0,0 +1,119 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExternalAuthConfig writes a value of the 'external_auth_config' type to the given writer. +func MarshalExternalAuthConfig(object *ExternalAuthConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalAuthConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalAuthConfig writes a value of the 'external_auth_config' type to the given stream. +func WriteExternalAuthConfig(object *ExternalAuthConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&2 != 0 && object.externalAuths != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_auths") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteExternalAuthList(object.externalAuths.Items(), stream) + stream.WriteObjectEnd() + } + stream.WriteObjectEnd() +} + +// UnmarshalExternalAuthConfig reads a value of the 'external_auth_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalExternalAuthConfig(source interface{}) (object *ExternalAuthConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadExternalAuthConfig(iterator) + err = iterator.Error + return +} + +// ReadExternalAuthConfig reads a value of the 'external_auth_config' type from the given iterator. +func ReadExternalAuthConfig(iterator *jsoniter.Iterator) *ExternalAuthConfig { + object := &ExternalAuthConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + case "external_auths": + value := &ExternalAuthList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == ExternalAuthListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadExternalAuthList(iterator)) + default: + iterator.ReadAny() + } + } + object.externalAuths = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/external_auth_list_builder.go b/clientapi/clustersmgmt/v1/external_auth_list_builder.go new file mode 100644 index 00000000..f921a55c --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalAuthListBuilder contains the data and logic needed to build +// 'external_auth' objects. +type ExternalAuthListBuilder struct { + items []*ExternalAuthBuilder +} + +// NewExternalAuthList creates a new builder of 'external_auth' objects. +func NewExternalAuthList() *ExternalAuthListBuilder { + return new(ExternalAuthListBuilder) +} + +// Items sets the items of the list. +func (b *ExternalAuthListBuilder) Items(values ...*ExternalAuthBuilder) *ExternalAuthListBuilder { + b.items = make([]*ExternalAuthBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ExternalAuthListBuilder) 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 *ExternalAuthListBuilder) Copy(list *ExternalAuthList) *ExternalAuthListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ExternalAuthBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewExternalAuth().Copy(v) + } + } + return b +} + +// Build creates a list of 'external_auth' objects using the +// configuration stored in the builder. +func (b *ExternalAuthListBuilder) Build() (list *ExternalAuthList, err error) { + items := make([]*ExternalAuth, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ExternalAuthList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/external_auth_list_type_json.go b/clientapi/clustersmgmt/v1/external_auth_list_type_json.go new file mode 100644 index 00000000..f6d106f7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExternalAuthList writes a list of values of the 'external_auth' type to +// the given writer. +func MarshalExternalAuthList(list []*ExternalAuth, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalAuthList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalAuthList writes a list of value of the 'external_auth' type to +// the given stream. +func WriteExternalAuthList(list []*ExternalAuth, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteExternalAuth(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalExternalAuthList reads a list of values of the 'external_auth' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalExternalAuthList(source interface{}) (items []*ExternalAuth, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadExternalAuthList(iterator) + err = iterator.Error + return +} + +// ReadExternalAuthList reads list of values of the ”external_auth' type from +// the given iterator. +func ReadExternalAuthList(iterator *jsoniter.Iterator) []*ExternalAuth { + list := []*ExternalAuth{} + for iterator.ReadArray() { + item := ReadExternalAuth(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/external_auth_type.go b/clientapi/clustersmgmt/v1/external_auth_type.go new file mode 100644 index 00000000..99526306 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_type.go @@ -0,0 +1,313 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalAuthKind is the name of the type used to represent objects +// of type 'external_auth'. +const ExternalAuthKind = "ExternalAuth" + +// ExternalAuthLinkKind is the name of the type used to represent links +// to objects of type 'external_auth'. +const ExternalAuthLinkKind = "ExternalAuthLink" + +// ExternalAuthNilKind is the name of the type used to nil references +// to objects of type 'external_auth'. +const ExternalAuthNilKind = "ExternalAuthNil" + +// ExternalAuth represents the values of the 'external_auth' type. +// +// Representation of an external authentication provider. +type ExternalAuth struct { + bitmap_ uint32 + id string + href string + claim *ExternalAuthClaim + clients []*ExternalAuthClientConfig + issuer *TokenIssuer +} + +// Kind returns the name of the type of the object. +func (o *ExternalAuth) Kind() string { + if o == nil { + return ExternalAuthNilKind + } + if o.bitmap_&1 != 0 { + return ExternalAuthLinkKind + } + return ExternalAuthKind +} + +// Link returns true if this is a link. +func (o *ExternalAuth) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ExternalAuth) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ExternalAuth) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ExternalAuth) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ExternalAuth) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ExternalAuth) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Claim returns the value of the 'claim' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The rules on how to transform information from an ID token into a cluster identity. +func (o *ExternalAuth) Claim() *ExternalAuthClaim { + if o != nil && o.bitmap_&8 != 0 { + return o.claim + } + return nil +} + +// GetClaim returns the value of the 'claim' attribute and +// a flag indicating if the attribute has a value. +// +// The rules on how to transform information from an ID token into a cluster identity. +func (o *ExternalAuth) GetClaim() (value *ExternalAuthClaim, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.claim + } + return +} + +// Clients returns the value of the 'clients' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The list of the platform's clients that need to request tokens from the issuer. +func (o *ExternalAuth) Clients() []*ExternalAuthClientConfig { + if o != nil && o.bitmap_&16 != 0 { + return o.clients + } + return nil +} + +// GetClients returns the value of the 'clients' attribute and +// a flag indicating if the attribute has a value. +// +// The list of the platform's clients that need to request tokens from the issuer. +func (o *ExternalAuth) GetClients() (value []*ExternalAuthClientConfig, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.clients + } + return +} + +// Issuer returns the value of the 'issuer' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The issuer describes the attributes of the OIDC token issuer. +func (o *ExternalAuth) Issuer() *TokenIssuer { + if o != nil && o.bitmap_&32 != 0 { + return o.issuer + } + return nil +} + +// GetIssuer returns the value of the 'issuer' attribute and +// a flag indicating if the attribute has a value. +// +// The issuer describes the attributes of the OIDC token issuer. +func (o *ExternalAuth) GetIssuer() (value *TokenIssuer, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.issuer + } + return +} + +// ExternalAuthListKind is the name of the type used to represent list of objects of +// type 'external_auth'. +const ExternalAuthListKind = "ExternalAuthList" + +// ExternalAuthListLinkKind is the name of the type used to represent links to list +// of objects of type 'external_auth'. +const ExternalAuthListLinkKind = "ExternalAuthListLink" + +// ExternalAuthNilKind is the name of the type used to nil lists of objects of +// type 'external_auth'. +const ExternalAuthListNilKind = "ExternalAuthListNil" + +// ExternalAuthList is a list of values of the 'external_auth' type. +type ExternalAuthList struct { + href string + link bool + items []*ExternalAuth +} + +// Kind returns the name of the type of the object. +func (l *ExternalAuthList) Kind() string { + if l == nil { + return ExternalAuthListNilKind + } + if l.link { + return ExternalAuthListLinkKind + } + return ExternalAuthListKind +} + +// Link returns true iif this is a link. +func (l *ExternalAuthList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ExternalAuthList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ExternalAuthList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ExternalAuthList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ExternalAuthList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ExternalAuthList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ExternalAuthList) SetItems(items []*ExternalAuth) { + l.items = items +} + +// Items returns the items of the list. +func (l *ExternalAuthList) Items() []*ExternalAuth { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ExternalAuthList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ExternalAuthList) Get(i int) *ExternalAuth { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ExternalAuthList) Slice() []*ExternalAuth { + var slice []*ExternalAuth + if l == nil { + slice = make([]*ExternalAuth, 0) + } else { + slice = make([]*ExternalAuth, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ExternalAuthList) Each(f func(item *ExternalAuth) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ExternalAuthList) Range(f func(index int, item *ExternalAuth) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/external_auth_type_json.go b/clientapi/clustersmgmt/v1/external_auth_type_json.go new file mode 100644 index 00000000..ae1336a0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_auth_type_json.go @@ -0,0 +1,146 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExternalAuth writes a value of the 'external_auth' type to the given writer. +func MarshalExternalAuth(object *ExternalAuth, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalAuth(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalAuth writes a value of the 'external_auth' type to the given stream. +func WriteExternalAuth(object *ExternalAuth, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ExternalAuthLinkKind) + } else { + stream.WriteString(ExternalAuthKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.claim != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("claim") + WriteExternalAuthClaim(object.claim, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.clients != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("clients") + WriteExternalAuthClientConfigList(object.clients, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.issuer != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("issuer") + WriteTokenIssuer(object.issuer, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalExternalAuth reads a value of the 'external_auth' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalExternalAuth(source interface{}) (object *ExternalAuth, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadExternalAuth(iterator) + err = iterator.Error + return +} + +// ReadExternalAuth reads a value of the 'external_auth' type from the given iterator. +func ReadExternalAuth(iterator *jsoniter.Iterator) *ExternalAuth { + object := &ExternalAuth{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ExternalAuthLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "claim": + value := ReadExternalAuthClaim(iterator) + object.claim = value + object.bitmap_ |= 8 + case "clients": + value := ReadExternalAuthClientConfigList(iterator) + object.clients = value + object.bitmap_ |= 16 + case "issuer": + value := ReadTokenIssuer(iterator) + object.issuer = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/external_configuration_builder.go b/clientapi/clustersmgmt/v1/external_configuration_builder.go new file mode 100644 index 00000000..bf3a8c36 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_configuration_builder.go @@ -0,0 +1,110 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalConfigurationBuilder contains the data and logic needed to build 'external_configuration' objects. +// +// Representation of cluster external configuration. +type ExternalConfigurationBuilder struct { + bitmap_ uint32 + labels *LabelListBuilder + manifests *ManifestListBuilder + syncsets *SyncsetListBuilder +} + +// NewExternalConfiguration creates a new builder of 'external_configuration' objects. +func NewExternalConfiguration() *ExternalConfigurationBuilder { + return &ExternalConfigurationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ExternalConfigurationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Labels sets the value of the 'labels' attribute to the given values. +func (b *ExternalConfigurationBuilder) Labels(value *LabelListBuilder) *ExternalConfigurationBuilder { + b.labels = value + b.bitmap_ |= 1 + return b +} + +// Manifests sets the value of the 'manifests' attribute to the given values. +func (b *ExternalConfigurationBuilder) Manifests(value *ManifestListBuilder) *ExternalConfigurationBuilder { + b.manifests = value + b.bitmap_ |= 2 + return b +} + +// Syncsets sets the value of the 'syncsets' attribute to the given values. +func (b *ExternalConfigurationBuilder) Syncsets(value *SyncsetListBuilder) *ExternalConfigurationBuilder { + b.syncsets = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ExternalConfigurationBuilder) Copy(object *ExternalConfiguration) *ExternalConfigurationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.labels != nil { + b.labels = NewLabelList().Copy(object.labels) + } else { + b.labels = nil + } + if object.manifests != nil { + b.manifests = NewManifestList().Copy(object.manifests) + } else { + b.manifests = nil + } + if object.syncsets != nil { + b.syncsets = NewSyncsetList().Copy(object.syncsets) + } else { + b.syncsets = nil + } + return b +} + +// Build creates a 'external_configuration' object using the configuration stored in the builder. +func (b *ExternalConfigurationBuilder) Build() (object *ExternalConfiguration, err error) { + object = new(ExternalConfiguration) + object.bitmap_ = b.bitmap_ + if b.labels != nil { + object.labels, err = b.labels.Build() + if err != nil { + return + } + } + if b.manifests != nil { + object.manifests, err = b.manifests.Build() + if err != nil { + return + } + } + if b.syncsets != nil { + object.syncsets, err = b.syncsets.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/external_configuration_list_builder.go b/clientapi/clustersmgmt/v1/external_configuration_list_builder.go new file mode 100644 index 00000000..c7de4865 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_configuration_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalConfigurationListBuilder contains the data and logic needed to build +// 'external_configuration' objects. +type ExternalConfigurationListBuilder struct { + items []*ExternalConfigurationBuilder +} + +// NewExternalConfigurationList creates a new builder of 'external_configuration' objects. +func NewExternalConfigurationList() *ExternalConfigurationListBuilder { + return new(ExternalConfigurationListBuilder) +} + +// Items sets the items of the list. +func (b *ExternalConfigurationListBuilder) Items(values ...*ExternalConfigurationBuilder) *ExternalConfigurationListBuilder { + b.items = make([]*ExternalConfigurationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ExternalConfigurationListBuilder) 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 *ExternalConfigurationListBuilder) Copy(list *ExternalConfigurationList) *ExternalConfigurationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ExternalConfigurationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewExternalConfiguration().Copy(v) + } + } + return b +} + +// Build creates a list of 'external_configuration' objects using the +// configuration stored in the builder. +func (b *ExternalConfigurationListBuilder) Build() (list *ExternalConfigurationList, err error) { + items := make([]*ExternalConfiguration, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ExternalConfigurationList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/external_configuration_list_type_json.go b/clientapi/clustersmgmt/v1/external_configuration_list_type_json.go new file mode 100644 index 00000000..c68bc8e1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_configuration_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExternalConfigurationList writes a list of values of the 'external_configuration' type to +// the given writer. +func MarshalExternalConfigurationList(list []*ExternalConfiguration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalConfigurationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalConfigurationList writes a list of value of the 'external_configuration' type to +// the given stream. +func WriteExternalConfigurationList(list []*ExternalConfiguration, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteExternalConfiguration(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalExternalConfigurationList reads a list of values of the 'external_configuration' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalExternalConfigurationList(source interface{}) (items []*ExternalConfiguration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadExternalConfigurationList(iterator) + err = iterator.Error + return +} + +// ReadExternalConfigurationList reads list of values of the ”external_configuration' type from +// the given iterator. +func ReadExternalConfigurationList(iterator *jsoniter.Iterator) []*ExternalConfiguration { + list := []*ExternalConfiguration{} + for iterator.ReadArray() { + item := ReadExternalConfiguration(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/external_configuration_type.go b/clientapi/clustersmgmt/v1/external_configuration_type.go new file mode 100644 index 00000000..dd8cec5b --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_configuration_type.go @@ -0,0 +1,213 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ExternalConfiguration represents the values of the 'external_configuration' type. +// +// Representation of cluster external configuration. +type ExternalConfiguration struct { + bitmap_ uint32 + labels *LabelList + manifests *ManifestList + syncsets *SyncsetList +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ExternalConfiguration) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Labels returns the value of the 'labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// list of labels externally configured on the clusterdeployment. +func (o *ExternalConfiguration) Labels() *LabelList { + if o != nil && o.bitmap_&1 != 0 { + return o.labels + } + return nil +} + +// GetLabels returns the value of the 'labels' attribute and +// a flag indicating if the attribute has a value. +// +// list of labels externally configured on the clusterdeployment. +func (o *ExternalConfiguration) GetLabels() (value *LabelList, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.labels + } + return +} + +// Manifests returns the value of the 'manifests' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// list of manifest externally configured for a hosted cluster. +func (o *ExternalConfiguration) Manifests() *ManifestList { + if o != nil && o.bitmap_&2 != 0 { + return o.manifests + } + return nil +} + +// GetManifests returns the value of the 'manifests' attribute and +// a flag indicating if the attribute has a value. +// +// list of manifest externally configured for a hosted cluster. +func (o *ExternalConfiguration) GetManifests() (value *ManifestList, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.manifests + } + return +} + +// Syncsets returns the value of the 'syncsets' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// list of syncsets externally configured on the cluster. +func (o *ExternalConfiguration) Syncsets() *SyncsetList { + if o != nil && o.bitmap_&4 != 0 { + return o.syncsets + } + return nil +} + +// GetSyncsets returns the value of the 'syncsets' attribute and +// a flag indicating if the attribute has a value. +// +// list of syncsets externally configured on the cluster. +func (o *ExternalConfiguration) GetSyncsets() (value *SyncsetList, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.syncsets + } + return +} + +// ExternalConfigurationListKind is the name of the type used to represent list of objects of +// type 'external_configuration'. +const ExternalConfigurationListKind = "ExternalConfigurationList" + +// ExternalConfigurationListLinkKind is the name of the type used to represent links to list +// of objects of type 'external_configuration'. +const ExternalConfigurationListLinkKind = "ExternalConfigurationListLink" + +// ExternalConfigurationNilKind is the name of the type used to nil lists of objects of +// type 'external_configuration'. +const ExternalConfigurationListNilKind = "ExternalConfigurationListNil" + +// ExternalConfigurationList is a list of values of the 'external_configuration' type. +type ExternalConfigurationList struct { + href string + link bool + items []*ExternalConfiguration +} + +// Len returns the length of the list. +func (l *ExternalConfigurationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ExternalConfigurationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ExternalConfigurationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ExternalConfigurationList) SetItems(items []*ExternalConfiguration) { + l.items = items +} + +// Items returns the items of the list. +func (l *ExternalConfigurationList) Items() []*ExternalConfiguration { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ExternalConfigurationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ExternalConfigurationList) Get(i int) *ExternalConfiguration { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ExternalConfigurationList) Slice() []*ExternalConfiguration { + var slice []*ExternalConfiguration + if l == nil { + slice = make([]*ExternalConfiguration, 0) + } else { + slice = make([]*ExternalConfiguration, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ExternalConfigurationList) Each(f func(item *ExternalConfiguration) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ExternalConfigurationList) Range(f func(index int, item *ExternalConfiguration) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/external_configuration_type_json.go b/clientapi/clustersmgmt/v1/external_configuration_type_json.go new file mode 100644 index 00000000..055d57cc --- /dev/null +++ b/clientapi/clustersmgmt/v1/external_configuration_type_json.go @@ -0,0 +1,172 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalExternalConfiguration writes a value of the 'external_configuration' type to the given writer. +func MarshalExternalConfiguration(object *ExternalConfiguration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteExternalConfiguration(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteExternalConfiguration writes a value of the 'external_configuration' type to the given stream. +func WriteExternalConfiguration(object *ExternalConfiguration, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.labels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("labels") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteLabelList(object.labels.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&2 != 0 && object.manifests != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("manifests") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteManifestList(object.manifests.Items(), stream) + stream.WriteObjectEnd() + count++ + } + present_ = object.bitmap_&4 != 0 && object.syncsets != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("syncsets") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteSyncsetList(object.syncsets.Items(), stream) + stream.WriteObjectEnd() + } + stream.WriteObjectEnd() +} + +// UnmarshalExternalConfiguration reads a value of the 'external_configuration' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalExternalConfiguration(source interface{}) (object *ExternalConfiguration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadExternalConfiguration(iterator) + err = iterator.Error + return +} + +// ReadExternalConfiguration reads a value of the 'external_configuration' type from the given iterator. +func ReadExternalConfiguration(iterator *jsoniter.Iterator) *ExternalConfiguration { + object := &ExternalConfiguration{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "labels": + value := &LabelList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == LabelListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadLabelList(iterator)) + default: + iterator.ReadAny() + } + } + object.labels = value + object.bitmap_ |= 1 + case "manifests": + value := &ManifestList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == ManifestListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadManifestList(iterator)) + default: + iterator.ReadAny() + } + } + object.manifests = value + object.bitmap_ |= 2 + case "syncsets": + value := &SyncsetList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == SyncsetListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadSyncsetList(iterator)) + default: + iterator.ReadAny() + } + } + object.syncsets = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/flavour_builder.go b/clientapi/clustersmgmt/v1/flavour_builder.go new file mode 100644 index 00000000..cd3c7c21 --- /dev/null +++ b/clientapi/clustersmgmt/v1/flavour_builder.go @@ -0,0 +1,190 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// FlavourBuilder contains the data and logic needed to build 'flavour' objects. +// +// Set of predefined properties of a cluster. For example, a _huge_ flavour can be a cluster +// with 10 infra nodes and 1000 compute nodes. +type FlavourBuilder struct { + bitmap_ uint32 + id string + href string + aws *AWSFlavourBuilder + gcp *GCPFlavourBuilder + name string + network *NetworkBuilder + nodes *FlavourNodesBuilder +} + +// NewFlavour creates a new builder of 'flavour' objects. +func NewFlavour() *FlavourBuilder { + return &FlavourBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *FlavourBuilder) Link(value bool) *FlavourBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *FlavourBuilder) ID(value string) *FlavourBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *FlavourBuilder) HREF(value string) *FlavourBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *FlavourBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AWS sets the value of the 'AWS' attribute to the given value. +// +// Specification for different classes of nodes inside a flavour. +func (b *FlavourBuilder) AWS(value *AWSFlavourBuilder) *FlavourBuilder { + b.aws = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// GCP sets the value of the 'GCP' attribute to the given value. +// +// Specification for different classes of nodes inside a flavour. +func (b *FlavourBuilder) GCP(value *GCPFlavourBuilder) *FlavourBuilder { + b.gcp = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *FlavourBuilder) Name(value string) *FlavourBuilder { + b.name = value + b.bitmap_ |= 32 + return b +} + +// Network sets the value of the 'network' attribute to the given value. +// +// Network configuration of a cluster. +func (b *FlavourBuilder) Network(value *NetworkBuilder) *FlavourBuilder { + b.network = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Nodes sets the value of the 'nodes' attribute to the given value. +// +// Counts of different classes of nodes inside a flavour. +func (b *FlavourBuilder) Nodes(value *FlavourNodesBuilder) *FlavourBuilder { + b.nodes = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *FlavourBuilder) Copy(object *Flavour) *FlavourBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.aws != nil { + b.aws = NewAWSFlavour().Copy(object.aws) + } else { + b.aws = nil + } + if object.gcp != nil { + b.gcp = NewGCPFlavour().Copy(object.gcp) + } else { + b.gcp = nil + } + b.name = object.name + if object.network != nil { + b.network = NewNetwork().Copy(object.network) + } else { + b.network = nil + } + if object.nodes != nil { + b.nodes = NewFlavourNodes().Copy(object.nodes) + } else { + b.nodes = nil + } + return b +} + +// Build creates a 'flavour' object using the configuration stored in the builder. +func (b *FlavourBuilder) Build() (object *Flavour, err error) { + object = new(Flavour) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.aws != nil { + object.aws, err = b.aws.Build() + if err != nil { + return + } + } + if b.gcp != nil { + object.gcp, err = b.gcp.Build() + if err != nil { + return + } + } + object.name = b.name + if b.network != nil { + object.network, err = b.network.Build() + if err != nil { + return + } + } + if b.nodes != nil { + object.nodes, err = b.nodes.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/flavour_list_builder.go b/clientapi/clustersmgmt/v1/flavour_list_builder.go new file mode 100644 index 00000000..ab8430b6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/flavour_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// FlavourListBuilder contains the data and logic needed to build +// 'flavour' objects. +type FlavourListBuilder struct { + items []*FlavourBuilder +} + +// NewFlavourList creates a new builder of 'flavour' objects. +func NewFlavourList() *FlavourListBuilder { + return new(FlavourListBuilder) +} + +// Items sets the items of the list. +func (b *FlavourListBuilder) Items(values ...*FlavourBuilder) *FlavourListBuilder { + b.items = make([]*FlavourBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *FlavourListBuilder) 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 *FlavourListBuilder) Copy(list *FlavourList) *FlavourListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*FlavourBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewFlavour().Copy(v) + } + } + return b +} + +// Build creates a list of 'flavour' objects using the +// configuration stored in the builder. +func (b *FlavourListBuilder) Build() (list *FlavourList, err error) { + items := make([]*Flavour, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(FlavourList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/flavour_list_type_json.go b/clientapi/clustersmgmt/v1/flavour_list_type_json.go new file mode 100644 index 00000000..acf8fed2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/flavour_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFlavourList writes a list of values of the 'flavour' type to +// the given writer. +func MarshalFlavourList(list []*Flavour, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFlavourList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFlavourList writes a list of value of the 'flavour' type to +// the given stream. +func WriteFlavourList(list []*Flavour, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteFlavour(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalFlavourList reads a list of values of the 'flavour' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFlavourList(source interface{}) (items []*Flavour, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFlavourList(iterator) + err = iterator.Error + return +} + +// ReadFlavourList reads list of values of the ”flavour' type from +// the given iterator. +func ReadFlavourList(iterator *jsoniter.Iterator) []*Flavour { + list := []*Flavour{} + for iterator.ReadArray() { + item := ReadFlavour(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/flavour_nodes_builder.go b/clientapi/clustersmgmt/v1/flavour_nodes_builder.go new file mode 100644 index 00000000..8f81761a --- /dev/null +++ b/clientapi/clustersmgmt/v1/flavour_nodes_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// FlavourNodesBuilder contains the data and logic needed to build 'flavour_nodes' objects. +// +// Counts of different classes of nodes inside a flavour. +type FlavourNodesBuilder struct { + bitmap_ uint32 + master int +} + +// NewFlavourNodes creates a new builder of 'flavour_nodes' objects. +func NewFlavourNodes() *FlavourNodesBuilder { + return &FlavourNodesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *FlavourNodesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Master sets the value of the 'master' attribute to the given value. +func (b *FlavourNodesBuilder) Master(value int) *FlavourNodesBuilder { + b.master = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *FlavourNodesBuilder) Copy(object *FlavourNodes) *FlavourNodesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.master = object.master + return b +} + +// Build creates a 'flavour_nodes' object using the configuration stored in the builder. +func (b *FlavourNodesBuilder) Build() (object *FlavourNodes, err error) { + object = new(FlavourNodes) + object.bitmap_ = b.bitmap_ + object.master = b.master + return +} diff --git a/clientapi/clustersmgmt/v1/flavour_nodes_list_builder.go b/clientapi/clustersmgmt/v1/flavour_nodes_list_builder.go new file mode 100644 index 00000000..841bf8c8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/flavour_nodes_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// FlavourNodesListBuilder contains the data and logic needed to build +// 'flavour_nodes' objects. +type FlavourNodesListBuilder struct { + items []*FlavourNodesBuilder +} + +// NewFlavourNodesList creates a new builder of 'flavour_nodes' objects. +func NewFlavourNodesList() *FlavourNodesListBuilder { + return new(FlavourNodesListBuilder) +} + +// Items sets the items of the list. +func (b *FlavourNodesListBuilder) Items(values ...*FlavourNodesBuilder) *FlavourNodesListBuilder { + b.items = make([]*FlavourNodesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *FlavourNodesListBuilder) 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 *FlavourNodesListBuilder) Copy(list *FlavourNodesList) *FlavourNodesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*FlavourNodesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewFlavourNodes().Copy(v) + } + } + return b +} + +// Build creates a list of 'flavour_nodes' objects using the +// configuration stored in the builder. +func (b *FlavourNodesListBuilder) Build() (list *FlavourNodesList, err error) { + items := make([]*FlavourNodes, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(FlavourNodesList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/flavour_nodes_list_type_json.go b/clientapi/clustersmgmt/v1/flavour_nodes_list_type_json.go new file mode 100644 index 00000000..8a40309d --- /dev/null +++ b/clientapi/clustersmgmt/v1/flavour_nodes_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFlavourNodesList writes a list of values of the 'flavour_nodes' type to +// the given writer. +func MarshalFlavourNodesList(list []*FlavourNodes, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFlavourNodesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFlavourNodesList writes a list of value of the 'flavour_nodes' type to +// the given stream. +func WriteFlavourNodesList(list []*FlavourNodes, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteFlavourNodes(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalFlavourNodesList reads a list of values of the 'flavour_nodes' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFlavourNodesList(source interface{}) (items []*FlavourNodes, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFlavourNodesList(iterator) + err = iterator.Error + return +} + +// ReadFlavourNodesList reads list of values of the ”flavour_nodes' type from +// the given iterator. +func ReadFlavourNodesList(iterator *jsoniter.Iterator) []*FlavourNodes { + list := []*FlavourNodes{} + for iterator.ReadArray() { + item := ReadFlavourNodes(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/flavour_nodes_type.go b/clientapi/clustersmgmt/v1/flavour_nodes_type.go new file mode 100644 index 00000000..a64d3128 --- /dev/null +++ b/clientapi/clustersmgmt/v1/flavour_nodes_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// FlavourNodes represents the values of the 'flavour_nodes' type. +// +// Counts of different classes of nodes inside a flavour. +type FlavourNodes struct { + bitmap_ uint32 + master int +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *FlavourNodes) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Master returns the value of the 'master' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Number of master nodes of the cluster. +func (o *FlavourNodes) Master() int { + if o != nil && o.bitmap_&1 != 0 { + return o.master + } + return 0 +} + +// GetMaster returns the value of the 'master' attribute and +// a flag indicating if the attribute has a value. +// +// Number of master nodes of the cluster. +func (o *FlavourNodes) GetMaster() (value int, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.master + } + return +} + +// FlavourNodesListKind is the name of the type used to represent list of objects of +// type 'flavour_nodes'. +const FlavourNodesListKind = "FlavourNodesList" + +// FlavourNodesListLinkKind is the name of the type used to represent links to list +// of objects of type 'flavour_nodes'. +const FlavourNodesListLinkKind = "FlavourNodesListLink" + +// FlavourNodesNilKind is the name of the type used to nil lists of objects of +// type 'flavour_nodes'. +const FlavourNodesListNilKind = "FlavourNodesListNil" + +// FlavourNodesList is a list of values of the 'flavour_nodes' type. +type FlavourNodesList struct { + href string + link bool + items []*FlavourNodes +} + +// Len returns the length of the list. +func (l *FlavourNodesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *FlavourNodesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *FlavourNodesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *FlavourNodesList) SetItems(items []*FlavourNodes) { + l.items = items +} + +// Items returns the items of the list. +func (l *FlavourNodesList) Items() []*FlavourNodes { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *FlavourNodesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *FlavourNodesList) Get(i int) *FlavourNodes { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *FlavourNodesList) Slice() []*FlavourNodes { + var slice []*FlavourNodes + if l == nil { + slice = make([]*FlavourNodes, 0) + } else { + slice = make([]*FlavourNodes, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *FlavourNodesList) Each(f func(item *FlavourNodes) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *FlavourNodesList) Range(f func(index int, item *FlavourNodes) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/flavour_nodes_type_json.go b/clientapi/clustersmgmt/v1/flavour_nodes_type_json.go new file mode 100644 index 00000000..6cb331d2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/flavour_nodes_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFlavourNodes writes a value of the 'flavour_nodes' type to the given writer. +func MarshalFlavourNodes(object *FlavourNodes, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFlavourNodes(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFlavourNodes writes a value of the 'flavour_nodes' type to the given stream. +func WriteFlavourNodes(object *FlavourNodes, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("master") + stream.WriteInt(object.master) + } + stream.WriteObjectEnd() +} + +// UnmarshalFlavourNodes reads a value of the 'flavour_nodes' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalFlavourNodes(source interface{}) (object *FlavourNodes, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadFlavourNodes(iterator) + err = iterator.Error + return +} + +// ReadFlavourNodes reads a value of the 'flavour_nodes' type from the given iterator. +func ReadFlavourNodes(iterator *jsoniter.Iterator) *FlavourNodes { + object := &FlavourNodes{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "master": + value := iterator.ReadInt() + object.master = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/flavour_type.go b/clientapi/clustersmgmt/v1/flavour_type.go new file mode 100644 index 00000000..c06066b3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/flavour_type.go @@ -0,0 +1,378 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// FlavourKind is the name of the type used to represent objects +// of type 'flavour'. +const FlavourKind = "Flavour" + +// FlavourLinkKind is the name of the type used to represent links +// to objects of type 'flavour'. +const FlavourLinkKind = "FlavourLink" + +// FlavourNilKind is the name of the type used to nil references +// to objects of type 'flavour'. +const FlavourNilKind = "FlavourNil" + +// Flavour represents the values of the 'flavour' type. +// +// Set of predefined properties of a cluster. For example, a _huge_ flavour can be a cluster +// with 10 infra nodes and 1000 compute nodes. +type Flavour struct { + bitmap_ uint32 + id string + href string + aws *AWSFlavour + gcp *GCPFlavour + name string + network *Network + nodes *FlavourNodes +} + +// Kind returns the name of the type of the object. +func (o *Flavour) Kind() string { + if o == nil { + return FlavourNilKind + } + if o.bitmap_&1 != 0 { + return FlavourLinkKind + } + return FlavourKind +} + +// Link returns true if this is a link. +func (o *Flavour) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Flavour) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Flavour) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Flavour) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Flavour) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Flavour) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AWS returns the value of the 'AWS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Default _Amazon Web Services_ settings of the cluster. +func (o *Flavour) AWS() *AWSFlavour { + if o != nil && o.bitmap_&8 != 0 { + return o.aws + } + return nil +} + +// GetAWS returns the value of the 'AWS' attribute and +// a flag indicating if the attribute has a value. +// +// Default _Amazon Web Services_ settings of the cluster. +func (o *Flavour) GetAWS() (value *AWSFlavour, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.aws + } + return +} + +// GCP returns the value of the 'GCP' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Default _Google Cloud Platform_ settings of the cluster. +func (o *Flavour) GCP() *GCPFlavour { + if o != nil && o.bitmap_&16 != 0 { + return o.gcp + } + return nil +} + +// GetGCP returns the value of the 'GCP' attribute and +// a flag indicating if the attribute has a value. +// +// Default _Google Cloud Platform_ settings of the cluster. +func (o *Flavour) GetGCP() (value *GCPFlavour, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.gcp + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Human friendly identifier of the cluster, for example `4`. +// +// NOTE: Currently for all flavours the `id` and `name` attributes have exactly the +// same values. +func (o *Flavour) Name() string { + if o != nil && o.bitmap_&32 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Human friendly identifier of the cluster, for example `4`. +// +// NOTE: Currently for all flavours the `id` and `name` attributes have exactly the +// same values. +func (o *Flavour) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.name + } + return +} + +// Network returns the value of the 'network' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Default network settings of the cluster. +// +// These can be overridden specifying in the cluster itself a different set of settings. +func (o *Flavour) Network() *Network { + if o != nil && o.bitmap_&64 != 0 { + return o.network + } + return nil +} + +// GetNetwork returns the value of the 'network' attribute and +// a flag indicating if the attribute has a value. +// +// Default network settings of the cluster. +// +// These can be overridden specifying in the cluster itself a different set of settings. +func (o *Flavour) GetNetwork() (value *Network, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.network + } + return +} + +// Nodes returns the value of the 'nodes' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Number of nodes that will be used by default when creating a cluster that uses +// this flavour. +// +// These can be overridden specifying in the cluster itself a different number of nodes. +func (o *Flavour) Nodes() *FlavourNodes { + if o != nil && o.bitmap_&128 != 0 { + return o.nodes + } + return nil +} + +// GetNodes returns the value of the 'nodes' attribute and +// a flag indicating if the attribute has a value. +// +// Number of nodes that will be used by default when creating a cluster that uses +// this flavour. +// +// These can be overridden specifying in the cluster itself a different number of nodes. +func (o *Flavour) GetNodes() (value *FlavourNodes, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.nodes + } + return +} + +// FlavourListKind is the name of the type used to represent list of objects of +// type 'flavour'. +const FlavourListKind = "FlavourList" + +// FlavourListLinkKind is the name of the type used to represent links to list +// of objects of type 'flavour'. +const FlavourListLinkKind = "FlavourListLink" + +// FlavourNilKind is the name of the type used to nil lists of objects of +// type 'flavour'. +const FlavourListNilKind = "FlavourListNil" + +// FlavourList is a list of values of the 'flavour' type. +type FlavourList struct { + href string + link bool + items []*Flavour +} + +// Kind returns the name of the type of the object. +func (l *FlavourList) Kind() string { + if l == nil { + return FlavourListNilKind + } + if l.link { + return FlavourListLinkKind + } + return FlavourListKind +} + +// Link returns true iif this is a link. +func (l *FlavourList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *FlavourList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *FlavourList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *FlavourList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *FlavourList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *FlavourList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *FlavourList) SetItems(items []*Flavour) { + l.items = items +} + +// Items returns the items of the list. +func (l *FlavourList) Items() []*Flavour { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *FlavourList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *FlavourList) Get(i int) *Flavour { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *FlavourList) Slice() []*Flavour { + var slice []*Flavour + if l == nil { + slice = make([]*Flavour, 0) + } else { + slice = make([]*Flavour, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *FlavourList) Each(f func(item *Flavour) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *FlavourList) Range(f func(index int, item *Flavour) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/flavour_type_json.go b/clientapi/clustersmgmt/v1/flavour_type_json.go new file mode 100644 index 00000000..fac37b55 --- /dev/null +++ b/clientapi/clustersmgmt/v1/flavour_type_json.go @@ -0,0 +1,172 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFlavour writes a value of the 'flavour' type to the given writer. +func MarshalFlavour(object *Flavour, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFlavour(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFlavour writes a value of the 'flavour' type to the given stream. +func WriteFlavour(object *Flavour, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(FlavourLinkKind) + } else { + stream.WriteString(FlavourKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.aws != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws") + WriteAWSFlavour(object.aws, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.gcp != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp") + WriteGCPFlavour(object.gcp, stream) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&64 != 0 && object.network != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("network") + WriteNetwork(object.network, stream) + count++ + } + present_ = object.bitmap_&128 != 0 && object.nodes != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("nodes") + WriteFlavourNodes(object.nodes, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalFlavour reads a value of the 'flavour' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalFlavour(source interface{}) (object *Flavour, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadFlavour(iterator) + err = iterator.Error + return +} + +// ReadFlavour reads a value of the 'flavour' type from the given iterator. +func ReadFlavour(iterator *jsoniter.Iterator) *Flavour { + object := &Flavour{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == FlavourLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "aws": + value := ReadAWSFlavour(iterator) + object.aws = value + object.bitmap_ |= 8 + case "gcp": + value := ReadGCPFlavour(iterator) + object.gcp = value + object.bitmap_ |= 16 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 32 + case "network": + value := ReadNetwork(iterator) + object.network = value + object.bitmap_ |= 64 + case "nodes": + value := ReadFlavourNodes(iterator) + object.nodes = value + object.bitmap_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/float_list_type_json.go b/clientapi/clustersmgmt/v1/float_list_type_json.go new file mode 100644 index 00000000..da68664c --- /dev/null +++ b/clientapi/clustersmgmt/v1/float_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFloatList writes a list of values of the 'float' type to +// the given writer. +func MarshalFloatList(list []float64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFloatList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFloatList writes a list of value of the 'float' type to +// the given stream. +func WriteFloatList(list []float64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteFloat64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalFloatList reads a list of values of the 'float' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFloatList(source interface{}) (items []float64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFloatList(iterator) + err = iterator.Error + return +} + +// ReadFloatList reads list of values of the ”float' type from +// the given iterator. +func ReadFloatList(iterator *jsoniter.Iterator) []float64 { + list := []float64{} + for iterator.ReadArray() { + item := iterator.ReadFloat64() + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/gcp_authentication_builder.go b/clientapi/clustersmgmt/v1/gcp_authentication_builder.go new file mode 100644 index 00000000..ef7eb2c6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_authentication_builder.go @@ -0,0 +1,83 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GcpAuthenticationBuilder contains the data and logic needed to build 'gcp_authentication' objects. +// +// Google cloud platform authentication method of a cluster. +type GcpAuthenticationBuilder struct { + bitmap_ uint32 + href string + id string + kind string +} + +// NewGcpAuthentication creates a new builder of 'gcp_authentication' objects. +func NewGcpAuthentication() *GcpAuthenticationBuilder { + return &GcpAuthenticationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GcpAuthenticationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Href sets the value of the 'href' attribute to the given value. +func (b *GcpAuthenticationBuilder) Href(value string) *GcpAuthenticationBuilder { + b.href = value + b.bitmap_ |= 1 + return b +} + +// Id sets the value of the 'id' attribute to the given value. +func (b *GcpAuthenticationBuilder) Id(value string) *GcpAuthenticationBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// Kind sets the value of the 'kind' attribute to the given value. +func (b *GcpAuthenticationBuilder) Kind(value string) *GcpAuthenticationBuilder { + b.kind = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GcpAuthenticationBuilder) Copy(object *GcpAuthentication) *GcpAuthenticationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.href = object.href + b.id = object.id + b.kind = object.kind + return b +} + +// Build creates a 'gcp_authentication' object using the configuration stored in the builder. +func (b *GcpAuthenticationBuilder) Build() (object *GcpAuthentication, err error) { + object = new(GcpAuthentication) + object.bitmap_ = b.bitmap_ + object.href = b.href + object.id = b.id + object.kind = b.kind + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_authentication_list_builder.go b/clientapi/clustersmgmt/v1/gcp_authentication_list_builder.go new file mode 100644 index 00000000..fcf937e2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_authentication_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GcpAuthenticationListBuilder contains the data and logic needed to build +// 'gcp_authentication' objects. +type GcpAuthenticationListBuilder struct { + items []*GcpAuthenticationBuilder +} + +// NewGcpAuthenticationList creates a new builder of 'gcp_authentication' objects. +func NewGcpAuthenticationList() *GcpAuthenticationListBuilder { + return new(GcpAuthenticationListBuilder) +} + +// Items sets the items of the list. +func (b *GcpAuthenticationListBuilder) Items(values ...*GcpAuthenticationBuilder) *GcpAuthenticationListBuilder { + b.items = make([]*GcpAuthenticationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GcpAuthenticationListBuilder) 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 *GcpAuthenticationListBuilder) Copy(list *GcpAuthenticationList) *GcpAuthenticationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GcpAuthenticationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGcpAuthentication().Copy(v) + } + } + return b +} + +// Build creates a list of 'gcp_authentication' objects using the +// configuration stored in the builder. +func (b *GcpAuthenticationListBuilder) Build() (list *GcpAuthenticationList, err error) { + items := make([]*GcpAuthentication, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GcpAuthenticationList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_authentication_list_type_json.go b/clientapi/clustersmgmt/v1/gcp_authentication_list_type_json.go new file mode 100644 index 00000000..761102e0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_authentication_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGcpAuthenticationList writes a list of values of the 'gcp_authentication' type to +// the given writer. +func MarshalGcpAuthenticationList(list []*GcpAuthentication, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGcpAuthenticationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGcpAuthenticationList writes a list of value of the 'gcp_authentication' type to +// the given stream. +func WriteGcpAuthenticationList(list []*GcpAuthentication, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGcpAuthentication(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGcpAuthenticationList reads a list of values of the 'gcp_authentication' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGcpAuthenticationList(source interface{}) (items []*GcpAuthentication, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGcpAuthenticationList(iterator) + err = iterator.Error + return +} + +// ReadGcpAuthenticationList reads list of values of the ”gcp_authentication' type from +// the given iterator. +func ReadGcpAuthenticationList(iterator *jsoniter.Iterator) []*GcpAuthentication { + list := []*GcpAuthentication{} + for iterator.ReadArray() { + item := ReadGcpAuthentication(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/gcp_authentication_type.go b/clientapi/clustersmgmt/v1/gcp_authentication_type.go new file mode 100644 index 00000000..7a80f9a5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_authentication_type.go @@ -0,0 +1,213 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GcpAuthentication represents the values of the 'gcp_authentication' type. +// +// Google cloud platform authentication method of a cluster. +type GcpAuthentication struct { + bitmap_ uint32 + href string + id string + kind string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GcpAuthentication) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Href returns the value of the 'href' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Self link +func (o *GcpAuthentication) Href() string { + if o != nil && o.bitmap_&1 != 0 { + return o.href + } + return "" +} + +// GetHref returns the value of the 'href' attribute and +// a flag indicating if the attribute has a value. +// +// Self link +func (o *GcpAuthentication) GetHref() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.href + } + return +} + +// Id returns the value of the 'id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Unique identifier of the object +func (o *GcpAuthentication) Id() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetId returns the value of the 'id' attribute and +// a flag indicating if the attribute has a value. +// +// Unique identifier of the object +func (o *GcpAuthentication) GetId() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// Kind returns the value of the 'kind' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the type of this object +func (o *GcpAuthentication) Kind() string { + if o != nil && o.bitmap_&4 != 0 { + return o.kind + } + return "" +} + +// GetKind returns the value of the 'kind' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the type of this object +func (o *GcpAuthentication) GetKind() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.kind + } + return +} + +// GcpAuthenticationListKind is the name of the type used to represent list of objects of +// type 'gcp_authentication'. +const GcpAuthenticationListKind = "GcpAuthenticationList" + +// GcpAuthenticationListLinkKind is the name of the type used to represent links to list +// of objects of type 'gcp_authentication'. +const GcpAuthenticationListLinkKind = "GcpAuthenticationListLink" + +// GcpAuthenticationNilKind is the name of the type used to nil lists of objects of +// type 'gcp_authentication'. +const GcpAuthenticationListNilKind = "GcpAuthenticationListNil" + +// GcpAuthenticationList is a list of values of the 'gcp_authentication' type. +type GcpAuthenticationList struct { + href string + link bool + items []*GcpAuthentication +} + +// Len returns the length of the list. +func (l *GcpAuthenticationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GcpAuthenticationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GcpAuthenticationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GcpAuthenticationList) SetItems(items []*GcpAuthentication) { + l.items = items +} + +// Items returns the items of the list. +func (l *GcpAuthenticationList) Items() []*GcpAuthentication { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GcpAuthenticationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GcpAuthenticationList) Get(i int) *GcpAuthentication { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GcpAuthenticationList) Slice() []*GcpAuthentication { + var slice []*GcpAuthentication + if l == nil { + slice = make([]*GcpAuthentication, 0) + } else { + slice = make([]*GcpAuthentication, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GcpAuthenticationList) Each(f func(item *GcpAuthentication) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GcpAuthenticationList) Range(f func(index int, item *GcpAuthentication) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/gcp_authentication_type_json.go b/clientapi/clustersmgmt/v1/gcp_authentication_type_json.go new file mode 100644 index 00000000..da1277a5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_authentication_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGcpAuthentication writes a value of the 'gcp_authentication' type to the given writer. +func MarshalGcpAuthentication(object *GcpAuthentication, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGcpAuthentication(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGcpAuthentication writes a value of the 'gcp_authentication' type to the given stream. +func WriteGcpAuthentication(object *GcpAuthentication, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kind") + stream.WriteString(object.kind) + } + stream.WriteObjectEnd() +} + +// UnmarshalGcpAuthentication reads a value of the 'gcp_authentication' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGcpAuthentication(source interface{}) (object *GcpAuthentication, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGcpAuthentication(iterator) + err = iterator.Error + return +} + +// ReadGcpAuthentication reads a value of the 'gcp_authentication' type from the given iterator. +func ReadGcpAuthentication(iterator *jsoniter.Iterator) *GcpAuthentication { + object := &GcpAuthentication{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 1 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 2 + case "kind": + value := iterator.ReadString() + object.kind = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/gcp_builder.go b/clientapi/clustersmgmt/v1/gcp_builder.go new file mode 100644 index 00000000..32c95f7b --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_builder.go @@ -0,0 +1,228 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPBuilder contains the data and logic needed to build 'GCP' objects. +// +// Google cloud platform settings of a cluster. +type GCPBuilder struct { + bitmap_ uint32 + authURI string + authProviderX509CertURL string + authentication *GcpAuthenticationBuilder + clientID string + clientX509CertURL string + clientEmail string + privateKey string + privateKeyID string + privateServiceConnect *GcpPrivateServiceConnectBuilder + projectID string + security *GcpSecurityBuilder + tokenURI string + type_ string +} + +// NewGCP creates a new builder of 'GCP' objects. +func NewGCP() *GCPBuilder { + return &GCPBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GCPBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AuthURI sets the value of the 'auth_URI' attribute to the given value. +func (b *GCPBuilder) AuthURI(value string) *GCPBuilder { + b.authURI = value + b.bitmap_ |= 1 + return b +} + +// AuthProviderX509CertURL sets the value of the 'auth_provider_X509_cert_URL' attribute to the given value. +func (b *GCPBuilder) AuthProviderX509CertURL(value string) *GCPBuilder { + b.authProviderX509CertURL = value + b.bitmap_ |= 2 + return b +} + +// Authentication sets the value of the 'authentication' attribute to the given value. +// +// Google cloud platform authentication method of a cluster. +func (b *GCPBuilder) Authentication(value *GcpAuthenticationBuilder) *GCPBuilder { + b.authentication = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// ClientID sets the value of the 'client_ID' attribute to the given value. +func (b *GCPBuilder) ClientID(value string) *GCPBuilder { + b.clientID = value + b.bitmap_ |= 8 + return b +} + +// ClientX509CertURL sets the value of the 'client_X509_cert_URL' attribute to the given value. +func (b *GCPBuilder) ClientX509CertURL(value string) *GCPBuilder { + b.clientX509CertURL = value + b.bitmap_ |= 16 + return b +} + +// ClientEmail sets the value of the 'client_email' attribute to the given value. +func (b *GCPBuilder) ClientEmail(value string) *GCPBuilder { + b.clientEmail = value + b.bitmap_ |= 32 + return b +} + +// PrivateKey sets the value of the 'private_key' attribute to the given value. +func (b *GCPBuilder) PrivateKey(value string) *GCPBuilder { + b.privateKey = value + b.bitmap_ |= 64 + return b +} + +// PrivateKeyID sets the value of the 'private_key_ID' attribute to the given value. +func (b *GCPBuilder) PrivateKeyID(value string) *GCPBuilder { + b.privateKeyID = value + b.bitmap_ |= 128 + return b +} + +// PrivateServiceConnect sets the value of the 'private_service_connect' attribute to the given value. +// +// Google cloud platform private service connect configuration of a cluster. +func (b *GCPBuilder) PrivateServiceConnect(value *GcpPrivateServiceConnectBuilder) *GCPBuilder { + b.privateServiceConnect = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// ProjectID sets the value of the 'project_ID' attribute to the given value. +func (b *GCPBuilder) ProjectID(value string) *GCPBuilder { + b.projectID = value + b.bitmap_ |= 512 + return b +} + +// Security sets the value of the 'security' attribute to the given value. +// +// Google cloud platform security settings of a cluster. +func (b *GCPBuilder) Security(value *GcpSecurityBuilder) *GCPBuilder { + b.security = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// TokenURI sets the value of the 'token_URI' attribute to the given value. +func (b *GCPBuilder) TokenURI(value string) *GCPBuilder { + b.tokenURI = value + b.bitmap_ |= 2048 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *GCPBuilder) Type(value string) *GCPBuilder { + b.type_ = value + b.bitmap_ |= 4096 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GCPBuilder) Copy(object *GCP) *GCPBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.authURI = object.authURI + b.authProviderX509CertURL = object.authProviderX509CertURL + if object.authentication != nil { + b.authentication = NewGcpAuthentication().Copy(object.authentication) + } else { + b.authentication = nil + } + b.clientID = object.clientID + b.clientX509CertURL = object.clientX509CertURL + b.clientEmail = object.clientEmail + b.privateKey = object.privateKey + b.privateKeyID = object.privateKeyID + if object.privateServiceConnect != nil { + b.privateServiceConnect = NewGcpPrivateServiceConnect().Copy(object.privateServiceConnect) + } else { + b.privateServiceConnect = nil + } + b.projectID = object.projectID + if object.security != nil { + b.security = NewGcpSecurity().Copy(object.security) + } else { + b.security = nil + } + b.tokenURI = object.tokenURI + b.type_ = object.type_ + return b +} + +// Build creates a 'GCP' object using the configuration stored in the builder. +func (b *GCPBuilder) Build() (object *GCP, err error) { + object = new(GCP) + object.bitmap_ = b.bitmap_ + object.authURI = b.authURI + object.authProviderX509CertURL = b.authProviderX509CertURL + if b.authentication != nil { + object.authentication, err = b.authentication.Build() + if err != nil { + return + } + } + object.clientID = b.clientID + object.clientX509CertURL = b.clientX509CertURL + object.clientEmail = b.clientEmail + object.privateKey = b.privateKey + object.privateKeyID = b.privateKeyID + if b.privateServiceConnect != nil { + object.privateServiceConnect, err = b.privateServiceConnect.Build() + if err != nil { + return + } + } + object.projectID = b.projectID + if b.security != nil { + object.security, err = b.security.Build() + if err != nil { + return + } + } + object.tokenURI = b.tokenURI + object.type_ = b.type_ + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_encryption_key_builder.go b/clientapi/clustersmgmt/v1/gcp_encryption_key_builder.go new file mode 100644 index 00000000..592b380c --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_encryption_key_builder.go @@ -0,0 +1,93 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPEncryptionKeyBuilder contains the data and logic needed to build 'GCP_encryption_key' objects. +// +// GCP Encryption Key for CCS clusters. +type GCPEncryptionKeyBuilder struct { + bitmap_ uint32 + kmsKeyServiceAccount string + keyLocation string + keyName string + keyRing string +} + +// NewGCPEncryptionKey creates a new builder of 'GCP_encryption_key' objects. +func NewGCPEncryptionKey() *GCPEncryptionKeyBuilder { + return &GCPEncryptionKeyBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GCPEncryptionKeyBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// KMSKeyServiceAccount sets the value of the 'KMS_key_service_account' attribute to the given value. +func (b *GCPEncryptionKeyBuilder) KMSKeyServiceAccount(value string) *GCPEncryptionKeyBuilder { + b.kmsKeyServiceAccount = value + b.bitmap_ |= 1 + return b +} + +// KeyLocation sets the value of the 'key_location' attribute to the given value. +func (b *GCPEncryptionKeyBuilder) KeyLocation(value string) *GCPEncryptionKeyBuilder { + b.keyLocation = value + b.bitmap_ |= 2 + return b +} + +// KeyName sets the value of the 'key_name' attribute to the given value. +func (b *GCPEncryptionKeyBuilder) KeyName(value string) *GCPEncryptionKeyBuilder { + b.keyName = value + b.bitmap_ |= 4 + return b +} + +// KeyRing sets the value of the 'key_ring' attribute to the given value. +func (b *GCPEncryptionKeyBuilder) KeyRing(value string) *GCPEncryptionKeyBuilder { + b.keyRing = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GCPEncryptionKeyBuilder) Copy(object *GCPEncryptionKey) *GCPEncryptionKeyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.kmsKeyServiceAccount = object.kmsKeyServiceAccount + b.keyLocation = object.keyLocation + b.keyName = object.keyName + b.keyRing = object.keyRing + return b +} + +// Build creates a 'GCP_encryption_key' object using the configuration stored in the builder. +func (b *GCPEncryptionKeyBuilder) Build() (object *GCPEncryptionKey, err error) { + object = new(GCPEncryptionKey) + object.bitmap_ = b.bitmap_ + object.kmsKeyServiceAccount = b.kmsKeyServiceAccount + object.keyLocation = b.keyLocation + object.keyName = b.keyName + object.keyRing = b.keyRing + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_encryption_key_list_builder.go b/clientapi/clustersmgmt/v1/gcp_encryption_key_list_builder.go new file mode 100644 index 00000000..2f17f872 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_encryption_key_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPEncryptionKeyListBuilder contains the data and logic needed to build +// 'GCP_encryption_key' objects. +type GCPEncryptionKeyListBuilder struct { + items []*GCPEncryptionKeyBuilder +} + +// NewGCPEncryptionKeyList creates a new builder of 'GCP_encryption_key' objects. +func NewGCPEncryptionKeyList() *GCPEncryptionKeyListBuilder { + return new(GCPEncryptionKeyListBuilder) +} + +// Items sets the items of the list. +func (b *GCPEncryptionKeyListBuilder) Items(values ...*GCPEncryptionKeyBuilder) *GCPEncryptionKeyListBuilder { + b.items = make([]*GCPEncryptionKeyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GCPEncryptionKeyListBuilder) 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 *GCPEncryptionKeyListBuilder) Copy(list *GCPEncryptionKeyList) *GCPEncryptionKeyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GCPEncryptionKeyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGCPEncryptionKey().Copy(v) + } + } + return b +} + +// Build creates a list of 'GCP_encryption_key' objects using the +// configuration stored in the builder. +func (b *GCPEncryptionKeyListBuilder) Build() (list *GCPEncryptionKeyList, err error) { + items := make([]*GCPEncryptionKey, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GCPEncryptionKeyList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_encryption_key_list_type_json.go b/clientapi/clustersmgmt/v1/gcp_encryption_key_list_type_json.go new file mode 100644 index 00000000..4864f09e --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_encryption_key_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPEncryptionKeyList writes a list of values of the 'GCP_encryption_key' type to +// the given writer. +func MarshalGCPEncryptionKeyList(list []*GCPEncryptionKey, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPEncryptionKeyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPEncryptionKeyList writes a list of value of the 'GCP_encryption_key' type to +// the given stream. +func WriteGCPEncryptionKeyList(list []*GCPEncryptionKey, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGCPEncryptionKey(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGCPEncryptionKeyList reads a list of values of the 'GCP_encryption_key' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGCPEncryptionKeyList(source interface{}) (items []*GCPEncryptionKey, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGCPEncryptionKeyList(iterator) + err = iterator.Error + return +} + +// ReadGCPEncryptionKeyList reads list of values of the ”GCP_encryption_key' type from +// the given iterator. +func ReadGCPEncryptionKeyList(iterator *jsoniter.Iterator) []*GCPEncryptionKey { + list := []*GCPEncryptionKey{} + for iterator.ReadArray() { + item := ReadGCPEncryptionKey(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/gcp_encryption_key_type.go b/clientapi/clustersmgmt/v1/gcp_encryption_key_type.go new file mode 100644 index 00000000..c78f687b --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_encryption_key_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPEncryptionKey represents the values of the 'GCP_encryption_key' type. +// +// GCP Encryption Key for CCS clusters. +type GCPEncryptionKey struct { + bitmap_ uint32 + kmsKeyServiceAccount string + keyLocation string + keyName string + keyRing string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GCPEncryptionKey) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// KMSKeyServiceAccount returns the value of the 'KMS_key_service_account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Service account used to access the KMS key +func (o *GCPEncryptionKey) KMSKeyServiceAccount() string { + if o != nil && o.bitmap_&1 != 0 { + return o.kmsKeyServiceAccount + } + return "" +} + +// GetKMSKeyServiceAccount returns the value of the 'KMS_key_service_account' attribute and +// a flag indicating if the attribute has a value. +// +// Service account used to access the KMS key +func (o *GCPEncryptionKey) GetKMSKeyServiceAccount() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.kmsKeyServiceAccount + } + return +} + +// KeyLocation returns the value of the 'key_location' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Location of the encryption key ring +func (o *GCPEncryptionKey) KeyLocation() string { + if o != nil && o.bitmap_&2 != 0 { + return o.keyLocation + } + return "" +} + +// GetKeyLocation returns the value of the 'key_location' attribute and +// a flag indicating if the attribute has a value. +// +// Location of the encryption key ring +func (o *GCPEncryptionKey) GetKeyLocation() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.keyLocation + } + return +} + +// KeyName returns the value of the 'key_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the encryption key +func (o *GCPEncryptionKey) KeyName() string { + if o != nil && o.bitmap_&4 != 0 { + return o.keyName + } + return "" +} + +// GetKeyName returns the value of the 'key_name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the encryption key +func (o *GCPEncryptionKey) GetKeyName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.keyName + } + return +} + +// KeyRing returns the value of the 'key_ring' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the key ring the encryption key is located on +func (o *GCPEncryptionKey) KeyRing() string { + if o != nil && o.bitmap_&8 != 0 { + return o.keyRing + } + return "" +} + +// GetKeyRing returns the value of the 'key_ring' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the key ring the encryption key is located on +func (o *GCPEncryptionKey) GetKeyRing() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.keyRing + } + return +} + +// GCPEncryptionKeyListKind is the name of the type used to represent list of objects of +// type 'GCP_encryption_key'. +const GCPEncryptionKeyListKind = "GCPEncryptionKeyList" + +// GCPEncryptionKeyListLinkKind is the name of the type used to represent links to list +// of objects of type 'GCP_encryption_key'. +const GCPEncryptionKeyListLinkKind = "GCPEncryptionKeyListLink" + +// GCPEncryptionKeyNilKind is the name of the type used to nil lists of objects of +// type 'GCP_encryption_key'. +const GCPEncryptionKeyListNilKind = "GCPEncryptionKeyListNil" + +// GCPEncryptionKeyList is a list of values of the 'GCP_encryption_key' type. +type GCPEncryptionKeyList struct { + href string + link bool + items []*GCPEncryptionKey +} + +// Len returns the length of the list. +func (l *GCPEncryptionKeyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GCPEncryptionKeyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GCPEncryptionKeyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GCPEncryptionKeyList) SetItems(items []*GCPEncryptionKey) { + l.items = items +} + +// Items returns the items of the list. +func (l *GCPEncryptionKeyList) Items() []*GCPEncryptionKey { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GCPEncryptionKeyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GCPEncryptionKeyList) Get(i int) *GCPEncryptionKey { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GCPEncryptionKeyList) Slice() []*GCPEncryptionKey { + var slice []*GCPEncryptionKey + if l == nil { + slice = make([]*GCPEncryptionKey, 0) + } else { + slice = make([]*GCPEncryptionKey, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GCPEncryptionKeyList) Each(f func(item *GCPEncryptionKey) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GCPEncryptionKeyList) Range(f func(index int, item *GCPEncryptionKey) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/gcp_encryption_key_type_json.go b/clientapi/clustersmgmt/v1/gcp_encryption_key_type_json.go new file mode 100644 index 00000000..1948d7bf --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_encryption_key_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPEncryptionKey writes a value of the 'GCP_encryption_key' type to the given writer. +func MarshalGCPEncryptionKey(object *GCPEncryptionKey, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPEncryptionKey(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPEncryptionKey writes a value of the 'GCP_encryption_key' type to the given stream. +func WriteGCPEncryptionKey(object *GCPEncryptionKey, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kms_key_service_account") + stream.WriteString(object.kmsKeyServiceAccount) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key_location") + stream.WriteString(object.keyLocation) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key_name") + stream.WriteString(object.keyName) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key_ring") + stream.WriteString(object.keyRing) + } + stream.WriteObjectEnd() +} + +// UnmarshalGCPEncryptionKey reads a value of the 'GCP_encryption_key' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGCPEncryptionKey(source interface{}) (object *GCPEncryptionKey, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGCPEncryptionKey(iterator) + err = iterator.Error + return +} + +// ReadGCPEncryptionKey reads a value of the 'GCP_encryption_key' type from the given iterator. +func ReadGCPEncryptionKey(iterator *jsoniter.Iterator) *GCPEncryptionKey { + object := &GCPEncryptionKey{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kms_key_service_account": + value := iterator.ReadString() + object.kmsKeyServiceAccount = value + object.bitmap_ |= 1 + case "key_location": + value := iterator.ReadString() + object.keyLocation = value + object.bitmap_ |= 2 + case "key_name": + value := iterator.ReadString() + object.keyName = value + object.bitmap_ |= 4 + case "key_ring": + value := iterator.ReadString() + object.keyRing = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/gcp_flavour_builder.go b/clientapi/clustersmgmt/v1/gcp_flavour_builder.go new file mode 100644 index 00000000..954829da --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_flavour_builder.go @@ -0,0 +1,158 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPFlavourBuilder contains the data and logic needed to build 'GCP_flavour' objects. +// +// Specification for different classes of nodes inside a flavour. +type GCPFlavourBuilder struct { + bitmap_ uint32 + computeInstanceType string + infraInstanceType string + infraVolume *GCPVolumeBuilder + masterInstanceType string + masterVolume *GCPVolumeBuilder + workerVolume *GCPVolumeBuilder +} + +// NewGCPFlavour creates a new builder of 'GCP_flavour' objects. +func NewGCPFlavour() *GCPFlavourBuilder { + return &GCPFlavourBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GCPFlavourBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ComputeInstanceType sets the value of the 'compute_instance_type' attribute to the given value. +func (b *GCPFlavourBuilder) ComputeInstanceType(value string) *GCPFlavourBuilder { + b.computeInstanceType = value + b.bitmap_ |= 1 + return b +} + +// InfraInstanceType sets the value of the 'infra_instance_type' attribute to the given value. +func (b *GCPFlavourBuilder) InfraInstanceType(value string) *GCPFlavourBuilder { + b.infraInstanceType = value + b.bitmap_ |= 2 + return b +} + +// InfraVolume sets the value of the 'infra_volume' attribute to the given value. +// +// Holds settings for an GCP storage volume. +func (b *GCPFlavourBuilder) InfraVolume(value *GCPVolumeBuilder) *GCPFlavourBuilder { + b.infraVolume = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// MasterInstanceType sets the value of the 'master_instance_type' attribute to the given value. +func (b *GCPFlavourBuilder) MasterInstanceType(value string) *GCPFlavourBuilder { + b.masterInstanceType = value + b.bitmap_ |= 8 + return b +} + +// MasterVolume sets the value of the 'master_volume' attribute to the given value. +// +// Holds settings for an GCP storage volume. +func (b *GCPFlavourBuilder) MasterVolume(value *GCPVolumeBuilder) *GCPFlavourBuilder { + b.masterVolume = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// WorkerVolume sets the value of the 'worker_volume' attribute to the given value. +// +// Holds settings for an GCP storage volume. +func (b *GCPFlavourBuilder) WorkerVolume(value *GCPVolumeBuilder) *GCPFlavourBuilder { + b.workerVolume = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GCPFlavourBuilder) Copy(object *GCPFlavour) *GCPFlavourBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.computeInstanceType = object.computeInstanceType + b.infraInstanceType = object.infraInstanceType + if object.infraVolume != nil { + b.infraVolume = NewGCPVolume().Copy(object.infraVolume) + } else { + b.infraVolume = nil + } + b.masterInstanceType = object.masterInstanceType + if object.masterVolume != nil { + b.masterVolume = NewGCPVolume().Copy(object.masterVolume) + } else { + b.masterVolume = nil + } + if object.workerVolume != nil { + b.workerVolume = NewGCPVolume().Copy(object.workerVolume) + } else { + b.workerVolume = nil + } + return b +} + +// Build creates a 'GCP_flavour' object using the configuration stored in the builder. +func (b *GCPFlavourBuilder) Build() (object *GCPFlavour, err error) { + object = new(GCPFlavour) + object.bitmap_ = b.bitmap_ + object.computeInstanceType = b.computeInstanceType + object.infraInstanceType = b.infraInstanceType + if b.infraVolume != nil { + object.infraVolume, err = b.infraVolume.Build() + if err != nil { + return + } + } + object.masterInstanceType = b.masterInstanceType + if b.masterVolume != nil { + object.masterVolume, err = b.masterVolume.Build() + if err != nil { + return + } + } + if b.workerVolume != nil { + object.workerVolume, err = b.workerVolume.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_flavour_list_builder.go b/clientapi/clustersmgmt/v1/gcp_flavour_list_builder.go new file mode 100644 index 00000000..c0970882 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_flavour_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPFlavourListBuilder contains the data and logic needed to build +// 'GCP_flavour' objects. +type GCPFlavourListBuilder struct { + items []*GCPFlavourBuilder +} + +// NewGCPFlavourList creates a new builder of 'GCP_flavour' objects. +func NewGCPFlavourList() *GCPFlavourListBuilder { + return new(GCPFlavourListBuilder) +} + +// Items sets the items of the list. +func (b *GCPFlavourListBuilder) Items(values ...*GCPFlavourBuilder) *GCPFlavourListBuilder { + b.items = make([]*GCPFlavourBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GCPFlavourListBuilder) 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 *GCPFlavourListBuilder) Copy(list *GCPFlavourList) *GCPFlavourListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GCPFlavourBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGCPFlavour().Copy(v) + } + } + return b +} + +// Build creates a list of 'GCP_flavour' objects using the +// configuration stored in the builder. +func (b *GCPFlavourListBuilder) Build() (list *GCPFlavourList, err error) { + items := make([]*GCPFlavour, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GCPFlavourList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_flavour_list_type_json.go b/clientapi/clustersmgmt/v1/gcp_flavour_list_type_json.go new file mode 100644 index 00000000..b6293d09 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_flavour_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPFlavourList writes a list of values of the 'GCP_flavour' type to +// the given writer. +func MarshalGCPFlavourList(list []*GCPFlavour, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPFlavourList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPFlavourList writes a list of value of the 'GCP_flavour' type to +// the given stream. +func WriteGCPFlavourList(list []*GCPFlavour, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGCPFlavour(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGCPFlavourList reads a list of values of the 'GCP_flavour' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGCPFlavourList(source interface{}) (items []*GCPFlavour, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGCPFlavourList(iterator) + err = iterator.Error + return +} + +// ReadGCPFlavourList reads list of values of the ”GCP_flavour' type from +// the given iterator. +func ReadGCPFlavourList(iterator *jsoniter.Iterator) []*GCPFlavour { + list := []*GCPFlavour{} + for iterator.ReadArray() { + item := ReadGCPFlavour(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/gcp_flavour_type.go b/clientapi/clustersmgmt/v1/gcp_flavour_type.go new file mode 100644 index 00000000..8eb507fe --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_flavour_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPFlavour represents the values of the 'GCP_flavour' type. +// +// Specification for different classes of nodes inside a flavour. +type GCPFlavour struct { + bitmap_ uint32 + computeInstanceType string + infraInstanceType string + infraVolume *GCPVolume + masterInstanceType string + masterVolume *GCPVolume + workerVolume *GCPVolume +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GCPFlavour) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ComputeInstanceType returns the value of the 'compute_instance_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP default instance type for the worker volume. +// +// User can be overridden specifying in the cluster itself a type for compute node. +func (o *GCPFlavour) ComputeInstanceType() string { + if o != nil && o.bitmap_&1 != 0 { + return o.computeInstanceType + } + return "" +} + +// GetComputeInstanceType returns the value of the 'compute_instance_type' attribute and +// a flag indicating if the attribute has a value. +// +// GCP default instance type for the worker volume. +// +// User can be overridden specifying in the cluster itself a type for compute node. +func (o *GCPFlavour) GetComputeInstanceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.computeInstanceType + } + return +} + +// InfraInstanceType returns the value of the 'infra_instance_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP default instance type for the infra volume. +func (o *GCPFlavour) InfraInstanceType() string { + if o != nil && o.bitmap_&2 != 0 { + return o.infraInstanceType + } + return "" +} + +// GetInfraInstanceType returns the value of the 'infra_instance_type' attribute and +// a flag indicating if the attribute has a value. +// +// GCP default instance type for the infra volume. +func (o *GCPFlavour) GetInfraInstanceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.infraInstanceType + } + return +} + +// InfraVolume returns the value of the 'infra_volume' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Infra volume specification. +func (o *GCPFlavour) InfraVolume() *GCPVolume { + if o != nil && o.bitmap_&4 != 0 { + return o.infraVolume + } + return nil +} + +// GetInfraVolume returns the value of the 'infra_volume' attribute and +// a flag indicating if the attribute has a value. +// +// Infra volume specification. +func (o *GCPFlavour) GetInfraVolume() (value *GCPVolume, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.infraVolume + } + return +} + +// MasterInstanceType returns the value of the 'master_instance_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP default instance type for the master volume. +func (o *GCPFlavour) MasterInstanceType() string { + if o != nil && o.bitmap_&8 != 0 { + return o.masterInstanceType + } + return "" +} + +// GetMasterInstanceType returns the value of the 'master_instance_type' attribute and +// a flag indicating if the attribute has a value. +// +// GCP default instance type for the master volume. +func (o *GCPFlavour) GetMasterInstanceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.masterInstanceType + } + return +} + +// MasterVolume returns the value of the 'master_volume' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Master volume specification. +func (o *GCPFlavour) MasterVolume() *GCPVolume { + if o != nil && o.bitmap_&16 != 0 { + return o.masterVolume + } + return nil +} + +// GetMasterVolume returns the value of the 'master_volume' attribute and +// a flag indicating if the attribute has a value. +// +// Master volume specification. +func (o *GCPFlavour) GetMasterVolume() (value *GCPVolume, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.masterVolume + } + return +} + +// WorkerVolume returns the value of the 'worker_volume' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Worker volume specification. +func (o *GCPFlavour) WorkerVolume() *GCPVolume { + if o != nil && o.bitmap_&32 != 0 { + return o.workerVolume + } + return nil +} + +// GetWorkerVolume returns the value of the 'worker_volume' attribute and +// a flag indicating if the attribute has a value. +// +// Worker volume specification. +func (o *GCPFlavour) GetWorkerVolume() (value *GCPVolume, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.workerVolume + } + return +} + +// GCPFlavourListKind is the name of the type used to represent list of objects of +// type 'GCP_flavour'. +const GCPFlavourListKind = "GCPFlavourList" + +// GCPFlavourListLinkKind is the name of the type used to represent links to list +// of objects of type 'GCP_flavour'. +const GCPFlavourListLinkKind = "GCPFlavourListLink" + +// GCPFlavourNilKind is the name of the type used to nil lists of objects of +// type 'GCP_flavour'. +const GCPFlavourListNilKind = "GCPFlavourListNil" + +// GCPFlavourList is a list of values of the 'GCP_flavour' type. +type GCPFlavourList struct { + href string + link bool + items []*GCPFlavour +} + +// Len returns the length of the list. +func (l *GCPFlavourList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GCPFlavourList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GCPFlavourList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GCPFlavourList) SetItems(items []*GCPFlavour) { + l.items = items +} + +// Items returns the items of the list. +func (l *GCPFlavourList) Items() []*GCPFlavour { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GCPFlavourList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GCPFlavourList) Get(i int) *GCPFlavour { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GCPFlavourList) Slice() []*GCPFlavour { + var slice []*GCPFlavour + if l == nil { + slice = make([]*GCPFlavour, 0) + } else { + slice = make([]*GCPFlavour, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GCPFlavourList) Each(f func(item *GCPFlavour) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GCPFlavourList) Range(f func(index int, item *GCPFlavour) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/gcp_flavour_type_json.go b/clientapi/clustersmgmt/v1/gcp_flavour_type_json.go new file mode 100644 index 00000000..0402e75e --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_flavour_type_json.go @@ -0,0 +1,151 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPFlavour writes a value of the 'GCP_flavour' type to the given writer. +func MarshalGCPFlavour(object *GCPFlavour, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPFlavour(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPFlavour writes a value of the 'GCP_flavour' type to the given stream. +func WriteGCPFlavour(object *GCPFlavour, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute_instance_type") + stream.WriteString(object.computeInstanceType) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("infra_instance_type") + stream.WriteString(object.infraInstanceType) + count++ + } + present_ = object.bitmap_&4 != 0 && object.infraVolume != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("infra_volume") + WriteGCPVolume(object.infraVolume, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("master_instance_type") + stream.WriteString(object.masterInstanceType) + count++ + } + present_ = object.bitmap_&16 != 0 && object.masterVolume != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("master_volume") + WriteGCPVolume(object.masterVolume, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.workerVolume != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("worker_volume") + WriteGCPVolume(object.workerVolume, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalGCPFlavour reads a value of the 'GCP_flavour' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGCPFlavour(source interface{}) (object *GCPFlavour, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGCPFlavour(iterator) + err = iterator.Error + return +} + +// ReadGCPFlavour reads a value of the 'GCP_flavour' type from the given iterator. +func ReadGCPFlavour(iterator *jsoniter.Iterator) *GCPFlavour { + object := &GCPFlavour{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "compute_instance_type": + value := iterator.ReadString() + object.computeInstanceType = value + object.bitmap_ |= 1 + case "infra_instance_type": + value := iterator.ReadString() + object.infraInstanceType = value + object.bitmap_ |= 2 + case "infra_volume": + value := ReadGCPVolume(iterator) + object.infraVolume = value + object.bitmap_ |= 4 + case "master_instance_type": + value := iterator.ReadString() + object.masterInstanceType = value + object.bitmap_ |= 8 + case "master_volume": + value := ReadGCPVolume(iterator) + object.masterVolume = value + object.bitmap_ |= 16 + case "worker_volume": + value := ReadGCPVolume(iterator) + object.workerVolume = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/gcp_image_override_builder.go b/clientapi/clustersmgmt/v1/gcp_image_override_builder.go new file mode 100644 index 00000000..749f21f5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_image_override_builder.go @@ -0,0 +1,149 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPImageOverrideBuilder contains the data and logic needed to build 'GCP_image_override' objects. +// +// GcpImageOverride specifies what a GCP VM Image should be used for a particular product and billing model +type GCPImageOverrideBuilder struct { + bitmap_ uint32 + id string + href string + billingModel *BillingModelItemBuilder + imageID string + product *ProductBuilder + projectID string +} + +// NewGCPImageOverride creates a new builder of 'GCP_image_override' objects. +func NewGCPImageOverride() *GCPImageOverrideBuilder { + return &GCPImageOverrideBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *GCPImageOverrideBuilder) Link(value bool) *GCPImageOverrideBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *GCPImageOverrideBuilder) ID(value string) *GCPImageOverrideBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *GCPImageOverrideBuilder) HREF(value string) *GCPImageOverrideBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GCPImageOverrideBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// BillingModel sets the value of the 'billing_model' attribute to the given value. +// +// BillingModelItem represents a billing model +func (b *GCPImageOverrideBuilder) BillingModel(value *BillingModelItemBuilder) *GCPImageOverrideBuilder { + b.billingModel = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// ImageID sets the value of the 'image_ID' attribute to the given value. +func (b *GCPImageOverrideBuilder) ImageID(value string) *GCPImageOverrideBuilder { + b.imageID = value + b.bitmap_ |= 16 + return b +} + +// Product sets the value of the 'product' attribute to the given value. +// +// Representation of an product that can be selected as a cluster type. +func (b *GCPImageOverrideBuilder) Product(value *ProductBuilder) *GCPImageOverrideBuilder { + b.product = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// ProjectID sets the value of the 'project_ID' attribute to the given value. +func (b *GCPImageOverrideBuilder) ProjectID(value string) *GCPImageOverrideBuilder { + b.projectID = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GCPImageOverrideBuilder) Copy(object *GCPImageOverride) *GCPImageOverrideBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.billingModel != nil { + b.billingModel = NewBillingModelItem().Copy(object.billingModel) + } else { + b.billingModel = nil + } + b.imageID = object.imageID + if object.product != nil { + b.product = NewProduct().Copy(object.product) + } else { + b.product = nil + } + b.projectID = object.projectID + return b +} + +// Build creates a 'GCP_image_override' object using the configuration stored in the builder. +func (b *GCPImageOverrideBuilder) Build() (object *GCPImageOverride, err error) { + object = new(GCPImageOverride) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.billingModel != nil { + object.billingModel, err = b.billingModel.Build() + if err != nil { + return + } + } + object.imageID = b.imageID + if b.product != nil { + object.product, err = b.product.Build() + if err != nil { + return + } + } + object.projectID = b.projectID + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_image_override_list_builder.go b/clientapi/clustersmgmt/v1/gcp_image_override_list_builder.go new file mode 100644 index 00000000..a8139a79 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_image_override_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPImageOverrideListBuilder contains the data and logic needed to build +// 'GCP_image_override' objects. +type GCPImageOverrideListBuilder struct { + items []*GCPImageOverrideBuilder +} + +// NewGCPImageOverrideList creates a new builder of 'GCP_image_override' objects. +func NewGCPImageOverrideList() *GCPImageOverrideListBuilder { + return new(GCPImageOverrideListBuilder) +} + +// Items sets the items of the list. +func (b *GCPImageOverrideListBuilder) Items(values ...*GCPImageOverrideBuilder) *GCPImageOverrideListBuilder { + b.items = make([]*GCPImageOverrideBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GCPImageOverrideListBuilder) 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 *GCPImageOverrideListBuilder) Copy(list *GCPImageOverrideList) *GCPImageOverrideListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GCPImageOverrideBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGCPImageOverride().Copy(v) + } + } + return b +} + +// Build creates a list of 'GCP_image_override' objects using the +// configuration stored in the builder. +func (b *GCPImageOverrideListBuilder) Build() (list *GCPImageOverrideList, err error) { + items := make([]*GCPImageOverride, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GCPImageOverrideList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_image_override_list_type_json.go b/clientapi/clustersmgmt/v1/gcp_image_override_list_type_json.go new file mode 100644 index 00000000..56e5a164 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_image_override_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPImageOverrideList writes a list of values of the 'GCP_image_override' type to +// the given writer. +func MarshalGCPImageOverrideList(list []*GCPImageOverride, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPImageOverrideList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPImageOverrideList writes a list of value of the 'GCP_image_override' type to +// the given stream. +func WriteGCPImageOverrideList(list []*GCPImageOverride, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGCPImageOverride(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGCPImageOverrideList reads a list of values of the 'GCP_image_override' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGCPImageOverrideList(source interface{}) (items []*GCPImageOverride, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGCPImageOverrideList(iterator) + err = iterator.Error + return +} + +// ReadGCPImageOverrideList reads list of values of the ”GCP_image_override' type from +// the given iterator. +func ReadGCPImageOverrideList(iterator *jsoniter.Iterator) []*GCPImageOverride { + list := []*GCPImageOverride{} + for iterator.ReadArray() { + item := ReadGCPImageOverride(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/gcp_image_override_type.go b/clientapi/clustersmgmt/v1/gcp_image_override_type.go new file mode 100644 index 00000000..28bf285e --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_image_override_type.go @@ -0,0 +1,337 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPImageOverrideKind is the name of the type used to represent objects +// of type 'GCP_image_override'. +const GCPImageOverrideKind = "GCPImageOverride" + +// GCPImageOverrideLinkKind is the name of the type used to represent links +// to objects of type 'GCP_image_override'. +const GCPImageOverrideLinkKind = "GCPImageOverrideLink" + +// GCPImageOverrideNilKind is the name of the type used to nil references +// to objects of type 'GCP_image_override'. +const GCPImageOverrideNilKind = "GCPImageOverrideNil" + +// GCPImageOverride represents the values of the 'GCP_image_override' type. +// +// GcpImageOverride specifies what a GCP VM Image should be used for a particular product and billing model +type GCPImageOverride struct { + bitmap_ uint32 + id string + href string + billingModel *BillingModelItem + imageID string + product *Product + projectID string +} + +// Kind returns the name of the type of the object. +func (o *GCPImageOverride) Kind() string { + if o == nil { + return GCPImageOverrideNilKind + } + if o.bitmap_&1 != 0 { + return GCPImageOverrideLinkKind + } + return GCPImageOverrideKind +} + +// Link returns true if this is a link. +func (o *GCPImageOverride) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *GCPImageOverride) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *GCPImageOverride) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *GCPImageOverride) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *GCPImageOverride) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GCPImageOverride) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// BillingModel returns the value of the 'billing_model' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the billing model. +func (o *GCPImageOverride) BillingModel() *BillingModelItem { + if o != nil && o.bitmap_&8 != 0 { + return o.billingModel + } + return nil +} + +// GetBillingModel returns the value of the 'billing_model' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the billing model. +func (o *GCPImageOverride) GetBillingModel() (value *BillingModelItem, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.billingModel + } + return +} + +// ImageID returns the value of the 'image_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ImageID is the id of the Google Cloud Platform image. +func (o *GCPImageOverride) ImageID() string { + if o != nil && o.bitmap_&16 != 0 { + return o.imageID + } + return "" +} + +// GetImageID returns the value of the 'image_ID' attribute and +// a flag indicating if the attribute has a value. +// +// ImageID is the id of the Google Cloud Platform image. +func (o *GCPImageOverride) GetImageID() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.imageID + } + return +} + +// Product returns the value of the 'product' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the product type. +func (o *GCPImageOverride) Product() *Product { + if o != nil && o.bitmap_&32 != 0 { + return o.product + } + return nil +} + +// GetProduct returns the value of the 'product' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the product type. +func (o *GCPImageOverride) GetProduct() (value *Product, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.product + } + return +} + +// ProjectID returns the value of the 'project_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ProjectID is the id of the Google Cloud Platform project that hosts the image. +func (o *GCPImageOverride) ProjectID() string { + if o != nil && o.bitmap_&64 != 0 { + return o.projectID + } + return "" +} + +// GetProjectID returns the value of the 'project_ID' attribute and +// a flag indicating if the attribute has a value. +// +// ProjectID is the id of the Google Cloud Platform project that hosts the image. +func (o *GCPImageOverride) GetProjectID() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.projectID + } + return +} + +// GCPImageOverrideListKind is the name of the type used to represent list of objects of +// type 'GCP_image_override'. +const GCPImageOverrideListKind = "GCPImageOverrideList" + +// GCPImageOverrideListLinkKind is the name of the type used to represent links to list +// of objects of type 'GCP_image_override'. +const GCPImageOverrideListLinkKind = "GCPImageOverrideListLink" + +// GCPImageOverrideNilKind is the name of the type used to nil lists of objects of +// type 'GCP_image_override'. +const GCPImageOverrideListNilKind = "GCPImageOverrideListNil" + +// GCPImageOverrideList is a list of values of the 'GCP_image_override' type. +type GCPImageOverrideList struct { + href string + link bool + items []*GCPImageOverride +} + +// Kind returns the name of the type of the object. +func (l *GCPImageOverrideList) Kind() string { + if l == nil { + return GCPImageOverrideListNilKind + } + if l.link { + return GCPImageOverrideListLinkKind + } + return GCPImageOverrideListKind +} + +// Link returns true iif this is a link. +func (l *GCPImageOverrideList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *GCPImageOverrideList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *GCPImageOverrideList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *GCPImageOverrideList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GCPImageOverrideList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GCPImageOverrideList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GCPImageOverrideList) SetItems(items []*GCPImageOverride) { + l.items = items +} + +// Items returns the items of the list. +func (l *GCPImageOverrideList) Items() []*GCPImageOverride { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GCPImageOverrideList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GCPImageOverrideList) Get(i int) *GCPImageOverride { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GCPImageOverrideList) Slice() []*GCPImageOverride { + var slice []*GCPImageOverride + if l == nil { + slice = make([]*GCPImageOverride, 0) + } else { + slice = make([]*GCPImageOverride, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GCPImageOverrideList) Each(f func(item *GCPImageOverride) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GCPImageOverrideList) Range(f func(index int, item *GCPImageOverride) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/gcp_image_override_type_json.go b/clientapi/clustersmgmt/v1/gcp_image_override_type_json.go new file mode 100644 index 00000000..696bea76 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_image_override_type_json.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPImageOverride writes a value of the 'GCP_image_override' type to the given writer. +func MarshalGCPImageOverride(object *GCPImageOverride, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPImageOverride(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPImageOverride writes a value of the 'GCP_image_override' type to the given stream. +func WriteGCPImageOverride(object *GCPImageOverride, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(GCPImageOverrideLinkKind) + } else { + stream.WriteString(GCPImageOverrideKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.billingModel != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("billing_model") + WriteBillingModelItem(object.billingModel, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("image_id") + stream.WriteString(object.imageID) + count++ + } + present_ = object.bitmap_&32 != 0 && object.product != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product") + WriteProduct(object.product, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("project_id") + stream.WriteString(object.projectID) + } + stream.WriteObjectEnd() +} + +// UnmarshalGCPImageOverride reads a value of the 'GCP_image_override' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGCPImageOverride(source interface{}) (object *GCPImageOverride, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGCPImageOverride(iterator) + err = iterator.Error + return +} + +// ReadGCPImageOverride reads a value of the 'GCP_image_override' type from the given iterator. +func ReadGCPImageOverride(iterator *jsoniter.Iterator) *GCPImageOverride { + object := &GCPImageOverride{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == GCPImageOverrideLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "billing_model": + value := ReadBillingModelItem(iterator) + object.billingModel = value + object.bitmap_ |= 8 + case "image_id": + value := iterator.ReadString() + object.imageID = value + object.bitmap_ |= 16 + case "product": + value := ReadProduct(iterator) + object.product = value + object.bitmap_ |= 32 + case "project_id": + value := iterator.ReadString() + object.projectID = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/gcp_list_builder.go b/clientapi/clustersmgmt/v1/gcp_list_builder.go new file mode 100644 index 00000000..13d16ed8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPListBuilder contains the data and logic needed to build +// 'GCP' objects. +type GCPListBuilder struct { + items []*GCPBuilder +} + +// NewGCPList creates a new builder of 'GCP' objects. +func NewGCPList() *GCPListBuilder { + return new(GCPListBuilder) +} + +// Items sets the items of the list. +func (b *GCPListBuilder) Items(values ...*GCPBuilder) *GCPListBuilder { + b.items = make([]*GCPBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GCPListBuilder) 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 *GCPListBuilder) Copy(list *GCPList) *GCPListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GCPBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGCP().Copy(v) + } + } + return b +} + +// Build creates a list of 'GCP' objects using the +// configuration stored in the builder. +func (b *GCPListBuilder) Build() (list *GCPList, err error) { + items := make([]*GCP, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GCPList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_list_type_json.go b/clientapi/clustersmgmt/v1/gcp_list_type_json.go new file mode 100644 index 00000000..10ead7e0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPList writes a list of values of the 'GCP' type to +// the given writer. +func MarshalGCPList(list []*GCP, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPList writes a list of value of the 'GCP' type to +// the given stream. +func WriteGCPList(list []*GCP, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGCP(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGCPList reads a list of values of the 'GCP' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGCPList(source interface{}) (items []*GCP, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGCPList(iterator) + err = iterator.Error + return +} + +// ReadGCPList reads list of values of the ”GCP' type from +// the given iterator. +func ReadGCPList(iterator *jsoniter.Iterator) []*GCP { + list := []*GCP{} + for iterator.ReadArray() { + item := ReadGCP(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/gcp_machine_pool_builder.go b/clientapi/clustersmgmt/v1/gcp_machine_pool_builder.go new file mode 100644 index 00000000..85c14c69 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_machine_pool_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPMachinePoolBuilder contains the data and logic needed to build 'GCP_machine_pool' objects. +// +// Representation of gcp machine pool specific parameters. +type GCPMachinePoolBuilder struct { + bitmap_ uint32 + secureBoot bool +} + +// NewGCPMachinePool creates a new builder of 'GCP_machine_pool' objects. +func NewGCPMachinePool() *GCPMachinePoolBuilder { + return &GCPMachinePoolBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GCPMachinePoolBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// SecureBoot sets the value of the 'secure_boot' attribute to the given value. +func (b *GCPMachinePoolBuilder) SecureBoot(value bool) *GCPMachinePoolBuilder { + b.secureBoot = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GCPMachinePoolBuilder) Copy(object *GCPMachinePool) *GCPMachinePoolBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.secureBoot = object.secureBoot + return b +} + +// Build creates a 'GCP_machine_pool' object using the configuration stored in the builder. +func (b *GCPMachinePoolBuilder) Build() (object *GCPMachinePool, err error) { + object = new(GCPMachinePool) + object.bitmap_ = b.bitmap_ + object.secureBoot = b.secureBoot + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_machine_pool_list_builder.go b/clientapi/clustersmgmt/v1/gcp_machine_pool_list_builder.go new file mode 100644 index 00000000..82fa8627 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_machine_pool_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPMachinePoolListBuilder contains the data and logic needed to build +// 'GCP_machine_pool' objects. +type GCPMachinePoolListBuilder struct { + items []*GCPMachinePoolBuilder +} + +// NewGCPMachinePoolList creates a new builder of 'GCP_machine_pool' objects. +func NewGCPMachinePoolList() *GCPMachinePoolListBuilder { + return new(GCPMachinePoolListBuilder) +} + +// Items sets the items of the list. +func (b *GCPMachinePoolListBuilder) Items(values ...*GCPMachinePoolBuilder) *GCPMachinePoolListBuilder { + b.items = make([]*GCPMachinePoolBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GCPMachinePoolListBuilder) 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 *GCPMachinePoolListBuilder) Copy(list *GCPMachinePoolList) *GCPMachinePoolListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GCPMachinePoolBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGCPMachinePool().Copy(v) + } + } + return b +} + +// Build creates a list of 'GCP_machine_pool' objects using the +// configuration stored in the builder. +func (b *GCPMachinePoolListBuilder) Build() (list *GCPMachinePoolList, err error) { + items := make([]*GCPMachinePool, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GCPMachinePoolList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_machine_pool_list_type_json.go b/clientapi/clustersmgmt/v1/gcp_machine_pool_list_type_json.go new file mode 100644 index 00000000..1dc53341 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_machine_pool_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPMachinePoolList writes a list of values of the 'GCP_machine_pool' type to +// the given writer. +func MarshalGCPMachinePoolList(list []*GCPMachinePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPMachinePoolList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPMachinePoolList writes a list of value of the 'GCP_machine_pool' type to +// the given stream. +func WriteGCPMachinePoolList(list []*GCPMachinePool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGCPMachinePool(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGCPMachinePoolList reads a list of values of the 'GCP_machine_pool' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGCPMachinePoolList(source interface{}) (items []*GCPMachinePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGCPMachinePoolList(iterator) + err = iterator.Error + return +} + +// ReadGCPMachinePoolList reads list of values of the ”GCP_machine_pool' type from +// the given iterator. +func ReadGCPMachinePoolList(iterator *jsoniter.Iterator) []*GCPMachinePool { + list := []*GCPMachinePool{} + for iterator.ReadArray() { + item := ReadGCPMachinePool(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/gcp_machine_pool_type.go b/clientapi/clustersmgmt/v1/gcp_machine_pool_type.go new file mode 100644 index 00000000..47386f07 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_machine_pool_type.go @@ -0,0 +1,177 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPMachinePool represents the values of the 'GCP_machine_pool' type. +// +// Representation of gcp machine pool specific parameters. +type GCPMachinePool struct { + bitmap_ uint32 + secureBoot bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GCPMachinePool) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// SecureBoot returns the value of the 'secure_boot' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Determines whether the Shielded VM's SecureBoot feature should be +// enabled for the nodes of the machine pool. If SecureBoot is not +// specified, the value of this attribute will remain unspecified and the +// SecureBoot's value specified in the `.gcp.security.secure_boot` +// attribute of the parent Cluster will be the one applied to the nodes of +// the machine pool. +// Immutable. +func (o *GCPMachinePool) SecureBoot() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.secureBoot + } + return false +} + +// GetSecureBoot returns the value of the 'secure_boot' attribute and +// a flag indicating if the attribute has a value. +// +// Determines whether the Shielded VM's SecureBoot feature should be +// enabled for the nodes of the machine pool. If SecureBoot is not +// specified, the value of this attribute will remain unspecified and the +// SecureBoot's value specified in the `.gcp.security.secure_boot` +// attribute of the parent Cluster will be the one applied to the nodes of +// the machine pool. +// Immutable. +func (o *GCPMachinePool) GetSecureBoot() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.secureBoot + } + return +} + +// GCPMachinePoolListKind is the name of the type used to represent list of objects of +// type 'GCP_machine_pool'. +const GCPMachinePoolListKind = "GCPMachinePoolList" + +// GCPMachinePoolListLinkKind is the name of the type used to represent links to list +// of objects of type 'GCP_machine_pool'. +const GCPMachinePoolListLinkKind = "GCPMachinePoolListLink" + +// GCPMachinePoolNilKind is the name of the type used to nil lists of objects of +// type 'GCP_machine_pool'. +const GCPMachinePoolListNilKind = "GCPMachinePoolListNil" + +// GCPMachinePoolList is a list of values of the 'GCP_machine_pool' type. +type GCPMachinePoolList struct { + href string + link bool + items []*GCPMachinePool +} + +// Len returns the length of the list. +func (l *GCPMachinePoolList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GCPMachinePoolList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GCPMachinePoolList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GCPMachinePoolList) SetItems(items []*GCPMachinePool) { + l.items = items +} + +// Items returns the items of the list. +func (l *GCPMachinePoolList) Items() []*GCPMachinePool { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GCPMachinePoolList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GCPMachinePoolList) Get(i int) *GCPMachinePool { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GCPMachinePoolList) Slice() []*GCPMachinePool { + var slice []*GCPMachinePool + if l == nil { + slice = make([]*GCPMachinePool, 0) + } else { + slice = make([]*GCPMachinePool, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GCPMachinePoolList) Each(f func(item *GCPMachinePool) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GCPMachinePoolList) Range(f func(index int, item *GCPMachinePool) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/gcp_machine_pool_type_json.go b/clientapi/clustersmgmt/v1/gcp_machine_pool_type_json.go new file mode 100644 index 00000000..d6de0801 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_machine_pool_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPMachinePool writes a value of the 'GCP_machine_pool' type to the given writer. +func MarshalGCPMachinePool(object *GCPMachinePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPMachinePool(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPMachinePool writes a value of the 'GCP_machine_pool' type to the given stream. +func WriteGCPMachinePool(object *GCPMachinePool, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("secure_boot") + stream.WriteBool(object.secureBoot) + } + stream.WriteObjectEnd() +} + +// UnmarshalGCPMachinePool reads a value of the 'GCP_machine_pool' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGCPMachinePool(source interface{}) (object *GCPMachinePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGCPMachinePool(iterator) + err = iterator.Error + return +} + +// ReadGCPMachinePool reads a value of the 'GCP_machine_pool' type from the given iterator. +func ReadGCPMachinePool(iterator *jsoniter.Iterator) *GCPMachinePool { + object := &GCPMachinePool{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "secure_boot": + value := iterator.ReadBool() + object.secureBoot = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/gcp_network_builder.go b/clientapi/clustersmgmt/v1/gcp_network_builder.go new file mode 100644 index 00000000..c8beda5a --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_network_builder.go @@ -0,0 +1,93 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPNetworkBuilder contains the data and logic needed to build 'GCP_network' objects. +// +// GCP Network configuration of a cluster. +type GCPNetworkBuilder struct { + bitmap_ uint32 + vpcName string + vpcProjectID string + computeSubnet string + controlPlaneSubnet string +} + +// NewGCPNetwork creates a new builder of 'GCP_network' objects. +func NewGCPNetwork() *GCPNetworkBuilder { + return &GCPNetworkBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GCPNetworkBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// VPCName sets the value of the 'VPC_name' attribute to the given value. +func (b *GCPNetworkBuilder) VPCName(value string) *GCPNetworkBuilder { + b.vpcName = value + b.bitmap_ |= 1 + return b +} + +// VPCProjectID sets the value of the 'VPC_project_ID' attribute to the given value. +func (b *GCPNetworkBuilder) VPCProjectID(value string) *GCPNetworkBuilder { + b.vpcProjectID = value + b.bitmap_ |= 2 + return b +} + +// ComputeSubnet sets the value of the 'compute_subnet' attribute to the given value. +func (b *GCPNetworkBuilder) ComputeSubnet(value string) *GCPNetworkBuilder { + b.computeSubnet = value + b.bitmap_ |= 4 + return b +} + +// ControlPlaneSubnet sets the value of the 'control_plane_subnet' attribute to the given value. +func (b *GCPNetworkBuilder) ControlPlaneSubnet(value string) *GCPNetworkBuilder { + b.controlPlaneSubnet = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GCPNetworkBuilder) Copy(object *GCPNetwork) *GCPNetworkBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.vpcName = object.vpcName + b.vpcProjectID = object.vpcProjectID + b.computeSubnet = object.computeSubnet + b.controlPlaneSubnet = object.controlPlaneSubnet + return b +} + +// Build creates a 'GCP_network' object using the configuration stored in the builder. +func (b *GCPNetworkBuilder) Build() (object *GCPNetwork, err error) { + object = new(GCPNetwork) + object.bitmap_ = b.bitmap_ + object.vpcName = b.vpcName + object.vpcProjectID = b.vpcProjectID + object.computeSubnet = b.computeSubnet + object.controlPlaneSubnet = b.controlPlaneSubnet + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_network_list_builder.go b/clientapi/clustersmgmt/v1/gcp_network_list_builder.go new file mode 100644 index 00000000..7171ecb0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_network_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPNetworkListBuilder contains the data and logic needed to build +// 'GCP_network' objects. +type GCPNetworkListBuilder struct { + items []*GCPNetworkBuilder +} + +// NewGCPNetworkList creates a new builder of 'GCP_network' objects. +func NewGCPNetworkList() *GCPNetworkListBuilder { + return new(GCPNetworkListBuilder) +} + +// Items sets the items of the list. +func (b *GCPNetworkListBuilder) Items(values ...*GCPNetworkBuilder) *GCPNetworkListBuilder { + b.items = make([]*GCPNetworkBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GCPNetworkListBuilder) 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 *GCPNetworkListBuilder) Copy(list *GCPNetworkList) *GCPNetworkListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GCPNetworkBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGCPNetwork().Copy(v) + } + } + return b +} + +// Build creates a list of 'GCP_network' objects using the +// configuration stored in the builder. +func (b *GCPNetworkListBuilder) Build() (list *GCPNetworkList, err error) { + items := make([]*GCPNetwork, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GCPNetworkList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_network_list_type_json.go b/clientapi/clustersmgmt/v1/gcp_network_list_type_json.go new file mode 100644 index 00000000..ce7a6505 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_network_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPNetworkList writes a list of values of the 'GCP_network' type to +// the given writer. +func MarshalGCPNetworkList(list []*GCPNetwork, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPNetworkList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPNetworkList writes a list of value of the 'GCP_network' type to +// the given stream. +func WriteGCPNetworkList(list []*GCPNetwork, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGCPNetwork(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGCPNetworkList reads a list of values of the 'GCP_network' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGCPNetworkList(source interface{}) (items []*GCPNetwork, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGCPNetworkList(iterator) + err = iterator.Error + return +} + +// ReadGCPNetworkList reads list of values of the ”GCP_network' type from +// the given iterator. +func ReadGCPNetworkList(iterator *jsoniter.Iterator) []*GCPNetwork { + list := []*GCPNetwork{} + for iterator.ReadArray() { + item := ReadGCPNetwork(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/gcp_network_type.go b/clientapi/clustersmgmt/v1/gcp_network_type.go new file mode 100644 index 00000000..d4672f24 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_network_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPNetwork represents the values of the 'GCP_network' type. +// +// GCP Network configuration of a cluster. +type GCPNetwork struct { + bitmap_ uint32 + vpcName string + vpcProjectID string + computeSubnet string + controlPlaneSubnet string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GCPNetwork) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// VPCName returns the value of the 'VPC_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// VPC mame used by the cluster. +func (o *GCPNetwork) VPCName() string { + if o != nil && o.bitmap_&1 != 0 { + return o.vpcName + } + return "" +} + +// GetVPCName returns the value of the 'VPC_name' attribute and +// a flag indicating if the attribute has a value. +// +// VPC mame used by the cluster. +func (o *GCPNetwork) GetVPCName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.vpcName + } + return +} + +// VPCProjectID returns the value of the 'VPC_project_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the host project where the shared VPC exists. +func (o *GCPNetwork) VPCProjectID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.vpcProjectID + } + return "" +} + +// GetVPCProjectID returns the value of the 'VPC_project_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the host project where the shared VPC exists. +func (o *GCPNetwork) GetVPCProjectID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.vpcProjectID + } + return +} + +// ComputeSubnet returns the value of the 'compute_subnet' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Compute subnet used by the cluster. +func (o *GCPNetwork) ComputeSubnet() string { + if o != nil && o.bitmap_&4 != 0 { + return o.computeSubnet + } + return "" +} + +// GetComputeSubnet returns the value of the 'compute_subnet' attribute and +// a flag indicating if the attribute has a value. +// +// Compute subnet used by the cluster. +func (o *GCPNetwork) GetComputeSubnet() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.computeSubnet + } + return +} + +// ControlPlaneSubnet returns the value of the 'control_plane_subnet' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Control plane subnet used by the cluster. +func (o *GCPNetwork) ControlPlaneSubnet() string { + if o != nil && o.bitmap_&8 != 0 { + return o.controlPlaneSubnet + } + return "" +} + +// GetControlPlaneSubnet returns the value of the 'control_plane_subnet' attribute and +// a flag indicating if the attribute has a value. +// +// Control plane subnet used by the cluster. +func (o *GCPNetwork) GetControlPlaneSubnet() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.controlPlaneSubnet + } + return +} + +// GCPNetworkListKind is the name of the type used to represent list of objects of +// type 'GCP_network'. +const GCPNetworkListKind = "GCPNetworkList" + +// GCPNetworkListLinkKind is the name of the type used to represent links to list +// of objects of type 'GCP_network'. +const GCPNetworkListLinkKind = "GCPNetworkListLink" + +// GCPNetworkNilKind is the name of the type used to nil lists of objects of +// type 'GCP_network'. +const GCPNetworkListNilKind = "GCPNetworkListNil" + +// GCPNetworkList is a list of values of the 'GCP_network' type. +type GCPNetworkList struct { + href string + link bool + items []*GCPNetwork +} + +// Len returns the length of the list. +func (l *GCPNetworkList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GCPNetworkList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GCPNetworkList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GCPNetworkList) SetItems(items []*GCPNetwork) { + l.items = items +} + +// Items returns the items of the list. +func (l *GCPNetworkList) Items() []*GCPNetwork { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GCPNetworkList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GCPNetworkList) Get(i int) *GCPNetwork { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GCPNetworkList) Slice() []*GCPNetwork { + var slice []*GCPNetwork + if l == nil { + slice = make([]*GCPNetwork, 0) + } else { + slice = make([]*GCPNetwork, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GCPNetworkList) Each(f func(item *GCPNetwork) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GCPNetworkList) Range(f func(index int, item *GCPNetwork) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/gcp_network_type_json.go b/clientapi/clustersmgmt/v1/gcp_network_type_json.go new file mode 100644 index 00000000..135c7527 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_network_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPNetwork writes a value of the 'GCP_network' type to the given writer. +func MarshalGCPNetwork(object *GCPNetwork, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPNetwork(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPNetwork writes a value of the 'GCP_network' type to the given stream. +func WriteGCPNetwork(object *GCPNetwork, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("vpc_name") + stream.WriteString(object.vpcName) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("vpc_project_id") + stream.WriteString(object.vpcProjectID) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("compute_subnet") + stream.WriteString(object.computeSubnet) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("control_plane_subnet") + stream.WriteString(object.controlPlaneSubnet) + } + stream.WriteObjectEnd() +} + +// UnmarshalGCPNetwork reads a value of the 'GCP_network' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGCPNetwork(source interface{}) (object *GCPNetwork, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGCPNetwork(iterator) + err = iterator.Error + return +} + +// ReadGCPNetwork reads a value of the 'GCP_network' type from the given iterator. +func ReadGCPNetwork(iterator *jsoniter.Iterator) *GCPNetwork { + object := &GCPNetwork{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "vpc_name": + value := iterator.ReadString() + object.vpcName = value + object.bitmap_ |= 1 + case "vpc_project_id": + value := iterator.ReadString() + object.vpcProjectID = value + object.bitmap_ |= 2 + case "compute_subnet": + value := iterator.ReadString() + object.computeSubnet = value + object.bitmap_ |= 4 + case "control_plane_subnet": + value := iterator.ReadString() + object.controlPlaneSubnet = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/gcp_private_service_connect_builder.go b/clientapi/clustersmgmt/v1/gcp_private_service_connect_builder.go new file mode 100644 index 00000000..9b74a412 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_private_service_connect_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GcpPrivateServiceConnectBuilder contains the data and logic needed to build 'gcp_private_service_connect' objects. +// +// Google cloud platform private service connect configuration of a cluster. +type GcpPrivateServiceConnectBuilder struct { + bitmap_ uint32 + serviceAttachmentSubnet string +} + +// NewGcpPrivateServiceConnect creates a new builder of 'gcp_private_service_connect' objects. +func NewGcpPrivateServiceConnect() *GcpPrivateServiceConnectBuilder { + return &GcpPrivateServiceConnectBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GcpPrivateServiceConnectBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ServiceAttachmentSubnet sets the value of the 'service_attachment_subnet' attribute to the given value. +func (b *GcpPrivateServiceConnectBuilder) ServiceAttachmentSubnet(value string) *GcpPrivateServiceConnectBuilder { + b.serviceAttachmentSubnet = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GcpPrivateServiceConnectBuilder) Copy(object *GcpPrivateServiceConnect) *GcpPrivateServiceConnectBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.serviceAttachmentSubnet = object.serviceAttachmentSubnet + return b +} + +// Build creates a 'gcp_private_service_connect' object using the configuration stored in the builder. +func (b *GcpPrivateServiceConnectBuilder) Build() (object *GcpPrivateServiceConnect, err error) { + object = new(GcpPrivateServiceConnect) + object.bitmap_ = b.bitmap_ + object.serviceAttachmentSubnet = b.serviceAttachmentSubnet + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_private_service_connect_list_builder.go b/clientapi/clustersmgmt/v1/gcp_private_service_connect_list_builder.go new file mode 100644 index 00000000..fdf446d5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_private_service_connect_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GcpPrivateServiceConnectListBuilder contains the data and logic needed to build +// 'gcp_private_service_connect' objects. +type GcpPrivateServiceConnectListBuilder struct { + items []*GcpPrivateServiceConnectBuilder +} + +// NewGcpPrivateServiceConnectList creates a new builder of 'gcp_private_service_connect' objects. +func NewGcpPrivateServiceConnectList() *GcpPrivateServiceConnectListBuilder { + return new(GcpPrivateServiceConnectListBuilder) +} + +// Items sets the items of the list. +func (b *GcpPrivateServiceConnectListBuilder) Items(values ...*GcpPrivateServiceConnectBuilder) *GcpPrivateServiceConnectListBuilder { + b.items = make([]*GcpPrivateServiceConnectBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GcpPrivateServiceConnectListBuilder) 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 *GcpPrivateServiceConnectListBuilder) Copy(list *GcpPrivateServiceConnectList) *GcpPrivateServiceConnectListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GcpPrivateServiceConnectBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGcpPrivateServiceConnect().Copy(v) + } + } + return b +} + +// Build creates a list of 'gcp_private_service_connect' objects using the +// configuration stored in the builder. +func (b *GcpPrivateServiceConnectListBuilder) Build() (list *GcpPrivateServiceConnectList, err error) { + items := make([]*GcpPrivateServiceConnect, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GcpPrivateServiceConnectList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_private_service_connect_list_type_json.go b/clientapi/clustersmgmt/v1/gcp_private_service_connect_list_type_json.go new file mode 100644 index 00000000..3ea2253d --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_private_service_connect_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGcpPrivateServiceConnectList writes a list of values of the 'gcp_private_service_connect' type to +// the given writer. +func MarshalGcpPrivateServiceConnectList(list []*GcpPrivateServiceConnect, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGcpPrivateServiceConnectList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGcpPrivateServiceConnectList writes a list of value of the 'gcp_private_service_connect' type to +// the given stream. +func WriteGcpPrivateServiceConnectList(list []*GcpPrivateServiceConnect, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGcpPrivateServiceConnect(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGcpPrivateServiceConnectList reads a list of values of the 'gcp_private_service_connect' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGcpPrivateServiceConnectList(source interface{}) (items []*GcpPrivateServiceConnect, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGcpPrivateServiceConnectList(iterator) + err = iterator.Error + return +} + +// ReadGcpPrivateServiceConnectList reads list of values of the ”gcp_private_service_connect' type from +// the given iterator. +func ReadGcpPrivateServiceConnectList(iterator *jsoniter.Iterator) []*GcpPrivateServiceConnect { + list := []*GcpPrivateServiceConnect{} + for iterator.ReadArray() { + item := ReadGcpPrivateServiceConnect(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/gcp_private_service_connect_type.go b/clientapi/clustersmgmt/v1/gcp_private_service_connect_type.go new file mode 100644 index 00000000..080c6a94 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_private_service_connect_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GcpPrivateServiceConnect represents the values of the 'gcp_private_service_connect' type. +// +// Google cloud platform private service connect configuration of a cluster. +type GcpPrivateServiceConnect struct { + bitmap_ uint32 + serviceAttachmentSubnet string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GcpPrivateServiceConnect) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ServiceAttachmentSubnet returns the value of the 'service_attachment_subnet' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the subnet where the PSC service attachment is created +func (o *GcpPrivateServiceConnect) ServiceAttachmentSubnet() string { + if o != nil && o.bitmap_&1 != 0 { + return o.serviceAttachmentSubnet + } + return "" +} + +// GetServiceAttachmentSubnet returns the value of the 'service_attachment_subnet' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the subnet where the PSC service attachment is created +func (o *GcpPrivateServiceConnect) GetServiceAttachmentSubnet() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.serviceAttachmentSubnet + } + return +} + +// GcpPrivateServiceConnectListKind is the name of the type used to represent list of objects of +// type 'gcp_private_service_connect'. +const GcpPrivateServiceConnectListKind = "GcpPrivateServiceConnectList" + +// GcpPrivateServiceConnectListLinkKind is the name of the type used to represent links to list +// of objects of type 'gcp_private_service_connect'. +const GcpPrivateServiceConnectListLinkKind = "GcpPrivateServiceConnectListLink" + +// GcpPrivateServiceConnectNilKind is the name of the type used to nil lists of objects of +// type 'gcp_private_service_connect'. +const GcpPrivateServiceConnectListNilKind = "GcpPrivateServiceConnectListNil" + +// GcpPrivateServiceConnectList is a list of values of the 'gcp_private_service_connect' type. +type GcpPrivateServiceConnectList struct { + href string + link bool + items []*GcpPrivateServiceConnect +} + +// Len returns the length of the list. +func (l *GcpPrivateServiceConnectList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GcpPrivateServiceConnectList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GcpPrivateServiceConnectList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GcpPrivateServiceConnectList) SetItems(items []*GcpPrivateServiceConnect) { + l.items = items +} + +// Items returns the items of the list. +func (l *GcpPrivateServiceConnectList) Items() []*GcpPrivateServiceConnect { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GcpPrivateServiceConnectList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GcpPrivateServiceConnectList) Get(i int) *GcpPrivateServiceConnect { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GcpPrivateServiceConnectList) Slice() []*GcpPrivateServiceConnect { + var slice []*GcpPrivateServiceConnect + if l == nil { + slice = make([]*GcpPrivateServiceConnect, 0) + } else { + slice = make([]*GcpPrivateServiceConnect, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GcpPrivateServiceConnectList) Each(f func(item *GcpPrivateServiceConnect) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GcpPrivateServiceConnectList) Range(f func(index int, item *GcpPrivateServiceConnect) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/gcp_private_service_connect_type_json.go b/clientapi/clustersmgmt/v1/gcp_private_service_connect_type_json.go new file mode 100644 index 00000000..24065cbe --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_private_service_connect_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGcpPrivateServiceConnect writes a value of the 'gcp_private_service_connect' type to the given writer. +func MarshalGcpPrivateServiceConnect(object *GcpPrivateServiceConnect, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGcpPrivateServiceConnect(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGcpPrivateServiceConnect writes a value of the 'gcp_private_service_connect' type to the given stream. +func WriteGcpPrivateServiceConnect(object *GcpPrivateServiceConnect, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_attachment_subnet") + stream.WriteString(object.serviceAttachmentSubnet) + } + stream.WriteObjectEnd() +} + +// UnmarshalGcpPrivateServiceConnect reads a value of the 'gcp_private_service_connect' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGcpPrivateServiceConnect(source interface{}) (object *GcpPrivateServiceConnect, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGcpPrivateServiceConnect(iterator) + err = iterator.Error + return +} + +// ReadGcpPrivateServiceConnect reads a value of the 'gcp_private_service_connect' type from the given iterator. +func ReadGcpPrivateServiceConnect(iterator *jsoniter.Iterator) *GcpPrivateServiceConnect { + object := &GcpPrivateServiceConnect{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "service_attachment_subnet": + value := iterator.ReadString() + object.serviceAttachmentSubnet = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/gcp_security_builder.go b/clientapi/clustersmgmt/v1/gcp_security_builder.go new file mode 100644 index 00000000..6bda644b --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_security_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GcpSecurityBuilder contains the data and logic needed to build 'gcp_security' objects. +// +// Google cloud platform security settings of a cluster. +type GcpSecurityBuilder struct { + bitmap_ uint32 + secureBoot bool +} + +// NewGcpSecurity creates a new builder of 'gcp_security' objects. +func NewGcpSecurity() *GcpSecurityBuilder { + return &GcpSecurityBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GcpSecurityBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// SecureBoot sets the value of the 'secure_boot' attribute to the given value. +func (b *GcpSecurityBuilder) SecureBoot(value bool) *GcpSecurityBuilder { + b.secureBoot = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GcpSecurityBuilder) Copy(object *GcpSecurity) *GcpSecurityBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.secureBoot = object.secureBoot + return b +} + +// Build creates a 'gcp_security' object using the configuration stored in the builder. +func (b *GcpSecurityBuilder) Build() (object *GcpSecurity, err error) { + object = new(GcpSecurity) + object.bitmap_ = b.bitmap_ + object.secureBoot = b.secureBoot + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_security_list_builder.go b/clientapi/clustersmgmt/v1/gcp_security_list_builder.go new file mode 100644 index 00000000..7a817418 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_security_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GcpSecurityListBuilder contains the data and logic needed to build +// 'gcp_security' objects. +type GcpSecurityListBuilder struct { + items []*GcpSecurityBuilder +} + +// NewGcpSecurityList creates a new builder of 'gcp_security' objects. +func NewGcpSecurityList() *GcpSecurityListBuilder { + return new(GcpSecurityListBuilder) +} + +// Items sets the items of the list. +func (b *GcpSecurityListBuilder) Items(values ...*GcpSecurityBuilder) *GcpSecurityListBuilder { + b.items = make([]*GcpSecurityBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GcpSecurityListBuilder) 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 *GcpSecurityListBuilder) Copy(list *GcpSecurityList) *GcpSecurityListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GcpSecurityBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGcpSecurity().Copy(v) + } + } + return b +} + +// Build creates a list of 'gcp_security' objects using the +// configuration stored in the builder. +func (b *GcpSecurityListBuilder) Build() (list *GcpSecurityList, err error) { + items := make([]*GcpSecurity, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GcpSecurityList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_security_list_type_json.go b/clientapi/clustersmgmt/v1/gcp_security_list_type_json.go new file mode 100644 index 00000000..c70d2810 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_security_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGcpSecurityList writes a list of values of the 'gcp_security' type to +// the given writer. +func MarshalGcpSecurityList(list []*GcpSecurity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGcpSecurityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGcpSecurityList writes a list of value of the 'gcp_security' type to +// the given stream. +func WriteGcpSecurityList(list []*GcpSecurity, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGcpSecurity(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGcpSecurityList reads a list of values of the 'gcp_security' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGcpSecurityList(source interface{}) (items []*GcpSecurity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGcpSecurityList(iterator) + err = iterator.Error + return +} + +// ReadGcpSecurityList reads list of values of the ”gcp_security' type from +// the given iterator. +func ReadGcpSecurityList(iterator *jsoniter.Iterator) []*GcpSecurity { + list := []*GcpSecurity{} + for iterator.ReadArray() { + item := ReadGcpSecurity(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/gcp_security_type.go b/clientapi/clustersmgmt/v1/gcp_security_type.go new file mode 100644 index 00000000..a68a131b --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_security_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GcpSecurity represents the values of the 'gcp_security' type. +// +// Google cloud platform security settings of a cluster. +type GcpSecurity struct { + bitmap_ uint32 + secureBoot bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GcpSecurity) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// SecureBoot returns the value of the 'secure_boot' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Determines if Shielded VM feature "Secure Boot" should be set for the nodes of the cluster. +func (o *GcpSecurity) SecureBoot() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.secureBoot + } + return false +} + +// GetSecureBoot returns the value of the 'secure_boot' attribute and +// a flag indicating if the attribute has a value. +// +// Determines if Shielded VM feature "Secure Boot" should be set for the nodes of the cluster. +func (o *GcpSecurity) GetSecureBoot() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.secureBoot + } + return +} + +// GcpSecurityListKind is the name of the type used to represent list of objects of +// type 'gcp_security'. +const GcpSecurityListKind = "GcpSecurityList" + +// GcpSecurityListLinkKind is the name of the type used to represent links to list +// of objects of type 'gcp_security'. +const GcpSecurityListLinkKind = "GcpSecurityListLink" + +// GcpSecurityNilKind is the name of the type used to nil lists of objects of +// type 'gcp_security'. +const GcpSecurityListNilKind = "GcpSecurityListNil" + +// GcpSecurityList is a list of values of the 'gcp_security' type. +type GcpSecurityList struct { + href string + link bool + items []*GcpSecurity +} + +// Len returns the length of the list. +func (l *GcpSecurityList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GcpSecurityList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GcpSecurityList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GcpSecurityList) SetItems(items []*GcpSecurity) { + l.items = items +} + +// Items returns the items of the list. +func (l *GcpSecurityList) Items() []*GcpSecurity { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GcpSecurityList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GcpSecurityList) Get(i int) *GcpSecurity { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GcpSecurityList) Slice() []*GcpSecurity { + var slice []*GcpSecurity + if l == nil { + slice = make([]*GcpSecurity, 0) + } else { + slice = make([]*GcpSecurity, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GcpSecurityList) Each(f func(item *GcpSecurity) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GcpSecurityList) Range(f func(index int, item *GcpSecurity) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/gcp_security_type_json.go b/clientapi/clustersmgmt/v1/gcp_security_type_json.go new file mode 100644 index 00000000..879527a7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_security_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGcpSecurity writes a value of the 'gcp_security' type to the given writer. +func MarshalGcpSecurity(object *GcpSecurity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGcpSecurity(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGcpSecurity writes a value of the 'gcp_security' type to the given stream. +func WriteGcpSecurity(object *GcpSecurity, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("secure_boot") + stream.WriteBool(object.secureBoot) + } + stream.WriteObjectEnd() +} + +// UnmarshalGcpSecurity reads a value of the 'gcp_security' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGcpSecurity(source interface{}) (object *GcpSecurity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGcpSecurity(iterator) + err = iterator.Error + return +} + +// ReadGcpSecurity reads a value of the 'gcp_security' type from the given iterator. +func ReadGcpSecurity(iterator *jsoniter.Iterator) *GcpSecurity { + object := &GcpSecurity{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "secure_boot": + value := iterator.ReadBool() + object.secureBoot = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/gcp_type.go b/clientapi/clustersmgmt/v1/gcp_type.go new file mode 100644 index 00000000..312c6630 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_type.go @@ -0,0 +1,453 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCP represents the values of the 'GCP' type. +// +// Google cloud platform settings of a cluster. +type GCP struct { + bitmap_ uint32 + authURI string + authProviderX509CertURL string + authentication *GcpAuthentication + clientID string + clientX509CertURL string + clientEmail string + privateKey string + privateKeyID string + privateServiceConnect *GcpPrivateServiceConnect + projectID string + security *GcpSecurity + tokenURI string + type_ string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GCP) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AuthURI returns the value of the 'auth_URI' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP authentication uri +func (o *GCP) AuthURI() string { + if o != nil && o.bitmap_&1 != 0 { + return o.authURI + } + return "" +} + +// GetAuthURI returns the value of the 'auth_URI' attribute and +// a flag indicating if the attribute has a value. +// +// GCP authentication uri +func (o *GCP) GetAuthURI() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.authURI + } + return +} + +// AuthProviderX509CertURL returns the value of the 'auth_provider_X509_cert_URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP Authentication provider x509 certificate url +func (o *GCP) AuthProviderX509CertURL() string { + if o != nil && o.bitmap_&2 != 0 { + return o.authProviderX509CertURL + } + return "" +} + +// GetAuthProviderX509CertURL returns the value of the 'auth_provider_X509_cert_URL' attribute and +// a flag indicating if the attribute has a value. +// +// GCP Authentication provider x509 certificate url +func (o *GCP) GetAuthProviderX509CertURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.authProviderX509CertURL + } + return +} + +// Authentication returns the value of the 'authentication' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP Authentication Method +func (o *GCP) Authentication() *GcpAuthentication { + if o != nil && o.bitmap_&4 != 0 { + return o.authentication + } + return nil +} + +// GetAuthentication returns the value of the 'authentication' attribute and +// a flag indicating if the attribute has a value. +// +// GCP Authentication Method +func (o *GCP) GetAuthentication() (value *GcpAuthentication, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.authentication + } + return +} + +// ClientID returns the value of the 'client_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP client identifier +func (o *GCP) ClientID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clientID + } + return "" +} + +// GetClientID returns the value of the 'client_ID' attribute and +// a flag indicating if the attribute has a value. +// +// GCP client identifier +func (o *GCP) GetClientID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clientID + } + return +} + +// ClientX509CertURL returns the value of the 'client_X509_cert_URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP client x509 certificate url +func (o *GCP) ClientX509CertURL() string { + if o != nil && o.bitmap_&16 != 0 { + return o.clientX509CertURL + } + return "" +} + +// GetClientX509CertURL returns the value of the 'client_X509_cert_URL' attribute and +// a flag indicating if the attribute has a value. +// +// GCP client x509 certificate url +func (o *GCP) GetClientX509CertURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.clientX509CertURL + } + return +} + +// ClientEmail returns the value of the 'client_email' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP client email +func (o *GCP) ClientEmail() string { + if o != nil && o.bitmap_&32 != 0 { + return o.clientEmail + } + return "" +} + +// GetClientEmail returns the value of the 'client_email' attribute and +// a flag indicating if the attribute has a value. +// +// GCP client email +func (o *GCP) GetClientEmail() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.clientEmail + } + return +} + +// PrivateKey returns the value of the 'private_key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP private key +func (o *GCP) PrivateKey() string { + if o != nil && o.bitmap_&64 != 0 { + return o.privateKey + } + return "" +} + +// GetPrivateKey returns the value of the 'private_key' attribute and +// a flag indicating if the attribute has a value. +// +// GCP private key +func (o *GCP) GetPrivateKey() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.privateKey + } + return +} + +// PrivateKeyID returns the value of the 'private_key_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP private key identifier +func (o *GCP) PrivateKeyID() string { + if o != nil && o.bitmap_&128 != 0 { + return o.privateKeyID + } + return "" +} + +// GetPrivateKeyID returns the value of the 'private_key_ID' attribute and +// a flag indicating if the attribute has a value. +// +// GCP private key identifier +func (o *GCP) GetPrivateKeyID() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.privateKeyID + } + return +} + +// PrivateServiceConnect returns the value of the 'private_service_connect' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP PrivateServiceConnect configuration +func (o *GCP) PrivateServiceConnect() *GcpPrivateServiceConnect { + if o != nil && o.bitmap_&256 != 0 { + return o.privateServiceConnect + } + return nil +} + +// GetPrivateServiceConnect returns the value of the 'private_service_connect' attribute and +// a flag indicating if the attribute has a value. +// +// GCP PrivateServiceConnect configuration +func (o *GCP) GetPrivateServiceConnect() (value *GcpPrivateServiceConnect, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.privateServiceConnect + } + return +} + +// ProjectID returns the value of the 'project_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP project identifier. +func (o *GCP) ProjectID() string { + if o != nil && o.bitmap_&512 != 0 { + return o.projectID + } + return "" +} + +// GetProjectID returns the value of the 'project_ID' attribute and +// a flag indicating if the attribute has a value. +// +// GCP project identifier. +func (o *GCP) GetProjectID() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.projectID + } + return +} + +// Security returns the value of the 'security' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP Security Settings +func (o *GCP) Security() *GcpSecurity { + if o != nil && o.bitmap_&1024 != 0 { + return o.security + } + return nil +} + +// GetSecurity returns the value of the 'security' attribute and +// a flag indicating if the attribute has a value. +// +// GCP Security Settings +func (o *GCP) GetSecurity() (value *GcpSecurity, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.security + } + return +} + +// TokenURI returns the value of the 'token_URI' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP token uri +func (o *GCP) TokenURI() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.tokenURI + } + return "" +} + +// GetTokenURI returns the value of the 'token_URI' attribute and +// a flag indicating if the attribute has a value. +// +// GCP token uri +func (o *GCP) GetTokenURI() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.tokenURI + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP the type of the service the key belongs to +func (o *GCP) Type() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// GCP the type of the service the key belongs to +func (o *GCP) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.type_ + } + return +} + +// GCPListKind is the name of the type used to represent list of objects of +// type 'GCP'. +const GCPListKind = "GCPList" + +// GCPListLinkKind is the name of the type used to represent links to list +// of objects of type 'GCP'. +const GCPListLinkKind = "GCPListLink" + +// GCPNilKind is the name of the type used to nil lists of objects of +// type 'GCP'. +const GCPListNilKind = "GCPListNil" + +// GCPList is a list of values of the 'GCP' type. +type GCPList struct { + href string + link bool + items []*GCP +} + +// Len returns the length of the list. +func (l *GCPList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GCPList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GCPList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GCPList) SetItems(items []*GCP) { + l.items = items +} + +// Items returns the items of the list. +func (l *GCPList) Items() []*GCP { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GCPList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GCPList) Get(i int) *GCP { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GCPList) Slice() []*GCP { + var slice []*GCP + if l == nil { + slice = make([]*GCP, 0) + } else { + slice = make([]*GCP, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GCPList) Each(f func(item *GCP) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GCPList) Range(f func(index int, item *GCP) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/gcp_type_json.go b/clientapi/clustersmgmt/v1/gcp_type_json.go new file mode 100644 index 00000000..3ca9e89e --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_type_json.go @@ -0,0 +1,242 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCP writes a value of the 'GCP' type to the given writer. +func MarshalGCP(object *GCP, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCP(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCP writes a value of the 'GCP' type to the given stream. +func WriteGCP(object *GCP, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("auth_uri") + stream.WriteString(object.authURI) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("auth_provider_x509_cert_url") + stream.WriteString(object.authProviderX509CertURL) + count++ + } + present_ = object.bitmap_&4 != 0 && object.authentication != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("authentication") + WriteGcpAuthentication(object.authentication, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_id") + stream.WriteString(object.clientID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_x509_cert_url") + stream.WriteString(object.clientX509CertURL) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_email") + stream.WriteString(object.clientEmail) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_key") + stream.WriteString(object.privateKey) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_key_id") + stream.WriteString(object.privateKeyID) + count++ + } + present_ = object.bitmap_&256 != 0 && object.privateServiceConnect != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_service_connect") + WriteGcpPrivateServiceConnect(object.privateServiceConnect, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("project_id") + stream.WriteString(object.projectID) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.security != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("security") + WriteGcpSecurity(object.security, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("token_uri") + stream.WriteString(object.tokenURI) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalGCP reads a value of the 'GCP' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGCP(source interface{}) (object *GCP, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGCP(iterator) + err = iterator.Error + return +} + +// ReadGCP reads a value of the 'GCP' type from the given iterator. +func ReadGCP(iterator *jsoniter.Iterator) *GCP { + object := &GCP{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "auth_uri": + value := iterator.ReadString() + object.authURI = value + object.bitmap_ |= 1 + case "auth_provider_x509_cert_url": + value := iterator.ReadString() + object.authProviderX509CertURL = value + object.bitmap_ |= 2 + case "authentication": + value := ReadGcpAuthentication(iterator) + object.authentication = value + object.bitmap_ |= 4 + case "client_id": + value := iterator.ReadString() + object.clientID = value + object.bitmap_ |= 8 + case "client_x509_cert_url": + value := iterator.ReadString() + object.clientX509CertURL = value + object.bitmap_ |= 16 + case "client_email": + value := iterator.ReadString() + object.clientEmail = value + object.bitmap_ |= 32 + case "private_key": + value := iterator.ReadString() + object.privateKey = value + object.bitmap_ |= 64 + case "private_key_id": + value := iterator.ReadString() + object.privateKeyID = value + object.bitmap_ |= 128 + case "private_service_connect": + value := ReadGcpPrivateServiceConnect(iterator) + object.privateServiceConnect = value + object.bitmap_ |= 256 + case "project_id": + value := iterator.ReadString() + object.projectID = value + object.bitmap_ |= 512 + case "security": + value := ReadGcpSecurity(iterator) + object.security = value + object.bitmap_ |= 1024 + case "token_uri": + value := iterator.ReadString() + object.tokenURI = value + object.bitmap_ |= 2048 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 4096 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/gcp_volume_builder.go b/clientapi/clustersmgmt/v1/gcp_volume_builder.go new file mode 100644 index 00000000..d10987d6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_volume_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPVolumeBuilder contains the data and logic needed to build 'GCP_volume' objects. +// +// Holds settings for an GCP storage volume. +type GCPVolumeBuilder struct { + bitmap_ uint32 + size int +} + +// NewGCPVolume creates a new builder of 'GCP_volume' objects. +func NewGCPVolume() *GCPVolumeBuilder { + return &GCPVolumeBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GCPVolumeBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Size sets the value of the 'size' attribute to the given value. +func (b *GCPVolumeBuilder) Size(value int) *GCPVolumeBuilder { + b.size = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GCPVolumeBuilder) Copy(object *GCPVolume) *GCPVolumeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.size = object.size + return b +} + +// Build creates a 'GCP_volume' object using the configuration stored in the builder. +func (b *GCPVolumeBuilder) Build() (object *GCPVolume, err error) { + object = new(GCPVolume) + object.bitmap_ = b.bitmap_ + object.size = b.size + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_volume_list_builder.go b/clientapi/clustersmgmt/v1/gcp_volume_list_builder.go new file mode 100644 index 00000000..c18105fa --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_volume_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPVolumeListBuilder contains the data and logic needed to build +// 'GCP_volume' objects. +type GCPVolumeListBuilder struct { + items []*GCPVolumeBuilder +} + +// NewGCPVolumeList creates a new builder of 'GCP_volume' objects. +func NewGCPVolumeList() *GCPVolumeListBuilder { + return new(GCPVolumeListBuilder) +} + +// Items sets the items of the list. +func (b *GCPVolumeListBuilder) Items(values ...*GCPVolumeBuilder) *GCPVolumeListBuilder { + b.items = make([]*GCPVolumeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GCPVolumeListBuilder) 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 *GCPVolumeListBuilder) Copy(list *GCPVolumeList) *GCPVolumeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GCPVolumeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGCPVolume().Copy(v) + } + } + return b +} + +// Build creates a list of 'GCP_volume' objects using the +// configuration stored in the builder. +func (b *GCPVolumeListBuilder) Build() (list *GCPVolumeList, err error) { + items := make([]*GCPVolume, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GCPVolumeList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/gcp_volume_list_type_json.go b/clientapi/clustersmgmt/v1/gcp_volume_list_type_json.go new file mode 100644 index 00000000..ec62e2df --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_volume_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPVolumeList writes a list of values of the 'GCP_volume' type to +// the given writer. +func MarshalGCPVolumeList(list []*GCPVolume, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPVolumeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPVolumeList writes a list of value of the 'GCP_volume' type to +// the given stream. +func WriteGCPVolumeList(list []*GCPVolume, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGCPVolume(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGCPVolumeList reads a list of values of the 'GCP_volume' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGCPVolumeList(source interface{}) (items []*GCPVolume, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGCPVolumeList(iterator) + err = iterator.Error + return +} + +// ReadGCPVolumeList reads list of values of the ”GCP_volume' type from +// the given iterator. +func ReadGCPVolumeList(iterator *jsoniter.Iterator) []*GCPVolume { + list := []*GCPVolume{} + for iterator.ReadArray() { + item := ReadGCPVolume(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/gcp_volume_type.go b/clientapi/clustersmgmt/v1/gcp_volume_type.go new file mode 100644 index 00000000..a0f5cf23 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_volume_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GCPVolume represents the values of the 'GCP_volume' type. +// +// Holds settings for an GCP storage volume. +type GCPVolume struct { + bitmap_ uint32 + size int +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GCPVolume) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Size returns the value of the 'size' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Volume size in Gib. +func (o *GCPVolume) Size() int { + if o != nil && o.bitmap_&1 != 0 { + return o.size + } + return 0 +} + +// GetSize returns the value of the 'size' attribute and +// a flag indicating if the attribute has a value. +// +// Volume size in Gib. +func (o *GCPVolume) GetSize() (value int, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.size + } + return +} + +// GCPVolumeListKind is the name of the type used to represent list of objects of +// type 'GCP_volume'. +const GCPVolumeListKind = "GCPVolumeList" + +// GCPVolumeListLinkKind is the name of the type used to represent links to list +// of objects of type 'GCP_volume'. +const GCPVolumeListLinkKind = "GCPVolumeListLink" + +// GCPVolumeNilKind is the name of the type used to nil lists of objects of +// type 'GCP_volume'. +const GCPVolumeListNilKind = "GCPVolumeListNil" + +// GCPVolumeList is a list of values of the 'GCP_volume' type. +type GCPVolumeList struct { + href string + link bool + items []*GCPVolume +} + +// Len returns the length of the list. +func (l *GCPVolumeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GCPVolumeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GCPVolumeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GCPVolumeList) SetItems(items []*GCPVolume) { + l.items = items +} + +// Items returns the items of the list. +func (l *GCPVolumeList) Items() []*GCPVolume { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GCPVolumeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GCPVolumeList) Get(i int) *GCPVolume { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GCPVolumeList) Slice() []*GCPVolume { + var slice []*GCPVolume + if l == nil { + slice = make([]*GCPVolume, 0) + } else { + slice = make([]*GCPVolume, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GCPVolumeList) Each(f func(item *GCPVolume) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GCPVolumeList) Range(f func(index int, item *GCPVolume) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/gcp_volume_type_json.go b/clientapi/clustersmgmt/v1/gcp_volume_type_json.go new file mode 100644 index 00000000..1fab1034 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gcp_volume_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGCPVolume writes a value of the 'GCP_volume' type to the given writer. +func MarshalGCPVolume(object *GCPVolume, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGCPVolume(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGCPVolume writes a value of the 'GCP_volume' type to the given stream. +func WriteGCPVolume(object *GCPVolume, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("size") + stream.WriteInt(object.size) + } + stream.WriteObjectEnd() +} + +// UnmarshalGCPVolume reads a value of the 'GCP_volume' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGCPVolume(source interface{}) (object *GCPVolume, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGCPVolume(iterator) + err = iterator.Error + return +} + +// ReadGCPVolume reads a value of the 'GCP_volume' type from the given iterator. +func ReadGCPVolume(iterator *jsoniter.Iterator) *GCPVolume { + object := &GCPVolume{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "size": + value := iterator.ReadInt() + object.size = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/github_identity_provider_builder.go b/clientapi/clustersmgmt/v1/github_identity_provider_builder.go new file mode 100644 index 00000000..4512b713 --- /dev/null +++ b/clientapi/clustersmgmt/v1/github_identity_provider_builder.go @@ -0,0 +1,131 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GithubIdentityProviderBuilder contains the data and logic needed to build 'github_identity_provider' objects. +// +// Details for `github` identity providers. +type GithubIdentityProviderBuilder struct { + bitmap_ uint32 + ca string + clientID string + clientSecret string + hostname string + organizations []string + teams []string +} + +// NewGithubIdentityProvider creates a new builder of 'github_identity_provider' objects. +func NewGithubIdentityProvider() *GithubIdentityProviderBuilder { + return &GithubIdentityProviderBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GithubIdentityProviderBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// CA sets the value of the 'CA' attribute to the given value. +func (b *GithubIdentityProviderBuilder) CA(value string) *GithubIdentityProviderBuilder { + b.ca = value + b.bitmap_ |= 1 + return b +} + +// ClientID sets the value of the 'client_ID' attribute to the given value. +func (b *GithubIdentityProviderBuilder) ClientID(value string) *GithubIdentityProviderBuilder { + b.clientID = value + b.bitmap_ |= 2 + return b +} + +// ClientSecret sets the value of the 'client_secret' attribute to the given value. +func (b *GithubIdentityProviderBuilder) ClientSecret(value string) *GithubIdentityProviderBuilder { + b.clientSecret = value + b.bitmap_ |= 4 + return b +} + +// Hostname sets the value of the 'hostname' attribute to the given value. +func (b *GithubIdentityProviderBuilder) Hostname(value string) *GithubIdentityProviderBuilder { + b.hostname = value + b.bitmap_ |= 8 + return b +} + +// Organizations sets the value of the 'organizations' attribute to the given values. +func (b *GithubIdentityProviderBuilder) Organizations(values ...string) *GithubIdentityProviderBuilder { + b.organizations = make([]string, len(values)) + copy(b.organizations, values) + b.bitmap_ |= 16 + return b +} + +// Teams sets the value of the 'teams' attribute to the given values. +func (b *GithubIdentityProviderBuilder) Teams(values ...string) *GithubIdentityProviderBuilder { + b.teams = make([]string, len(values)) + copy(b.teams, values) + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GithubIdentityProviderBuilder) Copy(object *GithubIdentityProvider) *GithubIdentityProviderBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.ca = object.ca + b.clientID = object.clientID + b.clientSecret = object.clientSecret + b.hostname = object.hostname + if object.organizations != nil { + b.organizations = make([]string, len(object.organizations)) + copy(b.organizations, object.organizations) + } else { + b.organizations = nil + } + if object.teams != nil { + b.teams = make([]string, len(object.teams)) + copy(b.teams, object.teams) + } else { + b.teams = nil + } + return b +} + +// Build creates a 'github_identity_provider' object using the configuration stored in the builder. +func (b *GithubIdentityProviderBuilder) Build() (object *GithubIdentityProvider, err error) { + object = new(GithubIdentityProvider) + object.bitmap_ = b.bitmap_ + object.ca = b.ca + object.clientID = b.clientID + object.clientSecret = b.clientSecret + object.hostname = b.hostname + if b.organizations != nil { + object.organizations = make([]string, len(b.organizations)) + copy(object.organizations, b.organizations) + } + if b.teams != nil { + object.teams = make([]string, len(b.teams)) + copy(object.teams, b.teams) + } + return +} diff --git a/clientapi/clustersmgmt/v1/github_identity_provider_list_builder.go b/clientapi/clustersmgmt/v1/github_identity_provider_list_builder.go new file mode 100644 index 00000000..0b2ac733 --- /dev/null +++ b/clientapi/clustersmgmt/v1/github_identity_provider_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GithubIdentityProviderListBuilder contains the data and logic needed to build +// 'github_identity_provider' objects. +type GithubIdentityProviderListBuilder struct { + items []*GithubIdentityProviderBuilder +} + +// NewGithubIdentityProviderList creates a new builder of 'github_identity_provider' objects. +func NewGithubIdentityProviderList() *GithubIdentityProviderListBuilder { + return new(GithubIdentityProviderListBuilder) +} + +// Items sets the items of the list. +func (b *GithubIdentityProviderListBuilder) Items(values ...*GithubIdentityProviderBuilder) *GithubIdentityProviderListBuilder { + b.items = make([]*GithubIdentityProviderBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GithubIdentityProviderListBuilder) 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 *GithubIdentityProviderListBuilder) Copy(list *GithubIdentityProviderList) *GithubIdentityProviderListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GithubIdentityProviderBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGithubIdentityProvider().Copy(v) + } + } + return b +} + +// Build creates a list of 'github_identity_provider' objects using the +// configuration stored in the builder. +func (b *GithubIdentityProviderListBuilder) Build() (list *GithubIdentityProviderList, err error) { + items := make([]*GithubIdentityProvider, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GithubIdentityProviderList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/github_identity_provider_list_type_json.go b/clientapi/clustersmgmt/v1/github_identity_provider_list_type_json.go new file mode 100644 index 00000000..eba4d53f --- /dev/null +++ b/clientapi/clustersmgmt/v1/github_identity_provider_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGithubIdentityProviderList writes a list of values of the 'github_identity_provider' type to +// the given writer. +func MarshalGithubIdentityProviderList(list []*GithubIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGithubIdentityProviderList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGithubIdentityProviderList writes a list of value of the 'github_identity_provider' type to +// the given stream. +func WriteGithubIdentityProviderList(list []*GithubIdentityProvider, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGithubIdentityProvider(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGithubIdentityProviderList reads a list of values of the 'github_identity_provider' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGithubIdentityProviderList(source interface{}) (items []*GithubIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGithubIdentityProviderList(iterator) + err = iterator.Error + return +} + +// ReadGithubIdentityProviderList reads list of values of the ”github_identity_provider' type from +// the given iterator. +func ReadGithubIdentityProviderList(iterator *jsoniter.Iterator) []*GithubIdentityProvider { + list := []*GithubIdentityProvider{} + for iterator.ReadArray() { + item := ReadGithubIdentityProvider(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/github_identity_provider_type.go b/clientapi/clustersmgmt/v1/github_identity_provider_type.go new file mode 100644 index 00000000..4bafba03 --- /dev/null +++ b/clientapi/clustersmgmt/v1/github_identity_provider_type.go @@ -0,0 +1,293 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GithubIdentityProvider represents the values of the 'github_identity_provider' type. +// +// Details for `github` identity providers. +type GithubIdentityProvider struct { + bitmap_ uint32 + ca string + clientID string + clientSecret string + hostname string + organizations []string + teams []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GithubIdentityProvider) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// CA returns the value of the 'CA' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional trusted certificate authority bundle to use when making requests tot he server. +func (o *GithubIdentityProvider) CA() string { + if o != nil && o.bitmap_&1 != 0 { + return o.ca + } + return "" +} + +// GetCA returns the value of the 'CA' attribute and +// a flag indicating if the attribute has a value. +// +// Optional trusted certificate authority bundle to use when making requests tot he server. +func (o *GithubIdentityProvider) GetCA() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.ca + } + return +} + +// ClientID returns the value of the 'client_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Client identifier of a registered _GitHub_ OAuth application. +func (o *GithubIdentityProvider) ClientID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.clientID + } + return "" +} + +// GetClientID returns the value of the 'client_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Client identifier of a registered _GitHub_ OAuth application. +func (o *GithubIdentityProvider) GetClientID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.clientID + } + return +} + +// ClientSecret returns the value of the 'client_secret' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Client secret of a registered _GitHub_ OAuth application. +func (o *GithubIdentityProvider) ClientSecret() string { + if o != nil && o.bitmap_&4 != 0 { + return o.clientSecret + } + return "" +} + +// GetClientSecret returns the value of the 'client_secret' attribute and +// a flag indicating if the attribute has a value. +// +// Client secret of a registered _GitHub_ OAuth application. +func (o *GithubIdentityProvider) GetClientSecret() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.clientSecret + } + return +} + +// Hostname returns the value of the 'hostname' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// For _GitHub Enterprise_ you must provide the host name of your instance, such as +// `example.com`. This value must match the _GitHub Enterprise_ host name value in the +// `/setup/settings` file and cannot include a port number. +// +// For plain _GitHub_ omit this parameter. +func (o *GithubIdentityProvider) Hostname() string { + if o != nil && o.bitmap_&8 != 0 { + return o.hostname + } + return "" +} + +// GetHostname returns the value of the 'hostname' attribute and +// a flag indicating if the attribute has a value. +// +// For _GitHub Enterprise_ you must provide the host name of your instance, such as +// `example.com`. This value must match the _GitHub Enterprise_ host name value in the +// `/setup/settings` file and cannot include a port number. +// +// For plain _GitHub_ omit this parameter. +func (o *GithubIdentityProvider) GetHostname() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.hostname + } + return +} + +// Organizations returns the value of the 'organizations' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional list of organizations. Cannot be used in combination with the Teams field. +func (o *GithubIdentityProvider) Organizations() []string { + if o != nil && o.bitmap_&16 != 0 { + return o.organizations + } + return nil +} + +// GetOrganizations returns the value of the 'organizations' attribute and +// a flag indicating if the attribute has a value. +// +// Optional list of organizations. Cannot be used in combination with the Teams field. +func (o *GithubIdentityProvider) GetOrganizations() (value []string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.organizations + } + return +} + +// Teams returns the value of the 'teams' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional list of teams. Cannot be used in combination with the Organizations field. +func (o *GithubIdentityProvider) Teams() []string { + if o != nil && o.bitmap_&32 != 0 { + return o.teams + } + return nil +} + +// GetTeams returns the value of the 'teams' attribute and +// a flag indicating if the attribute has a value. +// +// Optional list of teams. Cannot be used in combination with the Organizations field. +func (o *GithubIdentityProvider) GetTeams() (value []string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.teams + } + return +} + +// GithubIdentityProviderListKind is the name of the type used to represent list of objects of +// type 'github_identity_provider'. +const GithubIdentityProviderListKind = "GithubIdentityProviderList" + +// GithubIdentityProviderListLinkKind is the name of the type used to represent links to list +// of objects of type 'github_identity_provider'. +const GithubIdentityProviderListLinkKind = "GithubIdentityProviderListLink" + +// GithubIdentityProviderNilKind is the name of the type used to nil lists of objects of +// type 'github_identity_provider'. +const GithubIdentityProviderListNilKind = "GithubIdentityProviderListNil" + +// GithubIdentityProviderList is a list of values of the 'github_identity_provider' type. +type GithubIdentityProviderList struct { + href string + link bool + items []*GithubIdentityProvider +} + +// Len returns the length of the list. +func (l *GithubIdentityProviderList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GithubIdentityProviderList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GithubIdentityProviderList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GithubIdentityProviderList) SetItems(items []*GithubIdentityProvider) { + l.items = items +} + +// Items returns the items of the list. +func (l *GithubIdentityProviderList) Items() []*GithubIdentityProvider { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GithubIdentityProviderList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GithubIdentityProviderList) Get(i int) *GithubIdentityProvider { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GithubIdentityProviderList) Slice() []*GithubIdentityProvider { + var slice []*GithubIdentityProvider + if l == nil { + slice = make([]*GithubIdentityProvider, 0) + } else { + slice = make([]*GithubIdentityProvider, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GithubIdentityProviderList) Each(f func(item *GithubIdentityProvider) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GithubIdentityProviderList) Range(f func(index int, item *GithubIdentityProvider) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/github_identity_provider_type_json.go b/clientapi/clustersmgmt/v1/github_identity_provider_type_json.go new file mode 100644 index 00000000..b2ba8a8f --- /dev/null +++ b/clientapi/clustersmgmt/v1/github_identity_provider_type_json.go @@ -0,0 +1,151 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGithubIdentityProvider writes a value of the 'github_identity_provider' type to the given writer. +func MarshalGithubIdentityProvider(object *GithubIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGithubIdentityProvider(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGithubIdentityProvider writes a value of the 'github_identity_provider' type to the given stream. +func WriteGithubIdentityProvider(object *GithubIdentityProvider, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ca") + stream.WriteString(object.ca) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_id") + stream.WriteString(object.clientID) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_secret") + stream.WriteString(object.clientSecret) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hostname") + stream.WriteString(object.hostname) + count++ + } + present_ = object.bitmap_&16 != 0 && object.organizations != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organizations") + WriteStringList(object.organizations, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.teams != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("teams") + WriteStringList(object.teams, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalGithubIdentityProvider reads a value of the 'github_identity_provider' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGithubIdentityProvider(source interface{}) (object *GithubIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGithubIdentityProvider(iterator) + err = iterator.Error + return +} + +// ReadGithubIdentityProvider reads a value of the 'github_identity_provider' type from the given iterator. +func ReadGithubIdentityProvider(iterator *jsoniter.Iterator) *GithubIdentityProvider { + object := &GithubIdentityProvider{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "ca": + value := iterator.ReadString() + object.ca = value + object.bitmap_ |= 1 + case "client_id": + value := iterator.ReadString() + object.clientID = value + object.bitmap_ |= 2 + case "client_secret": + value := iterator.ReadString() + object.clientSecret = value + object.bitmap_ |= 4 + case "hostname": + value := iterator.ReadString() + object.hostname = value + object.bitmap_ |= 8 + case "organizations": + value := ReadStringList(iterator) + object.organizations = value + object.bitmap_ |= 16 + case "teams": + value := ReadStringList(iterator) + object.teams = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/gitlab_identity_provider_builder.go b/clientapi/clustersmgmt/v1/gitlab_identity_provider_builder.go new file mode 100644 index 00000000..c600e247 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gitlab_identity_provider_builder.go @@ -0,0 +1,93 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GitlabIdentityProviderBuilder contains the data and logic needed to build 'gitlab_identity_provider' objects. +// +// Details for `gitlab` identity providers. +type GitlabIdentityProviderBuilder struct { + bitmap_ uint32 + ca string + url string + clientID string + clientSecret string +} + +// NewGitlabIdentityProvider creates a new builder of 'gitlab_identity_provider' objects. +func NewGitlabIdentityProvider() *GitlabIdentityProviderBuilder { + return &GitlabIdentityProviderBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GitlabIdentityProviderBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// CA sets the value of the 'CA' attribute to the given value. +func (b *GitlabIdentityProviderBuilder) CA(value string) *GitlabIdentityProviderBuilder { + b.ca = value + b.bitmap_ |= 1 + return b +} + +// URL sets the value of the 'URL' attribute to the given value. +func (b *GitlabIdentityProviderBuilder) URL(value string) *GitlabIdentityProviderBuilder { + b.url = value + b.bitmap_ |= 2 + return b +} + +// ClientID sets the value of the 'client_ID' attribute to the given value. +func (b *GitlabIdentityProviderBuilder) ClientID(value string) *GitlabIdentityProviderBuilder { + b.clientID = value + b.bitmap_ |= 4 + return b +} + +// ClientSecret sets the value of the 'client_secret' attribute to the given value. +func (b *GitlabIdentityProviderBuilder) ClientSecret(value string) *GitlabIdentityProviderBuilder { + b.clientSecret = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GitlabIdentityProviderBuilder) Copy(object *GitlabIdentityProvider) *GitlabIdentityProviderBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.ca = object.ca + b.url = object.url + b.clientID = object.clientID + b.clientSecret = object.clientSecret + return b +} + +// Build creates a 'gitlab_identity_provider' object using the configuration stored in the builder. +func (b *GitlabIdentityProviderBuilder) Build() (object *GitlabIdentityProvider, err error) { + object = new(GitlabIdentityProvider) + object.bitmap_ = b.bitmap_ + object.ca = b.ca + object.url = b.url + object.clientID = b.clientID + object.clientSecret = b.clientSecret + return +} diff --git a/clientapi/clustersmgmt/v1/gitlab_identity_provider_list_builder.go b/clientapi/clustersmgmt/v1/gitlab_identity_provider_list_builder.go new file mode 100644 index 00000000..22e45587 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gitlab_identity_provider_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GitlabIdentityProviderListBuilder contains the data and logic needed to build +// 'gitlab_identity_provider' objects. +type GitlabIdentityProviderListBuilder struct { + items []*GitlabIdentityProviderBuilder +} + +// NewGitlabIdentityProviderList creates a new builder of 'gitlab_identity_provider' objects. +func NewGitlabIdentityProviderList() *GitlabIdentityProviderListBuilder { + return new(GitlabIdentityProviderListBuilder) +} + +// Items sets the items of the list. +func (b *GitlabIdentityProviderListBuilder) Items(values ...*GitlabIdentityProviderBuilder) *GitlabIdentityProviderListBuilder { + b.items = make([]*GitlabIdentityProviderBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GitlabIdentityProviderListBuilder) 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 *GitlabIdentityProviderListBuilder) Copy(list *GitlabIdentityProviderList) *GitlabIdentityProviderListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GitlabIdentityProviderBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGitlabIdentityProvider().Copy(v) + } + } + return b +} + +// Build creates a list of 'gitlab_identity_provider' objects using the +// configuration stored in the builder. +func (b *GitlabIdentityProviderListBuilder) Build() (list *GitlabIdentityProviderList, err error) { + items := make([]*GitlabIdentityProvider, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GitlabIdentityProviderList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/gitlab_identity_provider_list_type_json.go b/clientapi/clustersmgmt/v1/gitlab_identity_provider_list_type_json.go new file mode 100644 index 00000000..662733b4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gitlab_identity_provider_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGitlabIdentityProviderList writes a list of values of the 'gitlab_identity_provider' type to +// the given writer. +func MarshalGitlabIdentityProviderList(list []*GitlabIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGitlabIdentityProviderList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGitlabIdentityProviderList writes a list of value of the 'gitlab_identity_provider' type to +// the given stream. +func WriteGitlabIdentityProviderList(list []*GitlabIdentityProvider, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGitlabIdentityProvider(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGitlabIdentityProviderList reads a list of values of the 'gitlab_identity_provider' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGitlabIdentityProviderList(source interface{}) (items []*GitlabIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGitlabIdentityProviderList(iterator) + err = iterator.Error + return +} + +// ReadGitlabIdentityProviderList reads list of values of the ”gitlab_identity_provider' type from +// the given iterator. +func ReadGitlabIdentityProviderList(iterator *jsoniter.Iterator) []*GitlabIdentityProvider { + list := []*GitlabIdentityProvider{} + for iterator.ReadArray() { + item := ReadGitlabIdentityProvider(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/gitlab_identity_provider_type.go b/clientapi/clustersmgmt/v1/gitlab_identity_provider_type.go new file mode 100644 index 00000000..144ff5d0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gitlab_identity_provider_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GitlabIdentityProvider represents the values of the 'gitlab_identity_provider' type. +// +// Details for `gitlab` identity providers. +type GitlabIdentityProvider struct { + bitmap_ uint32 + ca string + url string + clientID string + clientSecret string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GitlabIdentityProvider) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// CA returns the value of the 'CA' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional trusted certificate authority bundle to use when making requests tot he server. +func (o *GitlabIdentityProvider) CA() string { + if o != nil && o.bitmap_&1 != 0 { + return o.ca + } + return "" +} + +// GetCA returns the value of the 'CA' attribute and +// a flag indicating if the attribute has a value. +// +// Optional trusted certificate authority bundle to use when making requests tot he server. +func (o *GitlabIdentityProvider) GetCA() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.ca + } + return +} + +// URL returns the value of the 'URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// URL of the _GitLab_ instance. +func (o *GitlabIdentityProvider) URL() string { + if o != nil && o.bitmap_&2 != 0 { + return o.url + } + return "" +} + +// GetURL returns the value of the 'URL' attribute and +// a flag indicating if the attribute has a value. +// +// URL of the _GitLab_ instance. +func (o *GitlabIdentityProvider) GetURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.url + } + return +} + +// ClientID returns the value of the 'client_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Client identifier of a registered _GitLab_ OAuth application. +func (o *GitlabIdentityProvider) ClientID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.clientID + } + return "" +} + +// GetClientID returns the value of the 'client_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Client identifier of a registered _GitLab_ OAuth application. +func (o *GitlabIdentityProvider) GetClientID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.clientID + } + return +} + +// ClientSecret returns the value of the 'client_secret' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Client secret issued by _GitLab_. +func (o *GitlabIdentityProvider) ClientSecret() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clientSecret + } + return "" +} + +// GetClientSecret returns the value of the 'client_secret' attribute and +// a flag indicating if the attribute has a value. +// +// Client secret issued by _GitLab_. +func (o *GitlabIdentityProvider) GetClientSecret() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clientSecret + } + return +} + +// GitlabIdentityProviderListKind is the name of the type used to represent list of objects of +// type 'gitlab_identity_provider'. +const GitlabIdentityProviderListKind = "GitlabIdentityProviderList" + +// GitlabIdentityProviderListLinkKind is the name of the type used to represent links to list +// of objects of type 'gitlab_identity_provider'. +const GitlabIdentityProviderListLinkKind = "GitlabIdentityProviderListLink" + +// GitlabIdentityProviderNilKind is the name of the type used to nil lists of objects of +// type 'gitlab_identity_provider'. +const GitlabIdentityProviderListNilKind = "GitlabIdentityProviderListNil" + +// GitlabIdentityProviderList is a list of values of the 'gitlab_identity_provider' type. +type GitlabIdentityProviderList struct { + href string + link bool + items []*GitlabIdentityProvider +} + +// Len returns the length of the list. +func (l *GitlabIdentityProviderList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GitlabIdentityProviderList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GitlabIdentityProviderList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GitlabIdentityProviderList) SetItems(items []*GitlabIdentityProvider) { + l.items = items +} + +// Items returns the items of the list. +func (l *GitlabIdentityProviderList) Items() []*GitlabIdentityProvider { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GitlabIdentityProviderList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GitlabIdentityProviderList) Get(i int) *GitlabIdentityProvider { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GitlabIdentityProviderList) Slice() []*GitlabIdentityProvider { + var slice []*GitlabIdentityProvider + if l == nil { + slice = make([]*GitlabIdentityProvider, 0) + } else { + slice = make([]*GitlabIdentityProvider, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GitlabIdentityProviderList) Each(f func(item *GitlabIdentityProvider) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GitlabIdentityProviderList) Range(f func(index int, item *GitlabIdentityProvider) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/gitlab_identity_provider_type_json.go b/clientapi/clustersmgmt/v1/gitlab_identity_provider_type_json.go new file mode 100644 index 00000000..d0737117 --- /dev/null +++ b/clientapi/clustersmgmt/v1/gitlab_identity_provider_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGitlabIdentityProvider writes a value of the 'gitlab_identity_provider' type to the given writer. +func MarshalGitlabIdentityProvider(object *GitlabIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGitlabIdentityProvider(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGitlabIdentityProvider writes a value of the 'gitlab_identity_provider' type to the given stream. +func WriteGitlabIdentityProvider(object *GitlabIdentityProvider, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ca") + stream.WriteString(object.ca) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("url") + stream.WriteString(object.url) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_id") + stream.WriteString(object.clientID) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_secret") + stream.WriteString(object.clientSecret) + } + stream.WriteObjectEnd() +} + +// UnmarshalGitlabIdentityProvider reads a value of the 'gitlab_identity_provider' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGitlabIdentityProvider(source interface{}) (object *GitlabIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGitlabIdentityProvider(iterator) + err = iterator.Error + return +} + +// ReadGitlabIdentityProvider reads a value of the 'gitlab_identity_provider' type from the given iterator. +func ReadGitlabIdentityProvider(iterator *jsoniter.Iterator) *GitlabIdentityProvider { + object := &GitlabIdentityProvider{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "ca": + value := iterator.ReadString() + object.ca = value + object.bitmap_ |= 1 + case "url": + value := iterator.ReadString() + object.url = value + object.bitmap_ |= 2 + case "client_id": + value := iterator.ReadString() + object.clientID = value + object.bitmap_ |= 4 + case "client_secret": + value := iterator.ReadString() + object.clientSecret = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/google_identity_provider_builder.go b/clientapi/clustersmgmt/v1/google_identity_provider_builder.go new file mode 100644 index 00000000..2080e788 --- /dev/null +++ b/clientapi/clustersmgmt/v1/google_identity_provider_builder.go @@ -0,0 +1,83 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GoogleIdentityProviderBuilder contains the data and logic needed to build 'google_identity_provider' objects. +// +// Details for `google` identity providers. +type GoogleIdentityProviderBuilder struct { + bitmap_ uint32 + clientID string + clientSecret string + hostedDomain string +} + +// NewGoogleIdentityProvider creates a new builder of 'google_identity_provider' objects. +func NewGoogleIdentityProvider() *GoogleIdentityProviderBuilder { + return &GoogleIdentityProviderBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GoogleIdentityProviderBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ClientID sets the value of the 'client_ID' attribute to the given value. +func (b *GoogleIdentityProviderBuilder) ClientID(value string) *GoogleIdentityProviderBuilder { + b.clientID = value + b.bitmap_ |= 1 + return b +} + +// ClientSecret sets the value of the 'client_secret' attribute to the given value. +func (b *GoogleIdentityProviderBuilder) ClientSecret(value string) *GoogleIdentityProviderBuilder { + b.clientSecret = value + b.bitmap_ |= 2 + return b +} + +// HostedDomain sets the value of the 'hosted_domain' attribute to the given value. +func (b *GoogleIdentityProviderBuilder) HostedDomain(value string) *GoogleIdentityProviderBuilder { + b.hostedDomain = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GoogleIdentityProviderBuilder) Copy(object *GoogleIdentityProvider) *GoogleIdentityProviderBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.clientID = object.clientID + b.clientSecret = object.clientSecret + b.hostedDomain = object.hostedDomain + return b +} + +// Build creates a 'google_identity_provider' object using the configuration stored in the builder. +func (b *GoogleIdentityProviderBuilder) Build() (object *GoogleIdentityProvider, err error) { + object = new(GoogleIdentityProvider) + object.bitmap_ = b.bitmap_ + object.clientID = b.clientID + object.clientSecret = b.clientSecret + object.hostedDomain = b.hostedDomain + return +} diff --git a/clientapi/clustersmgmt/v1/google_identity_provider_list_builder.go b/clientapi/clustersmgmt/v1/google_identity_provider_list_builder.go new file mode 100644 index 00000000..431dba3f --- /dev/null +++ b/clientapi/clustersmgmt/v1/google_identity_provider_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GoogleIdentityProviderListBuilder contains the data and logic needed to build +// 'google_identity_provider' objects. +type GoogleIdentityProviderListBuilder struct { + items []*GoogleIdentityProviderBuilder +} + +// NewGoogleIdentityProviderList creates a new builder of 'google_identity_provider' objects. +func NewGoogleIdentityProviderList() *GoogleIdentityProviderListBuilder { + return new(GoogleIdentityProviderListBuilder) +} + +// Items sets the items of the list. +func (b *GoogleIdentityProviderListBuilder) Items(values ...*GoogleIdentityProviderBuilder) *GoogleIdentityProviderListBuilder { + b.items = make([]*GoogleIdentityProviderBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GoogleIdentityProviderListBuilder) 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 *GoogleIdentityProviderListBuilder) Copy(list *GoogleIdentityProviderList) *GoogleIdentityProviderListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GoogleIdentityProviderBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGoogleIdentityProvider().Copy(v) + } + } + return b +} + +// Build creates a list of 'google_identity_provider' objects using the +// configuration stored in the builder. +func (b *GoogleIdentityProviderListBuilder) Build() (list *GoogleIdentityProviderList, err error) { + items := make([]*GoogleIdentityProvider, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GoogleIdentityProviderList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/google_identity_provider_list_type_json.go b/clientapi/clustersmgmt/v1/google_identity_provider_list_type_json.go new file mode 100644 index 00000000..769266fb --- /dev/null +++ b/clientapi/clustersmgmt/v1/google_identity_provider_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGoogleIdentityProviderList writes a list of values of the 'google_identity_provider' type to +// the given writer. +func MarshalGoogleIdentityProviderList(list []*GoogleIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGoogleIdentityProviderList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGoogleIdentityProviderList writes a list of value of the 'google_identity_provider' type to +// the given stream. +func WriteGoogleIdentityProviderList(list []*GoogleIdentityProvider, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGoogleIdentityProvider(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGoogleIdentityProviderList reads a list of values of the 'google_identity_provider' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGoogleIdentityProviderList(source interface{}) (items []*GoogleIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGoogleIdentityProviderList(iterator) + err = iterator.Error + return +} + +// ReadGoogleIdentityProviderList reads list of values of the ”google_identity_provider' type from +// the given iterator. +func ReadGoogleIdentityProviderList(iterator *jsoniter.Iterator) []*GoogleIdentityProvider { + list := []*GoogleIdentityProvider{} + for iterator.ReadArray() { + item := ReadGoogleIdentityProvider(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/google_identity_provider_type.go b/clientapi/clustersmgmt/v1/google_identity_provider_type.go new file mode 100644 index 00000000..1ebb8d97 --- /dev/null +++ b/clientapi/clustersmgmt/v1/google_identity_provider_type.go @@ -0,0 +1,213 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GoogleIdentityProvider represents the values of the 'google_identity_provider' type. +// +// Details for `google` identity providers. +type GoogleIdentityProvider struct { + bitmap_ uint32 + clientID string + clientSecret string + hostedDomain string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GoogleIdentityProvider) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ClientID returns the value of the 'client_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Client identifier of a registered _Google_ project. +func (o *GoogleIdentityProvider) ClientID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.clientID + } + return "" +} + +// GetClientID returns the value of the 'client_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Client identifier of a registered _Google_ project. +func (o *GoogleIdentityProvider) GetClientID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.clientID + } + return +} + +// ClientSecret returns the value of the 'client_secret' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Client secret issued by _Google_. +func (o *GoogleIdentityProvider) ClientSecret() string { + if o != nil && o.bitmap_&2 != 0 { + return o.clientSecret + } + return "" +} + +// GetClientSecret returns the value of the 'client_secret' attribute and +// a flag indicating if the attribute has a value. +// +// Client secret issued by _Google_. +func (o *GoogleIdentityProvider) GetClientSecret() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.clientSecret + } + return +} + +// HostedDomain returns the value of the 'hosted_domain' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional hosted domain to restrict sign-in accounts to. +func (o *GoogleIdentityProvider) HostedDomain() string { + if o != nil && o.bitmap_&4 != 0 { + return o.hostedDomain + } + return "" +} + +// GetHostedDomain returns the value of the 'hosted_domain' attribute and +// a flag indicating if the attribute has a value. +// +// Optional hosted domain to restrict sign-in accounts to. +func (o *GoogleIdentityProvider) GetHostedDomain() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.hostedDomain + } + return +} + +// GoogleIdentityProviderListKind is the name of the type used to represent list of objects of +// type 'google_identity_provider'. +const GoogleIdentityProviderListKind = "GoogleIdentityProviderList" + +// GoogleIdentityProviderListLinkKind is the name of the type used to represent links to list +// of objects of type 'google_identity_provider'. +const GoogleIdentityProviderListLinkKind = "GoogleIdentityProviderListLink" + +// GoogleIdentityProviderNilKind is the name of the type used to nil lists of objects of +// type 'google_identity_provider'. +const GoogleIdentityProviderListNilKind = "GoogleIdentityProviderListNil" + +// GoogleIdentityProviderList is a list of values of the 'google_identity_provider' type. +type GoogleIdentityProviderList struct { + href string + link bool + items []*GoogleIdentityProvider +} + +// Len returns the length of the list. +func (l *GoogleIdentityProviderList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GoogleIdentityProviderList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GoogleIdentityProviderList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GoogleIdentityProviderList) SetItems(items []*GoogleIdentityProvider) { + l.items = items +} + +// Items returns the items of the list. +func (l *GoogleIdentityProviderList) Items() []*GoogleIdentityProvider { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GoogleIdentityProviderList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GoogleIdentityProviderList) Get(i int) *GoogleIdentityProvider { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GoogleIdentityProviderList) Slice() []*GoogleIdentityProvider { + var slice []*GoogleIdentityProvider + if l == nil { + slice = make([]*GoogleIdentityProvider, 0) + } else { + slice = make([]*GoogleIdentityProvider, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GoogleIdentityProviderList) Each(f func(item *GoogleIdentityProvider) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GoogleIdentityProviderList) Range(f func(index int, item *GoogleIdentityProvider) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/google_identity_provider_type_json.go b/clientapi/clustersmgmt/v1/google_identity_provider_type_json.go new file mode 100644 index 00000000..503d630f --- /dev/null +++ b/clientapi/clustersmgmt/v1/google_identity_provider_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGoogleIdentityProvider writes a value of the 'google_identity_provider' type to the given writer. +func MarshalGoogleIdentityProvider(object *GoogleIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGoogleIdentityProvider(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGoogleIdentityProvider writes a value of the 'google_identity_provider' type to the given stream. +func WriteGoogleIdentityProvider(object *GoogleIdentityProvider, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_id") + stream.WriteString(object.clientID) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_secret") + stream.WriteString(object.clientSecret) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hosted_domain") + stream.WriteString(object.hostedDomain) + } + stream.WriteObjectEnd() +} + +// UnmarshalGoogleIdentityProvider reads a value of the 'google_identity_provider' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGoogleIdentityProvider(source interface{}) (object *GoogleIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGoogleIdentityProvider(iterator) + err = iterator.Error + return +} + +// ReadGoogleIdentityProvider reads a value of the 'google_identity_provider' type from the given iterator. +func ReadGoogleIdentityProvider(iterator *jsoniter.Iterator) *GoogleIdentityProvider { + object := &GoogleIdentityProvider{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "client_id": + value := iterator.ReadString() + object.clientID = value + object.bitmap_ |= 1 + case "client_secret": + value := iterator.ReadString() + object.clientSecret = value + object.bitmap_ |= 2 + case "hosted_domain": + value := iterator.ReadString() + object.hostedDomain = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/group_builder.go b/clientapi/clustersmgmt/v1/group_builder.go new file mode 100644 index 00000000..848a24bc --- /dev/null +++ b/clientapi/clustersmgmt/v1/group_builder.go @@ -0,0 +1,98 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GroupBuilder contains the data and logic needed to build 'group' objects. +// +// Representation of a group of users. +type GroupBuilder struct { + bitmap_ uint32 + id string + href string + users *UserListBuilder +} + +// NewGroup creates a new builder of 'group' objects. +func NewGroup() *GroupBuilder { + return &GroupBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *GroupBuilder) Link(value bool) *GroupBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *GroupBuilder) ID(value string) *GroupBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *GroupBuilder) HREF(value string) *GroupBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GroupBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Users sets the value of the 'users' attribute to the given values. +func (b *GroupBuilder) Users(value *UserListBuilder) *GroupBuilder { + b.users = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GroupBuilder) Copy(object *Group) *GroupBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.users != nil { + b.users = NewUserList().Copy(object.users) + } else { + b.users = nil + } + return b +} + +// Build creates a 'group' object using the configuration stored in the builder. +func (b *GroupBuilder) Build() (object *Group, err error) { + object = new(Group) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.users != nil { + object.users, err = b.users.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/group_list_builder.go b/clientapi/clustersmgmt/v1/group_list_builder.go new file mode 100644 index 00000000..fc17e730 --- /dev/null +++ b/clientapi/clustersmgmt/v1/group_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GroupListBuilder contains the data and logic needed to build +// 'group' objects. +type GroupListBuilder struct { + items []*GroupBuilder +} + +// NewGroupList creates a new builder of 'group' objects. +func NewGroupList() *GroupListBuilder { + return new(GroupListBuilder) +} + +// Items sets the items of the list. +func (b *GroupListBuilder) Items(values ...*GroupBuilder) *GroupListBuilder { + b.items = make([]*GroupBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GroupListBuilder) 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 *GroupListBuilder) Copy(list *GroupList) *GroupListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GroupBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGroup().Copy(v) + } + } + return b +} + +// Build creates a list of 'group' objects using the +// configuration stored in the builder. +func (b *GroupListBuilder) Build() (list *GroupList, err error) { + items := make([]*Group, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GroupList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/group_list_type_json.go b/clientapi/clustersmgmt/v1/group_list_type_json.go new file mode 100644 index 00000000..c913b0e0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/group_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGroupList writes a list of values of the 'group' type to +// the given writer. +func MarshalGroupList(list []*Group, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGroupList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGroupList writes a list of value of the 'group' type to +// the given stream. +func WriteGroupList(list []*Group, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGroup(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGroupList reads a list of values of the 'group' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGroupList(source interface{}) (items []*Group, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGroupList(iterator) + err = iterator.Error + return +} + +// ReadGroupList reads list of values of the ”group' type from +// the given iterator. +func ReadGroupList(iterator *jsoniter.Iterator) []*Group { + list := []*Group{} + for iterator.ReadArray() { + item := ReadGroup(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/group_type.go b/clientapi/clustersmgmt/v1/group_type.go new file mode 100644 index 00000000..5e7826cf --- /dev/null +++ b/clientapi/clustersmgmt/v1/group_type.go @@ -0,0 +1,265 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GroupKind is the name of the type used to represent objects +// of type 'group'. +const GroupKind = "Group" + +// GroupLinkKind is the name of the type used to represent links +// to objects of type 'group'. +const GroupLinkKind = "GroupLink" + +// GroupNilKind is the name of the type used to nil references +// to objects of type 'group'. +const GroupNilKind = "GroupNil" + +// Group represents the values of the 'group' type. +// +// Representation of a group of users. +type Group struct { + bitmap_ uint32 + id string + href string + users *UserList +} + +// Kind returns the name of the type of the object. +func (o *Group) Kind() string { + if o == nil { + return GroupNilKind + } + if o.bitmap_&1 != 0 { + return GroupLinkKind + } + return GroupKind +} + +// Link returns true if this is a link. +func (o *Group) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Group) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Group) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Group) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Group) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Group) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Users returns the value of the 'users' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of users of the group. +func (o *Group) Users() *UserList { + if o != nil && o.bitmap_&8 != 0 { + return o.users + } + return nil +} + +// GetUsers returns the value of the 'users' attribute and +// a flag indicating if the attribute has a value. +// +// List of users of the group. +func (o *Group) GetUsers() (value *UserList, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.users + } + return +} + +// GroupListKind is the name of the type used to represent list of objects of +// type 'group'. +const GroupListKind = "GroupList" + +// GroupListLinkKind is the name of the type used to represent links to list +// of objects of type 'group'. +const GroupListLinkKind = "GroupListLink" + +// GroupNilKind is the name of the type used to nil lists of objects of +// type 'group'. +const GroupListNilKind = "GroupListNil" + +// GroupList is a list of values of the 'group' type. +type GroupList struct { + href string + link bool + items []*Group +} + +// Kind returns the name of the type of the object. +func (l *GroupList) Kind() string { + if l == nil { + return GroupListNilKind + } + if l.link { + return GroupListLinkKind + } + return GroupListKind +} + +// Link returns true iif this is a link. +func (l *GroupList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *GroupList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *GroupList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *GroupList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GroupList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GroupList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GroupList) SetItems(items []*Group) { + l.items = items +} + +// Items returns the items of the list. +func (l *GroupList) Items() []*Group { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GroupList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GroupList) Get(i int) *Group { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GroupList) Slice() []*Group { + var slice []*Group + if l == nil { + slice = make([]*Group, 0) + } else { + slice = make([]*Group, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GroupList) Each(f func(item *Group) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GroupList) Range(f func(index int, item *Group) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/group_type_json.go b/clientapi/clustersmgmt/v1/group_type_json.go new file mode 100644 index 00000000..70e7ffa3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/group_type_json.go @@ -0,0 +1,140 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGroup writes a value of the 'group' type to the given writer. +func MarshalGroup(object *Group, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGroup(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGroup writes a value of the 'group' type to the given stream. +func WriteGroup(object *Group, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(GroupLinkKind) + } else { + stream.WriteString(GroupKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.users != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("users") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteUserList(object.users.Items(), stream) + stream.WriteObjectEnd() + } + stream.WriteObjectEnd() +} + +// UnmarshalGroup reads a value of the 'group' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGroup(source interface{}) (object *Group, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGroup(iterator) + err = iterator.Error + return +} + +// ReadGroup reads a value of the 'group' type from the given iterator. +func ReadGroup(iterator *jsoniter.Iterator) *Group { + object := &Group{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == GroupLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "users": + value := &UserList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == UserListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadUserList(iterator)) + default: + iterator.ReadAny() + } + } + object.users = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/groups_claim_builder.go b/clientapi/clustersmgmt/v1/groups_claim_builder.go new file mode 100644 index 00000000..f74d63ff --- /dev/null +++ b/clientapi/clustersmgmt/v1/groups_claim_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GroupsClaimBuilder contains the data and logic needed to build 'groups_claim' objects. +type GroupsClaimBuilder struct { + bitmap_ uint32 + claim string + prefix string +} + +// NewGroupsClaim creates a new builder of 'groups_claim' objects. +func NewGroupsClaim() *GroupsClaimBuilder { + return &GroupsClaimBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *GroupsClaimBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Claim sets the value of the 'claim' attribute to the given value. +func (b *GroupsClaimBuilder) Claim(value string) *GroupsClaimBuilder { + b.claim = value + b.bitmap_ |= 1 + return b +} + +// Prefix sets the value of the 'prefix' attribute to the given value. +func (b *GroupsClaimBuilder) Prefix(value string) *GroupsClaimBuilder { + b.prefix = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *GroupsClaimBuilder) Copy(object *GroupsClaim) *GroupsClaimBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.claim = object.claim + b.prefix = object.prefix + return b +} + +// Build creates a 'groups_claim' object using the configuration stored in the builder. +func (b *GroupsClaimBuilder) Build() (object *GroupsClaim, err error) { + object = new(GroupsClaim) + object.bitmap_ = b.bitmap_ + object.claim = b.claim + object.prefix = b.prefix + return +} diff --git a/clientapi/clustersmgmt/v1/groups_claim_list_builder.go b/clientapi/clustersmgmt/v1/groups_claim_list_builder.go new file mode 100644 index 00000000..53a883d7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/groups_claim_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GroupsClaimListBuilder contains the data and logic needed to build +// 'groups_claim' objects. +type GroupsClaimListBuilder struct { + items []*GroupsClaimBuilder +} + +// NewGroupsClaimList creates a new builder of 'groups_claim' objects. +func NewGroupsClaimList() *GroupsClaimListBuilder { + return new(GroupsClaimListBuilder) +} + +// Items sets the items of the list. +func (b *GroupsClaimListBuilder) Items(values ...*GroupsClaimBuilder) *GroupsClaimListBuilder { + b.items = make([]*GroupsClaimBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *GroupsClaimListBuilder) 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 *GroupsClaimListBuilder) Copy(list *GroupsClaimList) *GroupsClaimListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*GroupsClaimBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewGroupsClaim().Copy(v) + } + } + return b +} + +// Build creates a list of 'groups_claim' objects using the +// configuration stored in the builder. +func (b *GroupsClaimListBuilder) Build() (list *GroupsClaimList, err error) { + items := make([]*GroupsClaim, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(GroupsClaimList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/groups_claim_list_type_json.go b/clientapi/clustersmgmt/v1/groups_claim_list_type_json.go new file mode 100644 index 00000000..dabb455a --- /dev/null +++ b/clientapi/clustersmgmt/v1/groups_claim_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGroupsClaimList writes a list of values of the 'groups_claim' type to +// the given writer. +func MarshalGroupsClaimList(list []*GroupsClaim, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGroupsClaimList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGroupsClaimList writes a list of value of the 'groups_claim' type to +// the given stream. +func WriteGroupsClaimList(list []*GroupsClaim, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteGroupsClaim(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalGroupsClaimList reads a list of values of the 'groups_claim' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalGroupsClaimList(source interface{}) (items []*GroupsClaim, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadGroupsClaimList(iterator) + err = iterator.Error + return +} + +// ReadGroupsClaimList reads list of values of the ”groups_claim' type from +// the given iterator. +func ReadGroupsClaimList(iterator *jsoniter.Iterator) []*GroupsClaim { + list := []*GroupsClaim{} + for iterator.ReadArray() { + item := ReadGroupsClaim(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/groups_claim_type.go b/clientapi/clustersmgmt/v1/groups_claim_type.go new file mode 100644 index 00000000..66e195ca --- /dev/null +++ b/clientapi/clustersmgmt/v1/groups_claim_type.go @@ -0,0 +1,187 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// GroupsClaim represents the values of the 'groups_claim' type. +type GroupsClaim struct { + bitmap_ uint32 + claim string + prefix string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *GroupsClaim) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Claim returns the value of the 'claim' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The claim used in the token. +func (o *GroupsClaim) Claim() string { + if o != nil && o.bitmap_&1 != 0 { + return o.claim + } + return "" +} + +// GetClaim returns the value of the 'claim' attribute and +// a flag indicating if the attribute has a value. +// +// The claim used in the token. +func (o *GroupsClaim) GetClaim() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.claim + } + return +} + +// Prefix returns the value of the 'prefix' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// A prefix contatenated in the claim (Optional). +func (o *GroupsClaim) Prefix() string { + if o != nil && o.bitmap_&2 != 0 { + return o.prefix + } + return "" +} + +// GetPrefix returns the value of the 'prefix' attribute and +// a flag indicating if the attribute has a value. +// +// A prefix contatenated in the claim (Optional). +func (o *GroupsClaim) GetPrefix() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.prefix + } + return +} + +// GroupsClaimListKind is the name of the type used to represent list of objects of +// type 'groups_claim'. +const GroupsClaimListKind = "GroupsClaimList" + +// GroupsClaimListLinkKind is the name of the type used to represent links to list +// of objects of type 'groups_claim'. +const GroupsClaimListLinkKind = "GroupsClaimListLink" + +// GroupsClaimNilKind is the name of the type used to nil lists of objects of +// type 'groups_claim'. +const GroupsClaimListNilKind = "GroupsClaimListNil" + +// GroupsClaimList is a list of values of the 'groups_claim' type. +type GroupsClaimList struct { + href string + link bool + items []*GroupsClaim +} + +// Len returns the length of the list. +func (l *GroupsClaimList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *GroupsClaimList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *GroupsClaimList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *GroupsClaimList) SetItems(items []*GroupsClaim) { + l.items = items +} + +// Items returns the items of the list. +func (l *GroupsClaimList) Items() []*GroupsClaim { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *GroupsClaimList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *GroupsClaimList) Get(i int) *GroupsClaim { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *GroupsClaimList) Slice() []*GroupsClaim { + var slice []*GroupsClaim + if l == nil { + slice = make([]*GroupsClaim, 0) + } else { + slice = make([]*GroupsClaim, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *GroupsClaimList) Each(f func(item *GroupsClaim) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *GroupsClaimList) Range(f func(index int, item *GroupsClaim) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/groups_claim_type_json.go b/clientapi/clustersmgmt/v1/groups_claim_type_json.go new file mode 100644 index 00000000..bc7681d2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/groups_claim_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalGroupsClaim writes a value of the 'groups_claim' type to the given writer. +func MarshalGroupsClaim(object *GroupsClaim, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteGroupsClaim(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteGroupsClaim writes a value of the 'groups_claim' type to the given stream. +func WriteGroupsClaim(object *GroupsClaim, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("claim") + stream.WriteString(object.claim) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("prefix") + stream.WriteString(object.prefix) + } + stream.WriteObjectEnd() +} + +// UnmarshalGroupsClaim reads a value of the 'groups_claim' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalGroupsClaim(source interface{}) (object *GroupsClaim, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadGroupsClaim(iterator) + err = iterator.Error + return +} + +// ReadGroupsClaim reads a value of the 'groups_claim' type from the given iterator. +func ReadGroupsClaim(iterator *jsoniter.Iterator) *GroupsClaim { + object := &GroupsClaim{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "claim": + value := iterator.ReadString() + object.claim = value + object.bitmap_ |= 1 + case "prefix": + value := iterator.ReadString() + object.prefix = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_builder.go b/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_builder.go new file mode 100644 index 00000000..388c215b --- /dev/null +++ b/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_builder.go @@ -0,0 +1,92 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// HTPasswdIdentityProviderBuilder contains the data and logic needed to build 'HT_passwd_identity_provider' objects. +// +// Details for `htpasswd` identity providers. +type HTPasswdIdentityProviderBuilder struct { + bitmap_ uint32 + password string + username string + users *HTPasswdUserListBuilder +} + +// NewHTPasswdIdentityProvider creates a new builder of 'HT_passwd_identity_provider' objects. +func NewHTPasswdIdentityProvider() *HTPasswdIdentityProviderBuilder { + return &HTPasswdIdentityProviderBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *HTPasswdIdentityProviderBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Password sets the value of the 'password' attribute to the given value. +func (b *HTPasswdIdentityProviderBuilder) Password(value string) *HTPasswdIdentityProviderBuilder { + b.password = value + b.bitmap_ |= 1 + return b +} + +// Username sets the value of the 'username' attribute to the given value. +func (b *HTPasswdIdentityProviderBuilder) Username(value string) *HTPasswdIdentityProviderBuilder { + b.username = value + b.bitmap_ |= 2 + return b +} + +// Users sets the value of the 'users' attribute to the given values. +func (b *HTPasswdIdentityProviderBuilder) Users(value *HTPasswdUserListBuilder) *HTPasswdIdentityProviderBuilder { + b.users = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *HTPasswdIdentityProviderBuilder) Copy(object *HTPasswdIdentityProvider) *HTPasswdIdentityProviderBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.password = object.password + b.username = object.username + if object.users != nil { + b.users = NewHTPasswdUserList().Copy(object.users) + } else { + b.users = nil + } + return b +} + +// Build creates a 'HT_passwd_identity_provider' object using the configuration stored in the builder. +func (b *HTPasswdIdentityProviderBuilder) Build() (object *HTPasswdIdentityProvider, err error) { + object = new(HTPasswdIdentityProvider) + object.bitmap_ = b.bitmap_ + object.password = b.password + object.username = b.username + if b.users != nil { + object.users, err = b.users.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_list_builder.go b/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_list_builder.go new file mode 100644 index 00000000..1bd95d1e --- /dev/null +++ b/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// HTPasswdIdentityProviderListBuilder contains the data and logic needed to build +// 'HT_passwd_identity_provider' objects. +type HTPasswdIdentityProviderListBuilder struct { + items []*HTPasswdIdentityProviderBuilder +} + +// NewHTPasswdIdentityProviderList creates a new builder of 'HT_passwd_identity_provider' objects. +func NewHTPasswdIdentityProviderList() *HTPasswdIdentityProviderListBuilder { + return new(HTPasswdIdentityProviderListBuilder) +} + +// Items sets the items of the list. +func (b *HTPasswdIdentityProviderListBuilder) Items(values ...*HTPasswdIdentityProviderBuilder) *HTPasswdIdentityProviderListBuilder { + b.items = make([]*HTPasswdIdentityProviderBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *HTPasswdIdentityProviderListBuilder) 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 *HTPasswdIdentityProviderListBuilder) Copy(list *HTPasswdIdentityProviderList) *HTPasswdIdentityProviderListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*HTPasswdIdentityProviderBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewHTPasswdIdentityProvider().Copy(v) + } + } + return b +} + +// Build creates a list of 'HT_passwd_identity_provider' objects using the +// configuration stored in the builder. +func (b *HTPasswdIdentityProviderListBuilder) Build() (list *HTPasswdIdentityProviderList, err error) { + items := make([]*HTPasswdIdentityProvider, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(HTPasswdIdentityProviderList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_list_type_json.go b/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_list_type_json.go new file mode 100644 index 00000000..b8558c81 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalHTPasswdIdentityProviderList writes a list of values of the 'HT_passwd_identity_provider' type to +// the given writer. +func MarshalHTPasswdIdentityProviderList(list []*HTPasswdIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHTPasswdIdentityProviderList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHTPasswdIdentityProviderList writes a list of value of the 'HT_passwd_identity_provider' type to +// the given stream. +func WriteHTPasswdIdentityProviderList(list []*HTPasswdIdentityProvider, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteHTPasswdIdentityProvider(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalHTPasswdIdentityProviderList reads a list of values of the 'HT_passwd_identity_provider' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalHTPasswdIdentityProviderList(source interface{}) (items []*HTPasswdIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadHTPasswdIdentityProviderList(iterator) + err = iterator.Error + return +} + +// ReadHTPasswdIdentityProviderList reads list of values of the ”HT_passwd_identity_provider' type from +// the given iterator. +func ReadHTPasswdIdentityProviderList(iterator *jsoniter.Iterator) []*HTPasswdIdentityProvider { + list := []*HTPasswdIdentityProvider{} + for iterator.ReadArray() { + item := ReadHTPasswdIdentityProvider(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_type.go b/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_type.go new file mode 100644 index 00000000..34799f45 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_type.go @@ -0,0 +1,213 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// HTPasswdIdentityProvider represents the values of the 'HT_passwd_identity_provider' type. +// +// Details for `htpasswd` identity providers. +type HTPasswdIdentityProvider struct { + bitmap_ uint32 + password string + username string + users *HTPasswdUserList +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *HTPasswdIdentityProvider) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Password returns the value of the 'password' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Password to be used in the _HTPasswd_ data file. +func (o *HTPasswdIdentityProvider) Password() string { + if o != nil && o.bitmap_&1 != 0 { + return o.password + } + return "" +} + +// GetPassword returns the value of the 'password' attribute and +// a flag indicating if the attribute has a value. +// +// Password to be used in the _HTPasswd_ data file. +func (o *HTPasswdIdentityProvider) GetPassword() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.password + } + return +} + +// Username returns the value of the 'username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Username to be used in the _HTPasswd_ data file. +func (o *HTPasswdIdentityProvider) Username() string { + if o != nil && o.bitmap_&2 != 0 { + return o.username + } + return "" +} + +// GetUsername returns the value of the 'username' attribute and +// a flag indicating if the attribute has a value. +// +// Username to be used in the _HTPasswd_ data file. +func (o *HTPasswdIdentityProvider) GetUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.username + } + return +} + +// Users returns the value of the 'users' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the collection of _HTPasswd_ users. +func (o *HTPasswdIdentityProvider) Users() *HTPasswdUserList { + if o != nil && o.bitmap_&4 != 0 { + return o.users + } + return nil +} + +// GetUsers returns the value of the 'users' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the collection of _HTPasswd_ users. +func (o *HTPasswdIdentityProvider) GetUsers() (value *HTPasswdUserList, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.users + } + return +} + +// HTPasswdIdentityProviderListKind is the name of the type used to represent list of objects of +// type 'HT_passwd_identity_provider'. +const HTPasswdIdentityProviderListKind = "HTPasswdIdentityProviderList" + +// HTPasswdIdentityProviderListLinkKind is the name of the type used to represent links to list +// of objects of type 'HT_passwd_identity_provider'. +const HTPasswdIdentityProviderListLinkKind = "HTPasswdIdentityProviderListLink" + +// HTPasswdIdentityProviderNilKind is the name of the type used to nil lists of objects of +// type 'HT_passwd_identity_provider'. +const HTPasswdIdentityProviderListNilKind = "HTPasswdIdentityProviderListNil" + +// HTPasswdIdentityProviderList is a list of values of the 'HT_passwd_identity_provider' type. +type HTPasswdIdentityProviderList struct { + href string + link bool + items []*HTPasswdIdentityProvider +} + +// Len returns the length of the list. +func (l *HTPasswdIdentityProviderList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *HTPasswdIdentityProviderList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *HTPasswdIdentityProviderList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *HTPasswdIdentityProviderList) SetItems(items []*HTPasswdIdentityProvider) { + l.items = items +} + +// Items returns the items of the list. +func (l *HTPasswdIdentityProviderList) Items() []*HTPasswdIdentityProvider { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *HTPasswdIdentityProviderList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *HTPasswdIdentityProviderList) Get(i int) *HTPasswdIdentityProvider { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *HTPasswdIdentityProviderList) Slice() []*HTPasswdIdentityProvider { + var slice []*HTPasswdIdentityProvider + if l == nil { + slice = make([]*HTPasswdIdentityProvider, 0) + } else { + slice = make([]*HTPasswdIdentityProvider, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *HTPasswdIdentityProviderList) Each(f func(item *HTPasswdIdentityProvider) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *HTPasswdIdentityProviderList) Range(f func(index int, item *HTPasswdIdentityProvider) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_type_json.go b/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_type_json.go new file mode 100644 index 00000000..8816b5a3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ht_passwd_identity_provider_type_json.go @@ -0,0 +1,132 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalHTPasswdIdentityProvider writes a value of the 'HT_passwd_identity_provider' type to the given writer. +func MarshalHTPasswdIdentityProvider(object *HTPasswdIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHTPasswdIdentityProvider(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHTPasswdIdentityProvider writes a value of the 'HT_passwd_identity_provider' type to the given stream. +func WriteHTPasswdIdentityProvider(object *HTPasswdIdentityProvider, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("password") + stream.WriteString(object.password) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("username") + stream.WriteString(object.username) + count++ + } + present_ = object.bitmap_&4 != 0 && object.users != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("users") + stream.WriteObjectStart() + stream.WriteObjectField("items") + WriteHTPasswdUserList(object.users.Items(), stream) + stream.WriteObjectEnd() + } + stream.WriteObjectEnd() +} + +// UnmarshalHTPasswdIdentityProvider reads a value of the 'HT_passwd_identity_provider' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalHTPasswdIdentityProvider(source interface{}) (object *HTPasswdIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadHTPasswdIdentityProvider(iterator) + err = iterator.Error + return +} + +// ReadHTPasswdIdentityProvider reads a value of the 'HT_passwd_identity_provider' type from the given iterator. +func ReadHTPasswdIdentityProvider(iterator *jsoniter.Iterator) *HTPasswdIdentityProvider { + object := &HTPasswdIdentityProvider{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "password": + value := iterator.ReadString() + object.password = value + object.bitmap_ |= 1 + case "username": + value := iterator.ReadString() + object.username = value + object.bitmap_ |= 2 + case "users": + value := &HTPasswdUserList{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + text := iterator.ReadString() + value.SetLink(text == HTPasswdUserListLinkKind) + case "href": + value.SetHREF(iterator.ReadString()) + case "items": + value.SetItems(ReadHTPasswdUserList(iterator)) + default: + iterator.ReadAny() + } + } + object.users = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/ht_passwd_user_builder.go b/clientapi/clustersmgmt/v1/ht_passwd_user_builder.go new file mode 100644 index 00000000..2a83286f --- /dev/null +++ b/clientapi/clustersmgmt/v1/ht_passwd_user_builder.go @@ -0,0 +1,91 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// HTPasswdUserBuilder contains the data and logic needed to build 'HT_passwd_user' objects. +type HTPasswdUserBuilder struct { + bitmap_ uint32 + id string + hashedPassword string + password string + username string +} + +// NewHTPasswdUser creates a new builder of 'HT_passwd_user' objects. +func NewHTPasswdUser() *HTPasswdUserBuilder { + return &HTPasswdUserBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *HTPasswdUserBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *HTPasswdUserBuilder) ID(value string) *HTPasswdUserBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// HashedPassword sets the value of the 'hashed_password' attribute to the given value. +func (b *HTPasswdUserBuilder) HashedPassword(value string) *HTPasswdUserBuilder { + b.hashedPassword = value + b.bitmap_ |= 2 + return b +} + +// Password sets the value of the 'password' attribute to the given value. +func (b *HTPasswdUserBuilder) Password(value string) *HTPasswdUserBuilder { + b.password = value + b.bitmap_ |= 4 + return b +} + +// Username sets the value of the 'username' attribute to the given value. +func (b *HTPasswdUserBuilder) Username(value string) *HTPasswdUserBuilder { + b.username = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *HTPasswdUserBuilder) Copy(object *HTPasswdUser) *HTPasswdUserBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.hashedPassword = object.hashedPassword + b.password = object.password + b.username = object.username + return b +} + +// Build creates a 'HT_passwd_user' object using the configuration stored in the builder. +func (b *HTPasswdUserBuilder) Build() (object *HTPasswdUser, err error) { + object = new(HTPasswdUser) + object.bitmap_ = b.bitmap_ + object.id = b.id + object.hashedPassword = b.hashedPassword + object.password = b.password + object.username = b.username + return +} diff --git a/clientapi/clustersmgmt/v1/ht_passwd_user_list_builder.go b/clientapi/clustersmgmt/v1/ht_passwd_user_list_builder.go new file mode 100644 index 00000000..855858de --- /dev/null +++ b/clientapi/clustersmgmt/v1/ht_passwd_user_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// HTPasswdUserListBuilder contains the data and logic needed to build +// 'HT_passwd_user' objects. +type HTPasswdUserListBuilder struct { + items []*HTPasswdUserBuilder +} + +// NewHTPasswdUserList creates a new builder of 'HT_passwd_user' objects. +func NewHTPasswdUserList() *HTPasswdUserListBuilder { + return new(HTPasswdUserListBuilder) +} + +// Items sets the items of the list. +func (b *HTPasswdUserListBuilder) Items(values ...*HTPasswdUserBuilder) *HTPasswdUserListBuilder { + b.items = make([]*HTPasswdUserBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *HTPasswdUserListBuilder) 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 *HTPasswdUserListBuilder) Copy(list *HTPasswdUserList) *HTPasswdUserListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*HTPasswdUserBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewHTPasswdUser().Copy(v) + } + } + return b +} + +// Build creates a list of 'HT_passwd_user' objects using the +// configuration stored in the builder. +func (b *HTPasswdUserListBuilder) Build() (list *HTPasswdUserList, err error) { + items := make([]*HTPasswdUser, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(HTPasswdUserList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/ht_passwd_user_list_type_json.go b/clientapi/clustersmgmt/v1/ht_passwd_user_list_type_json.go new file mode 100644 index 00000000..78e45358 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ht_passwd_user_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalHTPasswdUserList writes a list of values of the 'HT_passwd_user' type to +// the given writer. +func MarshalHTPasswdUserList(list []*HTPasswdUser, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHTPasswdUserList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHTPasswdUserList writes a list of value of the 'HT_passwd_user' type to +// the given stream. +func WriteHTPasswdUserList(list []*HTPasswdUser, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteHTPasswdUser(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalHTPasswdUserList reads a list of values of the 'HT_passwd_user' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalHTPasswdUserList(source interface{}) (items []*HTPasswdUser, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadHTPasswdUserList(iterator) + err = iterator.Error + return +} + +// ReadHTPasswdUserList reads list of values of the ”HT_passwd_user' type from +// the given iterator. +func ReadHTPasswdUserList(iterator *jsoniter.Iterator) []*HTPasswdUser { + list := []*HTPasswdUser{} + for iterator.ReadArray() { + item := ReadHTPasswdUser(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/ht_passwd_user_type.go b/clientapi/clustersmgmt/v1/ht_passwd_user_type.go new file mode 100644 index 00000000..1a0ae6d3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ht_passwd_user_type.go @@ -0,0 +1,239 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// HTPasswdUser represents the values of the 'HT_passwd_user' type. +type HTPasswdUser struct { + bitmap_ uint32 + id string + hashedPassword string + password string + username string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *HTPasswdUser) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID for a secondary user in the _HTPasswd_ data file. +func (o *HTPasswdUser) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID for a secondary user in the _HTPasswd_ data file. +func (o *HTPasswdUser) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// HashedPassword returns the value of the 'hashed_password' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HTPasswd Hashed Password for a user in the _HTPasswd_ data file. +// The value of this field is set as-is in the _HTPasswd_ data file for the HTPasswd IDP +func (o *HTPasswdUser) HashedPassword() string { + if o != nil && o.bitmap_&2 != 0 { + return o.hashedPassword + } + return "" +} + +// GetHashedPassword returns the value of the 'hashed_password' attribute and +// a flag indicating if the attribute has a value. +// +// HTPasswd Hashed Password for a user in the _HTPasswd_ data file. +// The value of this field is set as-is in the _HTPasswd_ data file for the HTPasswd IDP +func (o *HTPasswdUser) GetHashedPassword() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.hashedPassword + } + return +} + +// Password returns the value of the 'password' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Password in plain-text for a user in the _HTPasswd_ data file. +// The value of this field is hashed before setting it in the _HTPasswd_ data file for the HTPasswd IDP +func (o *HTPasswdUser) Password() string { + if o != nil && o.bitmap_&4 != 0 { + return o.password + } + return "" +} + +// GetPassword returns the value of the 'password' attribute and +// a flag indicating if the attribute has a value. +// +// Password in plain-text for a user in the _HTPasswd_ data file. +// The value of this field is hashed before setting it in the _HTPasswd_ data file for the HTPasswd IDP +func (o *HTPasswdUser) GetPassword() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.password + } + return +} + +// Username returns the value of the 'username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Username for a secondary user in the _HTPasswd_ data file. +func (o *HTPasswdUser) Username() string { + if o != nil && o.bitmap_&8 != 0 { + return o.username + } + return "" +} + +// GetUsername returns the value of the 'username' attribute and +// a flag indicating if the attribute has a value. +// +// Username for a secondary user in the _HTPasswd_ data file. +func (o *HTPasswdUser) GetUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.username + } + return +} + +// HTPasswdUserListKind is the name of the type used to represent list of objects of +// type 'HT_passwd_user'. +const HTPasswdUserListKind = "HTPasswdUserList" + +// HTPasswdUserListLinkKind is the name of the type used to represent links to list +// of objects of type 'HT_passwd_user'. +const HTPasswdUserListLinkKind = "HTPasswdUserListLink" + +// HTPasswdUserNilKind is the name of the type used to nil lists of objects of +// type 'HT_passwd_user'. +const HTPasswdUserListNilKind = "HTPasswdUserListNil" + +// HTPasswdUserList is a list of values of the 'HT_passwd_user' type. +type HTPasswdUserList struct { + href string + link bool + items []*HTPasswdUser +} + +// Len returns the length of the list. +func (l *HTPasswdUserList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *HTPasswdUserList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *HTPasswdUserList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *HTPasswdUserList) SetItems(items []*HTPasswdUser) { + l.items = items +} + +// Items returns the items of the list. +func (l *HTPasswdUserList) Items() []*HTPasswdUser { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *HTPasswdUserList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *HTPasswdUserList) Get(i int) *HTPasswdUser { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *HTPasswdUserList) Slice() []*HTPasswdUser { + var slice []*HTPasswdUser + if l == nil { + slice = make([]*HTPasswdUser, 0) + } else { + slice = make([]*HTPasswdUser, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *HTPasswdUserList) Each(f func(item *HTPasswdUser) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *HTPasswdUserList) Range(f func(index int, item *HTPasswdUser) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/ht_passwd_user_type_json.go b/clientapi/clustersmgmt/v1/ht_passwd_user_type_json.go new file mode 100644 index 00000000..18bea6e6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ht_passwd_user_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalHTPasswdUser writes a value of the 'HT_passwd_user' type to the given writer. +func MarshalHTPasswdUser(object *HTPasswdUser, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHTPasswdUser(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHTPasswdUser writes a value of the 'HT_passwd_user' type to the given stream. +func WriteHTPasswdUser(object *HTPasswdUser, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hashed_password") + stream.WriteString(object.hashedPassword) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("password") + stream.WriteString(object.password) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("username") + stream.WriteString(object.username) + } + stream.WriteObjectEnd() +} + +// UnmarshalHTPasswdUser reads a value of the 'HT_passwd_user' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalHTPasswdUser(source interface{}) (object *HTPasswdUser, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadHTPasswdUser(iterator) + err = iterator.Error + return +} + +// ReadHTPasswdUser reads a value of the 'HT_passwd_user' type from the given iterator. +func ReadHTPasswdUser(iterator *jsoniter.Iterator) *HTPasswdUser { + object := &HTPasswdUser{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "hashed_password": + value := iterator.ReadString() + object.hashedPassword = value + object.bitmap_ |= 2 + case "password": + value := iterator.ReadString() + object.password = value + object.bitmap_ |= 4 + case "username": + value := iterator.ReadString() + object.username = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/hypershift_builder.go b/clientapi/clustersmgmt/v1/hypershift_builder.go new file mode 100644 index 00000000..aad574d4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/hypershift_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// HypershiftBuilder contains the data and logic needed to build 'hypershift' objects. +// +// Hypershift configuration. +type HypershiftBuilder struct { + bitmap_ uint32 + enabled bool +} + +// NewHypershift creates a new builder of 'hypershift' objects. +func NewHypershift() *HypershiftBuilder { + return &HypershiftBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *HypershiftBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *HypershiftBuilder) Enabled(value bool) *HypershiftBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *HypershiftBuilder) Copy(object *Hypershift) *HypershiftBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + return b +} + +// Build creates a 'hypershift' object using the configuration stored in the builder. +func (b *HypershiftBuilder) Build() (object *Hypershift, err error) { + object = new(Hypershift) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + return +} diff --git a/clientapi/clustersmgmt/v1/hypershift_config_builder.go b/clientapi/clustersmgmt/v1/hypershift_config_builder.go new file mode 100644 index 00000000..1b3a4761 --- /dev/null +++ b/clientapi/clustersmgmt/v1/hypershift_config_builder.go @@ -0,0 +1,83 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// HypershiftConfigBuilder contains the data and logic needed to build 'hypershift_config' objects. +// +// Hypershift configuration. +type HypershiftConfigBuilder struct { + bitmap_ uint32 + hcpNamespace string + managementCluster string + enabled bool +} + +// NewHypershiftConfig creates a new builder of 'hypershift_config' objects. +func NewHypershiftConfig() *HypershiftConfigBuilder { + return &HypershiftConfigBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *HypershiftConfigBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// HCPNamespace sets the value of the 'HCP_namespace' attribute to the given value. +func (b *HypershiftConfigBuilder) HCPNamespace(value string) *HypershiftConfigBuilder { + b.hcpNamespace = value + b.bitmap_ |= 1 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *HypershiftConfigBuilder) Enabled(value bool) *HypershiftConfigBuilder { + b.enabled = value + b.bitmap_ |= 2 + return b +} + +// ManagementCluster sets the value of the 'management_cluster' attribute to the given value. +func (b *HypershiftConfigBuilder) ManagementCluster(value string) *HypershiftConfigBuilder { + b.managementCluster = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *HypershiftConfigBuilder) Copy(object *HypershiftConfig) *HypershiftConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.hcpNamespace = object.hcpNamespace + b.enabled = object.enabled + b.managementCluster = object.managementCluster + return b +} + +// Build creates a 'hypershift_config' object using the configuration stored in the builder. +func (b *HypershiftConfigBuilder) Build() (object *HypershiftConfig, err error) { + object = new(HypershiftConfig) + object.bitmap_ = b.bitmap_ + object.hcpNamespace = b.hcpNamespace + object.enabled = b.enabled + object.managementCluster = b.managementCluster + return +} diff --git a/clientapi/clustersmgmt/v1/hypershift_config_list_builder.go b/clientapi/clustersmgmt/v1/hypershift_config_list_builder.go new file mode 100644 index 00000000..4de136e2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/hypershift_config_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// HypershiftConfigListBuilder contains the data and logic needed to build +// 'hypershift_config' objects. +type HypershiftConfigListBuilder struct { + items []*HypershiftConfigBuilder +} + +// NewHypershiftConfigList creates a new builder of 'hypershift_config' objects. +func NewHypershiftConfigList() *HypershiftConfigListBuilder { + return new(HypershiftConfigListBuilder) +} + +// Items sets the items of the list. +func (b *HypershiftConfigListBuilder) Items(values ...*HypershiftConfigBuilder) *HypershiftConfigListBuilder { + b.items = make([]*HypershiftConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *HypershiftConfigListBuilder) 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 *HypershiftConfigListBuilder) Copy(list *HypershiftConfigList) *HypershiftConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*HypershiftConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewHypershiftConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'hypershift_config' objects using the +// configuration stored in the builder. +func (b *HypershiftConfigListBuilder) Build() (list *HypershiftConfigList, err error) { + items := make([]*HypershiftConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(HypershiftConfigList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/hypershift_config_list_type_json.go b/clientapi/clustersmgmt/v1/hypershift_config_list_type_json.go new file mode 100644 index 00000000..af7a8cf6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/hypershift_config_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalHypershiftConfigList writes a list of values of the 'hypershift_config' type to +// the given writer. +func MarshalHypershiftConfigList(list []*HypershiftConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHypershiftConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHypershiftConfigList writes a list of value of the 'hypershift_config' type to +// the given stream. +func WriteHypershiftConfigList(list []*HypershiftConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteHypershiftConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalHypershiftConfigList reads a list of values of the 'hypershift_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalHypershiftConfigList(source interface{}) (items []*HypershiftConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadHypershiftConfigList(iterator) + err = iterator.Error + return +} + +// ReadHypershiftConfigList reads list of values of the ”hypershift_config' type from +// the given iterator. +func ReadHypershiftConfigList(iterator *jsoniter.Iterator) []*HypershiftConfig { + list := []*HypershiftConfig{} + for iterator.ReadArray() { + item := ReadHypershiftConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/hypershift_config_type.go b/clientapi/clustersmgmt/v1/hypershift_config_type.go new file mode 100644 index 00000000..7bc0a4db --- /dev/null +++ b/clientapi/clustersmgmt/v1/hypershift_config_type.go @@ -0,0 +1,227 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// HypershiftConfig represents the values of the 'hypershift_config' type. +// +// Hypershift configuration. +type HypershiftConfig struct { + bitmap_ uint32 + hcpNamespace string + managementCluster string + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *HypershiftConfig) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// HCPNamespace returns the value of the 'HCP_namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the name of the hcp namespace for this Hypershift cluster. +// Empty for non Hypershift clusters. +func (o *HypershiftConfig) HCPNamespace() string { + if o != nil && o.bitmap_&1 != 0 { + return o.hcpNamespace + } + return "" +} + +// GetHCPNamespace returns the value of the 'HCP_namespace' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the name of the hcp namespace for this Hypershift cluster. +// Empty for non Hypershift clusters. +func (o *HypershiftConfig) GetHCPNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.hcpNamespace + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Boolean flag indicating if the cluster should be creating using _Hypershift_. +// +// By default this is `false`. +// +// To enable it the cluster needs to be ROSA cluster and the organization of the user needs +// to have the `hypershift` capability enabled. +func (o *HypershiftConfig) Enabled() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Boolean flag indicating if the cluster should be creating using _Hypershift_. +// +// By default this is `false`. +// +// To enable it the cluster needs to be ROSA cluster and the organization of the user needs +// to have the `hypershift` capability enabled. +func (o *HypershiftConfig) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.enabled + } + return +} + +// ManagementCluster returns the value of the 'management_cluster' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the name of the current management cluster for this Hypershift cluster. +// Empty for non Hypershift clusters. +func (o *HypershiftConfig) ManagementCluster() string { + if o != nil && o.bitmap_&4 != 0 { + return o.managementCluster + } + return "" +} + +// GetManagementCluster returns the value of the 'management_cluster' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the name of the current management cluster for this Hypershift cluster. +// Empty for non Hypershift clusters. +func (o *HypershiftConfig) GetManagementCluster() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.managementCluster + } + return +} + +// HypershiftConfigListKind is the name of the type used to represent list of objects of +// type 'hypershift_config'. +const HypershiftConfigListKind = "HypershiftConfigList" + +// HypershiftConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'hypershift_config'. +const HypershiftConfigListLinkKind = "HypershiftConfigListLink" + +// HypershiftConfigNilKind is the name of the type used to nil lists of objects of +// type 'hypershift_config'. +const HypershiftConfigListNilKind = "HypershiftConfigListNil" + +// HypershiftConfigList is a list of values of the 'hypershift_config' type. +type HypershiftConfigList struct { + href string + link bool + items []*HypershiftConfig +} + +// Len returns the length of the list. +func (l *HypershiftConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *HypershiftConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *HypershiftConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *HypershiftConfigList) SetItems(items []*HypershiftConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *HypershiftConfigList) Items() []*HypershiftConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *HypershiftConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *HypershiftConfigList) Get(i int) *HypershiftConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *HypershiftConfigList) Slice() []*HypershiftConfig { + var slice []*HypershiftConfig + if l == nil { + slice = make([]*HypershiftConfig, 0) + } else { + slice = make([]*HypershiftConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *HypershiftConfigList) Each(f func(item *HypershiftConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *HypershiftConfigList) Range(f func(index int, item *HypershiftConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/hypershift_config_type_json.go b/clientapi/clustersmgmt/v1/hypershift_config_type_json.go new file mode 100644 index 00000000..f8dae64b --- /dev/null +++ b/clientapi/clustersmgmt/v1/hypershift_config_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalHypershiftConfig writes a value of the 'hypershift_config' type to the given writer. +func MarshalHypershiftConfig(object *HypershiftConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHypershiftConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHypershiftConfig writes a value of the 'hypershift_config' type to the given stream. +func WriteHypershiftConfig(object *HypershiftConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hcp_namespace") + stream.WriteString(object.hcpNamespace) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("management_cluster") + stream.WriteString(object.managementCluster) + } + stream.WriteObjectEnd() +} + +// UnmarshalHypershiftConfig reads a value of the 'hypershift_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalHypershiftConfig(source interface{}) (object *HypershiftConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadHypershiftConfig(iterator) + err = iterator.Error + return +} + +// ReadHypershiftConfig reads a value of the 'hypershift_config' type from the given iterator. +func ReadHypershiftConfig(iterator *jsoniter.Iterator) *HypershiftConfig { + object := &HypershiftConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "hcp_namespace": + value := iterator.ReadString() + object.hcpNamespace = value + object.bitmap_ |= 1 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 2 + case "management_cluster": + value := iterator.ReadString() + object.managementCluster = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/hypershift_list_builder.go b/clientapi/clustersmgmt/v1/hypershift_list_builder.go new file mode 100644 index 00000000..f3662fea --- /dev/null +++ b/clientapi/clustersmgmt/v1/hypershift_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// HypershiftListBuilder contains the data and logic needed to build +// 'hypershift' objects. +type HypershiftListBuilder struct { + items []*HypershiftBuilder +} + +// NewHypershiftList creates a new builder of 'hypershift' objects. +func NewHypershiftList() *HypershiftListBuilder { + return new(HypershiftListBuilder) +} + +// Items sets the items of the list. +func (b *HypershiftListBuilder) Items(values ...*HypershiftBuilder) *HypershiftListBuilder { + b.items = make([]*HypershiftBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *HypershiftListBuilder) 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 *HypershiftListBuilder) Copy(list *HypershiftList) *HypershiftListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*HypershiftBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewHypershift().Copy(v) + } + } + return b +} + +// Build creates a list of 'hypershift' objects using the +// configuration stored in the builder. +func (b *HypershiftListBuilder) Build() (list *HypershiftList, err error) { + items := make([]*Hypershift, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(HypershiftList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/hypershift_list_type_json.go b/clientapi/clustersmgmt/v1/hypershift_list_type_json.go new file mode 100644 index 00000000..4aa43c6c --- /dev/null +++ b/clientapi/clustersmgmt/v1/hypershift_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalHypershiftList writes a list of values of the 'hypershift' type to +// the given writer. +func MarshalHypershiftList(list []*Hypershift, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHypershiftList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHypershiftList writes a list of value of the 'hypershift' type to +// the given stream. +func WriteHypershiftList(list []*Hypershift, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteHypershift(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalHypershiftList reads a list of values of the 'hypershift' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalHypershiftList(source interface{}) (items []*Hypershift, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadHypershiftList(iterator) + err = iterator.Error + return +} + +// ReadHypershiftList reads list of values of the ”hypershift' type from +// the given iterator. +func ReadHypershiftList(iterator *jsoniter.Iterator) []*Hypershift { + list := []*Hypershift{} + for iterator.ReadArray() { + item := ReadHypershift(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/hypershift_type.go b/clientapi/clustersmgmt/v1/hypershift_type.go new file mode 100644 index 00000000..117cf9fe --- /dev/null +++ b/clientapi/clustersmgmt/v1/hypershift_type.go @@ -0,0 +1,175 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// Hypershift represents the values of the 'hypershift' type. +// +// Hypershift configuration. +type Hypershift struct { + bitmap_ uint32 + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Hypershift) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Boolean flag indicating if the cluster should be creating using _Hypershift_. +// +// By default this is `false`. +// +// To enable it the cluster needs to be ROSA cluster and the organization of the user needs +// to have the `hypershift` capability enabled. +func (o *Hypershift) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Boolean flag indicating if the cluster should be creating using _Hypershift_. +// +// By default this is `false`. +// +// To enable it the cluster needs to be ROSA cluster and the organization of the user needs +// to have the `hypershift` capability enabled. +func (o *Hypershift) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// HypershiftListKind is the name of the type used to represent list of objects of +// type 'hypershift'. +const HypershiftListKind = "HypershiftList" + +// HypershiftListLinkKind is the name of the type used to represent links to list +// of objects of type 'hypershift'. +const HypershiftListLinkKind = "HypershiftListLink" + +// HypershiftNilKind is the name of the type used to nil lists of objects of +// type 'hypershift'. +const HypershiftListNilKind = "HypershiftListNil" + +// HypershiftList is a list of values of the 'hypershift' type. +type HypershiftList struct { + href string + link bool + items []*Hypershift +} + +// Len returns the length of the list. +func (l *HypershiftList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *HypershiftList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *HypershiftList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *HypershiftList) SetItems(items []*Hypershift) { + l.items = items +} + +// Items returns the items of the list. +func (l *HypershiftList) Items() []*Hypershift { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *HypershiftList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *HypershiftList) Get(i int) *Hypershift { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *HypershiftList) Slice() []*Hypershift { + var slice []*Hypershift + if l == nil { + slice = make([]*Hypershift, 0) + } else { + slice = make([]*Hypershift, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *HypershiftList) Each(f func(item *Hypershift) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *HypershiftList) Range(f func(index int, item *Hypershift) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/hypershift_type_json.go b/clientapi/clustersmgmt/v1/hypershift_type_json.go new file mode 100644 index 00000000..8dcc5b40 --- /dev/null +++ b/clientapi/clustersmgmt/v1/hypershift_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalHypershift writes a value of the 'hypershift' type to the given writer. +func MarshalHypershift(object *Hypershift, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHypershift(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHypershift writes a value of the 'hypershift' type to the given stream. +func WriteHypershift(object *Hypershift, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalHypershift reads a value of the 'hypershift' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalHypershift(source interface{}) (object *Hypershift, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadHypershift(iterator) + err = iterator.Error + return +} + +// ReadHypershift reads a value of the 'hypershift' type from the given iterator. +func ReadHypershift(iterator *jsoniter.Iterator) *Hypershift { + object := &Hypershift{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/identity_provider_builder.go b/clientapi/clustersmgmt/v1/identity_provider_builder.go new file mode 100644 index 00000000..35647f1e --- /dev/null +++ b/clientapi/clustersmgmt/v1/identity_provider_builder.go @@ -0,0 +1,283 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// IdentityProviderBuilder contains the data and logic needed to build 'identity_provider' objects. +// +// Representation of an identity provider. +type IdentityProviderBuilder struct { + bitmap_ uint32 + id string + href string + ldap *LDAPIdentityProviderBuilder + github *GithubIdentityProviderBuilder + gitlab *GitlabIdentityProviderBuilder + google *GoogleIdentityProviderBuilder + htpasswd *HTPasswdIdentityProviderBuilder + mappingMethod IdentityProviderMappingMethod + name string + openID *OpenIDIdentityProviderBuilder + type_ IdentityProviderType + challenge bool + login bool +} + +// NewIdentityProvider creates a new builder of 'identity_provider' objects. +func NewIdentityProvider() *IdentityProviderBuilder { + return &IdentityProviderBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *IdentityProviderBuilder) Link(value bool) *IdentityProviderBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *IdentityProviderBuilder) ID(value string) *IdentityProviderBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *IdentityProviderBuilder) HREF(value string) *IdentityProviderBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *IdentityProviderBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// LDAP sets the value of the 'LDAP' attribute to the given value. +// +// Details for `ldap` identity providers. +func (b *IdentityProviderBuilder) LDAP(value *LDAPIdentityProviderBuilder) *IdentityProviderBuilder { + b.ldap = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// Challenge sets the value of the 'challenge' attribute to the given value. +func (b *IdentityProviderBuilder) Challenge(value bool) *IdentityProviderBuilder { + b.challenge = value + b.bitmap_ |= 16 + return b +} + +// Github sets the value of the 'github' attribute to the given value. +// +// Details for `github` identity providers. +func (b *IdentityProviderBuilder) Github(value *GithubIdentityProviderBuilder) *IdentityProviderBuilder { + b.github = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Gitlab sets the value of the 'gitlab' attribute to the given value. +// +// Details for `gitlab` identity providers. +func (b *IdentityProviderBuilder) Gitlab(value *GitlabIdentityProviderBuilder) *IdentityProviderBuilder { + b.gitlab = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Google sets the value of the 'google' attribute to the given value. +// +// Details for `google` identity providers. +func (b *IdentityProviderBuilder) Google(value *GoogleIdentityProviderBuilder) *IdentityProviderBuilder { + b.google = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// Htpasswd sets the value of the 'htpasswd' attribute to the given value. +// +// Details for `htpasswd` identity providers. +func (b *IdentityProviderBuilder) Htpasswd(value *HTPasswdIdentityProviderBuilder) *IdentityProviderBuilder { + b.htpasswd = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// Login sets the value of the 'login' attribute to the given value. +func (b *IdentityProviderBuilder) Login(value bool) *IdentityProviderBuilder { + b.login = value + b.bitmap_ |= 512 + return b +} + +// MappingMethod sets the value of the 'mapping_method' attribute to the given value. +// +// Controls how mappings are established between provider identities and user objects. +func (b *IdentityProviderBuilder) MappingMethod(value IdentityProviderMappingMethod) *IdentityProviderBuilder { + b.mappingMethod = value + b.bitmap_ |= 1024 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *IdentityProviderBuilder) Name(value string) *IdentityProviderBuilder { + b.name = value + b.bitmap_ |= 2048 + return b +} + +// OpenID sets the value of the 'open_ID' attribute to the given value. +// +// Details for `openid` identity providers. +func (b *IdentityProviderBuilder) OpenID(value *OpenIDIdentityProviderBuilder) *IdentityProviderBuilder { + b.openID = value + if value != nil { + b.bitmap_ |= 4096 + } else { + b.bitmap_ &^= 4096 + } + return b +} + +// Type sets the value of the 'type' attribute to the given value. +// +// Type of identity provider. +func (b *IdentityProviderBuilder) Type(value IdentityProviderType) *IdentityProviderBuilder { + b.type_ = value + b.bitmap_ |= 8192 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *IdentityProviderBuilder) Copy(object *IdentityProvider) *IdentityProviderBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.ldap != nil { + b.ldap = NewLDAPIdentityProvider().Copy(object.ldap) + } else { + b.ldap = nil + } + b.challenge = object.challenge + if object.github != nil { + b.github = NewGithubIdentityProvider().Copy(object.github) + } else { + b.github = nil + } + if object.gitlab != nil { + b.gitlab = NewGitlabIdentityProvider().Copy(object.gitlab) + } else { + b.gitlab = nil + } + if object.google != nil { + b.google = NewGoogleIdentityProvider().Copy(object.google) + } else { + b.google = nil + } + if object.htpasswd != nil { + b.htpasswd = NewHTPasswdIdentityProvider().Copy(object.htpasswd) + } else { + b.htpasswd = nil + } + b.login = object.login + b.mappingMethod = object.mappingMethod + b.name = object.name + if object.openID != nil { + b.openID = NewOpenIDIdentityProvider().Copy(object.openID) + } else { + b.openID = nil + } + b.type_ = object.type_ + return b +} + +// Build creates a 'identity_provider' object using the configuration stored in the builder. +func (b *IdentityProviderBuilder) Build() (object *IdentityProvider, err error) { + object = new(IdentityProvider) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.ldap != nil { + object.ldap, err = b.ldap.Build() + if err != nil { + return + } + } + object.challenge = b.challenge + if b.github != nil { + object.github, err = b.github.Build() + if err != nil { + return + } + } + if b.gitlab != nil { + object.gitlab, err = b.gitlab.Build() + if err != nil { + return + } + } + if b.google != nil { + object.google, err = b.google.Build() + if err != nil { + return + } + } + if b.htpasswd != nil { + object.htpasswd, err = b.htpasswd.Build() + if err != nil { + return + } + } + object.login = b.login + object.mappingMethod = b.mappingMethod + object.name = b.name + if b.openID != nil { + object.openID, err = b.openID.Build() + if err != nil { + return + } + } + object.type_ = b.type_ + return +} diff --git a/clientapi/clustersmgmt/v1/identity_provider_list_builder.go b/clientapi/clustersmgmt/v1/identity_provider_list_builder.go new file mode 100644 index 00000000..7e1387a0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/identity_provider_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// IdentityProviderListBuilder contains the data and logic needed to build +// 'identity_provider' objects. +type IdentityProviderListBuilder struct { + items []*IdentityProviderBuilder +} + +// NewIdentityProviderList creates a new builder of 'identity_provider' objects. +func NewIdentityProviderList() *IdentityProviderListBuilder { + return new(IdentityProviderListBuilder) +} + +// Items sets the items of the list. +func (b *IdentityProviderListBuilder) Items(values ...*IdentityProviderBuilder) *IdentityProviderListBuilder { + b.items = make([]*IdentityProviderBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *IdentityProviderListBuilder) 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 *IdentityProviderListBuilder) Copy(list *IdentityProviderList) *IdentityProviderListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*IdentityProviderBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewIdentityProvider().Copy(v) + } + } + return b +} + +// Build creates a list of 'identity_provider' objects using the +// configuration stored in the builder. +func (b *IdentityProviderListBuilder) Build() (list *IdentityProviderList, err error) { + items := make([]*IdentityProvider, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(IdentityProviderList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/identity_provider_list_type_json.go b/clientapi/clustersmgmt/v1/identity_provider_list_type_json.go new file mode 100644 index 00000000..f93bd49f --- /dev/null +++ b/clientapi/clustersmgmt/v1/identity_provider_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIdentityProviderList writes a list of values of the 'identity_provider' type to +// the given writer. +func MarshalIdentityProviderList(list []*IdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIdentityProviderList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIdentityProviderList writes a list of value of the 'identity_provider' type to +// the given stream. +func WriteIdentityProviderList(list []*IdentityProvider, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteIdentityProvider(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalIdentityProviderList reads a list of values of the 'identity_provider' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIdentityProviderList(source interface{}) (items []*IdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIdentityProviderList(iterator) + err = iterator.Error + return +} + +// ReadIdentityProviderList reads list of values of the ”identity_provider' type from +// the given iterator. +func ReadIdentityProviderList(iterator *jsoniter.Iterator) []*IdentityProvider { + list := []*IdentityProvider{} + for iterator.ReadArray() { + item := ReadIdentityProvider(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/identity_provider_mapping_method_list_type_json.go b/clientapi/clustersmgmt/v1/identity_provider_mapping_method_list_type_json.go new file mode 100644 index 00000000..e5074d0c --- /dev/null +++ b/clientapi/clustersmgmt/v1/identity_provider_mapping_method_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIdentityProviderMappingMethodList writes a list of values of the 'identity_provider_mapping_method' type to +// the given writer. +func MarshalIdentityProviderMappingMethodList(list []IdentityProviderMappingMethod, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIdentityProviderMappingMethodList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIdentityProviderMappingMethodList writes a list of value of the 'identity_provider_mapping_method' type to +// the given stream. +func WriteIdentityProviderMappingMethodList(list []IdentityProviderMappingMethod, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalIdentityProviderMappingMethodList reads a list of values of the 'identity_provider_mapping_method' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIdentityProviderMappingMethodList(source interface{}) (items []IdentityProviderMappingMethod, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIdentityProviderMappingMethodList(iterator) + err = iterator.Error + return +} + +// ReadIdentityProviderMappingMethodList reads list of values of the ”identity_provider_mapping_method' type from +// the given iterator. +func ReadIdentityProviderMappingMethodList(iterator *jsoniter.Iterator) []IdentityProviderMappingMethod { + list := []IdentityProviderMappingMethod{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := IdentityProviderMappingMethod(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/identity_provider_mapping_method_type.go b/clientapi/clustersmgmt/v1/identity_provider_mapping_method_type.go new file mode 100644 index 00000000..eb481c0f --- /dev/null +++ b/clientapi/clustersmgmt/v1/identity_provider_mapping_method_type.go @@ -0,0 +1,34 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// IdentityProviderMappingMethod represents the values of the 'identity_provider_mapping_method' enumerated type. +type IdentityProviderMappingMethod string + +const ( + // + IdentityProviderMappingMethodAdd IdentityProviderMappingMethod = "add" + // + IdentityProviderMappingMethodClaim IdentityProviderMappingMethod = "claim" + // + IdentityProviderMappingMethodGenerate IdentityProviderMappingMethod = "generate" + // + IdentityProviderMappingMethodLookup IdentityProviderMappingMethod = "lookup" +) diff --git a/clientapi/clustersmgmt/v1/identity_provider_type.go b/clientapi/clustersmgmt/v1/identity_provider_type.go new file mode 100644 index 00000000..3cd9d808 --- /dev/null +++ b/clientapi/clustersmgmt/v1/identity_provider_type.go @@ -0,0 +1,515 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// IdentityProviderKind is the name of the type used to represent objects +// of type 'identity_provider'. +const IdentityProviderKind = "IdentityProvider" + +// IdentityProviderLinkKind is the name of the type used to represent links +// to objects of type 'identity_provider'. +const IdentityProviderLinkKind = "IdentityProviderLink" + +// IdentityProviderNilKind is the name of the type used to nil references +// to objects of type 'identity_provider'. +const IdentityProviderNilKind = "IdentityProviderNil" + +// IdentityProvider represents the values of the 'identity_provider' type. +// +// Representation of an identity provider. +type IdentityProvider struct { + bitmap_ uint32 + id string + href string + ldap *LDAPIdentityProvider + github *GithubIdentityProvider + gitlab *GitlabIdentityProvider + google *GoogleIdentityProvider + htpasswd *HTPasswdIdentityProvider + mappingMethod IdentityProviderMappingMethod + name string + openID *OpenIDIdentityProvider + type_ IdentityProviderType + challenge bool + login bool +} + +// Kind returns the name of the type of the object. +func (o *IdentityProvider) Kind() string { + if o == nil { + return IdentityProviderNilKind + } + if o.bitmap_&1 != 0 { + return IdentityProviderLinkKind + } + return IdentityProviderKind +} + +// Link returns true if this is a link. +func (o *IdentityProvider) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *IdentityProvider) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *IdentityProvider) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *IdentityProvider) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *IdentityProvider) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *IdentityProvider) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// LDAP returns the value of the 'LDAP' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for `ldap` identity providers. +func (o *IdentityProvider) LDAP() *LDAPIdentityProvider { + if o != nil && o.bitmap_&8 != 0 { + return o.ldap + } + return nil +} + +// GetLDAP returns the value of the 'LDAP' attribute and +// a flag indicating if the attribute has a value. +// +// Details for `ldap` identity providers. +func (o *IdentityProvider) GetLDAP() (value *LDAPIdentityProvider, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.ldap + } + return +} + +// Challenge returns the value of the 'challenge' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// When `true` unauthenticated token requests from non-web clients (like the CLI) are sent a +// `WWW-Authenticate` challenge header for this provider. +func (o *IdentityProvider) Challenge() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.challenge + } + return false +} + +// GetChallenge returns the value of the 'challenge' attribute and +// a flag indicating if the attribute has a value. +// +// When `true` unauthenticated token requests from non-web clients (like the CLI) are sent a +// `WWW-Authenticate` challenge header for this provider. +func (o *IdentityProvider) GetChallenge() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.challenge + } + return +} + +// Github returns the value of the 'github' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for `github` identity providers. +func (o *IdentityProvider) Github() *GithubIdentityProvider { + if o != nil && o.bitmap_&32 != 0 { + return o.github + } + return nil +} + +// GetGithub returns the value of the 'github' attribute and +// a flag indicating if the attribute has a value. +// +// Details for `github` identity providers. +func (o *IdentityProvider) GetGithub() (value *GithubIdentityProvider, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.github + } + return +} + +// Gitlab returns the value of the 'gitlab' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for `gitlab` identity providers. +func (o *IdentityProvider) Gitlab() *GitlabIdentityProvider { + if o != nil && o.bitmap_&64 != 0 { + return o.gitlab + } + return nil +} + +// GetGitlab returns the value of the 'gitlab' attribute and +// a flag indicating if the attribute has a value. +// +// Details for `gitlab` identity providers. +func (o *IdentityProvider) GetGitlab() (value *GitlabIdentityProvider, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.gitlab + } + return +} + +// Google returns the value of the 'google' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for `google` identity providers. +func (o *IdentityProvider) Google() *GoogleIdentityProvider { + if o != nil && o.bitmap_&128 != 0 { + return o.google + } + return nil +} + +// GetGoogle returns the value of the 'google' attribute and +// a flag indicating if the attribute has a value. +// +// Details for `google` identity providers. +func (o *IdentityProvider) GetGoogle() (value *GoogleIdentityProvider, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.google + } + return +} + +// Htpasswd returns the value of the 'htpasswd' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for `htpasswd` identity providers. +func (o *IdentityProvider) Htpasswd() *HTPasswdIdentityProvider { + if o != nil && o.bitmap_&256 != 0 { + return o.htpasswd + } + return nil +} + +// GetHtpasswd returns the value of the 'htpasswd' attribute and +// a flag indicating if the attribute has a value. +// +// Details for `htpasswd` identity providers. +func (o *IdentityProvider) GetHtpasswd() (value *HTPasswdIdentityProvider, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.htpasswd + } + return +} + +// Login returns the value of the 'login' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// When `true` unauthenticated token requests from web clients (like the web console) are +// redirected to the authorize URL to log in. +func (o *IdentityProvider) Login() bool { + if o != nil && o.bitmap_&512 != 0 { + return o.login + } + return false +} + +// GetLogin returns the value of the 'login' attribute and +// a flag indicating if the attribute has a value. +// +// When `true` unauthenticated token requests from web clients (like the web console) are +// redirected to the authorize URL to log in. +func (o *IdentityProvider) GetLogin() (value bool, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.login + } + return +} + +// MappingMethod returns the value of the 'mapping_method' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Controls how mappings are established between this provider's identities and user +// objects. +func (o *IdentityProvider) MappingMethod() IdentityProviderMappingMethod { + if o != nil && o.bitmap_&1024 != 0 { + return o.mappingMethod + } + return IdentityProviderMappingMethod("") +} + +// GetMappingMethod returns the value of the 'mapping_method' attribute and +// a flag indicating if the attribute has a value. +// +// Controls how mappings are established between this provider's identities and user +// objects. +func (o *IdentityProvider) GetMappingMethod() (value IdentityProviderMappingMethod, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.mappingMethod + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the identity provider. +func (o *IdentityProvider) Name() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the identity provider. +func (o *IdentityProvider) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.name + } + return +} + +// OpenID returns the value of the 'open_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for `openid` identity providers. +func (o *IdentityProvider) OpenID() *OpenIDIdentityProvider { + if o != nil && o.bitmap_&4096 != 0 { + return o.openID + } + return nil +} + +// GetOpenID returns the value of the 'open_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Details for `openid` identity providers. +func (o *IdentityProvider) GetOpenID() (value *OpenIDIdentityProvider, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.openID + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of identity provider. The rest of the attributes will be populated according to this +// value. For example, if the type is `github` then only the `github` attribute will be +// populated. +func (o *IdentityProvider) Type() IdentityProviderType { + if o != nil && o.bitmap_&8192 != 0 { + return o.type_ + } + return IdentityProviderType("") +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of identity provider. The rest of the attributes will be populated according to this +// value. For example, if the type is `github` then only the `github` attribute will be +// populated. +func (o *IdentityProvider) GetType() (value IdentityProviderType, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.type_ + } + return +} + +// IdentityProviderListKind is the name of the type used to represent list of objects of +// type 'identity_provider'. +const IdentityProviderListKind = "IdentityProviderList" + +// IdentityProviderListLinkKind is the name of the type used to represent links to list +// of objects of type 'identity_provider'. +const IdentityProviderListLinkKind = "IdentityProviderListLink" + +// IdentityProviderNilKind is the name of the type used to nil lists of objects of +// type 'identity_provider'. +const IdentityProviderListNilKind = "IdentityProviderListNil" + +// IdentityProviderList is a list of values of the 'identity_provider' type. +type IdentityProviderList struct { + href string + link bool + items []*IdentityProvider +} + +// Kind returns the name of the type of the object. +func (l *IdentityProviderList) Kind() string { + if l == nil { + return IdentityProviderListNilKind + } + if l.link { + return IdentityProviderListLinkKind + } + return IdentityProviderListKind +} + +// Link returns true iif this is a link. +func (l *IdentityProviderList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *IdentityProviderList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *IdentityProviderList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *IdentityProviderList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *IdentityProviderList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *IdentityProviderList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *IdentityProviderList) SetItems(items []*IdentityProvider) { + l.items = items +} + +// Items returns the items of the list. +func (l *IdentityProviderList) Items() []*IdentityProvider { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *IdentityProviderList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *IdentityProviderList) Get(i int) *IdentityProvider { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *IdentityProviderList) Slice() []*IdentityProvider { + var slice []*IdentityProvider + if l == nil { + slice = make([]*IdentityProvider, 0) + } else { + slice = make([]*IdentityProvider, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *IdentityProviderList) Each(f func(item *IdentityProvider) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *IdentityProviderList) Range(f func(index int, item *IdentityProvider) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/identity_provider_type_json.go b/clientapi/clustersmgmt/v1/identity_provider_type_json.go new file mode 100644 index 00000000..6f55bad9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/identity_provider_type_json.go @@ -0,0 +1,252 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIdentityProvider writes a value of the 'identity_provider' type to the given writer. +func MarshalIdentityProvider(object *IdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIdentityProvider(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIdentityProvider writes a value of the 'identity_provider' type to the given stream. +func WriteIdentityProvider(object *IdentityProvider, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(IdentityProviderLinkKind) + } else { + stream.WriteString(IdentityProviderKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.ldap != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ldap") + WriteLDAPIdentityProvider(object.ldap, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("challenge") + stream.WriteBool(object.challenge) + count++ + } + present_ = object.bitmap_&32 != 0 && object.github != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("github") + WriteGithubIdentityProvider(object.github, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.gitlab != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gitlab") + WriteGitlabIdentityProvider(object.gitlab, stream) + count++ + } + present_ = object.bitmap_&128 != 0 && object.google != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("google") + WriteGoogleIdentityProvider(object.google, stream) + count++ + } + present_ = object.bitmap_&256 != 0 && object.htpasswd != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("htpasswd") + WriteHTPasswdIdentityProvider(object.htpasswd, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("login") + stream.WriteBool(object.login) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("mapping_method") + stream.WriteString(string(object.mappingMethod)) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&4096 != 0 && object.openID != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("open_id") + WriteOpenIDIdentityProvider(object.openID, stream) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(string(object.type_)) + } + stream.WriteObjectEnd() +} + +// UnmarshalIdentityProvider reads a value of the 'identity_provider' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalIdentityProvider(source interface{}) (object *IdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadIdentityProvider(iterator) + err = iterator.Error + return +} + +// ReadIdentityProvider reads a value of the 'identity_provider' type from the given iterator. +func ReadIdentityProvider(iterator *jsoniter.Iterator) *IdentityProvider { + object := &IdentityProvider{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == IdentityProviderLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "ldap": + value := ReadLDAPIdentityProvider(iterator) + object.ldap = value + object.bitmap_ |= 8 + case "challenge": + value := iterator.ReadBool() + object.challenge = value + object.bitmap_ |= 16 + case "github": + value := ReadGithubIdentityProvider(iterator) + object.github = value + object.bitmap_ |= 32 + case "gitlab": + value := ReadGitlabIdentityProvider(iterator) + object.gitlab = value + object.bitmap_ |= 64 + case "google": + value := ReadGoogleIdentityProvider(iterator) + object.google = value + object.bitmap_ |= 128 + case "htpasswd": + value := ReadHTPasswdIdentityProvider(iterator) + object.htpasswd = value + object.bitmap_ |= 256 + case "login": + value := iterator.ReadBool() + object.login = value + object.bitmap_ |= 512 + case "mapping_method": + text := iterator.ReadString() + value := IdentityProviderMappingMethod(text) + object.mappingMethod = value + object.bitmap_ |= 1024 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 2048 + case "open_id": + value := ReadOpenIDIdentityProvider(iterator) + object.openID = value + object.bitmap_ |= 4096 + case "type": + text := iterator.ReadString() + value := IdentityProviderType(text) + object.type_ = value + object.bitmap_ |= 8192 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/identity_provider_type_list_type_json.go b/clientapi/clustersmgmt/v1/identity_provider_type_list_type_json.go new file mode 100644 index 00000000..862fb9b0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/identity_provider_type_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIdentityProviderTypeList writes a list of values of the 'identity_provider_type' type to +// the given writer. +func MarshalIdentityProviderTypeList(list []IdentityProviderType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIdentityProviderTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIdentityProviderTypeList writes a list of value of the 'identity_provider_type' type to +// the given stream. +func WriteIdentityProviderTypeList(list []IdentityProviderType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalIdentityProviderTypeList reads a list of values of the 'identity_provider_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIdentityProviderTypeList(source interface{}) (items []IdentityProviderType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIdentityProviderTypeList(iterator) + err = iterator.Error + return +} + +// ReadIdentityProviderTypeList reads list of values of the ”identity_provider_type' type from +// the given iterator. +func ReadIdentityProviderTypeList(iterator *jsoniter.Iterator) []IdentityProviderType { + list := []IdentityProviderType{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := IdentityProviderType(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/identity_provider_type_type.go b/clientapi/clustersmgmt/v1/identity_provider_type_type.go new file mode 100644 index 00000000..2beef91e --- /dev/null +++ b/clientapi/clustersmgmt/v1/identity_provider_type_type.go @@ -0,0 +1,38 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// IdentityProviderType represents the values of the 'identity_provider_type' enumerated type. +type IdentityProviderType string + +const ( + // + IdentityProviderTypeLDAP IdentityProviderType = "LDAPIdentityProvider" + // + IdentityProviderTypeGithub IdentityProviderType = "GithubIdentityProvider" + // + IdentityProviderTypeGitlab IdentityProviderType = "GitlabIdentityProvider" + // + IdentityProviderTypeGoogle IdentityProviderType = "GoogleIdentityProvider" + // + IdentityProviderTypeHtpasswd IdentityProviderType = "HTPasswdIdentityProvider" + // + IdentityProviderTypeOpenID IdentityProviderType = "OpenIDIdentityProvider" +) diff --git a/clientapi/clustersmgmt/v1/image_overrides_builder.go b/clientapi/clustersmgmt/v1/image_overrides_builder.go new file mode 100644 index 00000000..24d2e351 --- /dev/null +++ b/clientapi/clustersmgmt/v1/image_overrides_builder.go @@ -0,0 +1,131 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ImageOverridesBuilder contains the data and logic needed to build 'image_overrides' objects. +// +// ImageOverrides holds the lists of available images per cloud provider. +type ImageOverridesBuilder struct { + bitmap_ uint32 + id string + href string + aws []*AMIOverrideBuilder + gcp []*GCPImageOverrideBuilder +} + +// NewImageOverrides creates a new builder of 'image_overrides' objects. +func NewImageOverrides() *ImageOverridesBuilder { + return &ImageOverridesBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ImageOverridesBuilder) Link(value bool) *ImageOverridesBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ImageOverridesBuilder) ID(value string) *ImageOverridesBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ImageOverridesBuilder) HREF(value string) *ImageOverridesBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ImageOverridesBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AWS sets the value of the 'AWS' attribute to the given values. +func (b *ImageOverridesBuilder) AWS(values ...*AMIOverrideBuilder) *ImageOverridesBuilder { + b.aws = make([]*AMIOverrideBuilder, len(values)) + copy(b.aws, values) + b.bitmap_ |= 8 + return b +} + +// GCP sets the value of the 'GCP' attribute to the given values. +func (b *ImageOverridesBuilder) GCP(values ...*GCPImageOverrideBuilder) *ImageOverridesBuilder { + b.gcp = make([]*GCPImageOverrideBuilder, len(values)) + copy(b.gcp, values) + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ImageOverridesBuilder) Copy(object *ImageOverrides) *ImageOverridesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.aws != nil { + b.aws = make([]*AMIOverrideBuilder, len(object.aws)) + for i, v := range object.aws { + b.aws[i] = NewAMIOverride().Copy(v) + } + } else { + b.aws = nil + } + if object.gcp != nil { + b.gcp = make([]*GCPImageOverrideBuilder, len(object.gcp)) + for i, v := range object.gcp { + b.gcp[i] = NewGCPImageOverride().Copy(v) + } + } else { + b.gcp = nil + } + return b +} + +// Build creates a 'image_overrides' object using the configuration stored in the builder. +func (b *ImageOverridesBuilder) Build() (object *ImageOverrides, err error) { + object = new(ImageOverrides) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.aws != nil { + object.aws = make([]*AMIOverride, len(b.aws)) + for i, v := range b.aws { + object.aws[i], err = v.Build() + if err != nil { + return + } + } + } + if b.gcp != nil { + object.gcp = make([]*GCPImageOverride, len(b.gcp)) + for i, v := range b.gcp { + object.gcp[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/image_overrides_list_builder.go b/clientapi/clustersmgmt/v1/image_overrides_list_builder.go new file mode 100644 index 00000000..92f44ca9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/image_overrides_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ImageOverridesListBuilder contains the data and logic needed to build +// 'image_overrides' objects. +type ImageOverridesListBuilder struct { + items []*ImageOverridesBuilder +} + +// NewImageOverridesList creates a new builder of 'image_overrides' objects. +func NewImageOverridesList() *ImageOverridesListBuilder { + return new(ImageOverridesListBuilder) +} + +// Items sets the items of the list. +func (b *ImageOverridesListBuilder) Items(values ...*ImageOverridesBuilder) *ImageOverridesListBuilder { + b.items = make([]*ImageOverridesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ImageOverridesListBuilder) 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 *ImageOverridesListBuilder) Copy(list *ImageOverridesList) *ImageOverridesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ImageOverridesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewImageOverrides().Copy(v) + } + } + return b +} + +// Build creates a list of 'image_overrides' objects using the +// configuration stored in the builder. +func (b *ImageOverridesListBuilder) Build() (list *ImageOverridesList, err error) { + items := make([]*ImageOverrides, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ImageOverridesList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/image_overrides_list_type_json.go b/clientapi/clustersmgmt/v1/image_overrides_list_type_json.go new file mode 100644 index 00000000..03ceb9b1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/image_overrides_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalImageOverridesList writes a list of values of the 'image_overrides' type to +// the given writer. +func MarshalImageOverridesList(list []*ImageOverrides, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteImageOverridesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteImageOverridesList writes a list of value of the 'image_overrides' type to +// the given stream. +func WriteImageOverridesList(list []*ImageOverrides, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteImageOverrides(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalImageOverridesList reads a list of values of the 'image_overrides' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalImageOverridesList(source interface{}) (items []*ImageOverrides, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadImageOverridesList(iterator) + err = iterator.Error + return +} + +// ReadImageOverridesList reads list of values of the ”image_overrides' type from +// the given iterator. +func ReadImageOverridesList(iterator *jsoniter.Iterator) []*ImageOverrides { + list := []*ImageOverrides{} + for iterator.ReadArray() { + item := ReadImageOverrides(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/image_overrides_type.go b/clientapi/clustersmgmt/v1/image_overrides_type.go new file mode 100644 index 00000000..ad7e86b0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/image_overrides_type.go @@ -0,0 +1,281 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ImageOverridesKind is the name of the type used to represent objects +// of type 'image_overrides'. +const ImageOverridesKind = "ImageOverrides" + +// ImageOverridesLinkKind is the name of the type used to represent links +// to objects of type 'image_overrides'. +const ImageOverridesLinkKind = "ImageOverridesLink" + +// ImageOverridesNilKind is the name of the type used to nil references +// to objects of type 'image_overrides'. +const ImageOverridesNilKind = "ImageOverridesNil" + +// ImageOverrides represents the values of the 'image_overrides' type. +// +// ImageOverrides holds the lists of available images per cloud provider. +type ImageOverrides struct { + bitmap_ uint32 + id string + href string + aws []*AMIOverride + gcp []*GCPImageOverride +} + +// Kind returns the name of the type of the object. +func (o *ImageOverrides) Kind() string { + if o == nil { + return ImageOverridesNilKind + } + if o.bitmap_&1 != 0 { + return ImageOverridesLinkKind + } + return ImageOverridesKind +} + +// Link returns true if this is a link. +func (o *ImageOverrides) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ImageOverrides) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ImageOverrides) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ImageOverrides) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ImageOverrides) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ImageOverrides) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AWS returns the value of the 'AWS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ImageOverrides) AWS() []*AMIOverride { + if o != nil && o.bitmap_&8 != 0 { + return o.aws + } + return nil +} + +// GetAWS returns the value of the 'AWS' attribute and +// a flag indicating if the attribute has a value. +func (o *ImageOverrides) GetAWS() (value []*AMIOverride, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.aws + } + return +} + +// GCP returns the value of the 'GCP' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ImageOverrides) GCP() []*GCPImageOverride { + if o != nil && o.bitmap_&16 != 0 { + return o.gcp + } + return nil +} + +// GetGCP returns the value of the 'GCP' attribute and +// a flag indicating if the attribute has a value. +func (o *ImageOverrides) GetGCP() (value []*GCPImageOverride, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.gcp + } + return +} + +// ImageOverridesListKind is the name of the type used to represent list of objects of +// type 'image_overrides'. +const ImageOverridesListKind = "ImageOverridesList" + +// ImageOverridesListLinkKind is the name of the type used to represent links to list +// of objects of type 'image_overrides'. +const ImageOverridesListLinkKind = "ImageOverridesListLink" + +// ImageOverridesNilKind is the name of the type used to nil lists of objects of +// type 'image_overrides'. +const ImageOverridesListNilKind = "ImageOverridesListNil" + +// ImageOverridesList is a list of values of the 'image_overrides' type. +type ImageOverridesList struct { + href string + link bool + items []*ImageOverrides +} + +// Kind returns the name of the type of the object. +func (l *ImageOverridesList) Kind() string { + if l == nil { + return ImageOverridesListNilKind + } + if l.link { + return ImageOverridesListLinkKind + } + return ImageOverridesListKind +} + +// Link returns true iif this is a link. +func (l *ImageOverridesList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ImageOverridesList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ImageOverridesList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ImageOverridesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ImageOverridesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ImageOverridesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ImageOverridesList) SetItems(items []*ImageOverrides) { + l.items = items +} + +// Items returns the items of the list. +func (l *ImageOverridesList) Items() []*ImageOverrides { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ImageOverridesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ImageOverridesList) Get(i int) *ImageOverrides { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ImageOverridesList) Slice() []*ImageOverrides { + var slice []*ImageOverrides + if l == nil { + slice = make([]*ImageOverrides, 0) + } else { + slice = make([]*ImageOverrides, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ImageOverridesList) Each(f func(item *ImageOverrides) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ImageOverridesList) Range(f func(index int, item *ImageOverrides) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/image_overrides_type_json.go b/clientapi/clustersmgmt/v1/image_overrides_type_json.go new file mode 100644 index 00000000..c7be5ad7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/image_overrides_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalImageOverrides writes a value of the 'image_overrides' type to the given writer. +func MarshalImageOverrides(object *ImageOverrides, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteImageOverrides(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteImageOverrides writes a value of the 'image_overrides' type to the given stream. +func WriteImageOverrides(object *ImageOverrides, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ImageOverridesLinkKind) + } else { + stream.WriteString(ImageOverridesKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.aws != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws") + WriteAMIOverrideList(object.aws, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.gcp != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp") + WriteGCPImageOverrideList(object.gcp, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalImageOverrides reads a value of the 'image_overrides' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalImageOverrides(source interface{}) (object *ImageOverrides, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadImageOverrides(iterator) + err = iterator.Error + return +} + +// ReadImageOverrides reads a value of the 'image_overrides' type from the given iterator. +func ReadImageOverrides(iterator *jsoniter.Iterator) *ImageOverrides { + object := &ImageOverrides{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ImageOverridesLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "aws": + value := ReadAMIOverrideList(iterator) + object.aws = value + object.bitmap_ |= 8 + case "gcp": + value := ReadGCPImageOverrideList(iterator) + object.gcp = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/inflight_check_builder.go b/clientapi/clustersmgmt/v1/inflight_check_builder.go new file mode 100644 index 00000000..7e32e6bc --- /dev/null +++ b/clientapi/clustersmgmt/v1/inflight_check_builder.go @@ -0,0 +1,145 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// InflightCheckBuilder contains the data and logic needed to build 'inflight_check' objects. +// +// Representation of check running before the cluster is provisioned. +type InflightCheckBuilder struct { + bitmap_ uint32 + id string + href string + details interface{} + endedAt time.Time + name string + restarts int + startedAt time.Time + state InflightCheckState +} + +// NewInflightCheck creates a new builder of 'inflight_check' objects. +func NewInflightCheck() *InflightCheckBuilder { + return &InflightCheckBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *InflightCheckBuilder) Link(value bool) *InflightCheckBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *InflightCheckBuilder) ID(value string) *InflightCheckBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *InflightCheckBuilder) HREF(value string) *InflightCheckBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *InflightCheckBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Details sets the value of the 'details' attribute to the given value. +func (b *InflightCheckBuilder) Details(value interface{}) *InflightCheckBuilder { + b.details = value + b.bitmap_ |= 8 + return b +} + +// EndedAt sets the value of the 'ended_at' attribute to the given value. +func (b *InflightCheckBuilder) EndedAt(value time.Time) *InflightCheckBuilder { + b.endedAt = value + b.bitmap_ |= 16 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *InflightCheckBuilder) Name(value string) *InflightCheckBuilder { + b.name = value + b.bitmap_ |= 32 + return b +} + +// Restarts sets the value of the 'restarts' attribute to the given value. +func (b *InflightCheckBuilder) Restarts(value int) *InflightCheckBuilder { + b.restarts = value + b.bitmap_ |= 64 + return b +} + +// StartedAt sets the value of the 'started_at' attribute to the given value. +func (b *InflightCheckBuilder) StartedAt(value time.Time) *InflightCheckBuilder { + b.startedAt = value + b.bitmap_ |= 128 + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// State of an inflight check. +func (b *InflightCheckBuilder) State(value InflightCheckState) *InflightCheckBuilder { + b.state = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *InflightCheckBuilder) Copy(object *InflightCheck) *InflightCheckBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.details = object.details + b.endedAt = object.endedAt + b.name = object.name + b.restarts = object.restarts + b.startedAt = object.startedAt + b.state = object.state + return b +} + +// Build creates a 'inflight_check' object using the configuration stored in the builder. +func (b *InflightCheckBuilder) Build() (object *InflightCheck, err error) { + object = new(InflightCheck) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.details = b.details + object.endedAt = b.endedAt + object.name = b.name + object.restarts = b.restarts + object.startedAt = b.startedAt + object.state = b.state + return +} diff --git a/clientapi/clustersmgmt/v1/inflight_check_list_builder.go b/clientapi/clustersmgmt/v1/inflight_check_list_builder.go new file mode 100644 index 00000000..94afb93e --- /dev/null +++ b/clientapi/clustersmgmt/v1/inflight_check_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// InflightCheckListBuilder contains the data and logic needed to build +// 'inflight_check' objects. +type InflightCheckListBuilder struct { + items []*InflightCheckBuilder +} + +// NewInflightCheckList creates a new builder of 'inflight_check' objects. +func NewInflightCheckList() *InflightCheckListBuilder { + return new(InflightCheckListBuilder) +} + +// Items sets the items of the list. +func (b *InflightCheckListBuilder) Items(values ...*InflightCheckBuilder) *InflightCheckListBuilder { + b.items = make([]*InflightCheckBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *InflightCheckListBuilder) 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 *InflightCheckListBuilder) Copy(list *InflightCheckList) *InflightCheckListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*InflightCheckBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewInflightCheck().Copy(v) + } + } + return b +} + +// Build creates a list of 'inflight_check' objects using the +// configuration stored in the builder. +func (b *InflightCheckListBuilder) Build() (list *InflightCheckList, err error) { + items := make([]*InflightCheck, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(InflightCheckList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/inflight_check_list_type_json.go b/clientapi/clustersmgmt/v1/inflight_check_list_type_json.go new file mode 100644 index 00000000..37eef004 --- /dev/null +++ b/clientapi/clustersmgmt/v1/inflight_check_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInflightCheckList writes a list of values of the 'inflight_check' type to +// the given writer. +func MarshalInflightCheckList(list []*InflightCheck, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInflightCheckList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInflightCheckList writes a list of value of the 'inflight_check' type to +// the given stream. +func WriteInflightCheckList(list []*InflightCheck, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteInflightCheck(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalInflightCheckList reads a list of values of the 'inflight_check' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInflightCheckList(source interface{}) (items []*InflightCheck, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInflightCheckList(iterator) + err = iterator.Error + return +} + +// ReadInflightCheckList reads list of values of the ”inflight_check' type from +// the given iterator. +func ReadInflightCheckList(iterator *jsoniter.Iterator) []*InflightCheck { + list := []*InflightCheck{} + for iterator.ReadArray() { + item := ReadInflightCheck(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/inflight_check_state_list_type_json.go b/clientapi/clustersmgmt/v1/inflight_check_state_list_type_json.go new file mode 100644 index 00000000..18a80ad5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/inflight_check_state_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInflightCheckStateList writes a list of values of the 'inflight_check_state' type to +// the given writer. +func MarshalInflightCheckStateList(list []InflightCheckState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInflightCheckStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInflightCheckStateList writes a list of value of the 'inflight_check_state' type to +// the given stream. +func WriteInflightCheckStateList(list []InflightCheckState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalInflightCheckStateList reads a list of values of the 'inflight_check_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInflightCheckStateList(source interface{}) (items []InflightCheckState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInflightCheckStateList(iterator) + err = iterator.Error + return +} + +// ReadInflightCheckStateList reads list of values of the ”inflight_check_state' type from +// the given iterator. +func ReadInflightCheckStateList(iterator *jsoniter.Iterator) []InflightCheckState { + list := []InflightCheckState{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := InflightCheckState(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/inflight_check_state_type.go b/clientapi/clustersmgmt/v1/inflight_check_state_type.go new file mode 100644 index 00000000..cf3b12f0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/inflight_check_state_type.go @@ -0,0 +1,34 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// InflightCheckState represents the values of the 'inflight_check_state' enumerated type. +type InflightCheckState string + +const ( + // The inflight check failed. + InflightCheckStateFailed InflightCheckState = "failed" + // The inflight check passed. + InflightCheckStatePassed InflightCheckState = "passed" + // The inflight check did not start running yet. + InflightCheckStatePending InflightCheckState = "pending" + // The inflight check is currently running. + InflightCheckStateRunning InflightCheckState = "running" +) diff --git a/clientapi/clustersmgmt/v1/inflight_check_type.go b/clientapi/clustersmgmt/v1/inflight_check_type.go new file mode 100644 index 00000000..1b8523a9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/inflight_check_type.go @@ -0,0 +1,389 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// InflightCheckKind is the name of the type used to represent objects +// of type 'inflight_check'. +const InflightCheckKind = "InflightCheck" + +// InflightCheckLinkKind is the name of the type used to represent links +// to objects of type 'inflight_check'. +const InflightCheckLinkKind = "InflightCheckLink" + +// InflightCheckNilKind is the name of the type used to nil references +// to objects of type 'inflight_check'. +const InflightCheckNilKind = "InflightCheckNil" + +// InflightCheck represents the values of the 'inflight_check' type. +// +// Representation of check running before the cluster is provisioned. +type InflightCheck struct { + bitmap_ uint32 + id string + href string + details interface{} + endedAt time.Time + name string + restarts int + startedAt time.Time + state InflightCheckState +} + +// Kind returns the name of the type of the object. +func (o *InflightCheck) Kind() string { + if o == nil { + return InflightCheckNilKind + } + if o.bitmap_&1 != 0 { + return InflightCheckLinkKind + } + return InflightCheckKind +} + +// Link returns true if this is a link. +func (o *InflightCheck) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *InflightCheck) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *InflightCheck) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *InflightCheck) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *InflightCheck) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *InflightCheck) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Details returns the value of the 'details' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details regarding the state of the inflight check. +func (o *InflightCheck) Details() interface{} { + if o != nil && o.bitmap_&8 != 0 { + return o.details + } + return nil +} + +// GetDetails returns the value of the 'details' attribute and +// a flag indicating if the attribute has a value. +// +// Details regarding the state of the inflight check. +func (o *InflightCheck) GetDetails() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.details + } + return +} + +// EndedAt returns the value of the 'ended_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The time the check finished running. +func (o *InflightCheck) EndedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.endedAt + } + return time.Time{} +} + +// GetEndedAt returns the value of the 'ended_at' attribute and +// a flag indicating if the attribute has a value. +// +// The time the check finished running. +func (o *InflightCheck) GetEndedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.endedAt + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the inflight check. +func (o *InflightCheck) Name() string { + if o != nil && o.bitmap_&32 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the inflight check. +func (o *InflightCheck) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.name + } + return +} + +// Restarts returns the value of the 'restarts' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The number of times the inflight check restarted. +func (o *InflightCheck) Restarts() int { + if o != nil && o.bitmap_&64 != 0 { + return o.restarts + } + return 0 +} + +// GetRestarts returns the value of the 'restarts' attribute and +// a flag indicating if the attribute has a value. +// +// The number of times the inflight check restarted. +func (o *InflightCheck) GetRestarts() (value int, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.restarts + } + return +} + +// StartedAt returns the value of the 'started_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The time the check started running. +func (o *InflightCheck) StartedAt() time.Time { + if o != nil && o.bitmap_&128 != 0 { + return o.startedAt + } + return time.Time{} +} + +// GetStartedAt returns the value of the 'started_at' attribute and +// a flag indicating if the attribute has a value. +// +// The time the check started running. +func (o *InflightCheck) GetStartedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.startedAt + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// State of the inflight check. +func (o *InflightCheck) State() InflightCheckState { + if o != nil && o.bitmap_&256 != 0 { + return o.state + } + return InflightCheckState("") +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// State of the inflight check. +func (o *InflightCheck) GetState() (value InflightCheckState, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.state + } + return +} + +// InflightCheckListKind is the name of the type used to represent list of objects of +// type 'inflight_check'. +const InflightCheckListKind = "InflightCheckList" + +// InflightCheckListLinkKind is the name of the type used to represent links to list +// of objects of type 'inflight_check'. +const InflightCheckListLinkKind = "InflightCheckListLink" + +// InflightCheckNilKind is the name of the type used to nil lists of objects of +// type 'inflight_check'. +const InflightCheckListNilKind = "InflightCheckListNil" + +// InflightCheckList is a list of values of the 'inflight_check' type. +type InflightCheckList struct { + href string + link bool + items []*InflightCheck +} + +// Kind returns the name of the type of the object. +func (l *InflightCheckList) Kind() string { + if l == nil { + return InflightCheckListNilKind + } + if l.link { + return InflightCheckListLinkKind + } + return InflightCheckListKind +} + +// Link returns true iif this is a link. +func (l *InflightCheckList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *InflightCheckList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *InflightCheckList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *InflightCheckList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *InflightCheckList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *InflightCheckList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *InflightCheckList) SetItems(items []*InflightCheck) { + l.items = items +} + +// Items returns the items of the list. +func (l *InflightCheckList) Items() []*InflightCheck { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *InflightCheckList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *InflightCheckList) Get(i int) *InflightCheck { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *InflightCheckList) Slice() []*InflightCheck { + var slice []*InflightCheck + if l == nil { + slice = make([]*InflightCheck, 0) + } else { + slice = make([]*InflightCheck, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *InflightCheckList) Each(f func(item *InflightCheck) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *InflightCheckList) Range(f func(index int, item *InflightCheck) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/inflight_check_type_json.go b/clientapi/clustersmgmt/v1/inflight_check_type_json.go new file mode 100644 index 00000000..fe9e94a0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/inflight_check_type_json.go @@ -0,0 +1,196 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInflightCheck writes a value of the 'inflight_check' type to the given writer. +func MarshalInflightCheck(object *InflightCheck, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInflightCheck(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInflightCheck writes a value of the 'inflight_check' type to the given stream. +func WriteInflightCheck(object *InflightCheck, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(InflightCheckLinkKind) + } else { + stream.WriteString(InflightCheckKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("details") + stream.WriteVal(object.details) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ended_at") + stream.WriteString((object.endedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("restarts") + stream.WriteInt(object.restarts) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("started_at") + stream.WriteString((object.startedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(string(object.state)) + } + stream.WriteObjectEnd() +} + +// UnmarshalInflightCheck reads a value of the 'inflight_check' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalInflightCheck(source interface{}) (object *InflightCheck, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadInflightCheck(iterator) + err = iterator.Error + return +} + +// ReadInflightCheck reads a value of the 'inflight_check' type from the given iterator. +func ReadInflightCheck(iterator *jsoniter.Iterator) *InflightCheck { + object := &InflightCheck{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == InflightCheckLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "details": + var value interface{} + iterator.ReadVal(&value) + object.details = value + object.bitmap_ |= 8 + case "ended_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.endedAt = value + object.bitmap_ |= 16 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 32 + case "restarts": + value := iterator.ReadInt() + object.restarts = value + object.bitmap_ |= 64 + case "started_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.startedAt = value + object.bitmap_ |= 128 + case "state": + text := iterator.ReadString() + value := InflightCheckState(text) + object.state = value + object.bitmap_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/ingress_builder.go b/clientapi/clustersmgmt/v1/ingress_builder.go new file mode 100644 index 00000000..44260dae --- /dev/null +++ b/clientapi/clustersmgmt/v1/ingress_builder.go @@ -0,0 +1,241 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// IngressBuilder contains the data and logic needed to build 'ingress' objects. +// +// Representation of an ingress. +type IngressBuilder struct { + bitmap_ uint32 + id string + href string + dnsName string + clusterRoutesHostname string + clusterRoutesTlsSecretRef string + componentRoutes map[string]*ComponentRouteBuilder + excludedNamespaces []string + listening ListeningMethod + loadBalancerType LoadBalancerFlavor + routeNamespaceOwnershipPolicy NamespaceOwnershipPolicy + routeSelectors map[string]string + routeWildcardPolicy WildcardPolicy + default_ bool +} + +// NewIngress creates a new builder of 'ingress' objects. +func NewIngress() *IngressBuilder { + return &IngressBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *IngressBuilder) Link(value bool) *IngressBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *IngressBuilder) ID(value string) *IngressBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *IngressBuilder) HREF(value string) *IngressBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *IngressBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// DNSName sets the value of the 'DNS_name' attribute to the given value. +func (b *IngressBuilder) DNSName(value string) *IngressBuilder { + b.dnsName = value + b.bitmap_ |= 8 + return b +} + +// ClusterRoutesHostname sets the value of the 'cluster_routes_hostname' attribute to the given value. +func (b *IngressBuilder) ClusterRoutesHostname(value string) *IngressBuilder { + b.clusterRoutesHostname = value + b.bitmap_ |= 16 + return b +} + +// ClusterRoutesTlsSecretRef sets the value of the 'cluster_routes_tls_secret_ref' attribute to the given value. +func (b *IngressBuilder) ClusterRoutesTlsSecretRef(value string) *IngressBuilder { + b.clusterRoutesTlsSecretRef = value + b.bitmap_ |= 32 + return b +} + +// ComponentRoutes sets the value of the 'component_routes' attribute to the given value. +func (b *IngressBuilder) ComponentRoutes(value map[string]*ComponentRouteBuilder) *IngressBuilder { + b.componentRoutes = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Default sets the value of the 'default' attribute to the given value. +func (b *IngressBuilder) Default(value bool) *IngressBuilder { + b.default_ = value + b.bitmap_ |= 128 + return b +} + +// ExcludedNamespaces sets the value of the 'excluded_namespaces' attribute to the given values. +func (b *IngressBuilder) ExcludedNamespaces(values ...string) *IngressBuilder { + b.excludedNamespaces = make([]string, len(values)) + copy(b.excludedNamespaces, values) + b.bitmap_ |= 256 + return b +} + +// Listening sets the value of the 'listening' attribute to the given value. +// +// Cluster components listening method. +func (b *IngressBuilder) Listening(value ListeningMethod) *IngressBuilder { + b.listening = value + b.bitmap_ |= 512 + return b +} + +// LoadBalancerType sets the value of the 'load_balancer_type' attribute to the given value. +// +// Type of load balancer for AWS cloud provider parameters. +func (b *IngressBuilder) LoadBalancerType(value LoadBalancerFlavor) *IngressBuilder { + b.loadBalancerType = value + b.bitmap_ |= 1024 + return b +} + +// RouteNamespaceOwnershipPolicy sets the value of the 'route_namespace_ownership_policy' attribute to the given value. +// +// Type of Namespace Ownership Policy. +func (b *IngressBuilder) RouteNamespaceOwnershipPolicy(value NamespaceOwnershipPolicy) *IngressBuilder { + b.routeNamespaceOwnershipPolicy = value + b.bitmap_ |= 2048 + return b +} + +// RouteSelectors sets the value of the 'route_selectors' attribute to the given value. +func (b *IngressBuilder) RouteSelectors(value map[string]string) *IngressBuilder { + b.routeSelectors = value + if value != nil { + b.bitmap_ |= 4096 + } else { + b.bitmap_ &^= 4096 + } + return b +} + +// RouteWildcardPolicy sets the value of the 'route_wildcard_policy' attribute to the given value. +// +// Type of wildcard policy. +func (b *IngressBuilder) RouteWildcardPolicy(value WildcardPolicy) *IngressBuilder { + b.routeWildcardPolicy = value + b.bitmap_ |= 8192 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *IngressBuilder) Copy(object *Ingress) *IngressBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.dnsName = object.dnsName + b.clusterRoutesHostname = object.clusterRoutesHostname + b.clusterRoutesTlsSecretRef = object.clusterRoutesTlsSecretRef + if len(object.componentRoutes) > 0 { + b.componentRoutes = map[string]*ComponentRouteBuilder{} + for k, v := range object.componentRoutes { + b.componentRoutes[k] = NewComponentRoute().Copy(v) + } + } else { + b.componentRoutes = nil + } + b.default_ = object.default_ + if object.excludedNamespaces != nil { + b.excludedNamespaces = make([]string, len(object.excludedNamespaces)) + copy(b.excludedNamespaces, object.excludedNamespaces) + } else { + b.excludedNamespaces = nil + } + b.listening = object.listening + b.loadBalancerType = object.loadBalancerType + b.routeNamespaceOwnershipPolicy = object.routeNamespaceOwnershipPolicy + if len(object.routeSelectors) > 0 { + b.routeSelectors = map[string]string{} + for k, v := range object.routeSelectors { + b.routeSelectors[k] = v + } + } else { + b.routeSelectors = nil + } + b.routeWildcardPolicy = object.routeWildcardPolicy + return b +} + +// Build creates a 'ingress' object using the configuration stored in the builder. +func (b *IngressBuilder) Build() (object *Ingress, err error) { + object = new(Ingress) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.dnsName = b.dnsName + object.clusterRoutesHostname = b.clusterRoutesHostname + object.clusterRoutesTlsSecretRef = b.clusterRoutesTlsSecretRef + if b.componentRoutes != nil { + object.componentRoutes = make(map[string]*ComponentRoute) + for k, v := range b.componentRoutes { + object.componentRoutes[k], err = v.Build() + if err != nil { + return + } + } + } + object.default_ = b.default_ + if b.excludedNamespaces != nil { + object.excludedNamespaces = make([]string, len(b.excludedNamespaces)) + copy(object.excludedNamespaces, b.excludedNamespaces) + } + object.listening = b.listening + object.loadBalancerType = b.loadBalancerType + object.routeNamespaceOwnershipPolicy = b.routeNamespaceOwnershipPolicy + if b.routeSelectors != nil { + object.routeSelectors = make(map[string]string) + for k, v := range b.routeSelectors { + object.routeSelectors[k] = v + } + } + object.routeWildcardPolicy = b.routeWildcardPolicy + return +} diff --git a/clientapi/clustersmgmt/v1/ingress_list_builder.go b/clientapi/clustersmgmt/v1/ingress_list_builder.go new file mode 100644 index 00000000..b0f40a43 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ingress_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// IngressListBuilder contains the data and logic needed to build +// 'ingress' objects. +type IngressListBuilder struct { + items []*IngressBuilder +} + +// NewIngressList creates a new builder of 'ingress' objects. +func NewIngressList() *IngressListBuilder { + return new(IngressListBuilder) +} + +// Items sets the items of the list. +func (b *IngressListBuilder) Items(values ...*IngressBuilder) *IngressListBuilder { + b.items = make([]*IngressBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *IngressListBuilder) 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 *IngressListBuilder) Copy(list *IngressList) *IngressListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*IngressBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewIngress().Copy(v) + } + } + return b +} + +// Build creates a list of 'ingress' objects using the +// configuration stored in the builder. +func (b *IngressListBuilder) Build() (list *IngressList, err error) { + items := make([]*Ingress, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(IngressList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/ingress_list_type_json.go b/clientapi/clustersmgmt/v1/ingress_list_type_json.go new file mode 100644 index 00000000..6da4e8ea --- /dev/null +++ b/clientapi/clustersmgmt/v1/ingress_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIngressList writes a list of values of the 'ingress' type to +// the given writer. +func MarshalIngressList(list []*Ingress, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIngressList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIngressList writes a list of value of the 'ingress' type to +// the given stream. +func WriteIngressList(list []*Ingress, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteIngress(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalIngressList reads a list of values of the 'ingress' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIngressList(source interface{}) (items []*Ingress, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIngressList(iterator) + err = iterator.Error + return +} + +// ReadIngressList reads list of values of the ”ingress' type from +// the given iterator. +func ReadIngressList(iterator *jsoniter.Iterator) []*Ingress { + list := []*Ingress{} + for iterator.ReadArray() { + item := ReadIngress(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/ingress_type.go b/clientapi/clustersmgmt/v1/ingress_type.go new file mode 100644 index 00000000..fa92b96f --- /dev/null +++ b/clientapi/clustersmgmt/v1/ingress_type.go @@ -0,0 +1,505 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// IngressKind is the name of the type used to represent objects +// of type 'ingress'. +const IngressKind = "Ingress" + +// IngressLinkKind is the name of the type used to represent links +// to objects of type 'ingress'. +const IngressLinkKind = "IngressLink" + +// IngressNilKind is the name of the type used to nil references +// to objects of type 'ingress'. +const IngressNilKind = "IngressNil" + +// Ingress represents the values of the 'ingress' type. +// +// Representation of an ingress. +type Ingress struct { + bitmap_ uint32 + id string + href string + dnsName string + clusterRoutesHostname string + clusterRoutesTlsSecretRef string + componentRoutes map[string]*ComponentRoute + excludedNamespaces []string + listening ListeningMethod + loadBalancerType LoadBalancerFlavor + routeNamespaceOwnershipPolicy NamespaceOwnershipPolicy + routeSelectors map[string]string + routeWildcardPolicy WildcardPolicy + default_ bool +} + +// Kind returns the name of the type of the object. +func (o *Ingress) Kind() string { + if o == nil { + return IngressNilKind + } + if o.bitmap_&1 != 0 { + return IngressLinkKind + } + return IngressKind +} + +// Link returns true if this is a link. +func (o *Ingress) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Ingress) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Ingress) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Ingress) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Ingress) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Ingress) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// DNSName returns the value of the 'DNS_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DNS Name of the ingress. +func (o *Ingress) DNSName() string { + if o != nil && o.bitmap_&8 != 0 { + return o.dnsName + } + return "" +} + +// GetDNSName returns the value of the 'DNS_name' attribute and +// a flag indicating if the attribute has a value. +// +// DNS Name of the ingress. +func (o *Ingress) GetDNSName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.dnsName + } + return +} + +// ClusterRoutesHostname returns the value of the 'cluster_routes_hostname' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster routes hostname. +func (o *Ingress) ClusterRoutesHostname() string { + if o != nil && o.bitmap_&16 != 0 { + return o.clusterRoutesHostname + } + return "" +} + +// GetClusterRoutesHostname returns the value of the 'cluster_routes_hostname' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster routes hostname. +func (o *Ingress) GetClusterRoutesHostname() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.clusterRoutesHostname + } + return +} + +// ClusterRoutesTlsSecretRef returns the value of the 'cluster_routes_tls_secret_ref' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster routes TLS Secret reference. +func (o *Ingress) ClusterRoutesTlsSecretRef() string { + if o != nil && o.bitmap_&32 != 0 { + return o.clusterRoutesTlsSecretRef + } + return "" +} + +// GetClusterRoutesTlsSecretRef returns the value of the 'cluster_routes_tls_secret_ref' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster routes TLS Secret reference. +func (o *Ingress) GetClusterRoutesTlsSecretRef() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.clusterRoutesTlsSecretRef + } + return +} + +// ComponentRoutes returns the value of the 'component_routes' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Component Routes settings. +func (o *Ingress) ComponentRoutes() map[string]*ComponentRoute { + if o != nil && o.bitmap_&64 != 0 { + return o.componentRoutes + } + return nil +} + +// GetComponentRoutes returns the value of the 'component_routes' attribute and +// a flag indicating if the attribute has a value. +// +// Component Routes settings. +func (o *Ingress) GetComponentRoutes() (value map[string]*ComponentRoute, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.componentRoutes + } + return +} + +// Default returns the value of the 'default' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this is the default ingress. +func (o *Ingress) Default() bool { + if o != nil && o.bitmap_&128 != 0 { + return o.default_ + } + return false +} + +// GetDefault returns the value of the 'default' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this is the default ingress. +func (o *Ingress) GetDefault() (value bool, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.default_ + } + return +} + +// ExcludedNamespaces returns the value of the 'excluded_namespaces' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// A set of excluded namespaces for the ingress. +func (o *Ingress) ExcludedNamespaces() []string { + if o != nil && o.bitmap_&256 != 0 { + return o.excludedNamespaces + } + return nil +} + +// GetExcludedNamespaces returns the value of the 'excluded_namespaces' attribute and +// a flag indicating if the attribute has a value. +// +// A set of excluded namespaces for the ingress. +func (o *Ingress) GetExcludedNamespaces() (value []string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.excludedNamespaces + } + return +} + +// Listening returns the value of the 'listening' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Listening method of the ingress +func (o *Ingress) Listening() ListeningMethod { + if o != nil && o.bitmap_&512 != 0 { + return o.listening + } + return ListeningMethod("") +} + +// GetListening returns the value of the 'listening' attribute and +// a flag indicating if the attribute has a value. +// +// Listening method of the ingress +func (o *Ingress) GetListening() (value ListeningMethod, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.listening + } + return +} + +// LoadBalancerType returns the value of the 'load_balancer_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Load Balancer type of the ingress +func (o *Ingress) LoadBalancerType() LoadBalancerFlavor { + if o != nil && o.bitmap_&1024 != 0 { + return o.loadBalancerType + } + return LoadBalancerFlavor("") +} + +// GetLoadBalancerType returns the value of the 'load_balancer_type' attribute and +// a flag indicating if the attribute has a value. +// +// Load Balancer type of the ingress +func (o *Ingress) GetLoadBalancerType() (value LoadBalancerFlavor, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.loadBalancerType + } + return +} + +// RouteNamespaceOwnershipPolicy returns the value of the 'route_namespace_ownership_policy' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Namespace Ownership Policy for the ingress. +func (o *Ingress) RouteNamespaceOwnershipPolicy() NamespaceOwnershipPolicy { + if o != nil && o.bitmap_&2048 != 0 { + return o.routeNamespaceOwnershipPolicy + } + return NamespaceOwnershipPolicy("") +} + +// GetRouteNamespaceOwnershipPolicy returns the value of the 'route_namespace_ownership_policy' attribute and +// a flag indicating if the attribute has a value. +// +// Namespace Ownership Policy for the ingress. +func (o *Ingress) GetRouteNamespaceOwnershipPolicy() (value NamespaceOwnershipPolicy, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.routeNamespaceOwnershipPolicy + } + return +} + +// RouteSelectors returns the value of the 'route_selectors' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// A set of labels for the ingress. +func (o *Ingress) RouteSelectors() map[string]string { + if o != nil && o.bitmap_&4096 != 0 { + return o.routeSelectors + } + return nil +} + +// GetRouteSelectors returns the value of the 'route_selectors' attribute and +// a flag indicating if the attribute has a value. +// +// A set of labels for the ingress. +func (o *Ingress) GetRouteSelectors() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.routeSelectors + } + return +} + +// RouteWildcardPolicy returns the value of the 'route_wildcard_policy' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Wildcard policy for the ingress. +func (o *Ingress) RouteWildcardPolicy() WildcardPolicy { + if o != nil && o.bitmap_&8192 != 0 { + return o.routeWildcardPolicy + } + return WildcardPolicy("") +} + +// GetRouteWildcardPolicy returns the value of the 'route_wildcard_policy' attribute and +// a flag indicating if the attribute has a value. +// +// Wildcard policy for the ingress. +func (o *Ingress) GetRouteWildcardPolicy() (value WildcardPolicy, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.routeWildcardPolicy + } + return +} + +// IngressListKind is the name of the type used to represent list of objects of +// type 'ingress'. +const IngressListKind = "IngressList" + +// IngressListLinkKind is the name of the type used to represent links to list +// of objects of type 'ingress'. +const IngressListLinkKind = "IngressListLink" + +// IngressNilKind is the name of the type used to nil lists of objects of +// type 'ingress'. +const IngressListNilKind = "IngressListNil" + +// IngressList is a list of values of the 'ingress' type. +type IngressList struct { + href string + link bool + items []*Ingress +} + +// Kind returns the name of the type of the object. +func (l *IngressList) Kind() string { + if l == nil { + return IngressListNilKind + } + if l.link { + return IngressListLinkKind + } + return IngressListKind +} + +// Link returns true iif this is a link. +func (l *IngressList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *IngressList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *IngressList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *IngressList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *IngressList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *IngressList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *IngressList) SetItems(items []*Ingress) { + l.items = items +} + +// Items returns the items of the list. +func (l *IngressList) Items() []*Ingress { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *IngressList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *IngressList) Get(i int) *Ingress { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *IngressList) Slice() []*Ingress { + var slice []*Ingress + if l == nil { + slice = make([]*Ingress, 0) + } else { + slice = make([]*Ingress, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *IngressList) Each(f func(item *Ingress) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *IngressList) Range(f func(index int, item *Ingress) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/ingress_type_json.go b/clientapi/clustersmgmt/v1/ingress_type_json.go new file mode 100644 index 00000000..afaf536a --- /dev/null +++ b/clientapi/clustersmgmt/v1/ingress_type_json.go @@ -0,0 +1,311 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIngress writes a value of the 'ingress' type to the given writer. +func MarshalIngress(object *Ingress, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIngress(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIngress writes a value of the 'ingress' type to the given stream. +func WriteIngress(object *Ingress, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(IngressLinkKind) + } else { + stream.WriteString(IngressKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("dns_name") + stream.WriteString(object.dnsName) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_routes_hostname") + stream.WriteString(object.clusterRoutesHostname) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_routes_tls_secret_ref") + stream.WriteString(object.clusterRoutesTlsSecretRef) + count++ + } + present_ = object.bitmap_&64 != 0 && object.componentRoutes != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("component_routes") + if object.componentRoutes != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.componentRoutes)) + i := 0 + for key := range object.componentRoutes { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.componentRoutes[key] + stream.WriteObjectField(key) + WriteComponentRoute(item, stream) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("default") + stream.WriteBool(object.default_) + count++ + } + present_ = object.bitmap_&256 != 0 && object.excludedNamespaces != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("excluded_namespaces") + WriteStringList(object.excludedNamespaces, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("listening") + stream.WriteString(string(object.listening)) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("load_balancer_type") + stream.WriteString(string(object.loadBalancerType)) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("route_namespace_ownership_policy") + stream.WriteString(string(object.routeNamespaceOwnershipPolicy)) + count++ + } + present_ = object.bitmap_&4096 != 0 && object.routeSelectors != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("route_selectors") + if object.routeSelectors != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.routeSelectors)) + i := 0 + for key := range object.routeSelectors { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.routeSelectors[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("route_wildcard_policy") + stream.WriteString(string(object.routeWildcardPolicy)) + } + stream.WriteObjectEnd() +} + +// UnmarshalIngress reads a value of the 'ingress' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalIngress(source interface{}) (object *Ingress, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadIngress(iterator) + err = iterator.Error + return +} + +// ReadIngress reads a value of the 'ingress' type from the given iterator. +func ReadIngress(iterator *jsoniter.Iterator) *Ingress { + object := &Ingress{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == IngressLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "dns_name": + value := iterator.ReadString() + object.dnsName = value + object.bitmap_ |= 8 + case "cluster_routes_hostname": + value := iterator.ReadString() + object.clusterRoutesHostname = value + object.bitmap_ |= 16 + case "cluster_routes_tls_secret_ref": + value := iterator.ReadString() + object.clusterRoutesTlsSecretRef = value + object.bitmap_ |= 32 + case "component_routes": + value := map[string]*ComponentRoute{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := ReadComponentRoute(iterator) + value[key] = item + } + object.componentRoutes = value + object.bitmap_ |= 64 + case "default": + value := iterator.ReadBool() + object.default_ = value + object.bitmap_ |= 128 + case "excluded_namespaces": + value := ReadStringList(iterator) + object.excludedNamespaces = value + object.bitmap_ |= 256 + case "listening": + text := iterator.ReadString() + value := ListeningMethod(text) + object.listening = value + object.bitmap_ |= 512 + case "load_balancer_type": + text := iterator.ReadString() + value := LoadBalancerFlavor(text) + object.loadBalancerType = value + object.bitmap_ |= 1024 + case "route_namespace_ownership_policy": + text := iterator.ReadString() + value := NamespaceOwnershipPolicy(text) + object.routeNamespaceOwnershipPolicy = value + object.bitmap_ |= 2048 + case "route_selectors": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.routeSelectors = value + object.bitmap_ |= 4096 + case "route_wildcard_policy": + text := iterator.ReadString() + value := WildcardPolicy(text) + object.routeWildcardPolicy = value + object.bitmap_ |= 8192 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/instance_iam_roles_builder.go b/clientapi/clustersmgmt/v1/instance_iam_roles_builder.go new file mode 100644 index 00000000..e18fd1fe --- /dev/null +++ b/clientapi/clustersmgmt/v1/instance_iam_roles_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// InstanceIAMRolesBuilder contains the data and logic needed to build 'instance_IAM_roles' objects. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type InstanceIAMRolesBuilder struct { + bitmap_ uint32 + masterRoleARN string + workerRoleARN string +} + +// NewInstanceIAMRoles creates a new builder of 'instance_IAM_roles' objects. +func NewInstanceIAMRoles() *InstanceIAMRolesBuilder { + return &InstanceIAMRolesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *InstanceIAMRolesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// MasterRoleARN sets the value of the 'master_role_ARN' attribute to the given value. +func (b *InstanceIAMRolesBuilder) MasterRoleARN(value string) *InstanceIAMRolesBuilder { + b.masterRoleARN = value + b.bitmap_ |= 1 + return b +} + +// WorkerRoleARN sets the value of the 'worker_role_ARN' attribute to the given value. +func (b *InstanceIAMRolesBuilder) WorkerRoleARN(value string) *InstanceIAMRolesBuilder { + b.workerRoleARN = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *InstanceIAMRolesBuilder) Copy(object *InstanceIAMRoles) *InstanceIAMRolesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.masterRoleARN = object.masterRoleARN + b.workerRoleARN = object.workerRoleARN + return b +} + +// Build creates a 'instance_IAM_roles' object using the configuration stored in the builder. +func (b *InstanceIAMRolesBuilder) Build() (object *InstanceIAMRoles, err error) { + object = new(InstanceIAMRoles) + object.bitmap_ = b.bitmap_ + object.masterRoleARN = b.masterRoleARN + object.workerRoleARN = b.workerRoleARN + return +} diff --git a/clientapi/clustersmgmt/v1/instance_iam_roles_list_builder.go b/clientapi/clustersmgmt/v1/instance_iam_roles_list_builder.go new file mode 100644 index 00000000..231cb121 --- /dev/null +++ b/clientapi/clustersmgmt/v1/instance_iam_roles_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// InstanceIAMRolesListBuilder contains the data and logic needed to build +// 'instance_IAM_roles' objects. +type InstanceIAMRolesListBuilder struct { + items []*InstanceIAMRolesBuilder +} + +// NewInstanceIAMRolesList creates a new builder of 'instance_IAM_roles' objects. +func NewInstanceIAMRolesList() *InstanceIAMRolesListBuilder { + return new(InstanceIAMRolesListBuilder) +} + +// Items sets the items of the list. +func (b *InstanceIAMRolesListBuilder) Items(values ...*InstanceIAMRolesBuilder) *InstanceIAMRolesListBuilder { + b.items = make([]*InstanceIAMRolesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *InstanceIAMRolesListBuilder) 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 *InstanceIAMRolesListBuilder) Copy(list *InstanceIAMRolesList) *InstanceIAMRolesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*InstanceIAMRolesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewInstanceIAMRoles().Copy(v) + } + } + return b +} + +// Build creates a list of 'instance_IAM_roles' objects using the +// configuration stored in the builder. +func (b *InstanceIAMRolesListBuilder) Build() (list *InstanceIAMRolesList, err error) { + items := make([]*InstanceIAMRoles, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(InstanceIAMRolesList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/instance_iam_roles_list_type_json.go b/clientapi/clustersmgmt/v1/instance_iam_roles_list_type_json.go new file mode 100644 index 00000000..652f0608 --- /dev/null +++ b/clientapi/clustersmgmt/v1/instance_iam_roles_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInstanceIAMRolesList writes a list of values of the 'instance_IAM_roles' type to +// the given writer. +func MarshalInstanceIAMRolesList(list []*InstanceIAMRoles, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInstanceIAMRolesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInstanceIAMRolesList writes a list of value of the 'instance_IAM_roles' type to +// the given stream. +func WriteInstanceIAMRolesList(list []*InstanceIAMRoles, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteInstanceIAMRoles(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalInstanceIAMRolesList reads a list of values of the 'instance_IAM_roles' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInstanceIAMRolesList(source interface{}) (items []*InstanceIAMRoles, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInstanceIAMRolesList(iterator) + err = iterator.Error + return +} + +// ReadInstanceIAMRolesList reads list of values of the ”instance_IAM_roles' type from +// the given iterator. +func ReadInstanceIAMRolesList(iterator *jsoniter.Iterator) []*InstanceIAMRoles { + list := []*InstanceIAMRoles{} + for iterator.ReadArray() { + item := ReadInstanceIAMRoles(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/instance_iam_roles_type.go b/clientapi/clustersmgmt/v1/instance_iam_roles_type.go new file mode 100644 index 00000000..c22459e3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/instance_iam_roles_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// InstanceIAMRoles represents the values of the 'instance_IAM_roles' type. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type InstanceIAMRoles struct { + bitmap_ uint32 + masterRoleARN string + workerRoleARN string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *InstanceIAMRoles) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// MasterRoleARN returns the value of the 'master_role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The IAM role ARN that will be attached to master instances +func (o *InstanceIAMRoles) MasterRoleARN() string { + if o != nil && o.bitmap_&1 != 0 { + return o.masterRoleARN + } + return "" +} + +// GetMasterRoleARN returns the value of the 'master_role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// The IAM role ARN that will be attached to master instances +func (o *InstanceIAMRoles) GetMasterRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.masterRoleARN + } + return +} + +// WorkerRoleARN returns the value of the 'worker_role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The IAM role ARN that will be attached to worker instances +func (o *InstanceIAMRoles) WorkerRoleARN() string { + if o != nil && o.bitmap_&2 != 0 { + return o.workerRoleARN + } + return "" +} + +// GetWorkerRoleARN returns the value of the 'worker_role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// The IAM role ARN that will be attached to worker instances +func (o *InstanceIAMRoles) GetWorkerRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.workerRoleARN + } + return +} + +// InstanceIAMRolesListKind is the name of the type used to represent list of objects of +// type 'instance_IAM_roles'. +const InstanceIAMRolesListKind = "InstanceIAMRolesList" + +// InstanceIAMRolesListLinkKind is the name of the type used to represent links to list +// of objects of type 'instance_IAM_roles'. +const InstanceIAMRolesListLinkKind = "InstanceIAMRolesListLink" + +// InstanceIAMRolesNilKind is the name of the type used to nil lists of objects of +// type 'instance_IAM_roles'. +const InstanceIAMRolesListNilKind = "InstanceIAMRolesListNil" + +// InstanceIAMRolesList is a list of values of the 'instance_IAM_roles' type. +type InstanceIAMRolesList struct { + href string + link bool + items []*InstanceIAMRoles +} + +// Len returns the length of the list. +func (l *InstanceIAMRolesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *InstanceIAMRolesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *InstanceIAMRolesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *InstanceIAMRolesList) SetItems(items []*InstanceIAMRoles) { + l.items = items +} + +// Items returns the items of the list. +func (l *InstanceIAMRolesList) Items() []*InstanceIAMRoles { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *InstanceIAMRolesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *InstanceIAMRolesList) Get(i int) *InstanceIAMRoles { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *InstanceIAMRolesList) Slice() []*InstanceIAMRoles { + var slice []*InstanceIAMRoles + if l == nil { + slice = make([]*InstanceIAMRoles, 0) + } else { + slice = make([]*InstanceIAMRoles, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *InstanceIAMRolesList) Each(f func(item *InstanceIAMRoles) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *InstanceIAMRolesList) Range(f func(index int, item *InstanceIAMRoles) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/instance_iam_roles_type_json.go b/clientapi/clustersmgmt/v1/instance_iam_roles_type_json.go new file mode 100644 index 00000000..1ced72ad --- /dev/null +++ b/clientapi/clustersmgmt/v1/instance_iam_roles_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInstanceIAMRoles writes a value of the 'instance_IAM_roles' type to the given writer. +func MarshalInstanceIAMRoles(object *InstanceIAMRoles, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInstanceIAMRoles(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInstanceIAMRoles writes a value of the 'instance_IAM_roles' type to the given stream. +func WriteInstanceIAMRoles(object *InstanceIAMRoles, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("master_role_arn") + stream.WriteString(object.masterRoleARN) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("worker_role_arn") + stream.WriteString(object.workerRoleARN) + } + stream.WriteObjectEnd() +} + +// UnmarshalInstanceIAMRoles reads a value of the 'instance_IAM_roles' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalInstanceIAMRoles(source interface{}) (object *InstanceIAMRoles, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadInstanceIAMRoles(iterator) + err = iterator.Error + return +} + +// ReadInstanceIAMRoles reads a value of the 'instance_IAM_roles' type from the given iterator. +func ReadInstanceIAMRoles(iterator *jsoniter.Iterator) *InstanceIAMRoles { + object := &InstanceIAMRoles{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "master_role_arn": + value := iterator.ReadString() + object.masterRoleARN = value + object.bitmap_ |= 1 + case "worker_role_arn": + value := iterator.ReadString() + object.workerRoleARN = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/integer_list_type_json.go b/clientapi/clustersmgmt/v1/integer_list_type_json.go new file mode 100644 index 00000000..c621f5f2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/integer_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIntegerList writes a list of values of the 'integer' type to +// the given writer. +func MarshalIntegerList(list []int, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIntegerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIntegerList writes a list of value of the 'integer' type to +// the given stream. +func WriteIntegerList(list []int, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalIntegerList reads a list of values of the 'integer' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIntegerList(source interface{}) (items []int, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIntegerList(iterator) + err = iterator.Error + return +} + +// ReadIntegerList reads list of values of the ”integer' type from +// the given iterator. +func ReadIntegerList(iterator *jsoniter.Iterator) []int { + list := []int{} + for iterator.ReadArray() { + item := iterator.ReadInt() + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/interface_list_type_json.go b/clientapi/clustersmgmt/v1/interface_list_type_json.go new file mode 100644 index 00000000..b8655309 --- /dev/null +++ b/clientapi/clustersmgmt/v1/interface_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInterfaceList writes a list of values of the 'interface' type to +// the given writer. +func MarshalInterfaceList(list []interface{}, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInterfaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInterfaceList writes a list of value of the 'interface' type to +// the given stream. +func WriteInterfaceList(list []interface{}, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteVal(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalInterfaceList reads a list of values of the 'interface' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInterfaceList(source interface{}) (items []interface{}, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInterfaceList(iterator) + err = iterator.Error + return +} + +// ReadInterfaceList reads list of values of the ”interface' type from +// the given iterator. +func ReadInterfaceList(iterator *jsoniter.Iterator) []interface{} { + list := []interface{}{} + for iterator.ReadArray() { + var item interface{} + iterator.ReadVal(&item) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/key_ring_builder.go b/clientapi/clustersmgmt/v1/key_ring_builder.go new file mode 100644 index 00000000..531f2fea --- /dev/null +++ b/clientapi/clustersmgmt/v1/key_ring_builder.go @@ -0,0 +1,89 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// KeyRingBuilder contains the data and logic needed to build 'key_ring' objects. +// +// Description of a cloud provider key ring. +type KeyRingBuilder struct { + bitmap_ uint32 + id string + href string + name string +} + +// NewKeyRing creates a new builder of 'key_ring' objects. +func NewKeyRing() *KeyRingBuilder { + return &KeyRingBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *KeyRingBuilder) Link(value bool) *KeyRingBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *KeyRingBuilder) ID(value string) *KeyRingBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *KeyRingBuilder) HREF(value string) *KeyRingBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *KeyRingBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *KeyRingBuilder) Name(value string) *KeyRingBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *KeyRingBuilder) Copy(object *KeyRing) *KeyRingBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.name = object.name + return b +} + +// Build creates a 'key_ring' object using the configuration stored in the builder. +func (b *KeyRingBuilder) Build() (object *KeyRing, err error) { + object = new(KeyRing) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.name = b.name + return +} diff --git a/clientapi/clustersmgmt/v1/key_ring_list_builder.go b/clientapi/clustersmgmt/v1/key_ring_list_builder.go new file mode 100644 index 00000000..283aa48e --- /dev/null +++ b/clientapi/clustersmgmt/v1/key_ring_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// KeyRingListBuilder contains the data and logic needed to build +// 'key_ring' objects. +type KeyRingListBuilder struct { + items []*KeyRingBuilder +} + +// NewKeyRingList creates a new builder of 'key_ring' objects. +func NewKeyRingList() *KeyRingListBuilder { + return new(KeyRingListBuilder) +} + +// Items sets the items of the list. +func (b *KeyRingListBuilder) Items(values ...*KeyRingBuilder) *KeyRingListBuilder { + b.items = make([]*KeyRingBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *KeyRingListBuilder) 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 *KeyRingListBuilder) Copy(list *KeyRingList) *KeyRingListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*KeyRingBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewKeyRing().Copy(v) + } + } + return b +} + +// Build creates a list of 'key_ring' objects using the +// configuration stored in the builder. +func (b *KeyRingListBuilder) Build() (list *KeyRingList, err error) { + items := make([]*KeyRing, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(KeyRingList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/key_ring_list_type_json.go b/clientapi/clustersmgmt/v1/key_ring_list_type_json.go new file mode 100644 index 00000000..a6b04a07 --- /dev/null +++ b/clientapi/clustersmgmt/v1/key_ring_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalKeyRingList writes a list of values of the 'key_ring' type to +// the given writer. +func MarshalKeyRingList(list []*KeyRing, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteKeyRingList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteKeyRingList writes a list of value of the 'key_ring' type to +// the given stream. +func WriteKeyRingList(list []*KeyRing, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteKeyRing(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalKeyRingList reads a list of values of the 'key_ring' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalKeyRingList(source interface{}) (items []*KeyRing, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadKeyRingList(iterator) + err = iterator.Error + return +} + +// ReadKeyRingList reads list of values of the ”key_ring' type from +// the given iterator. +func ReadKeyRingList(iterator *jsoniter.Iterator) []*KeyRing { + list := []*KeyRing{} + for iterator.ReadArray() { + item := ReadKeyRing(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/key_ring_type.go b/clientapi/clustersmgmt/v1/key_ring_type.go new file mode 100644 index 00000000..0ad3191b --- /dev/null +++ b/clientapi/clustersmgmt/v1/key_ring_type.go @@ -0,0 +1,265 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// KeyRingKind is the name of the type used to represent objects +// of type 'key_ring'. +const KeyRingKind = "KeyRing" + +// KeyRingLinkKind is the name of the type used to represent links +// to objects of type 'key_ring'. +const KeyRingLinkKind = "KeyRingLink" + +// KeyRingNilKind is the name of the type used to nil references +// to objects of type 'key_ring'. +const KeyRingNilKind = "KeyRingNil" + +// KeyRing represents the values of the 'key_ring' type. +// +// Description of a cloud provider key ring. +type KeyRing struct { + bitmap_ uint32 + id string + href string + name string +} + +// Kind returns the name of the type of the object. +func (o *KeyRing) Kind() string { + if o == nil { + return KeyRingNilKind + } + if o.bitmap_&1 != 0 { + return KeyRingLinkKind + } + return KeyRingKind +} + +// Link returns true if this is a link. +func (o *KeyRing) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *KeyRing) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *KeyRing) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *KeyRing) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *KeyRing) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *KeyRing) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the key ring. +func (o *KeyRing) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the key ring. +func (o *KeyRing) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// KeyRingListKind is the name of the type used to represent list of objects of +// type 'key_ring'. +const KeyRingListKind = "KeyRingList" + +// KeyRingListLinkKind is the name of the type used to represent links to list +// of objects of type 'key_ring'. +const KeyRingListLinkKind = "KeyRingListLink" + +// KeyRingNilKind is the name of the type used to nil lists of objects of +// type 'key_ring'. +const KeyRingListNilKind = "KeyRingListNil" + +// KeyRingList is a list of values of the 'key_ring' type. +type KeyRingList struct { + href string + link bool + items []*KeyRing +} + +// Kind returns the name of the type of the object. +func (l *KeyRingList) Kind() string { + if l == nil { + return KeyRingListNilKind + } + if l.link { + return KeyRingListLinkKind + } + return KeyRingListKind +} + +// Link returns true iif this is a link. +func (l *KeyRingList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *KeyRingList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *KeyRingList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *KeyRingList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *KeyRingList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *KeyRingList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *KeyRingList) SetItems(items []*KeyRing) { + l.items = items +} + +// Items returns the items of the list. +func (l *KeyRingList) Items() []*KeyRing { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *KeyRingList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *KeyRingList) Get(i int) *KeyRing { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *KeyRingList) Slice() []*KeyRing { + var slice []*KeyRing + if l == nil { + slice = make([]*KeyRing, 0) + } else { + slice = make([]*KeyRing, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *KeyRingList) Each(f func(item *KeyRing) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *KeyRingList) Range(f func(index int, item *KeyRing) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/key_ring_type_json.go b/clientapi/clustersmgmt/v1/key_ring_type_json.go new file mode 100644 index 00000000..cfbb8604 --- /dev/null +++ b/clientapi/clustersmgmt/v1/key_ring_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalKeyRing writes a value of the 'key_ring' type to the given writer. +func MarshalKeyRing(object *KeyRing, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteKeyRing(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteKeyRing writes a value of the 'key_ring' type to the given stream. +func WriteKeyRing(object *KeyRing, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(KeyRingLinkKind) + } else { + stream.WriteString(KeyRingKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + } + stream.WriteObjectEnd() +} + +// UnmarshalKeyRing reads a value of the 'key_ring' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalKeyRing(source interface{}) (object *KeyRing, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadKeyRing(iterator) + err = iterator.Error + return +} + +// ReadKeyRing reads a value of the 'key_ring' type from the given iterator. +func ReadKeyRing(iterator *jsoniter.Iterator) *KeyRing { + object := &KeyRing{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == KeyRingLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/kubelet_config_builder.go b/clientapi/clustersmgmt/v1/kubelet_config_builder.go new file mode 100644 index 00000000..0aa25904 --- /dev/null +++ b/clientapi/clustersmgmt/v1/kubelet_config_builder.go @@ -0,0 +1,100 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// KubeletConfigBuilder contains the data and logic needed to build 'kubelet_config' objects. +// +// OCM representation of KubeletConfig, exposing the fields of Kubernetes +// KubeletConfig that can be managed by users +type KubeletConfigBuilder struct { + bitmap_ uint32 + id string + href string + name string + podPidsLimit int +} + +// NewKubeletConfig creates a new builder of 'kubelet_config' objects. +func NewKubeletConfig() *KubeletConfigBuilder { + return &KubeletConfigBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *KubeletConfigBuilder) Link(value bool) *KubeletConfigBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *KubeletConfigBuilder) ID(value string) *KubeletConfigBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *KubeletConfigBuilder) HREF(value string) *KubeletConfigBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *KubeletConfigBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *KubeletConfigBuilder) Name(value string) *KubeletConfigBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// PodPidsLimit sets the value of the 'pod_pids_limit' attribute to the given value. +func (b *KubeletConfigBuilder) PodPidsLimit(value int) *KubeletConfigBuilder { + b.podPidsLimit = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *KubeletConfigBuilder) Copy(object *KubeletConfig) *KubeletConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.name = object.name + b.podPidsLimit = object.podPidsLimit + return b +} + +// Build creates a 'kubelet_config' object using the configuration stored in the builder. +func (b *KubeletConfigBuilder) Build() (object *KubeletConfig, err error) { + object = new(KubeletConfig) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.name = b.name + object.podPidsLimit = b.podPidsLimit + return +} diff --git a/clientapi/clustersmgmt/v1/kubelet_config_list_builder.go b/clientapi/clustersmgmt/v1/kubelet_config_list_builder.go new file mode 100644 index 00000000..eee46a2c --- /dev/null +++ b/clientapi/clustersmgmt/v1/kubelet_config_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// KubeletConfigListBuilder contains the data and logic needed to build +// 'kubelet_config' objects. +type KubeletConfigListBuilder struct { + items []*KubeletConfigBuilder +} + +// NewKubeletConfigList creates a new builder of 'kubelet_config' objects. +func NewKubeletConfigList() *KubeletConfigListBuilder { + return new(KubeletConfigListBuilder) +} + +// Items sets the items of the list. +func (b *KubeletConfigListBuilder) Items(values ...*KubeletConfigBuilder) *KubeletConfigListBuilder { + b.items = make([]*KubeletConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *KubeletConfigListBuilder) 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 *KubeletConfigListBuilder) Copy(list *KubeletConfigList) *KubeletConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*KubeletConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewKubeletConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'kubelet_config' objects using the +// configuration stored in the builder. +func (b *KubeletConfigListBuilder) Build() (list *KubeletConfigList, err error) { + items := make([]*KubeletConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(KubeletConfigList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/kubelet_config_list_type_json.go b/clientapi/clustersmgmt/v1/kubelet_config_list_type_json.go new file mode 100644 index 00000000..ff4b46e5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/kubelet_config_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalKubeletConfigList writes a list of values of the 'kubelet_config' type to +// the given writer. +func MarshalKubeletConfigList(list []*KubeletConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteKubeletConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteKubeletConfigList writes a list of value of the 'kubelet_config' type to +// the given stream. +func WriteKubeletConfigList(list []*KubeletConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteKubeletConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalKubeletConfigList reads a list of values of the 'kubelet_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalKubeletConfigList(source interface{}) (items []*KubeletConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadKubeletConfigList(iterator) + err = iterator.Error + return +} + +// ReadKubeletConfigList reads list of values of the ”kubelet_config' type from +// the given iterator. +func ReadKubeletConfigList(iterator *jsoniter.Iterator) []*KubeletConfig { + list := []*KubeletConfig{} + for iterator.ReadArray() { + item := ReadKubeletConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/kubelet_config_type.go b/clientapi/clustersmgmt/v1/kubelet_config_type.go new file mode 100644 index 00000000..dd0dfd7d --- /dev/null +++ b/clientapi/clustersmgmt/v1/kubelet_config_type.go @@ -0,0 +1,294 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// KubeletConfigKind is the name of the type used to represent objects +// of type 'kubelet_config'. +const KubeletConfigKind = "KubeletConfig" + +// KubeletConfigLinkKind is the name of the type used to represent links +// to objects of type 'kubelet_config'. +const KubeletConfigLinkKind = "KubeletConfigLink" + +// KubeletConfigNilKind is the name of the type used to nil references +// to objects of type 'kubelet_config'. +const KubeletConfigNilKind = "KubeletConfigNil" + +// KubeletConfig represents the values of the 'kubelet_config' type. +// +// OCM representation of KubeletConfig, exposing the fields of Kubernetes +// KubeletConfig that can be managed by users +type KubeletConfig struct { + bitmap_ uint32 + id string + href string + name string + podPidsLimit int +} + +// Kind returns the name of the type of the object. +func (o *KubeletConfig) Kind() string { + if o == nil { + return KubeletConfigNilKind + } + if o.bitmap_&1 != 0 { + return KubeletConfigLinkKind + } + return KubeletConfigKind +} + +// Link returns true if this is a link. +func (o *KubeletConfig) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *KubeletConfig) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *KubeletConfig) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *KubeletConfig) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *KubeletConfig) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *KubeletConfig) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Allows the user to specify the name to be used to identify this KubeletConfig. +// Optional. A name will be generated if not provided. +func (o *KubeletConfig) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Allows the user to specify the name to be used to identify this KubeletConfig. +// Optional. A name will be generated if not provided. +func (o *KubeletConfig) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// PodPidsLimit returns the value of the 'pod_pids_limit' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Allows the user to specify the podPidsLimit to be applied via KubeletConfig. +// Useful if workloads have greater PIDs limit requirements than the OCP default. +func (o *KubeletConfig) PodPidsLimit() int { + if o != nil && o.bitmap_&16 != 0 { + return o.podPidsLimit + } + return 0 +} + +// GetPodPidsLimit returns the value of the 'pod_pids_limit' attribute and +// a flag indicating if the attribute has a value. +// +// Allows the user to specify the podPidsLimit to be applied via KubeletConfig. +// Useful if workloads have greater PIDs limit requirements than the OCP default. +func (o *KubeletConfig) GetPodPidsLimit() (value int, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.podPidsLimit + } + return +} + +// KubeletConfigListKind is the name of the type used to represent list of objects of +// type 'kubelet_config'. +const KubeletConfigListKind = "KubeletConfigList" + +// KubeletConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'kubelet_config'. +const KubeletConfigListLinkKind = "KubeletConfigListLink" + +// KubeletConfigNilKind is the name of the type used to nil lists of objects of +// type 'kubelet_config'. +const KubeletConfigListNilKind = "KubeletConfigListNil" + +// KubeletConfigList is a list of values of the 'kubelet_config' type. +type KubeletConfigList struct { + href string + link bool + items []*KubeletConfig +} + +// Kind returns the name of the type of the object. +func (l *KubeletConfigList) Kind() string { + if l == nil { + return KubeletConfigListNilKind + } + if l.link { + return KubeletConfigListLinkKind + } + return KubeletConfigListKind +} + +// Link returns true iif this is a link. +func (l *KubeletConfigList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *KubeletConfigList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *KubeletConfigList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *KubeletConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *KubeletConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *KubeletConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *KubeletConfigList) SetItems(items []*KubeletConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *KubeletConfigList) Items() []*KubeletConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *KubeletConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *KubeletConfigList) Get(i int) *KubeletConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *KubeletConfigList) Slice() []*KubeletConfig { + var slice []*KubeletConfig + if l == nil { + slice = make([]*KubeletConfig, 0) + } else { + slice = make([]*KubeletConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *KubeletConfigList) Each(f func(item *KubeletConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *KubeletConfigList) Range(f func(index int, item *KubeletConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/kubelet_config_type_json.go b/clientapi/clustersmgmt/v1/kubelet_config_type_json.go new file mode 100644 index 00000000..b3406711 --- /dev/null +++ b/clientapi/clustersmgmt/v1/kubelet_config_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalKubeletConfig writes a value of the 'kubelet_config' type to the given writer. +func MarshalKubeletConfig(object *KubeletConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteKubeletConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteKubeletConfig writes a value of the 'kubelet_config' type to the given stream. +func WriteKubeletConfig(object *KubeletConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(KubeletConfigLinkKind) + } else { + stream.WriteString(KubeletConfigKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("pod_pids_limit") + stream.WriteInt(object.podPidsLimit) + } + stream.WriteObjectEnd() +} + +// UnmarshalKubeletConfig reads a value of the 'kubelet_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalKubeletConfig(source interface{}) (object *KubeletConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadKubeletConfig(iterator) + err = iterator.Error + return +} + +// ReadKubeletConfig reads a value of the 'kubelet_config' type from the given iterator. +func ReadKubeletConfig(iterator *jsoniter.Iterator) *KubeletConfig { + object := &KubeletConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == KubeletConfigLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + case "pod_pids_limit": + value := iterator.ReadInt() + object.podPidsLimit = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/label_builder.go b/clientapi/clustersmgmt/v1/label_builder.go new file mode 100644 index 00000000..bfb124fa --- /dev/null +++ b/clientapi/clustersmgmt/v1/label_builder.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LabelBuilder contains the data and logic needed to build 'label' objects. +// +// Representation of a label in clusterdeployment. +type LabelBuilder struct { + bitmap_ uint32 + id string + href string + key string + value string +} + +// NewLabel creates a new builder of 'label' objects. +func NewLabel() *LabelBuilder { + return &LabelBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *LabelBuilder) Link(value bool) *LabelBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *LabelBuilder) ID(value string) *LabelBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *LabelBuilder) HREF(value string) *LabelBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *LabelBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Key sets the value of the 'key' attribute to the given value. +func (b *LabelBuilder) Key(value string) *LabelBuilder { + b.key = value + b.bitmap_ |= 8 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *LabelBuilder) Value(value string) *LabelBuilder { + b.value = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *LabelBuilder) Copy(object *Label) *LabelBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.key = object.key + b.value = object.value + return b +} + +// Build creates a 'label' object using the configuration stored in the builder. +func (b *LabelBuilder) Build() (object *Label, err error) { + object = new(Label) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.key = b.key + object.value = b.value + return +} diff --git a/clientapi/clustersmgmt/v1/label_list_builder.go b/clientapi/clustersmgmt/v1/label_list_builder.go new file mode 100644 index 00000000..5f52d8f3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/label_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LabelListBuilder contains the data and logic needed to build +// 'label' objects. +type LabelListBuilder struct { + items []*LabelBuilder +} + +// NewLabelList creates a new builder of 'label' objects. +func NewLabelList() *LabelListBuilder { + return new(LabelListBuilder) +} + +// Items sets the items of the list. +func (b *LabelListBuilder) Items(values ...*LabelBuilder) *LabelListBuilder { + b.items = make([]*LabelBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *LabelListBuilder) 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 *LabelListBuilder) Copy(list *LabelList) *LabelListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*LabelBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewLabel().Copy(v) + } + } + return b +} + +// Build creates a list of 'label' objects using the +// configuration stored in the builder. +func (b *LabelListBuilder) Build() (list *LabelList, err error) { + items := make([]*Label, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(LabelList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/label_list_type_json.go b/clientapi/clustersmgmt/v1/label_list_type_json.go new file mode 100644 index 00000000..05569203 --- /dev/null +++ b/clientapi/clustersmgmt/v1/label_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLabelList writes a list of values of the 'label' type to +// the given writer. +func MarshalLabelList(list []*Label, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLabelList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLabelList writes a list of value of the 'label' type to +// the given stream. +func WriteLabelList(list []*Label, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteLabel(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalLabelList reads a list of values of the 'label' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLabelList(source interface{}) (items []*Label, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLabelList(iterator) + err = iterator.Error + return +} + +// ReadLabelList reads list of values of the ”label' type from +// the given iterator. +func ReadLabelList(iterator *jsoniter.Iterator) []*Label { + list := []*Label{} + for iterator.ReadArray() { + item := ReadLabel(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/label_type.go b/clientapi/clustersmgmt/v1/label_type.go new file mode 100644 index 00000000..74e4eb8e --- /dev/null +++ b/clientapi/clustersmgmt/v1/label_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LabelKind is the name of the type used to represent objects +// of type 'label'. +const LabelKind = "Label" + +// LabelLinkKind is the name of the type used to represent links +// to objects of type 'label'. +const LabelLinkKind = "LabelLink" + +// LabelNilKind is the name of the type used to nil references +// to objects of type 'label'. +const LabelNilKind = "LabelNil" + +// Label represents the values of the 'label' type. +// +// Representation of a label in clusterdeployment. +type Label struct { + bitmap_ uint32 + id string + href string + key string + value string +} + +// Kind returns the name of the type of the object. +func (o *Label) Kind() string { + if o == nil { + return LabelNilKind + } + if o.bitmap_&1 != 0 { + return LabelLinkKind + } + return LabelKind +} + +// Link returns true if this is a link. +func (o *Label) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Label) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Label) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Label) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Label) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Label) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Key returns the value of the 'key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// the key of the label +func (o *Label) Key() string { + if o != nil && o.bitmap_&8 != 0 { + return o.key + } + return "" +} + +// GetKey returns the value of the 'key' attribute and +// a flag indicating if the attribute has a value. +// +// the key of the label +func (o *Label) GetKey() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.key + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// the value to set in the label +func (o *Label) Value() string { + if o != nil && o.bitmap_&16 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// the value to set in the label +func (o *Label) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.value + } + return +} + +// LabelListKind is the name of the type used to represent list of objects of +// type 'label'. +const LabelListKind = "LabelList" + +// LabelListLinkKind is the name of the type used to represent links to list +// of objects of type 'label'. +const LabelListLinkKind = "LabelListLink" + +// LabelNilKind is the name of the type used to nil lists of objects of +// type 'label'. +const LabelListNilKind = "LabelListNil" + +// LabelList is a list of values of the 'label' type. +type LabelList struct { + href string + link bool + items []*Label +} + +// Kind returns the name of the type of the object. +func (l *LabelList) Kind() string { + if l == nil { + return LabelListNilKind + } + if l.link { + return LabelListLinkKind + } + return LabelListKind +} + +// Link returns true iif this is a link. +func (l *LabelList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *LabelList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *LabelList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *LabelList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *LabelList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *LabelList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *LabelList) SetItems(items []*Label) { + l.items = items +} + +// Items returns the items of the list. +func (l *LabelList) Items() []*Label { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *LabelList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *LabelList) Get(i int) *Label { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *LabelList) Slice() []*Label { + var slice []*Label + if l == nil { + slice = make([]*Label, 0) + } else { + slice = make([]*Label, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *LabelList) Each(f func(item *Label) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *LabelList) Range(f func(index int, item *Label) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/label_type_json.go b/clientapi/clustersmgmt/v1/label_type_json.go new file mode 100644 index 00000000..7199a501 --- /dev/null +++ b/clientapi/clustersmgmt/v1/label_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLabel writes a value of the 'label' type to the given writer. +func MarshalLabel(object *Label, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLabel(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLabel writes a value of the 'label' type to the given stream. +func WriteLabel(object *Label, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(LabelLinkKind) + } else { + stream.WriteString(LabelKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key") + stream.WriteString(object.key) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalLabel reads a value of the 'label' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalLabel(source interface{}) (object *Label, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadLabel(iterator) + err = iterator.Error + return +} + +// ReadLabel reads a value of the 'label' type from the given iterator. +func ReadLabel(iterator *jsoniter.Iterator) *Label { + object := &Label{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == LabelLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "key": + value := iterator.ReadString() + object.key = value + object.bitmap_ |= 8 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/ldap_attributes_builder.go b/clientapi/clustersmgmt/v1/ldap_attributes_builder.go new file mode 100644 index 00000000..8cc7069c --- /dev/null +++ b/clientapi/clustersmgmt/v1/ldap_attributes_builder.go @@ -0,0 +1,129 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LDAPAttributesBuilder contains the data and logic needed to build 'LDAP_attributes' objects. +// +// LDAP attributes used to configure the LDAP identity provider. +type LDAPAttributesBuilder struct { + bitmap_ uint32 + id []string + email []string + name []string + preferredUsername []string +} + +// NewLDAPAttributes creates a new builder of 'LDAP_attributes' objects. +func NewLDAPAttributes() *LDAPAttributesBuilder { + return &LDAPAttributesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *LDAPAttributesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given values. +func (b *LDAPAttributesBuilder) ID(values ...string) *LDAPAttributesBuilder { + b.id = make([]string, len(values)) + copy(b.id, values) + b.bitmap_ |= 1 + return b +} + +// Email sets the value of the 'email' attribute to the given values. +func (b *LDAPAttributesBuilder) Email(values ...string) *LDAPAttributesBuilder { + b.email = make([]string, len(values)) + copy(b.email, values) + b.bitmap_ |= 2 + return b +} + +// Name sets the value of the 'name' attribute to the given values. +func (b *LDAPAttributesBuilder) Name(values ...string) *LDAPAttributesBuilder { + b.name = make([]string, len(values)) + copy(b.name, values) + b.bitmap_ |= 4 + return b +} + +// PreferredUsername sets the value of the 'preferred_username' attribute to the given values. +func (b *LDAPAttributesBuilder) PreferredUsername(values ...string) *LDAPAttributesBuilder { + b.preferredUsername = make([]string, len(values)) + copy(b.preferredUsername, values) + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *LDAPAttributesBuilder) Copy(object *LDAPAttributes) *LDAPAttributesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.id != nil { + b.id = make([]string, len(object.id)) + copy(b.id, object.id) + } else { + b.id = nil + } + if object.email != nil { + b.email = make([]string, len(object.email)) + copy(b.email, object.email) + } else { + b.email = nil + } + if object.name != nil { + b.name = make([]string, len(object.name)) + copy(b.name, object.name) + } else { + b.name = nil + } + if object.preferredUsername != nil { + b.preferredUsername = make([]string, len(object.preferredUsername)) + copy(b.preferredUsername, object.preferredUsername) + } else { + b.preferredUsername = nil + } + return b +} + +// Build creates a 'LDAP_attributes' object using the configuration stored in the builder. +func (b *LDAPAttributesBuilder) Build() (object *LDAPAttributes, err error) { + object = new(LDAPAttributes) + object.bitmap_ = b.bitmap_ + if b.id != nil { + object.id = make([]string, len(b.id)) + copy(object.id, b.id) + } + if b.email != nil { + object.email = make([]string, len(b.email)) + copy(object.email, b.email) + } + if b.name != nil { + object.name = make([]string, len(b.name)) + copy(object.name, b.name) + } + if b.preferredUsername != nil { + object.preferredUsername = make([]string, len(b.preferredUsername)) + copy(object.preferredUsername, b.preferredUsername) + } + return +} diff --git a/clientapi/clustersmgmt/v1/ldap_attributes_list_builder.go b/clientapi/clustersmgmt/v1/ldap_attributes_list_builder.go new file mode 100644 index 00000000..237af167 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ldap_attributes_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LDAPAttributesListBuilder contains the data and logic needed to build +// 'LDAP_attributes' objects. +type LDAPAttributesListBuilder struct { + items []*LDAPAttributesBuilder +} + +// NewLDAPAttributesList creates a new builder of 'LDAP_attributes' objects. +func NewLDAPAttributesList() *LDAPAttributesListBuilder { + return new(LDAPAttributesListBuilder) +} + +// Items sets the items of the list. +func (b *LDAPAttributesListBuilder) Items(values ...*LDAPAttributesBuilder) *LDAPAttributesListBuilder { + b.items = make([]*LDAPAttributesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *LDAPAttributesListBuilder) 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 *LDAPAttributesListBuilder) Copy(list *LDAPAttributesList) *LDAPAttributesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*LDAPAttributesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewLDAPAttributes().Copy(v) + } + } + return b +} + +// Build creates a list of 'LDAP_attributes' objects using the +// configuration stored in the builder. +func (b *LDAPAttributesListBuilder) Build() (list *LDAPAttributesList, err error) { + items := make([]*LDAPAttributes, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(LDAPAttributesList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/ldap_attributes_list_type_json.go b/clientapi/clustersmgmt/v1/ldap_attributes_list_type_json.go new file mode 100644 index 00000000..7ab2b3b5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ldap_attributes_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLDAPAttributesList writes a list of values of the 'LDAP_attributes' type to +// the given writer. +func MarshalLDAPAttributesList(list []*LDAPAttributes, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLDAPAttributesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLDAPAttributesList writes a list of value of the 'LDAP_attributes' type to +// the given stream. +func WriteLDAPAttributesList(list []*LDAPAttributes, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteLDAPAttributes(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalLDAPAttributesList reads a list of values of the 'LDAP_attributes' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLDAPAttributesList(source interface{}) (items []*LDAPAttributes, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLDAPAttributesList(iterator) + err = iterator.Error + return +} + +// ReadLDAPAttributesList reads list of values of the ”LDAP_attributes' type from +// the given iterator. +func ReadLDAPAttributesList(iterator *jsoniter.Iterator) []*LDAPAttributes { + list := []*LDAPAttributes{} + for iterator.ReadArray() { + item := ReadLDAPAttributes(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/ldap_attributes_type.go b/clientapi/clustersmgmt/v1/ldap_attributes_type.go new file mode 100644 index 00000000..b5b1768a --- /dev/null +++ b/clientapi/clustersmgmt/v1/ldap_attributes_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LDAPAttributes represents the values of the 'LDAP_attributes' type. +// +// LDAP attributes used to configure the LDAP identity provider. +type LDAPAttributes struct { + bitmap_ uint32 + id []string + email []string + name []string + preferredUsername []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *LDAPAttributes) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of attributes to use as the identity. +func (o *LDAPAttributes) ID() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return nil +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// List of attributes to use as the identity. +func (o *LDAPAttributes) GetID() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// Email returns the value of the 'email' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of attributes to use as the mail address. +func (o *LDAPAttributes) Email() []string { + if o != nil && o.bitmap_&2 != 0 { + return o.email + } + return nil +} + +// GetEmail returns the value of the 'email' attribute and +// a flag indicating if the attribute has a value. +// +// List of attributes to use as the mail address. +func (o *LDAPAttributes) GetEmail() (value []string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.email + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of attributes to use as the display name. +func (o *LDAPAttributes) Name() []string { + if o != nil && o.bitmap_&4 != 0 { + return o.name + } + return nil +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// List of attributes to use as the display name. +func (o *LDAPAttributes) GetName() (value []string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.name + } + return +} + +// PreferredUsername returns the value of the 'preferred_username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of attributes to use as the preferred user name when provisioning a user. +func (o *LDAPAttributes) PreferredUsername() []string { + if o != nil && o.bitmap_&8 != 0 { + return o.preferredUsername + } + return nil +} + +// GetPreferredUsername returns the value of the 'preferred_username' attribute and +// a flag indicating if the attribute has a value. +// +// List of attributes to use as the preferred user name when provisioning a user. +func (o *LDAPAttributes) GetPreferredUsername() (value []string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.preferredUsername + } + return +} + +// LDAPAttributesListKind is the name of the type used to represent list of objects of +// type 'LDAP_attributes'. +const LDAPAttributesListKind = "LDAPAttributesList" + +// LDAPAttributesListLinkKind is the name of the type used to represent links to list +// of objects of type 'LDAP_attributes'. +const LDAPAttributesListLinkKind = "LDAPAttributesListLink" + +// LDAPAttributesNilKind is the name of the type used to nil lists of objects of +// type 'LDAP_attributes'. +const LDAPAttributesListNilKind = "LDAPAttributesListNil" + +// LDAPAttributesList is a list of values of the 'LDAP_attributes' type. +type LDAPAttributesList struct { + href string + link bool + items []*LDAPAttributes +} + +// Len returns the length of the list. +func (l *LDAPAttributesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *LDAPAttributesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *LDAPAttributesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *LDAPAttributesList) SetItems(items []*LDAPAttributes) { + l.items = items +} + +// Items returns the items of the list. +func (l *LDAPAttributesList) Items() []*LDAPAttributes { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *LDAPAttributesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *LDAPAttributesList) Get(i int) *LDAPAttributes { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *LDAPAttributesList) Slice() []*LDAPAttributes { + var slice []*LDAPAttributes + if l == nil { + slice = make([]*LDAPAttributes, 0) + } else { + slice = make([]*LDAPAttributes, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *LDAPAttributesList) Each(f func(item *LDAPAttributes) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *LDAPAttributesList) Range(f func(index int, item *LDAPAttributes) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/ldap_attributes_type_json.go b/clientapi/clustersmgmt/v1/ldap_attributes_type_json.go new file mode 100644 index 00000000..35fd1960 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ldap_attributes_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLDAPAttributes writes a value of the 'LDAP_attributes' type to the given writer. +func MarshalLDAPAttributes(object *LDAPAttributes, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLDAPAttributes(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLDAPAttributes writes a value of the 'LDAP_attributes' type to the given stream. +func WriteLDAPAttributes(object *LDAPAttributes, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.id != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + WriteStringList(object.id, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.email != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("email") + WriteStringList(object.email, stream) + count++ + } + present_ = object.bitmap_&4 != 0 && object.name != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + WriteStringList(object.name, stream) + count++ + } + present_ = object.bitmap_&8 != 0 && object.preferredUsername != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("preferred_username") + WriteStringList(object.preferredUsername, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalLDAPAttributes reads a value of the 'LDAP_attributes' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalLDAPAttributes(source interface{}) (object *LDAPAttributes, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadLDAPAttributes(iterator) + err = iterator.Error + return +} + +// ReadLDAPAttributes reads a value of the 'LDAP_attributes' type from the given iterator. +func ReadLDAPAttributes(iterator *jsoniter.Iterator) *LDAPAttributes { + object := &LDAPAttributes{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := ReadStringList(iterator) + object.id = value + object.bitmap_ |= 1 + case "email": + value := ReadStringList(iterator) + object.email = value + object.bitmap_ |= 2 + case "name": + value := ReadStringList(iterator) + object.name = value + object.bitmap_ |= 4 + case "preferred_username": + value := ReadStringList(iterator) + object.preferredUsername = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/ldap_identity_provider_builder.go b/clientapi/clustersmgmt/v1/ldap_identity_provider_builder.go new file mode 100644 index 00000000..140af15c --- /dev/null +++ b/clientapi/clustersmgmt/v1/ldap_identity_provider_builder.go @@ -0,0 +1,128 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LDAPIdentityProviderBuilder contains the data and logic needed to build 'LDAP_identity_provider' objects. +// +// Details for `ldap` identity providers. +type LDAPIdentityProviderBuilder struct { + bitmap_ uint32 + ca string + url string + attributes *LDAPAttributesBuilder + bindDN string + bindPassword string + insecure bool +} + +// NewLDAPIdentityProvider creates a new builder of 'LDAP_identity_provider' objects. +func NewLDAPIdentityProvider() *LDAPIdentityProviderBuilder { + return &LDAPIdentityProviderBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *LDAPIdentityProviderBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// CA sets the value of the 'CA' attribute to the given value. +func (b *LDAPIdentityProviderBuilder) CA(value string) *LDAPIdentityProviderBuilder { + b.ca = value + b.bitmap_ |= 1 + return b +} + +// URL sets the value of the 'URL' attribute to the given value. +func (b *LDAPIdentityProviderBuilder) URL(value string) *LDAPIdentityProviderBuilder { + b.url = value + b.bitmap_ |= 2 + return b +} + +// Attributes sets the value of the 'attributes' attribute to the given value. +// +// LDAP attributes used to configure the LDAP identity provider. +func (b *LDAPIdentityProviderBuilder) Attributes(value *LDAPAttributesBuilder) *LDAPIdentityProviderBuilder { + b.attributes = value + if value != nil { + b.bitmap_ |= 4 + } else { + b.bitmap_ &^= 4 + } + return b +} + +// BindDN sets the value of the 'bind_DN' attribute to the given value. +func (b *LDAPIdentityProviderBuilder) BindDN(value string) *LDAPIdentityProviderBuilder { + b.bindDN = value + b.bitmap_ |= 8 + return b +} + +// BindPassword sets the value of the 'bind_password' attribute to the given value. +func (b *LDAPIdentityProviderBuilder) BindPassword(value string) *LDAPIdentityProviderBuilder { + b.bindPassword = value + b.bitmap_ |= 16 + return b +} + +// Insecure sets the value of the 'insecure' attribute to the given value. +func (b *LDAPIdentityProviderBuilder) Insecure(value bool) *LDAPIdentityProviderBuilder { + b.insecure = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *LDAPIdentityProviderBuilder) Copy(object *LDAPIdentityProvider) *LDAPIdentityProviderBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.ca = object.ca + b.url = object.url + if object.attributes != nil { + b.attributes = NewLDAPAttributes().Copy(object.attributes) + } else { + b.attributes = nil + } + b.bindDN = object.bindDN + b.bindPassword = object.bindPassword + b.insecure = object.insecure + return b +} + +// Build creates a 'LDAP_identity_provider' object using the configuration stored in the builder. +func (b *LDAPIdentityProviderBuilder) Build() (object *LDAPIdentityProvider, err error) { + object = new(LDAPIdentityProvider) + object.bitmap_ = b.bitmap_ + object.ca = b.ca + object.url = b.url + if b.attributes != nil { + object.attributes, err = b.attributes.Build() + if err != nil { + return + } + } + object.bindDN = b.bindDN + object.bindPassword = b.bindPassword + object.insecure = b.insecure + return +} diff --git a/clientapi/clustersmgmt/v1/ldap_identity_provider_list_builder.go b/clientapi/clustersmgmt/v1/ldap_identity_provider_list_builder.go new file mode 100644 index 00000000..a7ec4965 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ldap_identity_provider_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LDAPIdentityProviderListBuilder contains the data and logic needed to build +// 'LDAP_identity_provider' objects. +type LDAPIdentityProviderListBuilder struct { + items []*LDAPIdentityProviderBuilder +} + +// NewLDAPIdentityProviderList creates a new builder of 'LDAP_identity_provider' objects. +func NewLDAPIdentityProviderList() *LDAPIdentityProviderListBuilder { + return new(LDAPIdentityProviderListBuilder) +} + +// Items sets the items of the list. +func (b *LDAPIdentityProviderListBuilder) Items(values ...*LDAPIdentityProviderBuilder) *LDAPIdentityProviderListBuilder { + b.items = make([]*LDAPIdentityProviderBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *LDAPIdentityProviderListBuilder) 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 *LDAPIdentityProviderListBuilder) Copy(list *LDAPIdentityProviderList) *LDAPIdentityProviderListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*LDAPIdentityProviderBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewLDAPIdentityProvider().Copy(v) + } + } + return b +} + +// Build creates a list of 'LDAP_identity_provider' objects using the +// configuration stored in the builder. +func (b *LDAPIdentityProviderListBuilder) Build() (list *LDAPIdentityProviderList, err error) { + items := make([]*LDAPIdentityProvider, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(LDAPIdentityProviderList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/ldap_identity_provider_list_type_json.go b/clientapi/clustersmgmt/v1/ldap_identity_provider_list_type_json.go new file mode 100644 index 00000000..74c32ddf --- /dev/null +++ b/clientapi/clustersmgmt/v1/ldap_identity_provider_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLDAPIdentityProviderList writes a list of values of the 'LDAP_identity_provider' type to +// the given writer. +func MarshalLDAPIdentityProviderList(list []*LDAPIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLDAPIdentityProviderList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLDAPIdentityProviderList writes a list of value of the 'LDAP_identity_provider' type to +// the given stream. +func WriteLDAPIdentityProviderList(list []*LDAPIdentityProvider, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteLDAPIdentityProvider(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalLDAPIdentityProviderList reads a list of values of the 'LDAP_identity_provider' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLDAPIdentityProviderList(source interface{}) (items []*LDAPIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLDAPIdentityProviderList(iterator) + err = iterator.Error + return +} + +// ReadLDAPIdentityProviderList reads list of values of the ”LDAP_identity_provider' type from +// the given iterator. +func ReadLDAPIdentityProviderList(iterator *jsoniter.Iterator) []*LDAPIdentityProvider { + list := []*LDAPIdentityProvider{} + for iterator.ReadArray() { + item := ReadLDAPIdentityProvider(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/ldap_identity_provider_type.go b/clientapi/clustersmgmt/v1/ldap_identity_provider_type.go new file mode 100644 index 00000000..e4e05700 --- /dev/null +++ b/clientapi/clustersmgmt/v1/ldap_identity_provider_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LDAPIdentityProvider represents the values of the 'LDAP_identity_provider' type. +// +// Details for `ldap` identity providers. +type LDAPIdentityProvider struct { + bitmap_ uint32 + ca string + url string + attributes *LDAPAttributes + bindDN string + bindPassword string + insecure bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *LDAPIdentityProvider) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// CA returns the value of the 'CA' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Certificate bundle to use to validate server certificates for the configured URL. +func (o *LDAPIdentityProvider) CA() string { + if o != nil && o.bitmap_&1 != 0 { + return o.ca + } + return "" +} + +// GetCA returns the value of the 'CA' attribute and +// a flag indicating if the attribute has a value. +// +// Certificate bundle to use to validate server certificates for the configured URL. +func (o *LDAPIdentityProvider) GetCA() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.ca + } + return +} + +// URL returns the value of the 'URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// An https://tools.ietf.org/html/rfc2255[RFC 2255] URL which specifies the LDAP host and +// search parameters to use. +func (o *LDAPIdentityProvider) URL() string { + if o != nil && o.bitmap_&2 != 0 { + return o.url + } + return "" +} + +// GetURL returns the value of the 'URL' attribute and +// a flag indicating if the attribute has a value. +// +// An https://tools.ietf.org/html/rfc2255[RFC 2255] URL which specifies the LDAP host and +// search parameters to use. +func (o *LDAPIdentityProvider) GetURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.url + } + return +} + +// Attributes returns the value of the 'attributes' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// LDAP attributes used to configure the provider. +func (o *LDAPIdentityProvider) Attributes() *LDAPAttributes { + if o != nil && o.bitmap_&4 != 0 { + return o.attributes + } + return nil +} + +// GetAttributes returns the value of the 'attributes' attribute and +// a flag indicating if the attribute has a value. +// +// LDAP attributes used to configure the provider. +func (o *LDAPIdentityProvider) GetAttributes() (value *LDAPAttributes, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.attributes + } + return +} + +// BindDN returns the value of the 'bind_DN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional distinguished name to use to bind during the search phase. +func (o *LDAPIdentityProvider) BindDN() string { + if o != nil && o.bitmap_&8 != 0 { + return o.bindDN + } + return "" +} + +// GetBindDN returns the value of the 'bind_DN' attribute and +// a flag indicating if the attribute has a value. +// +// Optional distinguished name to use to bind during the search phase. +func (o *LDAPIdentityProvider) GetBindDN() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.bindDN + } + return +} + +// BindPassword returns the value of the 'bind_password' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional password to use to bind during the search phase. +func (o *LDAPIdentityProvider) BindPassword() string { + if o != nil && o.bitmap_&16 != 0 { + return o.bindPassword + } + return "" +} + +// GetBindPassword returns the value of the 'bind_password' attribute and +// a flag indicating if the attribute has a value. +// +// Optional password to use to bind during the search phase. +func (o *LDAPIdentityProvider) GetBindPassword() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.bindPassword + } + return +} + +// Insecure returns the value of the 'insecure' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// When `true` no TLS connection is made to the server. When `false` `ldaps://...` URLs +// connect using TLS and `ldap://...` are upgraded to TLS. +func (o *LDAPIdentityProvider) Insecure() bool { + if o != nil && o.bitmap_&32 != 0 { + return o.insecure + } + return false +} + +// GetInsecure returns the value of the 'insecure' attribute and +// a flag indicating if the attribute has a value. +// +// When `true` no TLS connection is made to the server. When `false` `ldaps://...` URLs +// connect using TLS and `ldap://...` are upgraded to TLS. +func (o *LDAPIdentityProvider) GetInsecure() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.insecure + } + return +} + +// LDAPIdentityProviderListKind is the name of the type used to represent list of objects of +// type 'LDAP_identity_provider'. +const LDAPIdentityProviderListKind = "LDAPIdentityProviderList" + +// LDAPIdentityProviderListLinkKind is the name of the type used to represent links to list +// of objects of type 'LDAP_identity_provider'. +const LDAPIdentityProviderListLinkKind = "LDAPIdentityProviderListLink" + +// LDAPIdentityProviderNilKind is the name of the type used to nil lists of objects of +// type 'LDAP_identity_provider'. +const LDAPIdentityProviderListNilKind = "LDAPIdentityProviderListNil" + +// LDAPIdentityProviderList is a list of values of the 'LDAP_identity_provider' type. +type LDAPIdentityProviderList struct { + href string + link bool + items []*LDAPIdentityProvider +} + +// Len returns the length of the list. +func (l *LDAPIdentityProviderList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *LDAPIdentityProviderList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *LDAPIdentityProviderList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *LDAPIdentityProviderList) SetItems(items []*LDAPIdentityProvider) { + l.items = items +} + +// Items returns the items of the list. +func (l *LDAPIdentityProviderList) Items() []*LDAPIdentityProvider { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *LDAPIdentityProviderList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *LDAPIdentityProviderList) Get(i int) *LDAPIdentityProvider { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *LDAPIdentityProviderList) Slice() []*LDAPIdentityProvider { + var slice []*LDAPIdentityProvider + if l == nil { + slice = make([]*LDAPIdentityProvider, 0) + } else { + slice = make([]*LDAPIdentityProvider, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *LDAPIdentityProviderList) Each(f func(item *LDAPIdentityProvider) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *LDAPIdentityProviderList) Range(f func(index int, item *LDAPIdentityProvider) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/ldap_identity_provider_type_json.go b/clientapi/clustersmgmt/v1/ldap_identity_provider_type_json.go new file mode 100644 index 00000000..b2f3b5cd --- /dev/null +++ b/clientapi/clustersmgmt/v1/ldap_identity_provider_type_json.go @@ -0,0 +1,151 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLDAPIdentityProvider writes a value of the 'LDAP_identity_provider' type to the given writer. +func MarshalLDAPIdentityProvider(object *LDAPIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLDAPIdentityProvider(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLDAPIdentityProvider writes a value of the 'LDAP_identity_provider' type to the given stream. +func WriteLDAPIdentityProvider(object *LDAPIdentityProvider, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ca") + stream.WriteString(object.ca) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("url") + stream.WriteString(object.url) + count++ + } + present_ = object.bitmap_&4 != 0 && object.attributes != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("attributes") + WriteLDAPAttributes(object.attributes, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("bind_dn") + stream.WriteString(object.bindDN) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("bind_password") + stream.WriteString(object.bindPassword) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("insecure") + stream.WriteBool(object.insecure) + } + stream.WriteObjectEnd() +} + +// UnmarshalLDAPIdentityProvider reads a value of the 'LDAP_identity_provider' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalLDAPIdentityProvider(source interface{}) (object *LDAPIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadLDAPIdentityProvider(iterator) + err = iterator.Error + return +} + +// ReadLDAPIdentityProvider reads a value of the 'LDAP_identity_provider' type from the given iterator. +func ReadLDAPIdentityProvider(iterator *jsoniter.Iterator) *LDAPIdentityProvider { + object := &LDAPIdentityProvider{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "ca": + value := iterator.ReadString() + object.ca = value + object.bitmap_ |= 1 + case "url": + value := iterator.ReadString() + object.url = value + object.bitmap_ |= 2 + case "attributes": + value := ReadLDAPAttributes(iterator) + object.attributes = value + object.bitmap_ |= 4 + case "bind_dn": + value := iterator.ReadString() + object.bindDN = value + object.bitmap_ |= 8 + case "bind_password": + value := iterator.ReadString() + object.bindPassword = value + object.bitmap_ |= 16 + case "insecure": + value := iterator.ReadBool() + object.insecure = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_builder.go b/clientapi/clustersmgmt/v1/limited_support_reason_builder.go new file mode 100644 index 00000000..2118a88d --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_builder.go @@ -0,0 +1,173 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// LimitedSupportReasonBuilder contains the data and logic needed to build 'limited_support_reason' objects. +// +// A reason that a cluster is in limited support. +type LimitedSupportReasonBuilder struct { + bitmap_ uint32 + id string + href string + creationTimestamp time.Time + details string + detectionType DetectionType + override *LimitedSupportReasonOverrideBuilder + summary string + template *LimitedSupportReasonTemplateBuilder +} + +// NewLimitedSupportReason creates a new builder of 'limited_support_reason' objects. +func NewLimitedSupportReason() *LimitedSupportReasonBuilder { + return &LimitedSupportReasonBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *LimitedSupportReasonBuilder) Link(value bool) *LimitedSupportReasonBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *LimitedSupportReasonBuilder) ID(value string) *LimitedSupportReasonBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *LimitedSupportReasonBuilder) HREF(value string) *LimitedSupportReasonBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *LimitedSupportReasonBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *LimitedSupportReasonBuilder) CreationTimestamp(value time.Time) *LimitedSupportReasonBuilder { + b.creationTimestamp = value + b.bitmap_ |= 8 + return b +} + +// Details sets the value of the 'details' attribute to the given value. +func (b *LimitedSupportReasonBuilder) Details(value string) *LimitedSupportReasonBuilder { + b.details = value + b.bitmap_ |= 16 + return b +} + +// DetectionType sets the value of the 'detection_type' attribute to the given value. +func (b *LimitedSupportReasonBuilder) DetectionType(value DetectionType) *LimitedSupportReasonBuilder { + b.detectionType = value + b.bitmap_ |= 32 + return b +} + +// Override sets the value of the 'override' attribute to the given value. +// +// Representation of the limited support reason override. +func (b *LimitedSupportReasonBuilder) Override(value *LimitedSupportReasonOverrideBuilder) *LimitedSupportReasonBuilder { + b.override = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Summary sets the value of the 'summary' attribute to the given value. +func (b *LimitedSupportReasonBuilder) Summary(value string) *LimitedSupportReasonBuilder { + b.summary = value + b.bitmap_ |= 128 + return b +} + +// Template sets the value of the 'template' attribute to the given value. +// +// A template for cluster limited support reason. +func (b *LimitedSupportReasonBuilder) Template(value *LimitedSupportReasonTemplateBuilder) *LimitedSupportReasonBuilder { + b.template = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *LimitedSupportReasonBuilder) Copy(object *LimitedSupportReason) *LimitedSupportReasonBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.creationTimestamp = object.creationTimestamp + b.details = object.details + b.detectionType = object.detectionType + if object.override != nil { + b.override = NewLimitedSupportReasonOverride().Copy(object.override) + } else { + b.override = nil + } + b.summary = object.summary + if object.template != nil { + b.template = NewLimitedSupportReasonTemplate().Copy(object.template) + } else { + b.template = nil + } + return b +} + +// Build creates a 'limited_support_reason' object using the configuration stored in the builder. +func (b *LimitedSupportReasonBuilder) Build() (object *LimitedSupportReason, err error) { + object = new(LimitedSupportReason) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.creationTimestamp = b.creationTimestamp + object.details = b.details + object.detectionType = b.detectionType + if b.override != nil { + object.override, err = b.override.Build() + if err != nil { + return + } + } + object.summary = b.summary + if b.template != nil { + object.template, err = b.template.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_list_builder.go b/clientapi/clustersmgmt/v1/limited_support_reason_list_builder.go new file mode 100644 index 00000000..c2b85958 --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LimitedSupportReasonListBuilder contains the data and logic needed to build +// 'limited_support_reason' objects. +type LimitedSupportReasonListBuilder struct { + items []*LimitedSupportReasonBuilder +} + +// NewLimitedSupportReasonList creates a new builder of 'limited_support_reason' objects. +func NewLimitedSupportReasonList() *LimitedSupportReasonListBuilder { + return new(LimitedSupportReasonListBuilder) +} + +// Items sets the items of the list. +func (b *LimitedSupportReasonListBuilder) Items(values ...*LimitedSupportReasonBuilder) *LimitedSupportReasonListBuilder { + b.items = make([]*LimitedSupportReasonBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *LimitedSupportReasonListBuilder) 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 *LimitedSupportReasonListBuilder) Copy(list *LimitedSupportReasonList) *LimitedSupportReasonListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*LimitedSupportReasonBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewLimitedSupportReason().Copy(v) + } + } + return b +} + +// Build creates a list of 'limited_support_reason' objects using the +// configuration stored in the builder. +func (b *LimitedSupportReasonListBuilder) Build() (list *LimitedSupportReasonList, err error) { + items := make([]*LimitedSupportReason, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(LimitedSupportReasonList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_list_type_json.go b/clientapi/clustersmgmt/v1/limited_support_reason_list_type_json.go new file mode 100644 index 00000000..dc05f8ca --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLimitedSupportReasonList writes a list of values of the 'limited_support_reason' type to +// the given writer. +func MarshalLimitedSupportReasonList(list []*LimitedSupportReason, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLimitedSupportReasonList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLimitedSupportReasonList writes a list of value of the 'limited_support_reason' type to +// the given stream. +func WriteLimitedSupportReasonList(list []*LimitedSupportReason, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteLimitedSupportReason(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalLimitedSupportReasonList reads a list of values of the 'limited_support_reason' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLimitedSupportReasonList(source interface{}) (items []*LimitedSupportReason, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLimitedSupportReasonList(iterator) + err = iterator.Error + return +} + +// ReadLimitedSupportReasonList reads list of values of the ”limited_support_reason' type from +// the given iterator. +func ReadLimitedSupportReasonList(iterator *jsoniter.Iterator) []*LimitedSupportReason { + list := []*LimitedSupportReason{} + for iterator.ReadArray() { + item := ReadLimitedSupportReason(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_override_builder.go b/clientapi/clustersmgmt/v1/limited_support_reason_override_builder.go new file mode 100644 index 00000000..93791eeb --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_override_builder.go @@ -0,0 +1,89 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LimitedSupportReasonOverrideBuilder contains the data and logic needed to build 'limited_support_reason_override' objects. +// +// Representation of the limited support reason override. +type LimitedSupportReasonOverrideBuilder struct { + bitmap_ uint32 + id string + href string + enabled bool +} + +// NewLimitedSupportReasonOverride creates a new builder of 'limited_support_reason_override' objects. +func NewLimitedSupportReasonOverride() *LimitedSupportReasonOverrideBuilder { + return &LimitedSupportReasonOverrideBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *LimitedSupportReasonOverrideBuilder) Link(value bool) *LimitedSupportReasonOverrideBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *LimitedSupportReasonOverrideBuilder) ID(value string) *LimitedSupportReasonOverrideBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *LimitedSupportReasonOverrideBuilder) HREF(value string) *LimitedSupportReasonOverrideBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *LimitedSupportReasonOverrideBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *LimitedSupportReasonOverrideBuilder) Enabled(value bool) *LimitedSupportReasonOverrideBuilder { + b.enabled = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *LimitedSupportReasonOverrideBuilder) Copy(object *LimitedSupportReasonOverride) *LimitedSupportReasonOverrideBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.enabled = object.enabled + return b +} + +// Build creates a 'limited_support_reason_override' object using the configuration stored in the builder. +func (b *LimitedSupportReasonOverrideBuilder) Build() (object *LimitedSupportReasonOverride, err error) { + object = new(LimitedSupportReasonOverride) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + return +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_override_list_builder.go b/clientapi/clustersmgmt/v1/limited_support_reason_override_list_builder.go new file mode 100644 index 00000000..bb9660a0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_override_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LimitedSupportReasonOverrideListBuilder contains the data and logic needed to build +// 'limited_support_reason_override' objects. +type LimitedSupportReasonOverrideListBuilder struct { + items []*LimitedSupportReasonOverrideBuilder +} + +// NewLimitedSupportReasonOverrideList creates a new builder of 'limited_support_reason_override' objects. +func NewLimitedSupportReasonOverrideList() *LimitedSupportReasonOverrideListBuilder { + return new(LimitedSupportReasonOverrideListBuilder) +} + +// Items sets the items of the list. +func (b *LimitedSupportReasonOverrideListBuilder) Items(values ...*LimitedSupportReasonOverrideBuilder) *LimitedSupportReasonOverrideListBuilder { + b.items = make([]*LimitedSupportReasonOverrideBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *LimitedSupportReasonOverrideListBuilder) 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 *LimitedSupportReasonOverrideListBuilder) Copy(list *LimitedSupportReasonOverrideList) *LimitedSupportReasonOverrideListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*LimitedSupportReasonOverrideBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewLimitedSupportReasonOverride().Copy(v) + } + } + return b +} + +// Build creates a list of 'limited_support_reason_override' objects using the +// configuration stored in the builder. +func (b *LimitedSupportReasonOverrideListBuilder) Build() (list *LimitedSupportReasonOverrideList, err error) { + items := make([]*LimitedSupportReasonOverride, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(LimitedSupportReasonOverrideList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_override_list_type_json.go b/clientapi/clustersmgmt/v1/limited_support_reason_override_list_type_json.go new file mode 100644 index 00000000..724688e6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_override_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLimitedSupportReasonOverrideList writes a list of values of the 'limited_support_reason_override' type to +// the given writer. +func MarshalLimitedSupportReasonOverrideList(list []*LimitedSupportReasonOverride, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLimitedSupportReasonOverrideList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLimitedSupportReasonOverrideList writes a list of value of the 'limited_support_reason_override' type to +// the given stream. +func WriteLimitedSupportReasonOverrideList(list []*LimitedSupportReasonOverride, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteLimitedSupportReasonOverride(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalLimitedSupportReasonOverrideList reads a list of values of the 'limited_support_reason_override' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLimitedSupportReasonOverrideList(source interface{}) (items []*LimitedSupportReasonOverride, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLimitedSupportReasonOverrideList(iterator) + err = iterator.Error + return +} + +// ReadLimitedSupportReasonOverrideList reads list of values of the ”limited_support_reason_override' type from +// the given iterator. +func ReadLimitedSupportReasonOverrideList(iterator *jsoniter.Iterator) []*LimitedSupportReasonOverride { + list := []*LimitedSupportReasonOverride{} + for iterator.ReadArray() { + item := ReadLimitedSupportReasonOverride(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_override_type.go b/clientapi/clustersmgmt/v1/limited_support_reason_override_type.go new file mode 100644 index 00000000..c7e82770 --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_override_type.go @@ -0,0 +1,265 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LimitedSupportReasonOverrideKind is the name of the type used to represent objects +// of type 'limited_support_reason_override'. +const LimitedSupportReasonOverrideKind = "LimitedSupportReasonOverride" + +// LimitedSupportReasonOverrideLinkKind is the name of the type used to represent links +// to objects of type 'limited_support_reason_override'. +const LimitedSupportReasonOverrideLinkKind = "LimitedSupportReasonOverrideLink" + +// LimitedSupportReasonOverrideNilKind is the name of the type used to nil references +// to objects of type 'limited_support_reason_override'. +const LimitedSupportReasonOverrideNilKind = "LimitedSupportReasonOverrideNil" + +// LimitedSupportReasonOverride represents the values of the 'limited_support_reason_override' type. +// +// Representation of the limited support reason override. +type LimitedSupportReasonOverride struct { + bitmap_ uint32 + id string + href string + enabled bool +} + +// Kind returns the name of the type of the object. +func (o *LimitedSupportReasonOverride) Kind() string { + if o == nil { + return LimitedSupportReasonOverrideNilKind + } + if o.bitmap_&1 != 0 { + return LimitedSupportReasonOverrideLinkKind + } + return LimitedSupportReasonOverrideKind +} + +// Link returns true if this is a link. +func (o *LimitedSupportReasonOverride) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *LimitedSupportReasonOverride) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *LimitedSupportReasonOverride) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *LimitedSupportReasonOverride) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *LimitedSupportReasonOverride) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *LimitedSupportReasonOverride) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if the override is enabled +func (o *LimitedSupportReasonOverride) Enabled() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if the override is enabled +func (o *LimitedSupportReasonOverride) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.enabled + } + return +} + +// LimitedSupportReasonOverrideListKind is the name of the type used to represent list of objects of +// type 'limited_support_reason_override'. +const LimitedSupportReasonOverrideListKind = "LimitedSupportReasonOverrideList" + +// LimitedSupportReasonOverrideListLinkKind is the name of the type used to represent links to list +// of objects of type 'limited_support_reason_override'. +const LimitedSupportReasonOverrideListLinkKind = "LimitedSupportReasonOverrideListLink" + +// LimitedSupportReasonOverrideNilKind is the name of the type used to nil lists of objects of +// type 'limited_support_reason_override'. +const LimitedSupportReasonOverrideListNilKind = "LimitedSupportReasonOverrideListNil" + +// LimitedSupportReasonOverrideList is a list of values of the 'limited_support_reason_override' type. +type LimitedSupportReasonOverrideList struct { + href string + link bool + items []*LimitedSupportReasonOverride +} + +// Kind returns the name of the type of the object. +func (l *LimitedSupportReasonOverrideList) Kind() string { + if l == nil { + return LimitedSupportReasonOverrideListNilKind + } + if l.link { + return LimitedSupportReasonOverrideListLinkKind + } + return LimitedSupportReasonOverrideListKind +} + +// Link returns true iif this is a link. +func (l *LimitedSupportReasonOverrideList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *LimitedSupportReasonOverrideList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *LimitedSupportReasonOverrideList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *LimitedSupportReasonOverrideList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *LimitedSupportReasonOverrideList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *LimitedSupportReasonOverrideList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *LimitedSupportReasonOverrideList) SetItems(items []*LimitedSupportReasonOverride) { + l.items = items +} + +// Items returns the items of the list. +func (l *LimitedSupportReasonOverrideList) Items() []*LimitedSupportReasonOverride { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *LimitedSupportReasonOverrideList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *LimitedSupportReasonOverrideList) Get(i int) *LimitedSupportReasonOverride { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *LimitedSupportReasonOverrideList) Slice() []*LimitedSupportReasonOverride { + var slice []*LimitedSupportReasonOverride + if l == nil { + slice = make([]*LimitedSupportReasonOverride, 0) + } else { + slice = make([]*LimitedSupportReasonOverride, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *LimitedSupportReasonOverrideList) Each(f func(item *LimitedSupportReasonOverride) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *LimitedSupportReasonOverrideList) Range(f func(index int, item *LimitedSupportReasonOverride) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_override_type_json.go b/clientapi/clustersmgmt/v1/limited_support_reason_override_type_json.go new file mode 100644 index 00000000..b4108865 --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_override_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLimitedSupportReasonOverride writes a value of the 'limited_support_reason_override' type to the given writer. +func MarshalLimitedSupportReasonOverride(object *LimitedSupportReasonOverride, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLimitedSupportReasonOverride(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLimitedSupportReasonOverride writes a value of the 'limited_support_reason_override' type to the given stream. +func WriteLimitedSupportReasonOverride(object *LimitedSupportReasonOverride, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(LimitedSupportReasonOverrideLinkKind) + } else { + stream.WriteString(LimitedSupportReasonOverrideKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalLimitedSupportReasonOverride reads a value of the 'limited_support_reason_override' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalLimitedSupportReasonOverride(source interface{}) (object *LimitedSupportReasonOverride, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadLimitedSupportReasonOverride(iterator) + err = iterator.Error + return +} + +// ReadLimitedSupportReasonOverride reads a value of the 'limited_support_reason_override' type from the given iterator. +func ReadLimitedSupportReasonOverride(iterator *jsoniter.Iterator) *LimitedSupportReasonOverride { + object := &LimitedSupportReasonOverride{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == LimitedSupportReasonOverrideLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_template_builder.go b/clientapi/clustersmgmt/v1/limited_support_reason_template_builder.go new file mode 100644 index 00000000..5c2502d4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_template_builder.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LimitedSupportReasonTemplateBuilder contains the data and logic needed to build 'limited_support_reason_template' objects. +// +// A template for cluster limited support reason. +type LimitedSupportReasonTemplateBuilder struct { + bitmap_ uint32 + id string + href string + details string + summary string +} + +// NewLimitedSupportReasonTemplate creates a new builder of 'limited_support_reason_template' objects. +func NewLimitedSupportReasonTemplate() *LimitedSupportReasonTemplateBuilder { + return &LimitedSupportReasonTemplateBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *LimitedSupportReasonTemplateBuilder) Link(value bool) *LimitedSupportReasonTemplateBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *LimitedSupportReasonTemplateBuilder) ID(value string) *LimitedSupportReasonTemplateBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *LimitedSupportReasonTemplateBuilder) HREF(value string) *LimitedSupportReasonTemplateBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *LimitedSupportReasonTemplateBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Details sets the value of the 'details' attribute to the given value. +func (b *LimitedSupportReasonTemplateBuilder) Details(value string) *LimitedSupportReasonTemplateBuilder { + b.details = value + b.bitmap_ |= 8 + return b +} + +// Summary sets the value of the 'summary' attribute to the given value. +func (b *LimitedSupportReasonTemplateBuilder) Summary(value string) *LimitedSupportReasonTemplateBuilder { + b.summary = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *LimitedSupportReasonTemplateBuilder) Copy(object *LimitedSupportReasonTemplate) *LimitedSupportReasonTemplateBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.details = object.details + b.summary = object.summary + return b +} + +// Build creates a 'limited_support_reason_template' object using the configuration stored in the builder. +func (b *LimitedSupportReasonTemplateBuilder) Build() (object *LimitedSupportReasonTemplate, err error) { + object = new(LimitedSupportReasonTemplate) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.details = b.details + object.summary = b.summary + return +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_template_list_builder.go b/clientapi/clustersmgmt/v1/limited_support_reason_template_list_builder.go new file mode 100644 index 00000000..b6130436 --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_template_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LimitedSupportReasonTemplateListBuilder contains the data and logic needed to build +// 'limited_support_reason_template' objects. +type LimitedSupportReasonTemplateListBuilder struct { + items []*LimitedSupportReasonTemplateBuilder +} + +// NewLimitedSupportReasonTemplateList creates a new builder of 'limited_support_reason_template' objects. +func NewLimitedSupportReasonTemplateList() *LimitedSupportReasonTemplateListBuilder { + return new(LimitedSupportReasonTemplateListBuilder) +} + +// Items sets the items of the list. +func (b *LimitedSupportReasonTemplateListBuilder) Items(values ...*LimitedSupportReasonTemplateBuilder) *LimitedSupportReasonTemplateListBuilder { + b.items = make([]*LimitedSupportReasonTemplateBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *LimitedSupportReasonTemplateListBuilder) 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 *LimitedSupportReasonTemplateListBuilder) Copy(list *LimitedSupportReasonTemplateList) *LimitedSupportReasonTemplateListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*LimitedSupportReasonTemplateBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewLimitedSupportReasonTemplate().Copy(v) + } + } + return b +} + +// Build creates a list of 'limited_support_reason_template' objects using the +// configuration stored in the builder. +func (b *LimitedSupportReasonTemplateListBuilder) Build() (list *LimitedSupportReasonTemplateList, err error) { + items := make([]*LimitedSupportReasonTemplate, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(LimitedSupportReasonTemplateList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_template_list_type_json.go b/clientapi/clustersmgmt/v1/limited_support_reason_template_list_type_json.go new file mode 100644 index 00000000..c5c16ab0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_template_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLimitedSupportReasonTemplateList writes a list of values of the 'limited_support_reason_template' type to +// the given writer. +func MarshalLimitedSupportReasonTemplateList(list []*LimitedSupportReasonTemplate, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLimitedSupportReasonTemplateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLimitedSupportReasonTemplateList writes a list of value of the 'limited_support_reason_template' type to +// the given stream. +func WriteLimitedSupportReasonTemplateList(list []*LimitedSupportReasonTemplate, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteLimitedSupportReasonTemplate(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalLimitedSupportReasonTemplateList reads a list of values of the 'limited_support_reason_template' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLimitedSupportReasonTemplateList(source interface{}) (items []*LimitedSupportReasonTemplate, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLimitedSupportReasonTemplateList(iterator) + err = iterator.Error + return +} + +// ReadLimitedSupportReasonTemplateList reads list of values of the ”limited_support_reason_template' type from +// the given iterator. +func ReadLimitedSupportReasonTemplateList(iterator *jsoniter.Iterator) []*LimitedSupportReasonTemplate { + list := []*LimitedSupportReasonTemplate{} + for iterator.ReadArray() { + item := ReadLimitedSupportReasonTemplate(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_template_type.go b/clientapi/clustersmgmt/v1/limited_support_reason_template_type.go new file mode 100644 index 00000000..c8defee1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_template_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LimitedSupportReasonTemplateKind is the name of the type used to represent objects +// of type 'limited_support_reason_template'. +const LimitedSupportReasonTemplateKind = "LimitedSupportReasonTemplate" + +// LimitedSupportReasonTemplateLinkKind is the name of the type used to represent links +// to objects of type 'limited_support_reason_template'. +const LimitedSupportReasonTemplateLinkKind = "LimitedSupportReasonTemplateLink" + +// LimitedSupportReasonTemplateNilKind is the name of the type used to nil references +// to objects of type 'limited_support_reason_template'. +const LimitedSupportReasonTemplateNilKind = "LimitedSupportReasonTemplateNil" + +// LimitedSupportReasonTemplate represents the values of the 'limited_support_reason_template' type. +// +// A template for cluster limited support reason. +type LimitedSupportReasonTemplate struct { + bitmap_ uint32 + id string + href string + details string + summary string +} + +// Kind returns the name of the type of the object. +func (o *LimitedSupportReasonTemplate) Kind() string { + if o == nil { + return LimitedSupportReasonTemplateNilKind + } + if o.bitmap_&1 != 0 { + return LimitedSupportReasonTemplateLinkKind + } + return LimitedSupportReasonTemplateKind +} + +// Link returns true if this is a link. +func (o *LimitedSupportReasonTemplate) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *LimitedSupportReasonTemplate) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *LimitedSupportReasonTemplate) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *LimitedSupportReasonTemplate) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *LimitedSupportReasonTemplate) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *LimitedSupportReasonTemplate) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Details returns the value of the 'details' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// A detailed description of the reason. +func (o *LimitedSupportReasonTemplate) Details() string { + if o != nil && o.bitmap_&8 != 0 { + return o.details + } + return "" +} + +// GetDetails returns the value of the 'details' attribute and +// a flag indicating if the attribute has a value. +// +// A detailed description of the reason. +func (o *LimitedSupportReasonTemplate) GetDetails() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.details + } + return +} + +// Summary returns the value of the 'summary' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Summary of the reason. +func (o *LimitedSupportReasonTemplate) Summary() string { + if o != nil && o.bitmap_&16 != 0 { + return o.summary + } + return "" +} + +// GetSummary returns the value of the 'summary' attribute and +// a flag indicating if the attribute has a value. +// +// Summary of the reason. +func (o *LimitedSupportReasonTemplate) GetSummary() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.summary + } + return +} + +// LimitedSupportReasonTemplateListKind is the name of the type used to represent list of objects of +// type 'limited_support_reason_template'. +const LimitedSupportReasonTemplateListKind = "LimitedSupportReasonTemplateList" + +// LimitedSupportReasonTemplateListLinkKind is the name of the type used to represent links to list +// of objects of type 'limited_support_reason_template'. +const LimitedSupportReasonTemplateListLinkKind = "LimitedSupportReasonTemplateListLink" + +// LimitedSupportReasonTemplateNilKind is the name of the type used to nil lists of objects of +// type 'limited_support_reason_template'. +const LimitedSupportReasonTemplateListNilKind = "LimitedSupportReasonTemplateListNil" + +// LimitedSupportReasonTemplateList is a list of values of the 'limited_support_reason_template' type. +type LimitedSupportReasonTemplateList struct { + href string + link bool + items []*LimitedSupportReasonTemplate +} + +// Kind returns the name of the type of the object. +func (l *LimitedSupportReasonTemplateList) Kind() string { + if l == nil { + return LimitedSupportReasonTemplateListNilKind + } + if l.link { + return LimitedSupportReasonTemplateListLinkKind + } + return LimitedSupportReasonTemplateListKind +} + +// Link returns true iif this is a link. +func (l *LimitedSupportReasonTemplateList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *LimitedSupportReasonTemplateList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *LimitedSupportReasonTemplateList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *LimitedSupportReasonTemplateList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *LimitedSupportReasonTemplateList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *LimitedSupportReasonTemplateList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *LimitedSupportReasonTemplateList) SetItems(items []*LimitedSupportReasonTemplate) { + l.items = items +} + +// Items returns the items of the list. +func (l *LimitedSupportReasonTemplateList) Items() []*LimitedSupportReasonTemplate { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *LimitedSupportReasonTemplateList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *LimitedSupportReasonTemplateList) Get(i int) *LimitedSupportReasonTemplate { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *LimitedSupportReasonTemplateList) Slice() []*LimitedSupportReasonTemplate { + var slice []*LimitedSupportReasonTemplate + if l == nil { + slice = make([]*LimitedSupportReasonTemplate, 0) + } else { + slice = make([]*LimitedSupportReasonTemplate, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *LimitedSupportReasonTemplateList) Each(f func(item *LimitedSupportReasonTemplate) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *LimitedSupportReasonTemplateList) Range(f func(index int, item *LimitedSupportReasonTemplate) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_template_type_json.go b/clientapi/clustersmgmt/v1/limited_support_reason_template_type_json.go new file mode 100644 index 00000000..57c0a0ea --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_template_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLimitedSupportReasonTemplate writes a value of the 'limited_support_reason_template' type to the given writer. +func MarshalLimitedSupportReasonTemplate(object *LimitedSupportReasonTemplate, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLimitedSupportReasonTemplate(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLimitedSupportReasonTemplate writes a value of the 'limited_support_reason_template' type to the given stream. +func WriteLimitedSupportReasonTemplate(object *LimitedSupportReasonTemplate, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(LimitedSupportReasonTemplateLinkKind) + } else { + stream.WriteString(LimitedSupportReasonTemplateKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("details") + stream.WriteString(object.details) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("summary") + stream.WriteString(object.summary) + } + stream.WriteObjectEnd() +} + +// UnmarshalLimitedSupportReasonTemplate reads a value of the 'limited_support_reason_template' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalLimitedSupportReasonTemplate(source interface{}) (object *LimitedSupportReasonTemplate, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadLimitedSupportReasonTemplate(iterator) + err = iterator.Error + return +} + +// ReadLimitedSupportReasonTemplate reads a value of the 'limited_support_reason_template' type from the given iterator. +func ReadLimitedSupportReasonTemplate(iterator *jsoniter.Iterator) *LimitedSupportReasonTemplate { + object := &LimitedSupportReasonTemplate{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == LimitedSupportReasonTemplateLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "details": + value := iterator.ReadString() + object.details = value + object.bitmap_ |= 8 + case "summary": + value := iterator.ReadString() + object.summary = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_type.go b/clientapi/clustersmgmt/v1/limited_support_reason_type.go new file mode 100644 index 00000000..2630d000 --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_type.go @@ -0,0 +1,391 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// LimitedSupportReasonKind is the name of the type used to represent objects +// of type 'limited_support_reason'. +const LimitedSupportReasonKind = "LimitedSupportReason" + +// LimitedSupportReasonLinkKind is the name of the type used to represent links +// to objects of type 'limited_support_reason'. +const LimitedSupportReasonLinkKind = "LimitedSupportReasonLink" + +// LimitedSupportReasonNilKind is the name of the type used to nil references +// to objects of type 'limited_support_reason'. +const LimitedSupportReasonNilKind = "LimitedSupportReasonNil" + +// LimitedSupportReason represents the values of the 'limited_support_reason' type. +// +// A reason that a cluster is in limited support. +type LimitedSupportReason struct { + bitmap_ uint32 + id string + href string + creationTimestamp time.Time + details string + detectionType DetectionType + override *LimitedSupportReasonOverride + summary string + template *LimitedSupportReasonTemplate +} + +// Kind returns the name of the type of the object. +func (o *LimitedSupportReason) Kind() string { + if o == nil { + return LimitedSupportReasonNilKind + } + if o.bitmap_&1 != 0 { + return LimitedSupportReasonLinkKind + } + return LimitedSupportReasonKind +} + +// Link returns true if this is a link. +func (o *LimitedSupportReason) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *LimitedSupportReason) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *LimitedSupportReason) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *LimitedSupportReason) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *LimitedSupportReason) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *LimitedSupportReason) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The time the reason was detected. +func (o *LimitedSupportReason) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// The time the reason was detected. +func (o *LimitedSupportReason) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// Details returns the value of the 'details' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// URL with a link to a detailed description of the reason. +func (o *LimitedSupportReason) Details() string { + if o != nil && o.bitmap_&16 != 0 { + return o.details + } + return "" +} + +// GetDetails returns the value of the 'details' attribute and +// a flag indicating if the attribute has a value. +// +// URL with a link to a detailed description of the reason. +func (o *LimitedSupportReason) GetDetails() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.details + } + return +} + +// DetectionType returns the value of the 'detection_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if the reason was detected automatically or manually. +// When creating a new reason this field should be empty or "manual". +func (o *LimitedSupportReason) DetectionType() DetectionType { + if o != nil && o.bitmap_&32 != 0 { + return o.detectionType + } + return DetectionType("") +} + +// GetDetectionType returns the value of the 'detection_type' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if the reason was detected automatically or manually. +// When creating a new reason this field should be empty or "manual". +func (o *LimitedSupportReason) GetDetectionType() (value DetectionType, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.detectionType + } + return +} + +// Override returns the value of the 'override' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if the override is enabled +func (o *LimitedSupportReason) Override() *LimitedSupportReasonOverride { + if o != nil && o.bitmap_&64 != 0 { + return o.override + } + return nil +} + +// GetOverride returns the value of the 'override' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if the override is enabled +func (o *LimitedSupportReason) GetOverride() (value *LimitedSupportReasonOverride, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.override + } + return +} + +// Summary returns the value of the 'summary' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Summary of the reason. +func (o *LimitedSupportReason) Summary() string { + if o != nil && o.bitmap_&128 != 0 { + return o.summary + } + return "" +} + +// GetSummary returns the value of the 'summary' attribute and +// a flag indicating if the attribute has a value. +// +// Summary of the reason. +func (o *LimitedSupportReason) GetSummary() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.summary + } + return +} + +// Template returns the value of the 'template' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional link to a template with summary and details. +func (o *LimitedSupportReason) Template() *LimitedSupportReasonTemplate { + if o != nil && o.bitmap_&256 != 0 { + return o.template + } + return nil +} + +// GetTemplate returns the value of the 'template' attribute and +// a flag indicating if the attribute has a value. +// +// Optional link to a template with summary and details. +func (o *LimitedSupportReason) GetTemplate() (value *LimitedSupportReasonTemplate, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.template + } + return +} + +// LimitedSupportReasonListKind is the name of the type used to represent list of objects of +// type 'limited_support_reason'. +const LimitedSupportReasonListKind = "LimitedSupportReasonList" + +// LimitedSupportReasonListLinkKind is the name of the type used to represent links to list +// of objects of type 'limited_support_reason'. +const LimitedSupportReasonListLinkKind = "LimitedSupportReasonListLink" + +// LimitedSupportReasonNilKind is the name of the type used to nil lists of objects of +// type 'limited_support_reason'. +const LimitedSupportReasonListNilKind = "LimitedSupportReasonListNil" + +// LimitedSupportReasonList is a list of values of the 'limited_support_reason' type. +type LimitedSupportReasonList struct { + href string + link bool + items []*LimitedSupportReason +} + +// Kind returns the name of the type of the object. +func (l *LimitedSupportReasonList) Kind() string { + if l == nil { + return LimitedSupportReasonListNilKind + } + if l.link { + return LimitedSupportReasonListLinkKind + } + return LimitedSupportReasonListKind +} + +// Link returns true iif this is a link. +func (l *LimitedSupportReasonList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *LimitedSupportReasonList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *LimitedSupportReasonList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *LimitedSupportReasonList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *LimitedSupportReasonList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *LimitedSupportReasonList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *LimitedSupportReasonList) SetItems(items []*LimitedSupportReason) { + l.items = items +} + +// Items returns the items of the list. +func (l *LimitedSupportReasonList) Items() []*LimitedSupportReason { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *LimitedSupportReasonList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *LimitedSupportReasonList) Get(i int) *LimitedSupportReason { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *LimitedSupportReasonList) Slice() []*LimitedSupportReason { + var slice []*LimitedSupportReason + if l == nil { + slice = make([]*LimitedSupportReason, 0) + } else { + slice = make([]*LimitedSupportReason, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *LimitedSupportReasonList) Each(f func(item *LimitedSupportReason) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *LimitedSupportReasonList) Range(f func(index int, item *LimitedSupportReason) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/limited_support_reason_type_json.go b/clientapi/clustersmgmt/v1/limited_support_reason_type_json.go new file mode 100644 index 00000000..1ca415a1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/limited_support_reason_type_json.go @@ -0,0 +1,191 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLimitedSupportReason writes a value of the 'limited_support_reason' type to the given writer. +func MarshalLimitedSupportReason(object *LimitedSupportReason, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLimitedSupportReason(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLimitedSupportReason writes a value of the 'limited_support_reason' type to the given stream. +func WriteLimitedSupportReason(object *LimitedSupportReason, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(LimitedSupportReasonLinkKind) + } else { + stream.WriteString(LimitedSupportReasonKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("details") + stream.WriteString(object.details) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("detection_type") + stream.WriteString(string(object.detectionType)) + count++ + } + present_ = object.bitmap_&64 != 0 && object.override != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("override") + WriteLimitedSupportReasonOverride(object.override, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("summary") + stream.WriteString(object.summary) + count++ + } + present_ = object.bitmap_&256 != 0 && object.template != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("template") + WriteLimitedSupportReasonTemplate(object.template, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalLimitedSupportReason reads a value of the 'limited_support_reason' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalLimitedSupportReason(source interface{}) (object *LimitedSupportReason, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadLimitedSupportReason(iterator) + err = iterator.Error + return +} + +// ReadLimitedSupportReason reads a value of the 'limited_support_reason' type from the given iterator. +func ReadLimitedSupportReason(iterator *jsoniter.Iterator) *LimitedSupportReason { + object := &LimitedSupportReason{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == LimitedSupportReasonLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 8 + case "details": + value := iterator.ReadString() + object.details = value + object.bitmap_ |= 16 + case "detection_type": + text := iterator.ReadString() + value := DetectionType(text) + object.detectionType = value + object.bitmap_ |= 32 + case "override": + value := ReadLimitedSupportReasonOverride(iterator) + object.override = value + object.bitmap_ |= 64 + case "summary": + value := iterator.ReadString() + object.summary = value + object.bitmap_ |= 128 + case "template": + value := ReadLimitedSupportReasonTemplate(iterator) + object.template = value + object.bitmap_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/listening_method_list_type_json.go b/clientapi/clustersmgmt/v1/listening_method_list_type_json.go new file mode 100644 index 00000000..0b15024e --- /dev/null +++ b/clientapi/clustersmgmt/v1/listening_method_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalListeningMethodList writes a list of values of the 'listening_method' type to +// the given writer. +func MarshalListeningMethodList(list []ListeningMethod, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteListeningMethodList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteListeningMethodList writes a list of value of the 'listening_method' type to +// the given stream. +func WriteListeningMethodList(list []ListeningMethod, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalListeningMethodList reads a list of values of the 'listening_method' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalListeningMethodList(source interface{}) (items []ListeningMethod, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadListeningMethodList(iterator) + err = iterator.Error + return +} + +// ReadListeningMethodList reads list of values of the ”listening_method' type from +// the given iterator. +func ReadListeningMethodList(iterator *jsoniter.Iterator) []ListeningMethod { + list := []ListeningMethod{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ListeningMethod(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/listening_method_type.go b/clientapi/clustersmgmt/v1/listening_method_type.go new file mode 100644 index 00000000..234c707f --- /dev/null +++ b/clientapi/clustersmgmt/v1/listening_method_type.go @@ -0,0 +1,30 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ListeningMethod represents the values of the 'listening_method' enumerated type. +type ListeningMethod string + +const ( + // Uses both external and internal traffic. + ListeningMethodExternal ListeningMethod = "external" + // Uses only internal traffic. + ListeningMethodInternal ListeningMethod = "internal" +) diff --git a/clientapi/clustersmgmt/v1/load_balancer_flavor_list_type_json.go b/clientapi/clustersmgmt/v1/load_balancer_flavor_list_type_json.go new file mode 100644 index 00000000..48faec70 --- /dev/null +++ b/clientapi/clustersmgmt/v1/load_balancer_flavor_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLoadBalancerFlavorList writes a list of values of the 'load_balancer_flavor' type to +// the given writer. +func MarshalLoadBalancerFlavorList(list []LoadBalancerFlavor, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLoadBalancerFlavorList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLoadBalancerFlavorList writes a list of value of the 'load_balancer_flavor' type to +// the given stream. +func WriteLoadBalancerFlavorList(list []LoadBalancerFlavor, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalLoadBalancerFlavorList reads a list of values of the 'load_balancer_flavor' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLoadBalancerFlavorList(source interface{}) (items []LoadBalancerFlavor, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLoadBalancerFlavorList(iterator) + err = iterator.Error + return +} + +// ReadLoadBalancerFlavorList reads list of values of the ”load_balancer_flavor' type from +// the given iterator. +func ReadLoadBalancerFlavorList(iterator *jsoniter.Iterator) []LoadBalancerFlavor { + list := []LoadBalancerFlavor{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := LoadBalancerFlavor(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/load_balancer_flavor_type.go b/clientapi/clustersmgmt/v1/load_balancer_flavor_type.go new file mode 100644 index 00000000..71fa0337 --- /dev/null +++ b/clientapi/clustersmgmt/v1/load_balancer_flavor_type.go @@ -0,0 +1,30 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LoadBalancerFlavor represents the values of the 'load_balancer_flavor' enumerated type. +type LoadBalancerFlavor string + +const ( + // Classic Load Balancer. + LoadBalancerFlavorClassic LoadBalancerFlavor = "classic" + // Network Load Balancer. + LoadBalancerFlavorNlb LoadBalancerFlavor = "nlb" +) diff --git a/clientapi/clustersmgmt/v1/log_builder.go b/clientapi/clustersmgmt/v1/log_builder.go new file mode 100644 index 00000000..53eca91f --- /dev/null +++ b/clientapi/clustersmgmt/v1/log_builder.go @@ -0,0 +1,89 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LogBuilder contains the data and logic needed to build 'log' objects. +// +// Log of the cluster. +type LogBuilder struct { + bitmap_ uint32 + id string + href string + content string +} + +// NewLog creates a new builder of 'log' objects. +func NewLog() *LogBuilder { + return &LogBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *LogBuilder) Link(value bool) *LogBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *LogBuilder) ID(value string) *LogBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *LogBuilder) HREF(value string) *LogBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *LogBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Content sets the value of the 'content' attribute to the given value. +func (b *LogBuilder) Content(value string) *LogBuilder { + b.content = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *LogBuilder) Copy(object *Log) *LogBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.content = object.content + return b +} + +// Build creates a 'log' object using the configuration stored in the builder. +func (b *LogBuilder) Build() (object *Log, err error) { + object = new(Log) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.content = b.content + return +} diff --git a/clientapi/clustersmgmt/v1/log_list_builder.go b/clientapi/clustersmgmt/v1/log_list_builder.go new file mode 100644 index 00000000..59691ea7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/log_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LogListBuilder contains the data and logic needed to build +// 'log' objects. +type LogListBuilder struct { + items []*LogBuilder +} + +// NewLogList creates a new builder of 'log' objects. +func NewLogList() *LogListBuilder { + return new(LogListBuilder) +} + +// Items sets the items of the list. +func (b *LogListBuilder) Items(values ...*LogBuilder) *LogListBuilder { + b.items = make([]*LogBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *LogListBuilder) 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 *LogListBuilder) Copy(list *LogList) *LogListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*LogBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewLog().Copy(v) + } + } + return b +} + +// Build creates a list of 'log' objects using the +// configuration stored in the builder. +func (b *LogListBuilder) Build() (list *LogList, err error) { + items := make([]*Log, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(LogList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/log_list_type_json.go b/clientapi/clustersmgmt/v1/log_list_type_json.go new file mode 100644 index 00000000..f96653ab --- /dev/null +++ b/clientapi/clustersmgmt/v1/log_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLogList writes a list of values of the 'log' type to +// the given writer. +func MarshalLogList(list []*Log, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLogList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLogList writes a list of value of the 'log' type to +// the given stream. +func WriteLogList(list []*Log, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteLog(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalLogList reads a list of values of the 'log' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLogList(source interface{}) (items []*Log, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLogList(iterator) + err = iterator.Error + return +} + +// ReadLogList reads list of values of the ”log' type from +// the given iterator. +func ReadLogList(iterator *jsoniter.Iterator) []*Log { + list := []*Log{} + for iterator.ReadArray() { + item := ReadLog(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/log_type.go b/clientapi/clustersmgmt/v1/log_type.go new file mode 100644 index 00000000..a578dcd5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/log_type.go @@ -0,0 +1,265 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// LogKind is the name of the type used to represent objects +// of type 'log'. +const LogKind = "Log" + +// LogLinkKind is the name of the type used to represent links +// to objects of type 'log'. +const LogLinkKind = "LogLink" + +// LogNilKind is the name of the type used to nil references +// to objects of type 'log'. +const LogNilKind = "LogNil" + +// Log represents the values of the 'log' type. +// +// Log of the cluster. +type Log struct { + bitmap_ uint32 + id string + href string + content string +} + +// Kind returns the name of the type of the object. +func (o *Log) Kind() string { + if o == nil { + return LogNilKind + } + if o.bitmap_&1 != 0 { + return LogLinkKind + } + return LogKind +} + +// Link returns true if this is a link. +func (o *Log) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Log) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Log) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Log) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Log) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Log) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Content returns the value of the 'content' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Content of the log. +func (o *Log) Content() string { + if o != nil && o.bitmap_&8 != 0 { + return o.content + } + return "" +} + +// GetContent returns the value of the 'content' attribute and +// a flag indicating if the attribute has a value. +// +// Content of the log. +func (o *Log) GetContent() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.content + } + return +} + +// LogListKind is the name of the type used to represent list of objects of +// type 'log'. +const LogListKind = "LogList" + +// LogListLinkKind is the name of the type used to represent links to list +// of objects of type 'log'. +const LogListLinkKind = "LogListLink" + +// LogNilKind is the name of the type used to nil lists of objects of +// type 'log'. +const LogListNilKind = "LogListNil" + +// LogList is a list of values of the 'log' type. +type LogList struct { + href string + link bool + items []*Log +} + +// Kind returns the name of the type of the object. +func (l *LogList) Kind() string { + if l == nil { + return LogListNilKind + } + if l.link { + return LogListLinkKind + } + return LogListKind +} + +// Link returns true iif this is a link. +func (l *LogList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *LogList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *LogList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *LogList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *LogList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *LogList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *LogList) SetItems(items []*Log) { + l.items = items +} + +// Items returns the items of the list. +func (l *LogList) Items() []*Log { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *LogList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *LogList) Get(i int) *Log { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *LogList) Slice() []*Log { + var slice []*Log + if l == nil { + slice = make([]*Log, 0) + } else { + slice = make([]*Log, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *LogList) Each(f func(item *Log) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *LogList) Range(f func(index int, item *Log) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/log_type_json.go b/clientapi/clustersmgmt/v1/log_type_json.go new file mode 100644 index 00000000..3ce2eeeb --- /dev/null +++ b/clientapi/clustersmgmt/v1/log_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLog writes a value of the 'log' type to the given writer. +func MarshalLog(object *Log, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLog(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLog writes a value of the 'log' type to the given stream. +func WriteLog(object *Log, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(LogLinkKind) + } else { + stream.WriteString(LogKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("content") + stream.WriteString(object.content) + } + stream.WriteObjectEnd() +} + +// UnmarshalLog reads a value of the 'log' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalLog(source interface{}) (object *Log, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadLog(iterator) + err = iterator.Error + return +} + +// ReadLog reads a value of the 'log' type from the given iterator. +func ReadLog(iterator *jsoniter.Iterator) *Log { + object := &Log{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == LogLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "content": + value := iterator.ReadString() + object.content = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/long_list_type_json.go b/clientapi/clustersmgmt/v1/long_list_type_json.go new file mode 100644 index 00000000..b70b52f0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/long_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLongList writes a list of values of the 'long' type to +// the given writer. +func MarshalLongList(list []int64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLongList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLongList writes a list of value of the 'long' type to +// the given stream. +func WriteLongList(list []int64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalLongList reads a list of values of the 'long' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLongList(source interface{}) (items []int64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLongList(iterator) + err = iterator.Error + return +} + +// ReadLongList reads list of values of the ”long' type from +// the given iterator. +func ReadLongList(iterator *jsoniter.Iterator) []int64 { + list := []int64{} + for iterator.ReadArray() { + item := iterator.ReadInt64() + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_autoscaling_builder.go b/clientapi/clustersmgmt/v1/machine_pool_autoscaling_builder.go new file mode 100644 index 00000000..5d129115 --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_autoscaling_builder.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachinePoolAutoscalingBuilder contains the data and logic needed to build 'machine_pool_autoscaling' objects. +// +// Representation of a autoscaling in a machine pool. +type MachinePoolAutoscalingBuilder struct { + bitmap_ uint32 + id string + href string + maxReplicas int + minReplicas int +} + +// NewMachinePoolAutoscaling creates a new builder of 'machine_pool_autoscaling' objects. +func NewMachinePoolAutoscaling() *MachinePoolAutoscalingBuilder { + return &MachinePoolAutoscalingBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *MachinePoolAutoscalingBuilder) Link(value bool) *MachinePoolAutoscalingBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *MachinePoolAutoscalingBuilder) ID(value string) *MachinePoolAutoscalingBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *MachinePoolAutoscalingBuilder) HREF(value string) *MachinePoolAutoscalingBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *MachinePoolAutoscalingBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// MaxReplicas sets the value of the 'max_replicas' attribute to the given value. +func (b *MachinePoolAutoscalingBuilder) MaxReplicas(value int) *MachinePoolAutoscalingBuilder { + b.maxReplicas = value + b.bitmap_ |= 8 + return b +} + +// MinReplicas sets the value of the 'min_replicas' attribute to the given value. +func (b *MachinePoolAutoscalingBuilder) MinReplicas(value int) *MachinePoolAutoscalingBuilder { + b.minReplicas = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *MachinePoolAutoscalingBuilder) Copy(object *MachinePoolAutoscaling) *MachinePoolAutoscalingBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.maxReplicas = object.maxReplicas + b.minReplicas = object.minReplicas + return b +} + +// Build creates a 'machine_pool_autoscaling' object using the configuration stored in the builder. +func (b *MachinePoolAutoscalingBuilder) Build() (object *MachinePoolAutoscaling, err error) { + object = new(MachinePoolAutoscaling) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.maxReplicas = b.maxReplicas + object.minReplicas = b.minReplicas + return +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_autoscaling_list_builder.go b/clientapi/clustersmgmt/v1/machine_pool_autoscaling_list_builder.go new file mode 100644 index 00000000..6319972b --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_autoscaling_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachinePoolAutoscalingListBuilder contains the data and logic needed to build +// 'machine_pool_autoscaling' objects. +type MachinePoolAutoscalingListBuilder struct { + items []*MachinePoolAutoscalingBuilder +} + +// NewMachinePoolAutoscalingList creates a new builder of 'machine_pool_autoscaling' objects. +func NewMachinePoolAutoscalingList() *MachinePoolAutoscalingListBuilder { + return new(MachinePoolAutoscalingListBuilder) +} + +// Items sets the items of the list. +func (b *MachinePoolAutoscalingListBuilder) Items(values ...*MachinePoolAutoscalingBuilder) *MachinePoolAutoscalingListBuilder { + b.items = make([]*MachinePoolAutoscalingBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *MachinePoolAutoscalingListBuilder) 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 *MachinePoolAutoscalingListBuilder) Copy(list *MachinePoolAutoscalingList) *MachinePoolAutoscalingListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*MachinePoolAutoscalingBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewMachinePoolAutoscaling().Copy(v) + } + } + return b +} + +// Build creates a list of 'machine_pool_autoscaling' objects using the +// configuration stored in the builder. +func (b *MachinePoolAutoscalingListBuilder) Build() (list *MachinePoolAutoscalingList, err error) { + items := make([]*MachinePoolAutoscaling, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(MachinePoolAutoscalingList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_autoscaling_list_type_json.go b/clientapi/clustersmgmt/v1/machine_pool_autoscaling_list_type_json.go new file mode 100644 index 00000000..2791fcdc --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_autoscaling_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMachinePoolAutoscalingList writes a list of values of the 'machine_pool_autoscaling' type to +// the given writer. +func MarshalMachinePoolAutoscalingList(list []*MachinePoolAutoscaling, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachinePoolAutoscalingList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachinePoolAutoscalingList writes a list of value of the 'machine_pool_autoscaling' type to +// the given stream. +func WriteMachinePoolAutoscalingList(list []*MachinePoolAutoscaling, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteMachinePoolAutoscaling(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalMachinePoolAutoscalingList reads a list of values of the 'machine_pool_autoscaling' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMachinePoolAutoscalingList(source interface{}) (items []*MachinePoolAutoscaling, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMachinePoolAutoscalingList(iterator) + err = iterator.Error + return +} + +// ReadMachinePoolAutoscalingList reads list of values of the ”machine_pool_autoscaling' type from +// the given iterator. +func ReadMachinePoolAutoscalingList(iterator *jsoniter.Iterator) []*MachinePoolAutoscaling { + list := []*MachinePoolAutoscaling{} + for iterator.ReadArray() { + item := ReadMachinePoolAutoscaling(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_autoscaling_type.go b/clientapi/clustersmgmt/v1/machine_pool_autoscaling_type.go new file mode 100644 index 00000000..be84abde --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_autoscaling_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachinePoolAutoscalingKind is the name of the type used to represent objects +// of type 'machine_pool_autoscaling'. +const MachinePoolAutoscalingKind = "MachinePoolAutoscaling" + +// MachinePoolAutoscalingLinkKind is the name of the type used to represent links +// to objects of type 'machine_pool_autoscaling'. +const MachinePoolAutoscalingLinkKind = "MachinePoolAutoscalingLink" + +// MachinePoolAutoscalingNilKind is the name of the type used to nil references +// to objects of type 'machine_pool_autoscaling'. +const MachinePoolAutoscalingNilKind = "MachinePoolAutoscalingNil" + +// MachinePoolAutoscaling represents the values of the 'machine_pool_autoscaling' type. +// +// Representation of a autoscaling in a machine pool. +type MachinePoolAutoscaling struct { + bitmap_ uint32 + id string + href string + maxReplicas int + minReplicas int +} + +// Kind returns the name of the type of the object. +func (o *MachinePoolAutoscaling) Kind() string { + if o == nil { + return MachinePoolAutoscalingNilKind + } + if o.bitmap_&1 != 0 { + return MachinePoolAutoscalingLinkKind + } + return MachinePoolAutoscalingKind +} + +// Link returns true if this is a link. +func (o *MachinePoolAutoscaling) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *MachinePoolAutoscaling) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *MachinePoolAutoscaling) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *MachinePoolAutoscaling) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *MachinePoolAutoscaling) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *MachinePoolAutoscaling) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// MaxReplicas returns the value of the 'max_replicas' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The maximum number of replicas for the machine pool. +func (o *MachinePoolAutoscaling) MaxReplicas() int { + if o != nil && o.bitmap_&8 != 0 { + return o.maxReplicas + } + return 0 +} + +// GetMaxReplicas returns the value of the 'max_replicas' attribute and +// a flag indicating if the attribute has a value. +// +// The maximum number of replicas for the machine pool. +func (o *MachinePoolAutoscaling) GetMaxReplicas() (value int, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.maxReplicas + } + return +} + +// MinReplicas returns the value of the 'min_replicas' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The minimum number of replicas for the machine pool. +func (o *MachinePoolAutoscaling) MinReplicas() int { + if o != nil && o.bitmap_&16 != 0 { + return o.minReplicas + } + return 0 +} + +// GetMinReplicas returns the value of the 'min_replicas' attribute and +// a flag indicating if the attribute has a value. +// +// The minimum number of replicas for the machine pool. +func (o *MachinePoolAutoscaling) GetMinReplicas() (value int, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.minReplicas + } + return +} + +// MachinePoolAutoscalingListKind is the name of the type used to represent list of objects of +// type 'machine_pool_autoscaling'. +const MachinePoolAutoscalingListKind = "MachinePoolAutoscalingList" + +// MachinePoolAutoscalingListLinkKind is the name of the type used to represent links to list +// of objects of type 'machine_pool_autoscaling'. +const MachinePoolAutoscalingListLinkKind = "MachinePoolAutoscalingListLink" + +// MachinePoolAutoscalingNilKind is the name of the type used to nil lists of objects of +// type 'machine_pool_autoscaling'. +const MachinePoolAutoscalingListNilKind = "MachinePoolAutoscalingListNil" + +// MachinePoolAutoscalingList is a list of values of the 'machine_pool_autoscaling' type. +type MachinePoolAutoscalingList struct { + href string + link bool + items []*MachinePoolAutoscaling +} + +// Kind returns the name of the type of the object. +func (l *MachinePoolAutoscalingList) Kind() string { + if l == nil { + return MachinePoolAutoscalingListNilKind + } + if l.link { + return MachinePoolAutoscalingListLinkKind + } + return MachinePoolAutoscalingListKind +} + +// Link returns true iif this is a link. +func (l *MachinePoolAutoscalingList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *MachinePoolAutoscalingList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *MachinePoolAutoscalingList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *MachinePoolAutoscalingList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *MachinePoolAutoscalingList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *MachinePoolAutoscalingList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *MachinePoolAutoscalingList) SetItems(items []*MachinePoolAutoscaling) { + l.items = items +} + +// Items returns the items of the list. +func (l *MachinePoolAutoscalingList) Items() []*MachinePoolAutoscaling { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *MachinePoolAutoscalingList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *MachinePoolAutoscalingList) Get(i int) *MachinePoolAutoscaling { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *MachinePoolAutoscalingList) Slice() []*MachinePoolAutoscaling { + var slice []*MachinePoolAutoscaling + if l == nil { + slice = make([]*MachinePoolAutoscaling, 0) + } else { + slice = make([]*MachinePoolAutoscaling, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *MachinePoolAutoscalingList) Each(f func(item *MachinePoolAutoscaling) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *MachinePoolAutoscalingList) Range(f func(index int, item *MachinePoolAutoscaling) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_autoscaling_type_json.go b/clientapi/clustersmgmt/v1/machine_pool_autoscaling_type_json.go new file mode 100644 index 00000000..f37678db --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_autoscaling_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMachinePoolAutoscaling writes a value of the 'machine_pool_autoscaling' type to the given writer. +func MarshalMachinePoolAutoscaling(object *MachinePoolAutoscaling, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachinePoolAutoscaling(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachinePoolAutoscaling writes a value of the 'machine_pool_autoscaling' type to the given stream. +func WriteMachinePoolAutoscaling(object *MachinePoolAutoscaling, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(MachinePoolAutoscalingLinkKind) + } else { + stream.WriteString(MachinePoolAutoscalingKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_replicas") + stream.WriteInt(object.maxReplicas) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("min_replicas") + stream.WriteInt(object.minReplicas) + } + stream.WriteObjectEnd() +} + +// UnmarshalMachinePoolAutoscaling reads a value of the 'machine_pool_autoscaling' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalMachinePoolAutoscaling(source interface{}) (object *MachinePoolAutoscaling, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadMachinePoolAutoscaling(iterator) + err = iterator.Error + return +} + +// ReadMachinePoolAutoscaling reads a value of the 'machine_pool_autoscaling' type from the given iterator. +func ReadMachinePoolAutoscaling(iterator *jsoniter.Iterator) *MachinePoolAutoscaling { + object := &MachinePoolAutoscaling{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == MachinePoolAutoscalingLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "max_replicas": + value := iterator.ReadInt() + object.maxReplicas = value + object.bitmap_ |= 8 + case "min_replicas": + value := iterator.ReadInt() + object.minReplicas = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_builder.go b/clientapi/clustersmgmt/v1/machine_pool_builder.go new file mode 100644 index 00000000..6a50befc --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_builder.go @@ -0,0 +1,315 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachinePoolBuilder contains the data and logic needed to build 'machine_pool' objects. +// +// Representation of a machine pool in a cluster. +type MachinePoolBuilder struct { + bitmap_ uint32 + id string + href string + aws *AWSMachinePoolBuilder + gcp *GCPMachinePoolBuilder + autoscaling *MachinePoolAutoscalingBuilder + availabilityZones []string + instanceType string + labels map[string]string + replicas int + rootVolume *RootVolumeBuilder + securityGroupFilters []*MachinePoolSecurityGroupFilterBuilder + subnets []string + taints []*TaintBuilder +} + +// NewMachinePool creates a new builder of 'machine_pool' objects. +func NewMachinePool() *MachinePoolBuilder { + return &MachinePoolBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *MachinePoolBuilder) Link(value bool) *MachinePoolBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *MachinePoolBuilder) ID(value string) *MachinePoolBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *MachinePoolBuilder) HREF(value string) *MachinePoolBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *MachinePoolBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AWS sets the value of the 'AWS' attribute to the given value. +// +// Representation of aws machine pool specific parameters. +func (b *MachinePoolBuilder) AWS(value *AWSMachinePoolBuilder) *MachinePoolBuilder { + b.aws = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// GCP sets the value of the 'GCP' attribute to the given value. +// +// Representation of gcp machine pool specific parameters. +func (b *MachinePoolBuilder) GCP(value *GCPMachinePoolBuilder) *MachinePoolBuilder { + b.gcp = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Autoscaling sets the value of the 'autoscaling' attribute to the given value. +// +// Representation of a autoscaling in a machine pool. +func (b *MachinePoolBuilder) Autoscaling(value *MachinePoolAutoscalingBuilder) *MachinePoolBuilder { + b.autoscaling = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// AvailabilityZones sets the value of the 'availability_zones' attribute to the given values. +func (b *MachinePoolBuilder) AvailabilityZones(values ...string) *MachinePoolBuilder { + b.availabilityZones = make([]string, len(values)) + copy(b.availabilityZones, values) + b.bitmap_ |= 64 + return b +} + +// InstanceType sets the value of the 'instance_type' attribute to the given value. +func (b *MachinePoolBuilder) InstanceType(value string) *MachinePoolBuilder { + b.instanceType = value + b.bitmap_ |= 128 + return b +} + +// Labels sets the value of the 'labels' attribute to the given value. +func (b *MachinePoolBuilder) Labels(value map[string]string) *MachinePoolBuilder { + b.labels = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// Replicas sets the value of the 'replicas' attribute to the given value. +func (b *MachinePoolBuilder) Replicas(value int) *MachinePoolBuilder { + b.replicas = value + b.bitmap_ |= 512 + return b +} + +// RootVolume sets the value of the 'root_volume' attribute to the given value. +// +// Root volume capabilities. +func (b *MachinePoolBuilder) RootVolume(value *RootVolumeBuilder) *MachinePoolBuilder { + b.rootVolume = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// SecurityGroupFilters sets the value of the 'security_group_filters' attribute to the given values. +func (b *MachinePoolBuilder) SecurityGroupFilters(values ...*MachinePoolSecurityGroupFilterBuilder) *MachinePoolBuilder { + b.securityGroupFilters = make([]*MachinePoolSecurityGroupFilterBuilder, len(values)) + copy(b.securityGroupFilters, values) + b.bitmap_ |= 2048 + return b +} + +// Subnets sets the value of the 'subnets' attribute to the given values. +func (b *MachinePoolBuilder) Subnets(values ...string) *MachinePoolBuilder { + b.subnets = make([]string, len(values)) + copy(b.subnets, values) + b.bitmap_ |= 4096 + return b +} + +// Taints sets the value of the 'taints' attribute to the given values. +func (b *MachinePoolBuilder) Taints(values ...*TaintBuilder) *MachinePoolBuilder { + b.taints = make([]*TaintBuilder, len(values)) + copy(b.taints, values) + b.bitmap_ |= 8192 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *MachinePoolBuilder) Copy(object *MachinePool) *MachinePoolBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.aws != nil { + b.aws = NewAWSMachinePool().Copy(object.aws) + } else { + b.aws = nil + } + if object.gcp != nil { + b.gcp = NewGCPMachinePool().Copy(object.gcp) + } else { + b.gcp = nil + } + if object.autoscaling != nil { + b.autoscaling = NewMachinePoolAutoscaling().Copy(object.autoscaling) + } else { + b.autoscaling = nil + } + if object.availabilityZones != nil { + b.availabilityZones = make([]string, len(object.availabilityZones)) + copy(b.availabilityZones, object.availabilityZones) + } else { + b.availabilityZones = nil + } + b.instanceType = object.instanceType + if len(object.labels) > 0 { + b.labels = map[string]string{} + for k, v := range object.labels { + b.labels[k] = v + } + } else { + b.labels = nil + } + b.replicas = object.replicas + if object.rootVolume != nil { + b.rootVolume = NewRootVolume().Copy(object.rootVolume) + } else { + b.rootVolume = nil + } + if object.securityGroupFilters != nil { + b.securityGroupFilters = make([]*MachinePoolSecurityGroupFilterBuilder, len(object.securityGroupFilters)) + for i, v := range object.securityGroupFilters { + b.securityGroupFilters[i] = NewMachinePoolSecurityGroupFilter().Copy(v) + } + } else { + b.securityGroupFilters = nil + } + if object.subnets != nil { + b.subnets = make([]string, len(object.subnets)) + copy(b.subnets, object.subnets) + } else { + b.subnets = nil + } + if object.taints != nil { + b.taints = make([]*TaintBuilder, len(object.taints)) + for i, v := range object.taints { + b.taints[i] = NewTaint().Copy(v) + } + } else { + b.taints = nil + } + return b +} + +// Build creates a 'machine_pool' object using the configuration stored in the builder. +func (b *MachinePoolBuilder) Build() (object *MachinePool, err error) { + object = new(MachinePool) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.aws != nil { + object.aws, err = b.aws.Build() + if err != nil { + return + } + } + if b.gcp != nil { + object.gcp, err = b.gcp.Build() + if err != nil { + return + } + } + if b.autoscaling != nil { + object.autoscaling, err = b.autoscaling.Build() + if err != nil { + return + } + } + if b.availabilityZones != nil { + object.availabilityZones = make([]string, len(b.availabilityZones)) + copy(object.availabilityZones, b.availabilityZones) + } + object.instanceType = b.instanceType + if b.labels != nil { + object.labels = make(map[string]string) + for k, v := range b.labels { + object.labels[k] = v + } + } + object.replicas = b.replicas + if b.rootVolume != nil { + object.rootVolume, err = b.rootVolume.Build() + if err != nil { + return + } + } + if b.securityGroupFilters != nil { + object.securityGroupFilters = make([]*MachinePoolSecurityGroupFilter, len(b.securityGroupFilters)) + for i, v := range b.securityGroupFilters { + object.securityGroupFilters[i], err = v.Build() + if err != nil { + return + } + } + } + if b.subnets != nil { + object.subnets = make([]string, len(b.subnets)) + copy(object.subnets, b.subnets) + } + if b.taints != nil { + object.taints = make([]*Taint, len(b.taints)) + for i, v := range b.taints { + object.taints[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_list_builder.go b/clientapi/clustersmgmt/v1/machine_pool_list_builder.go new file mode 100644 index 00000000..684707dd --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachinePoolListBuilder contains the data and logic needed to build +// 'machine_pool' objects. +type MachinePoolListBuilder struct { + items []*MachinePoolBuilder +} + +// NewMachinePoolList creates a new builder of 'machine_pool' objects. +func NewMachinePoolList() *MachinePoolListBuilder { + return new(MachinePoolListBuilder) +} + +// Items sets the items of the list. +func (b *MachinePoolListBuilder) Items(values ...*MachinePoolBuilder) *MachinePoolListBuilder { + b.items = make([]*MachinePoolBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *MachinePoolListBuilder) 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 *MachinePoolListBuilder) Copy(list *MachinePoolList) *MachinePoolListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*MachinePoolBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewMachinePool().Copy(v) + } + } + return b +} + +// Build creates a list of 'machine_pool' objects using the +// configuration stored in the builder. +func (b *MachinePoolListBuilder) Build() (list *MachinePoolList, err error) { + items := make([]*MachinePool, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(MachinePoolList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_list_type_json.go b/clientapi/clustersmgmt/v1/machine_pool_list_type_json.go new file mode 100644 index 00000000..da6c61fb --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMachinePoolList writes a list of values of the 'machine_pool' type to +// the given writer. +func MarshalMachinePoolList(list []*MachinePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachinePoolList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachinePoolList writes a list of value of the 'machine_pool' type to +// the given stream. +func WriteMachinePoolList(list []*MachinePool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteMachinePool(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalMachinePoolList reads a list of values of the 'machine_pool' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMachinePoolList(source interface{}) (items []*MachinePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMachinePoolList(iterator) + err = iterator.Error + return +} + +// ReadMachinePoolList reads list of values of the ”machine_pool' type from +// the given iterator. +func ReadMachinePoolList(iterator *jsoniter.Iterator) []*MachinePool { + list := []*MachinePool{} + for iterator.ReadArray() { + item := ReadMachinePool(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_builder.go b/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_builder.go new file mode 100644 index 00000000..cbeaa446 --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachinePoolSecurityGroupFilterBuilder contains the data and logic needed to build 'machine_pool_security_group_filter' objects. +// +// Security Group Filter object, containing name of the filter tag and value of the filter tag +type MachinePoolSecurityGroupFilterBuilder struct { + bitmap_ uint32 + name string + value string +} + +// NewMachinePoolSecurityGroupFilter creates a new builder of 'machine_pool_security_group_filter' objects. +func NewMachinePoolSecurityGroupFilter() *MachinePoolSecurityGroupFilterBuilder { + return &MachinePoolSecurityGroupFilterBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *MachinePoolSecurityGroupFilterBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *MachinePoolSecurityGroupFilterBuilder) Name(value string) *MachinePoolSecurityGroupFilterBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *MachinePoolSecurityGroupFilterBuilder) Value(value string) *MachinePoolSecurityGroupFilterBuilder { + b.value = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *MachinePoolSecurityGroupFilterBuilder) Copy(object *MachinePoolSecurityGroupFilter) *MachinePoolSecurityGroupFilterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + b.value = object.value + return b +} + +// Build creates a 'machine_pool_security_group_filter' object using the configuration stored in the builder. +func (b *MachinePoolSecurityGroupFilterBuilder) Build() (object *MachinePoolSecurityGroupFilter, err error) { + object = new(MachinePoolSecurityGroupFilter) + object.bitmap_ = b.bitmap_ + object.name = b.name + object.value = b.value + return +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_list_builder.go b/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_list_builder.go new file mode 100644 index 00000000..52704e16 --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachinePoolSecurityGroupFilterListBuilder contains the data and logic needed to build +// 'machine_pool_security_group_filter' objects. +type MachinePoolSecurityGroupFilterListBuilder struct { + items []*MachinePoolSecurityGroupFilterBuilder +} + +// NewMachinePoolSecurityGroupFilterList creates a new builder of 'machine_pool_security_group_filter' objects. +func NewMachinePoolSecurityGroupFilterList() *MachinePoolSecurityGroupFilterListBuilder { + return new(MachinePoolSecurityGroupFilterListBuilder) +} + +// Items sets the items of the list. +func (b *MachinePoolSecurityGroupFilterListBuilder) Items(values ...*MachinePoolSecurityGroupFilterBuilder) *MachinePoolSecurityGroupFilterListBuilder { + b.items = make([]*MachinePoolSecurityGroupFilterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *MachinePoolSecurityGroupFilterListBuilder) 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 *MachinePoolSecurityGroupFilterListBuilder) Copy(list *MachinePoolSecurityGroupFilterList) *MachinePoolSecurityGroupFilterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*MachinePoolSecurityGroupFilterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewMachinePoolSecurityGroupFilter().Copy(v) + } + } + return b +} + +// Build creates a list of 'machine_pool_security_group_filter' objects using the +// configuration stored in the builder. +func (b *MachinePoolSecurityGroupFilterListBuilder) Build() (list *MachinePoolSecurityGroupFilterList, err error) { + items := make([]*MachinePoolSecurityGroupFilter, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(MachinePoolSecurityGroupFilterList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_list_type_json.go b/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_list_type_json.go new file mode 100644 index 00000000..969900fa --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMachinePoolSecurityGroupFilterList writes a list of values of the 'machine_pool_security_group_filter' type to +// the given writer. +func MarshalMachinePoolSecurityGroupFilterList(list []*MachinePoolSecurityGroupFilter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachinePoolSecurityGroupFilterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachinePoolSecurityGroupFilterList writes a list of value of the 'machine_pool_security_group_filter' type to +// the given stream. +func WriteMachinePoolSecurityGroupFilterList(list []*MachinePoolSecurityGroupFilter, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteMachinePoolSecurityGroupFilter(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalMachinePoolSecurityGroupFilterList reads a list of values of the 'machine_pool_security_group_filter' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMachinePoolSecurityGroupFilterList(source interface{}) (items []*MachinePoolSecurityGroupFilter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMachinePoolSecurityGroupFilterList(iterator) + err = iterator.Error + return +} + +// ReadMachinePoolSecurityGroupFilterList reads list of values of the ”machine_pool_security_group_filter' type from +// the given iterator. +func ReadMachinePoolSecurityGroupFilterList(iterator *jsoniter.Iterator) []*MachinePoolSecurityGroupFilter { + list := []*MachinePoolSecurityGroupFilter{} + for iterator.ReadArray() { + item := ReadMachinePoolSecurityGroupFilter(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_type.go b/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_type.go new file mode 100644 index 00000000..1d6c483a --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_type.go @@ -0,0 +1,181 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachinePoolSecurityGroupFilter represents the values of the 'machine_pool_security_group_filter' type. +// +// Security Group Filter object, containing name of the filter tag and value of the filter tag +type MachinePoolSecurityGroupFilter struct { + bitmap_ uint32 + name string + value string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *MachinePoolSecurityGroupFilter) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *MachinePoolSecurityGroupFilter) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *MachinePoolSecurityGroupFilter) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *MachinePoolSecurityGroupFilter) Value() string { + if o != nil && o.bitmap_&2 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +func (o *MachinePoolSecurityGroupFilter) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.value + } + return +} + +// MachinePoolSecurityGroupFilterListKind is the name of the type used to represent list of objects of +// type 'machine_pool_security_group_filter'. +const MachinePoolSecurityGroupFilterListKind = "MachinePoolSecurityGroupFilterList" + +// MachinePoolSecurityGroupFilterListLinkKind is the name of the type used to represent links to list +// of objects of type 'machine_pool_security_group_filter'. +const MachinePoolSecurityGroupFilterListLinkKind = "MachinePoolSecurityGroupFilterListLink" + +// MachinePoolSecurityGroupFilterNilKind is the name of the type used to nil lists of objects of +// type 'machine_pool_security_group_filter'. +const MachinePoolSecurityGroupFilterListNilKind = "MachinePoolSecurityGroupFilterListNil" + +// MachinePoolSecurityGroupFilterList is a list of values of the 'machine_pool_security_group_filter' type. +type MachinePoolSecurityGroupFilterList struct { + href string + link bool + items []*MachinePoolSecurityGroupFilter +} + +// Len returns the length of the list. +func (l *MachinePoolSecurityGroupFilterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *MachinePoolSecurityGroupFilterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *MachinePoolSecurityGroupFilterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *MachinePoolSecurityGroupFilterList) SetItems(items []*MachinePoolSecurityGroupFilter) { + l.items = items +} + +// Items returns the items of the list. +func (l *MachinePoolSecurityGroupFilterList) Items() []*MachinePoolSecurityGroupFilter { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *MachinePoolSecurityGroupFilterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *MachinePoolSecurityGroupFilterList) Get(i int) *MachinePoolSecurityGroupFilter { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *MachinePoolSecurityGroupFilterList) Slice() []*MachinePoolSecurityGroupFilter { + var slice []*MachinePoolSecurityGroupFilter + if l == nil { + slice = make([]*MachinePoolSecurityGroupFilter, 0) + } else { + slice = make([]*MachinePoolSecurityGroupFilter, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *MachinePoolSecurityGroupFilterList) Each(f func(item *MachinePoolSecurityGroupFilter) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *MachinePoolSecurityGroupFilterList) Range(f func(index int, item *MachinePoolSecurityGroupFilter) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_type_json.go b/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_type_json.go new file mode 100644 index 00000000..bba602a8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_security_group_filter_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMachinePoolSecurityGroupFilter writes a value of the 'machine_pool_security_group_filter' type to the given writer. +func MarshalMachinePoolSecurityGroupFilter(object *MachinePoolSecurityGroupFilter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachinePoolSecurityGroupFilter(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachinePoolSecurityGroupFilter writes a value of the 'machine_pool_security_group_filter' type to the given stream. +func WriteMachinePoolSecurityGroupFilter(object *MachinePoolSecurityGroupFilter, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalMachinePoolSecurityGroupFilter reads a value of the 'machine_pool_security_group_filter' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalMachinePoolSecurityGroupFilter(source interface{}) (object *MachinePoolSecurityGroupFilter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadMachinePoolSecurityGroupFilter(iterator) + err = iterator.Error + return +} + +// ReadMachinePoolSecurityGroupFilter reads a value of the 'machine_pool_security_group_filter' type from the given iterator. +func ReadMachinePoolSecurityGroupFilter(iterator *jsoniter.Iterator) *MachinePoolSecurityGroupFilter { + object := &MachinePoolSecurityGroupFilter{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_type.go b/clientapi/clustersmgmt/v1/machine_pool_type.go new file mode 100644 index 00000000..e57e145d --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_type.go @@ -0,0 +1,509 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachinePoolKind is the name of the type used to represent objects +// of type 'machine_pool'. +const MachinePoolKind = "MachinePool" + +// MachinePoolLinkKind is the name of the type used to represent links +// to objects of type 'machine_pool'. +const MachinePoolLinkKind = "MachinePoolLink" + +// MachinePoolNilKind is the name of the type used to nil references +// to objects of type 'machine_pool'. +const MachinePoolNilKind = "MachinePoolNil" + +// MachinePool represents the values of the 'machine_pool' type. +// +// Representation of a machine pool in a cluster. +type MachinePool struct { + bitmap_ uint32 + id string + href string + aws *AWSMachinePool + gcp *GCPMachinePool + autoscaling *MachinePoolAutoscaling + availabilityZones []string + instanceType string + labels map[string]string + replicas int + rootVolume *RootVolume + securityGroupFilters []*MachinePoolSecurityGroupFilter + subnets []string + taints []*Taint +} + +// Kind returns the name of the type of the object. +func (o *MachinePool) Kind() string { + if o == nil { + return MachinePoolNilKind + } + if o.bitmap_&1 != 0 { + return MachinePoolLinkKind + } + return MachinePoolKind +} + +// Link returns true if this is a link. +func (o *MachinePool) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *MachinePool) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *MachinePool) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *MachinePool) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *MachinePool) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *MachinePool) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AWS returns the value of the 'AWS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS specific parameters (Optional). +func (o *MachinePool) AWS() *AWSMachinePool { + if o != nil && o.bitmap_&8 != 0 { + return o.aws + } + return nil +} + +// GetAWS returns the value of the 'AWS' attribute and +// a flag indicating if the attribute has a value. +// +// AWS specific parameters (Optional). +func (o *MachinePool) GetAWS() (value *AWSMachinePool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.aws + } + return +} + +// GCP returns the value of the 'GCP' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP specific parameters (Optional). +func (o *MachinePool) GCP() *GCPMachinePool { + if o != nil && o.bitmap_&16 != 0 { + return o.gcp + } + return nil +} + +// GetGCP returns the value of the 'GCP' attribute and +// a flag indicating if the attribute has a value. +// +// GCP specific parameters (Optional). +func (o *MachinePool) GetGCP() (value *GCPMachinePool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.gcp + } + return +} + +// Autoscaling returns the value of the 'autoscaling' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for auto-scaling the machine pool. +// Replicas and autoscaling cannot be used together. +func (o *MachinePool) Autoscaling() *MachinePoolAutoscaling { + if o != nil && o.bitmap_&32 != 0 { + return o.autoscaling + } + return nil +} + +// GetAutoscaling returns the value of the 'autoscaling' attribute and +// a flag indicating if the attribute has a value. +// +// Details for auto-scaling the machine pool. +// Replicas and autoscaling cannot be used together. +func (o *MachinePool) GetAutoscaling() (value *MachinePoolAutoscaling, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.autoscaling + } + return +} + +// AvailabilityZones returns the value of the 'availability_zones' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The availability zones upon which the nodes are created. +func (o *MachinePool) AvailabilityZones() []string { + if o != nil && o.bitmap_&64 != 0 { + return o.availabilityZones + } + return nil +} + +// GetAvailabilityZones returns the value of the 'availability_zones' attribute and +// a flag indicating if the attribute has a value. +// +// The availability zones upon which the nodes are created. +func (o *MachinePool) GetAvailabilityZones() (value []string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.availabilityZones + } + return +} + +// InstanceType returns the value of the 'instance_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The instance type of Nodes to create. +func (o *MachinePool) InstanceType() string { + if o != nil && o.bitmap_&128 != 0 { + return o.instanceType + } + return "" +} + +// GetInstanceType returns the value of the 'instance_type' attribute and +// a flag indicating if the attribute has a value. +// +// The instance type of Nodes to create. +func (o *MachinePool) GetInstanceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.instanceType + } + return +} + +// Labels returns the value of the 'labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The labels set on the Nodes created. +func (o *MachinePool) Labels() map[string]string { + if o != nil && o.bitmap_&256 != 0 { + return o.labels + } + return nil +} + +// GetLabels returns the value of the 'labels' attribute and +// a flag indicating if the attribute has a value. +// +// The labels set on the Nodes created. +func (o *MachinePool) GetLabels() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.labels + } + return +} + +// Replicas returns the value of the 'replicas' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The number of Machines (and Nodes) to create. +// Replicas and autoscaling cannot be used together. +func (o *MachinePool) Replicas() int { + if o != nil && o.bitmap_&512 != 0 { + return o.replicas + } + return 0 +} + +// GetReplicas returns the value of the 'replicas' attribute and +// a flag indicating if the attribute has a value. +// +// The number of Machines (and Nodes) to create. +// Replicas and autoscaling cannot be used together. +func (o *MachinePool) GetReplicas() (value int, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.replicas + } + return +} + +// RootVolume returns the value of the 'root_volume' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The machine root volume capabilities. +func (o *MachinePool) RootVolume() *RootVolume { + if o != nil && o.bitmap_&1024 != 0 { + return o.rootVolume + } + return nil +} + +// GetRootVolume returns the value of the 'root_volume' attribute and +// a flag indicating if the attribute has a value. +// +// The machine root volume capabilities. +func (o *MachinePool) GetRootVolume() (value *RootVolume, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.rootVolume + } + return +} + +// SecurityGroupFilters returns the value of the 'security_group_filters' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of security groups to be applied to MachinePool (Optional) +func (o *MachinePool) SecurityGroupFilters() []*MachinePoolSecurityGroupFilter { + if o != nil && o.bitmap_&2048 != 0 { + return o.securityGroupFilters + } + return nil +} + +// GetSecurityGroupFilters returns the value of the 'security_group_filters' attribute and +// a flag indicating if the attribute has a value. +// +// List of security groups to be applied to MachinePool (Optional) +func (o *MachinePool) GetSecurityGroupFilters() (value []*MachinePoolSecurityGroupFilter, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.securityGroupFilters + } + return +} + +// Subnets returns the value of the 'subnets' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The subnets upon which the nodes are created. +func (o *MachinePool) Subnets() []string { + if o != nil && o.bitmap_&4096 != 0 { + return o.subnets + } + return nil +} + +// GetSubnets returns the value of the 'subnets' attribute and +// a flag indicating if the attribute has a value. +// +// The subnets upon which the nodes are created. +func (o *MachinePool) GetSubnets() (value []string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.subnets + } + return +} + +// Taints returns the value of the 'taints' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The taints set on the Nodes created. +func (o *MachinePool) Taints() []*Taint { + if o != nil && o.bitmap_&8192 != 0 { + return o.taints + } + return nil +} + +// GetTaints returns the value of the 'taints' attribute and +// a flag indicating if the attribute has a value. +// +// The taints set on the Nodes created. +func (o *MachinePool) GetTaints() (value []*Taint, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.taints + } + return +} + +// MachinePoolListKind is the name of the type used to represent list of objects of +// type 'machine_pool'. +const MachinePoolListKind = "MachinePoolList" + +// MachinePoolListLinkKind is the name of the type used to represent links to list +// of objects of type 'machine_pool'. +const MachinePoolListLinkKind = "MachinePoolListLink" + +// MachinePoolNilKind is the name of the type used to nil lists of objects of +// type 'machine_pool'. +const MachinePoolListNilKind = "MachinePoolListNil" + +// MachinePoolList is a list of values of the 'machine_pool' type. +type MachinePoolList struct { + href string + link bool + items []*MachinePool +} + +// Kind returns the name of the type of the object. +func (l *MachinePoolList) Kind() string { + if l == nil { + return MachinePoolListNilKind + } + if l.link { + return MachinePoolListLinkKind + } + return MachinePoolListKind +} + +// Link returns true iif this is a link. +func (l *MachinePoolList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *MachinePoolList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *MachinePoolList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *MachinePoolList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *MachinePoolList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *MachinePoolList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *MachinePoolList) SetItems(items []*MachinePool) { + l.items = items +} + +// Items returns the items of the list. +func (l *MachinePoolList) Items() []*MachinePool { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *MachinePoolList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *MachinePoolList) Get(i int) *MachinePool { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *MachinePoolList) Slice() []*MachinePool { + var slice []*MachinePool + if l == nil { + slice = make([]*MachinePool, 0) + } else { + slice = make([]*MachinePool, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *MachinePoolList) Each(f func(item *MachinePool) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *MachinePoolList) Range(f func(index int, item *MachinePool) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/machine_pool_type_json.go b/clientapi/clustersmgmt/v1/machine_pool_type_json.go new file mode 100644 index 00000000..ed9cd4dd --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_pool_type_json.go @@ -0,0 +1,279 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMachinePool writes a value of the 'machine_pool' type to the given writer. +func MarshalMachinePool(object *MachinePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachinePool(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachinePool writes a value of the 'machine_pool' type to the given stream. +func WriteMachinePool(object *MachinePool, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(MachinePoolLinkKind) + } else { + stream.WriteString(MachinePoolKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.aws != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws") + WriteAWSMachinePool(object.aws, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.gcp != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp") + WriteGCPMachinePool(object.gcp, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.autoscaling != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("autoscaling") + WriteMachinePoolAutoscaling(object.autoscaling, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.availabilityZones != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zones") + WriteStringList(object.availabilityZones, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("instance_type") + stream.WriteString(object.instanceType) + count++ + } + present_ = object.bitmap_&256 != 0 && object.labels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("labels") + if object.labels != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.labels)) + i := 0 + for key := range object.labels { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.labels[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("replicas") + stream.WriteInt(object.replicas) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.rootVolume != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("root_volume") + WriteRootVolume(object.rootVolume, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.securityGroupFilters != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("security_group_filters") + WriteMachinePoolSecurityGroupFilterList(object.securityGroupFilters, stream) + count++ + } + present_ = object.bitmap_&4096 != 0 && object.subnets != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnets") + WriteStringList(object.subnets, stream) + count++ + } + present_ = object.bitmap_&8192 != 0 && object.taints != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("taints") + WriteTaintList(object.taints, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalMachinePool reads a value of the 'machine_pool' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalMachinePool(source interface{}) (object *MachinePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadMachinePool(iterator) + err = iterator.Error + return +} + +// ReadMachinePool reads a value of the 'machine_pool' type from the given iterator. +func ReadMachinePool(iterator *jsoniter.Iterator) *MachinePool { + object := &MachinePool{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == MachinePoolLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "aws": + value := ReadAWSMachinePool(iterator) + object.aws = value + object.bitmap_ |= 8 + case "gcp": + value := ReadGCPMachinePool(iterator) + object.gcp = value + object.bitmap_ |= 16 + case "autoscaling": + value := ReadMachinePoolAutoscaling(iterator) + object.autoscaling = value + object.bitmap_ |= 32 + case "availability_zones": + value := ReadStringList(iterator) + object.availabilityZones = value + object.bitmap_ |= 64 + case "instance_type": + value := iterator.ReadString() + object.instanceType = value + object.bitmap_ |= 128 + case "labels": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.labels = value + object.bitmap_ |= 256 + case "replicas": + value := iterator.ReadInt() + object.replicas = value + object.bitmap_ |= 512 + case "root_volume": + value := ReadRootVolume(iterator) + object.rootVolume = value + object.bitmap_ |= 1024 + case "security_group_filters": + value := ReadMachinePoolSecurityGroupFilterList(iterator) + object.securityGroupFilters = value + object.bitmap_ |= 2048 + case "subnets": + value := ReadStringList(iterator) + object.subnets = value + object.bitmap_ |= 4096 + case "taints": + value := ReadTaintList(iterator) + object.taints = value + object.bitmap_ |= 8192 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/machine_type_builder.go b/clientapi/clustersmgmt/v1/machine_type_builder.go new file mode 100644 index 00000000..94423d67 --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_type_builder.go @@ -0,0 +1,254 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachineTypeBuilder contains the data and logic needed to build 'machine_type' objects. +// +// Machine type. +type MachineTypeBuilder struct { + bitmap_ uint32 + id string + href string + cpu *ValueBuilder + architecture ProcessorType + category MachineTypeCategory + cloudProvider *CloudProviderBuilder + genericName string + memory *ValueBuilder + name string + size MachineTypeSize + ccsOnly bool +} + +// NewMachineType creates a new builder of 'machine_type' objects. +func NewMachineType() *MachineTypeBuilder { + return &MachineTypeBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *MachineTypeBuilder) Link(value bool) *MachineTypeBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *MachineTypeBuilder) ID(value string) *MachineTypeBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *MachineTypeBuilder) HREF(value string) *MachineTypeBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *MachineTypeBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CCSOnly sets the value of the 'CCS_only' attribute to the given value. +func (b *MachineTypeBuilder) CCSOnly(value bool) *MachineTypeBuilder { + b.ccsOnly = value + b.bitmap_ |= 8 + return b +} + +// CPU sets the value of the 'CPU' attribute to the given value. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +func (b *MachineTypeBuilder) CPU(value *ValueBuilder) *MachineTypeBuilder { + b.cpu = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + 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_ |= 64 + return b +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +// +// Cloud provider. +func (b *MachineTypeBuilder) CloudProvider(value *CloudProviderBuilder) *MachineTypeBuilder { + b.cloudProvider = value + if value != nil { + b.bitmap_ |= 128 + } else { + 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_ |= 256 + return b +} + +// Memory sets the value of the 'memory' attribute to the given value. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +func (b *MachineTypeBuilder) Memory(value *ValueBuilder) *MachineTypeBuilder { + b.memory = value + if value != nil { + b.bitmap_ |= 512 + } else { + 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_ |= 1024 + return b +} + +// Size sets the value of the 'size' attribute to the given value. +// +// Machine type size. +func (b *MachineTypeBuilder) Size(value MachineTypeSize) *MachineTypeBuilder { + b.size = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *MachineTypeBuilder) Copy(object *MachineType) *MachineTypeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.ccsOnly = object.ccsOnly + if object.cpu != nil { + b.cpu = NewValue().Copy(object.cpu) + } else { + b.cpu = nil + } + b.architecture = object.architecture + b.category = object.category + if object.cloudProvider != nil { + b.cloudProvider = NewCloudProvider().Copy(object.cloudProvider) + } else { + b.cloudProvider = nil + } + b.genericName = object.genericName + if object.memory != nil { + b.memory = NewValue().Copy(object.memory) + } else { + b.memory = nil + } + b.name = object.name + b.size = object.size + return b +} + +// Build creates a 'machine_type' object using the configuration stored in the builder. +func (b *MachineTypeBuilder) Build() (object *MachineType, err error) { + object = new(MachineType) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.ccsOnly = b.ccsOnly + if b.cpu != nil { + object.cpu, err = b.cpu.Build() + if err != nil { + return + } + } + object.architecture = b.architecture + object.category = b.category + if b.cloudProvider != nil { + object.cloudProvider, err = b.cloudProvider.Build() + if err != nil { + return + } + } + object.genericName = b.genericName + if b.memory != nil { + object.memory, err = b.memory.Build() + if err != nil { + return + } + } + object.name = b.name + object.size = b.size + return +} diff --git a/clientapi/clustersmgmt/v1/machine_type_category_list_type_json.go b/clientapi/clustersmgmt/v1/machine_type_category_list_type_json.go new file mode 100644 index 00000000..a1e59099 --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_type_category_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMachineTypeCategoryList writes a list of values of the 'machine_type_category' type to +// the given writer. +func MarshalMachineTypeCategoryList(list []MachineTypeCategory, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachineTypeCategoryList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachineTypeCategoryList writes a list of value of the 'machine_type_category' type to +// the given stream. +func WriteMachineTypeCategoryList(list []MachineTypeCategory, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalMachineTypeCategoryList reads a list of values of the 'machine_type_category' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMachineTypeCategoryList(source interface{}) (items []MachineTypeCategory, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMachineTypeCategoryList(iterator) + err = iterator.Error + return +} + +// ReadMachineTypeCategoryList reads list of values of the ”machine_type_category' type from +// the given iterator. +func ReadMachineTypeCategoryList(iterator *jsoniter.Iterator) []MachineTypeCategory { + list := []MachineTypeCategory{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := MachineTypeCategory(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/machine_type_category_type.go b/clientapi/clustersmgmt/v1/machine_type_category_type.go new file mode 100644 index 00000000..b6ab8970 --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_type_category_type.go @@ -0,0 +1,34 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachineTypeCategory represents the values of the 'machine_type_category' enumerated type. +type MachineTypeCategory string + +const ( + // Accelerated Computing machine type. + MachineTypeCategoryAcceleratedComputing MachineTypeCategory = "accelerated_computing" + // Compute Optimized machine type. + MachineTypeCategoryComputeOptimized MachineTypeCategory = "compute_optimized" + // General Purpose machine type. + MachineTypeCategoryGeneralPurpose MachineTypeCategory = "general_purpose" + // Memory Optimized machine type. + MachineTypeCategoryMemoryOptimized MachineTypeCategory = "memory_optimized" +) diff --git a/clientapi/clustersmgmt/v1/machine_type_list_builder.go b/clientapi/clustersmgmt/v1/machine_type_list_builder.go new file mode 100644 index 00000000..92f03c2b --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_type_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachineTypeListBuilder contains the data and logic needed to build +// 'machine_type' objects. +type MachineTypeListBuilder struct { + items []*MachineTypeBuilder +} + +// NewMachineTypeList creates a new builder of 'machine_type' objects. +func NewMachineTypeList() *MachineTypeListBuilder { + return new(MachineTypeListBuilder) +} + +// Items sets the items of the list. +func (b *MachineTypeListBuilder) Items(values ...*MachineTypeBuilder) *MachineTypeListBuilder { + b.items = make([]*MachineTypeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *MachineTypeListBuilder) 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 *MachineTypeListBuilder) Copy(list *MachineTypeList) *MachineTypeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*MachineTypeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewMachineType().Copy(v) + } + } + return b +} + +// Build creates a list of 'machine_type' objects using the +// configuration stored in the builder. +func (b *MachineTypeListBuilder) Build() (list *MachineTypeList, err error) { + items := make([]*MachineType, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(MachineTypeList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/machine_type_list_type_json.go b/clientapi/clustersmgmt/v1/machine_type_list_type_json.go new file mode 100644 index 00000000..7ce89176 --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_type_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMachineTypeList writes a list of values of the 'machine_type' type to +// the given writer. +func MarshalMachineTypeList(list []*MachineType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachineTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachineTypeList writes a list of value of the 'machine_type' type to +// the given stream. +func WriteMachineTypeList(list []*MachineType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteMachineType(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalMachineTypeList reads a list of values of the 'machine_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMachineTypeList(source interface{}) (items []*MachineType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMachineTypeList(iterator) + err = iterator.Error + return +} + +// ReadMachineTypeList reads list of values of the ”machine_type' type from +// the given iterator. +func ReadMachineTypeList(iterator *jsoniter.Iterator) []*MachineType { + list := []*MachineType{} + for iterator.ReadArray() { + item := ReadMachineType(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/machine_type_size_list_type_json.go b/clientapi/clustersmgmt/v1/machine_type_size_list_type_json.go new file mode 100644 index 00000000..4a101ec4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_type_size_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMachineTypeSizeList writes a list of values of the 'machine_type_size' type to +// the given writer. +func MarshalMachineTypeSizeList(list []MachineTypeSize, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachineTypeSizeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachineTypeSizeList writes a list of value of the 'machine_type_size' type to +// the given stream. +func WriteMachineTypeSizeList(list []MachineTypeSize, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalMachineTypeSizeList reads a list of values of the 'machine_type_size' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalMachineTypeSizeList(source interface{}) (items []MachineTypeSize, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadMachineTypeSizeList(iterator) + err = iterator.Error + return +} + +// ReadMachineTypeSizeList reads list of values of the ”machine_type_size' type from +// the given iterator. +func ReadMachineTypeSizeList(iterator *jsoniter.Iterator) []MachineTypeSize { + list := []MachineTypeSize{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := MachineTypeSize(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/machine_type_size_type.go b/clientapi/clustersmgmt/v1/machine_type_size_type.go new file mode 100644 index 00000000..b235dca6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_type_size_type.go @@ -0,0 +1,32 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachineTypeSize represents the values of the 'machine_type_size' enumerated type. +type MachineTypeSize string + +const ( + // Large machine type (e.g. c5.4xlarge, custom-16-65536) + MachineTypeSizeLarge MachineTypeSize = "large" + // Medium machine type (e.g. r5.2xlarge, custom-8-32768) + MachineTypeSizeMedium MachineTypeSize = "medium" + // Small machine type (e.g. m5.xlarge, custom-4-16384) + MachineTypeSizeSmall MachineTypeSize = "small" +) diff --git a/clientapi/clustersmgmt/v1/machine_type_type.go b/clientapi/clustersmgmt/v1/machine_type_type.go new file mode 100644 index 00000000..950f1917 --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_type_type.go @@ -0,0 +1,463 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// MachineTypeKind is the name of the type used to represent objects +// of type 'machine_type'. +const MachineTypeKind = "MachineType" + +// MachineTypeLinkKind is the name of the type used to represent links +// to objects of type 'machine_type'. +const MachineTypeLinkKind = "MachineTypeLink" + +// MachineTypeNilKind is the name of the type used to nil references +// to objects of type 'machine_type'. +const MachineTypeNilKind = "MachineTypeNil" + +// MachineType represents the values of the 'machine_type' type. +// +// Machine type. +type MachineType struct { + bitmap_ uint32 + id string + href string + cpu *Value + architecture ProcessorType + category MachineTypeCategory + cloudProvider *CloudProvider + genericName string + memory *Value + name string + size MachineTypeSize + ccsOnly bool +} + +// Kind returns the name of the type of the object. +func (o *MachineType) Kind() string { + if o == nil { + return MachineTypeNilKind + } + if o.bitmap_&1 != 0 { + return MachineTypeLinkKind + } + return MachineTypeKind +} + +// Link returns true if this is a link. +func (o *MachineType) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *MachineType) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *MachineType) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *MachineType) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *MachineType) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *MachineType) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CCSOnly returns the value of the 'CCS_only' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// 'true' if the instance type is supported only for CCS clusters, 'false' otherwise. +func (o *MachineType) CCSOnly() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.ccsOnly + } + return false +} + +// GetCCSOnly returns the value of the 'CCS_only' attribute and +// a flag indicating if the attribute has a value. +// +// 'true' if the instance type is supported only for CCS clusters, 'false' otherwise. +func (o *MachineType) GetCCSOnly() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.ccsOnly + } + return +} + +// CPU returns the value of the 'CPU' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The amount of cpu's of the machine type. +func (o *MachineType) CPU() *Value { + if o != nil && o.bitmap_&16 != 0 { + return o.cpu + } + return nil +} + +// GetCPU returns the value of the 'CPU' attribute and +// a flag indicating if the attribute has a value. +// +// The amount of cpu's of the machine type. +func (o *MachineType) GetCPU() (value *Value, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.cpu + } + 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_&64 != 0 { + return o.category + } + return MachineTypeCategory("") +} + +// GetCategory returns the value of the 'category' attribute and +// a flag indicating if the attribute has a value. +// +// The category which the machine type is suitable for. +func (o *MachineType) GetCategory() (value MachineTypeCategory, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.category + } + return +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Link to the cloud provider that the machine type belongs to. +func (o *MachineType) CloudProvider() *CloudProvider { + if o != nil && o.bitmap_&128 != 0 { + return o.cloudProvider + } + return nil +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +// +// Link to the cloud provider that the machine type belongs to. +func (o *MachineType) GetCloudProvider() (value *CloudProvider, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// GenericName returns the value of the 'generic_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Generic name for quota purposes, for example `highmem-4`. +// Cloud provider agnostic - many values are shared between "similar" +// 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_&256 != 0 { + return o.genericName + } + return "" +} + +// GetGenericName returns the value of the 'generic_name' attribute and +// a flag indicating if the attribute has a value. +// +// Generic name for quota purposes, for example `highmem-4`. +// Cloud provider agnostic - many values are shared between "similar" +// 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_&256 != 0 + if ok { + value = o.genericName + } + return +} + +// Memory returns the value of the 'memory' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The amount of memory of the machine type. +func (o *MachineType) Memory() *Value { + if o != nil && o.bitmap_&512 != 0 { + return o.memory + } + return nil +} + +// GetMemory returns the value of the 'memory' attribute and +// a flag indicating if the attribute has a value. +// +// The amount of memory of the machine type. +func (o *MachineType) GetMemory() (value *Value, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.memory + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Human friendly identifier of the machine type, for example `r5.xlarge - Memory Optimized`. +func (o *MachineType) Name() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// 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_&1024 != 0 + if ok { + value = o.name + } + return +} + +// Size returns the value of the 'size' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The size of the machine type. +func (o *MachineType) Size() MachineTypeSize { + if o != nil && o.bitmap_&2048 != 0 { + return o.size + } + return MachineTypeSize("") +} + +// GetSize returns the value of the 'size' attribute and +// a flag indicating if the attribute has a value. +// +// The size of the machine type. +func (o *MachineType) GetSize() (value MachineTypeSize, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.size + } + return +} + +// MachineTypeListKind is the name of the type used to represent list of objects of +// type 'machine_type'. +const MachineTypeListKind = "MachineTypeList" + +// MachineTypeListLinkKind is the name of the type used to represent links to list +// of objects of type 'machine_type'. +const MachineTypeListLinkKind = "MachineTypeListLink" + +// MachineTypeNilKind is the name of the type used to nil lists of objects of +// type 'machine_type'. +const MachineTypeListNilKind = "MachineTypeListNil" + +// MachineTypeList is a list of values of the 'machine_type' type. +type MachineTypeList struct { + href string + link bool + items []*MachineType +} + +// Kind returns the name of the type of the object. +func (l *MachineTypeList) Kind() string { + if l == nil { + return MachineTypeListNilKind + } + if l.link { + return MachineTypeListLinkKind + } + return MachineTypeListKind +} + +// Link returns true iif this is a link. +func (l *MachineTypeList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *MachineTypeList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *MachineTypeList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *MachineTypeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *MachineTypeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *MachineTypeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *MachineTypeList) SetItems(items []*MachineType) { + l.items = items +} + +// Items returns the items of the list. +func (l *MachineTypeList) Items() []*MachineType { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *MachineTypeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *MachineTypeList) Get(i int) *MachineType { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *MachineTypeList) Slice() []*MachineType { + var slice []*MachineType + if l == nil { + slice = make([]*MachineType, 0) + } else { + slice = make([]*MachineType, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *MachineTypeList) Each(f func(item *MachineType) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *MachineTypeList) Range(f func(index int, item *MachineType) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/machine_type_type_json.go b/clientapi/clustersmgmt/v1/machine_type_type_json.go new file mode 100644 index 00000000..104347d7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/machine_type_type_json.go @@ -0,0 +1,227 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMachineType writes a value of the 'machine_type' type to the given writer. +func MarshalMachineType(object *MachineType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteMachineType(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteMachineType writes a value of the 'machine_type' type to the given stream. +func WriteMachineType(object *MachineType, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(MachineTypeLinkKind) + } else { + stream.WriteString(MachineTypeKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ccs_only") + stream.WriteBool(object.ccsOnly) + count++ + } + present_ = object.bitmap_&16 != 0 && object.cpu != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cpu") + WriteValue(object.cpu, 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() + } + stream.WriteObjectField("category") + stream.WriteString(string(object.category)) + count++ + } + present_ = object.bitmap_&128 != 0 && object.cloudProvider != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + WriteCloudProvider(object.cloudProvider, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("generic_name") + stream.WriteString(object.genericName) + count++ + } + present_ = object.bitmap_&512 != 0 && object.memory != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("memory") + WriteValue(object.memory, stream) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("size") + stream.WriteString(string(object.size)) + } + stream.WriteObjectEnd() +} + +// UnmarshalMachineType reads a value of the 'machine_type' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalMachineType(source interface{}) (object *MachineType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadMachineType(iterator) + err = iterator.Error + return +} + +// ReadMachineType reads a value of the 'machine_type' type from the given iterator. +func ReadMachineType(iterator *jsoniter.Iterator) *MachineType { + object := &MachineType{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == MachineTypeLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "ccs_only": + value := iterator.ReadBool() + object.ccsOnly = value + object.bitmap_ |= 8 + case "cpu": + 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_ |= 64 + case "cloud_provider": + value := ReadCloudProvider(iterator) + object.cloudProvider = value + object.bitmap_ |= 128 + case "generic_name": + value := iterator.ReadString() + object.genericName = value + object.bitmap_ |= 256 + case "memory": + value := ReadValue(iterator) + object.memory = value + object.bitmap_ |= 512 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1024 + case "size": + text := iterator.ReadString() + value := MachineTypeSize(text) + object.size = value + object.bitmap_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/managed_service_builder.go b/clientapi/clustersmgmt/v1/managed_service_builder.go new file mode 100644 index 00000000..cedb8e83 --- /dev/null +++ b/clientapi/clustersmgmt/v1/managed_service_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ManagedServiceBuilder contains the data and logic needed to build 'managed_service' objects. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type ManagedServiceBuilder struct { + bitmap_ uint32 + enabled bool +} + +// NewManagedService creates a new builder of 'managed_service' objects. +func NewManagedService() *ManagedServiceBuilder { + return &ManagedServiceBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ManagedServiceBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *ManagedServiceBuilder) Enabled(value bool) *ManagedServiceBuilder { + b.enabled = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ManagedServiceBuilder) Copy(object *ManagedService) *ManagedServiceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.enabled = object.enabled + return b +} + +// Build creates a 'managed_service' object using the configuration stored in the builder. +func (b *ManagedServiceBuilder) Build() (object *ManagedService, err error) { + object = new(ManagedService) + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + return +} diff --git a/clientapi/clustersmgmt/v1/managed_service_list_builder.go b/clientapi/clustersmgmt/v1/managed_service_list_builder.go new file mode 100644 index 00000000..e4a22ce2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/managed_service_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ManagedServiceListBuilder contains the data and logic needed to build +// 'managed_service' objects. +type ManagedServiceListBuilder struct { + items []*ManagedServiceBuilder +} + +// NewManagedServiceList creates a new builder of 'managed_service' objects. +func NewManagedServiceList() *ManagedServiceListBuilder { + return new(ManagedServiceListBuilder) +} + +// Items sets the items of the list. +func (b *ManagedServiceListBuilder) Items(values ...*ManagedServiceBuilder) *ManagedServiceListBuilder { + b.items = make([]*ManagedServiceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ManagedServiceListBuilder) 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 *ManagedServiceListBuilder) Copy(list *ManagedServiceList) *ManagedServiceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ManagedServiceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewManagedService().Copy(v) + } + } + return b +} + +// Build creates a list of 'managed_service' objects using the +// configuration stored in the builder. +func (b *ManagedServiceListBuilder) Build() (list *ManagedServiceList, err error) { + items := make([]*ManagedService, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ManagedServiceList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/managed_service_list_type_json.go b/clientapi/clustersmgmt/v1/managed_service_list_type_json.go new file mode 100644 index 00000000..0b73852d --- /dev/null +++ b/clientapi/clustersmgmt/v1/managed_service_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalManagedServiceList writes a list of values of the 'managed_service' type to +// the given writer. +func MarshalManagedServiceList(list []*ManagedService, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManagedServiceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManagedServiceList writes a list of value of the 'managed_service' type to +// the given stream. +func WriteManagedServiceList(list []*ManagedService, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteManagedService(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalManagedServiceList reads a list of values of the 'managed_service' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalManagedServiceList(source interface{}) (items []*ManagedService, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadManagedServiceList(iterator) + err = iterator.Error + return +} + +// ReadManagedServiceList reads list of values of the ”managed_service' type from +// the given iterator. +func ReadManagedServiceList(iterator *jsoniter.Iterator) []*ManagedService { + list := []*ManagedService{} + for iterator.ReadArray() { + item := ReadManagedService(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/managed_service_type.go b/clientapi/clustersmgmt/v1/managed_service_type.go new file mode 100644 index 00000000..4e30791d --- /dev/null +++ b/clientapi/clustersmgmt/v1/managed_service_type.go @@ -0,0 +1,169 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ManagedService represents the values of the 'managed_service' type. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type ManagedService struct { + bitmap_ uint32 + enabled bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ManagedService) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates whether the cluster belongs to a managed service +// This should only be set by the "Managed Service" service. +// clusters with this set can only be modified by the "Managed Service" service. +func (o *ManagedService) Enabled() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates whether the cluster belongs to a managed service +// This should only be set by the "Managed Service" service. +// clusters with this set can only be modified by the "Managed Service" service. +func (o *ManagedService) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.enabled + } + return +} + +// ManagedServiceListKind is the name of the type used to represent list of objects of +// type 'managed_service'. +const ManagedServiceListKind = "ManagedServiceList" + +// ManagedServiceListLinkKind is the name of the type used to represent links to list +// of objects of type 'managed_service'. +const ManagedServiceListLinkKind = "ManagedServiceListLink" + +// ManagedServiceNilKind is the name of the type used to nil lists of objects of +// type 'managed_service'. +const ManagedServiceListNilKind = "ManagedServiceListNil" + +// ManagedServiceList is a list of values of the 'managed_service' type. +type ManagedServiceList struct { + href string + link bool + items []*ManagedService +} + +// Len returns the length of the list. +func (l *ManagedServiceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ManagedServiceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ManagedServiceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ManagedServiceList) SetItems(items []*ManagedService) { + l.items = items +} + +// Items returns the items of the list. +func (l *ManagedServiceList) Items() []*ManagedService { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ManagedServiceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ManagedServiceList) Get(i int) *ManagedService { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ManagedServiceList) Slice() []*ManagedService { + var slice []*ManagedService + if l == nil { + slice = make([]*ManagedService, 0) + } else { + slice = make([]*ManagedService, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ManagedServiceList) Each(f func(item *ManagedService) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ManagedServiceList) Range(f func(index int, item *ManagedService) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/managed_service_type_json.go b/clientapi/clustersmgmt/v1/managed_service_type_json.go new file mode 100644 index 00000000..7e761307 --- /dev/null +++ b/clientapi/clustersmgmt/v1/managed_service_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalManagedService writes a value of the 'managed_service' type to the given writer. +func MarshalManagedService(object *ManagedService, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManagedService(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManagedService writes a value of the 'managed_service' type to the given stream. +func WriteManagedService(object *ManagedService, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalManagedService reads a value of the 'managed_service' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalManagedService(source interface{}) (object *ManagedService, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadManagedService(iterator) + err = iterator.Error + return +} + +// ReadManagedService reads a value of the 'managed_service' type from the given iterator. +func ReadManagedService(iterator *jsoniter.Iterator) *ManagedService { + object := &ManagedService{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/manifest_builder.go b/clientapi/clustersmgmt/v1/manifest_builder.go new file mode 100644 index 00000000..0f123b7c --- /dev/null +++ b/clientapi/clustersmgmt/v1/manifest_builder.go @@ -0,0 +1,142 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ManifestBuilder contains the data and logic needed to build 'manifest' objects. +// +// Representation of a manifestwork. +type ManifestBuilder struct { + bitmap_ uint32 + id string + href string + creationTimestamp time.Time + liveResource interface{} + spec interface{} + updatedTimestamp time.Time + workloads []interface{} +} + +// NewManifest creates a new builder of 'manifest' objects. +func NewManifest() *ManifestBuilder { + return &ManifestBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ManifestBuilder) Link(value bool) *ManifestBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ManifestBuilder) ID(value string) *ManifestBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ManifestBuilder) HREF(value string) *ManifestBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ManifestBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *ManifestBuilder) CreationTimestamp(value time.Time) *ManifestBuilder { + b.creationTimestamp = value + b.bitmap_ |= 8 + return b +} + +// LiveResource sets the value of the 'live_resource' attribute to the given value. +func (b *ManifestBuilder) LiveResource(value interface{}) *ManifestBuilder { + b.liveResource = value + b.bitmap_ |= 16 + return b +} + +// Spec sets the value of the 'spec' attribute to the given value. +func (b *ManifestBuilder) Spec(value interface{}) *ManifestBuilder { + b.spec = value + b.bitmap_ |= 32 + return b +} + +// UpdatedTimestamp sets the value of the 'updated_timestamp' attribute to the given value. +func (b *ManifestBuilder) UpdatedTimestamp(value time.Time) *ManifestBuilder { + b.updatedTimestamp = value + b.bitmap_ |= 64 + return b +} + +// Workloads sets the value of the 'workloads' attribute to the given values. +func (b *ManifestBuilder) Workloads(values ...interface{}) *ManifestBuilder { + b.workloads = make([]interface{}, len(values)) + copy(b.workloads, values) + b.bitmap_ |= 128 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ManifestBuilder) Copy(object *Manifest) *ManifestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.creationTimestamp = object.creationTimestamp + b.liveResource = object.liveResource + b.spec = object.spec + b.updatedTimestamp = object.updatedTimestamp + if object.workloads != nil { + b.workloads = make([]interface{}, len(object.workloads)) + copy(b.workloads, object.workloads) + } else { + b.workloads = nil + } + return b +} + +// Build creates a 'manifest' object using the configuration stored in the builder. +func (b *ManifestBuilder) Build() (object *Manifest, err error) { + object = new(Manifest) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.creationTimestamp = b.creationTimestamp + object.liveResource = b.liveResource + object.spec = b.spec + object.updatedTimestamp = b.updatedTimestamp + if b.workloads != nil { + object.workloads = make([]interface{}, len(b.workloads)) + copy(object.workloads, b.workloads) + } + return +} diff --git a/clientapi/clustersmgmt/v1/manifest_list_builder.go b/clientapi/clustersmgmt/v1/manifest_list_builder.go new file mode 100644 index 00000000..e73ba45a --- /dev/null +++ b/clientapi/clustersmgmt/v1/manifest_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ManifestListBuilder contains the data and logic needed to build +// 'manifest' objects. +type ManifestListBuilder struct { + items []*ManifestBuilder +} + +// NewManifestList creates a new builder of 'manifest' objects. +func NewManifestList() *ManifestListBuilder { + return new(ManifestListBuilder) +} + +// Items sets the items of the list. +func (b *ManifestListBuilder) Items(values ...*ManifestBuilder) *ManifestListBuilder { + b.items = make([]*ManifestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ManifestListBuilder) 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 *ManifestListBuilder) Copy(list *ManifestList) *ManifestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ManifestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewManifest().Copy(v) + } + } + return b +} + +// Build creates a list of 'manifest' objects using the +// configuration stored in the builder. +func (b *ManifestListBuilder) Build() (list *ManifestList, err error) { + items := make([]*Manifest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ManifestList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/manifest_list_type_json.go b/clientapi/clustersmgmt/v1/manifest_list_type_json.go new file mode 100644 index 00000000..e9a18123 --- /dev/null +++ b/clientapi/clustersmgmt/v1/manifest_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalManifestList writes a list of values of the 'manifest' type to +// the given writer. +func MarshalManifestList(list []*Manifest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManifestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManifestList writes a list of value of the 'manifest' type to +// the given stream. +func WriteManifestList(list []*Manifest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteManifest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalManifestList reads a list of values of the 'manifest' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalManifestList(source interface{}) (items []*Manifest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadManifestList(iterator) + err = iterator.Error + return +} + +// ReadManifestList reads list of values of the ”manifest' type from +// the given iterator. +func ReadManifestList(iterator *jsoniter.Iterator) []*Manifest { + list := []*Manifest{} + for iterator.ReadArray() { + item := ReadManifest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/manifest_type.go b/clientapi/clustersmgmt/v1/manifest_type.go new file mode 100644 index 00000000..9dc12ac6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/manifest_type.go @@ -0,0 +1,367 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ManifestKind is the name of the type used to represent objects +// of type 'manifest'. +const ManifestKind = "Manifest" + +// ManifestLinkKind is the name of the type used to represent links +// to objects of type 'manifest'. +const ManifestLinkKind = "ManifestLink" + +// ManifestNilKind is the name of the type used to nil references +// to objects of type 'manifest'. +const ManifestNilKind = "ManifestNil" + +// Manifest represents the values of the 'manifest' type. +// +// Representation of a manifestwork. +type Manifest struct { + bitmap_ uint32 + id string + href string + creationTimestamp time.Time + liveResource interface{} + spec interface{} + updatedTimestamp time.Time + workloads []interface{} +} + +// Kind returns the name of the type of the object. +func (o *Manifest) Kind() string { + if o == nil { + return ManifestNilKind + } + if o.bitmap_&1 != 0 { + return ManifestLinkKind + } + return ManifestKind +} + +// Link returns true if this is a link. +func (o *Manifest) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Manifest) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Manifest) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Manifest) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Manifest) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Manifest) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the manifest got created in OCM database. +func (o *Manifest) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the manifest got created in OCM database. +func (o *Manifest) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// LiveResource returns the value of the 'live_resource' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Transient value to represent the underlying live resource. +func (o *Manifest) LiveResource() interface{} { + if o != nil && o.bitmap_&16 != 0 { + return o.liveResource + } + return nil +} + +// GetLiveResource returns the value of the 'live_resource' attribute and +// a flag indicating if the attribute has a value. +// +// Transient value to represent the underlying live resource. +func (o *Manifest) GetLiveResource() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.liveResource + } + return +} + +// Spec returns the value of the 'spec' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Spec of Manifest Work object from open cluster management +// For more info please check https://open-cluster-management.io/concepts/manifestwork. +func (o *Manifest) Spec() interface{} { + if o != nil && o.bitmap_&32 != 0 { + return o.spec + } + return nil +} + +// GetSpec returns the value of the 'spec' attribute and +// a flag indicating if the attribute has a value. +// +// Spec of Manifest Work object from open cluster management +// For more info please check https://open-cluster-management.io/concepts/manifestwork. +func (o *Manifest) GetSpec() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.spec + } + return +} + +// UpdatedTimestamp returns the value of the 'updated_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the manifest got updated in OCM database. +func (o *Manifest) UpdatedTimestamp() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.updatedTimestamp + } + return time.Time{} +} + +// GetUpdatedTimestamp returns the value of the 'updated_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the manifest got updated in OCM database. +func (o *Manifest) GetUpdatedTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.updatedTimestamp + } + return +} + +// Workloads returns the value of the 'workloads' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of k8s objects to deploy on a hosted cluster. +func (o *Manifest) Workloads() []interface{} { + if o != nil && o.bitmap_&128 != 0 { + return o.workloads + } + return nil +} + +// GetWorkloads returns the value of the 'workloads' attribute and +// a flag indicating if the attribute has a value. +// +// List of k8s objects to deploy on a hosted cluster. +func (o *Manifest) GetWorkloads() (value []interface{}, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.workloads + } + return +} + +// ManifestListKind is the name of the type used to represent list of objects of +// type 'manifest'. +const ManifestListKind = "ManifestList" + +// ManifestListLinkKind is the name of the type used to represent links to list +// of objects of type 'manifest'. +const ManifestListLinkKind = "ManifestListLink" + +// ManifestNilKind is the name of the type used to nil lists of objects of +// type 'manifest'. +const ManifestListNilKind = "ManifestListNil" + +// ManifestList is a list of values of the 'manifest' type. +type ManifestList struct { + href string + link bool + items []*Manifest +} + +// Kind returns the name of the type of the object. +func (l *ManifestList) Kind() string { + if l == nil { + return ManifestListNilKind + } + if l.link { + return ManifestListLinkKind + } + return ManifestListKind +} + +// Link returns true iif this is a link. +func (l *ManifestList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ManifestList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ManifestList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ManifestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ManifestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ManifestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ManifestList) SetItems(items []*Manifest) { + l.items = items +} + +// Items returns the items of the list. +func (l *ManifestList) Items() []*Manifest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ManifestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ManifestList) Get(i int) *Manifest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ManifestList) Slice() []*Manifest { + var slice []*Manifest + if l == nil { + slice = make([]*Manifest, 0) + } else { + slice = make([]*Manifest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ManifestList) Each(f func(item *Manifest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ManifestList) Range(f func(index int, item *Manifest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/manifest_type_json.go b/clientapi/clustersmgmt/v1/manifest_type_json.go new file mode 100644 index 00000000..2b5df450 --- /dev/null +++ b/clientapi/clustersmgmt/v1/manifest_type_json.go @@ -0,0 +1,183 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalManifest writes a value of the 'manifest' type to the given writer. +func MarshalManifest(object *Manifest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManifest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManifest writes a value of the 'manifest' type to the given stream. +func WriteManifest(object *Manifest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ManifestLinkKind) + } else { + stream.WriteString(ManifestKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("live_resource") + stream.WriteVal(object.liveResource) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("spec") + stream.WriteVal(object.spec) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_timestamp") + stream.WriteString((object.updatedTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 && object.workloads != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("workloads") + WriteInterfaceList(object.workloads, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalManifest reads a value of the 'manifest' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalManifest(source interface{}) (object *Manifest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadManifest(iterator) + err = iterator.Error + return +} + +// ReadManifest reads a value of the 'manifest' type from the given iterator. +func ReadManifest(iterator *jsoniter.Iterator) *Manifest { + object := &Manifest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ManifestLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 8 + case "live_resource": + var value interface{} + iterator.ReadVal(&value) + object.liveResource = value + object.bitmap_ |= 16 + case "spec": + var value interface{} + iterator.ReadVal(&value) + object.spec = value + object.bitmap_ |= 32 + case "updated_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.updatedTimestamp = value + object.bitmap_ |= 64 + case "workloads": + value := ReadInterfaceList(iterator) + object.workloads = value + object.bitmap_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/metadata_reader.go b/clientapi/clustersmgmt/v1/metadata_reader.go new file mode 100644 index 00000000..c6cbf775 --- /dev/null +++ b/clientapi/clustersmgmt/v1/metadata_reader.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMetadata writes a value of the metadata type to the given target, which +// can be a writer or a JSON encoder. +func MarshalMetadata(object *Metadata, writer io.Writer) error { + stream := helpers.NewStream(writer) + writeMetadata(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} +func writeMetadata(object *Metadata, stream *jsoniter.Stream) { + stream.WriteObjectStart() + if object.bitmap_&1 != 0 { + stream.WriteObjectField("server_version") + stream.WriteString(object.serverVersion) + } + stream.WriteObjectEnd() +} + +// UnmarshalMetadata reads a value of the metadata type from the given source, which +// which can be a reader, a slice of byte or a string. +func UnmarshalMetadata(source interface{}) (object *Metadata, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = readMetadata(iterator) + err = iterator.Error + return +} +func readMetadata(iterator *jsoniter.Iterator) *Metadata { + object := &Metadata{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "server_version": + object.serverVersion = iterator.ReadString() + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/metadata_type.go b/clientapi/clustersmgmt/v1/metadata_type.go new file mode 100644 index 00000000..1c6ff5d7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/metadata_type.go @@ -0,0 +1,44 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// Metadata contains the version metadata. +type Metadata struct { + bitmap_ uint32 + serverVersion string +} + +// ServerVersion returns the version of the server. +func (m *Metadata) ServerVersion() string { + if m != nil && m.bitmap_&1 != 0 { + return m.serverVersion + } + return "" +} + +// GetServerVersion returns the value of the server version and a flag indicating if +// the attribute has a value. +func (m *Metadata) GetServerVersion() (value string, ok bool) { + ok = m != nil && m.bitmap_&1 != 0 + if ok { + value = m.serverVersion + } + return +} diff --git a/clientapi/clustersmgmt/v1/namespace_ownership_policy_list_type_json.go b/clientapi/clustersmgmt/v1/namespace_ownership_policy_list_type_json.go new file mode 100644 index 00000000..f6da60c4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/namespace_ownership_policy_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNamespaceOwnershipPolicyList writes a list of values of the 'namespace_ownership_policy' type to +// the given writer. +func MarshalNamespaceOwnershipPolicyList(list []NamespaceOwnershipPolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNamespaceOwnershipPolicyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNamespaceOwnershipPolicyList writes a list of value of the 'namespace_ownership_policy' type to +// the given stream. +func WriteNamespaceOwnershipPolicyList(list []NamespaceOwnershipPolicy, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalNamespaceOwnershipPolicyList reads a list of values of the 'namespace_ownership_policy' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNamespaceOwnershipPolicyList(source interface{}) (items []NamespaceOwnershipPolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNamespaceOwnershipPolicyList(iterator) + err = iterator.Error + return +} + +// ReadNamespaceOwnershipPolicyList reads list of values of the ”namespace_ownership_policy' type from +// the given iterator. +func ReadNamespaceOwnershipPolicyList(iterator *jsoniter.Iterator) []NamespaceOwnershipPolicy { + list := []NamespaceOwnershipPolicy{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := NamespaceOwnershipPolicy(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/namespace_ownership_policy_type.go b/clientapi/clustersmgmt/v1/namespace_ownership_policy_type.go new file mode 100644 index 00000000..585edb48 --- /dev/null +++ b/clientapi/clustersmgmt/v1/namespace_ownership_policy_type.go @@ -0,0 +1,30 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NamespaceOwnershipPolicy represents the values of the 'namespace_ownership_policy' enumerated type. +type NamespaceOwnershipPolicy string + +const ( + // InterNamespaceAllowed. + NamespaceOwnershipPolicyInterNamespaceAllowed NamespaceOwnershipPolicy = "InterNamespaceAllowed" + // Strict. + NamespaceOwnershipPolicyStrict NamespaceOwnershipPolicy = "Strict" +) diff --git a/clientapi/clustersmgmt/v1/network_builder.go b/clientapi/clustersmgmt/v1/network_builder.go new file mode 100644 index 00000000..6de8f2ac --- /dev/null +++ b/clientapi/clustersmgmt/v1/network_builder.go @@ -0,0 +1,103 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NetworkBuilder contains the data and logic needed to build 'network' objects. +// +// Network configuration of a cluster. +type NetworkBuilder struct { + bitmap_ uint32 + hostPrefix int + machineCIDR string + podCIDR string + serviceCIDR string + type_ string +} + +// NewNetwork creates a new builder of 'network' objects. +func NewNetwork() *NetworkBuilder { + return &NetworkBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NetworkBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// HostPrefix sets the value of the 'host_prefix' attribute to the given value. +func (b *NetworkBuilder) HostPrefix(value int) *NetworkBuilder { + b.hostPrefix = value + b.bitmap_ |= 1 + return b +} + +// MachineCIDR sets the value of the 'machine_CIDR' attribute to the given value. +func (b *NetworkBuilder) MachineCIDR(value string) *NetworkBuilder { + b.machineCIDR = value + b.bitmap_ |= 2 + return b +} + +// PodCIDR sets the value of the 'pod_CIDR' attribute to the given value. +func (b *NetworkBuilder) PodCIDR(value string) *NetworkBuilder { + b.podCIDR = value + b.bitmap_ |= 4 + return b +} + +// ServiceCIDR sets the value of the 'service_CIDR' attribute to the given value. +func (b *NetworkBuilder) ServiceCIDR(value string) *NetworkBuilder { + b.serviceCIDR = value + b.bitmap_ |= 8 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *NetworkBuilder) Type(value string) *NetworkBuilder { + b.type_ = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NetworkBuilder) Copy(object *Network) *NetworkBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.hostPrefix = object.hostPrefix + b.machineCIDR = object.machineCIDR + b.podCIDR = object.podCIDR + b.serviceCIDR = object.serviceCIDR + b.type_ = object.type_ + return b +} + +// Build creates a 'network' object using the configuration stored in the builder. +func (b *NetworkBuilder) Build() (object *Network, err error) { + object = new(Network) + object.bitmap_ = b.bitmap_ + object.hostPrefix = b.hostPrefix + object.machineCIDR = b.machineCIDR + object.podCIDR = b.podCIDR + object.serviceCIDR = b.serviceCIDR + object.type_ = b.type_ + return +} diff --git a/clientapi/clustersmgmt/v1/network_list_builder.go b/clientapi/clustersmgmt/v1/network_list_builder.go new file mode 100644 index 00000000..4a7e8eb1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/network_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NetworkListBuilder contains the data and logic needed to build +// 'network' objects. +type NetworkListBuilder struct { + items []*NetworkBuilder +} + +// NewNetworkList creates a new builder of 'network' objects. +func NewNetworkList() *NetworkListBuilder { + return new(NetworkListBuilder) +} + +// Items sets the items of the list. +func (b *NetworkListBuilder) Items(values ...*NetworkBuilder) *NetworkListBuilder { + b.items = make([]*NetworkBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NetworkListBuilder) 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 *NetworkListBuilder) Copy(list *NetworkList) *NetworkListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NetworkBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNetwork().Copy(v) + } + } + return b +} + +// Build creates a list of 'network' objects using the +// configuration stored in the builder. +func (b *NetworkListBuilder) Build() (list *NetworkList, err error) { + items := make([]*Network, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NetworkList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/network_list_type_json.go b/clientapi/clustersmgmt/v1/network_list_type_json.go new file mode 100644 index 00000000..aecafc29 --- /dev/null +++ b/clientapi/clustersmgmt/v1/network_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNetworkList writes a list of values of the 'network' type to +// the given writer. +func MarshalNetworkList(list []*Network, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNetworkList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNetworkList writes a list of value of the 'network' type to +// the given stream. +func WriteNetworkList(list []*Network, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNetwork(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNetworkList reads a list of values of the 'network' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNetworkList(source interface{}) (items []*Network, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNetworkList(iterator) + err = iterator.Error + return +} + +// ReadNetworkList reads list of values of the ”network' type from +// the given iterator. +func ReadNetworkList(iterator *jsoniter.Iterator) []*Network { + list := []*Network{} + for iterator.ReadArray() { + item := ReadNetwork(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/network_type.go b/clientapi/clustersmgmt/v1/network_type.go new file mode 100644 index 00000000..9d2afe7c --- /dev/null +++ b/clientapi/clustersmgmt/v1/network_type.go @@ -0,0 +1,261 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// Network represents the values of the 'network' type. +// +// Network configuration of a cluster. +type Network struct { + bitmap_ uint32 + hostPrefix int + machineCIDR string + podCIDR string + serviceCIDR string + type_ string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Network) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// HostPrefix returns the value of the 'host_prefix' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Network host prefix which is defaulted to `23` if not specified. +func (o *Network) HostPrefix() int { + if o != nil && o.bitmap_&1 != 0 { + return o.hostPrefix + } + return 0 +} + +// GetHostPrefix returns the value of the 'host_prefix' attribute and +// a flag indicating if the attribute has a value. +// +// Network host prefix which is defaulted to `23` if not specified. +func (o *Network) GetHostPrefix() (value int, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.hostPrefix + } + return +} + +// MachineCIDR returns the value of the 'machine_CIDR' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// IP address block from which to assign machine IP addresses, for example `10.0.0.0/16`. +func (o *Network) MachineCIDR() string { + if o != nil && o.bitmap_&2 != 0 { + return o.machineCIDR + } + return "" +} + +// GetMachineCIDR returns the value of the 'machine_CIDR' attribute and +// a flag indicating if the attribute has a value. +// +// IP address block from which to assign machine IP addresses, for example `10.0.0.0/16`. +func (o *Network) GetMachineCIDR() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.machineCIDR + } + return +} + +// PodCIDR returns the value of the 'pod_CIDR' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// IP address block from which to assign pod IP addresses, for example `10.128.0.0/14`. +func (o *Network) PodCIDR() string { + if o != nil && o.bitmap_&4 != 0 { + return o.podCIDR + } + return "" +} + +// GetPodCIDR returns the value of the 'pod_CIDR' attribute and +// a flag indicating if the attribute has a value. +// +// IP address block from which to assign pod IP addresses, for example `10.128.0.0/14`. +func (o *Network) GetPodCIDR() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.podCIDR + } + return +} + +// ServiceCIDR returns the value of the 'service_CIDR' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// IP address block from which to assign service IP addresses, for example `172.30.0.0/16`. +func (o *Network) ServiceCIDR() string { + if o != nil && o.bitmap_&8 != 0 { + return o.serviceCIDR + } + return "" +} + +// GetServiceCIDR returns the value of the 'service_CIDR' attribute and +// a flag indicating if the attribute has a value. +// +// IP address block from which to assign service IP addresses, for example `172.30.0.0/16`. +func (o *Network) GetServiceCIDR() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.serviceCIDR + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The main controller responsible for rendering the core networking components. +func (o *Network) Type() string { + if o != nil && o.bitmap_&16 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// The main controller responsible for rendering the core networking components. +func (o *Network) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.type_ + } + return +} + +// NetworkListKind is the name of the type used to represent list of objects of +// type 'network'. +const NetworkListKind = "NetworkList" + +// NetworkListLinkKind is the name of the type used to represent links to list +// of objects of type 'network'. +const NetworkListLinkKind = "NetworkListLink" + +// NetworkNilKind is the name of the type used to nil lists of objects of +// type 'network'. +const NetworkListNilKind = "NetworkListNil" + +// NetworkList is a list of values of the 'network' type. +type NetworkList struct { + href string + link bool + items []*Network +} + +// Len returns the length of the list. +func (l *NetworkList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NetworkList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NetworkList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NetworkList) SetItems(items []*Network) { + l.items = items +} + +// Items returns the items of the list. +func (l *NetworkList) Items() []*Network { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NetworkList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NetworkList) Get(i int) *Network { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NetworkList) Slice() []*Network { + var slice []*Network + if l == nil { + slice = make([]*Network, 0) + } else { + slice = make([]*Network, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NetworkList) Each(f func(item *Network) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NetworkList) Range(f func(index int, item *Network) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/network_type_json.go b/clientapi/clustersmgmt/v1/network_type_json.go new file mode 100644 index 00000000..169d11b9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/network_type_json.go @@ -0,0 +1,138 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNetwork writes a value of the 'network' type to the given writer. +func MarshalNetwork(object *Network, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNetwork(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNetwork writes a value of the 'network' type to the given stream. +func WriteNetwork(object *Network, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("host_prefix") + stream.WriteInt(object.hostPrefix) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("machine_cidr") + stream.WriteString(object.machineCIDR) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("pod_cidr") + stream.WriteString(object.podCIDR) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_cidr") + stream.WriteString(object.serviceCIDR) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalNetwork reads a value of the 'network' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNetwork(source interface{}) (object *Network, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNetwork(iterator) + err = iterator.Error + return +} + +// ReadNetwork reads a value of the 'network' type from the given iterator. +func ReadNetwork(iterator *jsoniter.Iterator) *Network { + object := &Network{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "host_prefix": + value := iterator.ReadInt() + object.hostPrefix = value + object.bitmap_ |= 1 + case "machine_cidr": + value := iterator.ReadString() + object.machineCIDR = value + object.bitmap_ |= 2 + case "pod_cidr": + value := iterator.ReadString() + object.podCIDR = value + object.bitmap_ |= 4 + case "service_cidr": + value := iterator.ReadString() + object.serviceCIDR = value + object.bitmap_ |= 8 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/network_verification_builder.go b/clientapi/clustersmgmt/v1/network_verification_builder.go new file mode 100644 index 00000000..63dc690f --- /dev/null +++ b/clientapi/clustersmgmt/v1/network_verification_builder.go @@ -0,0 +1,134 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NetworkVerificationBuilder contains the data and logic needed to build 'network_verification' objects. +type NetworkVerificationBuilder struct { + bitmap_ uint32 + cloudProviderData *CloudProviderDataBuilder + clusterId string + items []*SubnetNetworkVerificationBuilder + platform Platform + total int +} + +// NewNetworkVerification creates a new builder of 'network_verification' objects. +func NewNetworkVerification() *NetworkVerificationBuilder { + return &NetworkVerificationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NetworkVerificationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// CloudProviderData sets the value of the 'cloud_provider_data' attribute to the given value. +// +// Description of a cloud provider data used for cloud provider inquiries. +func (b *NetworkVerificationBuilder) CloudProviderData(value *CloudProviderDataBuilder) *NetworkVerificationBuilder { + b.cloudProviderData = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// ClusterId sets the value of the 'cluster_id' attribute to the given value. +func (b *NetworkVerificationBuilder) ClusterId(value string) *NetworkVerificationBuilder { + b.clusterId = value + b.bitmap_ |= 2 + return b +} + +// Items sets the value of the 'items' attribute to the given values. +func (b *NetworkVerificationBuilder) Items(values ...*SubnetNetworkVerificationBuilder) *NetworkVerificationBuilder { + b.items = make([]*SubnetNetworkVerificationBuilder, len(values)) + copy(b.items, values) + b.bitmap_ |= 4 + return b +} + +// Platform sets the value of the 'platform' attribute to the given value. +// +// Representation of an platform type field. +func (b *NetworkVerificationBuilder) Platform(value Platform) *NetworkVerificationBuilder { + b.platform = value + b.bitmap_ |= 8 + return b +} + +// Total sets the value of the 'total' attribute to the given value. +func (b *NetworkVerificationBuilder) Total(value int) *NetworkVerificationBuilder { + b.total = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NetworkVerificationBuilder) Copy(object *NetworkVerification) *NetworkVerificationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.cloudProviderData != nil { + b.cloudProviderData = NewCloudProviderData().Copy(object.cloudProviderData) + } else { + b.cloudProviderData = nil + } + b.clusterId = object.clusterId + if object.items != nil { + b.items = make([]*SubnetNetworkVerificationBuilder, len(object.items)) + for i, v := range object.items { + b.items[i] = NewSubnetNetworkVerification().Copy(v) + } + } else { + b.items = nil + } + b.platform = object.platform + b.total = object.total + return b +} + +// Build creates a 'network_verification' object using the configuration stored in the builder. +func (b *NetworkVerificationBuilder) Build() (object *NetworkVerification, err error) { + object = new(NetworkVerification) + object.bitmap_ = b.bitmap_ + if b.cloudProviderData != nil { + object.cloudProviderData, err = b.cloudProviderData.Build() + if err != nil { + return + } + } + object.clusterId = b.clusterId + if b.items != nil { + object.items = make([]*SubnetNetworkVerification, len(b.items)) + for i, v := range b.items { + object.items[i], err = v.Build() + if err != nil { + return + } + } + } + object.platform = b.platform + object.total = b.total + return +} diff --git a/clientapi/clustersmgmt/v1/network_verification_list_builder.go b/clientapi/clustersmgmt/v1/network_verification_list_builder.go new file mode 100644 index 00000000..2f884421 --- /dev/null +++ b/clientapi/clustersmgmt/v1/network_verification_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NetworkVerificationListBuilder contains the data and logic needed to build +// 'network_verification' objects. +type NetworkVerificationListBuilder struct { + items []*NetworkVerificationBuilder +} + +// NewNetworkVerificationList creates a new builder of 'network_verification' objects. +func NewNetworkVerificationList() *NetworkVerificationListBuilder { + return new(NetworkVerificationListBuilder) +} + +// Items sets the items of the list. +func (b *NetworkVerificationListBuilder) Items(values ...*NetworkVerificationBuilder) *NetworkVerificationListBuilder { + b.items = make([]*NetworkVerificationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NetworkVerificationListBuilder) 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 *NetworkVerificationListBuilder) Copy(list *NetworkVerificationList) *NetworkVerificationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NetworkVerificationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNetworkVerification().Copy(v) + } + } + return b +} + +// Build creates a list of 'network_verification' objects using the +// configuration stored in the builder. +func (b *NetworkVerificationListBuilder) Build() (list *NetworkVerificationList, err error) { + items := make([]*NetworkVerification, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NetworkVerificationList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/network_verification_list_type_json.go b/clientapi/clustersmgmt/v1/network_verification_list_type_json.go new file mode 100644 index 00000000..20c60559 --- /dev/null +++ b/clientapi/clustersmgmt/v1/network_verification_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNetworkVerificationList writes a list of values of the 'network_verification' type to +// the given writer. +func MarshalNetworkVerificationList(list []*NetworkVerification, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNetworkVerificationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNetworkVerificationList writes a list of value of the 'network_verification' type to +// the given stream. +func WriteNetworkVerificationList(list []*NetworkVerification, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNetworkVerification(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNetworkVerificationList reads a list of values of the 'network_verification' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNetworkVerificationList(source interface{}) (items []*NetworkVerification, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNetworkVerificationList(iterator) + err = iterator.Error + return +} + +// ReadNetworkVerificationList reads list of values of the ”network_verification' type from +// the given iterator. +func ReadNetworkVerificationList(iterator *jsoniter.Iterator) []*NetworkVerification { + list := []*NetworkVerification{} + for iterator.ReadArray() { + item := ReadNetworkVerification(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/network_verification_type.go b/clientapi/clustersmgmt/v1/network_verification_type.go new file mode 100644 index 00000000..d8ed8269 --- /dev/null +++ b/clientapi/clustersmgmt/v1/network_verification_type.go @@ -0,0 +1,259 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NetworkVerification represents the values of the 'network_verification' type. +type NetworkVerification struct { + bitmap_ uint32 + cloudProviderData *CloudProviderData + clusterId string + items []*SubnetNetworkVerification + platform Platform + total int +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NetworkVerification) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// CloudProviderData returns the value of the 'cloud_provider_data' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cloud provider data to execute the network verification. +func (o *NetworkVerification) CloudProviderData() *CloudProviderData { + if o != nil && o.bitmap_&1 != 0 { + return o.cloudProviderData + } + return nil +} + +// GetCloudProviderData returns the value of the 'cloud_provider_data' attribute and +// a flag indicating if the attribute has a value. +// +// Cloud provider data to execute the network verification. +func (o *NetworkVerification) GetCloudProviderData() (value *CloudProviderData, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.cloudProviderData + } + return +} + +// ClusterId returns the value of the 'cluster_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster ID needed to execute the network verification. +func (o *NetworkVerification) ClusterId() string { + if o != nil && o.bitmap_&2 != 0 { + return o.clusterId + } + return "" +} + +// GetClusterId returns the value of the 'cluster_id' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster ID needed to execute the network verification. +func (o *NetworkVerification) GetClusterId() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.clusterId + } + return +} + +// Items returns the value of the 'items' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details about each subnet network verification. +func (o *NetworkVerification) Items() []*SubnetNetworkVerification { + if o != nil && o.bitmap_&4 != 0 { + return o.items + } + return nil +} + +// GetItems returns the value of the 'items' attribute and +// a flag indicating if the attribute has a value. +// +// Details about each subnet network verification. +func (o *NetworkVerification) GetItems() (value []*SubnetNetworkVerification, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.items + } + return +} + +// Platform returns the value of the 'platform' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Platform needed to execute the network verification. +func (o *NetworkVerification) Platform() Platform { + if o != nil && o.bitmap_&8 != 0 { + return o.platform + } + return Platform("") +} + +// GetPlatform returns the value of the 'platform' attribute and +// a flag indicating if the attribute has a value. +// +// Platform needed to execute the network verification. +func (o *NetworkVerification) GetPlatform() (value Platform, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.platform + } + return +} + +// Total returns the value of the 'total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Amount of network verifier executions started. +func (o *NetworkVerification) Total() int { + if o != nil && o.bitmap_&16 != 0 { + return o.total + } + return 0 +} + +// GetTotal returns the value of the 'total' attribute and +// a flag indicating if the attribute has a value. +// +// Amount of network verifier executions started. +func (o *NetworkVerification) GetTotal() (value int, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.total + } + return +} + +// NetworkVerificationListKind is the name of the type used to represent list of objects of +// type 'network_verification'. +const NetworkVerificationListKind = "NetworkVerificationList" + +// NetworkVerificationListLinkKind is the name of the type used to represent links to list +// of objects of type 'network_verification'. +const NetworkVerificationListLinkKind = "NetworkVerificationListLink" + +// NetworkVerificationNilKind is the name of the type used to nil lists of objects of +// type 'network_verification'. +const NetworkVerificationListNilKind = "NetworkVerificationListNil" + +// NetworkVerificationList is a list of values of the 'network_verification' type. +type NetworkVerificationList struct { + href string + link bool + items []*NetworkVerification +} + +// Len returns the length of the list. +func (l *NetworkVerificationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NetworkVerificationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NetworkVerificationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NetworkVerificationList) SetItems(items []*NetworkVerification) { + l.items = items +} + +// Items returns the items of the list. +func (l *NetworkVerificationList) Items() []*NetworkVerification { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NetworkVerificationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NetworkVerificationList) Get(i int) *NetworkVerification { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NetworkVerificationList) Slice() []*NetworkVerification { + var slice []*NetworkVerification + if l == nil { + slice = make([]*NetworkVerification, 0) + } else { + slice = make([]*NetworkVerification, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NetworkVerificationList) Each(f func(item *NetworkVerification) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NetworkVerificationList) Range(f func(index int, item *NetworkVerification) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/network_verification_type_json.go b/clientapi/clustersmgmt/v1/network_verification_type_json.go new file mode 100644 index 00000000..5fbc6e18 --- /dev/null +++ b/clientapi/clustersmgmt/v1/network_verification_type_json.go @@ -0,0 +1,139 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNetworkVerification writes a value of the 'network_verification' type to the given writer. +func MarshalNetworkVerification(object *NetworkVerification, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNetworkVerification(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNetworkVerification writes a value of the 'network_verification' type to the given stream. +func WriteNetworkVerification(object *NetworkVerification, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.cloudProviderData != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider_data") + WriteCloudProviderData(object.cloudProviderData, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterId) + count++ + } + present_ = object.bitmap_&4 != 0 && object.items != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("items") + WriteSubnetNetworkVerificationList(object.items, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("platform") + stream.WriteString(string(object.platform)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("total") + stream.WriteInt(object.total) + } + stream.WriteObjectEnd() +} + +// UnmarshalNetworkVerification reads a value of the 'network_verification' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNetworkVerification(source interface{}) (object *NetworkVerification, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNetworkVerification(iterator) + err = iterator.Error + return +} + +// ReadNetworkVerification reads a value of the 'network_verification' type from the given iterator. +func ReadNetworkVerification(iterator *jsoniter.Iterator) *NetworkVerification { + object := &NetworkVerification{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "cloud_provider_data": + value := ReadCloudProviderData(iterator) + object.cloudProviderData = value + object.bitmap_ |= 1 + case "cluster_id": + value := iterator.ReadString() + object.clusterId = value + object.bitmap_ |= 2 + case "items": + value := ReadSubnetNetworkVerificationList(iterator) + object.items = value + object.bitmap_ |= 4 + case "platform": + text := iterator.ReadString() + value := Platform(text) + object.platform = value + object.bitmap_ |= 8 + case "total": + value := iterator.ReadInt() + object.total = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/node_info_builder.go b/clientapi/clustersmgmt/v1/node_info_builder.go new file mode 100644 index 00000000..dd36e123 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_info_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodeInfoBuilder contains the data and logic needed to build 'node_info' objects. +// +// Provides information about a node from specific type in the cluster. +type NodeInfoBuilder struct { + bitmap_ uint32 + amount int + type_ NodeType +} + +// NewNodeInfo creates a new builder of 'node_info' objects. +func NewNodeInfo() *NodeInfoBuilder { + return &NodeInfoBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NodeInfoBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Amount sets the value of the 'amount' attribute to the given value. +func (b *NodeInfoBuilder) Amount(value int) *NodeInfoBuilder { + b.amount = value + b.bitmap_ |= 1 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +// +// Type of node received via telemetry. +func (b *NodeInfoBuilder) Type(value NodeType) *NodeInfoBuilder { + b.type_ = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NodeInfoBuilder) Copy(object *NodeInfo) *NodeInfoBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.amount = object.amount + b.type_ = object.type_ + return b +} + +// Build creates a 'node_info' object using the configuration stored in the builder. +func (b *NodeInfoBuilder) Build() (object *NodeInfo, err error) { + object = new(NodeInfo) + object.bitmap_ = b.bitmap_ + object.amount = b.amount + object.type_ = b.type_ + return +} diff --git a/clientapi/clustersmgmt/v1/node_info_list_builder.go b/clientapi/clustersmgmt/v1/node_info_list_builder.go new file mode 100644 index 00000000..7bc12d9a --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_info_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodeInfoListBuilder contains the data and logic needed to build +// 'node_info' objects. +type NodeInfoListBuilder struct { + items []*NodeInfoBuilder +} + +// NewNodeInfoList creates a new builder of 'node_info' objects. +func NewNodeInfoList() *NodeInfoListBuilder { + return new(NodeInfoListBuilder) +} + +// Items sets the items of the list. +func (b *NodeInfoListBuilder) Items(values ...*NodeInfoBuilder) *NodeInfoListBuilder { + b.items = make([]*NodeInfoBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NodeInfoListBuilder) 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 *NodeInfoListBuilder) Copy(list *NodeInfoList) *NodeInfoListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NodeInfoBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNodeInfo().Copy(v) + } + } + return b +} + +// Build creates a list of 'node_info' objects using the +// configuration stored in the builder. +func (b *NodeInfoListBuilder) Build() (list *NodeInfoList, err error) { + items := make([]*NodeInfo, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NodeInfoList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/node_info_list_type_json.go b/clientapi/clustersmgmt/v1/node_info_list_type_json.go new file mode 100644 index 00000000..db2d1922 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_info_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodeInfoList writes a list of values of the 'node_info' type to +// the given writer. +func MarshalNodeInfoList(list []*NodeInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodeInfoList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodeInfoList writes a list of value of the 'node_info' type to +// the given stream. +func WriteNodeInfoList(list []*NodeInfo, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNodeInfo(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodeInfoList reads a list of values of the 'node_info' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodeInfoList(source interface{}) (items []*NodeInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodeInfoList(iterator) + err = iterator.Error + return +} + +// ReadNodeInfoList reads list of values of the ”node_info' type from +// the given iterator. +func ReadNodeInfoList(iterator *jsoniter.Iterator) []*NodeInfo { + list := []*NodeInfo{} + for iterator.ReadArray() { + item := ReadNodeInfo(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/node_info_type.go b/clientapi/clustersmgmt/v1/node_info_type.go new file mode 100644 index 00000000..9d694fce --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_info_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodeInfo represents the values of the 'node_info' type. +// +// Provides information about a node from specific type in the cluster. +type NodeInfo struct { + bitmap_ uint32 + amount int + type_ NodeType +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NodeInfo) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Amount returns the value of the 'amount' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The amount of the nodes from this type. +func (o *NodeInfo) Amount() int { + if o != nil && o.bitmap_&1 != 0 { + return o.amount + } + return 0 +} + +// GetAmount returns the value of the 'amount' attribute and +// a flag indicating if the attribute has a value. +// +// The amount of the nodes from this type. +func (o *NodeInfo) GetAmount() (value int, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.amount + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Node type. +func (o *NodeInfo) Type() NodeType { + if o != nil && o.bitmap_&2 != 0 { + return o.type_ + } + return NodeType("") +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// The Node type. +func (o *NodeInfo) GetType() (value NodeType, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.type_ + } + return +} + +// NodeInfoListKind is the name of the type used to represent list of objects of +// type 'node_info'. +const NodeInfoListKind = "NodeInfoList" + +// NodeInfoListLinkKind is the name of the type used to represent links to list +// of objects of type 'node_info'. +const NodeInfoListLinkKind = "NodeInfoListLink" + +// NodeInfoNilKind is the name of the type used to nil lists of objects of +// type 'node_info'. +const NodeInfoListNilKind = "NodeInfoListNil" + +// NodeInfoList is a list of values of the 'node_info' type. +type NodeInfoList struct { + href string + link bool + items []*NodeInfo +} + +// Len returns the length of the list. +func (l *NodeInfoList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NodeInfoList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NodeInfoList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NodeInfoList) SetItems(items []*NodeInfo) { + l.items = items +} + +// Items returns the items of the list. +func (l *NodeInfoList) Items() []*NodeInfo { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NodeInfoList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NodeInfoList) Get(i int) *NodeInfo { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NodeInfoList) Slice() []*NodeInfo { + var slice []*NodeInfo + if l == nil { + slice = make([]*NodeInfo, 0) + } else { + slice = make([]*NodeInfo, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NodeInfoList) Each(f func(item *NodeInfo) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NodeInfoList) Range(f func(index int, item *NodeInfo) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/node_info_type_json.go b/clientapi/clustersmgmt/v1/node_info_type_json.go new file mode 100644 index 00000000..1f15c581 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_info_type_json.go @@ -0,0 +1,100 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodeInfo writes a value of the 'node_info' type to the given writer. +func MarshalNodeInfo(object *NodeInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodeInfo(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodeInfo writes a value of the 'node_info' type to the given stream. +func WriteNodeInfo(object *NodeInfo, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("amount") + stream.WriteInt(object.amount) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(string(object.type_)) + } + stream.WriteObjectEnd() +} + +// UnmarshalNodeInfo reads a value of the 'node_info' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNodeInfo(source interface{}) (object *NodeInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNodeInfo(iterator) + err = iterator.Error + return +} + +// ReadNodeInfo reads a value of the 'node_info' type from the given iterator. +func ReadNodeInfo(iterator *jsoniter.Iterator) *NodeInfo { + object := &NodeInfo{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "amount": + value := iterator.ReadInt() + object.amount = value + object.bitmap_ |= 1 + case "type": + text := iterator.ReadString() + value := NodeType(text) + object.type_ = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/node_pool_autoscaling_builder.go b/clientapi/clustersmgmt/v1/node_pool_autoscaling_builder.go new file mode 100644 index 00000000..374d8980 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_autoscaling_builder.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolAutoscalingBuilder contains the data and logic needed to build 'node_pool_autoscaling' objects. +// +// Representation of a autoscaling in a node pool. +type NodePoolAutoscalingBuilder struct { + bitmap_ uint32 + id string + href string + maxReplica int + minReplica int +} + +// NewNodePoolAutoscaling creates a new builder of 'node_pool_autoscaling' objects. +func NewNodePoolAutoscaling() *NodePoolAutoscalingBuilder { + return &NodePoolAutoscalingBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *NodePoolAutoscalingBuilder) Link(value bool) *NodePoolAutoscalingBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *NodePoolAutoscalingBuilder) ID(value string) *NodePoolAutoscalingBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *NodePoolAutoscalingBuilder) HREF(value string) *NodePoolAutoscalingBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NodePoolAutoscalingBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// MaxReplica sets the value of the 'max_replica' attribute to the given value. +func (b *NodePoolAutoscalingBuilder) MaxReplica(value int) *NodePoolAutoscalingBuilder { + b.maxReplica = value + b.bitmap_ |= 8 + return b +} + +// MinReplica sets the value of the 'min_replica' attribute to the given value. +func (b *NodePoolAutoscalingBuilder) MinReplica(value int) *NodePoolAutoscalingBuilder { + b.minReplica = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NodePoolAutoscalingBuilder) Copy(object *NodePoolAutoscaling) *NodePoolAutoscalingBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.maxReplica = object.maxReplica + b.minReplica = object.minReplica + return b +} + +// Build creates a 'node_pool_autoscaling' object using the configuration stored in the builder. +func (b *NodePoolAutoscalingBuilder) Build() (object *NodePoolAutoscaling, err error) { + object = new(NodePoolAutoscaling) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.maxReplica = b.maxReplica + object.minReplica = b.minReplica + return +} diff --git a/clientapi/clustersmgmt/v1/node_pool_autoscaling_list_builder.go b/clientapi/clustersmgmt/v1/node_pool_autoscaling_list_builder.go new file mode 100644 index 00000000..98fd2ab2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_autoscaling_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolAutoscalingListBuilder contains the data and logic needed to build +// 'node_pool_autoscaling' objects. +type NodePoolAutoscalingListBuilder struct { + items []*NodePoolAutoscalingBuilder +} + +// NewNodePoolAutoscalingList creates a new builder of 'node_pool_autoscaling' objects. +func NewNodePoolAutoscalingList() *NodePoolAutoscalingListBuilder { + return new(NodePoolAutoscalingListBuilder) +} + +// Items sets the items of the list. +func (b *NodePoolAutoscalingListBuilder) Items(values ...*NodePoolAutoscalingBuilder) *NodePoolAutoscalingListBuilder { + b.items = make([]*NodePoolAutoscalingBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NodePoolAutoscalingListBuilder) 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 *NodePoolAutoscalingListBuilder) Copy(list *NodePoolAutoscalingList) *NodePoolAutoscalingListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NodePoolAutoscalingBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNodePoolAutoscaling().Copy(v) + } + } + return b +} + +// Build creates a list of 'node_pool_autoscaling' objects using the +// configuration stored in the builder. +func (b *NodePoolAutoscalingListBuilder) Build() (list *NodePoolAutoscalingList, err error) { + items := make([]*NodePoolAutoscaling, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NodePoolAutoscalingList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/node_pool_autoscaling_list_type_json.go b/clientapi/clustersmgmt/v1/node_pool_autoscaling_list_type_json.go new file mode 100644 index 00000000..389efa59 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_autoscaling_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePoolAutoscalingList writes a list of values of the 'node_pool_autoscaling' type to +// the given writer. +func MarshalNodePoolAutoscalingList(list []*NodePoolAutoscaling, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolAutoscalingList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolAutoscalingList writes a list of value of the 'node_pool_autoscaling' type to +// the given stream. +func WriteNodePoolAutoscalingList(list []*NodePoolAutoscaling, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNodePoolAutoscaling(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodePoolAutoscalingList reads a list of values of the 'node_pool_autoscaling' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodePoolAutoscalingList(source interface{}) (items []*NodePoolAutoscaling, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodePoolAutoscalingList(iterator) + err = iterator.Error + return +} + +// ReadNodePoolAutoscalingList reads list of values of the ”node_pool_autoscaling' type from +// the given iterator. +func ReadNodePoolAutoscalingList(iterator *jsoniter.Iterator) []*NodePoolAutoscaling { + list := []*NodePoolAutoscaling{} + for iterator.ReadArray() { + item := ReadNodePoolAutoscaling(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/node_pool_autoscaling_type.go b/clientapi/clustersmgmt/v1/node_pool_autoscaling_type.go new file mode 100644 index 00000000..493dd4f5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_autoscaling_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolAutoscalingKind is the name of the type used to represent objects +// of type 'node_pool_autoscaling'. +const NodePoolAutoscalingKind = "NodePoolAutoscaling" + +// NodePoolAutoscalingLinkKind is the name of the type used to represent links +// to objects of type 'node_pool_autoscaling'. +const NodePoolAutoscalingLinkKind = "NodePoolAutoscalingLink" + +// NodePoolAutoscalingNilKind is the name of the type used to nil references +// to objects of type 'node_pool_autoscaling'. +const NodePoolAutoscalingNilKind = "NodePoolAutoscalingNil" + +// NodePoolAutoscaling represents the values of the 'node_pool_autoscaling' type. +// +// Representation of a autoscaling in a node pool. +type NodePoolAutoscaling struct { + bitmap_ uint32 + id string + href string + maxReplica int + minReplica int +} + +// Kind returns the name of the type of the object. +func (o *NodePoolAutoscaling) Kind() string { + if o == nil { + return NodePoolAutoscalingNilKind + } + if o.bitmap_&1 != 0 { + return NodePoolAutoscalingLinkKind + } + return NodePoolAutoscalingKind +} + +// Link returns true if this is a link. +func (o *NodePoolAutoscaling) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *NodePoolAutoscaling) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *NodePoolAutoscaling) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *NodePoolAutoscaling) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *NodePoolAutoscaling) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NodePoolAutoscaling) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// MaxReplica returns the value of the 'max_replica' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The maximum number of replicas for the node pool. +func (o *NodePoolAutoscaling) MaxReplica() int { + if o != nil && o.bitmap_&8 != 0 { + return o.maxReplica + } + return 0 +} + +// GetMaxReplica returns the value of the 'max_replica' attribute and +// a flag indicating if the attribute has a value. +// +// The maximum number of replicas for the node pool. +func (o *NodePoolAutoscaling) GetMaxReplica() (value int, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.maxReplica + } + return +} + +// MinReplica returns the value of the 'min_replica' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The minimum number of replicas for the node pool. +func (o *NodePoolAutoscaling) MinReplica() int { + if o != nil && o.bitmap_&16 != 0 { + return o.minReplica + } + return 0 +} + +// GetMinReplica returns the value of the 'min_replica' attribute and +// a flag indicating if the attribute has a value. +// +// The minimum number of replicas for the node pool. +func (o *NodePoolAutoscaling) GetMinReplica() (value int, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.minReplica + } + return +} + +// NodePoolAutoscalingListKind is the name of the type used to represent list of objects of +// type 'node_pool_autoscaling'. +const NodePoolAutoscalingListKind = "NodePoolAutoscalingList" + +// NodePoolAutoscalingListLinkKind is the name of the type used to represent links to list +// of objects of type 'node_pool_autoscaling'. +const NodePoolAutoscalingListLinkKind = "NodePoolAutoscalingListLink" + +// NodePoolAutoscalingNilKind is the name of the type used to nil lists of objects of +// type 'node_pool_autoscaling'. +const NodePoolAutoscalingListNilKind = "NodePoolAutoscalingListNil" + +// NodePoolAutoscalingList is a list of values of the 'node_pool_autoscaling' type. +type NodePoolAutoscalingList struct { + href string + link bool + items []*NodePoolAutoscaling +} + +// Kind returns the name of the type of the object. +func (l *NodePoolAutoscalingList) Kind() string { + if l == nil { + return NodePoolAutoscalingListNilKind + } + if l.link { + return NodePoolAutoscalingListLinkKind + } + return NodePoolAutoscalingListKind +} + +// Link returns true iif this is a link. +func (l *NodePoolAutoscalingList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *NodePoolAutoscalingList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *NodePoolAutoscalingList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *NodePoolAutoscalingList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NodePoolAutoscalingList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NodePoolAutoscalingList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NodePoolAutoscalingList) SetItems(items []*NodePoolAutoscaling) { + l.items = items +} + +// Items returns the items of the list. +func (l *NodePoolAutoscalingList) Items() []*NodePoolAutoscaling { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NodePoolAutoscalingList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NodePoolAutoscalingList) Get(i int) *NodePoolAutoscaling { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NodePoolAutoscalingList) Slice() []*NodePoolAutoscaling { + var slice []*NodePoolAutoscaling + if l == nil { + slice = make([]*NodePoolAutoscaling, 0) + } else { + slice = make([]*NodePoolAutoscaling, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NodePoolAutoscalingList) Each(f func(item *NodePoolAutoscaling) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NodePoolAutoscalingList) Range(f func(index int, item *NodePoolAutoscaling) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/node_pool_autoscaling_type_json.go b/clientapi/clustersmgmt/v1/node_pool_autoscaling_type_json.go new file mode 100644 index 00000000..63ba8ac3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_autoscaling_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePoolAutoscaling writes a value of the 'node_pool_autoscaling' type to the given writer. +func MarshalNodePoolAutoscaling(object *NodePoolAutoscaling, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolAutoscaling(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolAutoscaling writes a value of the 'node_pool_autoscaling' type to the given stream. +func WriteNodePoolAutoscaling(object *NodePoolAutoscaling, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(NodePoolAutoscalingLinkKind) + } else { + stream.WriteString(NodePoolAutoscalingKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_replica") + stream.WriteInt(object.maxReplica) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("min_replica") + stream.WriteInt(object.minReplica) + } + stream.WriteObjectEnd() +} + +// UnmarshalNodePoolAutoscaling reads a value of the 'node_pool_autoscaling' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNodePoolAutoscaling(source interface{}) (object *NodePoolAutoscaling, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNodePoolAutoscaling(iterator) + err = iterator.Error + return +} + +// ReadNodePoolAutoscaling reads a value of the 'node_pool_autoscaling' type from the given iterator. +func ReadNodePoolAutoscaling(iterator *jsoniter.Iterator) *NodePoolAutoscaling { + object := &NodePoolAutoscaling{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == NodePoolAutoscalingLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "max_replica": + value := iterator.ReadInt() + object.maxReplica = value + object.bitmap_ |= 8 + case "min_replica": + value := iterator.ReadInt() + object.minReplica = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/node_pool_builder.go b/clientapi/clustersmgmt/v1/node_pool_builder.go new file mode 100644 index 00000000..95dcdd3f --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_builder.go @@ -0,0 +1,401 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolBuilder contains the data and logic needed to build 'node_pool' objects. +// +// Representation of a node pool in a cluster. +type NodePoolBuilder struct { + bitmap_ uint32 + id string + href string + awsNodePool *AWSNodePoolBuilder + autoscaling *NodePoolAutoscalingBuilder + availabilityZone string + azureNodePool *AzureNodePoolBuilder + kubeletConfigs []string + labels map[string]string + managementUpgrade *NodePoolManagementUpgradeBuilder + nodeDrainGracePeriod *ValueBuilder + replicas int + status *NodePoolStatusBuilder + subnet string + taints []*TaintBuilder + tuningConfigs []string + version *VersionBuilder + autoRepair bool +} + +// NewNodePool creates a new builder of 'node_pool' objects. +func NewNodePool() *NodePoolBuilder { + return &NodePoolBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *NodePoolBuilder) Link(value bool) *NodePoolBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *NodePoolBuilder) ID(value string) *NodePoolBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *NodePoolBuilder) HREF(value string) *NodePoolBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NodePoolBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AWSNodePool sets the value of the 'AWS_node_pool' attribute to the given value. +// +// Representation of aws node pool specific parameters. +func (b *NodePoolBuilder) AWSNodePool(value *AWSNodePoolBuilder) *NodePoolBuilder { + b.awsNodePool = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// AutoRepair sets the value of the 'auto_repair' attribute to the given value. +func (b *NodePoolBuilder) AutoRepair(value bool) *NodePoolBuilder { + b.autoRepair = value + b.bitmap_ |= 16 + return b +} + +// Autoscaling sets the value of the 'autoscaling' attribute to the given value. +// +// Representation of a autoscaling in a node pool. +func (b *NodePoolBuilder) Autoscaling(value *NodePoolAutoscalingBuilder) *NodePoolBuilder { + b.autoscaling = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// AvailabilityZone sets the value of the 'availability_zone' attribute to the given value. +func (b *NodePoolBuilder) AvailabilityZone(value string) *NodePoolBuilder { + b.availabilityZone = value + b.bitmap_ |= 64 + return b +} + +// AzureNodePool sets the value of the 'azure_node_pool' attribute to the given value. +// +// Representation of azure node pool specific parameters. +func (b *NodePoolBuilder) AzureNodePool(value *AzureNodePoolBuilder) *NodePoolBuilder { + b.azureNodePool = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// KubeletConfigs sets the value of the 'kubelet_configs' attribute to the given values. +func (b *NodePoolBuilder) KubeletConfigs(values ...string) *NodePoolBuilder { + b.kubeletConfigs = make([]string, len(values)) + copy(b.kubeletConfigs, values) + b.bitmap_ |= 256 + return b +} + +// Labels sets the value of the 'labels' attribute to the given value. +func (b *NodePoolBuilder) Labels(value map[string]string) *NodePoolBuilder { + b.labels = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// ManagementUpgrade sets the value of the 'management_upgrade' attribute to the given value. +// +// Representation of node pool management. +func (b *NodePoolBuilder) ManagementUpgrade(value *NodePoolManagementUpgradeBuilder) *NodePoolBuilder { + b.managementUpgrade = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// NodeDrainGracePeriod sets the value of the 'node_drain_grace_period' attribute to the given value. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +func (b *NodePoolBuilder) NodeDrainGracePeriod(value *ValueBuilder) *NodePoolBuilder { + b.nodeDrainGracePeriod = value + if value != nil { + b.bitmap_ |= 2048 + } else { + b.bitmap_ &^= 2048 + } + return b +} + +// Replicas sets the value of the 'replicas' attribute to the given value. +func (b *NodePoolBuilder) Replicas(value int) *NodePoolBuilder { + b.replicas = value + b.bitmap_ |= 4096 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +// +// Representation of the status of a node pool. +func (b *NodePoolBuilder) Status(value *NodePoolStatusBuilder) *NodePoolBuilder { + b.status = value + if value != nil { + b.bitmap_ |= 8192 + } else { + b.bitmap_ &^= 8192 + } + return b +} + +// Subnet sets the value of the 'subnet' attribute to the given value. +func (b *NodePoolBuilder) Subnet(value string) *NodePoolBuilder { + b.subnet = value + b.bitmap_ |= 16384 + return b +} + +// Taints sets the value of the 'taints' attribute to the given values. +func (b *NodePoolBuilder) Taints(values ...*TaintBuilder) *NodePoolBuilder { + b.taints = make([]*TaintBuilder, len(values)) + copy(b.taints, values) + b.bitmap_ |= 32768 + return b +} + +// TuningConfigs sets the value of the 'tuning_configs' attribute to the given values. +func (b *NodePoolBuilder) TuningConfigs(values ...string) *NodePoolBuilder { + b.tuningConfigs = make([]string, len(values)) + copy(b.tuningConfigs, values) + b.bitmap_ |= 65536 + return b +} + +// Version sets the value of the 'version' attribute to the given value. +// +// Representation of an _OpenShift_ version. +func (b *NodePoolBuilder) Version(value *VersionBuilder) *NodePoolBuilder { + b.version = value + if value != nil { + b.bitmap_ |= 131072 + } else { + b.bitmap_ &^= 131072 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NodePoolBuilder) Copy(object *NodePool) *NodePoolBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.awsNodePool != nil { + b.awsNodePool = NewAWSNodePool().Copy(object.awsNodePool) + } else { + b.awsNodePool = nil + } + b.autoRepair = object.autoRepair + if object.autoscaling != nil { + b.autoscaling = NewNodePoolAutoscaling().Copy(object.autoscaling) + } else { + b.autoscaling = nil + } + b.availabilityZone = object.availabilityZone + if object.azureNodePool != nil { + b.azureNodePool = NewAzureNodePool().Copy(object.azureNodePool) + } else { + b.azureNodePool = nil + } + if object.kubeletConfigs != nil { + b.kubeletConfigs = make([]string, len(object.kubeletConfigs)) + copy(b.kubeletConfigs, object.kubeletConfigs) + } else { + b.kubeletConfigs = nil + } + if len(object.labels) > 0 { + b.labels = map[string]string{} + for k, v := range object.labels { + b.labels[k] = v + } + } else { + b.labels = nil + } + if object.managementUpgrade != nil { + b.managementUpgrade = NewNodePoolManagementUpgrade().Copy(object.managementUpgrade) + } else { + b.managementUpgrade = nil + } + if object.nodeDrainGracePeriod != nil { + b.nodeDrainGracePeriod = NewValue().Copy(object.nodeDrainGracePeriod) + } else { + b.nodeDrainGracePeriod = nil + } + b.replicas = object.replicas + if object.status != nil { + b.status = NewNodePoolStatus().Copy(object.status) + } else { + b.status = nil + } + b.subnet = object.subnet + if object.taints != nil { + b.taints = make([]*TaintBuilder, len(object.taints)) + for i, v := range object.taints { + b.taints[i] = NewTaint().Copy(v) + } + } else { + b.taints = nil + } + if object.tuningConfigs != nil { + b.tuningConfigs = make([]string, len(object.tuningConfigs)) + copy(b.tuningConfigs, object.tuningConfigs) + } else { + b.tuningConfigs = nil + } + if object.version != nil { + b.version = NewVersion().Copy(object.version) + } else { + b.version = nil + } + return b +} + +// Build creates a 'node_pool' object using the configuration stored in the builder. +func (b *NodePoolBuilder) Build() (object *NodePool, err error) { + object = new(NodePool) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.awsNodePool != nil { + object.awsNodePool, err = b.awsNodePool.Build() + if err != nil { + return + } + } + object.autoRepair = b.autoRepair + if b.autoscaling != nil { + object.autoscaling, err = b.autoscaling.Build() + if err != nil { + return + } + } + object.availabilityZone = b.availabilityZone + if b.azureNodePool != nil { + object.azureNodePool, err = b.azureNodePool.Build() + if err != nil { + return + } + } + if b.kubeletConfigs != nil { + object.kubeletConfigs = make([]string, len(b.kubeletConfigs)) + copy(object.kubeletConfigs, b.kubeletConfigs) + } + if b.labels != nil { + object.labels = make(map[string]string) + for k, v := range b.labels { + object.labels[k] = v + } + } + if b.managementUpgrade != nil { + object.managementUpgrade, err = b.managementUpgrade.Build() + if err != nil { + return + } + } + if b.nodeDrainGracePeriod != nil { + object.nodeDrainGracePeriod, err = b.nodeDrainGracePeriod.Build() + if err != nil { + return + } + } + object.replicas = b.replicas + if b.status != nil { + object.status, err = b.status.Build() + if err != nil { + return + } + } + object.subnet = b.subnet + if b.taints != nil { + object.taints = make([]*Taint, len(b.taints)) + for i, v := range b.taints { + object.taints[i], err = v.Build() + if err != nil { + return + } + } + } + if b.tuningConfigs != nil { + object.tuningConfigs = make([]string, len(b.tuningConfigs)) + copy(object.tuningConfigs, b.tuningConfigs) + } + if b.version != nil { + object.version, err = b.version.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/node_pool_list_builder.go b/clientapi/clustersmgmt/v1/node_pool_list_builder.go new file mode 100644 index 00000000..ae843a47 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolListBuilder contains the data and logic needed to build +// 'node_pool' objects. +type NodePoolListBuilder struct { + items []*NodePoolBuilder +} + +// NewNodePoolList creates a new builder of 'node_pool' objects. +func NewNodePoolList() *NodePoolListBuilder { + return new(NodePoolListBuilder) +} + +// Items sets the items of the list. +func (b *NodePoolListBuilder) Items(values ...*NodePoolBuilder) *NodePoolListBuilder { + b.items = make([]*NodePoolBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NodePoolListBuilder) 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 *NodePoolListBuilder) Copy(list *NodePoolList) *NodePoolListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NodePoolBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNodePool().Copy(v) + } + } + return b +} + +// Build creates a list of 'node_pool' objects using the +// configuration stored in the builder. +func (b *NodePoolListBuilder) Build() (list *NodePoolList, err error) { + items := make([]*NodePool, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NodePoolList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/node_pool_list_type_json.go b/clientapi/clustersmgmt/v1/node_pool_list_type_json.go new file mode 100644 index 00000000..e9e7ccc1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePoolList writes a list of values of the 'node_pool' type to +// the given writer. +func MarshalNodePoolList(list []*NodePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolList writes a list of value of the 'node_pool' type to +// the given stream. +func WriteNodePoolList(list []*NodePool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNodePool(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodePoolList reads a list of values of the 'node_pool' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodePoolList(source interface{}) (items []*NodePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodePoolList(iterator) + err = iterator.Error + return +} + +// ReadNodePoolList reads list of values of the ”node_pool' type from +// the given iterator. +func ReadNodePoolList(iterator *jsoniter.Iterator) []*NodePool { + list := []*NodePool{} + for iterator.ReadArray() { + item := ReadNodePool(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/node_pool_management_upgrade_builder.go b/clientapi/clustersmgmt/v1/node_pool_management_upgrade_builder.go new file mode 100644 index 00000000..75405ca4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_management_upgrade_builder.go @@ -0,0 +1,109 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolManagementUpgradeBuilder contains the data and logic needed to build 'node_pool_management_upgrade' objects. +// +// Representation of node pool management. +type NodePoolManagementUpgradeBuilder struct { + bitmap_ uint32 + id string + href string + maxSurge string + maxUnavailable string + type_ string +} + +// NewNodePoolManagementUpgrade creates a new builder of 'node_pool_management_upgrade' objects. +func NewNodePoolManagementUpgrade() *NodePoolManagementUpgradeBuilder { + return &NodePoolManagementUpgradeBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *NodePoolManagementUpgradeBuilder) Link(value bool) *NodePoolManagementUpgradeBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *NodePoolManagementUpgradeBuilder) ID(value string) *NodePoolManagementUpgradeBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *NodePoolManagementUpgradeBuilder) HREF(value string) *NodePoolManagementUpgradeBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NodePoolManagementUpgradeBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// MaxSurge sets the value of the 'max_surge' attribute to the given value. +func (b *NodePoolManagementUpgradeBuilder) MaxSurge(value string) *NodePoolManagementUpgradeBuilder { + b.maxSurge = value + b.bitmap_ |= 8 + return b +} + +// MaxUnavailable sets the value of the 'max_unavailable' attribute to the given value. +func (b *NodePoolManagementUpgradeBuilder) MaxUnavailable(value string) *NodePoolManagementUpgradeBuilder { + b.maxUnavailable = value + b.bitmap_ |= 16 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *NodePoolManagementUpgradeBuilder) Type(value string) *NodePoolManagementUpgradeBuilder { + b.type_ = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NodePoolManagementUpgradeBuilder) Copy(object *NodePoolManagementUpgrade) *NodePoolManagementUpgradeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.maxSurge = object.maxSurge + b.maxUnavailable = object.maxUnavailable + b.type_ = object.type_ + return b +} + +// Build creates a 'node_pool_management_upgrade' object using the configuration stored in the builder. +func (b *NodePoolManagementUpgradeBuilder) Build() (object *NodePoolManagementUpgrade, err error) { + object = new(NodePoolManagementUpgrade) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.maxSurge = b.maxSurge + object.maxUnavailable = b.maxUnavailable + object.type_ = b.type_ + return +} diff --git a/clientapi/clustersmgmt/v1/node_pool_management_upgrade_list_builder.go b/clientapi/clustersmgmt/v1/node_pool_management_upgrade_list_builder.go new file mode 100644 index 00000000..e627dc41 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_management_upgrade_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolManagementUpgradeListBuilder contains the data and logic needed to build +// 'node_pool_management_upgrade' objects. +type NodePoolManagementUpgradeListBuilder struct { + items []*NodePoolManagementUpgradeBuilder +} + +// NewNodePoolManagementUpgradeList creates a new builder of 'node_pool_management_upgrade' objects. +func NewNodePoolManagementUpgradeList() *NodePoolManagementUpgradeListBuilder { + return new(NodePoolManagementUpgradeListBuilder) +} + +// Items sets the items of the list. +func (b *NodePoolManagementUpgradeListBuilder) Items(values ...*NodePoolManagementUpgradeBuilder) *NodePoolManagementUpgradeListBuilder { + b.items = make([]*NodePoolManagementUpgradeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NodePoolManagementUpgradeListBuilder) 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 *NodePoolManagementUpgradeListBuilder) Copy(list *NodePoolManagementUpgradeList) *NodePoolManagementUpgradeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NodePoolManagementUpgradeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNodePoolManagementUpgrade().Copy(v) + } + } + return b +} + +// Build creates a list of 'node_pool_management_upgrade' objects using the +// configuration stored in the builder. +func (b *NodePoolManagementUpgradeListBuilder) Build() (list *NodePoolManagementUpgradeList, err error) { + items := make([]*NodePoolManagementUpgrade, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NodePoolManagementUpgradeList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/node_pool_management_upgrade_list_type_json.go b/clientapi/clustersmgmt/v1/node_pool_management_upgrade_list_type_json.go new file mode 100644 index 00000000..f330ebc0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_management_upgrade_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePoolManagementUpgradeList writes a list of values of the 'node_pool_management_upgrade' type to +// the given writer. +func MarshalNodePoolManagementUpgradeList(list []*NodePoolManagementUpgrade, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolManagementUpgradeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolManagementUpgradeList writes a list of value of the 'node_pool_management_upgrade' type to +// the given stream. +func WriteNodePoolManagementUpgradeList(list []*NodePoolManagementUpgrade, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNodePoolManagementUpgrade(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodePoolManagementUpgradeList reads a list of values of the 'node_pool_management_upgrade' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodePoolManagementUpgradeList(source interface{}) (items []*NodePoolManagementUpgrade, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodePoolManagementUpgradeList(iterator) + err = iterator.Error + return +} + +// ReadNodePoolManagementUpgradeList reads list of values of the ”node_pool_management_upgrade' type from +// the given iterator. +func ReadNodePoolManagementUpgradeList(iterator *jsoniter.Iterator) []*NodePoolManagementUpgrade { + list := []*NodePoolManagementUpgrade{} + for iterator.ReadArray() { + item := ReadNodePoolManagementUpgrade(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/node_pool_management_upgrade_type.go b/clientapi/clustersmgmt/v1/node_pool_management_upgrade_type.go new file mode 100644 index 00000000..eb21fbb6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_management_upgrade_type.go @@ -0,0 +1,313 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolManagementUpgradeKind is the name of the type used to represent objects +// of type 'node_pool_management_upgrade'. +const NodePoolManagementUpgradeKind = "NodePoolManagementUpgrade" + +// NodePoolManagementUpgradeLinkKind is the name of the type used to represent links +// to objects of type 'node_pool_management_upgrade'. +const NodePoolManagementUpgradeLinkKind = "NodePoolManagementUpgradeLink" + +// NodePoolManagementUpgradeNilKind is the name of the type used to nil references +// to objects of type 'node_pool_management_upgrade'. +const NodePoolManagementUpgradeNilKind = "NodePoolManagementUpgradeNil" + +// NodePoolManagementUpgrade represents the values of the 'node_pool_management_upgrade' type. +// +// Representation of node pool management. +type NodePoolManagementUpgrade struct { + bitmap_ uint32 + id string + href string + maxSurge string + maxUnavailable string + type_ string +} + +// Kind returns the name of the type of the object. +func (o *NodePoolManagementUpgrade) Kind() string { + if o == nil { + return NodePoolManagementUpgradeNilKind + } + if o.bitmap_&1 != 0 { + return NodePoolManagementUpgradeLinkKind + } + return NodePoolManagementUpgradeKind +} + +// Link returns true if this is a link. +func (o *NodePoolManagementUpgrade) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *NodePoolManagementUpgrade) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *NodePoolManagementUpgrade) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *NodePoolManagementUpgrade) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *NodePoolManagementUpgrade) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NodePoolManagementUpgrade) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// MaxSurge returns the value of the 'max_surge' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Maximum number of nodes in the NodePool of a ROSA HCP cluster that can be scheduled above the desired number of nodes during the upgrade. +func (o *NodePoolManagementUpgrade) MaxSurge() string { + if o != nil && o.bitmap_&8 != 0 { + return o.maxSurge + } + return "" +} + +// GetMaxSurge returns the value of the 'max_surge' attribute and +// a flag indicating if the attribute has a value. +// +// Maximum number of nodes in the NodePool of a ROSA HCP cluster that can be scheduled above the desired number of nodes during the upgrade. +func (o *NodePoolManagementUpgrade) GetMaxSurge() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.maxSurge + } + return +} + +// MaxUnavailable returns the value of the 'max_unavailable' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Maximum number of nodes in the NodePool of a ROSA HCP cluster that can be unavailable during the upgrade. +func (o *NodePoolManagementUpgrade) MaxUnavailable() string { + if o != nil && o.bitmap_&16 != 0 { + return o.maxUnavailable + } + return "" +} + +// GetMaxUnavailable returns the value of the 'max_unavailable' attribute and +// a flag indicating if the attribute has a value. +// +// Maximum number of nodes in the NodePool of a ROSA HCP cluster that can be unavailable during the upgrade. +func (o *NodePoolManagementUpgrade) GetMaxUnavailable() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.maxUnavailable + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of strategy for handling upgrades. +func (o *NodePoolManagementUpgrade) Type() string { + if o != nil && o.bitmap_&32 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of strategy for handling upgrades. +func (o *NodePoolManagementUpgrade) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.type_ + } + return +} + +// NodePoolManagementUpgradeListKind is the name of the type used to represent list of objects of +// type 'node_pool_management_upgrade'. +const NodePoolManagementUpgradeListKind = "NodePoolManagementUpgradeList" + +// NodePoolManagementUpgradeListLinkKind is the name of the type used to represent links to list +// of objects of type 'node_pool_management_upgrade'. +const NodePoolManagementUpgradeListLinkKind = "NodePoolManagementUpgradeListLink" + +// NodePoolManagementUpgradeNilKind is the name of the type used to nil lists of objects of +// type 'node_pool_management_upgrade'. +const NodePoolManagementUpgradeListNilKind = "NodePoolManagementUpgradeListNil" + +// NodePoolManagementUpgradeList is a list of values of the 'node_pool_management_upgrade' type. +type NodePoolManagementUpgradeList struct { + href string + link bool + items []*NodePoolManagementUpgrade +} + +// Kind returns the name of the type of the object. +func (l *NodePoolManagementUpgradeList) Kind() string { + if l == nil { + return NodePoolManagementUpgradeListNilKind + } + if l.link { + return NodePoolManagementUpgradeListLinkKind + } + return NodePoolManagementUpgradeListKind +} + +// Link returns true iif this is a link. +func (l *NodePoolManagementUpgradeList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *NodePoolManagementUpgradeList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *NodePoolManagementUpgradeList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *NodePoolManagementUpgradeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NodePoolManagementUpgradeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NodePoolManagementUpgradeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NodePoolManagementUpgradeList) SetItems(items []*NodePoolManagementUpgrade) { + l.items = items +} + +// Items returns the items of the list. +func (l *NodePoolManagementUpgradeList) Items() []*NodePoolManagementUpgrade { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NodePoolManagementUpgradeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NodePoolManagementUpgradeList) Get(i int) *NodePoolManagementUpgrade { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NodePoolManagementUpgradeList) Slice() []*NodePoolManagementUpgrade { + var slice []*NodePoolManagementUpgrade + if l == nil { + slice = make([]*NodePoolManagementUpgrade, 0) + } else { + slice = make([]*NodePoolManagementUpgrade, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NodePoolManagementUpgradeList) Each(f func(item *NodePoolManagementUpgrade) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NodePoolManagementUpgradeList) Range(f func(index int, item *NodePoolManagementUpgrade) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/node_pool_management_upgrade_type_json.go b/clientapi/clustersmgmt/v1/node_pool_management_upgrade_type_json.go new file mode 100644 index 00000000..c78a57b9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_management_upgrade_type_json.go @@ -0,0 +1,146 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePoolManagementUpgrade writes a value of the 'node_pool_management_upgrade' type to the given writer. +func MarshalNodePoolManagementUpgrade(object *NodePoolManagementUpgrade, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolManagementUpgrade(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolManagementUpgrade writes a value of the 'node_pool_management_upgrade' type to the given stream. +func WriteNodePoolManagementUpgrade(object *NodePoolManagementUpgrade, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(NodePoolManagementUpgradeLinkKind) + } else { + stream.WriteString(NodePoolManagementUpgradeKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_surge") + stream.WriteString(object.maxSurge) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_unavailable") + stream.WriteString(object.maxUnavailable) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalNodePoolManagementUpgrade reads a value of the 'node_pool_management_upgrade' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNodePoolManagementUpgrade(source interface{}) (object *NodePoolManagementUpgrade, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNodePoolManagementUpgrade(iterator) + err = iterator.Error + return +} + +// ReadNodePoolManagementUpgrade reads a value of the 'node_pool_management_upgrade' type from the given iterator. +func ReadNodePoolManagementUpgrade(iterator *jsoniter.Iterator) *NodePoolManagementUpgrade { + object := &NodePoolManagementUpgrade{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == NodePoolManagementUpgradeLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "max_surge": + value := iterator.ReadString() + object.maxSurge = value + object.bitmap_ |= 8 + case "max_unavailable": + value := iterator.ReadString() + object.maxUnavailable = value + object.bitmap_ |= 16 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/node_pool_state_builder.go b/clientapi/clustersmgmt/v1/node_pool_state_builder.go new file mode 100644 index 00000000..549a893c --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_state_builder.go @@ -0,0 +1,103 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// NodePoolStateBuilder contains the data and logic needed to build 'node_pool_state' objects. +// +// Representation of the status of a node pool. +type NodePoolStateBuilder struct { + bitmap_ uint32 + id string + href string + lastUpdatedTimestamp time.Time + nodePoolStateValue string +} + +// NewNodePoolState creates a new builder of 'node_pool_state' objects. +func NewNodePoolState() *NodePoolStateBuilder { + return &NodePoolStateBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *NodePoolStateBuilder) Link(value bool) *NodePoolStateBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *NodePoolStateBuilder) ID(value string) *NodePoolStateBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *NodePoolStateBuilder) HREF(value string) *NodePoolStateBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NodePoolStateBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// LastUpdatedTimestamp sets the value of the 'last_updated_timestamp' attribute to the given value. +func (b *NodePoolStateBuilder) LastUpdatedTimestamp(value time.Time) *NodePoolStateBuilder { + b.lastUpdatedTimestamp = value + b.bitmap_ |= 8 + return b +} + +// NodePoolStateValue sets the value of the 'node_pool_state_value' attribute to the given value. +func (b *NodePoolStateBuilder) NodePoolStateValue(value string) *NodePoolStateBuilder { + b.nodePoolStateValue = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NodePoolStateBuilder) Copy(object *NodePoolState) *NodePoolStateBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.lastUpdatedTimestamp = object.lastUpdatedTimestamp + b.nodePoolStateValue = object.nodePoolStateValue + return b +} + +// Build creates a 'node_pool_state' object using the configuration stored in the builder. +func (b *NodePoolStateBuilder) Build() (object *NodePoolState, err error) { + object = new(NodePoolState) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.lastUpdatedTimestamp = b.lastUpdatedTimestamp + object.nodePoolStateValue = b.nodePoolStateValue + return +} diff --git a/clientapi/clustersmgmt/v1/node_pool_state_list_builder.go b/clientapi/clustersmgmt/v1/node_pool_state_list_builder.go new file mode 100644 index 00000000..b4eee39a --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_state_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolStateListBuilder contains the data and logic needed to build +// 'node_pool_state' objects. +type NodePoolStateListBuilder struct { + items []*NodePoolStateBuilder +} + +// NewNodePoolStateList creates a new builder of 'node_pool_state' objects. +func NewNodePoolStateList() *NodePoolStateListBuilder { + return new(NodePoolStateListBuilder) +} + +// Items sets the items of the list. +func (b *NodePoolStateListBuilder) Items(values ...*NodePoolStateBuilder) *NodePoolStateListBuilder { + b.items = make([]*NodePoolStateBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NodePoolStateListBuilder) 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 *NodePoolStateListBuilder) Copy(list *NodePoolStateList) *NodePoolStateListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NodePoolStateBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNodePoolState().Copy(v) + } + } + return b +} + +// Build creates a list of 'node_pool_state' objects using the +// configuration stored in the builder. +func (b *NodePoolStateListBuilder) Build() (list *NodePoolStateList, err error) { + items := make([]*NodePoolState, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NodePoolStateList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/node_pool_state_list_type_json.go b/clientapi/clustersmgmt/v1/node_pool_state_list_type_json.go new file mode 100644 index 00000000..f357091e --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_state_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePoolStateList writes a list of values of the 'node_pool_state' type to +// the given writer. +func MarshalNodePoolStateList(list []*NodePoolState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolStateList writes a list of value of the 'node_pool_state' type to +// the given stream. +func WriteNodePoolStateList(list []*NodePoolState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNodePoolState(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodePoolStateList reads a list of values of the 'node_pool_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodePoolStateList(source interface{}) (items []*NodePoolState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodePoolStateList(iterator) + err = iterator.Error + return +} + +// ReadNodePoolStateList reads list of values of the ”node_pool_state' type from +// the given iterator. +func ReadNodePoolStateList(iterator *jsoniter.Iterator) []*NodePoolState { + list := []*NodePoolState{} + for iterator.ReadArray() { + item := ReadNodePoolState(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/node_pool_state_type.go b/clientapi/clustersmgmt/v1/node_pool_state_type.go new file mode 100644 index 00000000..e3177672 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_state_type.go @@ -0,0 +1,293 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// NodePoolStateKind is the name of the type used to represent objects +// of type 'node_pool_state'. +const NodePoolStateKind = "NodePoolState" + +// NodePoolStateLinkKind is the name of the type used to represent links +// to objects of type 'node_pool_state'. +const NodePoolStateLinkKind = "NodePoolStateLink" + +// NodePoolStateNilKind is the name of the type used to nil references +// to objects of type 'node_pool_state'. +const NodePoolStateNilKind = "NodePoolStateNil" + +// NodePoolState represents the values of the 'node_pool_state' type. +// +// Representation of the status of a node pool. +type NodePoolState struct { + bitmap_ uint32 + id string + href string + lastUpdatedTimestamp time.Time + nodePoolStateValue string +} + +// Kind returns the name of the type of the object. +func (o *NodePoolState) Kind() string { + if o == nil { + return NodePoolStateNilKind + } + if o.bitmap_&1 != 0 { + return NodePoolStateLinkKind + } + return NodePoolStateKind +} + +// Link returns true if this is a link. +func (o *NodePoolState) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *NodePoolState) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *NodePoolState) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *NodePoolState) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *NodePoolState) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NodePoolState) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// LastUpdatedTimestamp returns the value of the 'last_updated_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The current number of replicas for the node pool. +func (o *NodePoolState) LastUpdatedTimestamp() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.lastUpdatedTimestamp + } + return time.Time{} +} + +// GetLastUpdatedTimestamp returns the value of the 'last_updated_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// The current number of replicas for the node pool. +func (o *NodePoolState) GetLastUpdatedTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.lastUpdatedTimestamp + } + return +} + +// NodePoolStateValue returns the value of the 'node_pool_state_value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The current state of the node pool +func (o *NodePoolState) NodePoolStateValue() string { + if o != nil && o.bitmap_&16 != 0 { + return o.nodePoolStateValue + } + return "" +} + +// GetNodePoolStateValue returns the value of the 'node_pool_state_value' attribute and +// a flag indicating if the attribute has a value. +// +// The current state of the node pool +func (o *NodePoolState) GetNodePoolStateValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.nodePoolStateValue + } + return +} + +// NodePoolStateListKind is the name of the type used to represent list of objects of +// type 'node_pool_state'. +const NodePoolStateListKind = "NodePoolStateList" + +// NodePoolStateListLinkKind is the name of the type used to represent links to list +// of objects of type 'node_pool_state'. +const NodePoolStateListLinkKind = "NodePoolStateListLink" + +// NodePoolStateNilKind is the name of the type used to nil lists of objects of +// type 'node_pool_state'. +const NodePoolStateListNilKind = "NodePoolStateListNil" + +// NodePoolStateList is a list of values of the 'node_pool_state' type. +type NodePoolStateList struct { + href string + link bool + items []*NodePoolState +} + +// Kind returns the name of the type of the object. +func (l *NodePoolStateList) Kind() string { + if l == nil { + return NodePoolStateListNilKind + } + if l.link { + return NodePoolStateListLinkKind + } + return NodePoolStateListKind +} + +// Link returns true iif this is a link. +func (l *NodePoolStateList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *NodePoolStateList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *NodePoolStateList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *NodePoolStateList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NodePoolStateList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NodePoolStateList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NodePoolStateList) SetItems(items []*NodePoolState) { + l.items = items +} + +// Items returns the items of the list. +func (l *NodePoolStateList) Items() []*NodePoolState { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NodePoolStateList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NodePoolStateList) Get(i int) *NodePoolState { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NodePoolStateList) Slice() []*NodePoolState { + var slice []*NodePoolState + if l == nil { + slice = make([]*NodePoolState, 0) + } else { + slice = make([]*NodePoolState, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NodePoolStateList) Each(f func(item *NodePoolState) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NodePoolStateList) Range(f func(index int, item *NodePoolState) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/node_pool_state_type_json.go b/clientapi/clustersmgmt/v1/node_pool_state_type_json.go new file mode 100644 index 00000000..0abc25d6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_state_type_json.go @@ -0,0 +1,138 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePoolState writes a value of the 'node_pool_state' type to the given writer. +func MarshalNodePoolState(object *NodePoolState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolState(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolState writes a value of the 'node_pool_state' type to the given stream. +func WriteNodePoolState(object *NodePoolState, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(NodePoolStateLinkKind) + } else { + stream.WriteString(NodePoolStateKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_updated_timestamp") + stream.WriteString((object.lastUpdatedTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("node_pool_state_value") + stream.WriteString(object.nodePoolStateValue) + } + stream.WriteObjectEnd() +} + +// UnmarshalNodePoolState reads a value of the 'node_pool_state' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNodePoolState(source interface{}) (object *NodePoolState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNodePoolState(iterator) + err = iterator.Error + return +} + +// ReadNodePoolState reads a value of the 'node_pool_state' type from the given iterator. +func ReadNodePoolState(iterator *jsoniter.Iterator) *NodePoolState { + object := &NodePoolState{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == NodePoolStateLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "last_updated_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastUpdatedTimestamp = value + object.bitmap_ |= 8 + case "node_pool_state_value": + value := iterator.ReadString() + object.nodePoolStateValue = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/node_pool_status_builder.go b/clientapi/clustersmgmt/v1/node_pool_status_builder.go new file mode 100644 index 00000000..e9c145c9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_status_builder.go @@ -0,0 +1,124 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolStatusBuilder contains the data and logic needed to build 'node_pool_status' objects. +// +// Representation of the status of a node pool. +type NodePoolStatusBuilder struct { + bitmap_ uint32 + id string + href string + currentReplicas int + message string + state *NodePoolStateBuilder +} + +// NewNodePoolStatus creates a new builder of 'node_pool_status' objects. +func NewNodePoolStatus() *NodePoolStatusBuilder { + return &NodePoolStatusBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *NodePoolStatusBuilder) Link(value bool) *NodePoolStatusBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *NodePoolStatusBuilder) ID(value string) *NodePoolStatusBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *NodePoolStatusBuilder) HREF(value string) *NodePoolStatusBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NodePoolStatusBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CurrentReplicas sets the value of the 'current_replicas' attribute to the given value. +func (b *NodePoolStatusBuilder) CurrentReplicas(value int) *NodePoolStatusBuilder { + b.currentReplicas = value + b.bitmap_ |= 8 + return b +} + +// Message sets the value of the 'message' attribute to the given value. +func (b *NodePoolStatusBuilder) Message(value string) *NodePoolStatusBuilder { + b.message = value + b.bitmap_ |= 16 + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// Representation of the status of a node pool. +func (b *NodePoolStatusBuilder) State(value *NodePoolStateBuilder) *NodePoolStatusBuilder { + b.state = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NodePoolStatusBuilder) Copy(object *NodePoolStatus) *NodePoolStatusBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.currentReplicas = object.currentReplicas + b.message = object.message + if object.state != nil { + b.state = NewNodePoolState().Copy(object.state) + } else { + b.state = nil + } + return b +} + +// Build creates a 'node_pool_status' object using the configuration stored in the builder. +func (b *NodePoolStatusBuilder) Build() (object *NodePoolStatus, err error) { + object = new(NodePoolStatus) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.currentReplicas = b.currentReplicas + object.message = b.message + if b.state != nil { + object.state, err = b.state.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/node_pool_status_list_builder.go b/clientapi/clustersmgmt/v1/node_pool_status_list_builder.go new file mode 100644 index 00000000..88b37af4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_status_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolStatusListBuilder contains the data and logic needed to build +// 'node_pool_status' objects. +type NodePoolStatusListBuilder struct { + items []*NodePoolStatusBuilder +} + +// NewNodePoolStatusList creates a new builder of 'node_pool_status' objects. +func NewNodePoolStatusList() *NodePoolStatusListBuilder { + return new(NodePoolStatusListBuilder) +} + +// Items sets the items of the list. +func (b *NodePoolStatusListBuilder) Items(values ...*NodePoolStatusBuilder) *NodePoolStatusListBuilder { + b.items = make([]*NodePoolStatusBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NodePoolStatusListBuilder) 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 *NodePoolStatusListBuilder) Copy(list *NodePoolStatusList) *NodePoolStatusListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NodePoolStatusBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNodePoolStatus().Copy(v) + } + } + return b +} + +// Build creates a list of 'node_pool_status' objects using the +// configuration stored in the builder. +func (b *NodePoolStatusListBuilder) Build() (list *NodePoolStatusList, err error) { + items := make([]*NodePoolStatus, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NodePoolStatusList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/node_pool_status_list_type_json.go b/clientapi/clustersmgmt/v1/node_pool_status_list_type_json.go new file mode 100644 index 00000000..3f9166ca --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_status_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePoolStatusList writes a list of values of the 'node_pool_status' type to +// the given writer. +func MarshalNodePoolStatusList(list []*NodePoolStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolStatusList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolStatusList writes a list of value of the 'node_pool_status' type to +// the given stream. +func WriteNodePoolStatusList(list []*NodePoolStatus, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNodePoolStatus(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodePoolStatusList reads a list of values of the 'node_pool_status' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodePoolStatusList(source interface{}) (items []*NodePoolStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodePoolStatusList(iterator) + err = iterator.Error + return +} + +// ReadNodePoolStatusList reads list of values of the ”node_pool_status' type from +// the given iterator. +func ReadNodePoolStatusList(iterator *jsoniter.Iterator) []*NodePoolStatus { + list := []*NodePoolStatus{} + for iterator.ReadArray() { + item := ReadNodePoolStatus(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/node_pool_status_type.go b/clientapi/clustersmgmt/v1/node_pool_status_type.go new file mode 100644 index 00000000..101f3ce5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_status_type.go @@ -0,0 +1,313 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolStatusKind is the name of the type used to represent objects +// of type 'node_pool_status'. +const NodePoolStatusKind = "NodePoolStatus" + +// NodePoolStatusLinkKind is the name of the type used to represent links +// to objects of type 'node_pool_status'. +const NodePoolStatusLinkKind = "NodePoolStatusLink" + +// NodePoolStatusNilKind is the name of the type used to nil references +// to objects of type 'node_pool_status'. +const NodePoolStatusNilKind = "NodePoolStatusNil" + +// NodePoolStatus represents the values of the 'node_pool_status' type. +// +// Representation of the status of a node pool. +type NodePoolStatus struct { + bitmap_ uint32 + id string + href string + currentReplicas int + message string + state *NodePoolState +} + +// Kind returns the name of the type of the object. +func (o *NodePoolStatus) Kind() string { + if o == nil { + return NodePoolStatusNilKind + } + if o.bitmap_&1 != 0 { + return NodePoolStatusLinkKind + } + return NodePoolStatusKind +} + +// Link returns true if this is a link. +func (o *NodePoolStatus) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *NodePoolStatus) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *NodePoolStatus) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *NodePoolStatus) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *NodePoolStatus) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NodePoolStatus) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CurrentReplicas returns the value of the 'current_replicas' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The current number of replicas for the node pool. +func (o *NodePoolStatus) CurrentReplicas() int { + if o != nil && o.bitmap_&8 != 0 { + return o.currentReplicas + } + return 0 +} + +// GetCurrentReplicas returns the value of the 'current_replicas' attribute and +// a flag indicating if the attribute has a value. +// +// The current number of replicas for the node pool. +func (o *NodePoolStatus) GetCurrentReplicas() (value int, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.currentReplicas + } + return +} + +// Message returns the value of the 'message' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Adds additional information about the NodePool status when the node pool doesn't reach the desired replicas. +func (o *NodePoolStatus) Message() string { + if o != nil && o.bitmap_&16 != 0 { + return o.message + } + return "" +} + +// GetMessage returns the value of the 'message' attribute and +// a flag indicating if the attribute has a value. +// +// Adds additional information about the NodePool status when the node pool doesn't reach the desired replicas. +func (o *NodePoolStatus) GetMessage() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.message + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The current state of the node pool +func (o *NodePoolStatus) State() *NodePoolState { + if o != nil && o.bitmap_&32 != 0 { + return o.state + } + return nil +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// The current state of the node pool +func (o *NodePoolStatus) GetState() (value *NodePoolState, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.state + } + return +} + +// NodePoolStatusListKind is the name of the type used to represent list of objects of +// type 'node_pool_status'. +const NodePoolStatusListKind = "NodePoolStatusList" + +// NodePoolStatusListLinkKind is the name of the type used to represent links to list +// of objects of type 'node_pool_status'. +const NodePoolStatusListLinkKind = "NodePoolStatusListLink" + +// NodePoolStatusNilKind is the name of the type used to nil lists of objects of +// type 'node_pool_status'. +const NodePoolStatusListNilKind = "NodePoolStatusListNil" + +// NodePoolStatusList is a list of values of the 'node_pool_status' type. +type NodePoolStatusList struct { + href string + link bool + items []*NodePoolStatus +} + +// Kind returns the name of the type of the object. +func (l *NodePoolStatusList) Kind() string { + if l == nil { + return NodePoolStatusListNilKind + } + if l.link { + return NodePoolStatusListLinkKind + } + return NodePoolStatusListKind +} + +// Link returns true iif this is a link. +func (l *NodePoolStatusList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *NodePoolStatusList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *NodePoolStatusList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *NodePoolStatusList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NodePoolStatusList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NodePoolStatusList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NodePoolStatusList) SetItems(items []*NodePoolStatus) { + l.items = items +} + +// Items returns the items of the list. +func (l *NodePoolStatusList) Items() []*NodePoolStatus { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NodePoolStatusList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NodePoolStatusList) Get(i int) *NodePoolStatus { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NodePoolStatusList) Slice() []*NodePoolStatus { + var slice []*NodePoolStatus + if l == nil { + slice = make([]*NodePoolStatus, 0) + } else { + slice = make([]*NodePoolStatus, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NodePoolStatusList) Each(f func(item *NodePoolStatus) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NodePoolStatusList) Range(f func(index int, item *NodePoolStatus) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/node_pool_status_type_json.go b/clientapi/clustersmgmt/v1/node_pool_status_type_json.go new file mode 100644 index 00000000..10b7f936 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_status_type_json.go @@ -0,0 +1,146 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePoolStatus writes a value of the 'node_pool_status' type to the given writer. +func MarshalNodePoolStatus(object *NodePoolStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolStatus(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolStatus writes a value of the 'node_pool_status' type to the given stream. +func WriteNodePoolStatus(object *NodePoolStatus, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(NodePoolStatusLinkKind) + } else { + stream.WriteString(NodePoolStatusKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("current_replicas") + stream.WriteInt(object.currentReplicas) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("message") + stream.WriteString(object.message) + count++ + } + present_ = object.bitmap_&32 != 0 && object.state != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + WriteNodePoolState(object.state, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalNodePoolStatus reads a value of the 'node_pool_status' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNodePoolStatus(source interface{}) (object *NodePoolStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNodePoolStatus(iterator) + err = iterator.Error + return +} + +// ReadNodePoolStatus reads a value of the 'node_pool_status' type from the given iterator. +func ReadNodePoolStatus(iterator *jsoniter.Iterator) *NodePoolStatus { + object := &NodePoolStatus{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == NodePoolStatusLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "current_replicas": + value := iterator.ReadInt() + object.currentReplicas = value + object.bitmap_ |= 8 + case "message": + value := iterator.ReadString() + object.message = value + object.bitmap_ |= 16 + case "state": + value := ReadNodePoolState(iterator) + object.state = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/node_pool_type.go b/clientapi/clustersmgmt/v1/node_pool_type.go new file mode 100644 index 00000000..e6d4c2eb --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_type.go @@ -0,0 +1,605 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolKind is the name of the type used to represent objects +// of type 'node_pool'. +const NodePoolKind = "NodePool" + +// NodePoolLinkKind is the name of the type used to represent links +// to objects of type 'node_pool'. +const NodePoolLinkKind = "NodePoolLink" + +// NodePoolNilKind is the name of the type used to nil references +// to objects of type 'node_pool'. +const NodePoolNilKind = "NodePoolNil" + +// NodePool represents the values of the 'node_pool' type. +// +// Representation of a node pool in a cluster. +type NodePool struct { + bitmap_ uint32 + id string + href string + awsNodePool *AWSNodePool + autoscaling *NodePoolAutoscaling + availabilityZone string + azureNodePool *AzureNodePool + kubeletConfigs []string + labels map[string]string + managementUpgrade *NodePoolManagementUpgrade + nodeDrainGracePeriod *Value + replicas int + status *NodePoolStatus + subnet string + taints []*Taint + tuningConfigs []string + version *Version + autoRepair bool +} + +// Kind returns the name of the type of the object. +func (o *NodePool) Kind() string { + if o == nil { + return NodePoolNilKind + } + if o.bitmap_&1 != 0 { + return NodePoolLinkKind + } + return NodePoolKind +} + +// Link returns true if this is a link. +func (o *NodePool) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *NodePool) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *NodePool) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *NodePool) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *NodePool) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NodePool) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AWSNodePool returns the value of the 'AWS_node_pool' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS specific parameters (Optional). +func (o *NodePool) AWSNodePool() *AWSNodePool { + if o != nil && o.bitmap_&8 != 0 { + return o.awsNodePool + } + return nil +} + +// GetAWSNodePool returns the value of the 'AWS_node_pool' attribute and +// a flag indicating if the attribute has a value. +// +// AWS specific parameters (Optional). +func (o *NodePool) GetAWSNodePool() (value *AWSNodePool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.awsNodePool + } + return +} + +// AutoRepair returns the value of the 'auto_repair' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Specifies whether health checks should be enabled for machines in the NodePool. +func (o *NodePool) AutoRepair() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.autoRepair + } + return false +} + +// GetAutoRepair returns the value of the 'auto_repair' attribute and +// a flag indicating if the attribute has a value. +// +// Specifies whether health checks should be enabled for machines in the NodePool. +func (o *NodePool) GetAutoRepair() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.autoRepair + } + return +} + +// Autoscaling returns the value of the 'autoscaling' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Details for auto-scaling the machine pool. +// Replicas and autoscaling cannot be used together. +func (o *NodePool) Autoscaling() *NodePoolAutoscaling { + if o != nil && o.bitmap_&32 != 0 { + return o.autoscaling + } + return nil +} + +// GetAutoscaling returns the value of the 'autoscaling' attribute and +// a flag indicating if the attribute has a value. +// +// Details for auto-scaling the machine pool. +// Replicas and autoscaling cannot be used together. +func (o *NodePool) GetAutoscaling() (value *NodePoolAutoscaling, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.autoscaling + } + return +} + +// AvailabilityZone returns the value of the 'availability_zone' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The availability zone upon which the node is created. +func (o *NodePool) AvailabilityZone() string { + if o != nil && o.bitmap_&64 != 0 { + return o.availabilityZone + } + return "" +} + +// GetAvailabilityZone returns the value of the 'availability_zone' attribute and +// a flag indicating if the attribute has a value. +// +// The availability zone upon which the node is created. +func (o *NodePool) GetAvailabilityZone() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.availabilityZone + } + return +} + +// AzureNodePool returns the value of the 'azure_node_pool' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Azure specific parameters. +func (o *NodePool) AzureNodePool() *AzureNodePool { + if o != nil && o.bitmap_&128 != 0 { + return o.azureNodePool + } + return nil +} + +// GetAzureNodePool returns the value of the 'azure_node_pool' attribute and +// a flag indicating if the attribute has a value. +// +// Azure specific parameters. +func (o *NodePool) GetAzureNodePool() (value *AzureNodePool, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.azureNodePool + } + return +} + +// KubeletConfigs returns the value of the 'kubelet_configs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The names of the KubeletConfigs for this node pool. +func (o *NodePool) KubeletConfigs() []string { + if o != nil && o.bitmap_&256 != 0 { + return o.kubeletConfigs + } + return nil +} + +// GetKubeletConfigs returns the value of the 'kubelet_configs' attribute and +// a flag indicating if the attribute has a value. +// +// The names of the KubeletConfigs for this node pool. +func (o *NodePool) GetKubeletConfigs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.kubeletConfigs + } + return +} + +// Labels returns the value of the 'labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The labels set on the Nodes created. +func (o *NodePool) Labels() map[string]string { + if o != nil && o.bitmap_&512 != 0 { + return o.labels + } + return nil +} + +// GetLabels returns the value of the 'labels' attribute and +// a flag indicating if the attribute has a value. +// +// The labels set on the Nodes created. +func (o *NodePool) GetLabels() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.labels + } + return +} + +// ManagementUpgrade returns the value of the 'management_upgrade' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Management parameters (Optional). +func (o *NodePool) ManagementUpgrade() *NodePoolManagementUpgrade { + if o != nil && o.bitmap_&1024 != 0 { + return o.managementUpgrade + } + return nil +} + +// GetManagementUpgrade returns the value of the 'management_upgrade' attribute and +// a flag indicating if the attribute has a value. +// +// Management parameters (Optional). +func (o *NodePool) GetManagementUpgrade() (value *NodePoolManagementUpgrade, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.managementUpgrade + } + return +} + +// NodeDrainGracePeriod returns the value of the 'node_drain_grace_period' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Time to wait for a NodePool to drain when it is upgraded or replaced before it is forcibly removed. +func (o *NodePool) NodeDrainGracePeriod() *Value { + if o != nil && o.bitmap_&2048 != 0 { + return o.nodeDrainGracePeriod + } + return nil +} + +// GetNodeDrainGracePeriod returns the value of the 'node_drain_grace_period' attribute and +// a flag indicating if the attribute has a value. +// +// Time to wait for a NodePool to drain when it is upgraded or replaced before it is forcibly removed. +func (o *NodePool) GetNodeDrainGracePeriod() (value *Value, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.nodeDrainGracePeriod + } + return +} + +// Replicas returns the value of the 'replicas' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The number of Machines (and Nodes) to create. +// Replicas and autoscaling cannot be used together. +func (o *NodePool) Replicas() int { + if o != nil && o.bitmap_&4096 != 0 { + return o.replicas + } + return 0 +} + +// GetReplicas returns the value of the 'replicas' attribute and +// a flag indicating if the attribute has a value. +// +// The number of Machines (and Nodes) to create. +// Replicas and autoscaling cannot be used together. +func (o *NodePool) GetReplicas() (value int, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.replicas + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// NodePool status. +func (o *NodePool) Status() *NodePoolStatus { + if o != nil && o.bitmap_&8192 != 0 { + return o.status + } + return nil +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// NodePool status. +func (o *NodePool) GetStatus() (value *NodePoolStatus, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.status + } + return +} + +// Subnet returns the value of the 'subnet' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The subnet upon which the nodes are created. +func (o *NodePool) Subnet() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.subnet + } + return "" +} + +// GetSubnet returns the value of the 'subnet' attribute and +// a flag indicating if the attribute has a value. +// +// The subnet upon which the nodes are created. +func (o *NodePool) GetSubnet() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.subnet + } + return +} + +// Taints returns the value of the 'taints' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The taints set on the Nodes created. +func (o *NodePool) Taints() []*Taint { + if o != nil && o.bitmap_&32768 != 0 { + return o.taints + } + return nil +} + +// GetTaints returns the value of the 'taints' attribute and +// a flag indicating if the attribute has a value. +// +// The taints set on the Nodes created. +func (o *NodePool) GetTaints() (value []*Taint, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.taints + } + return +} + +// TuningConfigs returns the value of the 'tuning_configs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The names of the tuning configs for this node pool. +func (o *NodePool) TuningConfigs() []string { + if o != nil && o.bitmap_&65536 != 0 { + return o.tuningConfigs + } + return nil +} + +// GetTuningConfigs returns the value of the 'tuning_configs' attribute and +// a flag indicating if the attribute has a value. +// +// The names of the tuning configs for this node pool. +func (o *NodePool) GetTuningConfigs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.tuningConfigs + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Version of the node pool. +func (o *NodePool) Version() *Version { + if o != nil && o.bitmap_&131072 != 0 { + return o.version + } + return nil +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +// +// Version of the node pool. +func (o *NodePool) GetVersion() (value *Version, ok bool) { + ok = o != nil && o.bitmap_&131072 != 0 + if ok { + value = o.version + } + return +} + +// NodePoolListKind is the name of the type used to represent list of objects of +// type 'node_pool'. +const NodePoolListKind = "NodePoolList" + +// NodePoolListLinkKind is the name of the type used to represent links to list +// of objects of type 'node_pool'. +const NodePoolListLinkKind = "NodePoolListLink" + +// NodePoolNilKind is the name of the type used to nil lists of objects of +// type 'node_pool'. +const NodePoolListNilKind = "NodePoolListNil" + +// NodePoolList is a list of values of the 'node_pool' type. +type NodePoolList struct { + href string + link bool + items []*NodePool +} + +// Kind returns the name of the type of the object. +func (l *NodePoolList) Kind() string { + if l == nil { + return NodePoolListNilKind + } + if l.link { + return NodePoolListLinkKind + } + return NodePoolListKind +} + +// Link returns true iif this is a link. +func (l *NodePoolList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *NodePoolList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *NodePoolList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *NodePoolList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NodePoolList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NodePoolList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NodePoolList) SetItems(items []*NodePool) { + l.items = items +} + +// Items returns the items of the list. +func (l *NodePoolList) Items() []*NodePool { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NodePoolList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NodePoolList) Get(i int) *NodePool { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NodePoolList) Slice() []*NodePool { + var slice []*NodePool + if l == nil { + slice = make([]*NodePool, 0) + } else { + slice = make([]*NodePool, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NodePoolList) Each(f func(item *NodePool) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NodePoolList) Range(f func(index int, item *NodePool) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/node_pool_type_json.go b/clientapi/clustersmgmt/v1/node_pool_type_json.go new file mode 100644 index 00000000..a4d15982 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_type_json.go @@ -0,0 +1,331 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePool writes a value of the 'node_pool' type to the given writer. +func MarshalNodePool(object *NodePool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePool(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePool writes a value of the 'node_pool' type to the given stream. +func WriteNodePool(object *NodePool, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(NodePoolLinkKind) + } else { + stream.WriteString(NodePoolKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.awsNodePool != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws_node_pool") + WriteAWSNodePool(object.awsNodePool, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("auto_repair") + stream.WriteBool(object.autoRepair) + count++ + } + present_ = object.bitmap_&32 != 0 && object.autoscaling != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("autoscaling") + WriteNodePoolAutoscaling(object.autoscaling, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zone") + stream.WriteString(object.availabilityZone) + count++ + } + present_ = object.bitmap_&128 != 0 && object.azureNodePool != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("azure_node_pool") + WriteAzureNodePool(object.azureNodePool, stream) + count++ + } + present_ = object.bitmap_&256 != 0 && object.kubeletConfigs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kubelet_configs") + WriteStringList(object.kubeletConfigs, stream) + count++ + } + present_ = object.bitmap_&512 != 0 && object.labels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("labels") + if object.labels != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.labels)) + i := 0 + for key := range object.labels { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.labels[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&1024 != 0 && object.managementUpgrade != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("management_upgrade") + WriteNodePoolManagementUpgrade(object.managementUpgrade, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.nodeDrainGracePeriod != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("node_drain_grace_period") + WriteValue(object.nodeDrainGracePeriod, stream) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("replicas") + stream.WriteInt(object.replicas) + count++ + } + present_ = object.bitmap_&8192 != 0 && object.status != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + WriteNodePoolStatus(object.status, stream) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnet") + stream.WriteString(object.subnet) + count++ + } + present_ = object.bitmap_&32768 != 0 && object.taints != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("taints") + WriteTaintList(object.taints, stream) + count++ + } + present_ = object.bitmap_&65536 != 0 && object.tuningConfigs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("tuning_configs") + WriteStringList(object.tuningConfigs, stream) + count++ + } + present_ = object.bitmap_&131072 != 0 && object.version != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + WriteVersion(object.version, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalNodePool reads a value of the 'node_pool' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNodePool(source interface{}) (object *NodePool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNodePool(iterator) + err = iterator.Error + return +} + +// ReadNodePool reads a value of the 'node_pool' type from the given iterator. +func ReadNodePool(iterator *jsoniter.Iterator) *NodePool { + object := &NodePool{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == NodePoolLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "aws_node_pool": + value := ReadAWSNodePool(iterator) + object.awsNodePool = value + object.bitmap_ |= 8 + case "auto_repair": + value := iterator.ReadBool() + object.autoRepair = value + object.bitmap_ |= 16 + case "autoscaling": + value := ReadNodePoolAutoscaling(iterator) + object.autoscaling = value + object.bitmap_ |= 32 + case "availability_zone": + value := iterator.ReadString() + object.availabilityZone = value + object.bitmap_ |= 64 + case "azure_node_pool": + value := ReadAzureNodePool(iterator) + object.azureNodePool = value + object.bitmap_ |= 128 + case "kubelet_configs": + value := ReadStringList(iterator) + object.kubeletConfigs = value + object.bitmap_ |= 256 + case "labels": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.labels = value + object.bitmap_ |= 512 + case "management_upgrade": + value := ReadNodePoolManagementUpgrade(iterator) + object.managementUpgrade = value + object.bitmap_ |= 1024 + case "node_drain_grace_period": + value := ReadValue(iterator) + object.nodeDrainGracePeriod = value + object.bitmap_ |= 2048 + case "replicas": + value := iterator.ReadInt() + object.replicas = value + object.bitmap_ |= 4096 + case "status": + value := ReadNodePoolStatus(iterator) + object.status = value + object.bitmap_ |= 8192 + case "subnet": + value := iterator.ReadString() + object.subnet = value + object.bitmap_ |= 16384 + case "taints": + value := ReadTaintList(iterator) + object.taints = value + object.bitmap_ |= 32768 + case "tuning_configs": + value := ReadStringList(iterator) + object.tuningConfigs = value + object.bitmap_ |= 65536 + case "version": + value := ReadVersion(iterator) + object.version = value + object.bitmap_ |= 131072 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_builder.go b/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_builder.go new file mode 100644 index 00000000..f5da2d54 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_builder.go @@ -0,0 +1,212 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// NodePoolUpgradePolicyBuilder contains the data and logic needed to build 'node_pool_upgrade_policy' objects. +// +// Representation of an upgrade policy that can be set for a node pool. +type NodePoolUpgradePolicyBuilder struct { + bitmap_ uint32 + id string + href string + clusterID string + creationTimestamp time.Time + lastUpdateTimestamp time.Time + nextRun time.Time + nodePoolID string + schedule string + scheduleType ScheduleType + state *UpgradePolicyStateBuilder + upgradeType UpgradeType + version string + enableMinorVersionUpgrades bool +} + +// NewNodePoolUpgradePolicy creates a new builder of 'node_pool_upgrade_policy' objects. +func NewNodePoolUpgradePolicy() *NodePoolUpgradePolicyBuilder { + return &NodePoolUpgradePolicyBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *NodePoolUpgradePolicyBuilder) Link(value bool) *NodePoolUpgradePolicyBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *NodePoolUpgradePolicyBuilder) ID(value string) *NodePoolUpgradePolicyBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *NodePoolUpgradePolicyBuilder) HREF(value string) *NodePoolUpgradePolicyBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NodePoolUpgradePolicyBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *NodePoolUpgradePolicyBuilder) ClusterID(value string) *NodePoolUpgradePolicyBuilder { + b.clusterID = value + b.bitmap_ |= 8 + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *NodePoolUpgradePolicyBuilder) CreationTimestamp(value time.Time) *NodePoolUpgradePolicyBuilder { + b.creationTimestamp = value + b.bitmap_ |= 16 + return b +} + +// EnableMinorVersionUpgrades sets the value of the 'enable_minor_version_upgrades' attribute to the given value. +func (b *NodePoolUpgradePolicyBuilder) EnableMinorVersionUpgrades(value bool) *NodePoolUpgradePolicyBuilder { + b.enableMinorVersionUpgrades = value + b.bitmap_ |= 32 + return b +} + +// LastUpdateTimestamp sets the value of the 'last_update_timestamp' attribute to the given value. +func (b *NodePoolUpgradePolicyBuilder) LastUpdateTimestamp(value time.Time) *NodePoolUpgradePolicyBuilder { + b.lastUpdateTimestamp = value + b.bitmap_ |= 64 + return b +} + +// NextRun sets the value of the 'next_run' attribute to the given value. +func (b *NodePoolUpgradePolicyBuilder) NextRun(value time.Time) *NodePoolUpgradePolicyBuilder { + b.nextRun = value + b.bitmap_ |= 128 + return b +} + +// NodePoolID sets the value of the 'node_pool_ID' attribute to the given value. +func (b *NodePoolUpgradePolicyBuilder) NodePoolID(value string) *NodePoolUpgradePolicyBuilder { + b.nodePoolID = value + b.bitmap_ |= 256 + return b +} + +// Schedule sets the value of the 'schedule' attribute to the given value. +func (b *NodePoolUpgradePolicyBuilder) Schedule(value string) *NodePoolUpgradePolicyBuilder { + b.schedule = value + b.bitmap_ |= 512 + return b +} + +// ScheduleType sets the value of the 'schedule_type' attribute to the given value. +// +// ScheduleType defines which type of scheduling should be used for the upgrade policy. +func (b *NodePoolUpgradePolicyBuilder) ScheduleType(value ScheduleType) *NodePoolUpgradePolicyBuilder { + b.scheduleType = value + b.bitmap_ |= 1024 + return b +} + +// State sets the value of the 'state' attribute to the given value. +// +// Representation of an upgrade policy state that that is set for a cluster. +func (b *NodePoolUpgradePolicyBuilder) State(value *UpgradePolicyStateBuilder) *NodePoolUpgradePolicyBuilder { + b.state = value + if value != nil { + b.bitmap_ |= 2048 + } else { + b.bitmap_ &^= 2048 + } + return b +} + +// UpgradeType sets the value of the 'upgrade_type' attribute to the given value. +// +// UpgradeType defines which type of upgrade should be used. +func (b *NodePoolUpgradePolicyBuilder) UpgradeType(value UpgradeType) *NodePoolUpgradePolicyBuilder { + b.upgradeType = value + b.bitmap_ |= 4096 + return b +} + +// Version sets the value of the 'version' attribute to the given value. +func (b *NodePoolUpgradePolicyBuilder) Version(value string) *NodePoolUpgradePolicyBuilder { + b.version = value + b.bitmap_ |= 8192 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NodePoolUpgradePolicyBuilder) Copy(object *NodePoolUpgradePolicy) *NodePoolUpgradePolicyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.clusterID = object.clusterID + b.creationTimestamp = object.creationTimestamp + b.enableMinorVersionUpgrades = object.enableMinorVersionUpgrades + b.lastUpdateTimestamp = object.lastUpdateTimestamp + b.nextRun = object.nextRun + b.nodePoolID = object.nodePoolID + b.schedule = object.schedule + b.scheduleType = object.scheduleType + if object.state != nil { + b.state = NewUpgradePolicyState().Copy(object.state) + } else { + b.state = nil + } + b.upgradeType = object.upgradeType + b.version = object.version + return b +} + +// Build creates a 'node_pool_upgrade_policy' object using the configuration stored in the builder. +func (b *NodePoolUpgradePolicyBuilder) Build() (object *NodePoolUpgradePolicy, err error) { + object = new(NodePoolUpgradePolicy) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.clusterID = b.clusterID + object.creationTimestamp = b.creationTimestamp + object.enableMinorVersionUpgrades = b.enableMinorVersionUpgrades + object.lastUpdateTimestamp = b.lastUpdateTimestamp + object.nextRun = b.nextRun + object.nodePoolID = b.nodePoolID + object.schedule = b.schedule + object.scheduleType = b.scheduleType + if b.state != nil { + object.state, err = b.state.Build() + if err != nil { + return + } + } + object.upgradeType = b.upgradeType + object.version = b.version + return +} diff --git a/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_list_builder.go b/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_list_builder.go new file mode 100644 index 00000000..63bb4b11 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodePoolUpgradePolicyListBuilder contains the data and logic needed to build +// 'node_pool_upgrade_policy' objects. +type NodePoolUpgradePolicyListBuilder struct { + items []*NodePoolUpgradePolicyBuilder +} + +// NewNodePoolUpgradePolicyList creates a new builder of 'node_pool_upgrade_policy' objects. +func NewNodePoolUpgradePolicyList() *NodePoolUpgradePolicyListBuilder { + return new(NodePoolUpgradePolicyListBuilder) +} + +// Items sets the items of the list. +func (b *NodePoolUpgradePolicyListBuilder) Items(values ...*NodePoolUpgradePolicyBuilder) *NodePoolUpgradePolicyListBuilder { + b.items = make([]*NodePoolUpgradePolicyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NodePoolUpgradePolicyListBuilder) 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 *NodePoolUpgradePolicyListBuilder) Copy(list *NodePoolUpgradePolicyList) *NodePoolUpgradePolicyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NodePoolUpgradePolicyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNodePoolUpgradePolicy().Copy(v) + } + } + return b +} + +// Build creates a list of 'node_pool_upgrade_policy' objects using the +// configuration stored in the builder. +func (b *NodePoolUpgradePolicyListBuilder) Build() (list *NodePoolUpgradePolicyList, err error) { + items := make([]*NodePoolUpgradePolicy, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NodePoolUpgradePolicyList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_list_type_json.go b/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_list_type_json.go new file mode 100644 index 00000000..7badaed9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePoolUpgradePolicyList writes a list of values of the 'node_pool_upgrade_policy' type to +// the given writer. +func MarshalNodePoolUpgradePolicyList(list []*NodePoolUpgradePolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolUpgradePolicyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolUpgradePolicyList writes a list of value of the 'node_pool_upgrade_policy' type to +// the given stream. +func WriteNodePoolUpgradePolicyList(list []*NodePoolUpgradePolicy, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNodePoolUpgradePolicy(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodePoolUpgradePolicyList reads a list of values of the 'node_pool_upgrade_policy' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodePoolUpgradePolicyList(source interface{}) (items []*NodePoolUpgradePolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodePoolUpgradePolicyList(iterator) + err = iterator.Error + return +} + +// ReadNodePoolUpgradePolicyList reads list of values of the ”node_pool_upgrade_policy' type from +// the given iterator. +func ReadNodePoolUpgradePolicyList(iterator *jsoniter.Iterator) []*NodePoolUpgradePolicy { + list := []*NodePoolUpgradePolicy{} + for iterator.ReadArray() { + item := ReadNodePoolUpgradePolicy(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_type.go b/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_type.go new file mode 100644 index 00000000..fa23f932 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_type.go @@ -0,0 +1,509 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// NodePoolUpgradePolicyKind is the name of the type used to represent objects +// of type 'node_pool_upgrade_policy'. +const NodePoolUpgradePolicyKind = "NodePoolUpgradePolicy" + +// NodePoolUpgradePolicyLinkKind is the name of the type used to represent links +// to objects of type 'node_pool_upgrade_policy'. +const NodePoolUpgradePolicyLinkKind = "NodePoolUpgradePolicyLink" + +// NodePoolUpgradePolicyNilKind is the name of the type used to nil references +// to objects of type 'node_pool_upgrade_policy'. +const NodePoolUpgradePolicyNilKind = "NodePoolUpgradePolicyNil" + +// NodePoolUpgradePolicy represents the values of the 'node_pool_upgrade_policy' type. +// +// Representation of an upgrade policy that can be set for a node pool. +type NodePoolUpgradePolicy struct { + bitmap_ uint32 + id string + href string + clusterID string + creationTimestamp time.Time + lastUpdateTimestamp time.Time + nextRun time.Time + nodePoolID string + schedule string + scheduleType ScheduleType + state *UpgradePolicyState + upgradeType UpgradeType + version string + enableMinorVersionUpgrades bool +} + +// Kind returns the name of the type of the object. +func (o *NodePoolUpgradePolicy) Kind() string { + if o == nil { + return NodePoolUpgradePolicyNilKind + } + if o.bitmap_&1 != 0 { + return NodePoolUpgradePolicyLinkKind + } + return NodePoolUpgradePolicyKind +} + +// Link returns true if this is a link. +func (o *NodePoolUpgradePolicy) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *NodePoolUpgradePolicy) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *NodePoolUpgradePolicy) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *NodePoolUpgradePolicy) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *NodePoolUpgradePolicy) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NodePoolUpgradePolicy) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster ID this upgrade policy for node pool is defined for. +func (o *NodePoolUpgradePolicy) ClusterID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster ID this upgrade policy for node pool is defined for. +func (o *NodePoolUpgradePolicy) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clusterID + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Timestamp for creation of resource. +func (o *NodePoolUpgradePolicy) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Timestamp for creation of resource. +func (o *NodePoolUpgradePolicy) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// EnableMinorVersionUpgrades returns the value of the 'enable_minor_version_upgrades' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if minor version upgrades are allowed for automatic upgrades (for manual it's always allowed). +func (o *NodePoolUpgradePolicy) EnableMinorVersionUpgrades() bool { + if o != nil && o.bitmap_&32 != 0 { + return o.enableMinorVersionUpgrades + } + return false +} + +// GetEnableMinorVersionUpgrades returns the value of the 'enable_minor_version_upgrades' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if minor version upgrades are allowed for automatic upgrades (for manual it's always allowed). +func (o *NodePoolUpgradePolicy) GetEnableMinorVersionUpgrades() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.enableMinorVersionUpgrades + } + return +} + +// LastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Timestamp for last update that happened to resource. +func (o *NodePoolUpgradePolicy) LastUpdateTimestamp() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.lastUpdateTimestamp + } + return time.Time{} +} + +// GetLastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Timestamp for last update that happened to resource. +func (o *NodePoolUpgradePolicy) GetLastUpdateTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.lastUpdateTimestamp + } + return +} + +// NextRun returns the value of the 'next_run' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Next time the upgrade should run. +func (o *NodePoolUpgradePolicy) NextRun() time.Time { + if o != nil && o.bitmap_&128 != 0 { + return o.nextRun + } + return time.Time{} +} + +// GetNextRun returns the value of the 'next_run' attribute and +// a flag indicating if the attribute has a value. +// +// Next time the upgrade should run. +func (o *NodePoolUpgradePolicy) GetNextRun() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.nextRun + } + return +} + +// NodePoolID returns the value of the 'node_pool_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Node Pool ID this upgrade policy is defined for. +func (o *NodePoolUpgradePolicy) NodePoolID() string { + if o != nil && o.bitmap_&256 != 0 { + return o.nodePoolID + } + return "" +} + +// GetNodePoolID returns the value of the 'node_pool_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Node Pool ID this upgrade policy is defined for. +func (o *NodePoolUpgradePolicy) GetNodePoolID() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.nodePoolID + } + return +} + +// Schedule returns the value of the 'schedule' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Schedule cron expression that defines automatic upgrade scheduling. +func (o *NodePoolUpgradePolicy) Schedule() string { + if o != nil && o.bitmap_&512 != 0 { + return o.schedule + } + return "" +} + +// GetSchedule returns the value of the 'schedule' attribute and +// a flag indicating if the attribute has a value. +// +// Schedule cron expression that defines automatic upgrade scheduling. +func (o *NodePoolUpgradePolicy) GetSchedule() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.schedule + } + return +} + +// ScheduleType returns the value of the 'schedule_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Schedule type of the upgrade. +func (o *NodePoolUpgradePolicy) ScheduleType() ScheduleType { + if o != nil && o.bitmap_&1024 != 0 { + return o.scheduleType + } + return ScheduleType("") +} + +// GetScheduleType returns the value of the 'schedule_type' attribute and +// a flag indicating if the attribute has a value. +// +// Schedule type of the upgrade. +func (o *NodePoolUpgradePolicy) GetScheduleType() (value ScheduleType, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.scheduleType + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// State of the upgrade policy for the node pool. +func (o *NodePoolUpgradePolicy) State() *UpgradePolicyState { + if o != nil && o.bitmap_&2048 != 0 { + return o.state + } + return nil +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// State of the upgrade policy for the node pool. +func (o *NodePoolUpgradePolicy) GetState() (value *UpgradePolicyState, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.state + } + return +} + +// UpgradeType returns the value of the 'upgrade_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Upgrade type of the node pool. +func (o *NodePoolUpgradePolicy) UpgradeType() UpgradeType { + if o != nil && o.bitmap_&4096 != 0 { + return o.upgradeType + } + return UpgradeType("") +} + +// GetUpgradeType returns the value of the 'upgrade_type' attribute and +// a flag indicating if the attribute has a value. +// +// Upgrade type of the node pool. +func (o *NodePoolUpgradePolicy) GetUpgradeType() (value UpgradeType, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.upgradeType + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Version is the desired upgrade version. +func (o *NodePoolUpgradePolicy) Version() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.version + } + return "" +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +// +// Version is the desired upgrade version. +func (o *NodePoolUpgradePolicy) GetVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.version + } + return +} + +// NodePoolUpgradePolicyListKind is the name of the type used to represent list of objects of +// type 'node_pool_upgrade_policy'. +const NodePoolUpgradePolicyListKind = "NodePoolUpgradePolicyList" + +// NodePoolUpgradePolicyListLinkKind is the name of the type used to represent links to list +// of objects of type 'node_pool_upgrade_policy'. +const NodePoolUpgradePolicyListLinkKind = "NodePoolUpgradePolicyListLink" + +// NodePoolUpgradePolicyNilKind is the name of the type used to nil lists of objects of +// type 'node_pool_upgrade_policy'. +const NodePoolUpgradePolicyListNilKind = "NodePoolUpgradePolicyListNil" + +// NodePoolUpgradePolicyList is a list of values of the 'node_pool_upgrade_policy' type. +type NodePoolUpgradePolicyList struct { + href string + link bool + items []*NodePoolUpgradePolicy +} + +// Kind returns the name of the type of the object. +func (l *NodePoolUpgradePolicyList) Kind() string { + if l == nil { + return NodePoolUpgradePolicyListNilKind + } + if l.link { + return NodePoolUpgradePolicyListLinkKind + } + return NodePoolUpgradePolicyListKind +} + +// Link returns true iif this is a link. +func (l *NodePoolUpgradePolicyList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *NodePoolUpgradePolicyList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *NodePoolUpgradePolicyList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *NodePoolUpgradePolicyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NodePoolUpgradePolicyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NodePoolUpgradePolicyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NodePoolUpgradePolicyList) SetItems(items []*NodePoolUpgradePolicy) { + l.items = items +} + +// Items returns the items of the list. +func (l *NodePoolUpgradePolicyList) Items() []*NodePoolUpgradePolicy { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NodePoolUpgradePolicyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NodePoolUpgradePolicyList) Get(i int) *NodePoolUpgradePolicy { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NodePoolUpgradePolicyList) Slice() []*NodePoolUpgradePolicy { + var slice []*NodePoolUpgradePolicy + if l == nil { + slice = make([]*NodePoolUpgradePolicy, 0) + } else { + slice = make([]*NodePoolUpgradePolicy, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NodePoolUpgradePolicyList) Each(f func(item *NodePoolUpgradePolicy) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NodePoolUpgradePolicyList) Range(f func(index int, item *NodePoolUpgradePolicy) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_type_json.go b/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_type_json.go new file mode 100644 index 00000000..69d01fa0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_pool_upgrade_policy_type_json.go @@ -0,0 +1,265 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodePoolUpgradePolicy writes a value of the 'node_pool_upgrade_policy' type to the given writer. +func MarshalNodePoolUpgradePolicy(object *NodePoolUpgradePolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodePoolUpgradePolicy(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodePoolUpgradePolicy writes a value of the 'node_pool_upgrade_policy' type to the given stream. +func WriteNodePoolUpgradePolicy(object *NodePoolUpgradePolicy, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(NodePoolUpgradePolicyLinkKind) + } else { + stream.WriteString(NodePoolUpgradePolicyKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enable_minor_version_upgrades") + stream.WriteBool(object.enableMinorVersionUpgrades) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_update_timestamp") + stream.WriteString((object.lastUpdateTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("next_run") + stream.WriteString((object.nextRun).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("node_pool_id") + stream.WriteString(object.nodePoolID) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("schedule") + stream.WriteString(object.schedule) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("schedule_type") + stream.WriteString(string(object.scheduleType)) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.state != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + WriteUpgradePolicyState(object.state, stream) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("upgrade_type") + stream.WriteString(string(object.upgradeType)) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + stream.WriteString(object.version) + } + stream.WriteObjectEnd() +} + +// UnmarshalNodePoolUpgradePolicy reads a value of the 'node_pool_upgrade_policy' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNodePoolUpgradePolicy(source interface{}) (object *NodePoolUpgradePolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNodePoolUpgradePolicy(iterator) + err = iterator.Error + return +} + +// ReadNodePoolUpgradePolicy reads a value of the 'node_pool_upgrade_policy' type from the given iterator. +func ReadNodePoolUpgradePolicy(iterator *jsoniter.Iterator) *NodePoolUpgradePolicy { + object := &NodePoolUpgradePolicy{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == NodePoolUpgradePolicyLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 8 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 16 + case "enable_minor_version_upgrades": + value := iterator.ReadBool() + object.enableMinorVersionUpgrades = value + object.bitmap_ |= 32 + case "last_update_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastUpdateTimestamp = value + object.bitmap_ |= 64 + case "next_run": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.nextRun = value + object.bitmap_ |= 128 + case "node_pool_id": + value := iterator.ReadString() + object.nodePoolID = value + object.bitmap_ |= 256 + case "schedule": + value := iterator.ReadString() + object.schedule = value + object.bitmap_ |= 512 + case "schedule_type": + text := iterator.ReadString() + value := ScheduleType(text) + object.scheduleType = value + object.bitmap_ |= 1024 + case "state": + value := ReadUpgradePolicyState(iterator) + object.state = value + object.bitmap_ |= 2048 + case "upgrade_type": + text := iterator.ReadString() + value := UpgradeType(text) + object.upgradeType = value + object.bitmap_ |= 4096 + case "version": + value := iterator.ReadString() + object.version = value + object.bitmap_ |= 8192 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/node_type_list_type_json.go b/clientapi/clustersmgmt/v1/node_type_list_type_json.go new file mode 100644 index 00000000..e8213ecf --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_type_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodeTypeList writes a list of values of the 'node_type' type to +// the given writer. +func MarshalNodeTypeList(list []NodeType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodeTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodeTypeList writes a list of value of the 'node_type' type to +// the given stream. +func WriteNodeTypeList(list []NodeType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodeTypeList reads a list of values of the 'node_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodeTypeList(source interface{}) (items []NodeType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodeTypeList(iterator) + err = iterator.Error + return +} + +// ReadNodeTypeList reads list of values of the ”node_type' type from +// the given iterator. +func ReadNodeTypeList(iterator *jsoniter.Iterator) []NodeType { + list := []NodeType{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := NodeType(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/node_type_type.go b/clientapi/clustersmgmt/v1/node_type_type.go new file mode 100644 index 00000000..878f0104 --- /dev/null +++ b/clientapi/clustersmgmt/v1/node_type_type.go @@ -0,0 +1,32 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodeType represents the values of the 'node_type' enumerated type. +type NodeType string + +const ( + // Compute. + NodeTypeCompute NodeType = "compute" + // Infra. + NodeTypeInfra NodeType = "infra" + // Master. + NodeTypeMaster NodeType = "master" +) diff --git a/clientapi/clustersmgmt/v1/nodes_info_builder.go b/clientapi/clustersmgmt/v1/nodes_info_builder.go new file mode 100644 index 00000000..a5049767 --- /dev/null +++ b/clientapi/clustersmgmt/v1/nodes_info_builder.go @@ -0,0 +1,79 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodesInfoBuilder contains the data and logic needed to build 'nodes_info' objects. +// +// Provides information about the nodes in the cluster. +type NodesInfoBuilder struct { + bitmap_ uint32 + nodes []*NodeInfoBuilder +} + +// NewNodesInfo creates a new builder of 'nodes_info' objects. +func NewNodesInfo() *NodesInfoBuilder { + return &NodesInfoBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NodesInfoBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Nodes sets the value of the 'nodes' attribute to the given values. +func (b *NodesInfoBuilder) Nodes(values ...*NodeInfoBuilder) *NodesInfoBuilder { + b.nodes = make([]*NodeInfoBuilder, len(values)) + copy(b.nodes, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NodesInfoBuilder) Copy(object *NodesInfo) *NodesInfoBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.nodes != nil { + b.nodes = make([]*NodeInfoBuilder, len(object.nodes)) + for i, v := range object.nodes { + b.nodes[i] = NewNodeInfo().Copy(v) + } + } else { + b.nodes = nil + } + return b +} + +// Build creates a 'nodes_info' object using the configuration stored in the builder. +func (b *NodesInfoBuilder) Build() (object *NodesInfo, err error) { + object = new(NodesInfo) + object.bitmap_ = b.bitmap_ + if b.nodes != nil { + object.nodes = make([]*NodeInfo, len(b.nodes)) + for i, v := range b.nodes { + object.nodes[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/nodes_info_list_builder.go b/clientapi/clustersmgmt/v1/nodes_info_list_builder.go new file mode 100644 index 00000000..4d5ef532 --- /dev/null +++ b/clientapi/clustersmgmt/v1/nodes_info_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodesInfoListBuilder contains the data and logic needed to build +// 'nodes_info' objects. +type NodesInfoListBuilder struct { + items []*NodesInfoBuilder +} + +// NewNodesInfoList creates a new builder of 'nodes_info' objects. +func NewNodesInfoList() *NodesInfoListBuilder { + return new(NodesInfoListBuilder) +} + +// Items sets the items of the list. +func (b *NodesInfoListBuilder) Items(values ...*NodesInfoBuilder) *NodesInfoListBuilder { + b.items = make([]*NodesInfoBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NodesInfoListBuilder) 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 *NodesInfoListBuilder) Copy(list *NodesInfoList) *NodesInfoListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NodesInfoBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNodesInfo().Copy(v) + } + } + return b +} + +// Build creates a list of 'nodes_info' objects using the +// configuration stored in the builder. +func (b *NodesInfoListBuilder) Build() (list *NodesInfoList, err error) { + items := make([]*NodesInfo, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NodesInfoList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/nodes_info_list_type_json.go b/clientapi/clustersmgmt/v1/nodes_info_list_type_json.go new file mode 100644 index 00000000..489f2b2a --- /dev/null +++ b/clientapi/clustersmgmt/v1/nodes_info_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodesInfoList writes a list of values of the 'nodes_info' type to +// the given writer. +func MarshalNodesInfoList(list []*NodesInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodesInfoList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodesInfoList writes a list of value of the 'nodes_info' type to +// the given stream. +func WriteNodesInfoList(list []*NodesInfo, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNodesInfo(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNodesInfoList reads a list of values of the 'nodes_info' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNodesInfoList(source interface{}) (items []*NodesInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNodesInfoList(iterator) + err = iterator.Error + return +} + +// ReadNodesInfoList reads list of values of the ”nodes_info' type from +// the given iterator. +func ReadNodesInfoList(iterator *jsoniter.Iterator) []*NodesInfo { + list := []*NodesInfo{} + for iterator.ReadArray() { + item := ReadNodesInfo(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/nodes_info_type.go b/clientapi/clustersmgmt/v1/nodes_info_type.go new file mode 100644 index 00000000..513c24eb --- /dev/null +++ b/clientapi/clustersmgmt/v1/nodes_info_type.go @@ -0,0 +1,161 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// NodesInfo represents the values of the 'nodes_info' type. +// +// Provides information about the nodes in the cluster. +type NodesInfo struct { + bitmap_ uint32 + nodes []*NodeInfo +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *NodesInfo) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Nodes returns the value of the 'nodes' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *NodesInfo) Nodes() []*NodeInfo { + if o != nil && o.bitmap_&1 != 0 { + return o.nodes + } + return nil +} + +// GetNodes returns the value of the 'nodes' attribute and +// a flag indicating if the attribute has a value. +func (o *NodesInfo) GetNodes() (value []*NodeInfo, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.nodes + } + return +} + +// NodesInfoListKind is the name of the type used to represent list of objects of +// type 'nodes_info'. +const NodesInfoListKind = "NodesInfoList" + +// NodesInfoListLinkKind is the name of the type used to represent links to list +// of objects of type 'nodes_info'. +const NodesInfoListLinkKind = "NodesInfoListLink" + +// NodesInfoNilKind is the name of the type used to nil lists of objects of +// type 'nodes_info'. +const NodesInfoListNilKind = "NodesInfoListNil" + +// NodesInfoList is a list of values of the 'nodes_info' type. +type NodesInfoList struct { + href string + link bool + items []*NodesInfo +} + +// Len returns the length of the list. +func (l *NodesInfoList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NodesInfoList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NodesInfoList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NodesInfoList) SetItems(items []*NodesInfo) { + l.items = items +} + +// Items returns the items of the list. +func (l *NodesInfoList) Items() []*NodesInfo { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NodesInfoList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NodesInfoList) Get(i int) *NodesInfo { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NodesInfoList) Slice() []*NodesInfo { + var slice []*NodesInfo + if l == nil { + slice = make([]*NodesInfo, 0) + } else { + slice = make([]*NodesInfo, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NodesInfoList) Each(f func(item *NodesInfo) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NodesInfoList) Range(f func(index int, item *NodesInfo) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/nodes_info_type_json.go b/clientapi/clustersmgmt/v1/nodes_info_type_json.go new file mode 100644 index 00000000..8635b114 --- /dev/null +++ b/clientapi/clustersmgmt/v1/nodes_info_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNodesInfo writes a value of the 'nodes_info' type to the given writer. +func MarshalNodesInfo(object *NodesInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNodesInfo(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNodesInfo writes a value of the 'nodes_info' type to the given stream. +func WriteNodesInfo(object *NodesInfo, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.nodes != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("nodes") + WriteNodeInfoList(object.nodes, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalNodesInfo reads a value of the 'nodes_info' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNodesInfo(source interface{}) (object *NodesInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNodesInfo(iterator) + err = iterator.Error + return +} + +// ReadNodesInfo reads a value of the 'nodes_info' type from the given iterator. +func ReadNodesInfo(iterator *jsoniter.Iterator) *NodesInfo { + object := &NodesInfo{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "nodes": + value := ReadNodeInfoList(iterator) + object.nodes = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/oidc_config_builder.go b/clientapi/clustersmgmt/v1/oidc_config_builder.go new file mode 100644 index 00000000..9a71da37 --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_config_builder.go @@ -0,0 +1,167 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// OidcConfigBuilder contains the data and logic needed to build 'oidc_config' objects. +// +// Contains the necessary attributes to support oidc configuration hosting under Red Hat or registering a Customer's byo oidc config. +type OidcConfigBuilder struct { + bitmap_ uint32 + href string + id string + creationTimestamp time.Time + installerRoleArn string + issuerUrl string + lastUpdateTimestamp time.Time + lastUsedTimestamp time.Time + organizationId string + secretArn string + managed bool + reusable bool +} + +// NewOidcConfig creates a new builder of 'oidc_config' objects. +func NewOidcConfig() *OidcConfigBuilder { + return &OidcConfigBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *OidcConfigBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// HREF sets the value of the 'HREF' attribute to the given value. +func (b *OidcConfigBuilder) HREF(value string) *OidcConfigBuilder { + b.href = value + b.bitmap_ |= 1 + return b +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *OidcConfigBuilder) ID(value string) *OidcConfigBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *OidcConfigBuilder) CreationTimestamp(value time.Time) *OidcConfigBuilder { + b.creationTimestamp = value + b.bitmap_ |= 4 + return b +} + +// InstallerRoleArn sets the value of the 'installer_role_arn' attribute to the given value. +func (b *OidcConfigBuilder) InstallerRoleArn(value string) *OidcConfigBuilder { + b.installerRoleArn = value + b.bitmap_ |= 8 + return b +} + +// IssuerUrl sets the value of the 'issuer_url' attribute to the given value. +func (b *OidcConfigBuilder) IssuerUrl(value string) *OidcConfigBuilder { + b.issuerUrl = value + b.bitmap_ |= 16 + return b +} + +// LastUpdateTimestamp sets the value of the 'last_update_timestamp' attribute to the given value. +func (b *OidcConfigBuilder) LastUpdateTimestamp(value time.Time) *OidcConfigBuilder { + b.lastUpdateTimestamp = value + b.bitmap_ |= 32 + return b +} + +// LastUsedTimestamp sets the value of the 'last_used_timestamp' attribute to the given value. +func (b *OidcConfigBuilder) LastUsedTimestamp(value time.Time) *OidcConfigBuilder { + b.lastUsedTimestamp = value + b.bitmap_ |= 64 + return b +} + +// Managed sets the value of the 'managed' attribute to the given value. +func (b *OidcConfigBuilder) Managed(value bool) *OidcConfigBuilder { + b.managed = value + b.bitmap_ |= 128 + return b +} + +// OrganizationId sets the value of the 'organization_id' attribute to the given value. +func (b *OidcConfigBuilder) OrganizationId(value string) *OidcConfigBuilder { + b.organizationId = value + b.bitmap_ |= 256 + return b +} + +// Reusable sets the value of the 'reusable' attribute to the given value. +func (b *OidcConfigBuilder) Reusable(value bool) *OidcConfigBuilder { + b.reusable = value + b.bitmap_ |= 512 + return b +} + +// SecretArn sets the value of the 'secret_arn' attribute to the given value. +func (b *OidcConfigBuilder) SecretArn(value string) *OidcConfigBuilder { + b.secretArn = value + b.bitmap_ |= 1024 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *OidcConfigBuilder) Copy(object *OidcConfig) *OidcConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.href = object.href + b.id = object.id + b.creationTimestamp = object.creationTimestamp + b.installerRoleArn = object.installerRoleArn + b.issuerUrl = object.issuerUrl + b.lastUpdateTimestamp = object.lastUpdateTimestamp + b.lastUsedTimestamp = object.lastUsedTimestamp + b.managed = object.managed + b.organizationId = object.organizationId + b.reusable = object.reusable + b.secretArn = object.secretArn + return b +} + +// Build creates a 'oidc_config' object using the configuration stored in the builder. +func (b *OidcConfigBuilder) Build() (object *OidcConfig, err error) { + object = new(OidcConfig) + object.bitmap_ = b.bitmap_ + object.href = b.href + object.id = b.id + object.creationTimestamp = b.creationTimestamp + object.installerRoleArn = b.installerRoleArn + object.issuerUrl = b.issuerUrl + object.lastUpdateTimestamp = b.lastUpdateTimestamp + object.lastUsedTimestamp = b.lastUsedTimestamp + object.managed = b.managed + object.organizationId = b.organizationId + object.reusable = b.reusable + object.secretArn = b.secretArn + return +} diff --git a/clientapi/clustersmgmt/v1/oidc_config_list_builder.go b/clientapi/clustersmgmt/v1/oidc_config_list_builder.go new file mode 100644 index 00000000..cde2b3fa --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_config_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OidcConfigListBuilder contains the data and logic needed to build +// 'oidc_config' objects. +type OidcConfigListBuilder struct { + items []*OidcConfigBuilder +} + +// NewOidcConfigList creates a new builder of 'oidc_config' objects. +func NewOidcConfigList() *OidcConfigListBuilder { + return new(OidcConfigListBuilder) +} + +// Items sets the items of the list. +func (b *OidcConfigListBuilder) Items(values ...*OidcConfigBuilder) *OidcConfigListBuilder { + b.items = make([]*OidcConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *OidcConfigListBuilder) 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 *OidcConfigListBuilder) Copy(list *OidcConfigList) *OidcConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*OidcConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewOidcConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'oidc_config' objects using the +// configuration stored in the builder. +func (b *OidcConfigListBuilder) Build() (list *OidcConfigList, err error) { + items := make([]*OidcConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(OidcConfigList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/oidc_config_list_type_json.go b/clientapi/clustersmgmt/v1/oidc_config_list_type_json.go new file mode 100644 index 00000000..664d79f5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_config_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOidcConfigList writes a list of values of the 'oidc_config' type to +// the given writer. +func MarshalOidcConfigList(list []*OidcConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOidcConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOidcConfigList writes a list of value of the 'oidc_config' type to +// the given stream. +func WriteOidcConfigList(list []*OidcConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteOidcConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalOidcConfigList reads a list of values of the 'oidc_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalOidcConfigList(source interface{}) (items []*OidcConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadOidcConfigList(iterator) + err = iterator.Error + return +} + +// ReadOidcConfigList reads list of values of the ”oidc_config' type from +// the given iterator. +func ReadOidcConfigList(iterator *jsoniter.Iterator) []*OidcConfig { + list := []*OidcConfig{} + for iterator.ReadArray() { + item := ReadOidcConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/oidc_config_type.go b/clientapi/clustersmgmt/v1/oidc_config_type.go new file mode 100644 index 00000000..7223de49 --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_config_type.go @@ -0,0 +1,409 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// OidcConfig represents the values of the 'oidc_config' type. +// +// Contains the necessary attributes to support oidc configuration hosting under Red Hat or registering a Customer's byo oidc config. +type OidcConfig struct { + bitmap_ uint32 + href string + id string + creationTimestamp time.Time + installerRoleArn string + issuerUrl string + lastUpdateTimestamp time.Time + lastUsedTimestamp time.Time + organizationId string + secretArn string + managed bool + reusable bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *OidcConfig) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// HREF returns the value of the 'HREF' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HREF for the oidc config, filled in response. +func (o *OidcConfig) HREF() string { + if o != nil && o.bitmap_&1 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the value of the 'HREF' attribute and +// a flag indicating if the attribute has a value. +// +// HREF for the oidc config, filled in response. +func (o *OidcConfig) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.href + } + return +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ID for the oidc config, filled in response. +func (o *OidcConfig) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// ID for the oidc config, filled in response. +func (o *OidcConfig) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Creation timestamp, filled in response. +func (o *OidcConfig) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&4 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Creation timestamp, filled in response. +func (o *OidcConfig) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// InstallerRoleArn returns the value of the 'installer_role_arn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN of the AWS role to assume when installing the cluster as to reveal the secret, supplied in request. It is only to be used in Unmanaged Oidc Config. +func (o *OidcConfig) InstallerRoleArn() string { + if o != nil && o.bitmap_&8 != 0 { + return o.installerRoleArn + } + return "" +} + +// GetInstallerRoleArn returns the value of the 'installer_role_arn' attribute and +// a flag indicating if the attribute has a value. +// +// ARN of the AWS role to assume when installing the cluster as to reveal the secret, supplied in request. It is only to be used in Unmanaged Oidc Config. +func (o *OidcConfig) GetInstallerRoleArn() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.installerRoleArn + } + return +} + +// IssuerUrl returns the value of the 'issuer_url' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Issuer URL, filled in response when Managed and supplied in Unmanaged. +func (o *OidcConfig) IssuerUrl() string { + if o != nil && o.bitmap_&16 != 0 { + return o.issuerUrl + } + return "" +} + +// GetIssuerUrl returns the value of the 'issuer_url' attribute and +// a flag indicating if the attribute has a value. +// +// Issuer URL, filled in response when Managed and supplied in Unmanaged. +func (o *OidcConfig) GetIssuerUrl() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.issuerUrl + } + return +} + +// LastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Last update timestamp, filled when patching a valid attribute of this oidc config. +func (o *OidcConfig) LastUpdateTimestamp() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.lastUpdateTimestamp + } + return time.Time{} +} + +// GetLastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Last update timestamp, filled when patching a valid attribute of this oidc config. +func (o *OidcConfig) GetLastUpdateTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.lastUpdateTimestamp + } + return +} + +// LastUsedTimestamp returns the value of the 'last_used_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Last used timestamp, filled by the latest cluster that used this oidc config. +func (o *OidcConfig) LastUsedTimestamp() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.lastUsedTimestamp + } + return time.Time{} +} + +// GetLastUsedTimestamp returns the value of the 'last_used_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Last used timestamp, filled by the latest cluster that used this oidc config. +func (o *OidcConfig) GetLastUsedTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.lastUsedTimestamp + } + return +} + +// Managed returns the value of the 'managed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates whether it is Managed or Unmanaged (Customer hosted). +func (o *OidcConfig) Managed() bool { + if o != nil && o.bitmap_&128 != 0 { + return o.managed + } + return false +} + +// GetManaged returns the value of the 'managed' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates whether it is Managed or Unmanaged (Customer hosted). +func (o *OidcConfig) GetManaged() (value bool, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.managed + } + return +} + +// OrganizationId returns the value of the 'organization_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Organization ID, filled in response respecting token provided. +func (o *OidcConfig) OrganizationId() string { + if o != nil && o.bitmap_&256 != 0 { + return o.organizationId + } + return "" +} + +// GetOrganizationId returns the value of the 'organization_id' attribute and +// a flag indicating if the attribute has a value. +// +// Organization ID, filled in response respecting token provided. +func (o *OidcConfig) GetOrganizationId() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.organizationId + } + return +} + +// Reusable returns the value of the 'reusable' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates whether the Oidc Config can be reused. +func (o *OidcConfig) Reusable() bool { + if o != nil && o.bitmap_&512 != 0 { + return o.reusable + } + return false +} + +// GetReusable returns the value of the 'reusable' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates whether the Oidc Config can be reused. +func (o *OidcConfig) GetReusable() (value bool, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.reusable + } + return +} + +// SecretArn returns the value of the 'secret_arn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Secrets Manager ARN for the OIDC private key, supplied in request. It is only to be used in Unmanaged Oidc Config. +func (o *OidcConfig) SecretArn() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.secretArn + } + return "" +} + +// GetSecretArn returns the value of the 'secret_arn' attribute and +// a flag indicating if the attribute has a value. +// +// Secrets Manager ARN for the OIDC private key, supplied in request. It is only to be used in Unmanaged Oidc Config. +func (o *OidcConfig) GetSecretArn() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.secretArn + } + return +} + +// OidcConfigListKind is the name of the type used to represent list of objects of +// type 'oidc_config'. +const OidcConfigListKind = "OidcConfigList" + +// OidcConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'oidc_config'. +const OidcConfigListLinkKind = "OidcConfigListLink" + +// OidcConfigNilKind is the name of the type used to nil lists of objects of +// type 'oidc_config'. +const OidcConfigListNilKind = "OidcConfigListNil" + +// OidcConfigList is a list of values of the 'oidc_config' type. +type OidcConfigList struct { + href string + link bool + items []*OidcConfig +} + +// Len returns the length of the list. +func (l *OidcConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *OidcConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *OidcConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *OidcConfigList) SetItems(items []*OidcConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *OidcConfigList) Items() []*OidcConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *OidcConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *OidcConfigList) Get(i int) *OidcConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *OidcConfigList) Slice() []*OidcConfig { + var slice []*OidcConfig + if l == nil { + slice = make([]*OidcConfig, 0) + } else { + slice = make([]*OidcConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *OidcConfigList) Each(f func(item *OidcConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *OidcConfigList) Range(f func(index int, item *OidcConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/oidc_config_type_json.go b/clientapi/clustersmgmt/v1/oidc_config_type_json.go new file mode 100644 index 00000000..addfb434 --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_config_type_json.go @@ -0,0 +1,229 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOidcConfig writes a value of the 'oidc_config' type to the given writer. +func MarshalOidcConfig(object *OidcConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOidcConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOidcConfig writes a value of the 'oidc_config' type to the given stream. +func WriteOidcConfig(object *OidcConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("installer_role_arn") + stream.WriteString(object.installerRoleArn) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("issuer_url") + stream.WriteString(object.issuerUrl) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_update_timestamp") + stream.WriteString((object.lastUpdateTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_used_timestamp") + stream.WriteString((object.lastUsedTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed") + stream.WriteBool(object.managed) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization_id") + stream.WriteString(object.organizationId) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("reusable") + stream.WriteBool(object.reusable) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("secret_arn") + stream.WriteString(object.secretArn) + } + stream.WriteObjectEnd() +} + +// UnmarshalOidcConfig reads a value of the 'oidc_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalOidcConfig(source interface{}) (object *OidcConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadOidcConfig(iterator) + err = iterator.Error + return +} + +// ReadOidcConfig reads a value of the 'oidc_config' type from the given iterator. +func ReadOidcConfig(iterator *jsoniter.Iterator) *OidcConfig { + object := &OidcConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 1 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 2 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 4 + case "installer_role_arn": + value := iterator.ReadString() + object.installerRoleArn = value + object.bitmap_ |= 8 + case "issuer_url": + value := iterator.ReadString() + object.issuerUrl = value + object.bitmap_ |= 16 + case "last_update_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastUpdateTimestamp = value + object.bitmap_ |= 32 + case "last_used_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastUsedTimestamp = value + object.bitmap_ |= 64 + case "managed": + value := iterator.ReadBool() + object.managed = value + object.bitmap_ |= 128 + case "organization_id": + value := iterator.ReadString() + object.organizationId = value + object.bitmap_ |= 256 + case "reusable": + value := iterator.ReadBool() + object.reusable = value + object.bitmap_ |= 512 + case "secret_arn": + value := iterator.ReadString() + object.secretArn = value + object.bitmap_ |= 1024 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/oidc_thumbprint_builder.go b/clientapi/clustersmgmt/v1/oidc_thumbprint_builder.go new file mode 100644 index 00000000..0aa39f00 --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_thumbprint_builder.go @@ -0,0 +1,103 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OidcThumbprintBuilder contains the data and logic needed to build 'oidc_thumbprint' objects. +// +// Contains the necessary attributes to support oidc configuration thumbprint operations such as fetching/creation of a thumbprint +type OidcThumbprintBuilder struct { + bitmap_ uint32 + href string + clusterId string + kind string + oidcConfigId string + thumbprint string +} + +// NewOidcThumbprint creates a new builder of 'oidc_thumbprint' objects. +func NewOidcThumbprint() *OidcThumbprintBuilder { + return &OidcThumbprintBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *OidcThumbprintBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// HREF sets the value of the 'HREF' attribute to the given value. +func (b *OidcThumbprintBuilder) HREF(value string) *OidcThumbprintBuilder { + b.href = value + b.bitmap_ |= 1 + return b +} + +// ClusterId sets the value of the 'cluster_id' attribute to the given value. +func (b *OidcThumbprintBuilder) ClusterId(value string) *OidcThumbprintBuilder { + b.clusterId = value + b.bitmap_ |= 2 + return b +} + +// Kind sets the value of the 'kind' attribute to the given value. +func (b *OidcThumbprintBuilder) Kind(value string) *OidcThumbprintBuilder { + b.kind = value + b.bitmap_ |= 4 + return b +} + +// OidcConfigId sets the value of the 'oidc_config_id' attribute to the given value. +func (b *OidcThumbprintBuilder) OidcConfigId(value string) *OidcThumbprintBuilder { + b.oidcConfigId = value + b.bitmap_ |= 8 + return b +} + +// Thumbprint sets the value of the 'thumbprint' attribute to the given value. +func (b *OidcThumbprintBuilder) Thumbprint(value string) *OidcThumbprintBuilder { + b.thumbprint = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *OidcThumbprintBuilder) Copy(object *OidcThumbprint) *OidcThumbprintBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.href = object.href + b.clusterId = object.clusterId + b.kind = object.kind + b.oidcConfigId = object.oidcConfigId + b.thumbprint = object.thumbprint + return b +} + +// Build creates a 'oidc_thumbprint' object using the configuration stored in the builder. +func (b *OidcThumbprintBuilder) Build() (object *OidcThumbprint, err error) { + object = new(OidcThumbprint) + object.bitmap_ = b.bitmap_ + object.href = b.href + object.clusterId = b.clusterId + object.kind = b.kind + object.oidcConfigId = b.oidcConfigId + object.thumbprint = b.thumbprint + return +} diff --git a/clientapi/clustersmgmt/v1/oidc_thumbprint_input_builder.go b/clientapi/clustersmgmt/v1/oidc_thumbprint_input_builder.go new file mode 100644 index 00000000..0c290a79 --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_thumbprint_input_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OidcThumbprintInputBuilder contains the data and logic needed to build 'oidc_thumbprint_input' objects. +// +// Contains the necessary attributes to fetch an OIDC Configuration thumbprint +type OidcThumbprintInputBuilder struct { + bitmap_ uint32 + clusterId string + oidcConfigId string +} + +// NewOidcThumbprintInput creates a new builder of 'oidc_thumbprint_input' objects. +func NewOidcThumbprintInput() *OidcThumbprintInputBuilder { + return &OidcThumbprintInputBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *OidcThumbprintInputBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ClusterId sets the value of the 'cluster_id' attribute to the given value. +func (b *OidcThumbprintInputBuilder) ClusterId(value string) *OidcThumbprintInputBuilder { + b.clusterId = value + b.bitmap_ |= 1 + return b +} + +// OidcConfigId sets the value of the 'oidc_config_id' attribute to the given value. +func (b *OidcThumbprintInputBuilder) OidcConfigId(value string) *OidcThumbprintInputBuilder { + b.oidcConfigId = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *OidcThumbprintInputBuilder) Copy(object *OidcThumbprintInput) *OidcThumbprintInputBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.clusterId = object.clusterId + b.oidcConfigId = object.oidcConfigId + return b +} + +// Build creates a 'oidc_thumbprint_input' object using the configuration stored in the builder. +func (b *OidcThumbprintInputBuilder) Build() (object *OidcThumbprintInput, err error) { + object = new(OidcThumbprintInput) + object.bitmap_ = b.bitmap_ + object.clusterId = b.clusterId + object.oidcConfigId = b.oidcConfigId + return +} diff --git a/clientapi/clustersmgmt/v1/oidc_thumbprint_input_list_builder.go b/clientapi/clustersmgmt/v1/oidc_thumbprint_input_list_builder.go new file mode 100644 index 00000000..9f1d4c75 --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_thumbprint_input_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OidcThumbprintInputListBuilder contains the data and logic needed to build +// 'oidc_thumbprint_input' objects. +type OidcThumbprintInputListBuilder struct { + items []*OidcThumbprintInputBuilder +} + +// NewOidcThumbprintInputList creates a new builder of 'oidc_thumbprint_input' objects. +func NewOidcThumbprintInputList() *OidcThumbprintInputListBuilder { + return new(OidcThumbprintInputListBuilder) +} + +// Items sets the items of the list. +func (b *OidcThumbprintInputListBuilder) Items(values ...*OidcThumbprintInputBuilder) *OidcThumbprintInputListBuilder { + b.items = make([]*OidcThumbprintInputBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *OidcThumbprintInputListBuilder) 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 *OidcThumbprintInputListBuilder) Copy(list *OidcThumbprintInputList) *OidcThumbprintInputListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*OidcThumbprintInputBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewOidcThumbprintInput().Copy(v) + } + } + return b +} + +// Build creates a list of 'oidc_thumbprint_input' objects using the +// configuration stored in the builder. +func (b *OidcThumbprintInputListBuilder) Build() (list *OidcThumbprintInputList, err error) { + items := make([]*OidcThumbprintInput, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(OidcThumbprintInputList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/oidc_thumbprint_input_list_type_json.go b/clientapi/clustersmgmt/v1/oidc_thumbprint_input_list_type_json.go new file mode 100644 index 00000000..fa55b47a --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_thumbprint_input_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOidcThumbprintInputList writes a list of values of the 'oidc_thumbprint_input' type to +// the given writer. +func MarshalOidcThumbprintInputList(list []*OidcThumbprintInput, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOidcThumbprintInputList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOidcThumbprintInputList writes a list of value of the 'oidc_thumbprint_input' type to +// the given stream. +func WriteOidcThumbprintInputList(list []*OidcThumbprintInput, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteOidcThumbprintInput(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalOidcThumbprintInputList reads a list of values of the 'oidc_thumbprint_input' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalOidcThumbprintInputList(source interface{}) (items []*OidcThumbprintInput, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadOidcThumbprintInputList(iterator) + err = iterator.Error + return +} + +// ReadOidcThumbprintInputList reads list of values of the ”oidc_thumbprint_input' type from +// the given iterator. +func ReadOidcThumbprintInputList(iterator *jsoniter.Iterator) []*OidcThumbprintInput { + list := []*OidcThumbprintInput{} + for iterator.ReadArray() { + item := ReadOidcThumbprintInput(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/oidc_thumbprint_input_type.go b/clientapi/clustersmgmt/v1/oidc_thumbprint_input_type.go new file mode 100644 index 00000000..148d9cc4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_thumbprint_input_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OidcThumbprintInput represents the values of the 'oidc_thumbprint_input' type. +// +// Contains the necessary attributes to fetch an OIDC Configuration thumbprint +type OidcThumbprintInput struct { + bitmap_ uint32 + clusterId string + oidcConfigId string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *OidcThumbprintInput) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ClusterId returns the value of the 'cluster_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ClusterId is the for the cluster used, exclusive from OidcConfigId. +func (o *OidcThumbprintInput) ClusterId() string { + if o != nil && o.bitmap_&1 != 0 { + return o.clusterId + } + return "" +} + +// GetClusterId returns the value of the 'cluster_id' attribute and +// a flag indicating if the attribute has a value. +// +// ClusterId is the for the cluster used, exclusive from OidcConfigId. +func (o *OidcThumbprintInput) GetClusterId() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.clusterId + } + return +} + +// OidcConfigId returns the value of the 'oidc_config_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// OidcConfigId is the ID for the oidc config used, exclusive from ClusterId. +func (o *OidcThumbprintInput) OidcConfigId() string { + if o != nil && o.bitmap_&2 != 0 { + return o.oidcConfigId + } + return "" +} + +// GetOidcConfigId returns the value of the 'oidc_config_id' attribute and +// a flag indicating if the attribute has a value. +// +// OidcConfigId is the ID for the oidc config used, exclusive from ClusterId. +func (o *OidcThumbprintInput) GetOidcConfigId() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.oidcConfigId + } + return +} + +// OidcThumbprintInputListKind is the name of the type used to represent list of objects of +// type 'oidc_thumbprint_input'. +const OidcThumbprintInputListKind = "OidcThumbprintInputList" + +// OidcThumbprintInputListLinkKind is the name of the type used to represent links to list +// of objects of type 'oidc_thumbprint_input'. +const OidcThumbprintInputListLinkKind = "OidcThumbprintInputListLink" + +// OidcThumbprintInputNilKind is the name of the type used to nil lists of objects of +// type 'oidc_thumbprint_input'. +const OidcThumbprintInputListNilKind = "OidcThumbprintInputListNil" + +// OidcThumbprintInputList is a list of values of the 'oidc_thumbprint_input' type. +type OidcThumbprintInputList struct { + href string + link bool + items []*OidcThumbprintInput +} + +// Len returns the length of the list. +func (l *OidcThumbprintInputList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *OidcThumbprintInputList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *OidcThumbprintInputList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *OidcThumbprintInputList) SetItems(items []*OidcThumbprintInput) { + l.items = items +} + +// Items returns the items of the list. +func (l *OidcThumbprintInputList) Items() []*OidcThumbprintInput { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *OidcThumbprintInputList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *OidcThumbprintInputList) Get(i int) *OidcThumbprintInput { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *OidcThumbprintInputList) Slice() []*OidcThumbprintInput { + var slice []*OidcThumbprintInput + if l == nil { + slice = make([]*OidcThumbprintInput, 0) + } else { + slice = make([]*OidcThumbprintInput, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *OidcThumbprintInputList) Each(f func(item *OidcThumbprintInput) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *OidcThumbprintInputList) Range(f func(index int, item *OidcThumbprintInput) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/oidc_thumbprint_input_type_json.go b/clientapi/clustersmgmt/v1/oidc_thumbprint_input_type_json.go new file mode 100644 index 00000000..9f13b1c0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_thumbprint_input_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOidcThumbprintInput writes a value of the 'oidc_thumbprint_input' type to the given writer. +func MarshalOidcThumbprintInput(object *OidcThumbprintInput, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOidcThumbprintInput(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOidcThumbprintInput writes a value of the 'oidc_thumbprint_input' type to the given stream. +func WriteOidcThumbprintInput(object *OidcThumbprintInput, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterId) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("oidc_config_id") + stream.WriteString(object.oidcConfigId) + } + stream.WriteObjectEnd() +} + +// UnmarshalOidcThumbprintInput reads a value of the 'oidc_thumbprint_input' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalOidcThumbprintInput(source interface{}) (object *OidcThumbprintInput, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadOidcThumbprintInput(iterator) + err = iterator.Error + return +} + +// ReadOidcThumbprintInput reads a value of the 'oidc_thumbprint_input' type from the given iterator. +func ReadOidcThumbprintInput(iterator *jsoniter.Iterator) *OidcThumbprintInput { + object := &OidcThumbprintInput{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "cluster_id": + value := iterator.ReadString() + object.clusterId = value + object.bitmap_ |= 1 + case "oidc_config_id": + value := iterator.ReadString() + object.oidcConfigId = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/oidc_thumbprint_list_builder.go b/clientapi/clustersmgmt/v1/oidc_thumbprint_list_builder.go new file mode 100644 index 00000000..392fd86f --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_thumbprint_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OidcThumbprintListBuilder contains the data and logic needed to build +// 'oidc_thumbprint' objects. +type OidcThumbprintListBuilder struct { + items []*OidcThumbprintBuilder +} + +// NewOidcThumbprintList creates a new builder of 'oidc_thumbprint' objects. +func NewOidcThumbprintList() *OidcThumbprintListBuilder { + return new(OidcThumbprintListBuilder) +} + +// Items sets the items of the list. +func (b *OidcThumbprintListBuilder) Items(values ...*OidcThumbprintBuilder) *OidcThumbprintListBuilder { + b.items = make([]*OidcThumbprintBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *OidcThumbprintListBuilder) 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 *OidcThumbprintListBuilder) Copy(list *OidcThumbprintList) *OidcThumbprintListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*OidcThumbprintBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewOidcThumbprint().Copy(v) + } + } + return b +} + +// Build creates a list of 'oidc_thumbprint' objects using the +// configuration stored in the builder. +func (b *OidcThumbprintListBuilder) Build() (list *OidcThumbprintList, err error) { + items := make([]*OidcThumbprint, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(OidcThumbprintList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/oidc_thumbprint_list_type_json.go b/clientapi/clustersmgmt/v1/oidc_thumbprint_list_type_json.go new file mode 100644 index 00000000..7059c872 --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_thumbprint_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOidcThumbprintList writes a list of values of the 'oidc_thumbprint' type to +// the given writer. +func MarshalOidcThumbprintList(list []*OidcThumbprint, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOidcThumbprintList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOidcThumbprintList writes a list of value of the 'oidc_thumbprint' type to +// the given stream. +func WriteOidcThumbprintList(list []*OidcThumbprint, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteOidcThumbprint(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalOidcThumbprintList reads a list of values of the 'oidc_thumbprint' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalOidcThumbprintList(source interface{}) (items []*OidcThumbprint, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadOidcThumbprintList(iterator) + err = iterator.Error + return +} + +// ReadOidcThumbprintList reads list of values of the ”oidc_thumbprint' type from +// the given iterator. +func ReadOidcThumbprintList(iterator *jsoniter.Iterator) []*OidcThumbprint { + list := []*OidcThumbprint{} + for iterator.ReadArray() { + item := ReadOidcThumbprint(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/oidc_thumbprint_type.go b/clientapi/clustersmgmt/v1/oidc_thumbprint_type.go new file mode 100644 index 00000000..a51350f7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_thumbprint_type.go @@ -0,0 +1,261 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OidcThumbprint represents the values of the 'oidc_thumbprint' type. +// +// Contains the necessary attributes to support oidc configuration thumbprint operations such as fetching/creation of a thumbprint +type OidcThumbprint struct { + bitmap_ uint32 + href string + clusterId string + kind string + oidcConfigId string + thumbprint string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *OidcThumbprint) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// HREF returns the value of the 'HREF' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HREF for the oidc config thumbprint, filled in response. +func (o *OidcThumbprint) HREF() string { + if o != nil && o.bitmap_&1 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the value of the 'HREF' attribute and +// a flag indicating if the attribute has a value. +// +// HREF for the oidc config thumbprint, filled in response. +func (o *OidcThumbprint) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.href + } + return +} + +// ClusterId returns the value of the 'cluster_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ClusterId is the for the cluster used, filled in response. +func (o *OidcThumbprint) ClusterId() string { + if o != nil && o.bitmap_&2 != 0 { + return o.clusterId + } + return "" +} + +// GetClusterId returns the value of the 'cluster_id' attribute and +// a flag indicating if the attribute has a value. +// +// ClusterId is the for the cluster used, filled in response. +func (o *OidcThumbprint) GetClusterId() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.clusterId + } + return +} + +// Kind returns the value of the 'kind' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Kind is the resource type, filled in response. +func (o *OidcThumbprint) Kind() string { + if o != nil && o.bitmap_&4 != 0 { + return o.kind + } + return "" +} + +// GetKind returns the value of the 'kind' attribute and +// a flag indicating if the attribute has a value. +// +// Kind is the resource type, filled in response. +func (o *OidcThumbprint) GetKind() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.kind + } + return +} + +// OidcConfigId returns the value of the 'oidc_config_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// OidcConfigId is the ID for the oidc config used, filled in response. +func (o *OidcThumbprint) OidcConfigId() string { + if o != nil && o.bitmap_&8 != 0 { + return o.oidcConfigId + } + return "" +} + +// GetOidcConfigId returns the value of the 'oidc_config_id' attribute and +// a flag indicating if the attribute has a value. +// +// OidcConfigId is the ID for the oidc config used, filled in response. +func (o *OidcThumbprint) GetOidcConfigId() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.oidcConfigId + } + return +} + +// Thumbprint returns the value of the 'thumbprint' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Thumbprint is the thumbprint itself, filled in response. +func (o *OidcThumbprint) Thumbprint() string { + if o != nil && o.bitmap_&16 != 0 { + return o.thumbprint + } + return "" +} + +// GetThumbprint returns the value of the 'thumbprint' attribute and +// a flag indicating if the attribute has a value. +// +// Thumbprint is the thumbprint itself, filled in response. +func (o *OidcThumbprint) GetThumbprint() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.thumbprint + } + return +} + +// OidcThumbprintListKind is the name of the type used to represent list of objects of +// type 'oidc_thumbprint'. +const OidcThumbprintListKind = "OidcThumbprintList" + +// OidcThumbprintListLinkKind is the name of the type used to represent links to list +// of objects of type 'oidc_thumbprint'. +const OidcThumbprintListLinkKind = "OidcThumbprintListLink" + +// OidcThumbprintNilKind is the name of the type used to nil lists of objects of +// type 'oidc_thumbprint'. +const OidcThumbprintListNilKind = "OidcThumbprintListNil" + +// OidcThumbprintList is a list of values of the 'oidc_thumbprint' type. +type OidcThumbprintList struct { + href string + link bool + items []*OidcThumbprint +} + +// Len returns the length of the list. +func (l *OidcThumbprintList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *OidcThumbprintList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *OidcThumbprintList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *OidcThumbprintList) SetItems(items []*OidcThumbprint) { + l.items = items +} + +// Items returns the items of the list. +func (l *OidcThumbprintList) Items() []*OidcThumbprint { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *OidcThumbprintList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *OidcThumbprintList) Get(i int) *OidcThumbprint { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *OidcThumbprintList) Slice() []*OidcThumbprint { + var slice []*OidcThumbprint + if l == nil { + slice = make([]*OidcThumbprint, 0) + } else { + slice = make([]*OidcThumbprint, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *OidcThumbprintList) Each(f func(item *OidcThumbprint) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *OidcThumbprintList) Range(f func(index int, item *OidcThumbprint) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/oidc_thumbprint_type_json.go b/clientapi/clustersmgmt/v1/oidc_thumbprint_type_json.go new file mode 100644 index 00000000..64d6f23f --- /dev/null +++ b/clientapi/clustersmgmt/v1/oidc_thumbprint_type_json.go @@ -0,0 +1,138 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOidcThumbprint writes a value of the 'oidc_thumbprint' type to the given writer. +func MarshalOidcThumbprint(object *OidcThumbprint, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOidcThumbprint(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOidcThumbprint writes a value of the 'oidc_thumbprint' type to the given stream. +func WriteOidcThumbprint(object *OidcThumbprint, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterId) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kind") + stream.WriteString(object.kind) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("oidc_config_id") + stream.WriteString(object.oidcConfigId) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("thumbprint") + stream.WriteString(object.thumbprint) + } + stream.WriteObjectEnd() +} + +// UnmarshalOidcThumbprint reads a value of the 'oidc_thumbprint' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalOidcThumbprint(source interface{}) (object *OidcThumbprint, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadOidcThumbprint(iterator) + err = iterator.Error + return +} + +// ReadOidcThumbprint reads a value of the 'oidc_thumbprint' type from the given iterator. +func ReadOidcThumbprint(iterator *jsoniter.Iterator) *OidcThumbprint { + object := &OidcThumbprint{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 1 + case "cluster_id": + value := iterator.ReadString() + object.clusterId = value + object.bitmap_ |= 2 + case "kind": + value := iterator.ReadString() + object.kind = value + object.bitmap_ |= 4 + case "oidc_config_id": + value := iterator.ReadString() + object.oidcConfigId = value + object.bitmap_ |= 8 + case "thumbprint": + value := iterator.ReadString() + object.thumbprint = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/open_id_claims_builder.go b/clientapi/clustersmgmt/v1/open_id_claims_builder.go new file mode 100644 index 00000000..7bf06a08 --- /dev/null +++ b/clientapi/clustersmgmt/v1/open_id_claims_builder.go @@ -0,0 +1,129 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OpenIDClaimsBuilder contains the data and logic needed to build 'open_ID_claims' objects. +// +// _OpenID_ identity provider claims. +type OpenIDClaimsBuilder struct { + bitmap_ uint32 + email []string + groups []string + name []string + preferredUsername []string +} + +// NewOpenIDClaims creates a new builder of 'open_ID_claims' objects. +func NewOpenIDClaims() *OpenIDClaimsBuilder { + return &OpenIDClaimsBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *OpenIDClaimsBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Email sets the value of the 'email' attribute to the given values. +func (b *OpenIDClaimsBuilder) Email(values ...string) *OpenIDClaimsBuilder { + b.email = make([]string, len(values)) + copy(b.email, values) + b.bitmap_ |= 1 + return b +} + +// Groups sets the value of the 'groups' attribute to the given values. +func (b *OpenIDClaimsBuilder) Groups(values ...string) *OpenIDClaimsBuilder { + b.groups = make([]string, len(values)) + copy(b.groups, values) + b.bitmap_ |= 2 + return b +} + +// Name sets the value of the 'name' attribute to the given values. +func (b *OpenIDClaimsBuilder) Name(values ...string) *OpenIDClaimsBuilder { + b.name = make([]string, len(values)) + copy(b.name, values) + b.bitmap_ |= 4 + return b +} + +// PreferredUsername sets the value of the 'preferred_username' attribute to the given values. +func (b *OpenIDClaimsBuilder) PreferredUsername(values ...string) *OpenIDClaimsBuilder { + b.preferredUsername = make([]string, len(values)) + copy(b.preferredUsername, values) + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *OpenIDClaimsBuilder) Copy(object *OpenIDClaims) *OpenIDClaimsBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.email != nil { + b.email = make([]string, len(object.email)) + copy(b.email, object.email) + } else { + b.email = nil + } + if object.groups != nil { + b.groups = make([]string, len(object.groups)) + copy(b.groups, object.groups) + } else { + b.groups = nil + } + if object.name != nil { + b.name = make([]string, len(object.name)) + copy(b.name, object.name) + } else { + b.name = nil + } + if object.preferredUsername != nil { + b.preferredUsername = make([]string, len(object.preferredUsername)) + copy(b.preferredUsername, object.preferredUsername) + } else { + b.preferredUsername = nil + } + return b +} + +// Build creates a 'open_ID_claims' object using the configuration stored in the builder. +func (b *OpenIDClaimsBuilder) Build() (object *OpenIDClaims, err error) { + object = new(OpenIDClaims) + object.bitmap_ = b.bitmap_ + if b.email != nil { + object.email = make([]string, len(b.email)) + copy(object.email, b.email) + } + if b.groups != nil { + object.groups = make([]string, len(b.groups)) + copy(object.groups, b.groups) + } + if b.name != nil { + object.name = make([]string, len(b.name)) + copy(object.name, b.name) + } + if b.preferredUsername != nil { + object.preferredUsername = make([]string, len(b.preferredUsername)) + copy(object.preferredUsername, b.preferredUsername) + } + return +} diff --git a/clientapi/clustersmgmt/v1/open_id_claims_list_builder.go b/clientapi/clustersmgmt/v1/open_id_claims_list_builder.go new file mode 100644 index 00000000..69ae455a --- /dev/null +++ b/clientapi/clustersmgmt/v1/open_id_claims_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OpenIDClaimsListBuilder contains the data and logic needed to build +// 'open_ID_claims' objects. +type OpenIDClaimsListBuilder struct { + items []*OpenIDClaimsBuilder +} + +// NewOpenIDClaimsList creates a new builder of 'open_ID_claims' objects. +func NewOpenIDClaimsList() *OpenIDClaimsListBuilder { + return new(OpenIDClaimsListBuilder) +} + +// Items sets the items of the list. +func (b *OpenIDClaimsListBuilder) Items(values ...*OpenIDClaimsBuilder) *OpenIDClaimsListBuilder { + b.items = make([]*OpenIDClaimsBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *OpenIDClaimsListBuilder) 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 *OpenIDClaimsListBuilder) Copy(list *OpenIDClaimsList) *OpenIDClaimsListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*OpenIDClaimsBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewOpenIDClaims().Copy(v) + } + } + return b +} + +// Build creates a list of 'open_ID_claims' objects using the +// configuration stored in the builder. +func (b *OpenIDClaimsListBuilder) Build() (list *OpenIDClaimsList, err error) { + items := make([]*OpenIDClaims, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(OpenIDClaimsList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/open_id_claims_list_type_json.go b/clientapi/clustersmgmt/v1/open_id_claims_list_type_json.go new file mode 100644 index 00000000..53c6fca6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/open_id_claims_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOpenIDClaimsList writes a list of values of the 'open_ID_claims' type to +// the given writer. +func MarshalOpenIDClaimsList(list []*OpenIDClaims, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOpenIDClaimsList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOpenIDClaimsList writes a list of value of the 'open_ID_claims' type to +// the given stream. +func WriteOpenIDClaimsList(list []*OpenIDClaims, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteOpenIDClaims(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalOpenIDClaimsList reads a list of values of the 'open_ID_claims' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalOpenIDClaimsList(source interface{}) (items []*OpenIDClaims, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadOpenIDClaimsList(iterator) + err = iterator.Error + return +} + +// ReadOpenIDClaimsList reads list of values of the ”open_ID_claims' type from +// the given iterator. +func ReadOpenIDClaimsList(iterator *jsoniter.Iterator) []*OpenIDClaims { + list := []*OpenIDClaims{} + for iterator.ReadArray() { + item := ReadOpenIDClaims(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/open_id_claims_type.go b/clientapi/clustersmgmt/v1/open_id_claims_type.go new file mode 100644 index 00000000..6d4853ba --- /dev/null +++ b/clientapi/clustersmgmt/v1/open_id_claims_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OpenIDClaims represents the values of the 'open_ID_claims' type. +// +// _OpenID_ identity provider claims. +type OpenIDClaims struct { + bitmap_ uint32 + email []string + groups []string + name []string + preferredUsername []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *OpenIDClaims) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Email returns the value of the 'email' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of claims to use as the mail address. +func (o *OpenIDClaims) Email() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.email + } + return nil +} + +// GetEmail returns the value of the 'email' attribute and +// a flag indicating if the attribute has a value. +// +// List of claims to use as the mail address. +func (o *OpenIDClaims) GetEmail() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.email + } + return +} + +// Groups returns the value of the 'groups' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of claims to use as the group name. +func (o *OpenIDClaims) Groups() []string { + if o != nil && o.bitmap_&2 != 0 { + return o.groups + } + return nil +} + +// GetGroups returns the value of the 'groups' attribute and +// a flag indicating if the attribute has a value. +// +// List of claims to use as the group name. +func (o *OpenIDClaims) GetGroups() (value []string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.groups + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of claims to use as the display name. +func (o *OpenIDClaims) Name() []string { + if o != nil && o.bitmap_&4 != 0 { + return o.name + } + return nil +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// List of claims to use as the display name. +func (o *OpenIDClaims) GetName() (value []string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.name + } + return +} + +// PreferredUsername returns the value of the 'preferred_username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of claims to use as the preferred user name when provisioning a user. +func (o *OpenIDClaims) PreferredUsername() []string { + if o != nil && o.bitmap_&8 != 0 { + return o.preferredUsername + } + return nil +} + +// GetPreferredUsername returns the value of the 'preferred_username' attribute and +// a flag indicating if the attribute has a value. +// +// List of claims to use as the preferred user name when provisioning a user. +func (o *OpenIDClaims) GetPreferredUsername() (value []string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.preferredUsername + } + return +} + +// OpenIDClaimsListKind is the name of the type used to represent list of objects of +// type 'open_ID_claims'. +const OpenIDClaimsListKind = "OpenIDClaimsList" + +// OpenIDClaimsListLinkKind is the name of the type used to represent links to list +// of objects of type 'open_ID_claims'. +const OpenIDClaimsListLinkKind = "OpenIDClaimsListLink" + +// OpenIDClaimsNilKind is the name of the type used to nil lists of objects of +// type 'open_ID_claims'. +const OpenIDClaimsListNilKind = "OpenIDClaimsListNil" + +// OpenIDClaimsList is a list of values of the 'open_ID_claims' type. +type OpenIDClaimsList struct { + href string + link bool + items []*OpenIDClaims +} + +// Len returns the length of the list. +func (l *OpenIDClaimsList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *OpenIDClaimsList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *OpenIDClaimsList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *OpenIDClaimsList) SetItems(items []*OpenIDClaims) { + l.items = items +} + +// Items returns the items of the list. +func (l *OpenIDClaimsList) Items() []*OpenIDClaims { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *OpenIDClaimsList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *OpenIDClaimsList) Get(i int) *OpenIDClaims { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *OpenIDClaimsList) Slice() []*OpenIDClaims { + var slice []*OpenIDClaims + if l == nil { + slice = make([]*OpenIDClaims, 0) + } else { + slice = make([]*OpenIDClaims, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *OpenIDClaimsList) Each(f func(item *OpenIDClaims) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *OpenIDClaimsList) Range(f func(index int, item *OpenIDClaims) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/open_id_claims_type_json.go b/clientapi/clustersmgmt/v1/open_id_claims_type_json.go new file mode 100644 index 00000000..a9205884 --- /dev/null +++ b/clientapi/clustersmgmt/v1/open_id_claims_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOpenIDClaims writes a value of the 'open_ID_claims' type to the given writer. +func MarshalOpenIDClaims(object *OpenIDClaims, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOpenIDClaims(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOpenIDClaims writes a value of the 'open_ID_claims' type to the given stream. +func WriteOpenIDClaims(object *OpenIDClaims, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.email != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("email") + WriteStringList(object.email, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.groups != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("groups") + WriteStringList(object.groups, stream) + count++ + } + present_ = object.bitmap_&4 != 0 && object.name != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + WriteStringList(object.name, stream) + count++ + } + present_ = object.bitmap_&8 != 0 && object.preferredUsername != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("preferred_username") + WriteStringList(object.preferredUsername, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalOpenIDClaims reads a value of the 'open_ID_claims' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalOpenIDClaims(source interface{}) (object *OpenIDClaims, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadOpenIDClaims(iterator) + err = iterator.Error + return +} + +// ReadOpenIDClaims reads a value of the 'open_ID_claims' type from the given iterator. +func ReadOpenIDClaims(iterator *jsoniter.Iterator) *OpenIDClaims { + object := &OpenIDClaims{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "email": + value := ReadStringList(iterator) + object.email = value + object.bitmap_ |= 1 + case "groups": + value := ReadStringList(iterator) + object.groups = value + object.bitmap_ |= 2 + case "name": + value := ReadStringList(iterator) + object.name = value + object.bitmap_ |= 4 + case "preferred_username": + value := ReadStringList(iterator) + object.preferredUsername = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/open_id_identity_provider_builder.go b/clientapi/clustersmgmt/v1/open_id_identity_provider_builder.go new file mode 100644 index 00000000..5b2dc596 --- /dev/null +++ b/clientapi/clustersmgmt/v1/open_id_identity_provider_builder.go @@ -0,0 +1,163 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OpenIDIdentityProviderBuilder contains the data and logic needed to build 'open_ID_identity_provider' objects. +// +// Details for `openid` identity providers. +type OpenIDIdentityProviderBuilder struct { + bitmap_ uint32 + ca string + claims *OpenIDClaimsBuilder + clientID string + clientSecret string + extraAuthorizeParameters map[string]string + extraScopes []string + issuer string +} + +// NewOpenIDIdentityProvider creates a new builder of 'open_ID_identity_provider' objects. +func NewOpenIDIdentityProvider() *OpenIDIdentityProviderBuilder { + return &OpenIDIdentityProviderBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *OpenIDIdentityProviderBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// CA sets the value of the 'CA' attribute to the given value. +func (b *OpenIDIdentityProviderBuilder) CA(value string) *OpenIDIdentityProviderBuilder { + b.ca = value + b.bitmap_ |= 1 + return b +} + +// Claims sets the value of the 'claims' attribute to the given value. +// +// _OpenID_ identity provider claims. +func (b *OpenIDIdentityProviderBuilder) Claims(value *OpenIDClaimsBuilder) *OpenIDIdentityProviderBuilder { + b.claims = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// ClientID sets the value of the 'client_ID' attribute to the given value. +func (b *OpenIDIdentityProviderBuilder) ClientID(value string) *OpenIDIdentityProviderBuilder { + b.clientID = value + b.bitmap_ |= 4 + return b +} + +// ClientSecret sets the value of the 'client_secret' attribute to the given value. +func (b *OpenIDIdentityProviderBuilder) ClientSecret(value string) *OpenIDIdentityProviderBuilder { + b.clientSecret = value + b.bitmap_ |= 8 + return b +} + +// ExtraAuthorizeParameters sets the value of the 'extra_authorize_parameters' attribute to the given value. +func (b *OpenIDIdentityProviderBuilder) ExtraAuthorizeParameters(value map[string]string) *OpenIDIdentityProviderBuilder { + b.extraAuthorizeParameters = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// ExtraScopes sets the value of the 'extra_scopes' attribute to the given values. +func (b *OpenIDIdentityProviderBuilder) ExtraScopes(values ...string) *OpenIDIdentityProviderBuilder { + b.extraScopes = make([]string, len(values)) + copy(b.extraScopes, values) + b.bitmap_ |= 32 + return b +} + +// Issuer sets the value of the 'issuer' attribute to the given value. +func (b *OpenIDIdentityProviderBuilder) Issuer(value string) *OpenIDIdentityProviderBuilder { + b.issuer = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *OpenIDIdentityProviderBuilder) Copy(object *OpenIDIdentityProvider) *OpenIDIdentityProviderBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.ca = object.ca + if object.claims != nil { + b.claims = NewOpenIDClaims().Copy(object.claims) + } else { + b.claims = nil + } + b.clientID = object.clientID + b.clientSecret = object.clientSecret + if len(object.extraAuthorizeParameters) > 0 { + b.extraAuthorizeParameters = map[string]string{} + for k, v := range object.extraAuthorizeParameters { + b.extraAuthorizeParameters[k] = v + } + } else { + b.extraAuthorizeParameters = nil + } + if object.extraScopes != nil { + b.extraScopes = make([]string, len(object.extraScopes)) + copy(b.extraScopes, object.extraScopes) + } else { + b.extraScopes = nil + } + b.issuer = object.issuer + return b +} + +// Build creates a 'open_ID_identity_provider' object using the configuration stored in the builder. +func (b *OpenIDIdentityProviderBuilder) Build() (object *OpenIDIdentityProvider, err error) { + object = new(OpenIDIdentityProvider) + object.bitmap_ = b.bitmap_ + object.ca = b.ca + if b.claims != nil { + object.claims, err = b.claims.Build() + if err != nil { + return + } + } + object.clientID = b.clientID + object.clientSecret = b.clientSecret + if b.extraAuthorizeParameters != nil { + object.extraAuthorizeParameters = make(map[string]string) + for k, v := range b.extraAuthorizeParameters { + object.extraAuthorizeParameters[k] = v + } + } + if b.extraScopes != nil { + object.extraScopes = make([]string, len(b.extraScopes)) + copy(object.extraScopes, b.extraScopes) + } + object.issuer = b.issuer + return +} diff --git a/clientapi/clustersmgmt/v1/open_id_identity_provider_list_builder.go b/clientapi/clustersmgmt/v1/open_id_identity_provider_list_builder.go new file mode 100644 index 00000000..1cb622d1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/open_id_identity_provider_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OpenIDIdentityProviderListBuilder contains the data and logic needed to build +// 'open_ID_identity_provider' objects. +type OpenIDIdentityProviderListBuilder struct { + items []*OpenIDIdentityProviderBuilder +} + +// NewOpenIDIdentityProviderList creates a new builder of 'open_ID_identity_provider' objects. +func NewOpenIDIdentityProviderList() *OpenIDIdentityProviderListBuilder { + return new(OpenIDIdentityProviderListBuilder) +} + +// Items sets the items of the list. +func (b *OpenIDIdentityProviderListBuilder) Items(values ...*OpenIDIdentityProviderBuilder) *OpenIDIdentityProviderListBuilder { + b.items = make([]*OpenIDIdentityProviderBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *OpenIDIdentityProviderListBuilder) 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 *OpenIDIdentityProviderListBuilder) Copy(list *OpenIDIdentityProviderList) *OpenIDIdentityProviderListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*OpenIDIdentityProviderBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewOpenIDIdentityProvider().Copy(v) + } + } + return b +} + +// Build creates a list of 'open_ID_identity_provider' objects using the +// configuration stored in the builder. +func (b *OpenIDIdentityProviderListBuilder) Build() (list *OpenIDIdentityProviderList, err error) { + items := make([]*OpenIDIdentityProvider, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(OpenIDIdentityProviderList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/open_id_identity_provider_list_type_json.go b/clientapi/clustersmgmt/v1/open_id_identity_provider_list_type_json.go new file mode 100644 index 00000000..2747440a --- /dev/null +++ b/clientapi/clustersmgmt/v1/open_id_identity_provider_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOpenIDIdentityProviderList writes a list of values of the 'open_ID_identity_provider' type to +// the given writer. +func MarshalOpenIDIdentityProviderList(list []*OpenIDIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOpenIDIdentityProviderList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOpenIDIdentityProviderList writes a list of value of the 'open_ID_identity_provider' type to +// the given stream. +func WriteOpenIDIdentityProviderList(list []*OpenIDIdentityProvider, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteOpenIDIdentityProvider(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalOpenIDIdentityProviderList reads a list of values of the 'open_ID_identity_provider' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalOpenIDIdentityProviderList(source interface{}) (items []*OpenIDIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadOpenIDIdentityProviderList(iterator) + err = iterator.Error + return +} + +// ReadOpenIDIdentityProviderList reads list of values of the ”open_ID_identity_provider' type from +// the given iterator. +func ReadOpenIDIdentityProviderList(iterator *jsoniter.Iterator) []*OpenIDIdentityProvider { + list := []*OpenIDIdentityProvider{} + for iterator.ReadArray() { + item := ReadOpenIDIdentityProvider(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/open_id_identity_provider_type.go b/clientapi/clustersmgmt/v1/open_id_identity_provider_type.go new file mode 100644 index 00000000..d12a9bce --- /dev/null +++ b/clientapi/clustersmgmt/v1/open_id_identity_provider_type.go @@ -0,0 +1,311 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OpenIDIdentityProvider represents the values of the 'open_ID_identity_provider' type. +// +// Details for `openid` identity providers. +type OpenIDIdentityProvider struct { + bitmap_ uint32 + ca string + claims *OpenIDClaims + clientID string + clientSecret string + extraAuthorizeParameters map[string]string + extraScopes []string + issuer string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *OpenIDIdentityProvider) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// CA returns the value of the 'CA' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Certificate bunde to use to validate server certificates for the configured URL. +func (o *OpenIDIdentityProvider) CA() string { + if o != nil && o.bitmap_&1 != 0 { + return o.ca + } + return "" +} + +// GetCA returns the value of the 'CA' attribute and +// a flag indicating if the attribute has a value. +// +// Certificate bunde to use to validate server certificates for the configured URL. +func (o *OpenIDIdentityProvider) GetCA() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.ca + } + return +} + +// Claims returns the value of the 'claims' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Claims used to configure the provider. +func (o *OpenIDIdentityProvider) Claims() *OpenIDClaims { + if o != nil && o.bitmap_&2 != 0 { + return o.claims + } + return nil +} + +// GetClaims returns the value of the 'claims' attribute and +// a flag indicating if the attribute has a value. +// +// Claims used to configure the provider. +func (o *OpenIDIdentityProvider) GetClaims() (value *OpenIDClaims, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.claims + } + return +} + +// ClientID returns the value of the 'client_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Identifier of a client registered with the _OpenID_ provider. +func (o *OpenIDIdentityProvider) ClientID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.clientID + } + return "" +} + +// GetClientID returns the value of the 'client_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Identifier of a client registered with the _OpenID_ provider. +func (o *OpenIDIdentityProvider) GetClientID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.clientID + } + return +} + +// ClientSecret returns the value of the 'client_secret' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Client secret. +func (o *OpenIDIdentityProvider) ClientSecret() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clientSecret + } + return "" +} + +// GetClientSecret returns the value of the 'client_secret' attribute and +// a flag indicating if the attribute has a value. +// +// Client secret. +func (o *OpenIDIdentityProvider) GetClientSecret() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clientSecret + } + return +} + +// ExtraAuthorizeParameters returns the value of the 'extra_authorize_parameters' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional map of extra parameters to add to the authorization token request. +func (o *OpenIDIdentityProvider) ExtraAuthorizeParameters() map[string]string { + if o != nil && o.bitmap_&16 != 0 { + return o.extraAuthorizeParameters + } + return nil +} + +// GetExtraAuthorizeParameters returns the value of the 'extra_authorize_parameters' attribute and +// a flag indicating if the attribute has a value. +// +// Optional map of extra parameters to add to the authorization token request. +func (o *OpenIDIdentityProvider) GetExtraAuthorizeParameters() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.extraAuthorizeParameters + } + return +} + +// ExtraScopes returns the value of the 'extra_scopes' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional list of scopes to request, in addition to the `openid` scope, during the +// authorization token request. +func (o *OpenIDIdentityProvider) ExtraScopes() []string { + if o != nil && o.bitmap_&32 != 0 { + return o.extraScopes + } + return nil +} + +// GetExtraScopes returns the value of the 'extra_scopes' attribute and +// a flag indicating if the attribute has a value. +// +// Optional list of scopes to request, in addition to the `openid` scope, during the +// authorization token request. +func (o *OpenIDIdentityProvider) GetExtraScopes() (value []string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.extraScopes + } + return +} + +// Issuer returns the value of the 'issuer' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The URL that the OpenID Provider asserts as the Issuer Identifier +func (o *OpenIDIdentityProvider) Issuer() string { + if o != nil && o.bitmap_&64 != 0 { + return o.issuer + } + return "" +} + +// GetIssuer returns the value of the 'issuer' attribute and +// a flag indicating if the attribute has a value. +// +// The URL that the OpenID Provider asserts as the Issuer Identifier +func (o *OpenIDIdentityProvider) GetIssuer() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.issuer + } + return +} + +// OpenIDIdentityProviderListKind is the name of the type used to represent list of objects of +// type 'open_ID_identity_provider'. +const OpenIDIdentityProviderListKind = "OpenIDIdentityProviderList" + +// OpenIDIdentityProviderListLinkKind is the name of the type used to represent links to list +// of objects of type 'open_ID_identity_provider'. +const OpenIDIdentityProviderListLinkKind = "OpenIDIdentityProviderListLink" + +// OpenIDIdentityProviderNilKind is the name of the type used to nil lists of objects of +// type 'open_ID_identity_provider'. +const OpenIDIdentityProviderListNilKind = "OpenIDIdentityProviderListNil" + +// OpenIDIdentityProviderList is a list of values of the 'open_ID_identity_provider' type. +type OpenIDIdentityProviderList struct { + href string + link bool + items []*OpenIDIdentityProvider +} + +// Len returns the length of the list. +func (l *OpenIDIdentityProviderList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *OpenIDIdentityProviderList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *OpenIDIdentityProviderList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *OpenIDIdentityProviderList) SetItems(items []*OpenIDIdentityProvider) { + l.items = items +} + +// Items returns the items of the list. +func (l *OpenIDIdentityProviderList) Items() []*OpenIDIdentityProvider { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *OpenIDIdentityProviderList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *OpenIDIdentityProviderList) Get(i int) *OpenIDIdentityProvider { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *OpenIDIdentityProviderList) Slice() []*OpenIDIdentityProvider { + var slice []*OpenIDIdentityProvider + if l == nil { + slice = make([]*OpenIDIdentityProvider, 0) + } else { + slice = make([]*OpenIDIdentityProvider, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *OpenIDIdentityProviderList) Each(f func(item *OpenIDIdentityProvider) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *OpenIDIdentityProviderList) Range(f func(index int, item *OpenIDIdentityProvider) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/open_id_identity_provider_type_json.go b/clientapi/clustersmgmt/v1/open_id_identity_provider_type_json.go new file mode 100644 index 00000000..1fbcaecf --- /dev/null +++ b/clientapi/clustersmgmt/v1/open_id_identity_provider_type_json.go @@ -0,0 +1,193 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOpenIDIdentityProvider writes a value of the 'open_ID_identity_provider' type to the given writer. +func MarshalOpenIDIdentityProvider(object *OpenIDIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOpenIDIdentityProvider(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOpenIDIdentityProvider writes a value of the 'open_ID_identity_provider' type to the given stream. +func WriteOpenIDIdentityProvider(object *OpenIDIdentityProvider, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ca") + stream.WriteString(object.ca) + count++ + } + present_ = object.bitmap_&2 != 0 && object.claims != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("claims") + WriteOpenIDClaims(object.claims, stream) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_id") + stream.WriteString(object.clientID) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("client_secret") + stream.WriteString(object.clientSecret) + count++ + } + present_ = object.bitmap_&16 != 0 && object.extraAuthorizeParameters != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("extra_authorize_parameters") + if object.extraAuthorizeParameters != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.extraAuthorizeParameters)) + i := 0 + for key := range object.extraAuthorizeParameters { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.extraAuthorizeParameters[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&32 != 0 && object.extraScopes != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("extra_scopes") + WriteStringList(object.extraScopes, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("issuer") + stream.WriteString(object.issuer) + } + stream.WriteObjectEnd() +} + +// UnmarshalOpenIDIdentityProvider reads a value of the 'open_ID_identity_provider' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalOpenIDIdentityProvider(source interface{}) (object *OpenIDIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadOpenIDIdentityProvider(iterator) + err = iterator.Error + return +} + +// ReadOpenIDIdentityProvider reads a value of the 'open_ID_identity_provider' type from the given iterator. +func ReadOpenIDIdentityProvider(iterator *jsoniter.Iterator) *OpenIDIdentityProvider { + object := &OpenIDIdentityProvider{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "ca": + value := iterator.ReadString() + object.ca = value + object.bitmap_ |= 1 + case "claims": + value := ReadOpenIDClaims(iterator) + object.claims = value + object.bitmap_ |= 2 + case "client_id": + value := iterator.ReadString() + object.clientID = value + object.bitmap_ |= 4 + case "client_secret": + value := iterator.ReadString() + object.clientSecret = value + object.bitmap_ |= 8 + case "extra_authorize_parameters": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.extraAuthorizeParameters = value + object.bitmap_ |= 16 + case "extra_scopes": + value := ReadStringList(iterator) + object.extraScopes = value + object.bitmap_ |= 32 + case "issuer": + value := iterator.ReadString() + object.issuer = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/operator_iam_role_builder.go b/clientapi/clustersmgmt/v1/operator_iam_role_builder.go new file mode 100644 index 00000000..62737419 --- /dev/null +++ b/clientapi/clustersmgmt/v1/operator_iam_role_builder.go @@ -0,0 +1,103 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OperatorIAMRoleBuilder contains the data and logic needed to build 'operator_IAM_role' objects. +// +// Contains the necessary attributes to allow each operator to access the necessary AWS resources +type OperatorIAMRoleBuilder struct { + bitmap_ uint32 + id string + name string + namespace string + roleARN string + serviceAccount string +} + +// NewOperatorIAMRole creates a new builder of 'operator_IAM_role' objects. +func NewOperatorIAMRole() *OperatorIAMRoleBuilder { + return &OperatorIAMRoleBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *OperatorIAMRoleBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *OperatorIAMRoleBuilder) ID(value string) *OperatorIAMRoleBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *OperatorIAMRoleBuilder) Name(value string) *OperatorIAMRoleBuilder { + b.name = value + b.bitmap_ |= 2 + return b +} + +// Namespace sets the value of the 'namespace' attribute to the given value. +func (b *OperatorIAMRoleBuilder) Namespace(value string) *OperatorIAMRoleBuilder { + b.namespace = value + b.bitmap_ |= 4 + return b +} + +// RoleARN sets the value of the 'role_ARN' attribute to the given value. +func (b *OperatorIAMRoleBuilder) RoleARN(value string) *OperatorIAMRoleBuilder { + b.roleARN = value + b.bitmap_ |= 8 + return b +} + +// ServiceAccount sets the value of the 'service_account' attribute to the given value. +func (b *OperatorIAMRoleBuilder) ServiceAccount(value string) *OperatorIAMRoleBuilder { + b.serviceAccount = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *OperatorIAMRoleBuilder) Copy(object *OperatorIAMRole) *OperatorIAMRoleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.name = object.name + b.namespace = object.namespace + b.roleARN = object.roleARN + b.serviceAccount = object.serviceAccount + return b +} + +// Build creates a 'operator_IAM_role' object using the configuration stored in the builder. +func (b *OperatorIAMRoleBuilder) Build() (object *OperatorIAMRole, err error) { + object = new(OperatorIAMRole) + object.bitmap_ = b.bitmap_ + object.id = b.id + object.name = b.name + object.namespace = b.namespace + object.roleARN = b.roleARN + object.serviceAccount = b.serviceAccount + return +} diff --git a/clientapi/clustersmgmt/v1/operator_iam_role_list_builder.go b/clientapi/clustersmgmt/v1/operator_iam_role_list_builder.go new file mode 100644 index 00000000..2d60eaa4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/operator_iam_role_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OperatorIAMRoleListBuilder contains the data and logic needed to build +// 'operator_IAM_role' objects. +type OperatorIAMRoleListBuilder struct { + items []*OperatorIAMRoleBuilder +} + +// NewOperatorIAMRoleList creates a new builder of 'operator_IAM_role' objects. +func NewOperatorIAMRoleList() *OperatorIAMRoleListBuilder { + return new(OperatorIAMRoleListBuilder) +} + +// Items sets the items of the list. +func (b *OperatorIAMRoleListBuilder) Items(values ...*OperatorIAMRoleBuilder) *OperatorIAMRoleListBuilder { + b.items = make([]*OperatorIAMRoleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *OperatorIAMRoleListBuilder) 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 *OperatorIAMRoleListBuilder) Copy(list *OperatorIAMRoleList) *OperatorIAMRoleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*OperatorIAMRoleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewOperatorIAMRole().Copy(v) + } + } + return b +} + +// Build creates a list of 'operator_IAM_role' objects using the +// configuration stored in the builder. +func (b *OperatorIAMRoleListBuilder) Build() (list *OperatorIAMRoleList, err error) { + items := make([]*OperatorIAMRole, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(OperatorIAMRoleList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/operator_iam_role_list_type_json.go b/clientapi/clustersmgmt/v1/operator_iam_role_list_type_json.go new file mode 100644 index 00000000..47c53d17 --- /dev/null +++ b/clientapi/clustersmgmt/v1/operator_iam_role_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOperatorIAMRoleList writes a list of values of the 'operator_IAM_role' type to +// the given writer. +func MarshalOperatorIAMRoleList(list []*OperatorIAMRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOperatorIAMRoleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOperatorIAMRoleList writes a list of value of the 'operator_IAM_role' type to +// the given stream. +func WriteOperatorIAMRoleList(list []*OperatorIAMRole, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteOperatorIAMRole(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalOperatorIAMRoleList reads a list of values of the 'operator_IAM_role' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalOperatorIAMRoleList(source interface{}) (items []*OperatorIAMRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadOperatorIAMRoleList(iterator) + err = iterator.Error + return +} + +// ReadOperatorIAMRoleList reads list of values of the ”operator_IAM_role' type from +// the given iterator. +func ReadOperatorIAMRoleList(iterator *jsoniter.Iterator) []*OperatorIAMRole { + list := []*OperatorIAMRole{} + for iterator.ReadArray() { + item := ReadOperatorIAMRole(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/operator_iam_role_type.go b/clientapi/clustersmgmt/v1/operator_iam_role_type.go new file mode 100644 index 00000000..b9704b88 --- /dev/null +++ b/clientapi/clustersmgmt/v1/operator_iam_role_type.go @@ -0,0 +1,261 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OperatorIAMRole represents the values of the 'operator_IAM_role' type. +// +// Contains the necessary attributes to allow each operator to access the necessary AWS resources +type OperatorIAMRole struct { + bitmap_ uint32 + id string + name string + namespace string + roleARN string + serviceAccount string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *OperatorIAMRole) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Randomly-generated ID to identify the operator role +func (o *OperatorIAMRole) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// Randomly-generated ID to identify the operator role +func (o *OperatorIAMRole) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the credentials secret used to access cloud resources +func (o *OperatorIAMRole) Name() string { + if o != nil && o.bitmap_&2 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the credentials secret used to access cloud resources +func (o *OperatorIAMRole) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.name + } + return +} + +// Namespace returns the value of the 'namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Namespace where the credentials secret lives in the cluster +func (o *OperatorIAMRole) Namespace() string { + if o != nil && o.bitmap_&4 != 0 { + return o.namespace + } + return "" +} + +// GetNamespace returns the value of the 'namespace' attribute and +// a flag indicating if the attribute has a value. +// +// Namespace where the credentials secret lives in the cluster +func (o *OperatorIAMRole) GetNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.namespace + } + return +} + +// RoleARN returns the value of the 'role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Role to assume when accessing AWS resources +func (o *OperatorIAMRole) RoleARN() string { + if o != nil && o.bitmap_&8 != 0 { + return o.roleARN + } + return "" +} + +// GetRoleARN returns the value of the 'role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// Role to assume when accessing AWS resources +func (o *OperatorIAMRole) GetRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.roleARN + } + return +} + +// ServiceAccount returns the value of the 'service_account' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Service account name to use when authenticating +func (o *OperatorIAMRole) ServiceAccount() string { + if o != nil && o.bitmap_&16 != 0 { + return o.serviceAccount + } + return "" +} + +// GetServiceAccount returns the value of the 'service_account' attribute and +// a flag indicating if the attribute has a value. +// +// Service account name to use when authenticating +func (o *OperatorIAMRole) GetServiceAccount() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.serviceAccount + } + return +} + +// OperatorIAMRoleListKind is the name of the type used to represent list of objects of +// type 'operator_IAM_role'. +const OperatorIAMRoleListKind = "OperatorIAMRoleList" + +// OperatorIAMRoleListLinkKind is the name of the type used to represent links to list +// of objects of type 'operator_IAM_role'. +const OperatorIAMRoleListLinkKind = "OperatorIAMRoleListLink" + +// OperatorIAMRoleNilKind is the name of the type used to nil lists of objects of +// type 'operator_IAM_role'. +const OperatorIAMRoleListNilKind = "OperatorIAMRoleListNil" + +// OperatorIAMRoleList is a list of values of the 'operator_IAM_role' type. +type OperatorIAMRoleList struct { + href string + link bool + items []*OperatorIAMRole +} + +// Len returns the length of the list. +func (l *OperatorIAMRoleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *OperatorIAMRoleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *OperatorIAMRoleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *OperatorIAMRoleList) SetItems(items []*OperatorIAMRole) { + l.items = items +} + +// Items returns the items of the list. +func (l *OperatorIAMRoleList) Items() []*OperatorIAMRole { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *OperatorIAMRoleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *OperatorIAMRoleList) Get(i int) *OperatorIAMRole { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *OperatorIAMRoleList) Slice() []*OperatorIAMRole { + var slice []*OperatorIAMRole + if l == nil { + slice = make([]*OperatorIAMRole, 0) + } else { + slice = make([]*OperatorIAMRole, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *OperatorIAMRoleList) Each(f func(item *OperatorIAMRole) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *OperatorIAMRoleList) Range(f func(index int, item *OperatorIAMRole) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/operator_iam_role_type_json.go b/clientapi/clustersmgmt/v1/operator_iam_role_type_json.go new file mode 100644 index 00000000..dc2070d8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/operator_iam_role_type_json.go @@ -0,0 +1,138 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOperatorIAMRole writes a value of the 'operator_IAM_role' type to the given writer. +func MarshalOperatorIAMRole(object *OperatorIAMRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOperatorIAMRole(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOperatorIAMRole writes a value of the 'operator_IAM_role' type to the given stream. +func WriteOperatorIAMRole(object *OperatorIAMRole, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("namespace") + stream.WriteString(object.namespace) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role_arn") + stream.WriteString(object.roleARN) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_account") + stream.WriteString(object.serviceAccount) + } + stream.WriteObjectEnd() +} + +// UnmarshalOperatorIAMRole reads a value of the 'operator_IAM_role' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalOperatorIAMRole(source interface{}) (object *OperatorIAMRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadOperatorIAMRole(iterator) + err = iterator.Error + return +} + +// ReadOperatorIAMRole reads a value of the 'operator_IAM_role' type from the given iterator. +func ReadOperatorIAMRole(iterator *jsoniter.Iterator) *OperatorIAMRole { + object := &OperatorIAMRole{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 2 + case "namespace": + value := iterator.ReadString() + object.namespace = value + object.bitmap_ |= 4 + case "role_arn": + value := iterator.ReadString() + object.roleARN = value + object.bitmap_ |= 8 + case "service_account": + value := iterator.ReadString() + object.serviceAccount = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/organization_link_builder.go b/clientapi/clustersmgmt/v1/organization_link_builder.go new file mode 100644 index 00000000..e751a618 --- /dev/null +++ b/clientapi/clustersmgmt/v1/organization_link_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OrganizationLinkBuilder contains the data and logic needed to build 'organization_link' objects. +// +// Definition of an organization link. +type OrganizationLinkBuilder struct { + bitmap_ uint32 + href string + id string +} + +// NewOrganizationLink creates a new builder of 'organization_link' objects. +func NewOrganizationLink() *OrganizationLinkBuilder { + return &OrganizationLinkBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *OrganizationLinkBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// HREF sets the value of the 'HREF' attribute to the given value. +func (b *OrganizationLinkBuilder) HREF(value string) *OrganizationLinkBuilder { + b.href = value + b.bitmap_ |= 1 + return b +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *OrganizationLinkBuilder) ID(value string) *OrganizationLinkBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *OrganizationLinkBuilder) Copy(object *OrganizationLink) *OrganizationLinkBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.href = object.href + b.id = object.id + return b +} + +// Build creates a 'organization_link' object using the configuration stored in the builder. +func (b *OrganizationLinkBuilder) Build() (object *OrganizationLink, err error) { + object = new(OrganizationLink) + object.bitmap_ = b.bitmap_ + object.href = b.href + object.id = b.id + return +} diff --git a/clientapi/clustersmgmt/v1/organization_link_list_builder.go b/clientapi/clustersmgmt/v1/organization_link_list_builder.go new file mode 100644 index 00000000..9b177191 --- /dev/null +++ b/clientapi/clustersmgmt/v1/organization_link_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OrganizationLinkListBuilder contains the data and logic needed to build +// 'organization_link' objects. +type OrganizationLinkListBuilder struct { + items []*OrganizationLinkBuilder +} + +// NewOrganizationLinkList creates a new builder of 'organization_link' objects. +func NewOrganizationLinkList() *OrganizationLinkListBuilder { + return new(OrganizationLinkListBuilder) +} + +// Items sets the items of the list. +func (b *OrganizationLinkListBuilder) Items(values ...*OrganizationLinkBuilder) *OrganizationLinkListBuilder { + b.items = make([]*OrganizationLinkBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *OrganizationLinkListBuilder) 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 *OrganizationLinkListBuilder) Copy(list *OrganizationLinkList) *OrganizationLinkListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*OrganizationLinkBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewOrganizationLink().Copy(v) + } + } + return b +} + +// Build creates a list of 'organization_link' objects using the +// configuration stored in the builder. +func (b *OrganizationLinkListBuilder) Build() (list *OrganizationLinkList, err error) { + items := make([]*OrganizationLink, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(OrganizationLinkList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/organization_link_list_type_json.go b/clientapi/clustersmgmt/v1/organization_link_list_type_json.go new file mode 100644 index 00000000..aa2571e7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/organization_link_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOrganizationLinkList writes a list of values of the 'organization_link' type to +// the given writer. +func MarshalOrganizationLinkList(list []*OrganizationLink, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOrganizationLinkList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOrganizationLinkList writes a list of value of the 'organization_link' type to +// the given stream. +func WriteOrganizationLinkList(list []*OrganizationLink, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteOrganizationLink(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalOrganizationLinkList reads a list of values of the 'organization_link' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalOrganizationLinkList(source interface{}) (items []*OrganizationLink, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadOrganizationLinkList(iterator) + err = iterator.Error + return +} + +// ReadOrganizationLinkList reads list of values of the ”organization_link' type from +// the given iterator. +func ReadOrganizationLinkList(iterator *jsoniter.Iterator) []*OrganizationLink { + list := []*OrganizationLink{} + for iterator.ReadArray() { + item := ReadOrganizationLink(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/organization_link_type.go b/clientapi/clustersmgmt/v1/organization_link_type.go new file mode 100644 index 00000000..9607c412 --- /dev/null +++ b/clientapi/clustersmgmt/v1/organization_link_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// OrganizationLink represents the values of the 'organization_link' type. +// +// Definition of an organization link. +type OrganizationLink struct { + bitmap_ uint32 + href string + id string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *OrganizationLink) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// HREF returns the value of the 'HREF' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HREF for the Organization, filled in response. +func (o *OrganizationLink) HREF() string { + if o != nil && o.bitmap_&1 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the value of the 'HREF' attribute and +// a flag indicating if the attribute has a value. +// +// HREF for the Organization, filled in response. +func (o *OrganizationLink) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.href + } + return +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The organization's ID. +func (o *OrganizationLink) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// The organization's ID. +func (o *OrganizationLink) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// OrganizationLinkListKind is the name of the type used to represent list of objects of +// type 'organization_link'. +const OrganizationLinkListKind = "OrganizationLinkList" + +// OrganizationLinkListLinkKind is the name of the type used to represent links to list +// of objects of type 'organization_link'. +const OrganizationLinkListLinkKind = "OrganizationLinkListLink" + +// OrganizationLinkNilKind is the name of the type used to nil lists of objects of +// type 'organization_link'. +const OrganizationLinkListNilKind = "OrganizationLinkListNil" + +// OrganizationLinkList is a list of values of the 'organization_link' type. +type OrganizationLinkList struct { + href string + link bool + items []*OrganizationLink +} + +// Len returns the length of the list. +func (l *OrganizationLinkList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *OrganizationLinkList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *OrganizationLinkList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *OrganizationLinkList) SetItems(items []*OrganizationLink) { + l.items = items +} + +// Items returns the items of the list. +func (l *OrganizationLinkList) Items() []*OrganizationLink { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *OrganizationLinkList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *OrganizationLinkList) Get(i int) *OrganizationLink { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *OrganizationLinkList) Slice() []*OrganizationLink { + var slice []*OrganizationLink + if l == nil { + slice = make([]*OrganizationLink, 0) + } else { + slice = make([]*OrganizationLink, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *OrganizationLinkList) Each(f func(item *OrganizationLink) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *OrganizationLinkList) Range(f func(index int, item *OrganizationLink) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/organization_link_type_json.go b/clientapi/clustersmgmt/v1/organization_link_type_json.go new file mode 100644 index 00000000..f07fa822 --- /dev/null +++ b/clientapi/clustersmgmt/v1/organization_link_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOrganizationLink writes a value of the 'organization_link' type to the given writer. +func MarshalOrganizationLink(object *OrganizationLink, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOrganizationLink(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOrganizationLink writes a value of the 'organization_link' type to the given stream. +func WriteOrganizationLink(object *OrganizationLink, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + } + stream.WriteObjectEnd() +} + +// UnmarshalOrganizationLink reads a value of the 'organization_link' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalOrganizationLink(source interface{}) (object *OrganizationLink, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadOrganizationLink(iterator) + err = iterator.Error + return +} + +// ReadOrganizationLink reads a value of the 'organization_link' type from the given iterator. +func ReadOrganizationLink(iterator *jsoniter.Iterator) *OrganizationLink { + object := &OrganizationLink{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 1 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/pending_delete_cluster_builder.go b/clientapi/clustersmgmt/v1/pending_delete_cluster_builder.go new file mode 100644 index 00000000..3105e9de --- /dev/null +++ b/clientapi/clustersmgmt/v1/pending_delete_cluster_builder.go @@ -0,0 +1,166 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// PendingDeleteClusterBuilder contains the data and logic needed to build 'pending_delete_cluster' objects. +// +// Represents a pending delete entry for a specific cluster. +type PendingDeleteClusterBuilder struct { + bitmap_ uint32 + id string + href string + cluster *ClusterBuilder + creationTimestamp time.Time + bestEffort bool +} + +// NewPendingDeleteCluster creates a new builder of 'pending_delete_cluster' objects. +func NewPendingDeleteCluster() *PendingDeleteClusterBuilder { + return &PendingDeleteClusterBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *PendingDeleteClusterBuilder) Link(value bool) *PendingDeleteClusterBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *PendingDeleteClusterBuilder) ID(value string) *PendingDeleteClusterBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *PendingDeleteClusterBuilder) HREF(value string) *PendingDeleteClusterBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *PendingDeleteClusterBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// BestEffort sets the value of the 'best_effort' attribute to the given value. +func (b *PendingDeleteClusterBuilder) BestEffort(value bool) *PendingDeleteClusterBuilder { + b.bestEffort = value + b.bitmap_ |= 8 + return b +} + +// Cluster sets the value of the 'cluster' attribute to the given value. +// +// Definition of an _OpenShift_ cluster. +// +// The `cloud_provider` attribute is a reference to the cloud provider. When a +// cluster is retrieved it will be a link to the cloud provider, containing only +// the kind, id and href attributes: +// +// ```json +// +// { +// "cloud_provider": { +// "kind": "CloudProviderLink", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/cloud_providers/123" +// } +// } +// +// ``` +// +// When a cluster is created this is optional, and if used it should contain the +// identifier of the cloud provider to use: +// +// ```json +// +// { +// "cloud_provider": { +// "id": "123", +// } +// } +// +// ``` +// +// If not included, then the cluster will be created using the default cloud +// provider, which is currently Amazon Web Services. +// +// The region attribute is mandatory when a cluster is created. +// +// The `aws.access_key_id`, `aws.secret_access_key` and `dns.base_domain` +// attributes are mandatory when creation a cluster with your own Amazon Web +// Services account. +func (b *PendingDeleteClusterBuilder) Cluster(value *ClusterBuilder) *PendingDeleteClusterBuilder { + b.cluster = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *PendingDeleteClusterBuilder) CreationTimestamp(value time.Time) *PendingDeleteClusterBuilder { + b.creationTimestamp = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *PendingDeleteClusterBuilder) Copy(object *PendingDeleteCluster) *PendingDeleteClusterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.bestEffort = object.bestEffort + if object.cluster != nil { + b.cluster = NewCluster().Copy(object.cluster) + } else { + b.cluster = nil + } + b.creationTimestamp = object.creationTimestamp + return b +} + +// Build creates a 'pending_delete_cluster' object using the configuration stored in the builder. +func (b *PendingDeleteClusterBuilder) Build() (object *PendingDeleteCluster, err error) { + object = new(PendingDeleteCluster) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.bestEffort = b.bestEffort + if b.cluster != nil { + object.cluster, err = b.cluster.Build() + if err != nil { + return + } + } + object.creationTimestamp = b.creationTimestamp + return +} diff --git a/clientapi/clustersmgmt/v1/pending_delete_cluster_list_builder.go b/clientapi/clustersmgmt/v1/pending_delete_cluster_list_builder.go new file mode 100644 index 00000000..d85bebd4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/pending_delete_cluster_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// PendingDeleteClusterListBuilder contains the data and logic needed to build +// 'pending_delete_cluster' objects. +type PendingDeleteClusterListBuilder struct { + items []*PendingDeleteClusterBuilder +} + +// NewPendingDeleteClusterList creates a new builder of 'pending_delete_cluster' objects. +func NewPendingDeleteClusterList() *PendingDeleteClusterListBuilder { + return new(PendingDeleteClusterListBuilder) +} + +// Items sets the items of the list. +func (b *PendingDeleteClusterListBuilder) Items(values ...*PendingDeleteClusterBuilder) *PendingDeleteClusterListBuilder { + b.items = make([]*PendingDeleteClusterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *PendingDeleteClusterListBuilder) 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 *PendingDeleteClusterListBuilder) Copy(list *PendingDeleteClusterList) *PendingDeleteClusterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*PendingDeleteClusterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewPendingDeleteCluster().Copy(v) + } + } + return b +} + +// Build creates a list of 'pending_delete_cluster' objects using the +// configuration stored in the builder. +func (b *PendingDeleteClusterListBuilder) Build() (list *PendingDeleteClusterList, err error) { + items := make([]*PendingDeleteCluster, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(PendingDeleteClusterList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/pending_delete_cluster_list_type_json.go b/clientapi/clustersmgmt/v1/pending_delete_cluster_list_type_json.go new file mode 100644 index 00000000..5a54b92c --- /dev/null +++ b/clientapi/clustersmgmt/v1/pending_delete_cluster_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPendingDeleteClusterList writes a list of values of the 'pending_delete_cluster' type to +// the given writer. +func MarshalPendingDeleteClusterList(list []*PendingDeleteCluster, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePendingDeleteClusterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePendingDeleteClusterList writes a list of value of the 'pending_delete_cluster' type to +// the given stream. +func WritePendingDeleteClusterList(list []*PendingDeleteCluster, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WritePendingDeleteCluster(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalPendingDeleteClusterList reads a list of values of the 'pending_delete_cluster' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalPendingDeleteClusterList(source interface{}) (items []*PendingDeleteCluster, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadPendingDeleteClusterList(iterator) + err = iterator.Error + return +} + +// ReadPendingDeleteClusterList reads list of values of the ”pending_delete_cluster' type from +// the given iterator. +func ReadPendingDeleteClusterList(iterator *jsoniter.Iterator) []*PendingDeleteCluster { + list := []*PendingDeleteCluster{} + for iterator.ReadArray() { + item := ReadPendingDeleteCluster(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/pending_delete_cluster_type.go b/clientapi/clustersmgmt/v1/pending_delete_cluster_type.go new file mode 100644 index 00000000..c4c26337 --- /dev/null +++ b/clientapi/clustersmgmt/v1/pending_delete_cluster_type.go @@ -0,0 +1,319 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// PendingDeleteClusterKind is the name of the type used to represent objects +// of type 'pending_delete_cluster'. +const PendingDeleteClusterKind = "PendingDeleteCluster" + +// PendingDeleteClusterLinkKind is the name of the type used to represent links +// to objects of type 'pending_delete_cluster'. +const PendingDeleteClusterLinkKind = "PendingDeleteClusterLink" + +// PendingDeleteClusterNilKind is the name of the type used to nil references +// to objects of type 'pending_delete_cluster'. +const PendingDeleteClusterNilKind = "PendingDeleteClusterNil" + +// PendingDeleteCluster represents the values of the 'pending_delete_cluster' type. +// +// Represents a pending delete entry for a specific cluster. +type PendingDeleteCluster struct { + bitmap_ uint32 + id string + href string + cluster *Cluster + creationTimestamp time.Time + bestEffort bool +} + +// Kind returns the name of the type of the object. +func (o *PendingDeleteCluster) Kind() string { + if o == nil { + return PendingDeleteClusterNilKind + } + if o.bitmap_&1 != 0 { + return PendingDeleteClusterLinkKind + } + return PendingDeleteClusterKind +} + +// Link returns true if this is a link. +func (o *PendingDeleteCluster) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *PendingDeleteCluster) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *PendingDeleteCluster) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *PendingDeleteCluster) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *PendingDeleteCluster) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *PendingDeleteCluster) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// BestEffort returns the value of the 'best_effort' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Flag indicating if the cluster deletion should be best-effort mode or not. +func (o *PendingDeleteCluster) BestEffort() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.bestEffort + } + return false +} + +// GetBestEffort returns the value of the 'best_effort' attribute and +// a flag indicating if the attribute has a value. +// +// Flag indicating if the cluster deletion should be best-effort mode or not. +func (o *PendingDeleteCluster) GetBestEffort() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.bestEffort + } + return +} + +// Cluster returns the value of the 'cluster' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster is the details of the cluster that is pending deletion. +func (o *PendingDeleteCluster) Cluster() *Cluster { + if o != nil && o.bitmap_&16 != 0 { + return o.cluster + } + return nil +} + +// GetCluster returns the value of the 'cluster' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster is the details of the cluster that is pending deletion. +func (o *PendingDeleteCluster) GetCluster() (value *Cluster, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.cluster + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the cluster was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *PendingDeleteCluster) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the cluster was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *PendingDeleteCluster) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// PendingDeleteClusterListKind is the name of the type used to represent list of objects of +// type 'pending_delete_cluster'. +const PendingDeleteClusterListKind = "PendingDeleteClusterList" + +// PendingDeleteClusterListLinkKind is the name of the type used to represent links to list +// of objects of type 'pending_delete_cluster'. +const PendingDeleteClusterListLinkKind = "PendingDeleteClusterListLink" + +// PendingDeleteClusterNilKind is the name of the type used to nil lists of objects of +// type 'pending_delete_cluster'. +const PendingDeleteClusterListNilKind = "PendingDeleteClusterListNil" + +// PendingDeleteClusterList is a list of values of the 'pending_delete_cluster' type. +type PendingDeleteClusterList struct { + href string + link bool + items []*PendingDeleteCluster +} + +// Kind returns the name of the type of the object. +func (l *PendingDeleteClusterList) Kind() string { + if l == nil { + return PendingDeleteClusterListNilKind + } + if l.link { + return PendingDeleteClusterListLinkKind + } + return PendingDeleteClusterListKind +} + +// Link returns true iif this is a link. +func (l *PendingDeleteClusterList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *PendingDeleteClusterList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *PendingDeleteClusterList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *PendingDeleteClusterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *PendingDeleteClusterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *PendingDeleteClusterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *PendingDeleteClusterList) SetItems(items []*PendingDeleteCluster) { + l.items = items +} + +// Items returns the items of the list. +func (l *PendingDeleteClusterList) Items() []*PendingDeleteCluster { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *PendingDeleteClusterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *PendingDeleteClusterList) Get(i int) *PendingDeleteCluster { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *PendingDeleteClusterList) Slice() []*PendingDeleteCluster { + var slice []*PendingDeleteCluster + if l == nil { + slice = make([]*PendingDeleteCluster, 0) + } else { + slice = make([]*PendingDeleteCluster, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *PendingDeleteClusterList) Each(f func(item *PendingDeleteCluster) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *PendingDeleteClusterList) Range(f func(index int, item *PendingDeleteCluster) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/pending_delete_cluster_type_json.go b/clientapi/clustersmgmt/v1/pending_delete_cluster_type_json.go new file mode 100644 index 00000000..f75cd3ef --- /dev/null +++ b/clientapi/clustersmgmt/v1/pending_delete_cluster_type_json.go @@ -0,0 +1,151 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPendingDeleteCluster writes a value of the 'pending_delete_cluster' type to the given writer. +func MarshalPendingDeleteCluster(object *PendingDeleteCluster, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePendingDeleteCluster(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePendingDeleteCluster writes a value of the 'pending_delete_cluster' type to the given stream. +func WritePendingDeleteCluster(object *PendingDeleteCluster, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(PendingDeleteClusterLinkKind) + } else { + stream.WriteString(PendingDeleteClusterKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("best_effort") + stream.WriteBool(object.bestEffort) + count++ + } + present_ = object.bitmap_&16 != 0 && object.cluster != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster") + WriteCluster(object.cluster, stream) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalPendingDeleteCluster reads a value of the 'pending_delete_cluster' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalPendingDeleteCluster(source interface{}) (object *PendingDeleteCluster, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadPendingDeleteCluster(iterator) + err = iterator.Error + return +} + +// ReadPendingDeleteCluster reads a value of the 'pending_delete_cluster' type from the given iterator. +func ReadPendingDeleteCluster(iterator *jsoniter.Iterator) *PendingDeleteCluster { + object := &PendingDeleteCluster{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == PendingDeleteClusterLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "best_effort": + value := iterator.ReadBool() + object.bestEffort = value + object.bitmap_ |= 8 + case "cluster": + value := ReadCluster(iterator) + object.cluster = value + object.bitmap_ |= 16 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/platform_list_type_json.go b/clientapi/clustersmgmt/v1/platform_list_type_json.go new file mode 100644 index 00000000..6bd75cd5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/platform_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPlatformList writes a list of values of the 'platform' type to +// the given writer. +func MarshalPlatformList(list []Platform, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePlatformList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePlatformList writes a list of value of the 'platform' type to +// the given stream. +func WritePlatformList(list []Platform, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalPlatformList reads a list of values of the 'platform' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalPlatformList(source interface{}) (items []Platform, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadPlatformList(iterator) + err = iterator.Error + return +} + +// ReadPlatformList reads list of values of the ”platform' type from +// the given iterator. +func ReadPlatformList(iterator *jsoniter.Iterator) []Platform { + list := []Platform{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := Platform(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/platform_type.go b/clientapi/clustersmgmt/v1/platform_type.go new file mode 100644 index 00000000..68a4e6d2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/platform_type.go @@ -0,0 +1,36 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// Platform represents the values of the 'platform' enumerated type. +type Platform string + +const ( + // + PlatformAws Platform = "aws" + // + PlatformAwsClassic Platform = "aws-classic" + // + PlatformAwsHostedCp Platform = "aws-hosted-cp" + // + PlatformGcp Platform = "gcp" + // + PlatformHostedCluster Platform = "hostedcluster" +) diff --git a/clientapi/clustersmgmt/v1/private_link_cluster_configuration_builder.go b/clientapi/clustersmgmt/v1/private_link_cluster_configuration_builder.go new file mode 100644 index 00000000..403f96bb --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_cluster_configuration_builder.go @@ -0,0 +1,79 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// PrivateLinkClusterConfigurationBuilder contains the data and logic needed to build 'private_link_cluster_configuration' objects. +// +// Manages the configuration for the Private Links. +type PrivateLinkClusterConfigurationBuilder struct { + bitmap_ uint32 + principals []*PrivateLinkPrincipalBuilder +} + +// NewPrivateLinkClusterConfiguration creates a new builder of 'private_link_cluster_configuration' objects. +func NewPrivateLinkClusterConfiguration() *PrivateLinkClusterConfigurationBuilder { + return &PrivateLinkClusterConfigurationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *PrivateLinkClusterConfigurationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Principals sets the value of the 'principals' attribute to the given values. +func (b *PrivateLinkClusterConfigurationBuilder) Principals(values ...*PrivateLinkPrincipalBuilder) *PrivateLinkClusterConfigurationBuilder { + b.principals = make([]*PrivateLinkPrincipalBuilder, len(values)) + copy(b.principals, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *PrivateLinkClusterConfigurationBuilder) Copy(object *PrivateLinkClusterConfiguration) *PrivateLinkClusterConfigurationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.principals != nil { + b.principals = make([]*PrivateLinkPrincipalBuilder, len(object.principals)) + for i, v := range object.principals { + b.principals[i] = NewPrivateLinkPrincipal().Copy(v) + } + } else { + b.principals = nil + } + return b +} + +// Build creates a 'private_link_cluster_configuration' object using the configuration stored in the builder. +func (b *PrivateLinkClusterConfigurationBuilder) Build() (object *PrivateLinkClusterConfiguration, err error) { + object = new(PrivateLinkClusterConfiguration) + object.bitmap_ = b.bitmap_ + if b.principals != nil { + object.principals = make([]*PrivateLinkPrincipal, len(b.principals)) + for i, v := range b.principals { + object.principals[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/private_link_cluster_configuration_list_builder.go b/clientapi/clustersmgmt/v1/private_link_cluster_configuration_list_builder.go new file mode 100644 index 00000000..c5ed12a4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_cluster_configuration_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// PrivateLinkClusterConfigurationListBuilder contains the data and logic needed to build +// 'private_link_cluster_configuration' objects. +type PrivateLinkClusterConfigurationListBuilder struct { + items []*PrivateLinkClusterConfigurationBuilder +} + +// NewPrivateLinkClusterConfigurationList creates a new builder of 'private_link_cluster_configuration' objects. +func NewPrivateLinkClusterConfigurationList() *PrivateLinkClusterConfigurationListBuilder { + return new(PrivateLinkClusterConfigurationListBuilder) +} + +// Items sets the items of the list. +func (b *PrivateLinkClusterConfigurationListBuilder) Items(values ...*PrivateLinkClusterConfigurationBuilder) *PrivateLinkClusterConfigurationListBuilder { + b.items = make([]*PrivateLinkClusterConfigurationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *PrivateLinkClusterConfigurationListBuilder) 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 *PrivateLinkClusterConfigurationListBuilder) Copy(list *PrivateLinkClusterConfigurationList) *PrivateLinkClusterConfigurationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*PrivateLinkClusterConfigurationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewPrivateLinkClusterConfiguration().Copy(v) + } + } + return b +} + +// Build creates a list of 'private_link_cluster_configuration' objects using the +// configuration stored in the builder. +func (b *PrivateLinkClusterConfigurationListBuilder) Build() (list *PrivateLinkClusterConfigurationList, err error) { + items := make([]*PrivateLinkClusterConfiguration, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(PrivateLinkClusterConfigurationList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/private_link_cluster_configuration_list_type_json.go b/clientapi/clustersmgmt/v1/private_link_cluster_configuration_list_type_json.go new file mode 100644 index 00000000..f2cc47ac --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_cluster_configuration_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPrivateLinkClusterConfigurationList writes a list of values of the 'private_link_cluster_configuration' type to +// the given writer. +func MarshalPrivateLinkClusterConfigurationList(list []*PrivateLinkClusterConfiguration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePrivateLinkClusterConfigurationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePrivateLinkClusterConfigurationList writes a list of value of the 'private_link_cluster_configuration' type to +// the given stream. +func WritePrivateLinkClusterConfigurationList(list []*PrivateLinkClusterConfiguration, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WritePrivateLinkClusterConfiguration(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalPrivateLinkClusterConfigurationList reads a list of values of the 'private_link_cluster_configuration' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalPrivateLinkClusterConfigurationList(source interface{}) (items []*PrivateLinkClusterConfiguration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadPrivateLinkClusterConfigurationList(iterator) + err = iterator.Error + return +} + +// ReadPrivateLinkClusterConfigurationList reads list of values of the ”private_link_cluster_configuration' type from +// the given iterator. +func ReadPrivateLinkClusterConfigurationList(iterator *jsoniter.Iterator) []*PrivateLinkClusterConfiguration { + list := []*PrivateLinkClusterConfiguration{} + for iterator.ReadArray() { + item := ReadPrivateLinkClusterConfiguration(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/private_link_cluster_configuration_type.go b/clientapi/clustersmgmt/v1/private_link_cluster_configuration_type.go new file mode 100644 index 00000000..809fb4c4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_cluster_configuration_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// PrivateLinkClusterConfiguration represents the values of the 'private_link_cluster_configuration' type. +// +// Manages the configuration for the Private Links. +type PrivateLinkClusterConfiguration struct { + bitmap_ uint32 + principals []*PrivateLinkPrincipal +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *PrivateLinkClusterConfiguration) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Principals returns the value of the 'principals' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of additional principals for the Private Link +func (o *PrivateLinkClusterConfiguration) Principals() []*PrivateLinkPrincipal { + if o != nil && o.bitmap_&1 != 0 { + return o.principals + } + return nil +} + +// GetPrincipals returns the value of the 'principals' attribute and +// a flag indicating if the attribute has a value. +// +// List of additional principals for the Private Link +func (o *PrivateLinkClusterConfiguration) GetPrincipals() (value []*PrivateLinkPrincipal, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.principals + } + return +} + +// PrivateLinkClusterConfigurationListKind is the name of the type used to represent list of objects of +// type 'private_link_cluster_configuration'. +const PrivateLinkClusterConfigurationListKind = "PrivateLinkClusterConfigurationList" + +// PrivateLinkClusterConfigurationListLinkKind is the name of the type used to represent links to list +// of objects of type 'private_link_cluster_configuration'. +const PrivateLinkClusterConfigurationListLinkKind = "PrivateLinkClusterConfigurationListLink" + +// PrivateLinkClusterConfigurationNilKind is the name of the type used to nil lists of objects of +// type 'private_link_cluster_configuration'. +const PrivateLinkClusterConfigurationListNilKind = "PrivateLinkClusterConfigurationListNil" + +// PrivateLinkClusterConfigurationList is a list of values of the 'private_link_cluster_configuration' type. +type PrivateLinkClusterConfigurationList struct { + href string + link bool + items []*PrivateLinkClusterConfiguration +} + +// Len returns the length of the list. +func (l *PrivateLinkClusterConfigurationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *PrivateLinkClusterConfigurationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *PrivateLinkClusterConfigurationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *PrivateLinkClusterConfigurationList) SetItems(items []*PrivateLinkClusterConfiguration) { + l.items = items +} + +// Items returns the items of the list. +func (l *PrivateLinkClusterConfigurationList) Items() []*PrivateLinkClusterConfiguration { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *PrivateLinkClusterConfigurationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *PrivateLinkClusterConfigurationList) Get(i int) *PrivateLinkClusterConfiguration { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *PrivateLinkClusterConfigurationList) Slice() []*PrivateLinkClusterConfiguration { + var slice []*PrivateLinkClusterConfiguration + if l == nil { + slice = make([]*PrivateLinkClusterConfiguration, 0) + } else { + slice = make([]*PrivateLinkClusterConfiguration, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *PrivateLinkClusterConfigurationList) Each(f func(item *PrivateLinkClusterConfiguration) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *PrivateLinkClusterConfigurationList) Range(f func(index int, item *PrivateLinkClusterConfiguration) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/private_link_cluster_configuration_type_json.go b/clientapi/clustersmgmt/v1/private_link_cluster_configuration_type_json.go new file mode 100644 index 00000000..ed11b9ee --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_cluster_configuration_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPrivateLinkClusterConfiguration writes a value of the 'private_link_cluster_configuration' type to the given writer. +func MarshalPrivateLinkClusterConfiguration(object *PrivateLinkClusterConfiguration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePrivateLinkClusterConfiguration(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePrivateLinkClusterConfiguration writes a value of the 'private_link_cluster_configuration' type to the given stream. +func WritePrivateLinkClusterConfiguration(object *PrivateLinkClusterConfiguration, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.principals != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("principals") + WritePrivateLinkPrincipalList(object.principals, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalPrivateLinkClusterConfiguration reads a value of the 'private_link_cluster_configuration' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalPrivateLinkClusterConfiguration(source interface{}) (object *PrivateLinkClusterConfiguration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadPrivateLinkClusterConfiguration(iterator) + err = iterator.Error + return +} + +// ReadPrivateLinkClusterConfiguration reads a value of the 'private_link_cluster_configuration' type from the given iterator. +func ReadPrivateLinkClusterConfiguration(iterator *jsoniter.Iterator) *PrivateLinkClusterConfiguration { + object := &PrivateLinkClusterConfiguration{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "principals": + value := ReadPrivateLinkPrincipalList(iterator) + object.principals = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/private_link_configuration_builder.go b/clientapi/clustersmgmt/v1/private_link_configuration_builder.go new file mode 100644 index 00000000..7300bbd2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_configuration_builder.go @@ -0,0 +1,78 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// PrivateLinkConfigurationBuilder contains the data and logic needed to build 'private_link_configuration' objects. +// +// Manages the configuration for the Private Links. +type PrivateLinkConfigurationBuilder struct { + bitmap_ uint32 + principals *PrivateLinkPrincipalsBuilder +} + +// NewPrivateLinkConfiguration creates a new builder of 'private_link_configuration' objects. +func NewPrivateLinkConfiguration() *PrivateLinkConfigurationBuilder { + return &PrivateLinkConfigurationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *PrivateLinkConfigurationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Principals sets the value of the 'principals' attribute to the given value. +// +// Contains a list of principals for the Private Link. +func (b *PrivateLinkConfigurationBuilder) Principals(value *PrivateLinkPrincipalsBuilder) *PrivateLinkConfigurationBuilder { + b.principals = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *PrivateLinkConfigurationBuilder) Copy(object *PrivateLinkConfiguration) *PrivateLinkConfigurationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.principals != nil { + b.principals = NewPrivateLinkPrincipals().Copy(object.principals) + } else { + b.principals = nil + } + return b +} + +// Build creates a 'private_link_configuration' object using the configuration stored in the builder. +func (b *PrivateLinkConfigurationBuilder) Build() (object *PrivateLinkConfiguration, err error) { + object = new(PrivateLinkConfiguration) + object.bitmap_ = b.bitmap_ + if b.principals != nil { + object.principals, err = b.principals.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/private_link_configuration_list_builder.go b/clientapi/clustersmgmt/v1/private_link_configuration_list_builder.go new file mode 100644 index 00000000..2a520af9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_configuration_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// PrivateLinkConfigurationListBuilder contains the data and logic needed to build +// 'private_link_configuration' objects. +type PrivateLinkConfigurationListBuilder struct { + items []*PrivateLinkConfigurationBuilder +} + +// NewPrivateLinkConfigurationList creates a new builder of 'private_link_configuration' objects. +func NewPrivateLinkConfigurationList() *PrivateLinkConfigurationListBuilder { + return new(PrivateLinkConfigurationListBuilder) +} + +// Items sets the items of the list. +func (b *PrivateLinkConfigurationListBuilder) Items(values ...*PrivateLinkConfigurationBuilder) *PrivateLinkConfigurationListBuilder { + b.items = make([]*PrivateLinkConfigurationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *PrivateLinkConfigurationListBuilder) 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 *PrivateLinkConfigurationListBuilder) Copy(list *PrivateLinkConfigurationList) *PrivateLinkConfigurationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*PrivateLinkConfigurationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewPrivateLinkConfiguration().Copy(v) + } + } + return b +} + +// Build creates a list of 'private_link_configuration' objects using the +// configuration stored in the builder. +func (b *PrivateLinkConfigurationListBuilder) Build() (list *PrivateLinkConfigurationList, err error) { + items := make([]*PrivateLinkConfiguration, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(PrivateLinkConfigurationList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/private_link_configuration_list_type_json.go b/clientapi/clustersmgmt/v1/private_link_configuration_list_type_json.go new file mode 100644 index 00000000..30d2c335 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_configuration_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPrivateLinkConfigurationList writes a list of values of the 'private_link_configuration' type to +// the given writer. +func MarshalPrivateLinkConfigurationList(list []*PrivateLinkConfiguration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePrivateLinkConfigurationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePrivateLinkConfigurationList writes a list of value of the 'private_link_configuration' type to +// the given stream. +func WritePrivateLinkConfigurationList(list []*PrivateLinkConfiguration, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WritePrivateLinkConfiguration(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalPrivateLinkConfigurationList reads a list of values of the 'private_link_configuration' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalPrivateLinkConfigurationList(source interface{}) (items []*PrivateLinkConfiguration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadPrivateLinkConfigurationList(iterator) + err = iterator.Error + return +} + +// ReadPrivateLinkConfigurationList reads list of values of the ”private_link_configuration' type from +// the given iterator. +func ReadPrivateLinkConfigurationList(iterator *jsoniter.Iterator) []*PrivateLinkConfiguration { + list := []*PrivateLinkConfiguration{} + for iterator.ReadArray() { + item := ReadPrivateLinkConfiguration(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/private_link_configuration_type.go b/clientapi/clustersmgmt/v1/private_link_configuration_type.go new file mode 100644 index 00000000..430c84a3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_configuration_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// PrivateLinkConfiguration represents the values of the 'private_link_configuration' type. +// +// Manages the configuration for the Private Links. +type PrivateLinkConfiguration struct { + bitmap_ uint32 + principals *PrivateLinkPrincipals +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *PrivateLinkConfiguration) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Principals returns the value of the 'principals' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of additional principals for the Private Link +func (o *PrivateLinkConfiguration) Principals() *PrivateLinkPrincipals { + if o != nil && o.bitmap_&1 != 0 { + return o.principals + } + return nil +} + +// GetPrincipals returns the value of the 'principals' attribute and +// a flag indicating if the attribute has a value. +// +// List of additional principals for the Private Link +func (o *PrivateLinkConfiguration) GetPrincipals() (value *PrivateLinkPrincipals, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.principals + } + return +} + +// PrivateLinkConfigurationListKind is the name of the type used to represent list of objects of +// type 'private_link_configuration'. +const PrivateLinkConfigurationListKind = "PrivateLinkConfigurationList" + +// PrivateLinkConfigurationListLinkKind is the name of the type used to represent links to list +// of objects of type 'private_link_configuration'. +const PrivateLinkConfigurationListLinkKind = "PrivateLinkConfigurationListLink" + +// PrivateLinkConfigurationNilKind is the name of the type used to nil lists of objects of +// type 'private_link_configuration'. +const PrivateLinkConfigurationListNilKind = "PrivateLinkConfigurationListNil" + +// PrivateLinkConfigurationList is a list of values of the 'private_link_configuration' type. +type PrivateLinkConfigurationList struct { + href string + link bool + items []*PrivateLinkConfiguration +} + +// Len returns the length of the list. +func (l *PrivateLinkConfigurationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *PrivateLinkConfigurationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *PrivateLinkConfigurationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *PrivateLinkConfigurationList) SetItems(items []*PrivateLinkConfiguration) { + l.items = items +} + +// Items returns the items of the list. +func (l *PrivateLinkConfigurationList) Items() []*PrivateLinkConfiguration { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *PrivateLinkConfigurationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *PrivateLinkConfigurationList) Get(i int) *PrivateLinkConfiguration { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *PrivateLinkConfigurationList) Slice() []*PrivateLinkConfiguration { + var slice []*PrivateLinkConfiguration + if l == nil { + slice = make([]*PrivateLinkConfiguration, 0) + } else { + slice = make([]*PrivateLinkConfiguration, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *PrivateLinkConfigurationList) Each(f func(item *PrivateLinkConfiguration) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *PrivateLinkConfigurationList) Range(f func(index int, item *PrivateLinkConfiguration) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/private_link_configuration_type_json.go b/clientapi/clustersmgmt/v1/private_link_configuration_type_json.go new file mode 100644 index 00000000..bedb9048 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_configuration_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPrivateLinkConfiguration writes a value of the 'private_link_configuration' type to the given writer. +func MarshalPrivateLinkConfiguration(object *PrivateLinkConfiguration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePrivateLinkConfiguration(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePrivateLinkConfiguration writes a value of the 'private_link_configuration' type to the given stream. +func WritePrivateLinkConfiguration(object *PrivateLinkConfiguration, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.principals != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("principals") + WritePrivateLinkPrincipals(object.principals, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalPrivateLinkConfiguration reads a value of the 'private_link_configuration' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalPrivateLinkConfiguration(source interface{}) (object *PrivateLinkConfiguration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadPrivateLinkConfiguration(iterator) + err = iterator.Error + return +} + +// ReadPrivateLinkConfiguration reads a value of the 'private_link_configuration' type from the given iterator. +func ReadPrivateLinkConfiguration(iterator *jsoniter.Iterator) *PrivateLinkConfiguration { + object := &PrivateLinkConfiguration{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "principals": + value := ReadPrivateLinkPrincipals(iterator) + object.principals = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/private_link_principal_builder.go b/clientapi/clustersmgmt/v1/private_link_principal_builder.go new file mode 100644 index 00000000..4f582b73 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_principal_builder.go @@ -0,0 +1,87 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// PrivateLinkPrincipalBuilder contains the data and logic needed to build 'private_link_principal' objects. +type PrivateLinkPrincipalBuilder struct { + bitmap_ uint32 + id string + href string + principal string +} + +// NewPrivateLinkPrincipal creates a new builder of 'private_link_principal' objects. +func NewPrivateLinkPrincipal() *PrivateLinkPrincipalBuilder { + return &PrivateLinkPrincipalBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *PrivateLinkPrincipalBuilder) Link(value bool) *PrivateLinkPrincipalBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *PrivateLinkPrincipalBuilder) ID(value string) *PrivateLinkPrincipalBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *PrivateLinkPrincipalBuilder) HREF(value string) *PrivateLinkPrincipalBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *PrivateLinkPrincipalBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Principal sets the value of the 'principal' attribute to the given value. +func (b *PrivateLinkPrincipalBuilder) Principal(value string) *PrivateLinkPrincipalBuilder { + b.principal = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *PrivateLinkPrincipalBuilder) Copy(object *PrivateLinkPrincipal) *PrivateLinkPrincipalBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.principal = object.principal + return b +} + +// Build creates a 'private_link_principal' object using the configuration stored in the builder. +func (b *PrivateLinkPrincipalBuilder) Build() (object *PrivateLinkPrincipal, err error) { + object = new(PrivateLinkPrincipal) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.principal = b.principal + return +} diff --git a/clientapi/clustersmgmt/v1/private_link_principal_list_builder.go b/clientapi/clustersmgmt/v1/private_link_principal_list_builder.go new file mode 100644 index 00000000..62eeab41 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_principal_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// PrivateLinkPrincipalListBuilder contains the data and logic needed to build +// 'private_link_principal' objects. +type PrivateLinkPrincipalListBuilder struct { + items []*PrivateLinkPrincipalBuilder +} + +// NewPrivateLinkPrincipalList creates a new builder of 'private_link_principal' objects. +func NewPrivateLinkPrincipalList() *PrivateLinkPrincipalListBuilder { + return new(PrivateLinkPrincipalListBuilder) +} + +// Items sets the items of the list. +func (b *PrivateLinkPrincipalListBuilder) Items(values ...*PrivateLinkPrincipalBuilder) *PrivateLinkPrincipalListBuilder { + b.items = make([]*PrivateLinkPrincipalBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *PrivateLinkPrincipalListBuilder) 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 *PrivateLinkPrincipalListBuilder) Copy(list *PrivateLinkPrincipalList) *PrivateLinkPrincipalListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*PrivateLinkPrincipalBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewPrivateLinkPrincipal().Copy(v) + } + } + return b +} + +// Build creates a list of 'private_link_principal' objects using the +// configuration stored in the builder. +func (b *PrivateLinkPrincipalListBuilder) Build() (list *PrivateLinkPrincipalList, err error) { + items := make([]*PrivateLinkPrincipal, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(PrivateLinkPrincipalList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/private_link_principal_list_type_json.go b/clientapi/clustersmgmt/v1/private_link_principal_list_type_json.go new file mode 100644 index 00000000..4ac7a851 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_principal_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPrivateLinkPrincipalList writes a list of values of the 'private_link_principal' type to +// the given writer. +func MarshalPrivateLinkPrincipalList(list []*PrivateLinkPrincipal, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePrivateLinkPrincipalList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePrivateLinkPrincipalList writes a list of value of the 'private_link_principal' type to +// the given stream. +func WritePrivateLinkPrincipalList(list []*PrivateLinkPrincipal, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WritePrivateLinkPrincipal(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalPrivateLinkPrincipalList reads a list of values of the 'private_link_principal' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalPrivateLinkPrincipalList(source interface{}) (items []*PrivateLinkPrincipal, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadPrivateLinkPrincipalList(iterator) + err = iterator.Error + return +} + +// ReadPrivateLinkPrincipalList reads list of values of the ”private_link_principal' type from +// the given iterator. +func ReadPrivateLinkPrincipalList(iterator *jsoniter.Iterator) []*PrivateLinkPrincipal { + list := []*PrivateLinkPrincipal{} + for iterator.ReadArray() { + item := ReadPrivateLinkPrincipal(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/private_link_principal_type.go b/clientapi/clustersmgmt/v1/private_link_principal_type.go new file mode 100644 index 00000000..ff9f201a --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_principal_type.go @@ -0,0 +1,263 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// PrivateLinkPrincipalKind is the name of the type used to represent objects +// of type 'private_link_principal'. +const PrivateLinkPrincipalKind = "PrivateLinkPrincipal" + +// PrivateLinkPrincipalLinkKind is the name of the type used to represent links +// to objects of type 'private_link_principal'. +const PrivateLinkPrincipalLinkKind = "PrivateLinkPrincipalLink" + +// PrivateLinkPrincipalNilKind is the name of the type used to nil references +// to objects of type 'private_link_principal'. +const PrivateLinkPrincipalNilKind = "PrivateLinkPrincipalNil" + +// PrivateLinkPrincipal represents the values of the 'private_link_principal' type. +type PrivateLinkPrincipal struct { + bitmap_ uint32 + id string + href string + principal string +} + +// Kind returns the name of the type of the object. +func (o *PrivateLinkPrincipal) Kind() string { + if o == nil { + return PrivateLinkPrincipalNilKind + } + if o.bitmap_&1 != 0 { + return PrivateLinkPrincipalLinkKind + } + return PrivateLinkPrincipalKind +} + +// Link returns true if this is a link. +func (o *PrivateLinkPrincipal) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *PrivateLinkPrincipal) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *PrivateLinkPrincipal) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *PrivateLinkPrincipal) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *PrivateLinkPrincipal) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *PrivateLinkPrincipal) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Principal returns the value of the 'principal' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN for a principal that is allowed for this Private Link. +func (o *PrivateLinkPrincipal) Principal() string { + if o != nil && o.bitmap_&8 != 0 { + return o.principal + } + return "" +} + +// GetPrincipal returns the value of the 'principal' attribute and +// a flag indicating if the attribute has a value. +// +// ARN for a principal that is allowed for this Private Link. +func (o *PrivateLinkPrincipal) GetPrincipal() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.principal + } + return +} + +// PrivateLinkPrincipalListKind is the name of the type used to represent list of objects of +// type 'private_link_principal'. +const PrivateLinkPrincipalListKind = "PrivateLinkPrincipalList" + +// PrivateLinkPrincipalListLinkKind is the name of the type used to represent links to list +// of objects of type 'private_link_principal'. +const PrivateLinkPrincipalListLinkKind = "PrivateLinkPrincipalListLink" + +// PrivateLinkPrincipalNilKind is the name of the type used to nil lists of objects of +// type 'private_link_principal'. +const PrivateLinkPrincipalListNilKind = "PrivateLinkPrincipalListNil" + +// PrivateLinkPrincipalList is a list of values of the 'private_link_principal' type. +type PrivateLinkPrincipalList struct { + href string + link bool + items []*PrivateLinkPrincipal +} + +// Kind returns the name of the type of the object. +func (l *PrivateLinkPrincipalList) Kind() string { + if l == nil { + return PrivateLinkPrincipalListNilKind + } + if l.link { + return PrivateLinkPrincipalListLinkKind + } + return PrivateLinkPrincipalListKind +} + +// Link returns true iif this is a link. +func (l *PrivateLinkPrincipalList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *PrivateLinkPrincipalList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *PrivateLinkPrincipalList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *PrivateLinkPrincipalList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *PrivateLinkPrincipalList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *PrivateLinkPrincipalList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *PrivateLinkPrincipalList) SetItems(items []*PrivateLinkPrincipal) { + l.items = items +} + +// Items returns the items of the list. +func (l *PrivateLinkPrincipalList) Items() []*PrivateLinkPrincipal { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *PrivateLinkPrincipalList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *PrivateLinkPrincipalList) Get(i int) *PrivateLinkPrincipal { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *PrivateLinkPrincipalList) Slice() []*PrivateLinkPrincipal { + var slice []*PrivateLinkPrincipal + if l == nil { + slice = make([]*PrivateLinkPrincipal, 0) + } else { + slice = make([]*PrivateLinkPrincipal, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *PrivateLinkPrincipalList) Each(f func(item *PrivateLinkPrincipal) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *PrivateLinkPrincipalList) Range(f func(index int, item *PrivateLinkPrincipal) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/private_link_principal_type_json.go b/clientapi/clustersmgmt/v1/private_link_principal_type_json.go new file mode 100644 index 00000000..94ef1f98 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_principal_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPrivateLinkPrincipal writes a value of the 'private_link_principal' type to the given writer. +func MarshalPrivateLinkPrincipal(object *PrivateLinkPrincipal, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePrivateLinkPrincipal(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePrivateLinkPrincipal writes a value of the 'private_link_principal' type to the given stream. +func WritePrivateLinkPrincipal(object *PrivateLinkPrincipal, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(PrivateLinkPrincipalLinkKind) + } else { + stream.WriteString(PrivateLinkPrincipalKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("principal") + stream.WriteString(object.principal) + } + stream.WriteObjectEnd() +} + +// UnmarshalPrivateLinkPrincipal reads a value of the 'private_link_principal' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalPrivateLinkPrincipal(source interface{}) (object *PrivateLinkPrincipal, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadPrivateLinkPrincipal(iterator) + err = iterator.Error + return +} + +// ReadPrivateLinkPrincipal reads a value of the 'private_link_principal' type from the given iterator. +func ReadPrivateLinkPrincipal(iterator *jsoniter.Iterator) *PrivateLinkPrincipal { + object := &PrivateLinkPrincipal{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == PrivateLinkPrincipalLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "principal": + value := iterator.ReadString() + object.principal = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/private_link_principals_builder.go b/clientapi/clustersmgmt/v1/private_link_principals_builder.go new file mode 100644 index 00000000..2fd02bc3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_principals_builder.go @@ -0,0 +1,105 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// PrivateLinkPrincipalsBuilder contains the data and logic needed to build 'private_link_principals' objects. +// +// Contains a list of principals for the Private Link. +type PrivateLinkPrincipalsBuilder struct { + bitmap_ uint32 + id string + href string + principals []*PrivateLinkPrincipalBuilder +} + +// NewPrivateLinkPrincipals creates a new builder of 'private_link_principals' objects. +func NewPrivateLinkPrincipals() *PrivateLinkPrincipalsBuilder { + return &PrivateLinkPrincipalsBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *PrivateLinkPrincipalsBuilder) Link(value bool) *PrivateLinkPrincipalsBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *PrivateLinkPrincipalsBuilder) ID(value string) *PrivateLinkPrincipalsBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *PrivateLinkPrincipalsBuilder) HREF(value string) *PrivateLinkPrincipalsBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *PrivateLinkPrincipalsBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Principals sets the value of the 'principals' attribute to the given values. +func (b *PrivateLinkPrincipalsBuilder) Principals(values ...*PrivateLinkPrincipalBuilder) *PrivateLinkPrincipalsBuilder { + b.principals = make([]*PrivateLinkPrincipalBuilder, len(values)) + copy(b.principals, values) + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *PrivateLinkPrincipalsBuilder) Copy(object *PrivateLinkPrincipals) *PrivateLinkPrincipalsBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.principals != nil { + b.principals = make([]*PrivateLinkPrincipalBuilder, len(object.principals)) + for i, v := range object.principals { + b.principals[i] = NewPrivateLinkPrincipal().Copy(v) + } + } else { + b.principals = nil + } + return b +} + +// Build creates a 'private_link_principals' object using the configuration stored in the builder. +func (b *PrivateLinkPrincipalsBuilder) Build() (object *PrivateLinkPrincipals, err error) { + object = new(PrivateLinkPrincipals) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.principals != nil { + object.principals = make([]*PrivateLinkPrincipal, len(b.principals)) + for i, v := range b.principals { + object.principals[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/private_link_principals_list_builder.go b/clientapi/clustersmgmt/v1/private_link_principals_list_builder.go new file mode 100644 index 00000000..3499f9de --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_principals_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// PrivateLinkPrincipalsListBuilder contains the data and logic needed to build +// 'private_link_principals' objects. +type PrivateLinkPrincipalsListBuilder struct { + items []*PrivateLinkPrincipalsBuilder +} + +// NewPrivateLinkPrincipalsList creates a new builder of 'private_link_principals' objects. +func NewPrivateLinkPrincipalsList() *PrivateLinkPrincipalsListBuilder { + return new(PrivateLinkPrincipalsListBuilder) +} + +// Items sets the items of the list. +func (b *PrivateLinkPrincipalsListBuilder) Items(values ...*PrivateLinkPrincipalsBuilder) *PrivateLinkPrincipalsListBuilder { + b.items = make([]*PrivateLinkPrincipalsBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *PrivateLinkPrincipalsListBuilder) 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 *PrivateLinkPrincipalsListBuilder) Copy(list *PrivateLinkPrincipalsList) *PrivateLinkPrincipalsListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*PrivateLinkPrincipalsBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewPrivateLinkPrincipals().Copy(v) + } + } + return b +} + +// Build creates a list of 'private_link_principals' objects using the +// configuration stored in the builder. +func (b *PrivateLinkPrincipalsListBuilder) Build() (list *PrivateLinkPrincipalsList, err error) { + items := make([]*PrivateLinkPrincipals, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(PrivateLinkPrincipalsList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/private_link_principals_list_type_json.go b/clientapi/clustersmgmt/v1/private_link_principals_list_type_json.go new file mode 100644 index 00000000..3a7d72b9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_principals_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPrivateLinkPrincipalsList writes a list of values of the 'private_link_principals' type to +// the given writer. +func MarshalPrivateLinkPrincipalsList(list []*PrivateLinkPrincipals, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePrivateLinkPrincipalsList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePrivateLinkPrincipalsList writes a list of value of the 'private_link_principals' type to +// the given stream. +func WritePrivateLinkPrincipalsList(list []*PrivateLinkPrincipals, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WritePrivateLinkPrincipals(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalPrivateLinkPrincipalsList reads a list of values of the 'private_link_principals' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalPrivateLinkPrincipalsList(source interface{}) (items []*PrivateLinkPrincipals, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadPrivateLinkPrincipalsList(iterator) + err = iterator.Error + return +} + +// ReadPrivateLinkPrincipalsList reads list of values of the ”private_link_principals' type from +// the given iterator. +func ReadPrivateLinkPrincipalsList(iterator *jsoniter.Iterator) []*PrivateLinkPrincipals { + list := []*PrivateLinkPrincipals{} + for iterator.ReadArray() { + item := ReadPrivateLinkPrincipals(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/private_link_principals_type.go b/clientapi/clustersmgmt/v1/private_link_principals_type.go new file mode 100644 index 00000000..ea1eb123 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_principals_type.go @@ -0,0 +1,265 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// PrivateLinkPrincipalsKind is the name of the type used to represent objects +// of type 'private_link_principals'. +const PrivateLinkPrincipalsKind = "PrivateLinkPrincipals" + +// PrivateLinkPrincipalsLinkKind is the name of the type used to represent links +// to objects of type 'private_link_principals'. +const PrivateLinkPrincipalsLinkKind = "PrivateLinkPrincipalsLink" + +// PrivateLinkPrincipalsNilKind is the name of the type used to nil references +// to objects of type 'private_link_principals'. +const PrivateLinkPrincipalsNilKind = "PrivateLinkPrincipalsNil" + +// PrivateLinkPrincipals represents the values of the 'private_link_principals' type. +// +// Contains a list of principals for the Private Link. +type PrivateLinkPrincipals struct { + bitmap_ uint32 + id string + href string + principals []*PrivateLinkPrincipal +} + +// Kind returns the name of the type of the object. +func (o *PrivateLinkPrincipals) Kind() string { + if o == nil { + return PrivateLinkPrincipalsNilKind + } + if o.bitmap_&1 != 0 { + return PrivateLinkPrincipalsLinkKind + } + return PrivateLinkPrincipalsKind +} + +// Link returns true if this is a link. +func (o *PrivateLinkPrincipals) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *PrivateLinkPrincipals) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *PrivateLinkPrincipals) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *PrivateLinkPrincipals) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *PrivateLinkPrincipals) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *PrivateLinkPrincipals) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Principals returns the value of the 'principals' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of additional principals for the Private Link +func (o *PrivateLinkPrincipals) Principals() []*PrivateLinkPrincipal { + if o != nil && o.bitmap_&8 != 0 { + return o.principals + } + return nil +} + +// GetPrincipals returns the value of the 'principals' attribute and +// a flag indicating if the attribute has a value. +// +// List of additional principals for the Private Link +func (o *PrivateLinkPrincipals) GetPrincipals() (value []*PrivateLinkPrincipal, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.principals + } + return +} + +// PrivateLinkPrincipalsListKind is the name of the type used to represent list of objects of +// type 'private_link_principals'. +const PrivateLinkPrincipalsListKind = "PrivateLinkPrincipalsList" + +// PrivateLinkPrincipalsListLinkKind is the name of the type used to represent links to list +// of objects of type 'private_link_principals'. +const PrivateLinkPrincipalsListLinkKind = "PrivateLinkPrincipalsListLink" + +// PrivateLinkPrincipalsNilKind is the name of the type used to nil lists of objects of +// type 'private_link_principals'. +const PrivateLinkPrincipalsListNilKind = "PrivateLinkPrincipalsListNil" + +// PrivateLinkPrincipalsList is a list of values of the 'private_link_principals' type. +type PrivateLinkPrincipalsList struct { + href string + link bool + items []*PrivateLinkPrincipals +} + +// Kind returns the name of the type of the object. +func (l *PrivateLinkPrincipalsList) Kind() string { + if l == nil { + return PrivateLinkPrincipalsListNilKind + } + if l.link { + return PrivateLinkPrincipalsListLinkKind + } + return PrivateLinkPrincipalsListKind +} + +// Link returns true iif this is a link. +func (l *PrivateLinkPrincipalsList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *PrivateLinkPrincipalsList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *PrivateLinkPrincipalsList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *PrivateLinkPrincipalsList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *PrivateLinkPrincipalsList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *PrivateLinkPrincipalsList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *PrivateLinkPrincipalsList) SetItems(items []*PrivateLinkPrincipals) { + l.items = items +} + +// Items returns the items of the list. +func (l *PrivateLinkPrincipalsList) Items() []*PrivateLinkPrincipals { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *PrivateLinkPrincipalsList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *PrivateLinkPrincipalsList) Get(i int) *PrivateLinkPrincipals { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *PrivateLinkPrincipalsList) Slice() []*PrivateLinkPrincipals { + var slice []*PrivateLinkPrincipals + if l == nil { + slice = make([]*PrivateLinkPrincipals, 0) + } else { + slice = make([]*PrivateLinkPrincipals, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *PrivateLinkPrincipalsList) Each(f func(item *PrivateLinkPrincipals) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *PrivateLinkPrincipalsList) Range(f func(index int, item *PrivateLinkPrincipals) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/private_link_principals_type_json.go b/clientapi/clustersmgmt/v1/private_link_principals_type_json.go new file mode 100644 index 00000000..36abc507 --- /dev/null +++ b/clientapi/clustersmgmt/v1/private_link_principals_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPrivateLinkPrincipals writes a value of the 'private_link_principals' type to the given writer. +func MarshalPrivateLinkPrincipals(object *PrivateLinkPrincipals, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePrivateLinkPrincipals(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePrivateLinkPrincipals writes a value of the 'private_link_principals' type to the given stream. +func WritePrivateLinkPrincipals(object *PrivateLinkPrincipals, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(PrivateLinkPrincipalsLinkKind) + } else { + stream.WriteString(PrivateLinkPrincipalsKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.principals != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("principals") + WritePrivateLinkPrincipalList(object.principals, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalPrivateLinkPrincipals reads a value of the 'private_link_principals' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalPrivateLinkPrincipals(source interface{}) (object *PrivateLinkPrincipals, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadPrivateLinkPrincipals(iterator) + err = iterator.Error + return +} + +// ReadPrivateLinkPrincipals reads a value of the 'private_link_principals' type from the given iterator. +func ReadPrivateLinkPrincipals(iterator *jsoniter.Iterator) *PrivateLinkPrincipals { + object := &PrivateLinkPrincipals{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == PrivateLinkPrincipalsLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "principals": + value := ReadPrivateLinkPrincipalList(iterator) + object.principals = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/processor_type_list_type_json.go b/clientapi/clustersmgmt/v1/processor_type_list_type_json.go new file mode 100644 index 00000000..012fc182 --- /dev/null +++ b/clientapi/clustersmgmt/v1/processor_type_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProcessorTypeList writes a list of values of the 'processor_type' type to +// the given writer. +func MarshalProcessorTypeList(list []ProcessorType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProcessorTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProcessorTypeList writes a list of value of the 'processor_type' type to +// the given stream. +func WriteProcessorTypeList(list []ProcessorType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalProcessorTypeList reads a list of values of the 'processor_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProcessorTypeList(source interface{}) (items []ProcessorType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProcessorTypeList(iterator) + err = iterator.Error + return +} + +// ReadProcessorTypeList reads list of values of the ”processor_type' type from +// the given iterator. +func ReadProcessorTypeList(iterator *jsoniter.Iterator) []ProcessorType { + list := []ProcessorType{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ProcessorType(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/processor_type_type.go b/clientapi/clustersmgmt/v1/processor_type_type.go new file mode 100644 index 00000000..6b5055bf --- /dev/null +++ b/clientapi/clustersmgmt/v1/processor_type_type.go @@ -0,0 +1,30 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ProcessorType represents the values of the 'processor_type' enumerated type. +type ProcessorType string + +const ( + // Amd64 + ProcessorTypeAMD64 ProcessorType = "amd64" + // Arm64 + ProcessorTypeARM64 ProcessorType = "arm64" +) diff --git a/clientapi/clustersmgmt/v1/product_builder.go b/clientapi/clustersmgmt/v1/product_builder.go new file mode 100644 index 00000000..5e985611 --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_builder.go @@ -0,0 +1,89 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ProductBuilder contains the data and logic needed to build 'product' objects. +// +// Representation of an product that can be selected as a cluster type. +type ProductBuilder struct { + bitmap_ uint32 + id string + href string + name string +} + +// NewProduct creates a new builder of 'product' objects. +func NewProduct() *ProductBuilder { + return &ProductBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ProductBuilder) Link(value bool) *ProductBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ProductBuilder) ID(value string) *ProductBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ProductBuilder) HREF(value string) *ProductBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ProductBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ProductBuilder) Name(value string) *ProductBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ProductBuilder) Copy(object *Product) *ProductBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.name = object.name + return b +} + +// Build creates a 'product' object using the configuration stored in the builder. +func (b *ProductBuilder) Build() (object *Product, err error) { + object = new(Product) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.name = b.name + return +} diff --git a/clientapi/clustersmgmt/v1/product_list_builder.go b/clientapi/clustersmgmt/v1/product_list_builder.go new file mode 100644 index 00000000..c7093b18 --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ProductListBuilder contains the data and logic needed to build +// 'product' objects. +type ProductListBuilder struct { + items []*ProductBuilder +} + +// NewProductList creates a new builder of 'product' objects. +func NewProductList() *ProductListBuilder { + return new(ProductListBuilder) +} + +// Items sets the items of the list. +func (b *ProductListBuilder) Items(values ...*ProductBuilder) *ProductListBuilder { + b.items = make([]*ProductBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ProductListBuilder) 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 *ProductListBuilder) Copy(list *ProductList) *ProductListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ProductBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewProduct().Copy(v) + } + } + return b +} + +// Build creates a list of 'product' objects using the +// configuration stored in the builder. +func (b *ProductListBuilder) Build() (list *ProductList, err error) { + items := make([]*Product, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ProductList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/product_list_type_json.go b/clientapi/clustersmgmt/v1/product_list_type_json.go new file mode 100644 index 00000000..2bdff830 --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProductList writes a list of values of the 'product' type to +// the given writer. +func MarshalProductList(list []*Product, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProductList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProductList writes a list of value of the 'product' type to +// the given stream. +func WriteProductList(list []*Product, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteProduct(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalProductList reads a list of values of the 'product' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProductList(source interface{}) (items []*Product, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProductList(iterator) + err = iterator.Error + return +} + +// ReadProductList reads list of values of the ”product' type from +// the given iterator. +func ReadProductList(iterator *jsoniter.Iterator) []*Product { + list := []*Product{} + for iterator.ReadArray() { + item := ReadProduct(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/product_minimal_version_builder.go b/clientapi/clustersmgmt/v1/product_minimal_version_builder.go new file mode 100644 index 00000000..0949fdee --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_minimal_version_builder.go @@ -0,0 +1,103 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ProductMinimalVersionBuilder contains the data and logic needed to build 'product_minimal_version' objects. +// +// Representation of a product minimal version. +type ProductMinimalVersionBuilder struct { + bitmap_ uint32 + id string + href string + rosaCli string + startDate time.Time +} + +// NewProductMinimalVersion creates a new builder of 'product_minimal_version' objects. +func NewProductMinimalVersion() *ProductMinimalVersionBuilder { + return &ProductMinimalVersionBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ProductMinimalVersionBuilder) Link(value bool) *ProductMinimalVersionBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ProductMinimalVersionBuilder) ID(value string) *ProductMinimalVersionBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ProductMinimalVersionBuilder) HREF(value string) *ProductMinimalVersionBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ProductMinimalVersionBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// RosaCli sets the value of the 'rosa_cli' attribute to the given value. +func (b *ProductMinimalVersionBuilder) RosaCli(value string) *ProductMinimalVersionBuilder { + b.rosaCli = value + b.bitmap_ |= 8 + return b +} + +// StartDate sets the value of the 'start_date' attribute to the given value. +func (b *ProductMinimalVersionBuilder) StartDate(value time.Time) *ProductMinimalVersionBuilder { + b.startDate = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ProductMinimalVersionBuilder) Copy(object *ProductMinimalVersion) *ProductMinimalVersionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.rosaCli = object.rosaCli + b.startDate = object.startDate + return b +} + +// Build creates a 'product_minimal_version' object using the configuration stored in the builder. +func (b *ProductMinimalVersionBuilder) Build() (object *ProductMinimalVersion, err error) { + object = new(ProductMinimalVersion) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.rosaCli = b.rosaCli + object.startDate = b.startDate + return +} diff --git a/clientapi/clustersmgmt/v1/product_minimal_version_list_builder.go b/clientapi/clustersmgmt/v1/product_minimal_version_list_builder.go new file mode 100644 index 00000000..1300af75 --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_minimal_version_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ProductMinimalVersionListBuilder contains the data and logic needed to build +// 'product_minimal_version' objects. +type ProductMinimalVersionListBuilder struct { + items []*ProductMinimalVersionBuilder +} + +// NewProductMinimalVersionList creates a new builder of 'product_minimal_version' objects. +func NewProductMinimalVersionList() *ProductMinimalVersionListBuilder { + return new(ProductMinimalVersionListBuilder) +} + +// Items sets the items of the list. +func (b *ProductMinimalVersionListBuilder) Items(values ...*ProductMinimalVersionBuilder) *ProductMinimalVersionListBuilder { + b.items = make([]*ProductMinimalVersionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ProductMinimalVersionListBuilder) 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 *ProductMinimalVersionListBuilder) Copy(list *ProductMinimalVersionList) *ProductMinimalVersionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ProductMinimalVersionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewProductMinimalVersion().Copy(v) + } + } + return b +} + +// Build creates a list of 'product_minimal_version' objects using the +// configuration stored in the builder. +func (b *ProductMinimalVersionListBuilder) Build() (list *ProductMinimalVersionList, err error) { + items := make([]*ProductMinimalVersion, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ProductMinimalVersionList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/product_minimal_version_list_type_json.go b/clientapi/clustersmgmt/v1/product_minimal_version_list_type_json.go new file mode 100644 index 00000000..f8941929 --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_minimal_version_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProductMinimalVersionList writes a list of values of the 'product_minimal_version' type to +// the given writer. +func MarshalProductMinimalVersionList(list []*ProductMinimalVersion, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProductMinimalVersionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProductMinimalVersionList writes a list of value of the 'product_minimal_version' type to +// the given stream. +func WriteProductMinimalVersionList(list []*ProductMinimalVersion, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteProductMinimalVersion(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalProductMinimalVersionList reads a list of values of the 'product_minimal_version' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProductMinimalVersionList(source interface{}) (items []*ProductMinimalVersion, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProductMinimalVersionList(iterator) + err = iterator.Error + return +} + +// ReadProductMinimalVersionList reads list of values of the ”product_minimal_version' type from +// the given iterator. +func ReadProductMinimalVersionList(iterator *jsoniter.Iterator) []*ProductMinimalVersion { + list := []*ProductMinimalVersion{} + for iterator.ReadArray() { + item := ReadProductMinimalVersion(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/product_minimal_version_type.go b/clientapi/clustersmgmt/v1/product_minimal_version_type.go new file mode 100644 index 00000000..02f759d3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_minimal_version_type.go @@ -0,0 +1,293 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ProductMinimalVersionKind is the name of the type used to represent objects +// of type 'product_minimal_version'. +const ProductMinimalVersionKind = "ProductMinimalVersion" + +// ProductMinimalVersionLinkKind is the name of the type used to represent links +// to objects of type 'product_minimal_version'. +const ProductMinimalVersionLinkKind = "ProductMinimalVersionLink" + +// ProductMinimalVersionNilKind is the name of the type used to nil references +// to objects of type 'product_minimal_version'. +const ProductMinimalVersionNilKind = "ProductMinimalVersionNil" + +// ProductMinimalVersion represents the values of the 'product_minimal_version' type. +// +// Representation of a product minimal version. +type ProductMinimalVersion struct { + bitmap_ uint32 + id string + href string + rosaCli string + startDate time.Time +} + +// Kind returns the name of the type of the object. +func (o *ProductMinimalVersion) Kind() string { + if o == nil { + return ProductMinimalVersionNilKind + } + if o.bitmap_&1 != 0 { + return ProductMinimalVersionLinkKind + } + return ProductMinimalVersionKind +} + +// Link returns true if this is a link. +func (o *ProductMinimalVersion) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ProductMinimalVersion) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ProductMinimalVersion) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ProductMinimalVersion) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ProductMinimalVersion) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ProductMinimalVersion) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// RosaCli returns the value of the 'rosa_cli' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The ROSA CLI minimal version. +func (o *ProductMinimalVersion) RosaCli() string { + if o != nil && o.bitmap_&8 != 0 { + return o.rosaCli + } + return "" +} + +// GetRosaCli returns the value of the 'rosa_cli' attribute and +// a flag indicating if the attribute has a value. +// +// The ROSA CLI minimal version. +func (o *ProductMinimalVersion) GetRosaCli() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.rosaCli + } + return +} + +// StartDate returns the value of the 'start_date' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The start date for this minimal version. +func (o *ProductMinimalVersion) StartDate() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.startDate + } + return time.Time{} +} + +// GetStartDate returns the value of the 'start_date' attribute and +// a flag indicating if the attribute has a value. +// +// The start date for this minimal version. +func (o *ProductMinimalVersion) GetStartDate() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.startDate + } + return +} + +// ProductMinimalVersionListKind is the name of the type used to represent list of objects of +// type 'product_minimal_version'. +const ProductMinimalVersionListKind = "ProductMinimalVersionList" + +// ProductMinimalVersionListLinkKind is the name of the type used to represent links to list +// of objects of type 'product_minimal_version'. +const ProductMinimalVersionListLinkKind = "ProductMinimalVersionListLink" + +// ProductMinimalVersionNilKind is the name of the type used to nil lists of objects of +// type 'product_minimal_version'. +const ProductMinimalVersionListNilKind = "ProductMinimalVersionListNil" + +// ProductMinimalVersionList is a list of values of the 'product_minimal_version' type. +type ProductMinimalVersionList struct { + href string + link bool + items []*ProductMinimalVersion +} + +// Kind returns the name of the type of the object. +func (l *ProductMinimalVersionList) Kind() string { + if l == nil { + return ProductMinimalVersionListNilKind + } + if l.link { + return ProductMinimalVersionListLinkKind + } + return ProductMinimalVersionListKind +} + +// Link returns true iif this is a link. +func (l *ProductMinimalVersionList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ProductMinimalVersionList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ProductMinimalVersionList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ProductMinimalVersionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ProductMinimalVersionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ProductMinimalVersionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ProductMinimalVersionList) SetItems(items []*ProductMinimalVersion) { + l.items = items +} + +// Items returns the items of the list. +func (l *ProductMinimalVersionList) Items() []*ProductMinimalVersion { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ProductMinimalVersionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ProductMinimalVersionList) Get(i int) *ProductMinimalVersion { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ProductMinimalVersionList) Slice() []*ProductMinimalVersion { + var slice []*ProductMinimalVersion + if l == nil { + slice = make([]*ProductMinimalVersion, 0) + } else { + slice = make([]*ProductMinimalVersion, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ProductMinimalVersionList) Each(f func(item *ProductMinimalVersion) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ProductMinimalVersionList) Range(f func(index int, item *ProductMinimalVersion) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/product_minimal_version_type_json.go b/clientapi/clustersmgmt/v1/product_minimal_version_type_json.go new file mode 100644 index 00000000..c5bd537b --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_minimal_version_type_json.go @@ -0,0 +1,138 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProductMinimalVersion writes a value of the 'product_minimal_version' type to the given writer. +func MarshalProductMinimalVersion(object *ProductMinimalVersion, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProductMinimalVersion(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProductMinimalVersion writes a value of the 'product_minimal_version' type to the given stream. +func WriteProductMinimalVersion(object *ProductMinimalVersion, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ProductMinimalVersionLinkKind) + } else { + stream.WriteString(ProductMinimalVersionKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("rosa_cli") + stream.WriteString(object.rosaCli) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("start_date") + stream.WriteString((object.startDate).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalProductMinimalVersion reads a value of the 'product_minimal_version' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalProductMinimalVersion(source interface{}) (object *ProductMinimalVersion, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadProductMinimalVersion(iterator) + err = iterator.Error + return +} + +// ReadProductMinimalVersion reads a value of the 'product_minimal_version' type from the given iterator. +func ReadProductMinimalVersion(iterator *jsoniter.Iterator) *ProductMinimalVersion { + object := &ProductMinimalVersion{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ProductMinimalVersionLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "rosa_cli": + value := iterator.ReadString() + object.rosaCli = value + object.bitmap_ |= 8 + case "start_date": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.startDate = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/product_technology_preview_builder.go b/clientapi/clustersmgmt/v1/product_technology_preview_builder.go new file mode 100644 index 00000000..682390a2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_technology_preview_builder.go @@ -0,0 +1,113 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ProductTechnologyPreviewBuilder contains the data and logic needed to build 'product_technology_preview' objects. +// +// Representation of a product technology preview. +type ProductTechnologyPreviewBuilder struct { + bitmap_ uint32 + id string + href string + additionalText string + endDate time.Time + startDate time.Time +} + +// NewProductTechnologyPreview creates a new builder of 'product_technology_preview' objects. +func NewProductTechnologyPreview() *ProductTechnologyPreviewBuilder { + return &ProductTechnologyPreviewBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ProductTechnologyPreviewBuilder) Link(value bool) *ProductTechnologyPreviewBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ProductTechnologyPreviewBuilder) ID(value string) *ProductTechnologyPreviewBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ProductTechnologyPreviewBuilder) HREF(value string) *ProductTechnologyPreviewBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ProductTechnologyPreviewBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AdditionalText sets the value of the 'additional_text' attribute to the given value. +func (b *ProductTechnologyPreviewBuilder) AdditionalText(value string) *ProductTechnologyPreviewBuilder { + b.additionalText = value + b.bitmap_ |= 8 + return b +} + +// EndDate sets the value of the 'end_date' attribute to the given value. +func (b *ProductTechnologyPreviewBuilder) EndDate(value time.Time) *ProductTechnologyPreviewBuilder { + b.endDate = value + b.bitmap_ |= 16 + return b +} + +// StartDate sets the value of the 'start_date' attribute to the given value. +func (b *ProductTechnologyPreviewBuilder) StartDate(value time.Time) *ProductTechnologyPreviewBuilder { + b.startDate = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ProductTechnologyPreviewBuilder) Copy(object *ProductTechnologyPreview) *ProductTechnologyPreviewBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.additionalText = object.additionalText + b.endDate = object.endDate + b.startDate = object.startDate + return b +} + +// Build creates a 'product_technology_preview' object using the configuration stored in the builder. +func (b *ProductTechnologyPreviewBuilder) Build() (object *ProductTechnologyPreview, err error) { + object = new(ProductTechnologyPreview) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.additionalText = b.additionalText + object.endDate = b.endDate + object.startDate = b.startDate + return +} diff --git a/clientapi/clustersmgmt/v1/product_technology_preview_list_builder.go b/clientapi/clustersmgmt/v1/product_technology_preview_list_builder.go new file mode 100644 index 00000000..22a5831d --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_technology_preview_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ProductTechnologyPreviewListBuilder contains the data and logic needed to build +// 'product_technology_preview' objects. +type ProductTechnologyPreviewListBuilder struct { + items []*ProductTechnologyPreviewBuilder +} + +// NewProductTechnologyPreviewList creates a new builder of 'product_technology_preview' objects. +func NewProductTechnologyPreviewList() *ProductTechnologyPreviewListBuilder { + return new(ProductTechnologyPreviewListBuilder) +} + +// Items sets the items of the list. +func (b *ProductTechnologyPreviewListBuilder) Items(values ...*ProductTechnologyPreviewBuilder) *ProductTechnologyPreviewListBuilder { + b.items = make([]*ProductTechnologyPreviewBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ProductTechnologyPreviewListBuilder) 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 *ProductTechnologyPreviewListBuilder) Copy(list *ProductTechnologyPreviewList) *ProductTechnologyPreviewListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ProductTechnologyPreviewBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewProductTechnologyPreview().Copy(v) + } + } + return b +} + +// Build creates a list of 'product_technology_preview' objects using the +// configuration stored in the builder. +func (b *ProductTechnologyPreviewListBuilder) Build() (list *ProductTechnologyPreviewList, err error) { + items := make([]*ProductTechnologyPreview, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ProductTechnologyPreviewList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/product_technology_preview_list_type_json.go b/clientapi/clustersmgmt/v1/product_technology_preview_list_type_json.go new file mode 100644 index 00000000..10ad606f --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_technology_preview_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProductTechnologyPreviewList writes a list of values of the 'product_technology_preview' type to +// the given writer. +func MarshalProductTechnologyPreviewList(list []*ProductTechnologyPreview, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProductTechnologyPreviewList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProductTechnologyPreviewList writes a list of value of the 'product_technology_preview' type to +// the given stream. +func WriteProductTechnologyPreviewList(list []*ProductTechnologyPreview, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteProductTechnologyPreview(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalProductTechnologyPreviewList reads a list of values of the 'product_technology_preview' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProductTechnologyPreviewList(source interface{}) (items []*ProductTechnologyPreview, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProductTechnologyPreviewList(iterator) + err = iterator.Error + return +} + +// ReadProductTechnologyPreviewList reads list of values of the ”product_technology_preview' type from +// the given iterator. +func ReadProductTechnologyPreviewList(iterator *jsoniter.Iterator) []*ProductTechnologyPreview { + list := []*ProductTechnologyPreview{} + for iterator.ReadArray() { + item := ReadProductTechnologyPreview(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/product_technology_preview_type.go b/clientapi/clustersmgmt/v1/product_technology_preview_type.go new file mode 100644 index 00000000..f0d5d33c --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_technology_preview_type.go @@ -0,0 +1,317 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ProductTechnologyPreviewKind is the name of the type used to represent objects +// of type 'product_technology_preview'. +const ProductTechnologyPreviewKind = "ProductTechnologyPreview" + +// ProductTechnologyPreviewLinkKind is the name of the type used to represent links +// to objects of type 'product_technology_preview'. +const ProductTechnologyPreviewLinkKind = "ProductTechnologyPreviewLink" + +// ProductTechnologyPreviewNilKind is the name of the type used to nil references +// to objects of type 'product_technology_preview'. +const ProductTechnologyPreviewNilKind = "ProductTechnologyPreviewNil" + +// ProductTechnologyPreview represents the values of the 'product_technology_preview' type. +// +// Representation of a product technology preview. +type ProductTechnologyPreview struct { + bitmap_ uint32 + id string + href string + additionalText string + endDate time.Time + startDate time.Time +} + +// Kind returns the name of the type of the object. +func (o *ProductTechnologyPreview) Kind() string { + if o == nil { + return ProductTechnologyPreviewNilKind + } + if o.bitmap_&1 != 0 { + return ProductTechnologyPreviewLinkKind + } + return ProductTechnologyPreviewKind +} + +// Link returns true if this is a link. +func (o *ProductTechnologyPreview) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ProductTechnologyPreview) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ProductTechnologyPreview) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ProductTechnologyPreview) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ProductTechnologyPreview) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ProductTechnologyPreview) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AdditionalText returns the value of the 'additional_text' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Message associated with this technology preview. +func (o *ProductTechnologyPreview) AdditionalText() string { + if o != nil && o.bitmap_&8 != 0 { + return o.additionalText + } + return "" +} + +// GetAdditionalText returns the value of the 'additional_text' attribute and +// a flag indicating if the attribute has a value. +// +// Message associated with this technology preview. +func (o *ProductTechnologyPreview) GetAdditionalText() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.additionalText + } + return +} + +// EndDate returns the value of the 'end_date' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The end date for this technology preview. +func (o *ProductTechnologyPreview) EndDate() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.endDate + } + return time.Time{} +} + +// GetEndDate returns the value of the 'end_date' attribute and +// a flag indicating if the attribute has a value. +// +// The end date for this technology preview. +func (o *ProductTechnologyPreview) GetEndDate() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.endDate + } + return +} + +// StartDate returns the value of the 'start_date' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The start date for this technology preview. +func (o *ProductTechnologyPreview) StartDate() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.startDate + } + return time.Time{} +} + +// GetStartDate returns the value of the 'start_date' attribute and +// a flag indicating if the attribute has a value. +// +// The start date for this technology preview. +func (o *ProductTechnologyPreview) GetStartDate() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.startDate + } + return +} + +// ProductTechnologyPreviewListKind is the name of the type used to represent list of objects of +// type 'product_technology_preview'. +const ProductTechnologyPreviewListKind = "ProductTechnologyPreviewList" + +// ProductTechnologyPreviewListLinkKind is the name of the type used to represent links to list +// of objects of type 'product_technology_preview'. +const ProductTechnologyPreviewListLinkKind = "ProductTechnologyPreviewListLink" + +// ProductTechnologyPreviewNilKind is the name of the type used to nil lists of objects of +// type 'product_technology_preview'. +const ProductTechnologyPreviewListNilKind = "ProductTechnologyPreviewListNil" + +// ProductTechnologyPreviewList is a list of values of the 'product_technology_preview' type. +type ProductTechnologyPreviewList struct { + href string + link bool + items []*ProductTechnologyPreview +} + +// Kind returns the name of the type of the object. +func (l *ProductTechnologyPreviewList) Kind() string { + if l == nil { + return ProductTechnologyPreviewListNilKind + } + if l.link { + return ProductTechnologyPreviewListLinkKind + } + return ProductTechnologyPreviewListKind +} + +// Link returns true iif this is a link. +func (l *ProductTechnologyPreviewList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ProductTechnologyPreviewList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ProductTechnologyPreviewList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ProductTechnologyPreviewList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ProductTechnologyPreviewList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ProductTechnologyPreviewList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ProductTechnologyPreviewList) SetItems(items []*ProductTechnologyPreview) { + l.items = items +} + +// Items returns the items of the list. +func (l *ProductTechnologyPreviewList) Items() []*ProductTechnologyPreview { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ProductTechnologyPreviewList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ProductTechnologyPreviewList) Get(i int) *ProductTechnologyPreview { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ProductTechnologyPreviewList) Slice() []*ProductTechnologyPreview { + var slice []*ProductTechnologyPreview + if l == nil { + slice = make([]*ProductTechnologyPreview, 0) + } else { + slice = make([]*ProductTechnologyPreview, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ProductTechnologyPreviewList) Each(f func(item *ProductTechnologyPreview) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ProductTechnologyPreviewList) Range(f func(index int, item *ProductTechnologyPreview) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/product_technology_preview_type_json.go b/clientapi/clustersmgmt/v1/product_technology_preview_type_json.go new file mode 100644 index 00000000..616c19e2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_technology_preview_type_json.go @@ -0,0 +1,155 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProductTechnologyPreview writes a value of the 'product_technology_preview' type to the given writer. +func MarshalProductTechnologyPreview(object *ProductTechnologyPreview, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProductTechnologyPreview(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProductTechnologyPreview writes a value of the 'product_technology_preview' type to the given stream. +func WriteProductTechnologyPreview(object *ProductTechnologyPreview, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ProductTechnologyPreviewLinkKind) + } else { + stream.WriteString(ProductTechnologyPreviewKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("additional_text") + stream.WriteString(object.additionalText) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("end_date") + stream.WriteString((object.endDate).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("start_date") + stream.WriteString((object.startDate).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalProductTechnologyPreview reads a value of the 'product_technology_preview' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalProductTechnologyPreview(source interface{}) (object *ProductTechnologyPreview, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadProductTechnologyPreview(iterator) + err = iterator.Error + return +} + +// ReadProductTechnologyPreview reads a value of the 'product_technology_preview' type from the given iterator. +func ReadProductTechnologyPreview(iterator *jsoniter.Iterator) *ProductTechnologyPreview { + object := &ProductTechnologyPreview{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ProductTechnologyPreviewLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "additional_text": + value := iterator.ReadString() + object.additionalText = value + object.bitmap_ |= 8 + case "end_date": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.endDate = value + object.bitmap_ |= 16 + case "start_date": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.startDate = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/product_type.go b/clientapi/clustersmgmt/v1/product_type.go new file mode 100644 index 00000000..c8618d33 --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_type.go @@ -0,0 +1,265 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ProductKind is the name of the type used to represent objects +// of type 'product'. +const ProductKind = "Product" + +// ProductLinkKind is the name of the type used to represent links +// to objects of type 'product'. +const ProductLinkKind = "ProductLink" + +// ProductNilKind is the name of the type used to nil references +// to objects of type 'product'. +const ProductNilKind = "ProductNil" + +// Product represents the values of the 'product' type. +// +// Representation of an product that can be selected as a cluster type. +type Product struct { + bitmap_ uint32 + id string + href string + name string +} + +// Kind returns the name of the type of the object. +func (o *Product) Kind() string { + if o == nil { + return ProductNilKind + } + if o.bitmap_&1 != 0 { + return ProductLinkKind + } + return ProductKind +} + +// Link returns true if this is a link. +func (o *Product) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Product) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Product) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Product) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Product) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Product) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the product. +func (o *Product) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the product. +func (o *Product) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// ProductListKind is the name of the type used to represent list of objects of +// type 'product'. +const ProductListKind = "ProductList" + +// ProductListLinkKind is the name of the type used to represent links to list +// of objects of type 'product'. +const ProductListLinkKind = "ProductListLink" + +// ProductNilKind is the name of the type used to nil lists of objects of +// type 'product'. +const ProductListNilKind = "ProductListNil" + +// ProductList is a list of values of the 'product' type. +type ProductList struct { + href string + link bool + items []*Product +} + +// Kind returns the name of the type of the object. +func (l *ProductList) Kind() string { + if l == nil { + return ProductListNilKind + } + if l.link { + return ProductListLinkKind + } + return ProductListKind +} + +// Link returns true iif this is a link. +func (l *ProductList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ProductList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ProductList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ProductList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ProductList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ProductList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ProductList) SetItems(items []*Product) { + l.items = items +} + +// Items returns the items of the list. +func (l *ProductList) Items() []*Product { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ProductList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ProductList) Get(i int) *Product { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ProductList) Slice() []*Product { + var slice []*Product + if l == nil { + slice = make([]*Product, 0) + } else { + slice = make([]*Product, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ProductList) Each(f func(item *Product) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ProductList) Range(f func(index int, item *Product) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/product_type_json.go b/clientapi/clustersmgmt/v1/product_type_json.go new file mode 100644 index 00000000..0a763ce1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/product_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProduct writes a value of the 'product' type to the given writer. +func MarshalProduct(object *Product, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProduct(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProduct writes a value of the 'product' type to the given stream. +func WriteProduct(object *Product, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ProductLinkKind) + } else { + stream.WriteString(ProductKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + } + stream.WriteObjectEnd() +} + +// UnmarshalProduct reads a value of the 'product' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalProduct(source interface{}) (object *Product, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadProduct(iterator) + err = iterator.Error + return +} + +// ReadProduct reads a value of the 'product' type from the given iterator. +func ReadProduct(iterator *jsoniter.Iterator) *Product { + object := &Product{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ProductLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/provision_shard_builder.go b/clientapi/clustersmgmt/v1/provision_shard_builder.go new file mode 100644 index 00000000..fb8ffcd2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/provision_shard_builder.go @@ -0,0 +1,293 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ProvisionShardBuilder contains the data and logic needed to build 'provision_shard' objects. +// +// Contains the properties of the provision shard, including AWS and GCP related configurations +type ProvisionShardBuilder struct { + bitmap_ uint32 + id string + href string + awsAccountOperatorConfig *ServerConfigBuilder + awsBaseDomain string + gcpBaseDomain string + gcpProjectOperator *ServerConfigBuilder + cloudProvider *CloudProviderBuilder + creationTimestamp time.Time + hiveConfig *ServerConfigBuilder + hypershiftConfig *ServerConfigBuilder + lastUpdateTimestamp time.Time + managementCluster string + region *CloudRegionBuilder + status string +} + +// NewProvisionShard creates a new builder of 'provision_shard' objects. +func NewProvisionShard() *ProvisionShardBuilder { + return &ProvisionShardBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ProvisionShardBuilder) Link(value bool) *ProvisionShardBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ProvisionShardBuilder) ID(value string) *ProvisionShardBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ProvisionShardBuilder) HREF(value string) *ProvisionShardBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ProvisionShardBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AWSAccountOperatorConfig sets the value of the 'AWS_account_operator_config' attribute to the given value. +// +// Representation of a server config +func (b *ProvisionShardBuilder) AWSAccountOperatorConfig(value *ServerConfigBuilder) *ProvisionShardBuilder { + b.awsAccountOperatorConfig = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// AWSBaseDomain sets the value of the 'AWS_base_domain' attribute to the given value. +func (b *ProvisionShardBuilder) AWSBaseDomain(value string) *ProvisionShardBuilder { + b.awsBaseDomain = value + b.bitmap_ |= 16 + return b +} + +// GCPBaseDomain sets the value of the 'GCP_base_domain' attribute to the given value. +func (b *ProvisionShardBuilder) GCPBaseDomain(value string) *ProvisionShardBuilder { + b.gcpBaseDomain = value + b.bitmap_ |= 32 + return b +} + +// GCPProjectOperator sets the value of the 'GCP_project_operator' attribute to the given value. +// +// Representation of a server config +func (b *ProvisionShardBuilder) GCPProjectOperator(value *ServerConfigBuilder) *ProvisionShardBuilder { + b.gcpProjectOperator = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +// +// Cloud provider. +func (b *ProvisionShardBuilder) CloudProvider(value *CloudProviderBuilder) *ProvisionShardBuilder { + b.cloudProvider = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *ProvisionShardBuilder) CreationTimestamp(value time.Time) *ProvisionShardBuilder { + b.creationTimestamp = value + b.bitmap_ |= 256 + return b +} + +// HiveConfig sets the value of the 'hive_config' attribute to the given value. +// +// Representation of a server config +func (b *ProvisionShardBuilder) HiveConfig(value *ServerConfigBuilder) *ProvisionShardBuilder { + b.hiveConfig = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// HypershiftConfig sets the value of the 'hypershift_config' attribute to the given value. +// +// Representation of a server config +func (b *ProvisionShardBuilder) HypershiftConfig(value *ServerConfigBuilder) *ProvisionShardBuilder { + b.hypershiftConfig = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// LastUpdateTimestamp sets the value of the 'last_update_timestamp' attribute to the given value. +func (b *ProvisionShardBuilder) LastUpdateTimestamp(value time.Time) *ProvisionShardBuilder { + b.lastUpdateTimestamp = value + b.bitmap_ |= 2048 + return b +} + +// ManagementCluster sets the value of the 'management_cluster' attribute to the given value. +func (b *ProvisionShardBuilder) ManagementCluster(value string) *ProvisionShardBuilder { + b.managementCluster = value + b.bitmap_ |= 4096 + return b +} + +// Region sets the value of the 'region' attribute to the given value. +// +// Description of a region of a cloud provider. +func (b *ProvisionShardBuilder) Region(value *CloudRegionBuilder) *ProvisionShardBuilder { + b.region = value + if value != nil { + b.bitmap_ |= 8192 + } else { + b.bitmap_ &^= 8192 + } + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *ProvisionShardBuilder) Status(value string) *ProvisionShardBuilder { + b.status = value + b.bitmap_ |= 16384 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ProvisionShardBuilder) Copy(object *ProvisionShard) *ProvisionShardBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.awsAccountOperatorConfig != nil { + b.awsAccountOperatorConfig = NewServerConfig().Copy(object.awsAccountOperatorConfig) + } else { + b.awsAccountOperatorConfig = nil + } + b.awsBaseDomain = object.awsBaseDomain + b.gcpBaseDomain = object.gcpBaseDomain + if object.gcpProjectOperator != nil { + b.gcpProjectOperator = NewServerConfig().Copy(object.gcpProjectOperator) + } else { + b.gcpProjectOperator = nil + } + if object.cloudProvider != nil { + b.cloudProvider = NewCloudProvider().Copy(object.cloudProvider) + } else { + b.cloudProvider = nil + } + b.creationTimestamp = object.creationTimestamp + if object.hiveConfig != nil { + b.hiveConfig = NewServerConfig().Copy(object.hiveConfig) + } else { + b.hiveConfig = nil + } + if object.hypershiftConfig != nil { + b.hypershiftConfig = NewServerConfig().Copy(object.hypershiftConfig) + } else { + b.hypershiftConfig = nil + } + b.lastUpdateTimestamp = object.lastUpdateTimestamp + b.managementCluster = object.managementCluster + if object.region != nil { + b.region = NewCloudRegion().Copy(object.region) + } else { + b.region = nil + } + b.status = object.status + return b +} + +// Build creates a 'provision_shard' object using the configuration stored in the builder. +func (b *ProvisionShardBuilder) Build() (object *ProvisionShard, err error) { + object = new(ProvisionShard) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.awsAccountOperatorConfig != nil { + object.awsAccountOperatorConfig, err = b.awsAccountOperatorConfig.Build() + if err != nil { + return + } + } + object.awsBaseDomain = b.awsBaseDomain + object.gcpBaseDomain = b.gcpBaseDomain + if b.gcpProjectOperator != nil { + object.gcpProjectOperator, err = b.gcpProjectOperator.Build() + if err != nil { + return + } + } + if b.cloudProvider != nil { + object.cloudProvider, err = b.cloudProvider.Build() + if err != nil { + return + } + } + object.creationTimestamp = b.creationTimestamp + if b.hiveConfig != nil { + object.hiveConfig, err = b.hiveConfig.Build() + if err != nil { + return + } + } + if b.hypershiftConfig != nil { + object.hypershiftConfig, err = b.hypershiftConfig.Build() + if err != nil { + return + } + } + object.lastUpdateTimestamp = b.lastUpdateTimestamp + object.managementCluster = b.managementCluster + if b.region != nil { + object.region, err = b.region.Build() + if err != nil { + return + } + } + object.status = b.status + return +} diff --git a/clientapi/clustersmgmt/v1/provision_shard_list_builder.go b/clientapi/clustersmgmt/v1/provision_shard_list_builder.go new file mode 100644 index 00000000..0384ca80 --- /dev/null +++ b/clientapi/clustersmgmt/v1/provision_shard_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ProvisionShardListBuilder contains the data and logic needed to build +// 'provision_shard' objects. +type ProvisionShardListBuilder struct { + items []*ProvisionShardBuilder +} + +// NewProvisionShardList creates a new builder of 'provision_shard' objects. +func NewProvisionShardList() *ProvisionShardListBuilder { + return new(ProvisionShardListBuilder) +} + +// Items sets the items of the list. +func (b *ProvisionShardListBuilder) Items(values ...*ProvisionShardBuilder) *ProvisionShardListBuilder { + b.items = make([]*ProvisionShardBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ProvisionShardListBuilder) 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 *ProvisionShardListBuilder) Copy(list *ProvisionShardList) *ProvisionShardListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ProvisionShardBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewProvisionShard().Copy(v) + } + } + return b +} + +// Build creates a list of 'provision_shard' objects using the +// configuration stored in the builder. +func (b *ProvisionShardListBuilder) Build() (list *ProvisionShardList, err error) { + items := make([]*ProvisionShard, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ProvisionShardList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/provision_shard_list_type_json.go b/clientapi/clustersmgmt/v1/provision_shard_list_type_json.go new file mode 100644 index 00000000..ca1ca037 --- /dev/null +++ b/clientapi/clustersmgmt/v1/provision_shard_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProvisionShardList writes a list of values of the 'provision_shard' type to +// the given writer. +func MarshalProvisionShardList(list []*ProvisionShard, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProvisionShardList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProvisionShardList writes a list of value of the 'provision_shard' type to +// the given stream. +func WriteProvisionShardList(list []*ProvisionShard, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteProvisionShard(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalProvisionShardList reads a list of values of the 'provision_shard' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProvisionShardList(source interface{}) (items []*ProvisionShard, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProvisionShardList(iterator) + err = iterator.Error + return +} + +// ReadProvisionShardList reads list of values of the ”provision_shard' type from +// the given iterator. +func ReadProvisionShardList(iterator *jsoniter.Iterator) []*ProvisionShard { + list := []*ProvisionShard{} + for iterator.ReadArray() { + item := ReadProvisionShard(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/provision_shard_topology_list_type_json.go b/clientapi/clustersmgmt/v1/provision_shard_topology_list_type_json.go new file mode 100644 index 00000000..8337bb67 --- /dev/null +++ b/clientapi/clustersmgmt/v1/provision_shard_topology_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProvisionShardTopologyList writes a list of values of the 'provision_shard_topology' type to +// the given writer. +func MarshalProvisionShardTopologyList(list []ProvisionShardTopology, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProvisionShardTopologyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProvisionShardTopologyList writes a list of value of the 'provision_shard_topology' type to +// the given stream. +func WriteProvisionShardTopologyList(list []ProvisionShardTopology, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalProvisionShardTopologyList reads a list of values of the 'provision_shard_topology' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProvisionShardTopologyList(source interface{}) (items []ProvisionShardTopology, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProvisionShardTopologyList(iterator) + err = iterator.Error + return +} + +// ReadProvisionShardTopologyList reads list of values of the ”provision_shard_topology' type from +// the given iterator. +func ReadProvisionShardTopologyList(iterator *jsoniter.Iterator) []ProvisionShardTopology { + list := []ProvisionShardTopology{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ProvisionShardTopology(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/provision_shard_topology_type.go b/clientapi/clustersmgmt/v1/provision_shard_topology_type.go new file mode 100644 index 00000000..69b8ce50 --- /dev/null +++ b/clientapi/clustersmgmt/v1/provision_shard_topology_type.go @@ -0,0 +1,28 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ProvisionShardTopology represents the values of the 'provision_shard_topology' enumerated type. +type ProvisionShardTopology string + +const ( + // Provision shard for hosted clusters is configured in a "dedicated" topology. + ProvisionShardTopologyDedicated ProvisionShardTopology = "dedicated" +) diff --git a/clientapi/clustersmgmt/v1/provision_shard_type.go b/clientapi/clustersmgmt/v1/provision_shard_type.go new file mode 100644 index 00000000..9c7acc6b --- /dev/null +++ b/clientapi/clustersmgmt/v1/provision_shard_type.go @@ -0,0 +1,539 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// ProvisionShardKind is the name of the type used to represent objects +// of type 'provision_shard'. +const ProvisionShardKind = "ProvisionShard" + +// ProvisionShardLinkKind is the name of the type used to represent links +// to objects of type 'provision_shard'. +const ProvisionShardLinkKind = "ProvisionShardLink" + +// ProvisionShardNilKind is the name of the type used to nil references +// to objects of type 'provision_shard'. +const ProvisionShardNilKind = "ProvisionShardNil" + +// ProvisionShard represents the values of the 'provision_shard' type. +// +// Contains the properties of the provision shard, including AWS and GCP related configurations +type ProvisionShard struct { + bitmap_ uint32 + id string + href string + awsAccountOperatorConfig *ServerConfig + awsBaseDomain string + gcpBaseDomain string + gcpProjectOperator *ServerConfig + cloudProvider *CloudProvider + creationTimestamp time.Time + hiveConfig *ServerConfig + hypershiftConfig *ServerConfig + lastUpdateTimestamp time.Time + managementCluster string + region *CloudRegion + status string +} + +// Kind returns the name of the type of the object. +func (o *ProvisionShard) Kind() string { + if o == nil { + return ProvisionShardNilKind + } + if o.bitmap_&1 != 0 { + return ProvisionShardLinkKind + } + return ProvisionShardKind +} + +// Link returns true if this is a link. +func (o *ProvisionShard) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ProvisionShard) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ProvisionShard) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ProvisionShard) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ProvisionShard) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ProvisionShard) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AWSAccountOperatorConfig returns the value of the 'AWS_account_operator_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the configuration for the AWS account operator. +func (o *ProvisionShard) AWSAccountOperatorConfig() *ServerConfig { + if o != nil && o.bitmap_&8 != 0 { + return o.awsAccountOperatorConfig + } + return nil +} + +// GetAWSAccountOperatorConfig returns the value of the 'AWS_account_operator_config' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the configuration for the AWS account operator. +func (o *ProvisionShard) GetAWSAccountOperatorConfig() (value *ServerConfig, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.awsAccountOperatorConfig + } + return +} + +// AWSBaseDomain returns the value of the 'AWS_base_domain' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the AWS base domain. +func (o *ProvisionShard) AWSBaseDomain() string { + if o != nil && o.bitmap_&16 != 0 { + return o.awsBaseDomain + } + return "" +} + +// GetAWSBaseDomain returns the value of the 'AWS_base_domain' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the AWS base domain. +func (o *ProvisionShard) GetAWSBaseDomain() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.awsBaseDomain + } + return +} + +// GCPBaseDomain returns the value of the 'GCP_base_domain' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the GCP base domain. +func (o *ProvisionShard) GCPBaseDomain() string { + if o != nil && o.bitmap_&32 != 0 { + return o.gcpBaseDomain + } + return "" +} + +// GetGCPBaseDomain returns the value of the 'GCP_base_domain' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the GCP base domain. +func (o *ProvisionShard) GetGCPBaseDomain() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.gcpBaseDomain + } + return +} + +// GCPProjectOperator returns the value of the 'GCP_project_operator' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the configuration for the GCP project operator. +func (o *ProvisionShard) GCPProjectOperator() *ServerConfig { + if o != nil && o.bitmap_&64 != 0 { + return o.gcpProjectOperator + } + return nil +} + +// GetGCPProjectOperator returns the value of the 'GCP_project_operator' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the configuration for the GCP project operator. +func (o *ProvisionShard) GetGCPProjectOperator() (value *ServerConfig, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.gcpProjectOperator + } + return +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the cloud provider name. +func (o *ProvisionShard) CloudProvider() *CloudProvider { + if o != nil && o.bitmap_&128 != 0 { + return o.cloudProvider + } + return nil +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the cloud provider name. +func (o *ProvisionShard) GetCloudProvider() (value *CloudProvider, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the provision shard was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *ProvisionShard) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the provision shard was initially created, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *ProvisionShard) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// HiveConfig returns the value of the 'hive_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the configuration for Hive. +func (o *ProvisionShard) HiveConfig() *ServerConfig { + if o != nil && o.bitmap_&512 != 0 { + return o.hiveConfig + } + return nil +} + +// GetHiveConfig returns the value of the 'hive_config' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the configuration for Hive. +func (o *ProvisionShard) GetHiveConfig() (value *ServerConfig, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.hiveConfig + } + return +} + +// HypershiftConfig returns the value of the 'hypershift_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the configuration for Hypershift. +func (o *ProvisionShard) HypershiftConfig() *ServerConfig { + if o != nil && o.bitmap_&1024 != 0 { + return o.hypershiftConfig + } + return nil +} + +// GetHypershiftConfig returns the value of the 'hypershift_config' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the configuration for Hypershift. +func (o *ProvisionShard) GetHypershiftConfig() (value *ServerConfig, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.hypershiftConfig + } + return +} + +// LastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Date and time when the provision shard was last updated, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *ProvisionShard) LastUpdateTimestamp() time.Time { + if o != nil && o.bitmap_&2048 != 0 { + return o.lastUpdateTimestamp + } + return time.Time{} +} + +// GetLastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Date and time when the provision shard was last updated, using the +// format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). +func (o *ProvisionShard) GetLastUpdateTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.lastUpdateTimestamp + } + return +} + +// ManagementCluster returns the value of the 'management_cluster' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the name of the management cluster for Hypershift clusters that are assigned to this shard. +// This field is populated by OCM, and must not be overwritten via API. +func (o *ProvisionShard) ManagementCluster() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.managementCluster + } + return "" +} + +// GetManagementCluster returns the value of the 'management_cluster' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the name of the management cluster for Hypershift clusters that are assigned to this shard. +// This field is populated by OCM, and must not be overwritten via API. +func (o *ProvisionShard) GetManagementCluster() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.managementCluster + } + return +} + +// Region returns the value of the 'region' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the cloud-provider region in which the provisioner spins up the cluster. +func (o *ProvisionShard) Region() *CloudRegion { + if o != nil && o.bitmap_&8192 != 0 { + return o.region + } + return nil +} + +// GetRegion returns the value of the 'region' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the cloud-provider region in which the provisioner spins up the cluster. +func (o *ProvisionShard) GetRegion() (value *CloudRegion, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.region + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Status of the provision shard. Possible values: active/maintenance/offline. +func (o *ProvisionShard) Status() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.status + } + return "" +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// Status of the provision shard. Possible values: active/maintenance/offline. +func (o *ProvisionShard) GetStatus() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.status + } + return +} + +// ProvisionShardListKind is the name of the type used to represent list of objects of +// type 'provision_shard'. +const ProvisionShardListKind = "ProvisionShardList" + +// ProvisionShardListLinkKind is the name of the type used to represent links to list +// of objects of type 'provision_shard'. +const ProvisionShardListLinkKind = "ProvisionShardListLink" + +// ProvisionShardNilKind is the name of the type used to nil lists of objects of +// type 'provision_shard'. +const ProvisionShardListNilKind = "ProvisionShardListNil" + +// ProvisionShardList is a list of values of the 'provision_shard' type. +type ProvisionShardList struct { + href string + link bool + items []*ProvisionShard +} + +// Kind returns the name of the type of the object. +func (l *ProvisionShardList) Kind() string { + if l == nil { + return ProvisionShardListNilKind + } + if l.link { + return ProvisionShardListLinkKind + } + return ProvisionShardListKind +} + +// Link returns true iif this is a link. +func (l *ProvisionShardList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ProvisionShardList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ProvisionShardList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ProvisionShardList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ProvisionShardList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ProvisionShardList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ProvisionShardList) SetItems(items []*ProvisionShard) { + l.items = items +} + +// Items returns the items of the list. +func (l *ProvisionShardList) Items() []*ProvisionShard { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ProvisionShardList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ProvisionShardList) Get(i int) *ProvisionShard { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ProvisionShardList) Slice() []*ProvisionShard { + var slice []*ProvisionShard + if l == nil { + slice = make([]*ProvisionShard, 0) + } else { + slice = make([]*ProvisionShard, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ProvisionShardList) Each(f func(item *ProvisionShard) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ProvisionShardList) Range(f func(index int, item *ProvisionShard) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/provision_shard_type_json.go b/clientapi/clustersmgmt/v1/provision_shard_type_json.go new file mode 100644 index 00000000..1f4479a2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/provision_shard_type_json.go @@ -0,0 +1,272 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProvisionShard writes a value of the 'provision_shard' type to the given writer. +func MarshalProvisionShard(object *ProvisionShard, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProvisionShard(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProvisionShard writes a value of the 'provision_shard' type to the given stream. +func WriteProvisionShard(object *ProvisionShard, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ProvisionShardLinkKind) + } else { + stream.WriteString(ProvisionShardKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.awsAccountOperatorConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws_account_operator_config") + WriteServerConfig(object.awsAccountOperatorConfig, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws_base_domain") + stream.WriteString(object.awsBaseDomain) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp_base_domain") + stream.WriteString(object.gcpBaseDomain) + count++ + } + present_ = object.bitmap_&64 != 0 && object.gcpProjectOperator != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp_project_operator") + WriteServerConfig(object.gcpProjectOperator, stream) + count++ + } + present_ = object.bitmap_&128 != 0 && object.cloudProvider != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + WriteCloudProvider(object.cloudProvider, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&512 != 0 && object.hiveConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hive_config") + WriteServerConfig(object.hiveConfig, stream) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.hypershiftConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hypershift_config") + WriteServerConfig(object.hypershiftConfig, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_update_timestamp") + stream.WriteString((object.lastUpdateTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("management_cluster") + stream.WriteString(object.managementCluster) + count++ + } + present_ = object.bitmap_&8192 != 0 && object.region != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region") + WriteCloudRegion(object.region, stream) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteString(object.status) + } + stream.WriteObjectEnd() +} + +// UnmarshalProvisionShard reads a value of the 'provision_shard' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalProvisionShard(source interface{}) (object *ProvisionShard, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadProvisionShard(iterator) + err = iterator.Error + return +} + +// ReadProvisionShard reads a value of the 'provision_shard' type from the given iterator. +func ReadProvisionShard(iterator *jsoniter.Iterator) *ProvisionShard { + object := &ProvisionShard{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ProvisionShardLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "aws_account_operator_config": + value := ReadServerConfig(iterator) + object.awsAccountOperatorConfig = value + object.bitmap_ |= 8 + case "aws_base_domain": + value := iterator.ReadString() + object.awsBaseDomain = value + object.bitmap_ |= 16 + case "gcp_base_domain": + value := iterator.ReadString() + object.gcpBaseDomain = value + object.bitmap_ |= 32 + case "gcp_project_operator": + value := ReadServerConfig(iterator) + object.gcpProjectOperator = value + object.bitmap_ |= 64 + case "cloud_provider": + value := ReadCloudProvider(iterator) + object.cloudProvider = value + object.bitmap_ |= 128 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 256 + case "hive_config": + value := ReadServerConfig(iterator) + object.hiveConfig = value + object.bitmap_ |= 512 + case "hypershift_config": + value := ReadServerConfig(iterator) + object.hypershiftConfig = value + object.bitmap_ |= 1024 + case "last_update_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastUpdateTimestamp = value + object.bitmap_ |= 2048 + case "management_cluster": + value := iterator.ReadString() + object.managementCluster = value + object.bitmap_ |= 4096 + case "region": + value := ReadCloudRegion(iterator) + object.region = value + object.bitmap_ |= 8192 + case "status": + value := iterator.ReadString() + object.status = value + object.bitmap_ |= 16384 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/proxy_builder.go b/clientapi/clustersmgmt/v1/proxy_builder.go new file mode 100644 index 00000000..0a5fc2bc --- /dev/null +++ b/clientapi/clustersmgmt/v1/proxy_builder.go @@ -0,0 +1,83 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ProxyBuilder contains the data and logic needed to build 'proxy' objects. +// +// Proxy configuration of a cluster. +type ProxyBuilder struct { + bitmap_ uint32 + httpProxy string + httpsProxy string + noProxy string +} + +// NewProxy creates a new builder of 'proxy' objects. +func NewProxy() *ProxyBuilder { + return &ProxyBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ProxyBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// HTTPProxy sets the value of the 'HTTP_proxy' attribute to the given value. +func (b *ProxyBuilder) HTTPProxy(value string) *ProxyBuilder { + b.httpProxy = value + b.bitmap_ |= 1 + return b +} + +// HTTPSProxy sets the value of the 'HTTPS_proxy' attribute to the given value. +func (b *ProxyBuilder) HTTPSProxy(value string) *ProxyBuilder { + b.httpsProxy = value + b.bitmap_ |= 2 + return b +} + +// NoProxy sets the value of the 'no_proxy' attribute to the given value. +func (b *ProxyBuilder) NoProxy(value string) *ProxyBuilder { + b.noProxy = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ProxyBuilder) Copy(object *Proxy) *ProxyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.httpProxy = object.httpProxy + b.httpsProxy = object.httpsProxy + b.noProxy = object.noProxy + return b +} + +// Build creates a 'proxy' object using the configuration stored in the builder. +func (b *ProxyBuilder) Build() (object *Proxy, err error) { + object = new(Proxy) + object.bitmap_ = b.bitmap_ + object.httpProxy = b.httpProxy + object.httpsProxy = b.httpsProxy + object.noProxy = b.noProxy + return +} diff --git a/clientapi/clustersmgmt/v1/proxy_list_builder.go b/clientapi/clustersmgmt/v1/proxy_list_builder.go new file mode 100644 index 00000000..131b1f28 --- /dev/null +++ b/clientapi/clustersmgmt/v1/proxy_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ProxyListBuilder contains the data and logic needed to build +// 'proxy' objects. +type ProxyListBuilder struct { + items []*ProxyBuilder +} + +// NewProxyList creates a new builder of 'proxy' objects. +func NewProxyList() *ProxyListBuilder { + return new(ProxyListBuilder) +} + +// Items sets the items of the list. +func (b *ProxyListBuilder) Items(values ...*ProxyBuilder) *ProxyListBuilder { + b.items = make([]*ProxyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ProxyListBuilder) 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 *ProxyListBuilder) Copy(list *ProxyList) *ProxyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ProxyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewProxy().Copy(v) + } + } + return b +} + +// Build creates a list of 'proxy' objects using the +// configuration stored in the builder. +func (b *ProxyListBuilder) Build() (list *ProxyList, err error) { + items := make([]*Proxy, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ProxyList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/proxy_list_type_json.go b/clientapi/clustersmgmt/v1/proxy_list_type_json.go new file mode 100644 index 00000000..ac87dcb8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/proxy_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProxyList writes a list of values of the 'proxy' type to +// the given writer. +func MarshalProxyList(list []*Proxy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProxyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProxyList writes a list of value of the 'proxy' type to +// the given stream. +func WriteProxyList(list []*Proxy, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteProxy(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalProxyList reads a list of values of the 'proxy' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProxyList(source interface{}) (items []*Proxy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProxyList(iterator) + err = iterator.Error + return +} + +// ReadProxyList reads list of values of the ”proxy' type from +// the given iterator. +func ReadProxyList(iterator *jsoniter.Iterator) []*Proxy { + list := []*Proxy{} + for iterator.ReadArray() { + item := ReadProxy(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/proxy_type.go b/clientapi/clustersmgmt/v1/proxy_type.go new file mode 100644 index 00000000..8655f592 --- /dev/null +++ b/clientapi/clustersmgmt/v1/proxy_type.go @@ -0,0 +1,215 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// Proxy represents the values of the 'proxy' type. +// +// Proxy configuration of a cluster. +type Proxy struct { + bitmap_ uint32 + httpProxy string + httpsProxy string + noProxy string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Proxy) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// HTTPProxy returns the value of the 'HTTP_proxy' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HTTPProxy is the URL of the proxy for HTTP requests. +func (o *Proxy) HTTPProxy() string { + if o != nil && o.bitmap_&1 != 0 { + return o.httpProxy + } + return "" +} + +// GetHTTPProxy returns the value of the 'HTTP_proxy' attribute and +// a flag indicating if the attribute has a value. +// +// HTTPProxy is the URL of the proxy for HTTP requests. +func (o *Proxy) GetHTTPProxy() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.httpProxy + } + return +} + +// HTTPSProxy returns the value of the 'HTTPS_proxy' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HTTPSProxy is the URL of the proxy for HTTPS requests. +func (o *Proxy) HTTPSProxy() string { + if o != nil && o.bitmap_&2 != 0 { + return o.httpsProxy + } + return "" +} + +// GetHTTPSProxy returns the value of the 'HTTPS_proxy' attribute and +// a flag indicating if the attribute has a value. +// +// HTTPSProxy is the URL of the proxy for HTTPS requests. +func (o *Proxy) GetHTTPSProxy() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.httpsProxy + } + return +} + +// NoProxy returns the value of the 'no_proxy' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// NoProxy is a comma-separated list of domains and CIDRs for which +// the proxy should not be used +func (o *Proxy) NoProxy() string { + if o != nil && o.bitmap_&4 != 0 { + return o.noProxy + } + return "" +} + +// GetNoProxy returns the value of the 'no_proxy' attribute and +// a flag indicating if the attribute has a value. +// +// NoProxy is a comma-separated list of domains and CIDRs for which +// the proxy should not be used +func (o *Proxy) GetNoProxy() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.noProxy + } + return +} + +// ProxyListKind is the name of the type used to represent list of objects of +// type 'proxy'. +const ProxyListKind = "ProxyList" + +// ProxyListLinkKind is the name of the type used to represent links to list +// of objects of type 'proxy'. +const ProxyListLinkKind = "ProxyListLink" + +// ProxyNilKind is the name of the type used to nil lists of objects of +// type 'proxy'. +const ProxyListNilKind = "ProxyListNil" + +// ProxyList is a list of values of the 'proxy' type. +type ProxyList struct { + href string + link bool + items []*Proxy +} + +// Len returns the length of the list. +func (l *ProxyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ProxyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ProxyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ProxyList) SetItems(items []*Proxy) { + l.items = items +} + +// Items returns the items of the list. +func (l *ProxyList) Items() []*Proxy { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ProxyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ProxyList) Get(i int) *Proxy { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ProxyList) Slice() []*Proxy { + var slice []*Proxy + if l == nil { + slice = make([]*Proxy, 0) + } else { + slice = make([]*Proxy, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ProxyList) Each(f func(item *Proxy) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ProxyList) Range(f func(index int, item *Proxy) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/proxy_type_json.go b/clientapi/clustersmgmt/v1/proxy_type_json.go new file mode 100644 index 00000000..838da003 --- /dev/null +++ b/clientapi/clustersmgmt/v1/proxy_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProxy writes a value of the 'proxy' type to the given writer. +func MarshalProxy(object *Proxy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProxy(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProxy writes a value of the 'proxy' type to the given stream. +func WriteProxy(object *Proxy, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("http_proxy") + stream.WriteString(object.httpProxy) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("https_proxy") + stream.WriteString(object.httpsProxy) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("no_proxy") + stream.WriteString(object.noProxy) + } + stream.WriteObjectEnd() +} + +// UnmarshalProxy reads a value of the 'proxy' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalProxy(source interface{}) (object *Proxy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadProxy(iterator) + err = iterator.Error + return +} + +// ReadProxy reads a value of the 'proxy' type from the given iterator. +func ReadProxy(iterator *jsoniter.Iterator) *Proxy { + object := &Proxy{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "http_proxy": + value := iterator.ReadString() + object.httpProxy = value + object.bitmap_ |= 1 + case "https_proxy": + value := iterator.ReadString() + object.httpsProxy = value + object.bitmap_ |= 2 + case "no_proxy": + value := iterator.ReadString() + object.noProxy = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/registry_allowlist_builder.go b/clientapi/clustersmgmt/v1/registry_allowlist_builder.go new file mode 100644 index 00000000..3f666131 --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_allowlist_builder.go @@ -0,0 +1,137 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// RegistryAllowlistBuilder contains the data and logic needed to build 'registry_allowlist' objects. +// +// RegistryAllowlist represents a single registry allowlist. +type RegistryAllowlistBuilder struct { + bitmap_ uint32 + id string + href string + cloudProvider *CloudProviderBuilder + creationTimestamp time.Time + registries []string +} + +// NewRegistryAllowlist creates a new builder of 'registry_allowlist' objects. +func NewRegistryAllowlist() *RegistryAllowlistBuilder { + return &RegistryAllowlistBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *RegistryAllowlistBuilder) Link(value bool) *RegistryAllowlistBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *RegistryAllowlistBuilder) ID(value string) *RegistryAllowlistBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *RegistryAllowlistBuilder) HREF(value string) *RegistryAllowlistBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RegistryAllowlistBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +// +// Cloud provider. +func (b *RegistryAllowlistBuilder) CloudProvider(value *CloudProviderBuilder) *RegistryAllowlistBuilder { + b.cloudProvider = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *RegistryAllowlistBuilder) CreationTimestamp(value time.Time) *RegistryAllowlistBuilder { + b.creationTimestamp = value + b.bitmap_ |= 16 + return b +} + +// Registries sets the value of the 'registries' attribute to the given values. +func (b *RegistryAllowlistBuilder) Registries(values ...string) *RegistryAllowlistBuilder { + b.registries = make([]string, len(values)) + copy(b.registries, values) + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RegistryAllowlistBuilder) Copy(object *RegistryAllowlist) *RegistryAllowlistBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.cloudProvider != nil { + b.cloudProvider = NewCloudProvider().Copy(object.cloudProvider) + } else { + b.cloudProvider = nil + } + b.creationTimestamp = object.creationTimestamp + if object.registries != nil { + b.registries = make([]string, len(object.registries)) + copy(b.registries, object.registries) + } else { + b.registries = nil + } + return b +} + +// Build creates a 'registry_allowlist' object using the configuration stored in the builder. +func (b *RegistryAllowlistBuilder) Build() (object *RegistryAllowlist, err error) { + object = new(RegistryAllowlist) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.cloudProvider != nil { + object.cloudProvider, err = b.cloudProvider.Build() + if err != nil { + return + } + } + object.creationTimestamp = b.creationTimestamp + if b.registries != nil { + object.registries = make([]string, len(b.registries)) + copy(object.registries, b.registries) + } + return +} diff --git a/clientapi/clustersmgmt/v1/registry_allowlist_list_builder.go b/clientapi/clustersmgmt/v1/registry_allowlist_list_builder.go new file mode 100644 index 00000000..d40da452 --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_allowlist_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RegistryAllowlistListBuilder contains the data and logic needed to build +// 'registry_allowlist' objects. +type RegistryAllowlistListBuilder struct { + items []*RegistryAllowlistBuilder +} + +// NewRegistryAllowlistList creates a new builder of 'registry_allowlist' objects. +func NewRegistryAllowlistList() *RegistryAllowlistListBuilder { + return new(RegistryAllowlistListBuilder) +} + +// Items sets the items of the list. +func (b *RegistryAllowlistListBuilder) Items(values ...*RegistryAllowlistBuilder) *RegistryAllowlistListBuilder { + b.items = make([]*RegistryAllowlistBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RegistryAllowlistListBuilder) 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 *RegistryAllowlistListBuilder) Copy(list *RegistryAllowlistList) *RegistryAllowlistListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RegistryAllowlistBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRegistryAllowlist().Copy(v) + } + } + return b +} + +// Build creates a list of 'registry_allowlist' objects using the +// configuration stored in the builder. +func (b *RegistryAllowlistListBuilder) Build() (list *RegistryAllowlistList, err error) { + items := make([]*RegistryAllowlist, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RegistryAllowlistList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/registry_allowlist_list_type_json.go b/clientapi/clustersmgmt/v1/registry_allowlist_list_type_json.go new file mode 100644 index 00000000..58b1f196 --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_allowlist_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRegistryAllowlistList writes a list of values of the 'registry_allowlist' type to +// the given writer. +func MarshalRegistryAllowlistList(list []*RegistryAllowlist, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistryAllowlistList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistryAllowlistList writes a list of value of the 'registry_allowlist' type to +// the given stream. +func WriteRegistryAllowlistList(list []*RegistryAllowlist, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRegistryAllowlist(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRegistryAllowlistList reads a list of values of the 'registry_allowlist' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRegistryAllowlistList(source interface{}) (items []*RegistryAllowlist, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRegistryAllowlistList(iterator) + err = iterator.Error + return +} + +// ReadRegistryAllowlistList reads list of values of the ”registry_allowlist' type from +// the given iterator. +func ReadRegistryAllowlistList(iterator *jsoniter.Iterator) []*RegistryAllowlist { + list := []*RegistryAllowlist{} + for iterator.ReadArray() { + item := ReadRegistryAllowlist(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/registry_allowlist_type.go b/clientapi/clustersmgmt/v1/registry_allowlist_type.go new file mode 100644 index 00000000..8a65edd6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_allowlist_type.go @@ -0,0 +1,317 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// RegistryAllowlistKind is the name of the type used to represent objects +// of type 'registry_allowlist'. +const RegistryAllowlistKind = "RegistryAllowlist" + +// RegistryAllowlistLinkKind is the name of the type used to represent links +// to objects of type 'registry_allowlist'. +const RegistryAllowlistLinkKind = "RegistryAllowlistLink" + +// RegistryAllowlistNilKind is the name of the type used to nil references +// to objects of type 'registry_allowlist'. +const RegistryAllowlistNilKind = "RegistryAllowlistNil" + +// RegistryAllowlist represents the values of the 'registry_allowlist' type. +// +// RegistryAllowlist represents a single registry allowlist. +type RegistryAllowlist struct { + bitmap_ uint32 + id string + href string + cloudProvider *CloudProvider + creationTimestamp time.Time + registries []string +} + +// Kind returns the name of the type of the object. +func (o *RegistryAllowlist) Kind() string { + if o == nil { + return RegistryAllowlistNilKind + } + if o.bitmap_&1 != 0 { + return RegistryAllowlistLinkKind + } + return RegistryAllowlistKind +} + +// Link returns true if this is a link. +func (o *RegistryAllowlist) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *RegistryAllowlist) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *RegistryAllowlist) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *RegistryAllowlist) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *RegistryAllowlist) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RegistryAllowlist) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// CloudProvider is the cloud provider for which this allowlist is valid. +func (o *RegistryAllowlist) CloudProvider() *CloudProvider { + if o != nil && o.bitmap_&8 != 0 { + return o.cloudProvider + } + return nil +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +// +// CloudProvider is the cloud provider for which this allowlist is valid. +func (o *RegistryAllowlist) GetCloudProvider() (value *CloudProvider, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// CreationTimestamp is the date and time when the allow list has been created. +func (o *RegistryAllowlist) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// CreationTimestamp is the date and time when the allow list has been created. +func (o *RegistryAllowlist) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// Registries returns the value of the 'registries' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Registries is the list of registries contained in this Allowlist. +func (o *RegistryAllowlist) Registries() []string { + if o != nil && o.bitmap_&32 != 0 { + return o.registries + } + return nil +} + +// GetRegistries returns the value of the 'registries' attribute and +// a flag indicating if the attribute has a value. +// +// Registries is the list of registries contained in this Allowlist. +func (o *RegistryAllowlist) GetRegistries() (value []string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.registries + } + return +} + +// RegistryAllowlistListKind is the name of the type used to represent list of objects of +// type 'registry_allowlist'. +const RegistryAllowlistListKind = "RegistryAllowlistList" + +// RegistryAllowlistListLinkKind is the name of the type used to represent links to list +// of objects of type 'registry_allowlist'. +const RegistryAllowlistListLinkKind = "RegistryAllowlistListLink" + +// RegistryAllowlistNilKind is the name of the type used to nil lists of objects of +// type 'registry_allowlist'. +const RegistryAllowlistListNilKind = "RegistryAllowlistListNil" + +// RegistryAllowlistList is a list of values of the 'registry_allowlist' type. +type RegistryAllowlistList struct { + href string + link bool + items []*RegistryAllowlist +} + +// Kind returns the name of the type of the object. +func (l *RegistryAllowlistList) Kind() string { + if l == nil { + return RegistryAllowlistListNilKind + } + if l.link { + return RegistryAllowlistListLinkKind + } + return RegistryAllowlistListKind +} + +// Link returns true iif this is a link. +func (l *RegistryAllowlistList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *RegistryAllowlistList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *RegistryAllowlistList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *RegistryAllowlistList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RegistryAllowlistList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RegistryAllowlistList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RegistryAllowlistList) SetItems(items []*RegistryAllowlist) { + l.items = items +} + +// Items returns the items of the list. +func (l *RegistryAllowlistList) Items() []*RegistryAllowlist { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RegistryAllowlistList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RegistryAllowlistList) Get(i int) *RegistryAllowlist { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RegistryAllowlistList) Slice() []*RegistryAllowlist { + var slice []*RegistryAllowlist + if l == nil { + slice = make([]*RegistryAllowlist, 0) + } else { + slice = make([]*RegistryAllowlist, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RegistryAllowlistList) Each(f func(item *RegistryAllowlist) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RegistryAllowlistList) Range(f func(index int, item *RegistryAllowlist) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/registry_allowlist_type_json.go b/clientapi/clustersmgmt/v1/registry_allowlist_type_json.go new file mode 100644 index 00000000..9bda755e --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_allowlist_type_json.go @@ -0,0 +1,151 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRegistryAllowlist writes a value of the 'registry_allowlist' type to the given writer. +func MarshalRegistryAllowlist(object *RegistryAllowlist, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistryAllowlist(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistryAllowlist writes a value of the 'registry_allowlist' type to the given stream. +func WriteRegistryAllowlist(object *RegistryAllowlist, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(RegistryAllowlistLinkKind) + } else { + stream.WriteString(RegistryAllowlistKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.cloudProvider != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + WriteCloudProvider(object.cloudProvider, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 && object.registries != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("registries") + WriteStringList(object.registries, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalRegistryAllowlist reads a value of the 'registry_allowlist' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRegistryAllowlist(source interface{}) (object *RegistryAllowlist, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRegistryAllowlist(iterator) + err = iterator.Error + return +} + +// ReadRegistryAllowlist reads a value of the 'registry_allowlist' type from the given iterator. +func ReadRegistryAllowlist(iterator *jsoniter.Iterator) *RegistryAllowlist { + object := &RegistryAllowlist{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == RegistryAllowlistLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "cloud_provider": + value := ReadCloudProvider(iterator) + object.cloudProvider = value + object.bitmap_ |= 8 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 16 + case "registries": + value := ReadStringList(iterator) + object.registries = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/registry_location_builder.go b/clientapi/clustersmgmt/v1/registry_location_builder.go new file mode 100644 index 00000000..34c61888 --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_location_builder.go @@ -0,0 +1,74 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RegistryLocationBuilder contains the data and logic needed to build 'registry_location' objects. +// +// RegistryLocation contains a location of the registry specified by the registry domain +// name. The domain name might include wildcards, like '*' or '??'. +type RegistryLocationBuilder struct { + bitmap_ uint32 + domainName string + insecure bool +} + +// NewRegistryLocation creates a new builder of 'registry_location' objects. +func NewRegistryLocation() *RegistryLocationBuilder { + return &RegistryLocationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RegistryLocationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// DomainName sets the value of the 'domain_name' attribute to the given value. +func (b *RegistryLocationBuilder) DomainName(value string) *RegistryLocationBuilder { + b.domainName = value + b.bitmap_ |= 1 + return b +} + +// Insecure sets the value of the 'insecure' attribute to the given value. +func (b *RegistryLocationBuilder) Insecure(value bool) *RegistryLocationBuilder { + b.insecure = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RegistryLocationBuilder) Copy(object *RegistryLocation) *RegistryLocationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.domainName = object.domainName + b.insecure = object.insecure + return b +} + +// Build creates a 'registry_location' object using the configuration stored in the builder. +func (b *RegistryLocationBuilder) Build() (object *RegistryLocation, err error) { + object = new(RegistryLocation) + object.bitmap_ = b.bitmap_ + object.domainName = b.domainName + object.insecure = b.insecure + return +} diff --git a/clientapi/clustersmgmt/v1/registry_location_list_builder.go b/clientapi/clustersmgmt/v1/registry_location_list_builder.go new file mode 100644 index 00000000..521e24c6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_location_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RegistryLocationListBuilder contains the data and logic needed to build +// 'registry_location' objects. +type RegistryLocationListBuilder struct { + items []*RegistryLocationBuilder +} + +// NewRegistryLocationList creates a new builder of 'registry_location' objects. +func NewRegistryLocationList() *RegistryLocationListBuilder { + return new(RegistryLocationListBuilder) +} + +// Items sets the items of the list. +func (b *RegistryLocationListBuilder) Items(values ...*RegistryLocationBuilder) *RegistryLocationListBuilder { + b.items = make([]*RegistryLocationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RegistryLocationListBuilder) 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 *RegistryLocationListBuilder) Copy(list *RegistryLocationList) *RegistryLocationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RegistryLocationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRegistryLocation().Copy(v) + } + } + return b +} + +// Build creates a list of 'registry_location' objects using the +// configuration stored in the builder. +func (b *RegistryLocationListBuilder) Build() (list *RegistryLocationList, err error) { + items := make([]*RegistryLocation, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RegistryLocationList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/registry_location_list_type_json.go b/clientapi/clustersmgmt/v1/registry_location_list_type_json.go new file mode 100644 index 00000000..a1b43c40 --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_location_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRegistryLocationList writes a list of values of the 'registry_location' type to +// the given writer. +func MarshalRegistryLocationList(list []*RegistryLocation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistryLocationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistryLocationList writes a list of value of the 'registry_location' type to +// the given stream. +func WriteRegistryLocationList(list []*RegistryLocation, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRegistryLocation(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRegistryLocationList reads a list of values of the 'registry_location' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRegistryLocationList(source interface{}) (items []*RegistryLocation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRegistryLocationList(iterator) + err = iterator.Error + return +} + +// ReadRegistryLocationList reads list of values of the ”registry_location' type from +// the given iterator. +func ReadRegistryLocationList(iterator *jsoniter.Iterator) []*RegistryLocation { + list := []*RegistryLocation{} + for iterator.ReadArray() { + item := ReadRegistryLocation(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/registry_location_type.go b/clientapi/clustersmgmt/v1/registry_location_type.go new file mode 100644 index 00000000..753f9645 --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_location_type.go @@ -0,0 +1,196 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RegistryLocation represents the values of the 'registry_location' type. +// +// RegistryLocation contains a location of the registry specified by the registry domain +// name. The domain name might include wildcards, like '*' or '??'. +type RegistryLocation struct { + bitmap_ uint32 + domainName string + insecure bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RegistryLocation) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// DomainName returns the value of the 'domain_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// domainName specifies a domain name for the registry +// In case the registry use non-standard (80 or 443) port, the port should be included +// in the domain name as well. +func (o *RegistryLocation) DomainName() string { + if o != nil && o.bitmap_&1 != 0 { + return o.domainName + } + return "" +} + +// GetDomainName returns the value of the 'domain_name' attribute and +// a flag indicating if the attribute has a value. +// +// domainName specifies a domain name for the registry +// In case the registry use non-standard (80 or 443) port, the port should be included +// in the domain name as well. +func (o *RegistryLocation) GetDomainName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.domainName + } + return +} + +// Insecure returns the value of the 'insecure' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// insecure indicates whether the registry is secure (https) or insecure (http) +// By default (if not specified) the registry is assumed as secure. +func (o *RegistryLocation) Insecure() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.insecure + } + return false +} + +// GetInsecure returns the value of the 'insecure' attribute and +// a flag indicating if the attribute has a value. +// +// insecure indicates whether the registry is secure (https) or insecure (http) +// By default (if not specified) the registry is assumed as secure. +func (o *RegistryLocation) GetInsecure() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.insecure + } + return +} + +// RegistryLocationListKind is the name of the type used to represent list of objects of +// type 'registry_location'. +const RegistryLocationListKind = "RegistryLocationList" + +// RegistryLocationListLinkKind is the name of the type used to represent links to list +// of objects of type 'registry_location'. +const RegistryLocationListLinkKind = "RegistryLocationListLink" + +// RegistryLocationNilKind is the name of the type used to nil lists of objects of +// type 'registry_location'. +const RegistryLocationListNilKind = "RegistryLocationListNil" + +// RegistryLocationList is a list of values of the 'registry_location' type. +type RegistryLocationList struct { + href string + link bool + items []*RegistryLocation +} + +// Len returns the length of the list. +func (l *RegistryLocationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RegistryLocationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RegistryLocationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RegistryLocationList) SetItems(items []*RegistryLocation) { + l.items = items +} + +// Items returns the items of the list. +func (l *RegistryLocationList) Items() []*RegistryLocation { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RegistryLocationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RegistryLocationList) Get(i int) *RegistryLocation { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RegistryLocationList) Slice() []*RegistryLocation { + var slice []*RegistryLocation + if l == nil { + slice = make([]*RegistryLocation, 0) + } else { + slice = make([]*RegistryLocation, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RegistryLocationList) Each(f func(item *RegistryLocation) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RegistryLocationList) Range(f func(index int, item *RegistryLocation) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/registry_location_type_json.go b/clientapi/clustersmgmt/v1/registry_location_type_json.go new file mode 100644 index 00000000..12d88a0b --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_location_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRegistryLocation writes a value of the 'registry_location' type to the given writer. +func MarshalRegistryLocation(object *RegistryLocation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistryLocation(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistryLocation writes a value of the 'registry_location' type to the given stream. +func WriteRegistryLocation(object *RegistryLocation, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("domain_name") + stream.WriteString(object.domainName) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("insecure") + stream.WriteBool(object.insecure) + } + stream.WriteObjectEnd() +} + +// UnmarshalRegistryLocation reads a value of the 'registry_location' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRegistryLocation(source interface{}) (object *RegistryLocation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRegistryLocation(iterator) + err = iterator.Error + return +} + +// ReadRegistryLocation reads a value of the 'registry_location' type from the given iterator. +func ReadRegistryLocation(iterator *jsoniter.Iterator) *RegistryLocation { + object := &RegistryLocation{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "domain_name": + value := iterator.ReadString() + object.domainName = value + object.bitmap_ |= 1 + case "insecure": + value := iterator.ReadBool() + object.insecure = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/registry_sources_builder.go b/clientapi/clustersmgmt/v1/registry_sources_builder.go new file mode 100644 index 00000000..09353ae6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_sources_builder.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RegistrySourcesBuilder contains the data and logic needed to build 'registry_sources' objects. +// +// RegistrySources contains configuration that determines how the container runtime should treat individual +// registries when accessing images for builds and pods. For instance, whether or not to allow insecure access. +// It does not contain configuration for the internal cluster registry. +type RegistrySourcesBuilder struct { + bitmap_ uint32 + allowedRegistries []string + blockedRegistries []string + insecureRegistries []string +} + +// NewRegistrySources creates a new builder of 'registry_sources' objects. +func NewRegistrySources() *RegistrySourcesBuilder { + return &RegistrySourcesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RegistrySourcesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AllowedRegistries sets the value of the 'allowed_registries' attribute to the given values. +func (b *RegistrySourcesBuilder) AllowedRegistries(values ...string) *RegistrySourcesBuilder { + b.allowedRegistries = make([]string, len(values)) + copy(b.allowedRegistries, values) + b.bitmap_ |= 1 + return b +} + +// BlockedRegistries sets the value of the 'blocked_registries' attribute to the given values. +func (b *RegistrySourcesBuilder) BlockedRegistries(values ...string) *RegistrySourcesBuilder { + b.blockedRegistries = make([]string, len(values)) + copy(b.blockedRegistries, values) + b.bitmap_ |= 2 + return b +} + +// InsecureRegistries sets the value of the 'insecure_registries' attribute to the given values. +func (b *RegistrySourcesBuilder) InsecureRegistries(values ...string) *RegistrySourcesBuilder { + b.insecureRegistries = make([]string, len(values)) + copy(b.insecureRegistries, values) + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RegistrySourcesBuilder) Copy(object *RegistrySources) *RegistrySourcesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.allowedRegistries != nil { + b.allowedRegistries = make([]string, len(object.allowedRegistries)) + copy(b.allowedRegistries, object.allowedRegistries) + } else { + b.allowedRegistries = nil + } + if object.blockedRegistries != nil { + b.blockedRegistries = make([]string, len(object.blockedRegistries)) + copy(b.blockedRegistries, object.blockedRegistries) + } else { + b.blockedRegistries = nil + } + if object.insecureRegistries != nil { + b.insecureRegistries = make([]string, len(object.insecureRegistries)) + copy(b.insecureRegistries, object.insecureRegistries) + } else { + b.insecureRegistries = nil + } + return b +} + +// Build creates a 'registry_sources' object using the configuration stored in the builder. +func (b *RegistrySourcesBuilder) Build() (object *RegistrySources, err error) { + object = new(RegistrySources) + object.bitmap_ = b.bitmap_ + if b.allowedRegistries != nil { + object.allowedRegistries = make([]string, len(b.allowedRegistries)) + copy(object.allowedRegistries, b.allowedRegistries) + } + if b.blockedRegistries != nil { + object.blockedRegistries = make([]string, len(b.blockedRegistries)) + copy(object.blockedRegistries, b.blockedRegistries) + } + if b.insecureRegistries != nil { + object.insecureRegistries = make([]string, len(b.insecureRegistries)) + copy(object.insecureRegistries, b.insecureRegistries) + } + return +} diff --git a/clientapi/clustersmgmt/v1/registry_sources_list_builder.go b/clientapi/clustersmgmt/v1/registry_sources_list_builder.go new file mode 100644 index 00000000..76878c42 --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_sources_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RegistrySourcesListBuilder contains the data and logic needed to build +// 'registry_sources' objects. +type RegistrySourcesListBuilder struct { + items []*RegistrySourcesBuilder +} + +// NewRegistrySourcesList creates a new builder of 'registry_sources' objects. +func NewRegistrySourcesList() *RegistrySourcesListBuilder { + return new(RegistrySourcesListBuilder) +} + +// Items sets the items of the list. +func (b *RegistrySourcesListBuilder) Items(values ...*RegistrySourcesBuilder) *RegistrySourcesListBuilder { + b.items = make([]*RegistrySourcesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RegistrySourcesListBuilder) 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 *RegistrySourcesListBuilder) Copy(list *RegistrySourcesList) *RegistrySourcesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RegistrySourcesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRegistrySources().Copy(v) + } + } + return b +} + +// Build creates a list of 'registry_sources' objects using the +// configuration stored in the builder. +func (b *RegistrySourcesListBuilder) Build() (list *RegistrySourcesList, err error) { + items := make([]*RegistrySources, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RegistrySourcesList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/registry_sources_list_type_json.go b/clientapi/clustersmgmt/v1/registry_sources_list_type_json.go new file mode 100644 index 00000000..5ad0b93e --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_sources_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRegistrySourcesList writes a list of values of the 'registry_sources' type to +// the given writer. +func MarshalRegistrySourcesList(list []*RegistrySources, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistrySourcesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistrySourcesList writes a list of value of the 'registry_sources' type to +// the given stream. +func WriteRegistrySourcesList(list []*RegistrySources, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRegistrySources(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRegistrySourcesList reads a list of values of the 'registry_sources' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRegistrySourcesList(source interface{}) (items []*RegistrySources, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRegistrySourcesList(iterator) + err = iterator.Error + return +} + +// ReadRegistrySourcesList reads list of values of the ”registry_sources' type from +// the given iterator. +func ReadRegistrySourcesList(iterator *jsoniter.Iterator) []*RegistrySources { + list := []*RegistrySources{} + for iterator.ReadArray() { + item := ReadRegistrySources(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/registry_sources_type.go b/clientapi/clustersmgmt/v1/registry_sources_type.go new file mode 100644 index 00000000..56da9b80 --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_sources_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RegistrySources represents the values of the 'registry_sources' type. +// +// RegistrySources contains configuration that determines how the container runtime should treat individual +// registries when accessing images for builds and pods. For instance, whether or not to allow insecure access. +// It does not contain configuration for the internal cluster registry. +type RegistrySources struct { + bitmap_ uint32 + allowedRegistries []string + blockedRegistries []string + insecureRegistries []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RegistrySources) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AllowedRegistries returns the value of the 'allowed_registries' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AllowedRegistries: registries for which image pull and push actions are allowed. +// To specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name. +// For example, *.example.com. You can specify an individual repository within a registry. +// For example: reg1.io/myrepo/myapp:latest. All other registries are blocked. +// Mutually exclusive with `BlockedRegistries` +func (o *RegistrySources) AllowedRegistries() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.allowedRegistries + } + return nil +} + +// GetAllowedRegistries returns the value of the 'allowed_registries' attribute and +// a flag indicating if the attribute has a value. +// +// AllowedRegistries: registries for which image pull and push actions are allowed. +// To specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name. +// For example, *.example.com. You can specify an individual repository within a registry. +// For example: reg1.io/myrepo/myapp:latest. All other registries are blocked. +// Mutually exclusive with `BlockedRegistries` +func (o *RegistrySources) GetAllowedRegistries() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.allowedRegistries + } + return +} + +// BlockedRegistries returns the value of the 'blocked_registries' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// BlockedRegistries: registries for which image pull and push actions are denied. +// To specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name. +// For example, *.example.com. You can specify an individual repository within a registry. +// For example: reg1.io/myrepo/myapp:latest. All other registries are allowed. +// Mutually exclusive with `AllowedRegistries` +func (o *RegistrySources) BlockedRegistries() []string { + if o != nil && o.bitmap_&2 != 0 { + return o.blockedRegistries + } + return nil +} + +// GetBlockedRegistries returns the value of the 'blocked_registries' attribute and +// a flag indicating if the attribute has a value. +// +// BlockedRegistries: registries for which image pull and push actions are denied. +// To specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name. +// For example, *.example.com. You can specify an individual repository within a registry. +// For example: reg1.io/myrepo/myapp:latest. All other registries are allowed. +// Mutually exclusive with `AllowedRegistries` +func (o *RegistrySources) GetBlockedRegistries() (value []string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.blockedRegistries + } + return +} + +// InsecureRegistries returns the value of the 'insecure_registries' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// InsecureRegistries are registries which do not have a valid TLS certificate or only support HTTP connections. +// To specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name. +// For example, *.example.com. You can specify an individual repository within a registry. +// For example: reg1.io/myrepo/myapp:latest. +func (o *RegistrySources) InsecureRegistries() []string { + if o != nil && o.bitmap_&4 != 0 { + return o.insecureRegistries + } + return nil +} + +// GetInsecureRegistries returns the value of the 'insecure_registries' attribute and +// a flag indicating if the attribute has a value. +// +// InsecureRegistries are registries which do not have a valid TLS certificate or only support HTTP connections. +// To specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name. +// For example, *.example.com. You can specify an individual repository within a registry. +// For example: reg1.io/myrepo/myapp:latest. +func (o *RegistrySources) GetInsecureRegistries() (value []string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.insecureRegistries + } + return +} + +// RegistrySourcesListKind is the name of the type used to represent list of objects of +// type 'registry_sources'. +const RegistrySourcesListKind = "RegistrySourcesList" + +// RegistrySourcesListLinkKind is the name of the type used to represent links to list +// of objects of type 'registry_sources'. +const RegistrySourcesListLinkKind = "RegistrySourcesListLink" + +// RegistrySourcesNilKind is the name of the type used to nil lists of objects of +// type 'registry_sources'. +const RegistrySourcesListNilKind = "RegistrySourcesListNil" + +// RegistrySourcesList is a list of values of the 'registry_sources' type. +type RegistrySourcesList struct { + href string + link bool + items []*RegistrySources +} + +// Len returns the length of the list. +func (l *RegistrySourcesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RegistrySourcesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RegistrySourcesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RegistrySourcesList) SetItems(items []*RegistrySources) { + l.items = items +} + +// Items returns the items of the list. +func (l *RegistrySourcesList) Items() []*RegistrySources { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RegistrySourcesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RegistrySourcesList) Get(i int) *RegistrySources { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RegistrySourcesList) Slice() []*RegistrySources { + var slice []*RegistrySources + if l == nil { + slice = make([]*RegistrySources, 0) + } else { + slice = make([]*RegistrySources, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RegistrySourcesList) Each(f func(item *RegistrySources) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RegistrySourcesList) Range(f func(index int, item *RegistrySources) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/registry_sources_type_json.go b/clientapi/clustersmgmt/v1/registry_sources_type_json.go new file mode 100644 index 00000000..516430e3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/registry_sources_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRegistrySources writes a value of the 'registry_sources' type to the given writer. +func MarshalRegistrySources(object *RegistrySources, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRegistrySources(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRegistrySources writes a value of the 'registry_sources' type to the given stream. +func WriteRegistrySources(object *RegistrySources, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.allowedRegistries != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("allowed_registries") + WriteStringList(object.allowedRegistries, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.blockedRegistries != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("blocked_registries") + WriteStringList(object.blockedRegistries, stream) + count++ + } + present_ = object.bitmap_&4 != 0 && object.insecureRegistries != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("insecure_registries") + WriteStringList(object.insecureRegistries, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalRegistrySources reads a value of the 'registry_sources' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRegistrySources(source interface{}) (object *RegistrySources, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRegistrySources(iterator) + err = iterator.Error + return +} + +// ReadRegistrySources reads a value of the 'registry_sources' type from the given iterator. +func ReadRegistrySources(iterator *jsoniter.Iterator) *RegistrySources { + object := &RegistrySources{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "allowed_registries": + value := ReadStringList(iterator) + object.allowedRegistries = value + object.bitmap_ |= 1 + case "blocked_registries": + value := ReadStringList(iterator) + object.blockedRegistries = value + object.bitmap_ |= 2 + case "insecure_registries": + value := ReadStringList(iterator) + object.insecureRegistries = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/release_image_details_builder.go b/clientapi/clustersmgmt/v1/release_image_details_builder.go new file mode 100644 index 00000000..c8f8d41b --- /dev/null +++ b/clientapi/clustersmgmt/v1/release_image_details_builder.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ReleaseImageDetailsBuilder contains the data and logic needed to build 'release_image_details' objects. +type ReleaseImageDetailsBuilder struct { + bitmap_ uint32 + availableUpgrades []string + releaseImage string +} + +// NewReleaseImageDetails creates a new builder of 'release_image_details' objects. +func NewReleaseImageDetails() *ReleaseImageDetailsBuilder { + return &ReleaseImageDetailsBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ReleaseImageDetailsBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AvailableUpgrades sets the value of the 'available_upgrades' attribute to the given values. +func (b *ReleaseImageDetailsBuilder) AvailableUpgrades(values ...string) *ReleaseImageDetailsBuilder { + b.availableUpgrades = make([]string, len(values)) + copy(b.availableUpgrades, values) + b.bitmap_ |= 1 + return b +} + +// ReleaseImage sets the value of the 'release_image' attribute to the given value. +func (b *ReleaseImageDetailsBuilder) ReleaseImage(value string) *ReleaseImageDetailsBuilder { + b.releaseImage = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ReleaseImageDetailsBuilder) Copy(object *ReleaseImageDetails) *ReleaseImageDetailsBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.availableUpgrades != nil { + b.availableUpgrades = make([]string, len(object.availableUpgrades)) + copy(b.availableUpgrades, object.availableUpgrades) + } else { + b.availableUpgrades = nil + } + b.releaseImage = object.releaseImage + return b +} + +// Build creates a 'release_image_details' object using the configuration stored in the builder. +func (b *ReleaseImageDetailsBuilder) Build() (object *ReleaseImageDetails, err error) { + object = new(ReleaseImageDetails) + object.bitmap_ = b.bitmap_ + if b.availableUpgrades != nil { + object.availableUpgrades = make([]string, len(b.availableUpgrades)) + copy(object.availableUpgrades, b.availableUpgrades) + } + object.releaseImage = b.releaseImage + return +} diff --git a/clientapi/clustersmgmt/v1/release_image_details_list_builder.go b/clientapi/clustersmgmt/v1/release_image_details_list_builder.go new file mode 100644 index 00000000..0643fe9c --- /dev/null +++ b/clientapi/clustersmgmt/v1/release_image_details_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ReleaseImageDetailsListBuilder contains the data and logic needed to build +// 'release_image_details' objects. +type ReleaseImageDetailsListBuilder struct { + items []*ReleaseImageDetailsBuilder +} + +// NewReleaseImageDetailsList creates a new builder of 'release_image_details' objects. +func NewReleaseImageDetailsList() *ReleaseImageDetailsListBuilder { + return new(ReleaseImageDetailsListBuilder) +} + +// Items sets the items of the list. +func (b *ReleaseImageDetailsListBuilder) Items(values ...*ReleaseImageDetailsBuilder) *ReleaseImageDetailsListBuilder { + b.items = make([]*ReleaseImageDetailsBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ReleaseImageDetailsListBuilder) 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 *ReleaseImageDetailsListBuilder) Copy(list *ReleaseImageDetailsList) *ReleaseImageDetailsListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ReleaseImageDetailsBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewReleaseImageDetails().Copy(v) + } + } + return b +} + +// Build creates a list of 'release_image_details' objects using the +// configuration stored in the builder. +func (b *ReleaseImageDetailsListBuilder) Build() (list *ReleaseImageDetailsList, err error) { + items := make([]*ReleaseImageDetails, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ReleaseImageDetailsList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/release_image_details_list_type_json.go b/clientapi/clustersmgmt/v1/release_image_details_list_type_json.go new file mode 100644 index 00000000..9afb1b11 --- /dev/null +++ b/clientapi/clustersmgmt/v1/release_image_details_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalReleaseImageDetailsList writes a list of values of the 'release_image_details' type to +// the given writer. +func MarshalReleaseImageDetailsList(list []*ReleaseImageDetails, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteReleaseImageDetailsList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteReleaseImageDetailsList writes a list of value of the 'release_image_details' type to +// the given stream. +func WriteReleaseImageDetailsList(list []*ReleaseImageDetails, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteReleaseImageDetails(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalReleaseImageDetailsList reads a list of values of the 'release_image_details' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalReleaseImageDetailsList(source interface{}) (items []*ReleaseImageDetails, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadReleaseImageDetailsList(iterator) + err = iterator.Error + return +} + +// ReadReleaseImageDetailsList reads list of values of the ”release_image_details' type from +// the given iterator. +func ReadReleaseImageDetailsList(iterator *jsoniter.Iterator) []*ReleaseImageDetails { + list := []*ReleaseImageDetails{} + for iterator.ReadArray() { + item := ReadReleaseImageDetails(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/release_image_details_type.go b/clientapi/clustersmgmt/v1/release_image_details_type.go new file mode 100644 index 00000000..d35b9135 --- /dev/null +++ b/clientapi/clustersmgmt/v1/release_image_details_type.go @@ -0,0 +1,187 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ReleaseImageDetails represents the values of the 'release_image_details' type. +type ReleaseImageDetails struct { + bitmap_ uint32 + availableUpgrades []string + releaseImage string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ReleaseImageDetails) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AvailableUpgrades returns the value of the 'available_upgrades' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AvailableUpgrades is the list of versions this version can be upgraded to. +func (o *ReleaseImageDetails) AvailableUpgrades() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.availableUpgrades + } + return nil +} + +// GetAvailableUpgrades returns the value of the 'available_upgrades' attribute and +// a flag indicating if the attribute has a value. +// +// AvailableUpgrades is the list of versions this version can be upgraded to. +func (o *ReleaseImageDetails) GetAvailableUpgrades() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.availableUpgrades + } + return +} + +// ReleaseImage returns the value of the 'release_image' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ReleaseImage contains the URI of Openshift release image. +func (o *ReleaseImageDetails) ReleaseImage() string { + if o != nil && o.bitmap_&2 != 0 { + return o.releaseImage + } + return "" +} + +// GetReleaseImage returns the value of the 'release_image' attribute and +// a flag indicating if the attribute has a value. +// +// ReleaseImage contains the URI of Openshift release image. +func (o *ReleaseImageDetails) GetReleaseImage() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.releaseImage + } + return +} + +// ReleaseImageDetailsListKind is the name of the type used to represent list of objects of +// type 'release_image_details'. +const ReleaseImageDetailsListKind = "ReleaseImageDetailsList" + +// ReleaseImageDetailsListLinkKind is the name of the type used to represent links to list +// of objects of type 'release_image_details'. +const ReleaseImageDetailsListLinkKind = "ReleaseImageDetailsListLink" + +// ReleaseImageDetailsNilKind is the name of the type used to nil lists of objects of +// type 'release_image_details'. +const ReleaseImageDetailsListNilKind = "ReleaseImageDetailsListNil" + +// ReleaseImageDetailsList is a list of values of the 'release_image_details' type. +type ReleaseImageDetailsList struct { + href string + link bool + items []*ReleaseImageDetails +} + +// Len returns the length of the list. +func (l *ReleaseImageDetailsList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ReleaseImageDetailsList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ReleaseImageDetailsList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ReleaseImageDetailsList) SetItems(items []*ReleaseImageDetails) { + l.items = items +} + +// Items returns the items of the list. +func (l *ReleaseImageDetailsList) Items() []*ReleaseImageDetails { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ReleaseImageDetailsList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ReleaseImageDetailsList) Get(i int) *ReleaseImageDetails { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ReleaseImageDetailsList) Slice() []*ReleaseImageDetails { + var slice []*ReleaseImageDetails + if l == nil { + slice = make([]*ReleaseImageDetails, 0) + } else { + slice = make([]*ReleaseImageDetails, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ReleaseImageDetailsList) Each(f func(item *ReleaseImageDetails) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ReleaseImageDetailsList) Range(f func(index int, item *ReleaseImageDetails) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/release_image_details_type_json.go b/clientapi/clustersmgmt/v1/release_image_details_type_json.go new file mode 100644 index 00000000..a3acae97 --- /dev/null +++ b/clientapi/clustersmgmt/v1/release_image_details_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalReleaseImageDetails writes a value of the 'release_image_details' type to the given writer. +func MarshalReleaseImageDetails(object *ReleaseImageDetails, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteReleaseImageDetails(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteReleaseImageDetails writes a value of the 'release_image_details' type to the given stream. +func WriteReleaseImageDetails(object *ReleaseImageDetails, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.availableUpgrades != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("available_upgrades") + WriteStringList(object.availableUpgrades, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("release_image") + stream.WriteString(object.releaseImage) + } + stream.WriteObjectEnd() +} + +// UnmarshalReleaseImageDetails reads a value of the 'release_image_details' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalReleaseImageDetails(source interface{}) (object *ReleaseImageDetails, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadReleaseImageDetails(iterator) + err = iterator.Error + return +} + +// ReadReleaseImageDetails reads a value of the 'release_image_details' type from the given iterator. +func ReadReleaseImageDetails(iterator *jsoniter.Iterator) *ReleaseImageDetails { + object := &ReleaseImageDetails{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "available_upgrades": + value := ReadStringList(iterator) + object.availableUpgrades = value + object.bitmap_ |= 1 + case "release_image": + value := iterator.ReadString() + object.releaseImage = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/release_images_builder.go b/clientapi/clustersmgmt/v1/release_images_builder.go new file mode 100644 index 00000000..e246fa13 --- /dev/null +++ b/clientapi/clustersmgmt/v1/release_images_builder.go @@ -0,0 +1,97 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ReleaseImagesBuilder contains the data and logic needed to build 'release_images' objects. +type ReleaseImagesBuilder struct { + bitmap_ uint32 + arm64 *ReleaseImageDetailsBuilder + multi *ReleaseImageDetailsBuilder +} + +// NewReleaseImages creates a new builder of 'release_images' objects. +func NewReleaseImages() *ReleaseImagesBuilder { + return &ReleaseImagesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ReleaseImagesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ARM64 sets the value of the 'ARM64' attribute to the given value. +func (b *ReleaseImagesBuilder) ARM64(value *ReleaseImageDetailsBuilder) *ReleaseImagesBuilder { + b.arm64 = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// Multi sets the value of the 'multi' attribute to the given value. +func (b *ReleaseImagesBuilder) Multi(value *ReleaseImageDetailsBuilder) *ReleaseImagesBuilder { + b.multi = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ReleaseImagesBuilder) Copy(object *ReleaseImages) *ReleaseImagesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.arm64 != nil { + b.arm64 = NewReleaseImageDetails().Copy(object.arm64) + } else { + b.arm64 = nil + } + if object.multi != nil { + b.multi = NewReleaseImageDetails().Copy(object.multi) + } else { + b.multi = nil + } + return b +} + +// Build creates a 'release_images' object using the configuration stored in the builder. +func (b *ReleaseImagesBuilder) Build() (object *ReleaseImages, err error) { + object = new(ReleaseImages) + object.bitmap_ = b.bitmap_ + if b.arm64 != nil { + object.arm64, err = b.arm64.Build() + if err != nil { + return + } + } + if b.multi != nil { + object.multi, err = b.multi.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/release_images_list_builder.go b/clientapi/clustersmgmt/v1/release_images_list_builder.go new file mode 100644 index 00000000..7f20d61d --- /dev/null +++ b/clientapi/clustersmgmt/v1/release_images_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ReleaseImagesListBuilder contains the data and logic needed to build +// 'release_images' objects. +type ReleaseImagesListBuilder struct { + items []*ReleaseImagesBuilder +} + +// NewReleaseImagesList creates a new builder of 'release_images' objects. +func NewReleaseImagesList() *ReleaseImagesListBuilder { + return new(ReleaseImagesListBuilder) +} + +// Items sets the items of the list. +func (b *ReleaseImagesListBuilder) Items(values ...*ReleaseImagesBuilder) *ReleaseImagesListBuilder { + b.items = make([]*ReleaseImagesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ReleaseImagesListBuilder) 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 *ReleaseImagesListBuilder) Copy(list *ReleaseImagesList) *ReleaseImagesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ReleaseImagesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewReleaseImages().Copy(v) + } + } + return b +} + +// Build creates a list of 'release_images' objects using the +// configuration stored in the builder. +func (b *ReleaseImagesListBuilder) Build() (list *ReleaseImagesList, err error) { + items := make([]*ReleaseImages, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ReleaseImagesList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/release_images_list_type_json.go b/clientapi/clustersmgmt/v1/release_images_list_type_json.go new file mode 100644 index 00000000..d4ecd146 --- /dev/null +++ b/clientapi/clustersmgmt/v1/release_images_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalReleaseImagesList writes a list of values of the 'release_images' type to +// the given writer. +func MarshalReleaseImagesList(list []*ReleaseImages, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteReleaseImagesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteReleaseImagesList writes a list of value of the 'release_images' type to +// the given stream. +func WriteReleaseImagesList(list []*ReleaseImages, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteReleaseImages(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalReleaseImagesList reads a list of values of the 'release_images' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalReleaseImagesList(source interface{}) (items []*ReleaseImages, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadReleaseImagesList(iterator) + err = iterator.Error + return +} + +// ReadReleaseImagesList reads list of values of the ”release_images' type from +// the given iterator. +func ReadReleaseImagesList(iterator *jsoniter.Iterator) []*ReleaseImages { + list := []*ReleaseImages{} + for iterator.ReadArray() { + item := ReadReleaseImages(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/release_images_type.go b/clientapi/clustersmgmt/v1/release_images_type.go new file mode 100644 index 00000000..0e77bc8f --- /dev/null +++ b/clientapi/clustersmgmt/v1/release_images_type.go @@ -0,0 +1,187 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ReleaseImages represents the values of the 'release_images' type. +type ReleaseImages struct { + bitmap_ uint32 + arm64 *ReleaseImageDetails + multi *ReleaseImageDetails +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ReleaseImages) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ARM64 returns the value of the 'ARM64' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Arm64 will contain the reference for the arm64 image which will be used for cluster deployments +func (o *ReleaseImages) ARM64() *ReleaseImageDetails { + if o != nil && o.bitmap_&1 != 0 { + return o.arm64 + } + return nil +} + +// GetARM64 returns the value of the 'ARM64' attribute and +// a flag indicating if the attribute has a value. +// +// Arm64 will contain the reference for the arm64 image which will be used for cluster deployments +func (o *ReleaseImages) GetARM64() (value *ReleaseImageDetails, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.arm64 + } + return +} + +// Multi returns the value of the 'multi' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Multi will contain the reference for the multi image which will be used for cluster deployments +func (o *ReleaseImages) Multi() *ReleaseImageDetails { + if o != nil && o.bitmap_&2 != 0 { + return o.multi + } + return nil +} + +// GetMulti returns the value of the 'multi' attribute and +// a flag indicating if the attribute has a value. +// +// Multi will contain the reference for the multi image which will be used for cluster deployments +func (o *ReleaseImages) GetMulti() (value *ReleaseImageDetails, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.multi + } + return +} + +// ReleaseImagesListKind is the name of the type used to represent list of objects of +// type 'release_images'. +const ReleaseImagesListKind = "ReleaseImagesList" + +// ReleaseImagesListLinkKind is the name of the type used to represent links to list +// of objects of type 'release_images'. +const ReleaseImagesListLinkKind = "ReleaseImagesListLink" + +// ReleaseImagesNilKind is the name of the type used to nil lists of objects of +// type 'release_images'. +const ReleaseImagesListNilKind = "ReleaseImagesListNil" + +// ReleaseImagesList is a list of values of the 'release_images' type. +type ReleaseImagesList struct { + href string + link bool + items []*ReleaseImages +} + +// Len returns the length of the list. +func (l *ReleaseImagesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ReleaseImagesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ReleaseImagesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ReleaseImagesList) SetItems(items []*ReleaseImages) { + l.items = items +} + +// Items returns the items of the list. +func (l *ReleaseImagesList) Items() []*ReleaseImages { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ReleaseImagesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ReleaseImagesList) Get(i int) *ReleaseImages { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ReleaseImagesList) Slice() []*ReleaseImages { + var slice []*ReleaseImages + if l == nil { + slice = make([]*ReleaseImages, 0) + } else { + slice = make([]*ReleaseImages, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ReleaseImagesList) Each(f func(item *ReleaseImages) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ReleaseImagesList) Range(f func(index int, item *ReleaseImages) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/release_images_type_json.go b/clientapi/clustersmgmt/v1/release_images_type_json.go new file mode 100644 index 00000000..8ed49527 --- /dev/null +++ b/clientapi/clustersmgmt/v1/release_images_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalReleaseImages writes a value of the 'release_images' type to the given writer. +func MarshalReleaseImages(object *ReleaseImages, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteReleaseImages(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteReleaseImages writes a value of the 'release_images' type to the given stream. +func WriteReleaseImages(object *ReleaseImages, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.arm64 != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("arm64") + WriteReleaseImageDetails(object.arm64, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.multi != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("multi") + WriteReleaseImageDetails(object.multi, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalReleaseImages reads a value of the 'release_images' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalReleaseImages(source interface{}) (object *ReleaseImages, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadReleaseImages(iterator) + err = iterator.Error + return +} + +// ReadReleaseImages reads a value of the 'release_images' type from the given iterator. +func ReadReleaseImages(iterator *jsoniter.Iterator) *ReleaseImages { + object := &ReleaseImages{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "arm64": + value := ReadReleaseImageDetails(iterator) + object.arm64 = value + object.bitmap_ |= 1 + case "multi": + value := ReadReleaseImageDetails(iterator) + object.multi = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/resource_range_builder.go b/clientapi/clustersmgmt/v1/resource_range_builder.go new file mode 100644 index 00000000..b2c13064 --- /dev/null +++ b/clientapi/clustersmgmt/v1/resource_range_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ResourceRangeBuilder contains the data and logic needed to build 'resource_range' objects. +type ResourceRangeBuilder struct { + bitmap_ uint32 + max int + min int +} + +// NewResourceRange creates a new builder of 'resource_range' objects. +func NewResourceRange() *ResourceRangeBuilder { + return &ResourceRangeBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ResourceRangeBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Max sets the value of the 'max' attribute to the given value. +func (b *ResourceRangeBuilder) Max(value int) *ResourceRangeBuilder { + b.max = value + b.bitmap_ |= 1 + return b +} + +// Min sets the value of the 'min' attribute to the given value. +func (b *ResourceRangeBuilder) Min(value int) *ResourceRangeBuilder { + b.min = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ResourceRangeBuilder) Copy(object *ResourceRange) *ResourceRangeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.max = object.max + b.min = object.min + return b +} + +// Build creates a 'resource_range' object using the configuration stored in the builder. +func (b *ResourceRangeBuilder) Build() (object *ResourceRange, err error) { + object = new(ResourceRange) + object.bitmap_ = b.bitmap_ + object.max = b.max + object.min = b.min + return +} diff --git a/clientapi/clustersmgmt/v1/resource_range_list_builder.go b/clientapi/clustersmgmt/v1/resource_range_list_builder.go new file mode 100644 index 00000000..b575f974 --- /dev/null +++ b/clientapi/clustersmgmt/v1/resource_range_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ResourceRangeListBuilder contains the data and logic needed to build +// 'resource_range' objects. +type ResourceRangeListBuilder struct { + items []*ResourceRangeBuilder +} + +// NewResourceRangeList creates a new builder of 'resource_range' objects. +func NewResourceRangeList() *ResourceRangeListBuilder { + return new(ResourceRangeListBuilder) +} + +// Items sets the items of the list. +func (b *ResourceRangeListBuilder) Items(values ...*ResourceRangeBuilder) *ResourceRangeListBuilder { + b.items = make([]*ResourceRangeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ResourceRangeListBuilder) 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 *ResourceRangeListBuilder) Copy(list *ResourceRangeList) *ResourceRangeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ResourceRangeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewResourceRange().Copy(v) + } + } + return b +} + +// Build creates a list of 'resource_range' objects using the +// configuration stored in the builder. +func (b *ResourceRangeListBuilder) Build() (list *ResourceRangeList, err error) { + items := make([]*ResourceRange, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ResourceRangeList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/resource_range_list_type_json.go b/clientapi/clustersmgmt/v1/resource_range_list_type_json.go new file mode 100644 index 00000000..0c59cf74 --- /dev/null +++ b/clientapi/clustersmgmt/v1/resource_range_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalResourceRangeList writes a list of values of the 'resource_range' type to +// the given writer. +func MarshalResourceRangeList(list []*ResourceRange, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteResourceRangeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteResourceRangeList writes a list of value of the 'resource_range' type to +// the given stream. +func WriteResourceRangeList(list []*ResourceRange, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteResourceRange(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalResourceRangeList reads a list of values of the 'resource_range' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalResourceRangeList(source interface{}) (items []*ResourceRange, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadResourceRangeList(iterator) + err = iterator.Error + return +} + +// ReadResourceRangeList reads list of values of the ”resource_range' type from +// the given iterator. +func ReadResourceRangeList(iterator *jsoniter.Iterator) []*ResourceRange { + list := []*ResourceRange{} + for iterator.ReadArray() { + item := ReadResourceRange(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/resource_range_type.go b/clientapi/clustersmgmt/v1/resource_range_type.go new file mode 100644 index 00000000..ac7e6aee --- /dev/null +++ b/clientapi/clustersmgmt/v1/resource_range_type.go @@ -0,0 +1,179 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ResourceRange represents the values of the 'resource_range' type. +type ResourceRange struct { + bitmap_ uint32 + max int + min int +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ResourceRange) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Max returns the value of the 'max' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ResourceRange) Max() int { + if o != nil && o.bitmap_&1 != 0 { + return o.max + } + return 0 +} + +// GetMax returns the value of the 'max' attribute and +// a flag indicating if the attribute has a value. +func (o *ResourceRange) GetMax() (value int, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.max + } + return +} + +// Min returns the value of the 'min' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ResourceRange) Min() int { + if o != nil && o.bitmap_&2 != 0 { + return o.min + } + return 0 +} + +// GetMin returns the value of the 'min' attribute and +// a flag indicating if the attribute has a value. +func (o *ResourceRange) GetMin() (value int, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.min + } + return +} + +// ResourceRangeListKind is the name of the type used to represent list of objects of +// type 'resource_range'. +const ResourceRangeListKind = "ResourceRangeList" + +// ResourceRangeListLinkKind is the name of the type used to represent links to list +// of objects of type 'resource_range'. +const ResourceRangeListLinkKind = "ResourceRangeListLink" + +// ResourceRangeNilKind is the name of the type used to nil lists of objects of +// type 'resource_range'. +const ResourceRangeListNilKind = "ResourceRangeListNil" + +// ResourceRangeList is a list of values of the 'resource_range' type. +type ResourceRangeList struct { + href string + link bool + items []*ResourceRange +} + +// Len returns the length of the list. +func (l *ResourceRangeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ResourceRangeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ResourceRangeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ResourceRangeList) SetItems(items []*ResourceRange) { + l.items = items +} + +// Items returns the items of the list. +func (l *ResourceRangeList) Items() []*ResourceRange { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ResourceRangeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ResourceRangeList) Get(i int) *ResourceRange { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ResourceRangeList) Slice() []*ResourceRange { + var slice []*ResourceRange + if l == nil { + slice = make([]*ResourceRange, 0) + } else { + slice = make([]*ResourceRange, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ResourceRangeList) Each(f func(item *ResourceRange) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ResourceRangeList) Range(f func(index int, item *ResourceRange) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/resource_range_type_json.go b/clientapi/clustersmgmt/v1/resource_range_type_json.go new file mode 100644 index 00000000..9cd5f849 --- /dev/null +++ b/clientapi/clustersmgmt/v1/resource_range_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalResourceRange writes a value of the 'resource_range' type to the given writer. +func MarshalResourceRange(object *ResourceRange, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteResourceRange(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteResourceRange writes a value of the 'resource_range' type to the given stream. +func WriteResourceRange(object *ResourceRange, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max") + stream.WriteInt(object.max) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("min") + stream.WriteInt(object.min) + } + stream.WriteObjectEnd() +} + +// UnmarshalResourceRange reads a value of the 'resource_range' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalResourceRange(source interface{}) (object *ResourceRange, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadResourceRange(iterator) + err = iterator.Error + return +} + +// ReadResourceRange reads a value of the 'resource_range' type from the given iterator. +func ReadResourceRange(iterator *jsoniter.Iterator) *ResourceRange { + object := &ResourceRange{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "max": + value := iterator.ReadInt() + object.max = value + object.bitmap_ |= 1 + case "min": + value := iterator.ReadInt() + object.min = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/role_policy_binding_builder.go b/clientapi/clustersmgmt/v1/role_policy_binding_builder.go new file mode 100644 index 00000000..8ee7dd2e --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_binding_builder.go @@ -0,0 +1,154 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// RolePolicyBindingBuilder contains the data and logic needed to build 'role_policy_binding' objects. +type RolePolicyBindingBuilder struct { + bitmap_ uint32 + arn string + creationTimestamp time.Time + lastUpdateTimestamp time.Time + name string + policies []*RolePolicyBuilder + status *RolePolicyBindingStatusBuilder + type_ string +} + +// NewRolePolicyBinding creates a new builder of 'role_policy_binding' objects. +func NewRolePolicyBinding() *RolePolicyBindingBuilder { + return &RolePolicyBindingBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RolePolicyBindingBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Arn sets the value of the 'arn' attribute to the given value. +func (b *RolePolicyBindingBuilder) Arn(value string) *RolePolicyBindingBuilder { + b.arn = value + b.bitmap_ |= 1 + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *RolePolicyBindingBuilder) CreationTimestamp(value time.Time) *RolePolicyBindingBuilder { + b.creationTimestamp = value + b.bitmap_ |= 2 + return b +} + +// LastUpdateTimestamp sets the value of the 'last_update_timestamp' attribute to the given value. +func (b *RolePolicyBindingBuilder) LastUpdateTimestamp(value time.Time) *RolePolicyBindingBuilder { + b.lastUpdateTimestamp = value + b.bitmap_ |= 4 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *RolePolicyBindingBuilder) Name(value string) *RolePolicyBindingBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// Policies sets the value of the 'policies' attribute to the given values. +func (b *RolePolicyBindingBuilder) Policies(values ...*RolePolicyBuilder) *RolePolicyBindingBuilder { + b.policies = make([]*RolePolicyBuilder, len(values)) + copy(b.policies, values) + b.bitmap_ |= 16 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *RolePolicyBindingBuilder) Status(value *RolePolicyBindingStatusBuilder) *RolePolicyBindingBuilder { + b.status = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *RolePolicyBindingBuilder) Type(value string) *RolePolicyBindingBuilder { + b.type_ = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RolePolicyBindingBuilder) Copy(object *RolePolicyBinding) *RolePolicyBindingBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.arn = object.arn + b.creationTimestamp = object.creationTimestamp + b.lastUpdateTimestamp = object.lastUpdateTimestamp + b.name = object.name + if object.policies != nil { + b.policies = make([]*RolePolicyBuilder, len(object.policies)) + for i, v := range object.policies { + b.policies[i] = NewRolePolicy().Copy(v) + } + } else { + b.policies = nil + } + if object.status != nil { + b.status = NewRolePolicyBindingStatus().Copy(object.status) + } else { + b.status = nil + } + b.type_ = object.type_ + return b +} + +// Build creates a 'role_policy_binding' object using the configuration stored in the builder. +func (b *RolePolicyBindingBuilder) Build() (object *RolePolicyBinding, err error) { + object = new(RolePolicyBinding) + object.bitmap_ = b.bitmap_ + object.arn = b.arn + object.creationTimestamp = b.creationTimestamp + object.lastUpdateTimestamp = b.lastUpdateTimestamp + object.name = b.name + if b.policies != nil { + object.policies = make([]*RolePolicy, len(b.policies)) + for i, v := range b.policies { + object.policies[i], err = v.Build() + if err != nil { + return + } + } + } + if b.status != nil { + object.status, err = b.status.Build() + if err != nil { + return + } + } + object.type_ = b.type_ + return +} diff --git a/clientapi/clustersmgmt/v1/role_policy_binding_list_builder.go b/clientapi/clustersmgmt/v1/role_policy_binding_list_builder.go new file mode 100644 index 00000000..109c3df1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_binding_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RolePolicyBindingListBuilder contains the data and logic needed to build +// 'role_policy_binding' objects. +type RolePolicyBindingListBuilder struct { + items []*RolePolicyBindingBuilder +} + +// NewRolePolicyBindingList creates a new builder of 'role_policy_binding' objects. +func NewRolePolicyBindingList() *RolePolicyBindingListBuilder { + return new(RolePolicyBindingListBuilder) +} + +// Items sets the items of the list. +func (b *RolePolicyBindingListBuilder) Items(values ...*RolePolicyBindingBuilder) *RolePolicyBindingListBuilder { + b.items = make([]*RolePolicyBindingBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RolePolicyBindingListBuilder) 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 *RolePolicyBindingListBuilder) Copy(list *RolePolicyBindingList) *RolePolicyBindingListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RolePolicyBindingBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRolePolicyBinding().Copy(v) + } + } + return b +} + +// Build creates a list of 'role_policy_binding' objects using the +// configuration stored in the builder. +func (b *RolePolicyBindingListBuilder) Build() (list *RolePolicyBindingList, err error) { + items := make([]*RolePolicyBinding, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RolePolicyBindingList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/role_policy_binding_list_type_json.go b/clientapi/clustersmgmt/v1/role_policy_binding_list_type_json.go new file mode 100644 index 00000000..22c9a213 --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_binding_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRolePolicyBindingList writes a list of values of the 'role_policy_binding' type to +// the given writer. +func MarshalRolePolicyBindingList(list []*RolePolicyBinding, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRolePolicyBindingList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRolePolicyBindingList writes a list of value of the 'role_policy_binding' type to +// the given stream. +func WriteRolePolicyBindingList(list []*RolePolicyBinding, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRolePolicyBinding(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRolePolicyBindingList reads a list of values of the 'role_policy_binding' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRolePolicyBindingList(source interface{}) (items []*RolePolicyBinding, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRolePolicyBindingList(iterator) + err = iterator.Error + return +} + +// ReadRolePolicyBindingList reads list of values of the ”role_policy_binding' type from +// the given iterator. +func ReadRolePolicyBindingList(iterator *jsoniter.Iterator) []*RolePolicyBinding { + list := []*RolePolicyBinding{} + for iterator.ReadArray() { + item := ReadRolePolicyBinding(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/role_policy_binding_status_builder.go b/clientapi/clustersmgmt/v1/role_policy_binding_status_builder.go new file mode 100644 index 00000000..bfb1d074 --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_binding_status_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RolePolicyBindingStatusBuilder contains the data and logic needed to build 'role_policy_binding_status' objects. +type RolePolicyBindingStatusBuilder struct { + bitmap_ uint32 + description string + value string +} + +// NewRolePolicyBindingStatus creates a new builder of 'role_policy_binding_status' objects. +func NewRolePolicyBindingStatus() *RolePolicyBindingStatusBuilder { + return &RolePolicyBindingStatusBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RolePolicyBindingStatusBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *RolePolicyBindingStatusBuilder) Description(value string) *RolePolicyBindingStatusBuilder { + b.description = value + b.bitmap_ |= 1 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *RolePolicyBindingStatusBuilder) Value(value string) *RolePolicyBindingStatusBuilder { + b.value = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RolePolicyBindingStatusBuilder) Copy(object *RolePolicyBindingStatus) *RolePolicyBindingStatusBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.description = object.description + b.value = object.value + return b +} + +// Build creates a 'role_policy_binding_status' object using the configuration stored in the builder. +func (b *RolePolicyBindingStatusBuilder) Build() (object *RolePolicyBindingStatus, err error) { + object = new(RolePolicyBindingStatus) + object.bitmap_ = b.bitmap_ + object.description = b.description + object.value = b.value + return +} diff --git a/clientapi/clustersmgmt/v1/role_policy_binding_status_list_builder.go b/clientapi/clustersmgmt/v1/role_policy_binding_status_list_builder.go new file mode 100644 index 00000000..bf2fdf0b --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_binding_status_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RolePolicyBindingStatusListBuilder contains the data and logic needed to build +// 'role_policy_binding_status' objects. +type RolePolicyBindingStatusListBuilder struct { + items []*RolePolicyBindingStatusBuilder +} + +// NewRolePolicyBindingStatusList creates a new builder of 'role_policy_binding_status' objects. +func NewRolePolicyBindingStatusList() *RolePolicyBindingStatusListBuilder { + return new(RolePolicyBindingStatusListBuilder) +} + +// Items sets the items of the list. +func (b *RolePolicyBindingStatusListBuilder) Items(values ...*RolePolicyBindingStatusBuilder) *RolePolicyBindingStatusListBuilder { + b.items = make([]*RolePolicyBindingStatusBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RolePolicyBindingStatusListBuilder) 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 *RolePolicyBindingStatusListBuilder) Copy(list *RolePolicyBindingStatusList) *RolePolicyBindingStatusListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RolePolicyBindingStatusBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRolePolicyBindingStatus().Copy(v) + } + } + return b +} + +// Build creates a list of 'role_policy_binding_status' objects using the +// configuration stored in the builder. +func (b *RolePolicyBindingStatusListBuilder) Build() (list *RolePolicyBindingStatusList, err error) { + items := make([]*RolePolicyBindingStatus, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RolePolicyBindingStatusList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/role_policy_binding_status_list_type_json.go b/clientapi/clustersmgmt/v1/role_policy_binding_status_list_type_json.go new file mode 100644 index 00000000..915261f1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_binding_status_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRolePolicyBindingStatusList writes a list of values of the 'role_policy_binding_status' type to +// the given writer. +func MarshalRolePolicyBindingStatusList(list []*RolePolicyBindingStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRolePolicyBindingStatusList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRolePolicyBindingStatusList writes a list of value of the 'role_policy_binding_status' type to +// the given stream. +func WriteRolePolicyBindingStatusList(list []*RolePolicyBindingStatus, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRolePolicyBindingStatus(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRolePolicyBindingStatusList reads a list of values of the 'role_policy_binding_status' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRolePolicyBindingStatusList(source interface{}) (items []*RolePolicyBindingStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRolePolicyBindingStatusList(iterator) + err = iterator.Error + return +} + +// ReadRolePolicyBindingStatusList reads list of values of the ”role_policy_binding_status' type from +// the given iterator. +func ReadRolePolicyBindingStatusList(iterator *jsoniter.Iterator) []*RolePolicyBindingStatus { + list := []*RolePolicyBindingStatus{} + for iterator.ReadArray() { + item := ReadRolePolicyBindingStatus(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/role_policy_binding_status_type.go b/clientapi/clustersmgmt/v1/role_policy_binding_status_type.go new file mode 100644 index 00000000..de35e7cc --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_binding_status_type.go @@ -0,0 +1,179 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RolePolicyBindingStatus represents the values of the 'role_policy_binding_status' type. +type RolePolicyBindingStatus struct { + bitmap_ uint32 + description string + value string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RolePolicyBindingStatus) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RolePolicyBindingStatus) Description() string { + if o != nil && o.bitmap_&1 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +func (o *RolePolicyBindingStatus) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.description + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RolePolicyBindingStatus) Value() string { + if o != nil && o.bitmap_&2 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +func (o *RolePolicyBindingStatus) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.value + } + return +} + +// RolePolicyBindingStatusListKind is the name of the type used to represent list of objects of +// type 'role_policy_binding_status'. +const RolePolicyBindingStatusListKind = "RolePolicyBindingStatusList" + +// RolePolicyBindingStatusListLinkKind is the name of the type used to represent links to list +// of objects of type 'role_policy_binding_status'. +const RolePolicyBindingStatusListLinkKind = "RolePolicyBindingStatusListLink" + +// RolePolicyBindingStatusNilKind is the name of the type used to nil lists of objects of +// type 'role_policy_binding_status'. +const RolePolicyBindingStatusListNilKind = "RolePolicyBindingStatusListNil" + +// RolePolicyBindingStatusList is a list of values of the 'role_policy_binding_status' type. +type RolePolicyBindingStatusList struct { + href string + link bool + items []*RolePolicyBindingStatus +} + +// Len returns the length of the list. +func (l *RolePolicyBindingStatusList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RolePolicyBindingStatusList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RolePolicyBindingStatusList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RolePolicyBindingStatusList) SetItems(items []*RolePolicyBindingStatus) { + l.items = items +} + +// Items returns the items of the list. +func (l *RolePolicyBindingStatusList) Items() []*RolePolicyBindingStatus { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RolePolicyBindingStatusList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RolePolicyBindingStatusList) Get(i int) *RolePolicyBindingStatus { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RolePolicyBindingStatusList) Slice() []*RolePolicyBindingStatus { + var slice []*RolePolicyBindingStatus + if l == nil { + slice = make([]*RolePolicyBindingStatus, 0) + } else { + slice = make([]*RolePolicyBindingStatus, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RolePolicyBindingStatusList) Each(f func(item *RolePolicyBindingStatus) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RolePolicyBindingStatusList) Range(f func(index int, item *RolePolicyBindingStatus) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/role_policy_binding_status_type_json.go b/clientapi/clustersmgmt/v1/role_policy_binding_status_type_json.go new file mode 100644 index 00000000..bdcacd67 --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_binding_status_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRolePolicyBindingStatus writes a value of the 'role_policy_binding_status' type to the given writer. +func MarshalRolePolicyBindingStatus(object *RolePolicyBindingStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRolePolicyBindingStatus(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRolePolicyBindingStatus writes a value of the 'role_policy_binding_status' type to the given stream. +func WriteRolePolicyBindingStatus(object *RolePolicyBindingStatus, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalRolePolicyBindingStatus reads a value of the 'role_policy_binding_status' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRolePolicyBindingStatus(source interface{}) (object *RolePolicyBindingStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRolePolicyBindingStatus(iterator) + err = iterator.Error + return +} + +// ReadRolePolicyBindingStatus reads a value of the 'role_policy_binding_status' type from the given iterator. +func ReadRolePolicyBindingStatus(iterator *jsoniter.Iterator) *RolePolicyBindingStatus { + object := &RolePolicyBindingStatus{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 1 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/role_policy_binding_type.go b/clientapi/clustersmgmt/v1/role_policy_binding_type.go new file mode 100644 index 00000000..bf85ee4d --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_binding_type.go @@ -0,0 +1,283 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// RolePolicyBinding represents the values of the 'role_policy_binding' type. +type RolePolicyBinding struct { + bitmap_ uint32 + arn string + creationTimestamp time.Time + lastUpdateTimestamp time.Time + name string + policies []*RolePolicy + status *RolePolicyBindingStatus + type_ string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RolePolicyBinding) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Arn returns the value of the 'arn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RolePolicyBinding) Arn() string { + if o != nil && o.bitmap_&1 != 0 { + return o.arn + } + return "" +} + +// GetArn returns the value of the 'arn' attribute and +// a flag indicating if the attribute has a value. +func (o *RolePolicyBinding) GetArn() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.arn + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RolePolicyBinding) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&2 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +func (o *RolePolicyBinding) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// LastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RolePolicyBinding) LastUpdateTimestamp() time.Time { + if o != nil && o.bitmap_&4 != 0 { + return o.lastUpdateTimestamp + } + return time.Time{} +} + +// GetLastUpdateTimestamp returns the value of the 'last_update_timestamp' attribute and +// a flag indicating if the attribute has a value. +func (o *RolePolicyBinding) GetLastUpdateTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.lastUpdateTimestamp + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RolePolicyBinding) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *RolePolicyBinding) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// Policies returns the value of the 'policies' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RolePolicyBinding) Policies() []*RolePolicy { + if o != nil && o.bitmap_&16 != 0 { + return o.policies + } + return nil +} + +// GetPolicies returns the value of the 'policies' attribute and +// a flag indicating if the attribute has a value. +func (o *RolePolicyBinding) GetPolicies() (value []*RolePolicy, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.policies + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RolePolicyBinding) Status() *RolePolicyBindingStatus { + if o != nil && o.bitmap_&32 != 0 { + return o.status + } + return nil +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +func (o *RolePolicyBinding) GetStatus() (value *RolePolicyBindingStatus, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.status + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RolePolicyBinding) Type() string { + if o != nil && o.bitmap_&64 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +func (o *RolePolicyBinding) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.type_ + } + return +} + +// RolePolicyBindingListKind is the name of the type used to represent list of objects of +// type 'role_policy_binding'. +const RolePolicyBindingListKind = "RolePolicyBindingList" + +// RolePolicyBindingListLinkKind is the name of the type used to represent links to list +// of objects of type 'role_policy_binding'. +const RolePolicyBindingListLinkKind = "RolePolicyBindingListLink" + +// RolePolicyBindingNilKind is the name of the type used to nil lists of objects of +// type 'role_policy_binding'. +const RolePolicyBindingListNilKind = "RolePolicyBindingListNil" + +// RolePolicyBindingList is a list of values of the 'role_policy_binding' type. +type RolePolicyBindingList struct { + href string + link bool + items []*RolePolicyBinding +} + +// Len returns the length of the list. +func (l *RolePolicyBindingList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RolePolicyBindingList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RolePolicyBindingList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RolePolicyBindingList) SetItems(items []*RolePolicyBinding) { + l.items = items +} + +// Items returns the items of the list. +func (l *RolePolicyBindingList) Items() []*RolePolicyBinding { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RolePolicyBindingList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RolePolicyBindingList) Get(i int) *RolePolicyBinding { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RolePolicyBindingList) Slice() []*RolePolicyBinding { + var slice []*RolePolicyBinding + if l == nil { + slice = make([]*RolePolicyBinding, 0) + } else { + slice = make([]*RolePolicyBinding, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RolePolicyBindingList) Each(f func(item *RolePolicyBinding) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RolePolicyBindingList) Range(f func(index int, item *RolePolicyBinding) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/role_policy_binding_type_json.go b/clientapi/clustersmgmt/v1/role_policy_binding_type_json.go new file mode 100644 index 00000000..8346aad2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_binding_type_json.go @@ -0,0 +1,173 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRolePolicyBinding writes a value of the 'role_policy_binding' type to the given writer. +func MarshalRolePolicyBinding(object *RolePolicyBinding, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRolePolicyBinding(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRolePolicyBinding writes a value of the 'role_policy_binding' type to the given stream. +func WriteRolePolicyBinding(object *RolePolicyBinding, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("arn") + stream.WriteString(object.arn) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_update_timestamp") + stream.WriteString((object.lastUpdateTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&16 != 0 && object.policies != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("policies") + WriteRolePolicyList(object.policies, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.status != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + WriteRolePolicyBindingStatus(object.status, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalRolePolicyBinding reads a value of the 'role_policy_binding' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRolePolicyBinding(source interface{}) (object *RolePolicyBinding, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRolePolicyBinding(iterator) + err = iterator.Error + return +} + +// ReadRolePolicyBinding reads a value of the 'role_policy_binding' type from the given iterator. +func ReadRolePolicyBinding(iterator *jsoniter.Iterator) *RolePolicyBinding { + object := &RolePolicyBinding{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "arn": + value := iterator.ReadString() + object.arn = value + object.bitmap_ |= 1 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 2 + case "last_update_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastUpdateTimestamp = value + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + case "policies": + value := ReadRolePolicyList(iterator) + object.policies = value + object.bitmap_ |= 16 + case "status": + value := ReadRolePolicyBindingStatus(iterator) + object.status = value + object.bitmap_ |= 32 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/role_policy_builder.go b/clientapi/clustersmgmt/v1/role_policy_builder.go new file mode 100644 index 00000000..ec41b596 --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_builder.go @@ -0,0 +1,81 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RolePolicyBuilder contains the data and logic needed to build 'role_policy' objects. +type RolePolicyBuilder struct { + bitmap_ uint32 + arn string + name string + type_ string +} + +// NewRolePolicy creates a new builder of 'role_policy' objects. +func NewRolePolicy() *RolePolicyBuilder { + return &RolePolicyBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RolePolicyBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Arn sets the value of the 'arn' attribute to the given value. +func (b *RolePolicyBuilder) Arn(value string) *RolePolicyBuilder { + b.arn = value + b.bitmap_ |= 1 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *RolePolicyBuilder) Name(value string) *RolePolicyBuilder { + b.name = value + b.bitmap_ |= 2 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *RolePolicyBuilder) Type(value string) *RolePolicyBuilder { + b.type_ = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RolePolicyBuilder) Copy(object *RolePolicy) *RolePolicyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.arn = object.arn + b.name = object.name + b.type_ = object.type_ + return b +} + +// Build creates a 'role_policy' object using the configuration stored in the builder. +func (b *RolePolicyBuilder) Build() (object *RolePolicy, err error) { + object = new(RolePolicy) + object.bitmap_ = b.bitmap_ + object.arn = b.arn + object.name = b.name + object.type_ = b.type_ + return +} diff --git a/clientapi/clustersmgmt/v1/role_policy_list_builder.go b/clientapi/clustersmgmt/v1/role_policy_list_builder.go new file mode 100644 index 00000000..474d1729 --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RolePolicyListBuilder contains the data and logic needed to build +// 'role_policy' objects. +type RolePolicyListBuilder struct { + items []*RolePolicyBuilder +} + +// NewRolePolicyList creates a new builder of 'role_policy' objects. +func NewRolePolicyList() *RolePolicyListBuilder { + return new(RolePolicyListBuilder) +} + +// Items sets the items of the list. +func (b *RolePolicyListBuilder) Items(values ...*RolePolicyBuilder) *RolePolicyListBuilder { + b.items = make([]*RolePolicyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RolePolicyListBuilder) 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 *RolePolicyListBuilder) Copy(list *RolePolicyList) *RolePolicyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RolePolicyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRolePolicy().Copy(v) + } + } + return b +} + +// Build creates a list of 'role_policy' objects using the +// configuration stored in the builder. +func (b *RolePolicyListBuilder) Build() (list *RolePolicyList, err error) { + items := make([]*RolePolicy, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RolePolicyList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/role_policy_list_type_json.go b/clientapi/clustersmgmt/v1/role_policy_list_type_json.go new file mode 100644 index 00000000..2cda3637 --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRolePolicyList writes a list of values of the 'role_policy' type to +// the given writer. +func MarshalRolePolicyList(list []*RolePolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRolePolicyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRolePolicyList writes a list of value of the 'role_policy' type to +// the given stream. +func WriteRolePolicyList(list []*RolePolicy, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRolePolicy(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRolePolicyList reads a list of values of the 'role_policy' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRolePolicyList(source interface{}) (items []*RolePolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRolePolicyList(iterator) + err = iterator.Error + return +} + +// ReadRolePolicyList reads list of values of the ”role_policy' type from +// the given iterator. +func ReadRolePolicyList(iterator *jsoniter.Iterator) []*RolePolicy { + list := []*RolePolicy{} + for iterator.ReadArray() { + item := ReadRolePolicy(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/role_policy_type.go b/clientapi/clustersmgmt/v1/role_policy_type.go new file mode 100644 index 00000000..de23cf7e --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_type.go @@ -0,0 +1,199 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RolePolicy represents the values of the 'role_policy' type. +type RolePolicy struct { + bitmap_ uint32 + arn string + name string + type_ string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RolePolicy) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Arn returns the value of the 'arn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RolePolicy) Arn() string { + if o != nil && o.bitmap_&1 != 0 { + return o.arn + } + return "" +} + +// GetArn returns the value of the 'arn' attribute and +// a flag indicating if the attribute has a value. +func (o *RolePolicy) GetArn() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.arn + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RolePolicy) Name() string { + if o != nil && o.bitmap_&2 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *RolePolicy) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.name + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *RolePolicy) Type() string { + if o != nil && o.bitmap_&4 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +func (o *RolePolicy) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.type_ + } + return +} + +// RolePolicyListKind is the name of the type used to represent list of objects of +// type 'role_policy'. +const RolePolicyListKind = "RolePolicyList" + +// RolePolicyListLinkKind is the name of the type used to represent links to list +// of objects of type 'role_policy'. +const RolePolicyListLinkKind = "RolePolicyListLink" + +// RolePolicyNilKind is the name of the type used to nil lists of objects of +// type 'role_policy'. +const RolePolicyListNilKind = "RolePolicyListNil" + +// RolePolicyList is a list of values of the 'role_policy' type. +type RolePolicyList struct { + href string + link bool + items []*RolePolicy +} + +// Len returns the length of the list. +func (l *RolePolicyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RolePolicyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RolePolicyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RolePolicyList) SetItems(items []*RolePolicy) { + l.items = items +} + +// Items returns the items of the list. +func (l *RolePolicyList) Items() []*RolePolicy { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RolePolicyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RolePolicyList) Get(i int) *RolePolicy { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RolePolicyList) Slice() []*RolePolicy { + var slice []*RolePolicy + if l == nil { + slice = make([]*RolePolicy, 0) + } else { + slice = make([]*RolePolicy, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RolePolicyList) Each(f func(item *RolePolicy) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RolePolicyList) Range(f func(index int, item *RolePolicy) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/role_policy_type_json.go b/clientapi/clustersmgmt/v1/role_policy_type_json.go new file mode 100644 index 00000000..49bbf8df --- /dev/null +++ b/clientapi/clustersmgmt/v1/role_policy_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRolePolicy writes a value of the 'role_policy' type to the given writer. +func MarshalRolePolicy(object *RolePolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRolePolicy(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRolePolicy writes a value of the 'role_policy' type to the given stream. +func WriteRolePolicy(object *RolePolicy, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("arn") + stream.WriteString(object.arn) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalRolePolicy reads a value of the 'role_policy' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRolePolicy(source interface{}) (object *RolePolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRolePolicy(iterator) + err = iterator.Error + return +} + +// ReadRolePolicy reads a value of the 'role_policy' type from the given iterator. +func ReadRolePolicy(iterator *jsoniter.Iterator) *RolePolicy { + object := &RolePolicy{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "arn": + value := iterator.ReadString() + object.arn = value + object.bitmap_ |= 1 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 2 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/root_volume_builder.go b/clientapi/clustersmgmt/v1/root_volume_builder.go new file mode 100644 index 00000000..0347cfbc --- /dev/null +++ b/clientapi/clustersmgmt/v1/root_volume_builder.go @@ -0,0 +1,103 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RootVolumeBuilder contains the data and logic needed to build 'root_volume' objects. +// +// Root volume capabilities. +type RootVolumeBuilder struct { + bitmap_ uint32 + aws *AWSVolumeBuilder + gcp *GCPVolumeBuilder +} + +// NewRootVolume creates a new builder of 'root_volume' objects. +func NewRootVolume() *RootVolumeBuilder { + return &RootVolumeBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *RootVolumeBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AWS sets the value of the 'AWS' attribute to the given value. +// +// Holds settings for an AWS storage volume. +func (b *RootVolumeBuilder) AWS(value *AWSVolumeBuilder) *RootVolumeBuilder { + b.aws = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// GCP sets the value of the 'GCP' attribute to the given value. +// +// Holds settings for an GCP storage volume. +func (b *RootVolumeBuilder) GCP(value *GCPVolumeBuilder) *RootVolumeBuilder { + b.gcp = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *RootVolumeBuilder) Copy(object *RootVolume) *RootVolumeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.aws != nil { + b.aws = NewAWSVolume().Copy(object.aws) + } else { + b.aws = nil + } + if object.gcp != nil { + b.gcp = NewGCPVolume().Copy(object.gcp) + } else { + b.gcp = nil + } + return b +} + +// Build creates a 'root_volume' object using the configuration stored in the builder. +func (b *RootVolumeBuilder) Build() (object *RootVolume, err error) { + object = new(RootVolume) + object.bitmap_ = b.bitmap_ + if b.aws != nil { + object.aws, err = b.aws.Build() + if err != nil { + return + } + } + if b.gcp != nil { + object.gcp, err = b.gcp.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/root_volume_list_builder.go b/clientapi/clustersmgmt/v1/root_volume_list_builder.go new file mode 100644 index 00000000..3e2e9222 --- /dev/null +++ b/clientapi/clustersmgmt/v1/root_volume_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RootVolumeListBuilder contains the data and logic needed to build +// 'root_volume' objects. +type RootVolumeListBuilder struct { + items []*RootVolumeBuilder +} + +// NewRootVolumeList creates a new builder of 'root_volume' objects. +func NewRootVolumeList() *RootVolumeListBuilder { + return new(RootVolumeListBuilder) +} + +// Items sets the items of the list. +func (b *RootVolumeListBuilder) Items(values ...*RootVolumeBuilder) *RootVolumeListBuilder { + b.items = make([]*RootVolumeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *RootVolumeListBuilder) 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 *RootVolumeListBuilder) Copy(list *RootVolumeList) *RootVolumeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*RootVolumeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewRootVolume().Copy(v) + } + } + return b +} + +// Build creates a list of 'root_volume' objects using the +// configuration stored in the builder. +func (b *RootVolumeListBuilder) Build() (list *RootVolumeList, err error) { + items := make([]*RootVolume, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(RootVolumeList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/root_volume_list_type_json.go b/clientapi/clustersmgmt/v1/root_volume_list_type_json.go new file mode 100644 index 00000000..d9f26e02 --- /dev/null +++ b/clientapi/clustersmgmt/v1/root_volume_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRootVolumeList writes a list of values of the 'root_volume' type to +// the given writer. +func MarshalRootVolumeList(list []*RootVolume, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRootVolumeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRootVolumeList writes a list of value of the 'root_volume' type to +// the given stream. +func WriteRootVolumeList(list []*RootVolume, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteRootVolume(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalRootVolumeList reads a list of values of the 'root_volume' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalRootVolumeList(source interface{}) (items []*RootVolume, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadRootVolumeList(iterator) + err = iterator.Error + return +} + +// ReadRootVolumeList reads list of values of the ”root_volume' type from +// the given iterator. +func ReadRootVolumeList(iterator *jsoniter.Iterator) []*RootVolume { + list := []*RootVolume{} + for iterator.ReadArray() { + item := ReadRootVolume(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/root_volume_type.go b/clientapi/clustersmgmt/v1/root_volume_type.go new file mode 100644 index 00000000..bf276344 --- /dev/null +++ b/clientapi/clustersmgmt/v1/root_volume_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// RootVolume represents the values of the 'root_volume' type. +// +// Root volume capabilities. +type RootVolume struct { + bitmap_ uint32 + aws *AWSVolume + gcp *GCPVolume +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *RootVolume) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AWS returns the value of the 'AWS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS volume specification +func (o *RootVolume) AWS() *AWSVolume { + if o != nil && o.bitmap_&1 != 0 { + return o.aws + } + return nil +} + +// GetAWS returns the value of the 'AWS' attribute and +// a flag indicating if the attribute has a value. +// +// AWS volume specification +func (o *RootVolume) GetAWS() (value *AWSVolume, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.aws + } + return +} + +// GCP returns the value of the 'GCP' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCP Volume specification +func (o *RootVolume) GCP() *GCPVolume { + if o != nil && o.bitmap_&2 != 0 { + return o.gcp + } + return nil +} + +// GetGCP returns the value of the 'GCP' attribute and +// a flag indicating if the attribute has a value. +// +// GCP Volume specification +func (o *RootVolume) GetGCP() (value *GCPVolume, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.gcp + } + return +} + +// RootVolumeListKind is the name of the type used to represent list of objects of +// type 'root_volume'. +const RootVolumeListKind = "RootVolumeList" + +// RootVolumeListLinkKind is the name of the type used to represent links to list +// of objects of type 'root_volume'. +const RootVolumeListLinkKind = "RootVolumeListLink" + +// RootVolumeNilKind is the name of the type used to nil lists of objects of +// type 'root_volume'. +const RootVolumeListNilKind = "RootVolumeListNil" + +// RootVolumeList is a list of values of the 'root_volume' type. +type RootVolumeList struct { + href string + link bool + items []*RootVolume +} + +// Len returns the length of the list. +func (l *RootVolumeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *RootVolumeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *RootVolumeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *RootVolumeList) SetItems(items []*RootVolume) { + l.items = items +} + +// Items returns the items of the list. +func (l *RootVolumeList) Items() []*RootVolume { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *RootVolumeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *RootVolumeList) Get(i int) *RootVolume { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *RootVolumeList) Slice() []*RootVolume { + var slice []*RootVolume + if l == nil { + slice = make([]*RootVolume, 0) + } else { + slice = make([]*RootVolume, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *RootVolumeList) Each(f func(item *RootVolume) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *RootVolumeList) Range(f func(index int, item *RootVolume) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/root_volume_type_json.go b/clientapi/clustersmgmt/v1/root_volume_type_json.go new file mode 100644 index 00000000..c2b1d076 --- /dev/null +++ b/clientapi/clustersmgmt/v1/root_volume_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalRootVolume writes a value of the 'root_volume' type to the given writer. +func MarshalRootVolume(object *RootVolume, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteRootVolume(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteRootVolume writes a value of the 'root_volume' type to the given stream. +func WriteRootVolume(object *RootVolume, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.aws != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws") + WriteAWSVolume(object.aws, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.gcp != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp") + WriteGCPVolume(object.gcp, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalRootVolume reads a value of the 'root_volume' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalRootVolume(source interface{}) (object *RootVolume, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadRootVolume(iterator) + err = iterator.Error + return +} + +// ReadRootVolume reads a value of the 'root_volume' type from the given iterator. +func ReadRootVolume(iterator *jsoniter.Iterator) *RootVolume { + object := &RootVolume{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "aws": + value := ReadAWSVolume(iterator) + object.aws = value + object.bitmap_ |= 1 + case "gcp": + value := ReadGCPVolume(iterator) + object.gcp = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/schedule_type_list_type_json.go b/clientapi/clustersmgmt/v1/schedule_type_list_type_json.go new file mode 100644 index 00000000..9b950720 --- /dev/null +++ b/clientapi/clustersmgmt/v1/schedule_type_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalScheduleTypeList writes a list of values of the 'schedule_type' type to +// the given writer. +func MarshalScheduleTypeList(list []ScheduleType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteScheduleTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteScheduleTypeList writes a list of value of the 'schedule_type' type to +// the given stream. +func WriteScheduleTypeList(list []ScheduleType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalScheduleTypeList reads a list of values of the 'schedule_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalScheduleTypeList(source interface{}) (items []ScheduleType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadScheduleTypeList(iterator) + err = iterator.Error + return +} + +// ReadScheduleTypeList reads list of values of the ”schedule_type' type from +// the given iterator. +func ReadScheduleTypeList(iterator *jsoniter.Iterator) []ScheduleType { + list := []ScheduleType{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ScheduleType(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/schedule_type_type.go b/clientapi/clustersmgmt/v1/schedule_type_type.go new file mode 100644 index 00000000..71b7ac53 --- /dev/null +++ b/clientapi/clustersmgmt/v1/schedule_type_type.go @@ -0,0 +1,33 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ScheduleType represents the values of the 'schedule_type' enumerated type. +type ScheduleType string + +const ( + // Automatic schedule type for automatically upgrade to the latest available version, at the next scheduled time, + // as defined by the 'scheduled' cron expression. Note that by default, automatic upgrade will pick only + // the latest Z stream. To enable minor version upgrades automatically, you will need to set the + // 'enable_minor_version_upgrades' to be 'true'. Major version upgrades are not supported. + ScheduleTypeAutomatic ScheduleType = "automatic" + // Manual schedule type is for upgrades scheduled manually by a user, to a specific version, at a specific time. + ScheduleTypeManual ScheduleType = "manual" +) diff --git a/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_builder.go b/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_builder.go new file mode 100644 index 00000000..2b4268a0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_builder.go @@ -0,0 +1,83 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SdnToOvnClusterMigrationBuilder contains the data and logic needed to build 'sdn_to_ovn_cluster_migration' objects. +// +// Details for `SdnToOvn` cluster migrations. +type SdnToOvnClusterMigrationBuilder struct { + bitmap_ uint32 + joinIpv4 string + masqueradeIpv4 string + transitIpv4 string +} + +// NewSdnToOvnClusterMigration creates a new builder of 'sdn_to_ovn_cluster_migration' objects. +func NewSdnToOvnClusterMigration() *SdnToOvnClusterMigrationBuilder { + return &SdnToOvnClusterMigrationBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SdnToOvnClusterMigrationBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// JoinIpv4 sets the value of the 'join_ipv_4' attribute to the given value. +func (b *SdnToOvnClusterMigrationBuilder) JoinIpv4(value string) *SdnToOvnClusterMigrationBuilder { + b.joinIpv4 = value + b.bitmap_ |= 1 + return b +} + +// MasqueradeIpv4 sets the value of the 'masquerade_ipv_4' attribute to the given value. +func (b *SdnToOvnClusterMigrationBuilder) MasqueradeIpv4(value string) *SdnToOvnClusterMigrationBuilder { + b.masqueradeIpv4 = value + b.bitmap_ |= 2 + return b +} + +// TransitIpv4 sets the value of the 'transit_ipv_4' attribute to the given value. +func (b *SdnToOvnClusterMigrationBuilder) TransitIpv4(value string) *SdnToOvnClusterMigrationBuilder { + b.transitIpv4 = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SdnToOvnClusterMigrationBuilder) Copy(object *SdnToOvnClusterMigration) *SdnToOvnClusterMigrationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.joinIpv4 = object.joinIpv4 + b.masqueradeIpv4 = object.masqueradeIpv4 + b.transitIpv4 = object.transitIpv4 + return b +} + +// Build creates a 'sdn_to_ovn_cluster_migration' object using the configuration stored in the builder. +func (b *SdnToOvnClusterMigrationBuilder) Build() (object *SdnToOvnClusterMigration, err error) { + object = new(SdnToOvnClusterMigration) + object.bitmap_ = b.bitmap_ + object.joinIpv4 = b.joinIpv4 + object.masqueradeIpv4 = b.masqueradeIpv4 + object.transitIpv4 = b.transitIpv4 + return +} diff --git a/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_list_builder.go b/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_list_builder.go new file mode 100644 index 00000000..086777a4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SdnToOvnClusterMigrationListBuilder contains the data and logic needed to build +// 'sdn_to_ovn_cluster_migration' objects. +type SdnToOvnClusterMigrationListBuilder struct { + items []*SdnToOvnClusterMigrationBuilder +} + +// NewSdnToOvnClusterMigrationList creates a new builder of 'sdn_to_ovn_cluster_migration' objects. +func NewSdnToOvnClusterMigrationList() *SdnToOvnClusterMigrationListBuilder { + return new(SdnToOvnClusterMigrationListBuilder) +} + +// Items sets the items of the list. +func (b *SdnToOvnClusterMigrationListBuilder) Items(values ...*SdnToOvnClusterMigrationBuilder) *SdnToOvnClusterMigrationListBuilder { + b.items = make([]*SdnToOvnClusterMigrationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SdnToOvnClusterMigrationListBuilder) 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 *SdnToOvnClusterMigrationListBuilder) Copy(list *SdnToOvnClusterMigrationList) *SdnToOvnClusterMigrationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SdnToOvnClusterMigrationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSdnToOvnClusterMigration().Copy(v) + } + } + return b +} + +// Build creates a list of 'sdn_to_ovn_cluster_migration' objects using the +// configuration stored in the builder. +func (b *SdnToOvnClusterMigrationListBuilder) Build() (list *SdnToOvnClusterMigrationList, err error) { + items := make([]*SdnToOvnClusterMigration, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SdnToOvnClusterMigrationList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_list_type_json.go b/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_list_type_json.go new file mode 100644 index 00000000..5e9efe0d --- /dev/null +++ b/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSdnToOvnClusterMigrationList writes a list of values of the 'sdn_to_ovn_cluster_migration' type to +// the given writer. +func MarshalSdnToOvnClusterMigrationList(list []*SdnToOvnClusterMigration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSdnToOvnClusterMigrationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSdnToOvnClusterMigrationList writes a list of value of the 'sdn_to_ovn_cluster_migration' type to +// the given stream. +func WriteSdnToOvnClusterMigrationList(list []*SdnToOvnClusterMigration, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSdnToOvnClusterMigration(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSdnToOvnClusterMigrationList reads a list of values of the 'sdn_to_ovn_cluster_migration' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSdnToOvnClusterMigrationList(source interface{}) (items []*SdnToOvnClusterMigration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSdnToOvnClusterMigrationList(iterator) + err = iterator.Error + return +} + +// ReadSdnToOvnClusterMigrationList reads list of values of the ”sdn_to_ovn_cluster_migration' type from +// the given iterator. +func ReadSdnToOvnClusterMigrationList(iterator *jsoniter.Iterator) []*SdnToOvnClusterMigration { + list := []*SdnToOvnClusterMigration{} + for iterator.ReadArray() { + item := ReadSdnToOvnClusterMigration(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_type.go b/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_type.go new file mode 100644 index 00000000..dc87dda7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_type.go @@ -0,0 +1,219 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SdnToOvnClusterMigration represents the values of the 'sdn_to_ovn_cluster_migration' type. +// +// Details for `SdnToOvn` cluster migrations. +type SdnToOvnClusterMigration struct { + bitmap_ uint32 + joinIpv4 string + masqueradeIpv4 string + transitIpv4 string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SdnToOvnClusterMigration) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// JoinIpv4 returns the value of the 'join_ipv_4' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The IP address range to use for the internalJoinSubnet parameter of OVN-Kubernetes +// upon migration. +func (o *SdnToOvnClusterMigration) JoinIpv4() string { + if o != nil && o.bitmap_&1 != 0 { + return o.joinIpv4 + } + return "" +} + +// GetJoinIpv4 returns the value of the 'join_ipv_4' attribute and +// a flag indicating if the attribute has a value. +// +// The IP address range to use for the internalJoinSubnet parameter of OVN-Kubernetes +// upon migration. +func (o *SdnToOvnClusterMigration) GetJoinIpv4() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.joinIpv4 + } + return +} + +// MasqueradeIpv4 returns the value of the 'masquerade_ipv_4' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The IP address range to us for the internalMasqueradeSubnet parameter of OVN-Kubernetes +// upon migration. +func (o *SdnToOvnClusterMigration) MasqueradeIpv4() string { + if o != nil && o.bitmap_&2 != 0 { + return o.masqueradeIpv4 + } + return "" +} + +// GetMasqueradeIpv4 returns the value of the 'masquerade_ipv_4' attribute and +// a flag indicating if the attribute has a value. +// +// The IP address range to us for the internalMasqueradeSubnet parameter of OVN-Kubernetes +// upon migration. +func (o *SdnToOvnClusterMigration) GetMasqueradeIpv4() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.masqueradeIpv4 + } + return +} + +// TransitIpv4 returns the value of the 'transit_ipv_4' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The IP address range to use for the internalTransSwitchSubnet parameter of OVN-Kubernetes +// upon migration. +func (o *SdnToOvnClusterMigration) TransitIpv4() string { + if o != nil && o.bitmap_&4 != 0 { + return o.transitIpv4 + } + return "" +} + +// GetTransitIpv4 returns the value of the 'transit_ipv_4' attribute and +// a flag indicating if the attribute has a value. +// +// The IP address range to use for the internalTransSwitchSubnet parameter of OVN-Kubernetes +// upon migration. +func (o *SdnToOvnClusterMigration) GetTransitIpv4() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.transitIpv4 + } + return +} + +// SdnToOvnClusterMigrationListKind is the name of the type used to represent list of objects of +// type 'sdn_to_ovn_cluster_migration'. +const SdnToOvnClusterMigrationListKind = "SdnToOvnClusterMigrationList" + +// SdnToOvnClusterMigrationListLinkKind is the name of the type used to represent links to list +// of objects of type 'sdn_to_ovn_cluster_migration'. +const SdnToOvnClusterMigrationListLinkKind = "SdnToOvnClusterMigrationListLink" + +// SdnToOvnClusterMigrationNilKind is the name of the type used to nil lists of objects of +// type 'sdn_to_ovn_cluster_migration'. +const SdnToOvnClusterMigrationListNilKind = "SdnToOvnClusterMigrationListNil" + +// SdnToOvnClusterMigrationList is a list of values of the 'sdn_to_ovn_cluster_migration' type. +type SdnToOvnClusterMigrationList struct { + href string + link bool + items []*SdnToOvnClusterMigration +} + +// Len returns the length of the list. +func (l *SdnToOvnClusterMigrationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SdnToOvnClusterMigrationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SdnToOvnClusterMigrationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SdnToOvnClusterMigrationList) SetItems(items []*SdnToOvnClusterMigration) { + l.items = items +} + +// Items returns the items of the list. +func (l *SdnToOvnClusterMigrationList) Items() []*SdnToOvnClusterMigration { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SdnToOvnClusterMigrationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SdnToOvnClusterMigrationList) Get(i int) *SdnToOvnClusterMigration { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SdnToOvnClusterMigrationList) Slice() []*SdnToOvnClusterMigration { + var slice []*SdnToOvnClusterMigration + if l == nil { + slice = make([]*SdnToOvnClusterMigration, 0) + } else { + slice = make([]*SdnToOvnClusterMigration, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SdnToOvnClusterMigrationList) Each(f func(item *SdnToOvnClusterMigration) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SdnToOvnClusterMigrationList) Range(f func(index int, item *SdnToOvnClusterMigration) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_type_json.go b/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_type_json.go new file mode 100644 index 00000000..afa3f88e --- /dev/null +++ b/clientapi/clustersmgmt/v1/sdn_to_ovn_cluster_migration_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSdnToOvnClusterMigration writes a value of the 'sdn_to_ovn_cluster_migration' type to the given writer. +func MarshalSdnToOvnClusterMigration(object *SdnToOvnClusterMigration, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSdnToOvnClusterMigration(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSdnToOvnClusterMigration writes a value of the 'sdn_to_ovn_cluster_migration' type to the given stream. +func WriteSdnToOvnClusterMigration(object *SdnToOvnClusterMigration, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("join_ipv4") + stream.WriteString(object.joinIpv4) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("masquerade_ipv4") + stream.WriteString(object.masqueradeIpv4) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("transit_ipv4") + stream.WriteString(object.transitIpv4) + } + stream.WriteObjectEnd() +} + +// UnmarshalSdnToOvnClusterMigration reads a value of the 'sdn_to_ovn_cluster_migration' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSdnToOvnClusterMigration(source interface{}) (object *SdnToOvnClusterMigration, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSdnToOvnClusterMigration(iterator) + err = iterator.Error + return +} + +// ReadSdnToOvnClusterMigration reads a value of the 'sdn_to_ovn_cluster_migration' type from the given iterator. +func ReadSdnToOvnClusterMigration(iterator *jsoniter.Iterator) *SdnToOvnClusterMigration { + object := &SdnToOvnClusterMigration{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "join_ipv4": + value := iterator.ReadString() + object.joinIpv4 = value + object.bitmap_ |= 1 + case "masquerade_ipv4": + value := iterator.ReadString() + object.masqueradeIpv4 = value + object.bitmap_ |= 2 + case "transit_ipv4": + value := iterator.ReadString() + object.transitIpv4 = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/security_group_builder.go b/clientapi/clustersmgmt/v1/security_group_builder.go new file mode 100644 index 00000000..bd01c0dd --- /dev/null +++ b/clientapi/clustersmgmt/v1/security_group_builder.go @@ -0,0 +1,83 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SecurityGroupBuilder contains the data and logic needed to build 'security_group' objects. +// +// AWS security group object +type SecurityGroupBuilder struct { + bitmap_ uint32 + id string + name string + redHatManaged bool +} + +// NewSecurityGroup creates a new builder of 'security_group' objects. +func NewSecurityGroup() *SecurityGroupBuilder { + return &SecurityGroupBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SecurityGroupBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *SecurityGroupBuilder) ID(value string) *SecurityGroupBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *SecurityGroupBuilder) Name(value string) *SecurityGroupBuilder { + b.name = value + b.bitmap_ |= 2 + return b +} + +// RedHatManaged sets the value of the 'red_hat_managed' attribute to the given value. +func (b *SecurityGroupBuilder) RedHatManaged(value bool) *SecurityGroupBuilder { + b.redHatManaged = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SecurityGroupBuilder) Copy(object *SecurityGroup) *SecurityGroupBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.name = object.name + b.redHatManaged = object.redHatManaged + return b +} + +// Build creates a 'security_group' object using the configuration stored in the builder. +func (b *SecurityGroupBuilder) Build() (object *SecurityGroup, err error) { + object = new(SecurityGroup) + object.bitmap_ = b.bitmap_ + object.id = b.id + object.name = b.name + object.redHatManaged = b.redHatManaged + return +} diff --git a/clientapi/clustersmgmt/v1/security_group_list_builder.go b/clientapi/clustersmgmt/v1/security_group_list_builder.go new file mode 100644 index 00000000..ebb73f27 --- /dev/null +++ b/clientapi/clustersmgmt/v1/security_group_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SecurityGroupListBuilder contains the data and logic needed to build +// 'security_group' objects. +type SecurityGroupListBuilder struct { + items []*SecurityGroupBuilder +} + +// NewSecurityGroupList creates a new builder of 'security_group' objects. +func NewSecurityGroupList() *SecurityGroupListBuilder { + return new(SecurityGroupListBuilder) +} + +// Items sets the items of the list. +func (b *SecurityGroupListBuilder) Items(values ...*SecurityGroupBuilder) *SecurityGroupListBuilder { + b.items = make([]*SecurityGroupBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SecurityGroupListBuilder) 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 *SecurityGroupListBuilder) Copy(list *SecurityGroupList) *SecurityGroupListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SecurityGroupBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSecurityGroup().Copy(v) + } + } + return b +} + +// Build creates a list of 'security_group' objects using the +// configuration stored in the builder. +func (b *SecurityGroupListBuilder) Build() (list *SecurityGroupList, err error) { + items := make([]*SecurityGroup, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SecurityGroupList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/security_group_list_type_json.go b/clientapi/clustersmgmt/v1/security_group_list_type_json.go new file mode 100644 index 00000000..039228c7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/security_group_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSecurityGroupList writes a list of values of the 'security_group' type to +// the given writer. +func MarshalSecurityGroupList(list []*SecurityGroup, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSecurityGroupList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSecurityGroupList writes a list of value of the 'security_group' type to +// the given stream. +func WriteSecurityGroupList(list []*SecurityGroup, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSecurityGroup(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSecurityGroupList reads a list of values of the 'security_group' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSecurityGroupList(source interface{}) (items []*SecurityGroup, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSecurityGroupList(iterator) + err = iterator.Error + return +} + +// ReadSecurityGroupList reads list of values of the ”security_group' type from +// the given iterator. +func ReadSecurityGroupList(iterator *jsoniter.Iterator) []*SecurityGroup { + list := []*SecurityGroup{} + for iterator.ReadArray() { + item := ReadSecurityGroup(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/security_group_type.go b/clientapi/clustersmgmt/v1/security_group_type.go new file mode 100644 index 00000000..2ea7f3d6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/security_group_type.go @@ -0,0 +1,213 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SecurityGroup represents the values of the 'security_group' type. +// +// AWS security group object +type SecurityGroup struct { + bitmap_ uint32 + id string + name string + redHatManaged bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SecurityGroup) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The security group ID. +func (o *SecurityGroup) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// The security group ID. +func (o *SecurityGroup) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the security group according to its `Name` tag on AWS. +func (o *SecurityGroup) Name() string { + if o != nil && o.bitmap_&2 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the security group according to its `Name` tag on AWS. +func (o *SecurityGroup) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.name + } + return +} + +// RedHatManaged returns the value of the 'red_hat_managed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// If the resource is RH managed. +func (o *SecurityGroup) RedHatManaged() bool { + if o != nil && o.bitmap_&4 != 0 { + return o.redHatManaged + } + return false +} + +// GetRedHatManaged returns the value of the 'red_hat_managed' attribute and +// a flag indicating if the attribute has a value. +// +// If the resource is RH managed. +func (o *SecurityGroup) GetRedHatManaged() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.redHatManaged + } + return +} + +// SecurityGroupListKind is the name of the type used to represent list of objects of +// type 'security_group'. +const SecurityGroupListKind = "SecurityGroupList" + +// SecurityGroupListLinkKind is the name of the type used to represent links to list +// of objects of type 'security_group'. +const SecurityGroupListLinkKind = "SecurityGroupListLink" + +// SecurityGroupNilKind is the name of the type used to nil lists of objects of +// type 'security_group'. +const SecurityGroupListNilKind = "SecurityGroupListNil" + +// SecurityGroupList is a list of values of the 'security_group' type. +type SecurityGroupList struct { + href string + link bool + items []*SecurityGroup +} + +// Len returns the length of the list. +func (l *SecurityGroupList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SecurityGroupList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SecurityGroupList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SecurityGroupList) SetItems(items []*SecurityGroup) { + l.items = items +} + +// Items returns the items of the list. +func (l *SecurityGroupList) Items() []*SecurityGroup { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SecurityGroupList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SecurityGroupList) Get(i int) *SecurityGroup { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SecurityGroupList) Slice() []*SecurityGroup { + var slice []*SecurityGroup + if l == nil { + slice = make([]*SecurityGroup, 0) + } else { + slice = make([]*SecurityGroup, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SecurityGroupList) Each(f func(item *SecurityGroup) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SecurityGroupList) Range(f func(index int, item *SecurityGroup) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/security_group_type_json.go b/clientapi/clustersmgmt/v1/security_group_type_json.go new file mode 100644 index 00000000..a65dba55 --- /dev/null +++ b/clientapi/clustersmgmt/v1/security_group_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSecurityGroup writes a value of the 'security_group' type to the given writer. +func MarshalSecurityGroup(object *SecurityGroup, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSecurityGroup(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSecurityGroup writes a value of the 'security_group' type to the given stream. +func WriteSecurityGroup(object *SecurityGroup, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("red_hat_managed") + stream.WriteBool(object.redHatManaged) + } + stream.WriteObjectEnd() +} + +// UnmarshalSecurityGroup reads a value of the 'security_group' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSecurityGroup(source interface{}) (object *SecurityGroup, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSecurityGroup(iterator) + err = iterator.Error + return +} + +// ReadSecurityGroup reads a value of the 'security_group' type from the given iterator. +func ReadSecurityGroup(iterator *jsoniter.Iterator) *SecurityGroup { + object := &SecurityGroup{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 2 + case "red_hat_managed": + value := iterator.ReadBool() + object.redHatManaged = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/server_config_builder.go b/clientapi/clustersmgmt/v1/server_config_builder.go new file mode 100644 index 00000000..5ef7d0fd --- /dev/null +++ b/clientapi/clustersmgmt/v1/server_config_builder.go @@ -0,0 +1,134 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ServerConfigBuilder contains the data and logic needed to build 'server_config' objects. +// +// Representation of a server config +type ServerConfigBuilder struct { + bitmap_ uint32 + id string + href string + awsShard *AWSShardBuilder + kubeconfig string + server string + topology ProvisionShardTopology +} + +// NewServerConfig creates a new builder of 'server_config' objects. +func NewServerConfig() *ServerConfigBuilder { + return &ServerConfigBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ServerConfigBuilder) Link(value bool) *ServerConfigBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ServerConfigBuilder) ID(value string) *ServerConfigBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ServerConfigBuilder) HREF(value string) *ServerConfigBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ServerConfigBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AWSShard sets the value of the 'AWS_shard' attribute to the given value. +// +// Config for AWS provision shards +func (b *ServerConfigBuilder) AWSShard(value *AWSShardBuilder) *ServerConfigBuilder { + b.awsShard = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// Kubeconfig sets the value of the 'kubeconfig' attribute to the given value. +func (b *ServerConfigBuilder) Kubeconfig(value string) *ServerConfigBuilder { + b.kubeconfig = value + b.bitmap_ |= 16 + return b +} + +// Server sets the value of the 'server' attribute to the given value. +func (b *ServerConfigBuilder) Server(value string) *ServerConfigBuilder { + b.server = value + b.bitmap_ |= 32 + return b +} + +// Topology sets the value of the 'topology' attribute to the given value. +func (b *ServerConfigBuilder) Topology(value ProvisionShardTopology) *ServerConfigBuilder { + b.topology = value + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ServerConfigBuilder) Copy(object *ServerConfig) *ServerConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.awsShard != nil { + b.awsShard = NewAWSShard().Copy(object.awsShard) + } else { + b.awsShard = nil + } + b.kubeconfig = object.kubeconfig + b.server = object.server + b.topology = object.topology + return b +} + +// Build creates a 'server_config' object using the configuration stored in the builder. +func (b *ServerConfigBuilder) Build() (object *ServerConfig, err error) { + object = new(ServerConfig) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.awsShard != nil { + object.awsShard, err = b.awsShard.Build() + if err != nil { + return + } + } + object.kubeconfig = b.kubeconfig + object.server = b.server + object.topology = b.topology + return +} diff --git a/clientapi/clustersmgmt/v1/server_config_list_builder.go b/clientapi/clustersmgmt/v1/server_config_list_builder.go new file mode 100644 index 00000000..9b1f7595 --- /dev/null +++ b/clientapi/clustersmgmt/v1/server_config_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ServerConfigListBuilder contains the data and logic needed to build +// 'server_config' objects. +type ServerConfigListBuilder struct { + items []*ServerConfigBuilder +} + +// NewServerConfigList creates a new builder of 'server_config' objects. +func NewServerConfigList() *ServerConfigListBuilder { + return new(ServerConfigListBuilder) +} + +// Items sets the items of the list. +func (b *ServerConfigListBuilder) Items(values ...*ServerConfigBuilder) *ServerConfigListBuilder { + b.items = make([]*ServerConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ServerConfigListBuilder) 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 *ServerConfigListBuilder) Copy(list *ServerConfigList) *ServerConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ServerConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewServerConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'server_config' objects using the +// configuration stored in the builder. +func (b *ServerConfigListBuilder) Build() (list *ServerConfigList, err error) { + items := make([]*ServerConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ServerConfigList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/server_config_list_type_json.go b/clientapi/clustersmgmt/v1/server_config_list_type_json.go new file mode 100644 index 00000000..76630925 --- /dev/null +++ b/clientapi/clustersmgmt/v1/server_config_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalServerConfigList writes a list of values of the 'server_config' type to +// the given writer. +func MarshalServerConfigList(list []*ServerConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServerConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServerConfigList writes a list of value of the 'server_config' type to +// the given stream. +func WriteServerConfigList(list []*ServerConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteServerConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalServerConfigList reads a list of values of the 'server_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalServerConfigList(source interface{}) (items []*ServerConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadServerConfigList(iterator) + err = iterator.Error + return +} + +// ReadServerConfigList reads list of values of the ”server_config' type from +// the given iterator. +func ReadServerConfigList(iterator *jsoniter.Iterator) []*ServerConfig { + list := []*ServerConfig{} + for iterator.ReadArray() { + item := ReadServerConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/server_config_type.go b/clientapi/clustersmgmt/v1/server_config_type.go new file mode 100644 index 00000000..a30c63a5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/server_config_type.go @@ -0,0 +1,337 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ServerConfigKind is the name of the type used to represent objects +// of type 'server_config'. +const ServerConfigKind = "ServerConfig" + +// ServerConfigLinkKind is the name of the type used to represent links +// to objects of type 'server_config'. +const ServerConfigLinkKind = "ServerConfigLink" + +// ServerConfigNilKind is the name of the type used to nil references +// to objects of type 'server_config'. +const ServerConfigNilKind = "ServerConfigNil" + +// ServerConfig represents the values of the 'server_config' type. +// +// Representation of a server config +type ServerConfig struct { + bitmap_ uint32 + id string + href string + awsShard *AWSShard + kubeconfig string + server string + topology ProvisionShardTopology +} + +// Kind returns the name of the type of the object. +func (o *ServerConfig) Kind() string { + if o == nil { + return ServerConfigNilKind + } + if o.bitmap_&1 != 0 { + return ServerConfigLinkKind + } + return ServerConfigKind +} + +// Link returns true if this is a link. +func (o *ServerConfig) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ServerConfig) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ServerConfig) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ServerConfig) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ServerConfig) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ServerConfig) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AWSShard returns the value of the 'AWS_shard' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Config for AWS provision shards +func (o *ServerConfig) AWSShard() *AWSShard { + if o != nil && o.bitmap_&8 != 0 { + return o.awsShard + } + return nil +} + +// GetAWSShard returns the value of the 'AWS_shard' attribute and +// a flag indicating if the attribute has a value. +// +// Config for AWS provision shards +func (o *ServerConfig) GetAWSShard() (value *AWSShard, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.awsShard + } + return +} + +// Kubeconfig returns the value of the 'kubeconfig' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The kubeconfig of the server. +func (o *ServerConfig) Kubeconfig() string { + if o != nil && o.bitmap_&16 != 0 { + return o.kubeconfig + } + return "" +} + +// GetKubeconfig returns the value of the 'kubeconfig' attribute and +// a flag indicating if the attribute has a value. +// +// The kubeconfig of the server. +func (o *ServerConfig) GetKubeconfig() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.kubeconfig + } + return +} + +// Server returns the value of the 'server' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The URL of the server. +func (o *ServerConfig) Server() string { + if o != nil && o.bitmap_&32 != 0 { + return o.server + } + return "" +} + +// GetServer returns the value of the 'server' attribute and +// a flag indicating if the attribute has a value. +// +// The URL of the server. +func (o *ServerConfig) GetServer() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.server + } + return +} + +// Topology returns the value of the 'topology' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The topology of a provision shard (Optional). +func (o *ServerConfig) Topology() ProvisionShardTopology { + if o != nil && o.bitmap_&64 != 0 { + return o.topology + } + return ProvisionShardTopology("") +} + +// GetTopology returns the value of the 'topology' attribute and +// a flag indicating if the attribute has a value. +// +// The topology of a provision shard (Optional). +func (o *ServerConfig) GetTopology() (value ProvisionShardTopology, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.topology + } + return +} + +// ServerConfigListKind is the name of the type used to represent list of objects of +// type 'server_config'. +const ServerConfigListKind = "ServerConfigList" + +// ServerConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'server_config'. +const ServerConfigListLinkKind = "ServerConfigListLink" + +// ServerConfigNilKind is the name of the type used to nil lists of objects of +// type 'server_config'. +const ServerConfigListNilKind = "ServerConfigListNil" + +// ServerConfigList is a list of values of the 'server_config' type. +type ServerConfigList struct { + href string + link bool + items []*ServerConfig +} + +// Kind returns the name of the type of the object. +func (l *ServerConfigList) Kind() string { + if l == nil { + return ServerConfigListNilKind + } + if l.link { + return ServerConfigListLinkKind + } + return ServerConfigListKind +} + +// Link returns true iif this is a link. +func (l *ServerConfigList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ServerConfigList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ServerConfigList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ServerConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ServerConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ServerConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ServerConfigList) SetItems(items []*ServerConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *ServerConfigList) Items() []*ServerConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ServerConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ServerConfigList) Get(i int) *ServerConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ServerConfigList) Slice() []*ServerConfig { + var slice []*ServerConfig + if l == nil { + slice = make([]*ServerConfig, 0) + } else { + slice = make([]*ServerConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ServerConfigList) Each(f func(item *ServerConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ServerConfigList) Range(f func(index int, item *ServerConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/server_config_type_json.go b/clientapi/clustersmgmt/v1/server_config_type_json.go new file mode 100644 index 00000000..721b93b7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/server_config_type_json.go @@ -0,0 +1,160 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalServerConfig writes a value of the 'server_config' type to the given writer. +func MarshalServerConfig(object *ServerConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServerConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServerConfig writes a value of the 'server_config' type to the given stream. +func WriteServerConfig(object *ServerConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ServerConfigLinkKind) + } else { + stream.WriteString(ServerConfigKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.awsShard != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws_shard") + WriteAWSShard(object.awsShard, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kubeconfig") + stream.WriteString(object.kubeconfig) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("server") + stream.WriteString(object.server) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("topology") + stream.WriteString(string(object.topology)) + } + stream.WriteObjectEnd() +} + +// UnmarshalServerConfig reads a value of the 'server_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalServerConfig(source interface{}) (object *ServerConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadServerConfig(iterator) + err = iterator.Error + return +} + +// ReadServerConfig reads a value of the 'server_config' type from the given iterator. +func ReadServerConfig(iterator *jsoniter.Iterator) *ServerConfig { + object := &ServerConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ServerConfigLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "aws_shard": + value := ReadAWSShard(iterator) + object.awsShard = value + object.bitmap_ |= 8 + case "kubeconfig": + value := iterator.ReadString() + object.kubeconfig = value + object.bitmap_ |= 16 + case "server": + value := iterator.ReadString() + object.server = value + object.bitmap_ |= 32 + case "topology": + text := iterator.ReadString() + value := ProvisionShardTopology(text) + object.topology = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_builder.go b/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_builder.go new file mode 100644 index 00000000..847e080f --- /dev/null +++ b/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_builder.go @@ -0,0 +1,107 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// SocketTotalNodeRoleOSMetricNodeBuilder contains the data and logic needed to build 'socket_total_node_role_OS_metric_node' objects. +// +// Representation of information from telemetry about a the socket capacity +// by node role and OS. +type SocketTotalNodeRoleOSMetricNodeBuilder struct { + bitmap_ uint32 + nodeRoles []string + operatingSystem string + socketTotal float64 + time time.Time +} + +// NewSocketTotalNodeRoleOSMetricNode creates a new builder of 'socket_total_node_role_OS_metric_node' objects. +func NewSocketTotalNodeRoleOSMetricNode() *SocketTotalNodeRoleOSMetricNodeBuilder { + return &SocketTotalNodeRoleOSMetricNodeBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SocketTotalNodeRoleOSMetricNodeBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// NodeRoles sets the value of the 'node_roles' attribute to the given values. +func (b *SocketTotalNodeRoleOSMetricNodeBuilder) NodeRoles(values ...string) *SocketTotalNodeRoleOSMetricNodeBuilder { + b.nodeRoles = make([]string, len(values)) + copy(b.nodeRoles, values) + b.bitmap_ |= 1 + return b +} + +// OperatingSystem sets the value of the 'operating_system' attribute to the given value. +func (b *SocketTotalNodeRoleOSMetricNodeBuilder) OperatingSystem(value string) *SocketTotalNodeRoleOSMetricNodeBuilder { + b.operatingSystem = value + b.bitmap_ |= 2 + return b +} + +// SocketTotal sets the value of the 'socket_total' attribute to the given value. +func (b *SocketTotalNodeRoleOSMetricNodeBuilder) SocketTotal(value float64) *SocketTotalNodeRoleOSMetricNodeBuilder { + b.socketTotal = value + b.bitmap_ |= 4 + return b +} + +// Time sets the value of the 'time' attribute to the given value. +func (b *SocketTotalNodeRoleOSMetricNodeBuilder) Time(value time.Time) *SocketTotalNodeRoleOSMetricNodeBuilder { + b.time = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SocketTotalNodeRoleOSMetricNodeBuilder) Copy(object *SocketTotalNodeRoleOSMetricNode) *SocketTotalNodeRoleOSMetricNodeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.nodeRoles != nil { + b.nodeRoles = make([]string, len(object.nodeRoles)) + copy(b.nodeRoles, object.nodeRoles) + } else { + b.nodeRoles = nil + } + b.operatingSystem = object.operatingSystem + b.socketTotal = object.socketTotal + b.time = object.time + return b +} + +// Build creates a 'socket_total_node_role_OS_metric_node' object using the configuration stored in the builder. +func (b *SocketTotalNodeRoleOSMetricNodeBuilder) Build() (object *SocketTotalNodeRoleOSMetricNode, err error) { + object = new(SocketTotalNodeRoleOSMetricNode) + object.bitmap_ = b.bitmap_ + if b.nodeRoles != nil { + object.nodeRoles = make([]string, len(b.nodeRoles)) + copy(object.nodeRoles, b.nodeRoles) + } + object.operatingSystem = b.operatingSystem + object.socketTotal = b.socketTotal + object.time = b.time + return +} diff --git a/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_list_builder.go b/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_list_builder.go new file mode 100644 index 00000000..5dffa975 --- /dev/null +++ b/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SocketTotalNodeRoleOSMetricNodeListBuilder contains the data and logic needed to build +// 'socket_total_node_role_OS_metric_node' objects. +type SocketTotalNodeRoleOSMetricNodeListBuilder struct { + items []*SocketTotalNodeRoleOSMetricNodeBuilder +} + +// NewSocketTotalNodeRoleOSMetricNodeList creates a new builder of 'socket_total_node_role_OS_metric_node' objects. +func NewSocketTotalNodeRoleOSMetricNodeList() *SocketTotalNodeRoleOSMetricNodeListBuilder { + return new(SocketTotalNodeRoleOSMetricNodeListBuilder) +} + +// Items sets the items of the list. +func (b *SocketTotalNodeRoleOSMetricNodeListBuilder) Items(values ...*SocketTotalNodeRoleOSMetricNodeBuilder) *SocketTotalNodeRoleOSMetricNodeListBuilder { + b.items = make([]*SocketTotalNodeRoleOSMetricNodeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SocketTotalNodeRoleOSMetricNodeListBuilder) 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 *SocketTotalNodeRoleOSMetricNodeListBuilder) Copy(list *SocketTotalNodeRoleOSMetricNodeList) *SocketTotalNodeRoleOSMetricNodeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SocketTotalNodeRoleOSMetricNodeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSocketTotalNodeRoleOSMetricNode().Copy(v) + } + } + return b +} + +// Build creates a list of 'socket_total_node_role_OS_metric_node' objects using the +// configuration stored in the builder. +func (b *SocketTotalNodeRoleOSMetricNodeListBuilder) Build() (list *SocketTotalNodeRoleOSMetricNodeList, err error) { + items := make([]*SocketTotalNodeRoleOSMetricNode, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SocketTotalNodeRoleOSMetricNodeList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_list_type_json.go b/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_list_type_json.go new file mode 100644 index 00000000..e8ee955d --- /dev/null +++ b/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSocketTotalNodeRoleOSMetricNodeList writes a list of values of the 'socket_total_node_role_OS_metric_node' type to +// the given writer. +func MarshalSocketTotalNodeRoleOSMetricNodeList(list []*SocketTotalNodeRoleOSMetricNode, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSocketTotalNodeRoleOSMetricNodeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSocketTotalNodeRoleOSMetricNodeList writes a list of value of the 'socket_total_node_role_OS_metric_node' type to +// the given stream. +func WriteSocketTotalNodeRoleOSMetricNodeList(list []*SocketTotalNodeRoleOSMetricNode, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSocketTotalNodeRoleOSMetricNode(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSocketTotalNodeRoleOSMetricNodeList reads a list of values of the 'socket_total_node_role_OS_metric_node' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSocketTotalNodeRoleOSMetricNodeList(source interface{}) (items []*SocketTotalNodeRoleOSMetricNode, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSocketTotalNodeRoleOSMetricNodeList(iterator) + err = iterator.Error + return +} + +// ReadSocketTotalNodeRoleOSMetricNodeList reads list of values of the ”socket_total_node_role_OS_metric_node' type from +// the given iterator. +func ReadSocketTotalNodeRoleOSMetricNodeList(iterator *jsoniter.Iterator) []*SocketTotalNodeRoleOSMetricNode { + list := []*SocketTotalNodeRoleOSMetricNode{} + for iterator.ReadArray() { + item := ReadSocketTotalNodeRoleOSMetricNode(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_type.go b/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_type.go new file mode 100644 index 00000000..2197dff5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_type.go @@ -0,0 +1,238 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// SocketTotalNodeRoleOSMetricNode represents the values of the 'socket_total_node_role_OS_metric_node' type. +// +// Representation of information from telemetry about a the socket capacity +// by node role and OS. +type SocketTotalNodeRoleOSMetricNode struct { + bitmap_ uint32 + nodeRoles []string + operatingSystem string + socketTotal float64 + time time.Time +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SocketTotalNodeRoleOSMetricNode) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// NodeRoles returns the value of the 'node_roles' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Representation of the node role for a cluster. +func (o *SocketTotalNodeRoleOSMetricNode) NodeRoles() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.nodeRoles + } + return nil +} + +// GetNodeRoles returns the value of the 'node_roles' attribute and +// a flag indicating if the attribute has a value. +// +// Representation of the node role for a cluster. +func (o *SocketTotalNodeRoleOSMetricNode) GetNodeRoles() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.nodeRoles + } + return +} + +// OperatingSystem returns the value of the 'operating_system' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The operating system. +func (o *SocketTotalNodeRoleOSMetricNode) OperatingSystem() string { + if o != nil && o.bitmap_&2 != 0 { + return o.operatingSystem + } + return "" +} + +// GetOperatingSystem returns the value of the 'operating_system' attribute and +// a flag indicating if the attribute has a value. +// +// The operating system. +func (o *SocketTotalNodeRoleOSMetricNode) GetOperatingSystem() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.operatingSystem + } + return +} + +// SocketTotal returns the value of the 'socket_total' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The total socket capacity of nodes with this set of roles and operating system. +func (o *SocketTotalNodeRoleOSMetricNode) SocketTotal() float64 { + if o != nil && o.bitmap_&4 != 0 { + return o.socketTotal + } + return 0.0 +} + +// GetSocketTotal returns the value of the 'socket_total' attribute and +// a flag indicating if the attribute has a value. +// +// The total socket capacity of nodes with this set of roles and operating system. +func (o *SocketTotalNodeRoleOSMetricNode) GetSocketTotal() (value float64, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.socketTotal + } + return +} + +// Time returns the value of the 'time' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SocketTotalNodeRoleOSMetricNode) Time() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.time + } + return time.Time{} +} + +// GetTime returns the value of the 'time' attribute and +// a flag indicating if the attribute has a value. +func (o *SocketTotalNodeRoleOSMetricNode) GetTime() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.time + } + return +} + +// SocketTotalNodeRoleOSMetricNodeListKind is the name of the type used to represent list of objects of +// type 'socket_total_node_role_OS_metric_node'. +const SocketTotalNodeRoleOSMetricNodeListKind = "SocketTotalNodeRoleOSMetricNodeList" + +// SocketTotalNodeRoleOSMetricNodeListLinkKind is the name of the type used to represent links to list +// of objects of type 'socket_total_node_role_OS_metric_node'. +const SocketTotalNodeRoleOSMetricNodeListLinkKind = "SocketTotalNodeRoleOSMetricNodeListLink" + +// SocketTotalNodeRoleOSMetricNodeNilKind is the name of the type used to nil lists of objects of +// type 'socket_total_node_role_OS_metric_node'. +const SocketTotalNodeRoleOSMetricNodeListNilKind = "SocketTotalNodeRoleOSMetricNodeListNil" + +// SocketTotalNodeRoleOSMetricNodeList is a list of values of the 'socket_total_node_role_OS_metric_node' type. +type SocketTotalNodeRoleOSMetricNodeList struct { + href string + link bool + items []*SocketTotalNodeRoleOSMetricNode +} + +// Len returns the length of the list. +func (l *SocketTotalNodeRoleOSMetricNodeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SocketTotalNodeRoleOSMetricNodeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SocketTotalNodeRoleOSMetricNodeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SocketTotalNodeRoleOSMetricNodeList) SetItems(items []*SocketTotalNodeRoleOSMetricNode) { + l.items = items +} + +// Items returns the items of the list. +func (l *SocketTotalNodeRoleOSMetricNodeList) Items() []*SocketTotalNodeRoleOSMetricNode { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SocketTotalNodeRoleOSMetricNodeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SocketTotalNodeRoleOSMetricNodeList) Get(i int) *SocketTotalNodeRoleOSMetricNode { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SocketTotalNodeRoleOSMetricNodeList) Slice() []*SocketTotalNodeRoleOSMetricNode { + var slice []*SocketTotalNodeRoleOSMetricNode + if l == nil { + slice = make([]*SocketTotalNodeRoleOSMetricNode, 0) + } else { + slice = make([]*SocketTotalNodeRoleOSMetricNode, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SocketTotalNodeRoleOSMetricNodeList) Each(f func(item *SocketTotalNodeRoleOSMetricNode) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SocketTotalNodeRoleOSMetricNodeList) Range(f func(index int, item *SocketTotalNodeRoleOSMetricNode) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_type_json.go b/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_type_json.go new file mode 100644 index 00000000..44d16720 --- /dev/null +++ b/clientapi/clustersmgmt/v1/socket_total_node_role_os_metric_node_type_json.go @@ -0,0 +1,130 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSocketTotalNodeRoleOSMetricNode writes a value of the 'socket_total_node_role_OS_metric_node' type to the given writer. +func MarshalSocketTotalNodeRoleOSMetricNode(object *SocketTotalNodeRoleOSMetricNode, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSocketTotalNodeRoleOSMetricNode(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSocketTotalNodeRoleOSMetricNode writes a value of the 'socket_total_node_role_OS_metric_node' type to the given stream. +func WriteSocketTotalNodeRoleOSMetricNode(object *SocketTotalNodeRoleOSMetricNode, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.nodeRoles != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("node_roles") + WriteStringList(object.nodeRoles, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operating_system") + stream.WriteString(object.operatingSystem) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("socket_total") + stream.WriteFloat64(object.socketTotal) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("time") + stream.WriteString((object.time).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalSocketTotalNodeRoleOSMetricNode reads a value of the 'socket_total_node_role_OS_metric_node' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSocketTotalNodeRoleOSMetricNode(source interface{}) (object *SocketTotalNodeRoleOSMetricNode, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSocketTotalNodeRoleOSMetricNode(iterator) + err = iterator.Error + return +} + +// ReadSocketTotalNodeRoleOSMetricNode reads a value of the 'socket_total_node_role_OS_metric_node' type from the given iterator. +func ReadSocketTotalNodeRoleOSMetricNode(iterator *jsoniter.Iterator) *SocketTotalNodeRoleOSMetricNode { + object := &SocketTotalNodeRoleOSMetricNode{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "node_roles": + value := ReadStringList(iterator) + object.nodeRoles = value + object.bitmap_ |= 1 + case "operating_system": + value := iterator.ReadString() + object.operatingSystem = value + object.bitmap_ |= 2 + case "socket_total": + value := iterator.ReadFloat64() + object.socketTotal = value + object.bitmap_ |= 4 + case "time": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.time = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_builder.go b/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_builder.go new file mode 100644 index 00000000..3487b748 --- /dev/null +++ b/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_builder.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SocketTotalsNodeRoleOSMetricNodeBuilder contains the data and logic needed to build 'socket_totals_node_role_OS_metric_node' objects. +// +// Representation of information from telemetry about the socket capacity by node +// role and OS of a cluster. +type SocketTotalsNodeRoleOSMetricNodeBuilder struct { + bitmap_ uint32 + socketTotals []*SocketTotalNodeRoleOSMetricNodeBuilder +} + +// NewSocketTotalsNodeRoleOSMetricNode creates a new builder of 'socket_totals_node_role_OS_metric_node' objects. +func NewSocketTotalsNodeRoleOSMetricNode() *SocketTotalsNodeRoleOSMetricNodeBuilder { + return &SocketTotalsNodeRoleOSMetricNodeBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SocketTotalsNodeRoleOSMetricNodeBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// SocketTotals sets the value of the 'socket_totals' attribute to the given values. +func (b *SocketTotalsNodeRoleOSMetricNodeBuilder) SocketTotals(values ...*SocketTotalNodeRoleOSMetricNodeBuilder) *SocketTotalsNodeRoleOSMetricNodeBuilder { + b.socketTotals = make([]*SocketTotalNodeRoleOSMetricNodeBuilder, len(values)) + copy(b.socketTotals, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SocketTotalsNodeRoleOSMetricNodeBuilder) Copy(object *SocketTotalsNodeRoleOSMetricNode) *SocketTotalsNodeRoleOSMetricNodeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.socketTotals != nil { + b.socketTotals = make([]*SocketTotalNodeRoleOSMetricNodeBuilder, len(object.socketTotals)) + for i, v := range object.socketTotals { + b.socketTotals[i] = NewSocketTotalNodeRoleOSMetricNode().Copy(v) + } + } else { + b.socketTotals = nil + } + return b +} + +// Build creates a 'socket_totals_node_role_OS_metric_node' object using the configuration stored in the builder. +func (b *SocketTotalsNodeRoleOSMetricNodeBuilder) Build() (object *SocketTotalsNodeRoleOSMetricNode, err error) { + object = new(SocketTotalsNodeRoleOSMetricNode) + object.bitmap_ = b.bitmap_ + if b.socketTotals != nil { + object.socketTotals = make([]*SocketTotalNodeRoleOSMetricNode, len(b.socketTotals)) + for i, v := range b.socketTotals { + object.socketTotals[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_list_builder.go b/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_list_builder.go new file mode 100644 index 00000000..0c3a17c6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SocketTotalsNodeRoleOSMetricNodeListBuilder contains the data and logic needed to build +// 'socket_totals_node_role_OS_metric_node' objects. +type SocketTotalsNodeRoleOSMetricNodeListBuilder struct { + items []*SocketTotalsNodeRoleOSMetricNodeBuilder +} + +// NewSocketTotalsNodeRoleOSMetricNodeList creates a new builder of 'socket_totals_node_role_OS_metric_node' objects. +func NewSocketTotalsNodeRoleOSMetricNodeList() *SocketTotalsNodeRoleOSMetricNodeListBuilder { + return new(SocketTotalsNodeRoleOSMetricNodeListBuilder) +} + +// Items sets the items of the list. +func (b *SocketTotalsNodeRoleOSMetricNodeListBuilder) Items(values ...*SocketTotalsNodeRoleOSMetricNodeBuilder) *SocketTotalsNodeRoleOSMetricNodeListBuilder { + b.items = make([]*SocketTotalsNodeRoleOSMetricNodeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SocketTotalsNodeRoleOSMetricNodeListBuilder) 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 *SocketTotalsNodeRoleOSMetricNodeListBuilder) Copy(list *SocketTotalsNodeRoleOSMetricNodeList) *SocketTotalsNodeRoleOSMetricNodeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SocketTotalsNodeRoleOSMetricNodeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSocketTotalsNodeRoleOSMetricNode().Copy(v) + } + } + return b +} + +// Build creates a list of 'socket_totals_node_role_OS_metric_node' objects using the +// configuration stored in the builder. +func (b *SocketTotalsNodeRoleOSMetricNodeListBuilder) Build() (list *SocketTotalsNodeRoleOSMetricNodeList, err error) { + items := make([]*SocketTotalsNodeRoleOSMetricNode, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SocketTotalsNodeRoleOSMetricNodeList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_list_type_json.go b/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_list_type_json.go new file mode 100644 index 00000000..094af103 --- /dev/null +++ b/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSocketTotalsNodeRoleOSMetricNodeList writes a list of values of the 'socket_totals_node_role_OS_metric_node' type to +// the given writer. +func MarshalSocketTotalsNodeRoleOSMetricNodeList(list []*SocketTotalsNodeRoleOSMetricNode, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSocketTotalsNodeRoleOSMetricNodeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSocketTotalsNodeRoleOSMetricNodeList writes a list of value of the 'socket_totals_node_role_OS_metric_node' type to +// the given stream. +func WriteSocketTotalsNodeRoleOSMetricNodeList(list []*SocketTotalsNodeRoleOSMetricNode, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSocketTotalsNodeRoleOSMetricNode(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSocketTotalsNodeRoleOSMetricNodeList reads a list of values of the 'socket_totals_node_role_OS_metric_node' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSocketTotalsNodeRoleOSMetricNodeList(source interface{}) (items []*SocketTotalsNodeRoleOSMetricNode, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSocketTotalsNodeRoleOSMetricNodeList(iterator) + err = iterator.Error + return +} + +// ReadSocketTotalsNodeRoleOSMetricNodeList reads list of values of the ”socket_totals_node_role_OS_metric_node' type from +// the given iterator. +func ReadSocketTotalsNodeRoleOSMetricNodeList(iterator *jsoniter.Iterator) []*SocketTotalsNodeRoleOSMetricNode { + list := []*SocketTotalsNodeRoleOSMetricNode{} + for iterator.ReadArray() { + item := ReadSocketTotalsNodeRoleOSMetricNode(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_type.go b/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_type.go new file mode 100644 index 00000000..5564aaa8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_type.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SocketTotalsNodeRoleOSMetricNode represents the values of the 'socket_totals_node_role_OS_metric_node' type. +// +// Representation of information from telemetry about the socket capacity by node +// role and OS of a cluster. +type SocketTotalsNodeRoleOSMetricNode struct { + bitmap_ uint32 + socketTotals []*SocketTotalNodeRoleOSMetricNode +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SocketTotalsNodeRoleOSMetricNode) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// SocketTotals returns the value of the 'socket_totals' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *SocketTotalsNodeRoleOSMetricNode) SocketTotals() []*SocketTotalNodeRoleOSMetricNode { + if o != nil && o.bitmap_&1 != 0 { + return o.socketTotals + } + return nil +} + +// GetSocketTotals returns the value of the 'socket_totals' attribute and +// a flag indicating if the attribute has a value. +func (o *SocketTotalsNodeRoleOSMetricNode) GetSocketTotals() (value []*SocketTotalNodeRoleOSMetricNode, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.socketTotals + } + return +} + +// SocketTotalsNodeRoleOSMetricNodeListKind is the name of the type used to represent list of objects of +// type 'socket_totals_node_role_OS_metric_node'. +const SocketTotalsNodeRoleOSMetricNodeListKind = "SocketTotalsNodeRoleOSMetricNodeList" + +// SocketTotalsNodeRoleOSMetricNodeListLinkKind is the name of the type used to represent links to list +// of objects of type 'socket_totals_node_role_OS_metric_node'. +const SocketTotalsNodeRoleOSMetricNodeListLinkKind = "SocketTotalsNodeRoleOSMetricNodeListLink" + +// SocketTotalsNodeRoleOSMetricNodeNilKind is the name of the type used to nil lists of objects of +// type 'socket_totals_node_role_OS_metric_node'. +const SocketTotalsNodeRoleOSMetricNodeListNilKind = "SocketTotalsNodeRoleOSMetricNodeListNil" + +// SocketTotalsNodeRoleOSMetricNodeList is a list of values of the 'socket_totals_node_role_OS_metric_node' type. +type SocketTotalsNodeRoleOSMetricNodeList struct { + href string + link bool + items []*SocketTotalsNodeRoleOSMetricNode +} + +// Len returns the length of the list. +func (l *SocketTotalsNodeRoleOSMetricNodeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SocketTotalsNodeRoleOSMetricNodeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SocketTotalsNodeRoleOSMetricNodeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SocketTotalsNodeRoleOSMetricNodeList) SetItems(items []*SocketTotalsNodeRoleOSMetricNode) { + l.items = items +} + +// Items returns the items of the list. +func (l *SocketTotalsNodeRoleOSMetricNodeList) Items() []*SocketTotalsNodeRoleOSMetricNode { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SocketTotalsNodeRoleOSMetricNodeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SocketTotalsNodeRoleOSMetricNodeList) Get(i int) *SocketTotalsNodeRoleOSMetricNode { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SocketTotalsNodeRoleOSMetricNodeList) Slice() []*SocketTotalsNodeRoleOSMetricNode { + var slice []*SocketTotalsNodeRoleOSMetricNode + if l == nil { + slice = make([]*SocketTotalsNodeRoleOSMetricNode, 0) + } else { + slice = make([]*SocketTotalsNodeRoleOSMetricNode, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SocketTotalsNodeRoleOSMetricNodeList) Each(f func(item *SocketTotalsNodeRoleOSMetricNode) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SocketTotalsNodeRoleOSMetricNodeList) Range(f func(index int, item *SocketTotalsNodeRoleOSMetricNode) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_type_json.go b/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_type_json.go new file mode 100644 index 00000000..16a2f4ce --- /dev/null +++ b/clientapi/clustersmgmt/v1/socket_totals_node_role_os_metric_node_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSocketTotalsNodeRoleOSMetricNode writes a value of the 'socket_totals_node_role_OS_metric_node' type to the given writer. +func MarshalSocketTotalsNodeRoleOSMetricNode(object *SocketTotalsNodeRoleOSMetricNode, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSocketTotalsNodeRoleOSMetricNode(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSocketTotalsNodeRoleOSMetricNode writes a value of the 'socket_totals_node_role_OS_metric_node' type to the given stream. +func WriteSocketTotalsNodeRoleOSMetricNode(object *SocketTotalsNodeRoleOSMetricNode, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.socketTotals != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("socket_totals") + WriteSocketTotalNodeRoleOSMetricNodeList(object.socketTotals, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalSocketTotalsNodeRoleOSMetricNode reads a value of the 'socket_totals_node_role_OS_metric_node' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSocketTotalsNodeRoleOSMetricNode(source interface{}) (object *SocketTotalsNodeRoleOSMetricNode, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSocketTotalsNodeRoleOSMetricNode(iterator) + err = iterator.Error + return +} + +// ReadSocketTotalsNodeRoleOSMetricNode reads a value of the 'socket_totals_node_role_OS_metric_node' type from the given iterator. +func ReadSocketTotalsNodeRoleOSMetricNode(iterator *jsoniter.Iterator) *SocketTotalsNodeRoleOSMetricNode { + object := &SocketTotalsNodeRoleOSMetricNode{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "socket_totals": + value := ReadSocketTotalNodeRoleOSMetricNodeList(iterator) + object.socketTotals = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/storage_quota_builder.go b/clientapi/clustersmgmt/v1/storage_quota_builder.go new file mode 100644 index 00000000..fe05d63e --- /dev/null +++ b/clientapi/clustersmgmt/v1/storage_quota_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// StorageQuotaBuilder contains the data and logic needed to build 'storage_quota' objects. +// +// Representation of a storage quota +type StorageQuotaBuilder struct { + bitmap_ uint32 + unit string + value float64 +} + +// NewStorageQuota creates a new builder of 'storage_quota' objects. +func NewStorageQuota() *StorageQuotaBuilder { + return &StorageQuotaBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *StorageQuotaBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Unit sets the value of the 'unit' attribute to the given value. +func (b *StorageQuotaBuilder) Unit(value string) *StorageQuotaBuilder { + b.unit = value + b.bitmap_ |= 1 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *StorageQuotaBuilder) Value(value float64) *StorageQuotaBuilder { + b.value = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *StorageQuotaBuilder) Copy(object *StorageQuota) *StorageQuotaBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.unit = object.unit + b.value = object.value + return b +} + +// Build creates a 'storage_quota' object using the configuration stored in the builder. +func (b *StorageQuotaBuilder) Build() (object *StorageQuota, err error) { + object = new(StorageQuota) + object.bitmap_ = b.bitmap_ + object.unit = b.unit + object.value = b.value + return +} diff --git a/clientapi/clustersmgmt/v1/storage_quota_list_builder.go b/clientapi/clustersmgmt/v1/storage_quota_list_builder.go new file mode 100644 index 00000000..ed7c467c --- /dev/null +++ b/clientapi/clustersmgmt/v1/storage_quota_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// StorageQuotaListBuilder contains the data and logic needed to build +// 'storage_quota' objects. +type StorageQuotaListBuilder struct { + items []*StorageQuotaBuilder +} + +// NewStorageQuotaList creates a new builder of 'storage_quota' objects. +func NewStorageQuotaList() *StorageQuotaListBuilder { + return new(StorageQuotaListBuilder) +} + +// Items sets the items of the list. +func (b *StorageQuotaListBuilder) Items(values ...*StorageQuotaBuilder) *StorageQuotaListBuilder { + b.items = make([]*StorageQuotaBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *StorageQuotaListBuilder) 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 *StorageQuotaListBuilder) Copy(list *StorageQuotaList) *StorageQuotaListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*StorageQuotaBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewStorageQuota().Copy(v) + } + } + return b +} + +// Build creates a list of 'storage_quota' objects using the +// configuration stored in the builder. +func (b *StorageQuotaListBuilder) Build() (list *StorageQuotaList, err error) { + items := make([]*StorageQuota, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(StorageQuotaList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/storage_quota_list_type_json.go b/clientapi/clustersmgmt/v1/storage_quota_list_type_json.go new file mode 100644 index 00000000..8e94662b --- /dev/null +++ b/clientapi/clustersmgmt/v1/storage_quota_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStorageQuotaList writes a list of values of the 'storage_quota' type to +// the given writer. +func MarshalStorageQuotaList(list []*StorageQuota, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStorageQuotaList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStorageQuotaList writes a list of value of the 'storage_quota' type to +// the given stream. +func WriteStorageQuotaList(list []*StorageQuota, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteStorageQuota(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalStorageQuotaList reads a list of values of the 'storage_quota' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStorageQuotaList(source interface{}) (items []*StorageQuota, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStorageQuotaList(iterator) + err = iterator.Error + return +} + +// ReadStorageQuotaList reads list of values of the ”storage_quota' type from +// the given iterator. +func ReadStorageQuotaList(iterator *jsoniter.Iterator) []*StorageQuota { + list := []*StorageQuota{} + for iterator.ReadArray() { + item := ReadStorageQuota(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/storage_quota_type.go b/clientapi/clustersmgmt/v1/storage_quota_type.go new file mode 100644 index 00000000..8d884ad4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/storage_quota_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// StorageQuota represents the values of the 'storage_quota' type. +// +// Representation of a storage quota +type StorageQuota struct { + bitmap_ uint32 + unit string + value float64 +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *StorageQuota) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Unit returns the value of the 'unit' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Unit of storage +func (o *StorageQuota) Unit() string { + if o != nil && o.bitmap_&1 != 0 { + return o.unit + } + return "" +} + +// GetUnit returns the value of the 'unit' attribute and +// a flag indicating if the attribute has a value. +// +// Unit of storage +func (o *StorageQuota) GetUnit() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.unit + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Numerical value +func (o *StorageQuota) Value() float64 { + if o != nil && o.bitmap_&2 != 0 { + return o.value + } + return 0.0 +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Numerical value +func (o *StorageQuota) GetValue() (value float64, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.value + } + return +} + +// StorageQuotaListKind is the name of the type used to represent list of objects of +// type 'storage_quota'. +const StorageQuotaListKind = "StorageQuotaList" + +// StorageQuotaListLinkKind is the name of the type used to represent links to list +// of objects of type 'storage_quota'. +const StorageQuotaListLinkKind = "StorageQuotaListLink" + +// StorageQuotaNilKind is the name of the type used to nil lists of objects of +// type 'storage_quota'. +const StorageQuotaListNilKind = "StorageQuotaListNil" + +// StorageQuotaList is a list of values of the 'storage_quota' type. +type StorageQuotaList struct { + href string + link bool + items []*StorageQuota +} + +// Len returns the length of the list. +func (l *StorageQuotaList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *StorageQuotaList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *StorageQuotaList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *StorageQuotaList) SetItems(items []*StorageQuota) { + l.items = items +} + +// Items returns the items of the list. +func (l *StorageQuotaList) Items() []*StorageQuota { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *StorageQuotaList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *StorageQuotaList) Get(i int) *StorageQuota { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *StorageQuotaList) Slice() []*StorageQuota { + var slice []*StorageQuota + if l == nil { + slice = make([]*StorageQuota, 0) + } else { + slice = make([]*StorageQuota, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *StorageQuotaList) Each(f func(item *StorageQuota) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *StorageQuotaList) Range(f func(index int, item *StorageQuota) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/storage_quota_type_json.go b/clientapi/clustersmgmt/v1/storage_quota_type_json.go new file mode 100644 index 00000000..40610bc1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/storage_quota_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStorageQuota writes a value of the 'storage_quota' type to the given writer. +func MarshalStorageQuota(object *StorageQuota, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStorageQuota(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStorageQuota writes a value of the 'storage_quota' type to the given stream. +func WriteStorageQuota(object *StorageQuota, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("unit") + stream.WriteString(object.unit) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteFloat64(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalStorageQuota reads a value of the 'storage_quota' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalStorageQuota(source interface{}) (object *StorageQuota, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadStorageQuota(iterator) + err = iterator.Error + return +} + +// ReadStorageQuota reads a value of the 'storage_quota' type from the given iterator. +func ReadStorageQuota(iterator *jsoniter.Iterator) *StorageQuota { + object := &StorageQuota{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "unit": + value := iterator.ReadString() + object.unit = value + object.bitmap_ |= 1 + case "value": + value := iterator.ReadFloat64() + object.value = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/string_list_type_json.go b/clientapi/clustersmgmt/v1/string_list_type_json.go new file mode 100644 index 00000000..efdc0535 --- /dev/null +++ b/clientapi/clustersmgmt/v1/string_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStringList writes a list of values of the 'string' type to +// the given writer. +func MarshalStringList(list []string, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStringList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStringList writes a list of value of the 'string' type to +// the given stream. +func WriteStringList(list []string, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalStringList reads a list of values of the 'string' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStringList(source interface{}) (items []string, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStringList(iterator) + err = iterator.Error + return +} + +// ReadStringList reads list of values of the ”string' type from +// the given iterator. +func ReadStringList(iterator *jsoniter.Iterator) []string { + list := []string{} + for iterator.ReadArray() { + item := iterator.ReadString() + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/sts_builder.go b/clientapi/clustersmgmt/v1/sts_builder.go new file mode 100644 index 00000000..099e0d6c --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_builder.go @@ -0,0 +1,219 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// STSBuilder contains the data and logic needed to build 'STS' objects. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type STSBuilder struct { + bitmap_ uint32 + oidcEndpointURL string + externalID string + instanceIAMRoles *InstanceIAMRolesBuilder + oidcConfig *OidcConfigBuilder + operatorIAMRoles []*OperatorIAMRoleBuilder + operatorRolePrefix string + permissionBoundary string + roleARN string + supportRoleARN string + autoMode bool + enabled bool + managedPolicies bool +} + +// NewSTS creates a new builder of 'STS' objects. +func NewSTS() *STSBuilder { + return &STSBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *STSBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// OIDCEndpointURL sets the value of the 'OIDC_endpoint_URL' attribute to the given value. +func (b *STSBuilder) OIDCEndpointURL(value string) *STSBuilder { + b.oidcEndpointURL = value + b.bitmap_ |= 1 + return b +} + +// AutoMode sets the value of the 'auto_mode' attribute to the given value. +func (b *STSBuilder) AutoMode(value bool) *STSBuilder { + b.autoMode = value + b.bitmap_ |= 2 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *STSBuilder) Enabled(value bool) *STSBuilder { + b.enabled = value + b.bitmap_ |= 4 + return b +} + +// ExternalID sets the value of the 'external_ID' attribute to the given value. +func (b *STSBuilder) ExternalID(value string) *STSBuilder { + b.externalID = value + b.bitmap_ |= 8 + return b +} + +// InstanceIAMRoles sets the value of the 'instance_IAM_roles' attribute to the given value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (b *STSBuilder) InstanceIAMRoles(value *InstanceIAMRolesBuilder) *STSBuilder { + b.instanceIAMRoles = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// ManagedPolicies sets the value of the 'managed_policies' attribute to the given value. +func (b *STSBuilder) ManagedPolicies(value bool) *STSBuilder { + b.managedPolicies = value + b.bitmap_ |= 32 + return b +} + +// OidcConfig sets the value of the 'oidc_config' attribute to the given value. +// +// Contains the necessary attributes to support oidc configuration hosting under Red Hat or registering a Customer's byo oidc config. +func (b *STSBuilder) OidcConfig(value *OidcConfigBuilder) *STSBuilder { + b.oidcConfig = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// OperatorIAMRoles sets the value of the 'operator_IAM_roles' attribute to the given values. +func (b *STSBuilder) OperatorIAMRoles(values ...*OperatorIAMRoleBuilder) *STSBuilder { + b.operatorIAMRoles = make([]*OperatorIAMRoleBuilder, len(values)) + copy(b.operatorIAMRoles, values) + b.bitmap_ |= 128 + return b +} + +// OperatorRolePrefix sets the value of the 'operator_role_prefix' attribute to the given value. +func (b *STSBuilder) OperatorRolePrefix(value string) *STSBuilder { + b.operatorRolePrefix = value + b.bitmap_ |= 256 + return b +} + +// PermissionBoundary sets the value of the 'permission_boundary' attribute to the given value. +func (b *STSBuilder) PermissionBoundary(value string) *STSBuilder { + b.permissionBoundary = value + b.bitmap_ |= 512 + return b +} + +// RoleARN sets the value of the 'role_ARN' attribute to the given value. +func (b *STSBuilder) RoleARN(value string) *STSBuilder { + b.roleARN = value + b.bitmap_ |= 1024 + return b +} + +// SupportRoleARN sets the value of the 'support_role_ARN' attribute to the given value. +func (b *STSBuilder) SupportRoleARN(value string) *STSBuilder { + b.supportRoleARN = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *STSBuilder) Copy(object *STS) *STSBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.oidcEndpointURL = object.oidcEndpointURL + b.autoMode = object.autoMode + b.enabled = object.enabled + b.externalID = object.externalID + if object.instanceIAMRoles != nil { + b.instanceIAMRoles = NewInstanceIAMRoles().Copy(object.instanceIAMRoles) + } else { + b.instanceIAMRoles = nil + } + b.managedPolicies = object.managedPolicies + if object.oidcConfig != nil { + b.oidcConfig = NewOidcConfig().Copy(object.oidcConfig) + } else { + b.oidcConfig = nil + } + if object.operatorIAMRoles != nil { + b.operatorIAMRoles = make([]*OperatorIAMRoleBuilder, len(object.operatorIAMRoles)) + for i, v := range object.operatorIAMRoles { + b.operatorIAMRoles[i] = NewOperatorIAMRole().Copy(v) + } + } else { + b.operatorIAMRoles = nil + } + b.operatorRolePrefix = object.operatorRolePrefix + b.permissionBoundary = object.permissionBoundary + b.roleARN = object.roleARN + b.supportRoleARN = object.supportRoleARN + return b +} + +// Build creates a 'STS' object using the configuration stored in the builder. +func (b *STSBuilder) Build() (object *STS, err error) { + object = new(STS) + object.bitmap_ = b.bitmap_ + object.oidcEndpointURL = b.oidcEndpointURL + object.autoMode = b.autoMode + object.enabled = b.enabled + object.externalID = b.externalID + if b.instanceIAMRoles != nil { + object.instanceIAMRoles, err = b.instanceIAMRoles.Build() + if err != nil { + return + } + } + object.managedPolicies = b.managedPolicies + if b.oidcConfig != nil { + object.oidcConfig, err = b.oidcConfig.Build() + if err != nil { + return + } + } + if b.operatorIAMRoles != nil { + object.operatorIAMRoles = make([]*OperatorIAMRole, len(b.operatorIAMRoles)) + for i, v := range b.operatorIAMRoles { + object.operatorIAMRoles[i], err = v.Build() + if err != nil { + return + } + } + } + object.operatorRolePrefix = b.operatorRolePrefix + object.permissionBoundary = b.permissionBoundary + object.roleARN = b.roleARN + object.supportRoleARN = b.supportRoleARN + return +} diff --git a/clientapi/clustersmgmt/v1/sts_credential_request_builder.go b/clientapi/clustersmgmt/v1/sts_credential_request_builder.go new file mode 100644 index 00000000..63f5b0e6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_credential_request_builder.go @@ -0,0 +1,88 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// STSCredentialRequestBuilder contains the data and logic needed to build 'STS_credential_request' objects. +// +// Representation of an credRequest +type STSCredentialRequestBuilder struct { + bitmap_ uint32 + name string + operator *STSOperatorBuilder +} + +// NewSTSCredentialRequest creates a new builder of 'STS_credential_request' objects. +func NewSTSCredentialRequest() *STSCredentialRequestBuilder { + return &STSCredentialRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *STSCredentialRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *STSCredentialRequestBuilder) Name(value string) *STSCredentialRequestBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Operator sets the value of the 'operator' attribute to the given value. +// +// Representation of an sts operator +func (b *STSCredentialRequestBuilder) Operator(value *STSOperatorBuilder) *STSCredentialRequestBuilder { + b.operator = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *STSCredentialRequestBuilder) Copy(object *STSCredentialRequest) *STSCredentialRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + if object.operator != nil { + b.operator = NewSTSOperator().Copy(object.operator) + } else { + b.operator = nil + } + return b +} + +// Build creates a 'STS_credential_request' object using the configuration stored in the builder. +func (b *STSCredentialRequestBuilder) Build() (object *STSCredentialRequest, err error) { + object = new(STSCredentialRequest) + object.bitmap_ = b.bitmap_ + object.name = b.name + if b.operator != nil { + object.operator, err = b.operator.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/sts_credential_request_list_builder.go b/clientapi/clustersmgmt/v1/sts_credential_request_list_builder.go new file mode 100644 index 00000000..fb49dd34 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_credential_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// STSCredentialRequestListBuilder contains the data and logic needed to build +// 'STS_credential_request' objects. +type STSCredentialRequestListBuilder struct { + items []*STSCredentialRequestBuilder +} + +// NewSTSCredentialRequestList creates a new builder of 'STS_credential_request' objects. +func NewSTSCredentialRequestList() *STSCredentialRequestListBuilder { + return new(STSCredentialRequestListBuilder) +} + +// Items sets the items of the list. +func (b *STSCredentialRequestListBuilder) Items(values ...*STSCredentialRequestBuilder) *STSCredentialRequestListBuilder { + b.items = make([]*STSCredentialRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *STSCredentialRequestListBuilder) 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 *STSCredentialRequestListBuilder) Copy(list *STSCredentialRequestList) *STSCredentialRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*STSCredentialRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSTSCredentialRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'STS_credential_request' objects using the +// configuration stored in the builder. +func (b *STSCredentialRequestListBuilder) Build() (list *STSCredentialRequestList, err error) { + items := make([]*STSCredentialRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(STSCredentialRequestList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/sts_credential_request_list_type_json.go b/clientapi/clustersmgmt/v1/sts_credential_request_list_type_json.go new file mode 100644 index 00000000..fe6b69dc --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_credential_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSTSCredentialRequestList writes a list of values of the 'STS_credential_request' type to +// the given writer. +func MarshalSTSCredentialRequestList(list []*STSCredentialRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSTSCredentialRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSTSCredentialRequestList writes a list of value of the 'STS_credential_request' type to +// the given stream. +func WriteSTSCredentialRequestList(list []*STSCredentialRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSTSCredentialRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSTSCredentialRequestList reads a list of values of the 'STS_credential_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSTSCredentialRequestList(source interface{}) (items []*STSCredentialRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSTSCredentialRequestList(iterator) + err = iterator.Error + return +} + +// ReadSTSCredentialRequestList reads list of values of the ”STS_credential_request' type from +// the given iterator. +func ReadSTSCredentialRequestList(iterator *jsoniter.Iterator) []*STSCredentialRequest { + list := []*STSCredentialRequest{} + for iterator.ReadArray() { + item := ReadSTSCredentialRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/sts_credential_request_type.go b/clientapi/clustersmgmt/v1/sts_credential_request_type.go new file mode 100644 index 00000000..9386241a --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_credential_request_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// STSCredentialRequest represents the values of the 'STS_credential_request' type. +// +// Representation of an credRequest +type STSCredentialRequest struct { + bitmap_ uint32 + name string + operator *STSOperator +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *STSCredentialRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of CredRequest +func (o *STSCredentialRequest) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of CredRequest +func (o *STSCredentialRequest) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Operator returns the value of the 'operator' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Operator Details +func (o *STSCredentialRequest) Operator() *STSOperator { + if o != nil && o.bitmap_&2 != 0 { + return o.operator + } + return nil +} + +// GetOperator returns the value of the 'operator' attribute and +// a flag indicating if the attribute has a value. +// +// Operator Details +func (o *STSCredentialRequest) GetOperator() (value *STSOperator, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.operator + } + return +} + +// STSCredentialRequestListKind is the name of the type used to represent list of objects of +// type 'STS_credential_request'. +const STSCredentialRequestListKind = "STSCredentialRequestList" + +// STSCredentialRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'STS_credential_request'. +const STSCredentialRequestListLinkKind = "STSCredentialRequestListLink" + +// STSCredentialRequestNilKind is the name of the type used to nil lists of objects of +// type 'STS_credential_request'. +const STSCredentialRequestListNilKind = "STSCredentialRequestListNil" + +// STSCredentialRequestList is a list of values of the 'STS_credential_request' type. +type STSCredentialRequestList struct { + href string + link bool + items []*STSCredentialRequest +} + +// Len returns the length of the list. +func (l *STSCredentialRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *STSCredentialRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *STSCredentialRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *STSCredentialRequestList) SetItems(items []*STSCredentialRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *STSCredentialRequestList) Items() []*STSCredentialRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *STSCredentialRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *STSCredentialRequestList) Get(i int) *STSCredentialRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *STSCredentialRequestList) Slice() []*STSCredentialRequest { + var slice []*STSCredentialRequest + if l == nil { + slice = make([]*STSCredentialRequest, 0) + } else { + slice = make([]*STSCredentialRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *STSCredentialRequestList) Each(f func(item *STSCredentialRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *STSCredentialRequestList) Range(f func(index int, item *STSCredentialRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/sts_credential_request_type_json.go b/clientapi/clustersmgmt/v1/sts_credential_request_type_json.go new file mode 100644 index 00000000..af5281b8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_credential_request_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSTSCredentialRequest writes a value of the 'STS_credential_request' type to the given writer. +func MarshalSTSCredentialRequest(object *STSCredentialRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSTSCredentialRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSTSCredentialRequest writes a value of the 'STS_credential_request' type to the given stream. +func WriteSTSCredentialRequest(object *STSCredentialRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 && object.operator != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator") + WriteSTSOperator(object.operator, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalSTSCredentialRequest reads a value of the 'STS_credential_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSTSCredentialRequest(source interface{}) (object *STSCredentialRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSTSCredentialRequest(iterator) + err = iterator.Error + return +} + +// ReadSTSCredentialRequest reads a value of the 'STS_credential_request' type from the given iterator. +func ReadSTSCredentialRequest(iterator *jsoniter.Iterator) *STSCredentialRequest { + object := &STSCredentialRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "operator": + value := ReadSTSOperator(iterator) + object.operator = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/sts_list_builder.go b/clientapi/clustersmgmt/v1/sts_list_builder.go new file mode 100644 index 00000000..a1fb74fc --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// STSListBuilder contains the data and logic needed to build +// 'STS' objects. +type STSListBuilder struct { + items []*STSBuilder +} + +// NewSTSList creates a new builder of 'STS' objects. +func NewSTSList() *STSListBuilder { + return new(STSListBuilder) +} + +// Items sets the items of the list. +func (b *STSListBuilder) Items(values ...*STSBuilder) *STSListBuilder { + b.items = make([]*STSBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *STSListBuilder) 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 *STSListBuilder) Copy(list *STSList) *STSListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*STSBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSTS().Copy(v) + } + } + return b +} + +// Build creates a list of 'STS' objects using the +// configuration stored in the builder. +func (b *STSListBuilder) Build() (list *STSList, err error) { + items := make([]*STS, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(STSList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/sts_list_type_json.go b/clientapi/clustersmgmt/v1/sts_list_type_json.go new file mode 100644 index 00000000..23d84168 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSTSList writes a list of values of the 'STS' type to +// the given writer. +func MarshalSTSList(list []*STS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSTSList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSTSList writes a list of value of the 'STS' type to +// the given stream. +func WriteSTSList(list []*STS, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSTS(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSTSList reads a list of values of the 'STS' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSTSList(source interface{}) (items []*STS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSTSList(iterator) + err = iterator.Error + return +} + +// ReadSTSList reads list of values of the ”STS' type from +// the given iterator. +func ReadSTSList(iterator *jsoniter.Iterator) []*STS { + list := []*STS{} + for iterator.ReadArray() { + item := ReadSTS(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/sts_operator_builder.go b/clientapi/clustersmgmt/v1/sts_operator_builder.go new file mode 100644 index 00000000..372f61d2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_operator_builder.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// STSOperatorBuilder contains the data and logic needed to build 'STS_operator' objects. +// +// Representation of an sts operator +type STSOperatorBuilder struct { + bitmap_ uint32 + maxVersion string + minVersion string + name string + namespace string + serviceAccounts []string +} + +// NewSTSOperator creates a new builder of 'STS_operator' objects. +func NewSTSOperator() *STSOperatorBuilder { + return &STSOperatorBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *STSOperatorBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// MaxVersion sets the value of the 'max_version' attribute to the given value. +func (b *STSOperatorBuilder) MaxVersion(value string) *STSOperatorBuilder { + b.maxVersion = value + b.bitmap_ |= 1 + return b +} + +// MinVersion sets the value of the 'min_version' attribute to the given value. +func (b *STSOperatorBuilder) MinVersion(value string) *STSOperatorBuilder { + b.minVersion = value + b.bitmap_ |= 2 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *STSOperatorBuilder) Name(value string) *STSOperatorBuilder { + b.name = value + b.bitmap_ |= 4 + return b +} + +// Namespace sets the value of the 'namespace' attribute to the given value. +func (b *STSOperatorBuilder) Namespace(value string) *STSOperatorBuilder { + b.namespace = value + b.bitmap_ |= 8 + return b +} + +// ServiceAccounts sets the value of the 'service_accounts' attribute to the given values. +func (b *STSOperatorBuilder) ServiceAccounts(values ...string) *STSOperatorBuilder { + b.serviceAccounts = make([]string, len(values)) + copy(b.serviceAccounts, values) + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *STSOperatorBuilder) Copy(object *STSOperator) *STSOperatorBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.maxVersion = object.maxVersion + b.minVersion = object.minVersion + b.name = object.name + b.namespace = object.namespace + if object.serviceAccounts != nil { + b.serviceAccounts = make([]string, len(object.serviceAccounts)) + copy(b.serviceAccounts, object.serviceAccounts) + } else { + b.serviceAccounts = nil + } + return b +} + +// Build creates a 'STS_operator' object using the configuration stored in the builder. +func (b *STSOperatorBuilder) Build() (object *STSOperator, err error) { + object = new(STSOperator) + object.bitmap_ = b.bitmap_ + object.maxVersion = b.maxVersion + object.minVersion = b.minVersion + object.name = b.name + object.namespace = b.namespace + if b.serviceAccounts != nil { + object.serviceAccounts = make([]string, len(b.serviceAccounts)) + copy(object.serviceAccounts, b.serviceAccounts) + } + return +} diff --git a/clientapi/clustersmgmt/v1/sts_operator_list_builder.go b/clientapi/clustersmgmt/v1/sts_operator_list_builder.go new file mode 100644 index 00000000..d62f7cfb --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_operator_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// STSOperatorListBuilder contains the data and logic needed to build +// 'STS_operator' objects. +type STSOperatorListBuilder struct { + items []*STSOperatorBuilder +} + +// NewSTSOperatorList creates a new builder of 'STS_operator' objects. +func NewSTSOperatorList() *STSOperatorListBuilder { + return new(STSOperatorListBuilder) +} + +// Items sets the items of the list. +func (b *STSOperatorListBuilder) Items(values ...*STSOperatorBuilder) *STSOperatorListBuilder { + b.items = make([]*STSOperatorBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *STSOperatorListBuilder) 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 *STSOperatorListBuilder) Copy(list *STSOperatorList) *STSOperatorListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*STSOperatorBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSTSOperator().Copy(v) + } + } + return b +} + +// Build creates a list of 'STS_operator' objects using the +// configuration stored in the builder. +func (b *STSOperatorListBuilder) Build() (list *STSOperatorList, err error) { + items := make([]*STSOperator, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(STSOperatorList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/sts_operator_list_type_json.go b/clientapi/clustersmgmt/v1/sts_operator_list_type_json.go new file mode 100644 index 00000000..baa05c43 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_operator_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSTSOperatorList writes a list of values of the 'STS_operator' type to +// the given writer. +func MarshalSTSOperatorList(list []*STSOperator, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSTSOperatorList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSTSOperatorList writes a list of value of the 'STS_operator' type to +// the given stream. +func WriteSTSOperatorList(list []*STSOperator, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSTSOperator(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSTSOperatorList reads a list of values of the 'STS_operator' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSTSOperatorList(source interface{}) (items []*STSOperator, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSTSOperatorList(iterator) + err = iterator.Error + return +} + +// ReadSTSOperatorList reads list of values of the ”STS_operator' type from +// the given iterator. +func ReadSTSOperatorList(iterator *jsoniter.Iterator) []*STSOperator { + list := []*STSOperator{} + for iterator.ReadArray() { + item := ReadSTSOperator(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/sts_operator_type.go b/clientapi/clustersmgmt/v1/sts_operator_type.go new file mode 100644 index 00000000..c87c6026 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_operator_type.go @@ -0,0 +1,261 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// STSOperator represents the values of the 'STS_operator' type. +// +// Representation of an sts operator +type STSOperator struct { + bitmap_ uint32 + maxVersion string + minVersion string + name string + namespace string + serviceAccounts []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *STSOperator) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// MaxVersion returns the value of the 'max_version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Maximum ocp version supported +func (o *STSOperator) MaxVersion() string { + if o != nil && o.bitmap_&1 != 0 { + return o.maxVersion + } + return "" +} + +// GetMaxVersion returns the value of the 'max_version' attribute and +// a flag indicating if the attribute has a value. +// +// Maximum ocp version supported +func (o *STSOperator) GetMaxVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.maxVersion + } + return +} + +// MinVersion returns the value of the 'min_version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Minimum ocp version supported +func (o *STSOperator) MinVersion() string { + if o != nil && o.bitmap_&2 != 0 { + return o.minVersion + } + return "" +} + +// GetMinVersion returns the value of the 'min_version' attribute and +// a flag indicating if the attribute has a value. +// +// Minimum ocp version supported +func (o *STSOperator) GetMinVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.minVersion + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Operator Name +func (o *STSOperator) Name() string { + if o != nil && o.bitmap_&4 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Operator Name +func (o *STSOperator) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.name + } + return +} + +// Namespace returns the value of the 'namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Operator Namespace +func (o *STSOperator) Namespace() string { + if o != nil && o.bitmap_&8 != 0 { + return o.namespace + } + return "" +} + +// GetNamespace returns the value of the 'namespace' attribute and +// a flag indicating if the attribute has a value. +// +// Operator Namespace +func (o *STSOperator) GetNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.namespace + } + return +} + +// ServiceAccounts returns the value of the 'service_accounts' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Service Accounts +func (o *STSOperator) ServiceAccounts() []string { + if o != nil && o.bitmap_&16 != 0 { + return o.serviceAccounts + } + return nil +} + +// GetServiceAccounts returns the value of the 'service_accounts' attribute and +// a flag indicating if the attribute has a value. +// +// Service Accounts +func (o *STSOperator) GetServiceAccounts() (value []string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.serviceAccounts + } + return +} + +// STSOperatorListKind is the name of the type used to represent list of objects of +// type 'STS_operator'. +const STSOperatorListKind = "STSOperatorList" + +// STSOperatorListLinkKind is the name of the type used to represent links to list +// of objects of type 'STS_operator'. +const STSOperatorListLinkKind = "STSOperatorListLink" + +// STSOperatorNilKind is the name of the type used to nil lists of objects of +// type 'STS_operator'. +const STSOperatorListNilKind = "STSOperatorListNil" + +// STSOperatorList is a list of values of the 'STS_operator' type. +type STSOperatorList struct { + href string + link bool + items []*STSOperator +} + +// Len returns the length of the list. +func (l *STSOperatorList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *STSOperatorList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *STSOperatorList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *STSOperatorList) SetItems(items []*STSOperator) { + l.items = items +} + +// Items returns the items of the list. +func (l *STSOperatorList) Items() []*STSOperator { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *STSOperatorList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *STSOperatorList) Get(i int) *STSOperator { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *STSOperatorList) Slice() []*STSOperator { + var slice []*STSOperator + if l == nil { + slice = make([]*STSOperator, 0) + } else { + slice = make([]*STSOperator, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *STSOperatorList) Each(f func(item *STSOperator) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *STSOperatorList) Range(f func(index int, item *STSOperator) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/sts_operator_type_json.go b/clientapi/clustersmgmt/v1/sts_operator_type_json.go new file mode 100644 index 00000000..5c509068 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_operator_type_json.go @@ -0,0 +1,138 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSTSOperator writes a value of the 'STS_operator' type to the given writer. +func MarshalSTSOperator(object *STSOperator, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSTSOperator(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSTSOperator writes a value of the 'STS_operator' type to the given stream. +func WriteSTSOperator(object *STSOperator, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_version") + stream.WriteString(object.maxVersion) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("min_version") + stream.WriteString(object.minVersion) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("namespace") + stream.WriteString(object.namespace) + count++ + } + present_ = object.bitmap_&16 != 0 && object.serviceAccounts != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_accounts") + WriteStringList(object.serviceAccounts, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalSTSOperator reads a value of the 'STS_operator' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSTSOperator(source interface{}) (object *STSOperator, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSTSOperator(iterator) + err = iterator.Error + return +} + +// ReadSTSOperator reads a value of the 'STS_operator' type from the given iterator. +func ReadSTSOperator(iterator *jsoniter.Iterator) *STSOperator { + object := &STSOperator{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "max_version": + value := iterator.ReadString() + object.maxVersion = value + object.bitmap_ |= 1 + case "min_version": + value := iterator.ReadString() + object.minVersion = value + object.bitmap_ |= 2 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 4 + case "namespace": + value := iterator.ReadString() + object.namespace = value + object.bitmap_ |= 8 + case "service_accounts": + value := ReadStringList(iterator) + object.serviceAccounts = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/sts_support_jump_role_builder.go b/clientapi/clustersmgmt/v1/sts_support_jump_role_builder.go new file mode 100644 index 00000000..36575c7d --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_support_jump_role_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// StsSupportJumpRoleBuilder contains the data and logic needed to build 'sts_support_jump_role' objects. +// +// Isolated STS support role created per organization. +type StsSupportJumpRoleBuilder struct { + bitmap_ uint32 + roleArn string +} + +// NewStsSupportJumpRole creates a new builder of 'sts_support_jump_role' objects. +func NewStsSupportJumpRole() *StsSupportJumpRoleBuilder { + return &StsSupportJumpRoleBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *StsSupportJumpRoleBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// RoleArn sets the value of the 'role_arn' attribute to the given value. +func (b *StsSupportJumpRoleBuilder) RoleArn(value string) *StsSupportJumpRoleBuilder { + b.roleArn = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *StsSupportJumpRoleBuilder) Copy(object *StsSupportJumpRole) *StsSupportJumpRoleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.roleArn = object.roleArn + return b +} + +// Build creates a 'sts_support_jump_role' object using the configuration stored in the builder. +func (b *StsSupportJumpRoleBuilder) Build() (object *StsSupportJumpRole, err error) { + object = new(StsSupportJumpRole) + object.bitmap_ = b.bitmap_ + object.roleArn = b.roleArn + return +} diff --git a/clientapi/clustersmgmt/v1/sts_support_jump_role_list_builder.go b/clientapi/clustersmgmt/v1/sts_support_jump_role_list_builder.go new file mode 100644 index 00000000..37b0d267 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_support_jump_role_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// StsSupportJumpRoleListBuilder contains the data and logic needed to build +// 'sts_support_jump_role' objects. +type StsSupportJumpRoleListBuilder struct { + items []*StsSupportJumpRoleBuilder +} + +// NewStsSupportJumpRoleList creates a new builder of 'sts_support_jump_role' objects. +func NewStsSupportJumpRoleList() *StsSupportJumpRoleListBuilder { + return new(StsSupportJumpRoleListBuilder) +} + +// Items sets the items of the list. +func (b *StsSupportJumpRoleListBuilder) Items(values ...*StsSupportJumpRoleBuilder) *StsSupportJumpRoleListBuilder { + b.items = make([]*StsSupportJumpRoleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *StsSupportJumpRoleListBuilder) 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 *StsSupportJumpRoleListBuilder) Copy(list *StsSupportJumpRoleList) *StsSupportJumpRoleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*StsSupportJumpRoleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewStsSupportJumpRole().Copy(v) + } + } + return b +} + +// Build creates a list of 'sts_support_jump_role' objects using the +// configuration stored in the builder. +func (b *StsSupportJumpRoleListBuilder) Build() (list *StsSupportJumpRoleList, err error) { + items := make([]*StsSupportJumpRole, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(StsSupportJumpRoleList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/sts_support_jump_role_list_type_json.go b/clientapi/clustersmgmt/v1/sts_support_jump_role_list_type_json.go new file mode 100644 index 00000000..1979b6f0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_support_jump_role_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStsSupportJumpRoleList writes a list of values of the 'sts_support_jump_role' type to +// the given writer. +func MarshalStsSupportJumpRoleList(list []*StsSupportJumpRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStsSupportJumpRoleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStsSupportJumpRoleList writes a list of value of the 'sts_support_jump_role' type to +// the given stream. +func WriteStsSupportJumpRoleList(list []*StsSupportJumpRole, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteStsSupportJumpRole(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalStsSupportJumpRoleList reads a list of values of the 'sts_support_jump_role' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStsSupportJumpRoleList(source interface{}) (items []*StsSupportJumpRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStsSupportJumpRoleList(iterator) + err = iterator.Error + return +} + +// ReadStsSupportJumpRoleList reads list of values of the ”sts_support_jump_role' type from +// the given iterator. +func ReadStsSupportJumpRoleList(iterator *jsoniter.Iterator) []*StsSupportJumpRole { + list := []*StsSupportJumpRole{} + for iterator.ReadArray() { + item := ReadStsSupportJumpRole(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/sts_support_jump_role_type.go b/clientapi/clustersmgmt/v1/sts_support_jump_role_type.go new file mode 100644 index 00000000..73d84b81 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_support_jump_role_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// StsSupportJumpRole represents the values of the 'sts_support_jump_role' type. +// +// Isolated STS support role created per organization. +type StsSupportJumpRole struct { + bitmap_ uint32 + roleArn string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *StsSupportJumpRole) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// RoleArn returns the value of the 'role_arn' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN of the support role created in the SRE jump account. +func (o *StsSupportJumpRole) RoleArn() string { + if o != nil && o.bitmap_&1 != 0 { + return o.roleArn + } + return "" +} + +// GetRoleArn returns the value of the 'role_arn' attribute and +// a flag indicating if the attribute has a value. +// +// ARN of the support role created in the SRE jump account. +func (o *StsSupportJumpRole) GetRoleArn() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.roleArn + } + return +} + +// StsSupportJumpRoleListKind is the name of the type used to represent list of objects of +// type 'sts_support_jump_role'. +const StsSupportJumpRoleListKind = "StsSupportJumpRoleList" + +// StsSupportJumpRoleListLinkKind is the name of the type used to represent links to list +// of objects of type 'sts_support_jump_role'. +const StsSupportJumpRoleListLinkKind = "StsSupportJumpRoleListLink" + +// StsSupportJumpRoleNilKind is the name of the type used to nil lists of objects of +// type 'sts_support_jump_role'. +const StsSupportJumpRoleListNilKind = "StsSupportJumpRoleListNil" + +// StsSupportJumpRoleList is a list of values of the 'sts_support_jump_role' type. +type StsSupportJumpRoleList struct { + href string + link bool + items []*StsSupportJumpRole +} + +// Len returns the length of the list. +func (l *StsSupportJumpRoleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *StsSupportJumpRoleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *StsSupportJumpRoleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *StsSupportJumpRoleList) SetItems(items []*StsSupportJumpRole) { + l.items = items +} + +// Items returns the items of the list. +func (l *StsSupportJumpRoleList) Items() []*StsSupportJumpRole { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *StsSupportJumpRoleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *StsSupportJumpRoleList) Get(i int) *StsSupportJumpRole { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *StsSupportJumpRoleList) Slice() []*StsSupportJumpRole { + var slice []*StsSupportJumpRole + if l == nil { + slice = make([]*StsSupportJumpRole, 0) + } else { + slice = make([]*StsSupportJumpRole, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *StsSupportJumpRoleList) Each(f func(item *StsSupportJumpRole) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *StsSupportJumpRoleList) Range(f func(index int, item *StsSupportJumpRole) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/sts_support_jump_role_type_json.go b/clientapi/clustersmgmt/v1/sts_support_jump_role_type_json.go new file mode 100644 index 00000000..f468e89e --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_support_jump_role_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStsSupportJumpRole writes a value of the 'sts_support_jump_role' type to the given writer. +func MarshalStsSupportJumpRole(object *StsSupportJumpRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStsSupportJumpRole(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStsSupportJumpRole writes a value of the 'sts_support_jump_role' type to the given stream. +func WriteStsSupportJumpRole(object *StsSupportJumpRole, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role_arn") + stream.WriteString(object.roleArn) + } + stream.WriteObjectEnd() +} + +// UnmarshalStsSupportJumpRole reads a value of the 'sts_support_jump_role' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalStsSupportJumpRole(source interface{}) (object *StsSupportJumpRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadStsSupportJumpRole(iterator) + err = iterator.Error + return +} + +// ReadStsSupportJumpRole reads a value of the 'sts_support_jump_role' type from the given iterator. +func ReadStsSupportJumpRole(iterator *jsoniter.Iterator) *StsSupportJumpRole { + object := &StsSupportJumpRole{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "role_arn": + value := iterator.ReadString() + object.roleArn = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/sts_type.go b/clientapi/clustersmgmt/v1/sts_type.go new file mode 100644 index 00000000..7b1b3b6a --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_type.go @@ -0,0 +1,429 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// STS represents the values of the 'STS' type. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type STS struct { + bitmap_ uint32 + oidcEndpointURL string + externalID string + instanceIAMRoles *InstanceIAMRoles + oidcConfig *OidcConfig + operatorIAMRoles []*OperatorIAMRole + operatorRolePrefix string + permissionBoundary string + roleARN string + supportRoleARN string + autoMode bool + enabled bool + managedPolicies bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *STS) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// OIDCEndpointURL returns the value of the 'OIDC_endpoint_URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// URL of the location where OIDC configuration and keys are available +func (o *STS) OIDCEndpointURL() string { + if o != nil && o.bitmap_&1 != 0 { + return o.oidcEndpointURL + } + return "" +} + +// GetOIDCEndpointURL returns the value of the 'OIDC_endpoint_URL' attribute and +// a flag indicating if the attribute has a value. +// +// URL of the location where OIDC configuration and keys are available +func (o *STS) GetOIDCEndpointURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.oidcEndpointURL + } + return +} + +// AutoMode returns the value of the 'auto_mode' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Auto creation mode for cluster - OCM will create the operator roles and OIDC provider. false by default. +func (o *STS) AutoMode() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.autoMode + } + return false +} + +// GetAutoMode returns the value of the 'auto_mode' attribute and +// a flag indicating if the attribute has a value. +// +// Auto creation mode for cluster - OCM will create the operator roles and OIDC provider. false by default. +func (o *STS) GetAutoMode() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.autoMode + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// If STS is enabled or disabled +func (o *STS) Enabled() bool { + if o != nil && o.bitmap_&4 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// If STS is enabled or disabled +func (o *STS) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.enabled + } + return +} + +// ExternalID returns the value of the 'external_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional unique identifier when assuming role in another account +func (o *STS) ExternalID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.externalID + } + return "" +} + +// GetExternalID returns the value of the 'external_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Optional unique identifier when assuming role in another account +func (o *STS) GetExternalID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.externalID + } + return +} + +// InstanceIAMRoles returns the value of the 'instance_IAM_roles' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Instance IAM roles to use for the instance profiles of the master and worker instances +func (o *STS) InstanceIAMRoles() *InstanceIAMRoles { + if o != nil && o.bitmap_&16 != 0 { + return o.instanceIAMRoles + } + return nil +} + +// GetInstanceIAMRoles returns the value of the 'instance_IAM_roles' attribute and +// a flag indicating if the attribute has a value. +// +// Instance IAM roles to use for the instance profiles of the master and worker instances +func (o *STS) GetInstanceIAMRoles() (value *InstanceIAMRoles, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.instanceIAMRoles + } + return +} + +// ManagedPolicies returns the value of the 'managed_policies' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// If true, cluster account and operator roles have managed policies attached. +func (o *STS) ManagedPolicies() bool { + if o != nil && o.bitmap_&32 != 0 { + return o.managedPolicies + } + return false +} + +// GetManagedPolicies returns the value of the 'managed_policies' attribute and +// a flag indicating if the attribute has a value. +// +// If true, cluster account and operator roles have managed policies attached. +func (o *STS) GetManagedPolicies() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.managedPolicies + } + return +} + +// OidcConfig returns the value of the 'oidc_config' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Registered Oidc Config, if available holds information related to the oidc config. +func (o *STS) OidcConfig() *OidcConfig { + if o != nil && o.bitmap_&64 != 0 { + return o.oidcConfig + } + return nil +} + +// GetOidcConfig returns the value of the 'oidc_config' attribute and +// a flag indicating if the attribute has a value. +// +// Registered Oidc Config, if available holds information related to the oidc config. +func (o *STS) GetOidcConfig() (value *OidcConfig, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.oidcConfig + } + return +} + +// OperatorIAMRoles returns the value of the 'operator_IAM_roles' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of roles necessary to access the AWS resources of the various operators used during installation +func (o *STS) OperatorIAMRoles() []*OperatorIAMRole { + if o != nil && o.bitmap_&128 != 0 { + return o.operatorIAMRoles + } + return nil +} + +// GetOperatorIAMRoles returns the value of the 'operator_IAM_roles' attribute and +// a flag indicating if the attribute has a value. +// +// List of roles necessary to access the AWS resources of the various operators used during installation +func (o *STS) GetOperatorIAMRoles() (value []*OperatorIAMRole, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.operatorIAMRoles + } + return +} + +// OperatorRolePrefix returns the value of the 'operator_role_prefix' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional user provided prefix for operator roles. +func (o *STS) OperatorRolePrefix() string { + if o != nil && o.bitmap_&256 != 0 { + return o.operatorRolePrefix + } + return "" +} + +// GetOperatorRolePrefix returns the value of the 'operator_role_prefix' attribute and +// a flag indicating if the attribute has a value. +// +// Optional user provided prefix for operator roles. +func (o *STS) GetOperatorRolePrefix() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.operatorRolePrefix + } + return +} + +// PermissionBoundary returns the value of the 'permission_boundary' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional user provided permission boundary. +func (o *STS) PermissionBoundary() string { + if o != nil && o.bitmap_&512 != 0 { + return o.permissionBoundary + } + return "" +} + +// GetPermissionBoundary returns the value of the 'permission_boundary' attribute and +// a flag indicating if the attribute has a value. +// +// Optional user provided permission boundary. +func (o *STS) GetPermissionBoundary() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.permissionBoundary + } + return +} + +// RoleARN returns the value of the 'role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN of the AWS role to assume when installing the cluster +func (o *STS) RoleARN() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.roleARN + } + return "" +} + +// GetRoleARN returns the value of the 'role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// ARN of the AWS role to assume when installing the cluster +func (o *STS) GetRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.roleARN + } + return +} + +// SupportRoleARN returns the value of the 'support_role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN of the AWS role used by SREs to access the cluster AWS account in order to provide support +func (o *STS) SupportRoleARN() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.supportRoleARN + } + return "" +} + +// GetSupportRoleARN returns the value of the 'support_role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// ARN of the AWS role used by SREs to access the cluster AWS account in order to provide support +func (o *STS) GetSupportRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.supportRoleARN + } + return +} + +// STSListKind is the name of the type used to represent list of objects of +// type 'STS'. +const STSListKind = "STSList" + +// STSListLinkKind is the name of the type used to represent links to list +// of objects of type 'STS'. +const STSListLinkKind = "STSListLink" + +// STSNilKind is the name of the type used to nil lists of objects of +// type 'STS'. +const STSListNilKind = "STSListNil" + +// STSList is a list of values of the 'STS' type. +type STSList struct { + href string + link bool + items []*STS +} + +// Len returns the length of the list. +func (l *STSList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *STSList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *STSList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *STSList) SetItems(items []*STS) { + l.items = items +} + +// Items returns the items of the list. +func (l *STSList) Items() []*STS { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *STSList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *STSList) Get(i int) *STS { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *STSList) Slice() []*STS { + var slice []*STS + if l == nil { + slice = make([]*STS, 0) + } else { + slice = make([]*STS, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *STSList) Each(f func(item *STS) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *STSList) Range(f func(index int, item *STS) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/sts_type_json.go b/clientapi/clustersmgmt/v1/sts_type_json.go new file mode 100644 index 00000000..411640f4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/sts_type_json.go @@ -0,0 +1,229 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSTS writes a value of the 'STS' type to the given writer. +func MarshalSTS(object *STS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSTS(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSTS writes a value of the 'STS' type to the given stream. +func WriteSTS(object *STS, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("oidc_endpoint_url") + stream.WriteString(object.oidcEndpointURL) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("auto_mode") + stream.WriteBool(object.autoMode) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_id") + stream.WriteString(object.externalID) + count++ + } + present_ = object.bitmap_&16 != 0 && object.instanceIAMRoles != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("instance_iam_roles") + WriteInstanceIAMRoles(object.instanceIAMRoles, stream) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("managed_policies") + stream.WriteBool(object.managedPolicies) + count++ + } + present_ = object.bitmap_&64 != 0 && object.oidcConfig != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("oidc_config") + WriteOidcConfig(object.oidcConfig, stream) + count++ + } + present_ = object.bitmap_&128 != 0 && object.operatorIAMRoles != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_iam_roles") + WriteOperatorIAMRoleList(object.operatorIAMRoles, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_role_prefix") + stream.WriteString(object.operatorRolePrefix) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("permission_boundary") + stream.WriteString(object.permissionBoundary) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role_arn") + stream.WriteString(object.roleARN) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("support_role_arn") + stream.WriteString(object.supportRoleARN) + } + stream.WriteObjectEnd() +} + +// UnmarshalSTS reads a value of the 'STS' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSTS(source interface{}) (object *STS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSTS(iterator) + err = iterator.Error + return +} + +// ReadSTS reads a value of the 'STS' type from the given iterator. +func ReadSTS(iterator *jsoniter.Iterator) *STS { + object := &STS{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "oidc_endpoint_url": + value := iterator.ReadString() + object.oidcEndpointURL = value + object.bitmap_ |= 1 + case "auto_mode": + value := iterator.ReadBool() + object.autoMode = value + object.bitmap_ |= 2 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 4 + case "external_id": + value := iterator.ReadString() + object.externalID = value + object.bitmap_ |= 8 + case "instance_iam_roles": + value := ReadInstanceIAMRoles(iterator) + object.instanceIAMRoles = value + object.bitmap_ |= 16 + case "managed_policies": + value := iterator.ReadBool() + object.managedPolicies = value + object.bitmap_ |= 32 + case "oidc_config": + value := ReadOidcConfig(iterator) + object.oidcConfig = value + object.bitmap_ |= 64 + case "operator_iam_roles": + value := ReadOperatorIAMRoleList(iterator) + object.operatorIAMRoles = value + object.bitmap_ |= 128 + case "operator_role_prefix": + value := iterator.ReadString() + object.operatorRolePrefix = value + object.bitmap_ |= 256 + case "permission_boundary": + value := iterator.ReadString() + object.permissionBoundary = value + object.bitmap_ |= 512 + case "role_arn": + value := iterator.ReadString() + object.roleARN = value + object.bitmap_ |= 1024 + case "support_role_arn": + value := iterator.ReadString() + object.supportRoleARN = value + object.bitmap_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/subnet_network_verification_builder.go b/clientapi/clustersmgmt/v1/subnet_network_verification_builder.go new file mode 100644 index 00000000..9ad21ce8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/subnet_network_verification_builder.go @@ -0,0 +1,144 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SubnetNetworkVerificationBuilder contains the data and logic needed to build 'subnet_network_verification' objects. +type SubnetNetworkVerificationBuilder struct { + bitmap_ uint32 + id string + href string + details []string + platform Platform + state string + tags map[string]string +} + +// NewSubnetNetworkVerification creates a new builder of 'subnet_network_verification' objects. +func NewSubnetNetworkVerification() *SubnetNetworkVerificationBuilder { + return &SubnetNetworkVerificationBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *SubnetNetworkVerificationBuilder) Link(value bool) *SubnetNetworkVerificationBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *SubnetNetworkVerificationBuilder) ID(value string) *SubnetNetworkVerificationBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *SubnetNetworkVerificationBuilder) HREF(value string) *SubnetNetworkVerificationBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SubnetNetworkVerificationBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Details sets the value of the 'details' attribute to the given values. +func (b *SubnetNetworkVerificationBuilder) Details(values ...string) *SubnetNetworkVerificationBuilder { + b.details = make([]string, len(values)) + copy(b.details, values) + b.bitmap_ |= 8 + return b +} + +// Platform sets the value of the 'platform' attribute to the given value. +// +// Representation of an platform type field. +func (b *SubnetNetworkVerificationBuilder) Platform(value Platform) *SubnetNetworkVerificationBuilder { + b.platform = value + b.bitmap_ |= 16 + return b +} + +// State sets the value of the 'state' attribute to the given value. +func (b *SubnetNetworkVerificationBuilder) State(value string) *SubnetNetworkVerificationBuilder { + b.state = value + b.bitmap_ |= 32 + return b +} + +// Tags sets the value of the 'tags' attribute to the given value. +func (b *SubnetNetworkVerificationBuilder) Tags(value map[string]string) *SubnetNetworkVerificationBuilder { + b.tags = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SubnetNetworkVerificationBuilder) Copy(object *SubnetNetworkVerification) *SubnetNetworkVerificationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.details != nil { + b.details = make([]string, len(object.details)) + copy(b.details, object.details) + } else { + b.details = nil + } + b.platform = object.platform + b.state = object.state + if len(object.tags) > 0 { + b.tags = map[string]string{} + for k, v := range object.tags { + b.tags[k] = v + } + } else { + b.tags = nil + } + return b +} + +// Build creates a 'subnet_network_verification' object using the configuration stored in the builder. +func (b *SubnetNetworkVerificationBuilder) Build() (object *SubnetNetworkVerification, err error) { + object = new(SubnetNetworkVerification) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.details != nil { + object.details = make([]string, len(b.details)) + copy(object.details, b.details) + } + object.platform = b.platform + object.state = b.state + if b.tags != nil { + object.tags = make(map[string]string) + for k, v := range b.tags { + object.tags[k] = v + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/subnet_network_verification_list_builder.go b/clientapi/clustersmgmt/v1/subnet_network_verification_list_builder.go new file mode 100644 index 00000000..84c75d32 --- /dev/null +++ b/clientapi/clustersmgmt/v1/subnet_network_verification_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SubnetNetworkVerificationListBuilder contains the data and logic needed to build +// 'subnet_network_verification' objects. +type SubnetNetworkVerificationListBuilder struct { + items []*SubnetNetworkVerificationBuilder +} + +// NewSubnetNetworkVerificationList creates a new builder of 'subnet_network_verification' objects. +func NewSubnetNetworkVerificationList() *SubnetNetworkVerificationListBuilder { + return new(SubnetNetworkVerificationListBuilder) +} + +// Items sets the items of the list. +func (b *SubnetNetworkVerificationListBuilder) Items(values ...*SubnetNetworkVerificationBuilder) *SubnetNetworkVerificationListBuilder { + b.items = make([]*SubnetNetworkVerificationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SubnetNetworkVerificationListBuilder) 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 *SubnetNetworkVerificationListBuilder) Copy(list *SubnetNetworkVerificationList) *SubnetNetworkVerificationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SubnetNetworkVerificationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSubnetNetworkVerification().Copy(v) + } + } + return b +} + +// Build creates a list of 'subnet_network_verification' objects using the +// configuration stored in the builder. +func (b *SubnetNetworkVerificationListBuilder) Build() (list *SubnetNetworkVerificationList, err error) { + items := make([]*SubnetNetworkVerification, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SubnetNetworkVerificationList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/subnet_network_verification_list_type_json.go b/clientapi/clustersmgmt/v1/subnet_network_verification_list_type_json.go new file mode 100644 index 00000000..5874677a --- /dev/null +++ b/clientapi/clustersmgmt/v1/subnet_network_verification_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSubnetNetworkVerificationList writes a list of values of the 'subnet_network_verification' type to +// the given writer. +func MarshalSubnetNetworkVerificationList(list []*SubnetNetworkVerification, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSubnetNetworkVerificationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSubnetNetworkVerificationList writes a list of value of the 'subnet_network_verification' type to +// the given stream. +func WriteSubnetNetworkVerificationList(list []*SubnetNetworkVerification, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSubnetNetworkVerification(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSubnetNetworkVerificationList reads a list of values of the 'subnet_network_verification' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSubnetNetworkVerificationList(source interface{}) (items []*SubnetNetworkVerification, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSubnetNetworkVerificationList(iterator) + err = iterator.Error + return +} + +// ReadSubnetNetworkVerificationList reads list of values of the ”subnet_network_verification' type from +// the given iterator. +func ReadSubnetNetworkVerificationList(iterator *jsoniter.Iterator) []*SubnetNetworkVerification { + list := []*SubnetNetworkVerification{} + for iterator.ReadArray() { + item := ReadSubnetNetworkVerification(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/subnet_network_verification_type.go b/clientapi/clustersmgmt/v1/subnet_network_verification_type.go new file mode 100644 index 00000000..8bc0a0e8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/subnet_network_verification_type.go @@ -0,0 +1,335 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SubnetNetworkVerificationKind is the name of the type used to represent objects +// of type 'subnet_network_verification'. +const SubnetNetworkVerificationKind = "SubnetNetworkVerification" + +// SubnetNetworkVerificationLinkKind is the name of the type used to represent links +// to objects of type 'subnet_network_verification'. +const SubnetNetworkVerificationLinkKind = "SubnetNetworkVerificationLink" + +// SubnetNetworkVerificationNilKind is the name of the type used to nil references +// to objects of type 'subnet_network_verification'. +const SubnetNetworkVerificationNilKind = "SubnetNetworkVerificationNil" + +// SubnetNetworkVerification represents the values of the 'subnet_network_verification' type. +type SubnetNetworkVerification struct { + bitmap_ uint32 + id string + href string + details []string + platform Platform + state string + tags map[string]string +} + +// Kind returns the name of the type of the object. +func (o *SubnetNetworkVerification) Kind() string { + if o == nil { + return SubnetNetworkVerificationNilKind + } + if o.bitmap_&1 != 0 { + return SubnetNetworkVerificationLinkKind + } + return SubnetNetworkVerificationKind +} + +// Link returns true if this is a link. +func (o *SubnetNetworkVerification) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *SubnetNetworkVerification) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *SubnetNetworkVerification) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *SubnetNetworkVerification) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *SubnetNetworkVerification) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *SubnetNetworkVerification) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Details returns the value of the 'details' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Slice of failures that happened during a subnet network verification. +func (o *SubnetNetworkVerification) Details() []string { + if o != nil && o.bitmap_&8 != 0 { + return o.details + } + return nil +} + +// GetDetails returns the value of the 'details' attribute and +// a flag indicating if the attribute has a value. +// +// Slice of failures that happened during a subnet network verification. +func (o *SubnetNetworkVerification) GetDetails() (value []string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.details + } + return +} + +// Platform returns the value of the 'platform' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Platform supplied to the network verifier for this subnet. +func (o *SubnetNetworkVerification) Platform() Platform { + if o != nil && o.bitmap_&16 != 0 { + return o.platform + } + return Platform("") +} + +// GetPlatform returns the value of the 'platform' attribute and +// a flag indicating if the attribute has a value. +// +// Platform supplied to the network verifier for this subnet. +func (o *SubnetNetworkVerification) GetPlatform() (value Platform, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.platform + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// State of the subnet network verification. +func (o *SubnetNetworkVerification) State() string { + if o != nil && o.bitmap_&32 != 0 { + return o.state + } + return "" +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +// +// State of the subnet network verification. +func (o *SubnetNetworkVerification) GetState() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.state + } + return +} + +// Tags returns the value of the 'tags' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Tags supplied to the network verifier for this subnet. +func (o *SubnetNetworkVerification) Tags() map[string]string { + if o != nil && o.bitmap_&64 != 0 { + return o.tags + } + return nil +} + +// GetTags returns the value of the 'tags' attribute and +// a flag indicating if the attribute has a value. +// +// Tags supplied to the network verifier for this subnet. +func (o *SubnetNetworkVerification) GetTags() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.tags + } + return +} + +// SubnetNetworkVerificationListKind is the name of the type used to represent list of objects of +// type 'subnet_network_verification'. +const SubnetNetworkVerificationListKind = "SubnetNetworkVerificationList" + +// SubnetNetworkVerificationListLinkKind is the name of the type used to represent links to list +// of objects of type 'subnet_network_verification'. +const SubnetNetworkVerificationListLinkKind = "SubnetNetworkVerificationListLink" + +// SubnetNetworkVerificationNilKind is the name of the type used to nil lists of objects of +// type 'subnet_network_verification'. +const SubnetNetworkVerificationListNilKind = "SubnetNetworkVerificationListNil" + +// SubnetNetworkVerificationList is a list of values of the 'subnet_network_verification' type. +type SubnetNetworkVerificationList struct { + href string + link bool + items []*SubnetNetworkVerification +} + +// Kind returns the name of the type of the object. +func (l *SubnetNetworkVerificationList) Kind() string { + if l == nil { + return SubnetNetworkVerificationListNilKind + } + if l.link { + return SubnetNetworkVerificationListLinkKind + } + return SubnetNetworkVerificationListKind +} + +// Link returns true iif this is a link. +func (l *SubnetNetworkVerificationList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *SubnetNetworkVerificationList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *SubnetNetworkVerificationList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *SubnetNetworkVerificationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SubnetNetworkVerificationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SubnetNetworkVerificationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SubnetNetworkVerificationList) SetItems(items []*SubnetNetworkVerification) { + l.items = items +} + +// Items returns the items of the list. +func (l *SubnetNetworkVerificationList) Items() []*SubnetNetworkVerification { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SubnetNetworkVerificationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SubnetNetworkVerificationList) Get(i int) *SubnetNetworkVerification { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SubnetNetworkVerificationList) Slice() []*SubnetNetworkVerification { + var slice []*SubnetNetworkVerification + if l == nil { + slice = make([]*SubnetNetworkVerification, 0) + } else { + slice = make([]*SubnetNetworkVerification, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SubnetNetworkVerificationList) Each(f func(item *SubnetNetworkVerification) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SubnetNetworkVerificationList) Range(f func(index int, item *SubnetNetworkVerification) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/subnet_network_verification_type_json.go b/clientapi/clustersmgmt/v1/subnet_network_verification_type_json.go new file mode 100644 index 00000000..05eb29a1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/subnet_network_verification_type_json.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSubnetNetworkVerification writes a value of the 'subnet_network_verification' type to the given writer. +func MarshalSubnetNetworkVerification(object *SubnetNetworkVerification, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSubnetNetworkVerification(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSubnetNetworkVerification writes a value of the 'subnet_network_verification' type to the given stream. +func WriteSubnetNetworkVerification(object *SubnetNetworkVerification, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(SubnetNetworkVerificationLinkKind) + } else { + stream.WriteString(SubnetNetworkVerificationKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.details != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("details") + WriteStringList(object.details, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("platform") + stream.WriteString(string(object.platform)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(object.state) + count++ + } + present_ = object.bitmap_&64 != 0 && object.tags != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("tags") + if object.tags != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.tags)) + i := 0 + for key := range object.tags { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.tags[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + } + stream.WriteObjectEnd() +} + +// UnmarshalSubnetNetworkVerification reads a value of the 'subnet_network_verification' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSubnetNetworkVerification(source interface{}) (object *SubnetNetworkVerification, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSubnetNetworkVerification(iterator) + err = iterator.Error + return +} + +// ReadSubnetNetworkVerification reads a value of the 'subnet_network_verification' type from the given iterator. +func ReadSubnetNetworkVerification(iterator *jsoniter.Iterator) *SubnetNetworkVerification { + object := &SubnetNetworkVerification{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == SubnetNetworkVerificationLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "details": + value := ReadStringList(iterator) + object.details = value + object.bitmap_ |= 8 + case "platform": + text := iterator.ReadString() + value := Platform(text) + object.platform = value + object.bitmap_ |= 16 + case "state": + value := iterator.ReadString() + object.state = value + object.bitmap_ |= 32 + case "tags": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.tags = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/subnetwork_builder.go b/clientapi/clustersmgmt/v1/subnetwork_builder.go new file mode 100644 index 00000000..c0cf70c6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/subnetwork_builder.go @@ -0,0 +1,113 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SubnetworkBuilder contains the data and logic needed to build 'subnetwork' objects. +// +// AWS subnetwork object to be used while installing a cluster +type SubnetworkBuilder struct { + bitmap_ uint32 + cidrBlock string + availabilityZone string + name string + subnetID string + public bool + redHatManaged bool +} + +// NewSubnetwork creates a new builder of 'subnetwork' objects. +func NewSubnetwork() *SubnetworkBuilder { + return &SubnetworkBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SubnetworkBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// CIDRBlock sets the value of the 'CIDR_block' attribute to the given value. +func (b *SubnetworkBuilder) CIDRBlock(value string) *SubnetworkBuilder { + b.cidrBlock = value + b.bitmap_ |= 1 + return b +} + +// AvailabilityZone sets the value of the 'availability_zone' attribute to the given value. +func (b *SubnetworkBuilder) AvailabilityZone(value string) *SubnetworkBuilder { + b.availabilityZone = value + b.bitmap_ |= 2 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *SubnetworkBuilder) Name(value string) *SubnetworkBuilder { + b.name = value + b.bitmap_ |= 4 + return b +} + +// Public sets the value of the 'public' attribute to the given value. +func (b *SubnetworkBuilder) Public(value bool) *SubnetworkBuilder { + b.public = value + b.bitmap_ |= 8 + return b +} + +// RedHatManaged sets the value of the 'red_hat_managed' attribute to the given value. +func (b *SubnetworkBuilder) RedHatManaged(value bool) *SubnetworkBuilder { + b.redHatManaged = value + b.bitmap_ |= 16 + return b +} + +// SubnetID sets the value of the 'subnet_ID' attribute to the given value. +func (b *SubnetworkBuilder) SubnetID(value string) *SubnetworkBuilder { + b.subnetID = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SubnetworkBuilder) Copy(object *Subnetwork) *SubnetworkBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.cidrBlock = object.cidrBlock + b.availabilityZone = object.availabilityZone + b.name = object.name + b.public = object.public + b.redHatManaged = object.redHatManaged + b.subnetID = object.subnetID + return b +} + +// Build creates a 'subnetwork' object using the configuration stored in the builder. +func (b *SubnetworkBuilder) Build() (object *Subnetwork, err error) { + object = new(Subnetwork) + object.bitmap_ = b.bitmap_ + object.cidrBlock = b.cidrBlock + object.availabilityZone = b.availabilityZone + object.name = b.name + object.public = b.public + object.redHatManaged = b.redHatManaged + object.subnetID = b.subnetID + return +} diff --git a/clientapi/clustersmgmt/v1/subnetwork_list_builder.go b/clientapi/clustersmgmt/v1/subnetwork_list_builder.go new file mode 100644 index 00000000..f649ad23 --- /dev/null +++ b/clientapi/clustersmgmt/v1/subnetwork_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SubnetworkListBuilder contains the data and logic needed to build +// 'subnetwork' objects. +type SubnetworkListBuilder struct { + items []*SubnetworkBuilder +} + +// NewSubnetworkList creates a new builder of 'subnetwork' objects. +func NewSubnetworkList() *SubnetworkListBuilder { + return new(SubnetworkListBuilder) +} + +// Items sets the items of the list. +func (b *SubnetworkListBuilder) Items(values ...*SubnetworkBuilder) *SubnetworkListBuilder { + b.items = make([]*SubnetworkBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SubnetworkListBuilder) 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 *SubnetworkListBuilder) Copy(list *SubnetworkList) *SubnetworkListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SubnetworkBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSubnetwork().Copy(v) + } + } + return b +} + +// Build creates a list of 'subnetwork' objects using the +// configuration stored in the builder. +func (b *SubnetworkListBuilder) Build() (list *SubnetworkList, err error) { + items := make([]*Subnetwork, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SubnetworkList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/subnetwork_list_type_json.go b/clientapi/clustersmgmt/v1/subnetwork_list_type_json.go new file mode 100644 index 00000000..9db0ca24 --- /dev/null +++ b/clientapi/clustersmgmt/v1/subnetwork_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSubnetworkList writes a list of values of the 'subnetwork' type to +// the given writer. +func MarshalSubnetworkList(list []*Subnetwork, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSubnetworkList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSubnetworkList writes a list of value of the 'subnetwork' type to +// the given stream. +func WriteSubnetworkList(list []*Subnetwork, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSubnetwork(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSubnetworkList reads a list of values of the 'subnetwork' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSubnetworkList(source interface{}) (items []*Subnetwork, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSubnetworkList(iterator) + err = iterator.Error + return +} + +// ReadSubnetworkList reads list of values of the ”subnetwork' type from +// the given iterator. +func ReadSubnetworkList(iterator *jsoniter.Iterator) []*Subnetwork { + list := []*Subnetwork{} + for iterator.ReadArray() { + item := ReadSubnetwork(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/subnetwork_type.go b/clientapi/clustersmgmt/v1/subnetwork_type.go new file mode 100644 index 00000000..f711930d --- /dev/null +++ b/clientapi/clustersmgmt/v1/subnetwork_type.go @@ -0,0 +1,285 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// Subnetwork represents the values of the 'subnetwork' type. +// +// AWS subnetwork object to be used while installing a cluster +type Subnetwork struct { + bitmap_ uint32 + cidrBlock string + availabilityZone string + name string + subnetID string + public bool + redHatManaged bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Subnetwork) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// CIDRBlock returns the value of the 'CIDR_block' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The CIDR Block of the subnet. +func (o *Subnetwork) CIDRBlock() string { + if o != nil && o.bitmap_&1 != 0 { + return o.cidrBlock + } + return "" +} + +// GetCIDRBlock returns the value of the 'CIDR_block' attribute and +// a flag indicating if the attribute has a value. +// +// The CIDR Block of the subnet. +func (o *Subnetwork) GetCIDRBlock() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.cidrBlock + } + return +} + +// AvailabilityZone returns the value of the 'availability_zone' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The availability zone to which the subnet is related. +func (o *Subnetwork) AvailabilityZone() string { + if o != nil && o.bitmap_&2 != 0 { + return o.availabilityZone + } + return "" +} + +// GetAvailabilityZone returns the value of the 'availability_zone' attribute and +// a flag indicating if the attribute has a value. +// +// The availability zone to which the subnet is related. +func (o *Subnetwork) GetAvailabilityZone() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.availabilityZone + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the subnet according to its `Name` tag on AWS. +func (o *Subnetwork) Name() string { + if o != nil && o.bitmap_&4 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the subnet according to its `Name` tag on AWS. +func (o *Subnetwork) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.name + } + return +} + +// Public returns the value of the 'public' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Whether or not it is a public subnet. +func (o *Subnetwork) Public() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.public + } + return false +} + +// GetPublic returns the value of the 'public' attribute and +// a flag indicating if the attribute has a value. +// +// Whether or not it is a public subnet. +func (o *Subnetwork) GetPublic() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.public + } + return +} + +// RedHatManaged returns the value of the 'red_hat_managed' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// If the resource is RH managed. +func (o *Subnetwork) RedHatManaged() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.redHatManaged + } + return false +} + +// GetRedHatManaged returns the value of the 'red_hat_managed' attribute and +// a flag indicating if the attribute has a value. +// +// If the resource is RH managed. +func (o *Subnetwork) GetRedHatManaged() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.redHatManaged + } + return +} + +// SubnetID returns the value of the 'subnet_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The subnet ID to be used while installing a cluster. +func (o *Subnetwork) SubnetID() string { + if o != nil && o.bitmap_&32 != 0 { + return o.subnetID + } + return "" +} + +// GetSubnetID returns the value of the 'subnet_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The subnet ID to be used while installing a cluster. +func (o *Subnetwork) GetSubnetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.subnetID + } + return +} + +// SubnetworkListKind is the name of the type used to represent list of objects of +// type 'subnetwork'. +const SubnetworkListKind = "SubnetworkList" + +// SubnetworkListLinkKind is the name of the type used to represent links to list +// of objects of type 'subnetwork'. +const SubnetworkListLinkKind = "SubnetworkListLink" + +// SubnetworkNilKind is the name of the type used to nil lists of objects of +// type 'subnetwork'. +const SubnetworkListNilKind = "SubnetworkListNil" + +// SubnetworkList is a list of values of the 'subnetwork' type. +type SubnetworkList struct { + href string + link bool + items []*Subnetwork +} + +// Len returns the length of the list. +func (l *SubnetworkList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SubnetworkList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SubnetworkList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SubnetworkList) SetItems(items []*Subnetwork) { + l.items = items +} + +// Items returns the items of the list. +func (l *SubnetworkList) Items() []*Subnetwork { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SubnetworkList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SubnetworkList) Get(i int) *Subnetwork { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SubnetworkList) Slice() []*Subnetwork { + var slice []*Subnetwork + if l == nil { + slice = make([]*Subnetwork, 0) + } else { + slice = make([]*Subnetwork, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SubnetworkList) Each(f func(item *Subnetwork) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SubnetworkList) Range(f func(index int, item *Subnetwork) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/subnetwork_type_json.go b/clientapi/clustersmgmt/v1/subnetwork_type_json.go new file mode 100644 index 00000000..52e7674c --- /dev/null +++ b/clientapi/clustersmgmt/v1/subnetwork_type_json.go @@ -0,0 +1,151 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSubnetwork writes a value of the 'subnetwork' type to the given writer. +func MarshalSubnetwork(object *Subnetwork, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSubnetwork(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSubnetwork writes a value of the 'subnetwork' type to the given stream. +func WriteSubnetwork(object *Subnetwork, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cidr_block") + stream.WriteString(object.cidrBlock) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zone") + stream.WriteString(object.availabilityZone) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("public") + stream.WriteBool(object.public) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("red_hat_managed") + stream.WriteBool(object.redHatManaged) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnet_id") + stream.WriteString(object.subnetID) + } + stream.WriteObjectEnd() +} + +// UnmarshalSubnetwork reads a value of the 'subnetwork' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSubnetwork(source interface{}) (object *Subnetwork, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSubnetwork(iterator) + err = iterator.Error + return +} + +// ReadSubnetwork reads a value of the 'subnetwork' type from the given iterator. +func ReadSubnetwork(iterator *jsoniter.Iterator) *Subnetwork { + object := &Subnetwork{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "cidr_block": + value := iterator.ReadString() + object.cidrBlock = value + object.bitmap_ |= 1 + case "availability_zone": + value := iterator.ReadString() + object.availabilityZone = value + object.bitmap_ |= 2 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 4 + case "public": + value := iterator.ReadBool() + object.public = value + object.bitmap_ |= 8 + case "red_hat_managed": + value := iterator.ReadBool() + object.redHatManaged = value + object.bitmap_ |= 16 + case "subnet_id": + value := iterator.ReadString() + object.subnetID = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/subscription_builder.go b/clientapi/clustersmgmt/v1/subscription_builder.go new file mode 100644 index 00000000..f2f55ce1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/subscription_builder.go @@ -0,0 +1,79 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SubscriptionBuilder contains the data and logic needed to build 'subscription' objects. +// +// Definition of a subscription. +type SubscriptionBuilder struct { + bitmap_ uint32 + id string + href string +} + +// NewSubscription creates a new builder of 'subscription' objects. +func NewSubscription() *SubscriptionBuilder { + return &SubscriptionBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *SubscriptionBuilder) Link(value bool) *SubscriptionBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *SubscriptionBuilder) ID(value string) *SubscriptionBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *SubscriptionBuilder) HREF(value string) *SubscriptionBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SubscriptionBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SubscriptionBuilder) Copy(object *Subscription) *SubscriptionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + return b +} + +// Build creates a 'subscription' object using the configuration stored in the builder. +func (b *SubscriptionBuilder) Build() (object *Subscription, err error) { + object = new(Subscription) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + return +} diff --git a/clientapi/clustersmgmt/v1/subscription_list_builder.go b/clientapi/clustersmgmt/v1/subscription_list_builder.go new file mode 100644 index 00000000..20332185 --- /dev/null +++ b/clientapi/clustersmgmt/v1/subscription_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SubscriptionListBuilder contains the data and logic needed to build +// 'subscription' objects. +type SubscriptionListBuilder struct { + items []*SubscriptionBuilder +} + +// NewSubscriptionList creates a new builder of 'subscription' objects. +func NewSubscriptionList() *SubscriptionListBuilder { + return new(SubscriptionListBuilder) +} + +// Items sets the items of the list. +func (b *SubscriptionListBuilder) Items(values ...*SubscriptionBuilder) *SubscriptionListBuilder { + b.items = make([]*SubscriptionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SubscriptionListBuilder) 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 *SubscriptionListBuilder) Copy(list *SubscriptionList) *SubscriptionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SubscriptionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSubscription().Copy(v) + } + } + return b +} + +// Build creates a list of 'subscription' objects using the +// configuration stored in the builder. +func (b *SubscriptionListBuilder) Build() (list *SubscriptionList, err error) { + items := make([]*Subscription, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SubscriptionList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/subscription_list_type_json.go b/clientapi/clustersmgmt/v1/subscription_list_type_json.go new file mode 100644 index 00000000..89cf618e --- /dev/null +++ b/clientapi/clustersmgmt/v1/subscription_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSubscriptionList writes a list of values of the 'subscription' type to +// the given writer. +func MarshalSubscriptionList(list []*Subscription, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSubscriptionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSubscriptionList writes a list of value of the 'subscription' type to +// the given stream. +func WriteSubscriptionList(list []*Subscription, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSubscription(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSubscriptionList reads a list of values of the 'subscription' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSubscriptionList(source interface{}) (items []*Subscription, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSubscriptionList(iterator) + err = iterator.Error + return +} + +// ReadSubscriptionList reads list of values of the ”subscription' type from +// the given iterator. +func ReadSubscriptionList(iterator *jsoniter.Iterator) []*Subscription { + list := []*Subscription{} + for iterator.ReadArray() { + item := ReadSubscription(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/subscription_type.go b/clientapi/clustersmgmt/v1/subscription_type.go new file mode 100644 index 00000000..2e119495 --- /dev/null +++ b/clientapi/clustersmgmt/v1/subscription_type.go @@ -0,0 +1,241 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SubscriptionKind is the name of the type used to represent objects +// of type 'subscription'. +const SubscriptionKind = "Subscription" + +// SubscriptionLinkKind is the name of the type used to represent links +// to objects of type 'subscription'. +const SubscriptionLinkKind = "SubscriptionLink" + +// SubscriptionNilKind is the name of the type used to nil references +// to objects of type 'subscription'. +const SubscriptionNilKind = "SubscriptionNil" + +// Subscription represents the values of the 'subscription' type. +// +// Definition of a subscription. +type Subscription struct { + bitmap_ uint32 + id string + href string +} + +// Kind returns the name of the type of the object. +func (o *Subscription) Kind() string { + if o == nil { + return SubscriptionNilKind + } + if o.bitmap_&1 != 0 { + return SubscriptionLinkKind + } + return SubscriptionKind +} + +// Link returns true if this is a link. +func (o *Subscription) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Subscription) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Subscription) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Subscription) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Subscription) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Subscription) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// SubscriptionListKind is the name of the type used to represent list of objects of +// type 'subscription'. +const SubscriptionListKind = "SubscriptionList" + +// SubscriptionListLinkKind is the name of the type used to represent links to list +// of objects of type 'subscription'. +const SubscriptionListLinkKind = "SubscriptionListLink" + +// SubscriptionNilKind is the name of the type used to nil lists of objects of +// type 'subscription'. +const SubscriptionListNilKind = "SubscriptionListNil" + +// SubscriptionList is a list of values of the 'subscription' type. +type SubscriptionList struct { + href string + link bool + items []*Subscription +} + +// Kind returns the name of the type of the object. +func (l *SubscriptionList) Kind() string { + if l == nil { + return SubscriptionListNilKind + } + if l.link { + return SubscriptionListLinkKind + } + return SubscriptionListKind +} + +// Link returns true iif this is a link. +func (l *SubscriptionList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *SubscriptionList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *SubscriptionList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *SubscriptionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SubscriptionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SubscriptionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SubscriptionList) SetItems(items []*Subscription) { + l.items = items +} + +// Items returns the items of the list. +func (l *SubscriptionList) Items() []*Subscription { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SubscriptionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SubscriptionList) Get(i int) *Subscription { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SubscriptionList) Slice() []*Subscription { + var slice []*Subscription + if l == nil { + slice = make([]*Subscription, 0) + } else { + slice = make([]*Subscription, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SubscriptionList) Each(f func(item *Subscription) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SubscriptionList) Range(f func(index int, item *Subscription) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/subscription_type_json.go b/clientapi/clustersmgmt/v1/subscription_type_json.go new file mode 100644 index 00000000..c434afa2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/subscription_type_json.go @@ -0,0 +1,106 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSubscription writes a value of the 'subscription' type to the given writer. +func MarshalSubscription(object *Subscription, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSubscription(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSubscription writes a value of the 'subscription' type to the given stream. +func WriteSubscription(object *Subscription, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(SubscriptionLinkKind) + } else { + stream.WriteString(SubscriptionKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + } + stream.WriteObjectEnd() +} + +// UnmarshalSubscription reads a value of the 'subscription' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSubscription(source interface{}) (object *Subscription, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSubscription(iterator) + err = iterator.Error + return +} + +// ReadSubscription reads a value of the 'subscription' type from the given iterator. +func ReadSubscription(iterator *jsoniter.Iterator) *Subscription { + object := &Subscription{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == SubscriptionLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/syncset_builder.go b/clientapi/clustersmgmt/v1/syncset_builder.go new file mode 100644 index 00000000..e3fc6db8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/syncset_builder.go @@ -0,0 +1,98 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SyncsetBuilder contains the data and logic needed to build 'syncset' objects. +// +// Representation of a syncset. +type SyncsetBuilder struct { + bitmap_ uint32 + id string + href string + resources []interface{} +} + +// NewSyncset creates a new builder of 'syncset' objects. +func NewSyncset() *SyncsetBuilder { + return &SyncsetBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *SyncsetBuilder) Link(value bool) *SyncsetBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *SyncsetBuilder) ID(value string) *SyncsetBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *SyncsetBuilder) HREF(value string) *SyncsetBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *SyncsetBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Resources sets the value of the 'resources' attribute to the given values. +func (b *SyncsetBuilder) Resources(values ...interface{}) *SyncsetBuilder { + b.resources = make([]interface{}, len(values)) + copy(b.resources, values) + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *SyncsetBuilder) Copy(object *Syncset) *SyncsetBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.resources != nil { + b.resources = make([]interface{}, len(object.resources)) + copy(b.resources, object.resources) + } else { + b.resources = nil + } + return b +} + +// Build creates a 'syncset' object using the configuration stored in the builder. +func (b *SyncsetBuilder) Build() (object *Syncset, err error) { + object = new(Syncset) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.resources != nil { + object.resources = make([]interface{}, len(b.resources)) + copy(object.resources, b.resources) + } + return +} diff --git a/clientapi/clustersmgmt/v1/syncset_list_builder.go b/clientapi/clustersmgmt/v1/syncset_list_builder.go new file mode 100644 index 00000000..e89ea579 --- /dev/null +++ b/clientapi/clustersmgmt/v1/syncset_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SyncsetListBuilder contains the data and logic needed to build +// 'syncset' objects. +type SyncsetListBuilder struct { + items []*SyncsetBuilder +} + +// NewSyncsetList creates a new builder of 'syncset' objects. +func NewSyncsetList() *SyncsetListBuilder { + return new(SyncsetListBuilder) +} + +// Items sets the items of the list. +func (b *SyncsetListBuilder) Items(values ...*SyncsetBuilder) *SyncsetListBuilder { + b.items = make([]*SyncsetBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *SyncsetListBuilder) 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 *SyncsetListBuilder) Copy(list *SyncsetList) *SyncsetListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*SyncsetBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSyncset().Copy(v) + } + } + return b +} + +// Build creates a list of 'syncset' objects using the +// configuration stored in the builder. +func (b *SyncsetListBuilder) Build() (list *SyncsetList, err error) { + items := make([]*Syncset, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(SyncsetList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/syncset_list_type_json.go b/clientapi/clustersmgmt/v1/syncset_list_type_json.go new file mode 100644 index 00000000..af2a1960 --- /dev/null +++ b/clientapi/clustersmgmt/v1/syncset_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSyncsetList writes a list of values of the 'syncset' type to +// the given writer. +func MarshalSyncsetList(list []*Syncset, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSyncsetList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSyncsetList writes a list of value of the 'syncset' type to +// the given stream. +func WriteSyncsetList(list []*Syncset, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSyncset(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSyncsetList reads a list of values of the 'syncset' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSyncsetList(source interface{}) (items []*Syncset, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSyncsetList(iterator) + err = iterator.Error + return +} + +// ReadSyncsetList reads list of values of the ”syncset' type from +// the given iterator. +func ReadSyncsetList(iterator *jsoniter.Iterator) []*Syncset { + list := []*Syncset{} + for iterator.ReadArray() { + item := ReadSyncset(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/syncset_type.go b/clientapi/clustersmgmt/v1/syncset_type.go new file mode 100644 index 00000000..7880962c --- /dev/null +++ b/clientapi/clustersmgmt/v1/syncset_type.go @@ -0,0 +1,265 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// SyncsetKind is the name of the type used to represent objects +// of type 'syncset'. +const SyncsetKind = "Syncset" + +// SyncsetLinkKind is the name of the type used to represent links +// to objects of type 'syncset'. +const SyncsetLinkKind = "SyncsetLink" + +// SyncsetNilKind is the name of the type used to nil references +// to objects of type 'syncset'. +const SyncsetNilKind = "SyncsetNil" + +// Syncset represents the values of the 'syncset' type. +// +// Representation of a syncset. +type Syncset struct { + bitmap_ uint32 + id string + href string + resources []interface{} +} + +// Kind returns the name of the type of the object. +func (o *Syncset) Kind() string { + if o == nil { + return SyncsetNilKind + } + if o.bitmap_&1 != 0 { + return SyncsetLinkKind + } + return SyncsetKind +} + +// Link returns true if this is a link. +func (o *Syncset) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Syncset) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Syncset) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Syncset) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Syncset) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Syncset) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Resources returns the value of the 'resources' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of k8s objects to configure for the cluster. +func (o *Syncset) Resources() []interface{} { + if o != nil && o.bitmap_&8 != 0 { + return o.resources + } + return nil +} + +// GetResources returns the value of the 'resources' attribute and +// a flag indicating if the attribute has a value. +// +// List of k8s objects to configure for the cluster. +func (o *Syncset) GetResources() (value []interface{}, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.resources + } + return +} + +// SyncsetListKind is the name of the type used to represent list of objects of +// type 'syncset'. +const SyncsetListKind = "SyncsetList" + +// SyncsetListLinkKind is the name of the type used to represent links to list +// of objects of type 'syncset'. +const SyncsetListLinkKind = "SyncsetListLink" + +// SyncsetNilKind is the name of the type used to nil lists of objects of +// type 'syncset'. +const SyncsetListNilKind = "SyncsetListNil" + +// SyncsetList is a list of values of the 'syncset' type. +type SyncsetList struct { + href string + link bool + items []*Syncset +} + +// Kind returns the name of the type of the object. +func (l *SyncsetList) Kind() string { + if l == nil { + return SyncsetListNilKind + } + if l.link { + return SyncsetListLinkKind + } + return SyncsetListKind +} + +// Link returns true iif this is a link. +func (l *SyncsetList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *SyncsetList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *SyncsetList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *SyncsetList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *SyncsetList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *SyncsetList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *SyncsetList) SetItems(items []*Syncset) { + l.items = items +} + +// Items returns the items of the list. +func (l *SyncsetList) Items() []*Syncset { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *SyncsetList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *SyncsetList) Get(i int) *Syncset { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *SyncsetList) Slice() []*Syncset { + var slice []*Syncset + if l == nil { + slice = make([]*Syncset, 0) + } else { + slice = make([]*Syncset, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *SyncsetList) Each(f func(item *Syncset) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *SyncsetList) Range(f func(index int, item *Syncset) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/syncset_type_json.go b/clientapi/clustersmgmt/v1/syncset_type_json.go new file mode 100644 index 00000000..13f401a7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/syncset_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSyncset writes a value of the 'syncset' type to the given writer. +func MarshalSyncset(object *Syncset, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSyncset(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSyncset writes a value of the 'syncset' type to the given stream. +func WriteSyncset(object *Syncset, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(SyncsetLinkKind) + } else { + stream.WriteString(SyncsetKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.resources != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resources") + WriteInterfaceList(object.resources, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalSyncset reads a value of the 'syncset' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSyncset(source interface{}) (object *Syncset, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSyncset(iterator) + err = iterator.Error + return +} + +// ReadSyncset reads a value of the 'syncset' type from the given iterator. +func ReadSyncset(iterator *jsoniter.Iterator) *Syncset { + object := &Syncset{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == SyncsetLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "resources": + value := ReadInterfaceList(iterator) + object.resources = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/taint_builder.go b/clientapi/clustersmgmt/v1/taint_builder.go new file mode 100644 index 00000000..371741ec --- /dev/null +++ b/clientapi/clustersmgmt/v1/taint_builder.go @@ -0,0 +1,83 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TaintBuilder contains the data and logic needed to build 'taint' objects. +// +// Representation of a Taint set on a MachinePool in a cluster. +type TaintBuilder struct { + bitmap_ uint32 + effect string + key string + value string +} + +// NewTaint creates a new builder of 'taint' objects. +func NewTaint() *TaintBuilder { + return &TaintBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *TaintBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Effect sets the value of the 'effect' attribute to the given value. +func (b *TaintBuilder) Effect(value string) *TaintBuilder { + b.effect = value + b.bitmap_ |= 1 + return b +} + +// Key sets the value of the 'key' attribute to the given value. +func (b *TaintBuilder) Key(value string) *TaintBuilder { + b.key = value + b.bitmap_ |= 2 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *TaintBuilder) Value(value string) *TaintBuilder { + b.value = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *TaintBuilder) Copy(object *Taint) *TaintBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.effect = object.effect + b.key = object.key + b.value = object.value + return b +} + +// Build creates a 'taint' object using the configuration stored in the builder. +func (b *TaintBuilder) Build() (object *Taint, err error) { + object = new(Taint) + object.bitmap_ = b.bitmap_ + object.effect = b.effect + object.key = b.key + object.value = b.value + return +} diff --git a/clientapi/clustersmgmt/v1/taint_list_builder.go b/clientapi/clustersmgmt/v1/taint_list_builder.go new file mode 100644 index 00000000..539d3a3f --- /dev/null +++ b/clientapi/clustersmgmt/v1/taint_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TaintListBuilder contains the data and logic needed to build +// 'taint' objects. +type TaintListBuilder struct { + items []*TaintBuilder +} + +// NewTaintList creates a new builder of 'taint' objects. +func NewTaintList() *TaintListBuilder { + return new(TaintListBuilder) +} + +// Items sets the items of the list. +func (b *TaintListBuilder) Items(values ...*TaintBuilder) *TaintListBuilder { + b.items = make([]*TaintBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *TaintListBuilder) 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 *TaintListBuilder) Copy(list *TaintList) *TaintListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*TaintBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewTaint().Copy(v) + } + } + return b +} + +// Build creates a list of 'taint' objects using the +// configuration stored in the builder. +func (b *TaintListBuilder) Build() (list *TaintList, err error) { + items := make([]*Taint, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(TaintList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/taint_list_type_json.go b/clientapi/clustersmgmt/v1/taint_list_type_json.go new file mode 100644 index 00000000..e4547459 --- /dev/null +++ b/clientapi/clustersmgmt/v1/taint_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTaintList writes a list of values of the 'taint' type to +// the given writer. +func MarshalTaintList(list []*Taint, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTaintList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTaintList writes a list of value of the 'taint' type to +// the given stream. +func WriteTaintList(list []*Taint, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteTaint(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalTaintList reads a list of values of the 'taint' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalTaintList(source interface{}) (items []*Taint, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadTaintList(iterator) + err = iterator.Error + return +} + +// ReadTaintList reads list of values of the ”taint' type from +// the given iterator. +func ReadTaintList(iterator *jsoniter.Iterator) []*Taint { + list := []*Taint{} + for iterator.ReadArray() { + item := ReadTaint(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/taint_type.go b/clientapi/clustersmgmt/v1/taint_type.go new file mode 100644 index 00000000..33353ec0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/taint_type.go @@ -0,0 +1,213 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// Taint represents the values of the 'taint' type. +// +// Representation of a Taint set on a MachinePool in a cluster. +type Taint struct { + bitmap_ uint32 + effect string + key string + value string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Taint) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Effect returns the value of the 'effect' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The effect on the node for the pods matching the taint, i.e: NoSchedule, NoExecute, PreferNoSchedule. +func (o *Taint) Effect() string { + if o != nil && o.bitmap_&1 != 0 { + return o.effect + } + return "" +} + +// GetEffect returns the value of the 'effect' attribute and +// a flag indicating if the attribute has a value. +// +// The effect on the node for the pods matching the taint, i.e: NoSchedule, NoExecute, PreferNoSchedule. +func (o *Taint) GetEffect() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.effect + } + return +} + +// Key returns the value of the 'key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The key for the taint +func (o *Taint) Key() string { + if o != nil && o.bitmap_&2 != 0 { + return o.key + } + return "" +} + +// GetKey returns the value of the 'key' attribute and +// a flag indicating if the attribute has a value. +// +// The key for the taint +func (o *Taint) GetKey() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.key + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The value for the taint. +func (o *Taint) Value() string { + if o != nil && o.bitmap_&4 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// The value for the taint. +func (o *Taint) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.value + } + return +} + +// TaintListKind is the name of the type used to represent list of objects of +// type 'taint'. +const TaintListKind = "TaintList" + +// TaintListLinkKind is the name of the type used to represent links to list +// of objects of type 'taint'. +const TaintListLinkKind = "TaintListLink" + +// TaintNilKind is the name of the type used to nil lists of objects of +// type 'taint'. +const TaintListNilKind = "TaintListNil" + +// TaintList is a list of values of the 'taint' type. +type TaintList struct { + href string + link bool + items []*Taint +} + +// Len returns the length of the list. +func (l *TaintList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *TaintList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *TaintList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *TaintList) SetItems(items []*Taint) { + l.items = items +} + +// Items returns the items of the list. +func (l *TaintList) Items() []*Taint { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *TaintList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *TaintList) Get(i int) *Taint { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *TaintList) Slice() []*Taint { + var slice []*Taint + if l == nil { + slice = make([]*Taint, 0) + } else { + slice = make([]*Taint, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *TaintList) Each(f func(item *Taint) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *TaintList) Range(f func(index int, item *Taint) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/taint_type_json.go b/clientapi/clustersmgmt/v1/taint_type_json.go new file mode 100644 index 00000000..3feee07a --- /dev/null +++ b/clientapi/clustersmgmt/v1/taint_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTaint writes a value of the 'taint' type to the given writer. +func MarshalTaint(object *Taint, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTaint(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTaint writes a value of the 'taint' type to the given stream. +func WriteTaint(object *Taint, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("effect") + stream.WriteString(object.effect) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key") + stream.WriteString(object.key) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalTaint reads a value of the 'taint' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalTaint(source interface{}) (object *Taint, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadTaint(iterator) + err = iterator.Error + return +} + +// ReadTaint reads a value of the 'taint' type from the given iterator. +func ReadTaint(iterator *jsoniter.Iterator) *Taint { + object := &Taint{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "effect": + value := iterator.ReadString() + object.effect = value + object.bitmap_ |= 1 + case "key": + value := iterator.ReadString() + object.key = value + object.bitmap_ |= 2 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/token_claim_mappings_builder.go b/clientapi/clustersmgmt/v1/token_claim_mappings_builder.go new file mode 100644 index 00000000..de7c131d --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_claim_mappings_builder.go @@ -0,0 +1,101 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TokenClaimMappingsBuilder contains the data and logic needed to build 'token_claim_mappings' objects. +// +// The claim mappings defined for users and groups. +type TokenClaimMappingsBuilder struct { + bitmap_ uint32 + groups *GroupsClaimBuilder + userName *UsernameClaimBuilder +} + +// NewTokenClaimMappings creates a new builder of 'token_claim_mappings' objects. +func NewTokenClaimMappings() *TokenClaimMappingsBuilder { + return &TokenClaimMappingsBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *TokenClaimMappingsBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Groups sets the value of the 'groups' attribute to the given value. +func (b *TokenClaimMappingsBuilder) Groups(value *GroupsClaimBuilder) *TokenClaimMappingsBuilder { + b.groups = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// UserName sets the value of the 'user_name' attribute to the given value. +// +// The username claim mapping. +func (b *TokenClaimMappingsBuilder) UserName(value *UsernameClaimBuilder) *TokenClaimMappingsBuilder { + b.userName = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *TokenClaimMappingsBuilder) Copy(object *TokenClaimMappings) *TokenClaimMappingsBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.groups != nil { + b.groups = NewGroupsClaim().Copy(object.groups) + } else { + b.groups = nil + } + if object.userName != nil { + b.userName = NewUsernameClaim().Copy(object.userName) + } else { + b.userName = nil + } + return b +} + +// Build creates a 'token_claim_mappings' object using the configuration stored in the builder. +func (b *TokenClaimMappingsBuilder) Build() (object *TokenClaimMappings, err error) { + object = new(TokenClaimMappings) + object.bitmap_ = b.bitmap_ + if b.groups != nil { + object.groups, err = b.groups.Build() + if err != nil { + return + } + } + if b.userName != nil { + object.userName, err = b.userName.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/token_claim_mappings_list_builder.go b/clientapi/clustersmgmt/v1/token_claim_mappings_list_builder.go new file mode 100644 index 00000000..6e2fbcca --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_claim_mappings_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TokenClaimMappingsListBuilder contains the data and logic needed to build +// 'token_claim_mappings' objects. +type TokenClaimMappingsListBuilder struct { + items []*TokenClaimMappingsBuilder +} + +// NewTokenClaimMappingsList creates a new builder of 'token_claim_mappings' objects. +func NewTokenClaimMappingsList() *TokenClaimMappingsListBuilder { + return new(TokenClaimMappingsListBuilder) +} + +// Items sets the items of the list. +func (b *TokenClaimMappingsListBuilder) Items(values ...*TokenClaimMappingsBuilder) *TokenClaimMappingsListBuilder { + b.items = make([]*TokenClaimMappingsBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *TokenClaimMappingsListBuilder) 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 *TokenClaimMappingsListBuilder) Copy(list *TokenClaimMappingsList) *TokenClaimMappingsListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*TokenClaimMappingsBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewTokenClaimMappings().Copy(v) + } + } + return b +} + +// Build creates a list of 'token_claim_mappings' objects using the +// configuration stored in the builder. +func (b *TokenClaimMappingsListBuilder) Build() (list *TokenClaimMappingsList, err error) { + items := make([]*TokenClaimMappings, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(TokenClaimMappingsList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/token_claim_mappings_list_type_json.go b/clientapi/clustersmgmt/v1/token_claim_mappings_list_type_json.go new file mode 100644 index 00000000..53b0d95a --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_claim_mappings_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTokenClaimMappingsList writes a list of values of the 'token_claim_mappings' type to +// the given writer. +func MarshalTokenClaimMappingsList(list []*TokenClaimMappings, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTokenClaimMappingsList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTokenClaimMappingsList writes a list of value of the 'token_claim_mappings' type to +// the given stream. +func WriteTokenClaimMappingsList(list []*TokenClaimMappings, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteTokenClaimMappings(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalTokenClaimMappingsList reads a list of values of the 'token_claim_mappings' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalTokenClaimMappingsList(source interface{}) (items []*TokenClaimMappings, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadTokenClaimMappingsList(iterator) + err = iterator.Error + return +} + +// ReadTokenClaimMappingsList reads list of values of the ”token_claim_mappings' type from +// the given iterator. +func ReadTokenClaimMappingsList(iterator *jsoniter.Iterator) []*TokenClaimMappings { + list := []*TokenClaimMappings{} + for iterator.ReadArray() { + item := ReadTokenClaimMappings(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/token_claim_mappings_type.go b/clientapi/clustersmgmt/v1/token_claim_mappings_type.go new file mode 100644 index 00000000..d3e9e57f --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_claim_mappings_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TokenClaimMappings represents the values of the 'token_claim_mappings' type. +// +// The claim mappings defined for users and groups. +type TokenClaimMappings struct { + bitmap_ uint32 + groups *GroupsClaim + userName *UsernameClaim +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *TokenClaimMappings) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Groups returns the value of the 'groups' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Groups is a name of the claim that should be used to construct groups for the cluster identity. +func (o *TokenClaimMappings) Groups() *GroupsClaim { + if o != nil && o.bitmap_&1 != 0 { + return o.groups + } + return nil +} + +// GetGroups returns the value of the 'groups' attribute and +// a flag indicating if the attribute has a value. +// +// Groups is a name of the claim that should be used to construct groups for the cluster identity. +func (o *TokenClaimMappings) GetGroups() (value *GroupsClaim, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.groups + } + return +} + +// UserName returns the value of the 'user_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Username is a name of the claim that should be used to construct usernames for the cluster identity. +func (o *TokenClaimMappings) UserName() *UsernameClaim { + if o != nil && o.bitmap_&2 != 0 { + return o.userName + } + return nil +} + +// GetUserName returns the value of the 'user_name' attribute and +// a flag indicating if the attribute has a value. +// +// Username is a name of the claim that should be used to construct usernames for the cluster identity. +func (o *TokenClaimMappings) GetUserName() (value *UsernameClaim, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.userName + } + return +} + +// TokenClaimMappingsListKind is the name of the type used to represent list of objects of +// type 'token_claim_mappings'. +const TokenClaimMappingsListKind = "TokenClaimMappingsList" + +// TokenClaimMappingsListLinkKind is the name of the type used to represent links to list +// of objects of type 'token_claim_mappings'. +const TokenClaimMappingsListLinkKind = "TokenClaimMappingsListLink" + +// TokenClaimMappingsNilKind is the name of the type used to nil lists of objects of +// type 'token_claim_mappings'. +const TokenClaimMappingsListNilKind = "TokenClaimMappingsListNil" + +// TokenClaimMappingsList is a list of values of the 'token_claim_mappings' type. +type TokenClaimMappingsList struct { + href string + link bool + items []*TokenClaimMappings +} + +// Len returns the length of the list. +func (l *TokenClaimMappingsList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *TokenClaimMappingsList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *TokenClaimMappingsList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *TokenClaimMappingsList) SetItems(items []*TokenClaimMappings) { + l.items = items +} + +// Items returns the items of the list. +func (l *TokenClaimMappingsList) Items() []*TokenClaimMappings { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *TokenClaimMappingsList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *TokenClaimMappingsList) Get(i int) *TokenClaimMappings { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *TokenClaimMappingsList) Slice() []*TokenClaimMappings { + var slice []*TokenClaimMappings + if l == nil { + slice = make([]*TokenClaimMappings, 0) + } else { + slice = make([]*TokenClaimMappings, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *TokenClaimMappingsList) Each(f func(item *TokenClaimMappings) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *TokenClaimMappingsList) Range(f func(index int, item *TokenClaimMappings) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/token_claim_mappings_type_json.go b/clientapi/clustersmgmt/v1/token_claim_mappings_type_json.go new file mode 100644 index 00000000..8b139b00 --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_claim_mappings_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTokenClaimMappings writes a value of the 'token_claim_mappings' type to the given writer. +func MarshalTokenClaimMappings(object *TokenClaimMappings, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTokenClaimMappings(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTokenClaimMappings writes a value of the 'token_claim_mappings' type to the given stream. +func WriteTokenClaimMappings(object *TokenClaimMappings, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.groups != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("groups") + WriteGroupsClaim(object.groups, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.userName != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("username") + WriteUsernameClaim(object.userName, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalTokenClaimMappings reads a value of the 'token_claim_mappings' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalTokenClaimMappings(source interface{}) (object *TokenClaimMappings, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadTokenClaimMappings(iterator) + err = iterator.Error + return +} + +// ReadTokenClaimMappings reads a value of the 'token_claim_mappings' type from the given iterator. +func ReadTokenClaimMappings(iterator *jsoniter.Iterator) *TokenClaimMappings { + object := &TokenClaimMappings{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "groups": + value := ReadGroupsClaim(iterator) + object.groups = value + object.bitmap_ |= 1 + case "username": + value := ReadUsernameClaim(iterator) + object.userName = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/token_claim_validation_rule_builder.go b/clientapi/clustersmgmt/v1/token_claim_validation_rule_builder.go new file mode 100644 index 00000000..10fd706e --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_claim_validation_rule_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TokenClaimValidationRuleBuilder contains the data and logic needed to build 'token_claim_validation_rule' objects. +// +// The rule that is applied to validate token claims to authenticate users. +type TokenClaimValidationRuleBuilder struct { + bitmap_ uint32 + claim string + requiredValue string +} + +// NewTokenClaimValidationRule creates a new builder of 'token_claim_validation_rule' objects. +func NewTokenClaimValidationRule() *TokenClaimValidationRuleBuilder { + return &TokenClaimValidationRuleBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *TokenClaimValidationRuleBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Claim sets the value of the 'claim' attribute to the given value. +func (b *TokenClaimValidationRuleBuilder) Claim(value string) *TokenClaimValidationRuleBuilder { + b.claim = value + b.bitmap_ |= 1 + return b +} + +// RequiredValue sets the value of the 'required_value' attribute to the given value. +func (b *TokenClaimValidationRuleBuilder) RequiredValue(value string) *TokenClaimValidationRuleBuilder { + b.requiredValue = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *TokenClaimValidationRuleBuilder) Copy(object *TokenClaimValidationRule) *TokenClaimValidationRuleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.claim = object.claim + b.requiredValue = object.requiredValue + return b +} + +// Build creates a 'token_claim_validation_rule' object using the configuration stored in the builder. +func (b *TokenClaimValidationRuleBuilder) Build() (object *TokenClaimValidationRule, err error) { + object = new(TokenClaimValidationRule) + object.bitmap_ = b.bitmap_ + object.claim = b.claim + object.requiredValue = b.requiredValue + return +} diff --git a/clientapi/clustersmgmt/v1/token_claim_validation_rule_list_builder.go b/clientapi/clustersmgmt/v1/token_claim_validation_rule_list_builder.go new file mode 100644 index 00000000..5d2df977 --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_claim_validation_rule_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TokenClaimValidationRuleListBuilder contains the data and logic needed to build +// 'token_claim_validation_rule' objects. +type TokenClaimValidationRuleListBuilder struct { + items []*TokenClaimValidationRuleBuilder +} + +// NewTokenClaimValidationRuleList creates a new builder of 'token_claim_validation_rule' objects. +func NewTokenClaimValidationRuleList() *TokenClaimValidationRuleListBuilder { + return new(TokenClaimValidationRuleListBuilder) +} + +// Items sets the items of the list. +func (b *TokenClaimValidationRuleListBuilder) Items(values ...*TokenClaimValidationRuleBuilder) *TokenClaimValidationRuleListBuilder { + b.items = make([]*TokenClaimValidationRuleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *TokenClaimValidationRuleListBuilder) 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 *TokenClaimValidationRuleListBuilder) Copy(list *TokenClaimValidationRuleList) *TokenClaimValidationRuleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*TokenClaimValidationRuleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewTokenClaimValidationRule().Copy(v) + } + } + return b +} + +// Build creates a list of 'token_claim_validation_rule' objects using the +// configuration stored in the builder. +func (b *TokenClaimValidationRuleListBuilder) Build() (list *TokenClaimValidationRuleList, err error) { + items := make([]*TokenClaimValidationRule, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(TokenClaimValidationRuleList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/token_claim_validation_rule_list_type_json.go b/clientapi/clustersmgmt/v1/token_claim_validation_rule_list_type_json.go new file mode 100644 index 00000000..25137722 --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_claim_validation_rule_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTokenClaimValidationRuleList writes a list of values of the 'token_claim_validation_rule' type to +// the given writer. +func MarshalTokenClaimValidationRuleList(list []*TokenClaimValidationRule, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTokenClaimValidationRuleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTokenClaimValidationRuleList writes a list of value of the 'token_claim_validation_rule' type to +// the given stream. +func WriteTokenClaimValidationRuleList(list []*TokenClaimValidationRule, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteTokenClaimValidationRule(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalTokenClaimValidationRuleList reads a list of values of the 'token_claim_validation_rule' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalTokenClaimValidationRuleList(source interface{}) (items []*TokenClaimValidationRule, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadTokenClaimValidationRuleList(iterator) + err = iterator.Error + return +} + +// ReadTokenClaimValidationRuleList reads list of values of the ”token_claim_validation_rule' type from +// the given iterator. +func ReadTokenClaimValidationRuleList(iterator *jsoniter.Iterator) []*TokenClaimValidationRule { + list := []*TokenClaimValidationRule{} + for iterator.ReadArray() { + item := ReadTokenClaimValidationRule(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/token_claim_validation_rule_type.go b/clientapi/clustersmgmt/v1/token_claim_validation_rule_type.go new file mode 100644 index 00000000..1ffb91c6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_claim_validation_rule_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TokenClaimValidationRule represents the values of the 'token_claim_validation_rule' type. +// +// The rule that is applied to validate token claims to authenticate users. +type TokenClaimValidationRule struct { + bitmap_ uint32 + claim string + requiredValue string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *TokenClaimValidationRule) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Claim returns the value of the 'claim' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Claim is a name of a required claim. +func (o *TokenClaimValidationRule) Claim() string { + if o != nil && o.bitmap_&1 != 0 { + return o.claim + } + return "" +} + +// GetClaim returns the value of the 'claim' attribute and +// a flag indicating if the attribute has a value. +// +// Claim is a name of a required claim. +func (o *TokenClaimValidationRule) GetClaim() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.claim + } + return +} + +// RequiredValue returns the value of the 'required_value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// RequiredValue is the required value for the claim. +func (o *TokenClaimValidationRule) RequiredValue() string { + if o != nil && o.bitmap_&2 != 0 { + return o.requiredValue + } + return "" +} + +// GetRequiredValue returns the value of the 'required_value' attribute and +// a flag indicating if the attribute has a value. +// +// RequiredValue is the required value for the claim. +func (o *TokenClaimValidationRule) GetRequiredValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.requiredValue + } + return +} + +// TokenClaimValidationRuleListKind is the name of the type used to represent list of objects of +// type 'token_claim_validation_rule'. +const TokenClaimValidationRuleListKind = "TokenClaimValidationRuleList" + +// TokenClaimValidationRuleListLinkKind is the name of the type used to represent links to list +// of objects of type 'token_claim_validation_rule'. +const TokenClaimValidationRuleListLinkKind = "TokenClaimValidationRuleListLink" + +// TokenClaimValidationRuleNilKind is the name of the type used to nil lists of objects of +// type 'token_claim_validation_rule'. +const TokenClaimValidationRuleListNilKind = "TokenClaimValidationRuleListNil" + +// TokenClaimValidationRuleList is a list of values of the 'token_claim_validation_rule' type. +type TokenClaimValidationRuleList struct { + href string + link bool + items []*TokenClaimValidationRule +} + +// Len returns the length of the list. +func (l *TokenClaimValidationRuleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *TokenClaimValidationRuleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *TokenClaimValidationRuleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *TokenClaimValidationRuleList) SetItems(items []*TokenClaimValidationRule) { + l.items = items +} + +// Items returns the items of the list. +func (l *TokenClaimValidationRuleList) Items() []*TokenClaimValidationRule { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *TokenClaimValidationRuleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *TokenClaimValidationRuleList) Get(i int) *TokenClaimValidationRule { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *TokenClaimValidationRuleList) Slice() []*TokenClaimValidationRule { + var slice []*TokenClaimValidationRule + if l == nil { + slice = make([]*TokenClaimValidationRule, 0) + } else { + slice = make([]*TokenClaimValidationRule, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *TokenClaimValidationRuleList) Each(f func(item *TokenClaimValidationRule) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *TokenClaimValidationRuleList) Range(f func(index int, item *TokenClaimValidationRule) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/token_claim_validation_rule_type_json.go b/clientapi/clustersmgmt/v1/token_claim_validation_rule_type_json.go new file mode 100644 index 00000000..c675f003 --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_claim_validation_rule_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTokenClaimValidationRule writes a value of the 'token_claim_validation_rule' type to the given writer. +func MarshalTokenClaimValidationRule(object *TokenClaimValidationRule, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTokenClaimValidationRule(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTokenClaimValidationRule writes a value of the 'token_claim_validation_rule' type to the given stream. +func WriteTokenClaimValidationRule(object *TokenClaimValidationRule, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("claim") + stream.WriteString(object.claim) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("required_value") + stream.WriteString(object.requiredValue) + } + stream.WriteObjectEnd() +} + +// UnmarshalTokenClaimValidationRule reads a value of the 'token_claim_validation_rule' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalTokenClaimValidationRule(source interface{}) (object *TokenClaimValidationRule, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadTokenClaimValidationRule(iterator) + err = iterator.Error + return +} + +// ReadTokenClaimValidationRule reads a value of the 'token_claim_validation_rule' type from the given iterator. +func ReadTokenClaimValidationRule(iterator *jsoniter.Iterator) *TokenClaimValidationRule { + object := &TokenClaimValidationRule{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "claim": + value := iterator.ReadString() + object.claim = value + object.bitmap_ |= 1 + case "required_value": + value := iterator.ReadString() + object.requiredValue = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/token_issuer_builder.go b/clientapi/clustersmgmt/v1/token_issuer_builder.go new file mode 100644 index 00000000..bb21fee4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_issuer_builder.go @@ -0,0 +1,92 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TokenIssuerBuilder contains the data and logic needed to build 'token_issuer' objects. +// +// Representation of a token issuer used in an external authentication. +type TokenIssuerBuilder struct { + bitmap_ uint32 + ca string + url string + audiences []string +} + +// NewTokenIssuer creates a new builder of 'token_issuer' objects. +func NewTokenIssuer() *TokenIssuerBuilder { + return &TokenIssuerBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *TokenIssuerBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// CA sets the value of the 'CA' attribute to the given value. +func (b *TokenIssuerBuilder) CA(value string) *TokenIssuerBuilder { + b.ca = value + b.bitmap_ |= 1 + return b +} + +// URL sets the value of the 'URL' attribute to the given value. +func (b *TokenIssuerBuilder) URL(value string) *TokenIssuerBuilder { + b.url = value + b.bitmap_ |= 2 + return b +} + +// Audiences sets the value of the 'audiences' attribute to the given values. +func (b *TokenIssuerBuilder) Audiences(values ...string) *TokenIssuerBuilder { + b.audiences = make([]string, len(values)) + copy(b.audiences, values) + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *TokenIssuerBuilder) Copy(object *TokenIssuer) *TokenIssuerBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.ca = object.ca + b.url = object.url + if object.audiences != nil { + b.audiences = make([]string, len(object.audiences)) + copy(b.audiences, object.audiences) + } else { + b.audiences = nil + } + return b +} + +// Build creates a 'token_issuer' object using the configuration stored in the builder. +func (b *TokenIssuerBuilder) Build() (object *TokenIssuer, err error) { + object = new(TokenIssuer) + object.bitmap_ = b.bitmap_ + object.ca = b.ca + object.url = b.url + if b.audiences != nil { + object.audiences = make([]string, len(b.audiences)) + copy(object.audiences, b.audiences) + } + return +} diff --git a/clientapi/clustersmgmt/v1/token_issuer_list_builder.go b/clientapi/clustersmgmt/v1/token_issuer_list_builder.go new file mode 100644 index 00000000..07398e2e --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_issuer_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TokenIssuerListBuilder contains the data and logic needed to build +// 'token_issuer' objects. +type TokenIssuerListBuilder struct { + items []*TokenIssuerBuilder +} + +// NewTokenIssuerList creates a new builder of 'token_issuer' objects. +func NewTokenIssuerList() *TokenIssuerListBuilder { + return new(TokenIssuerListBuilder) +} + +// Items sets the items of the list. +func (b *TokenIssuerListBuilder) Items(values ...*TokenIssuerBuilder) *TokenIssuerListBuilder { + b.items = make([]*TokenIssuerBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *TokenIssuerListBuilder) 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 *TokenIssuerListBuilder) Copy(list *TokenIssuerList) *TokenIssuerListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*TokenIssuerBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewTokenIssuer().Copy(v) + } + } + return b +} + +// Build creates a list of 'token_issuer' objects using the +// configuration stored in the builder. +func (b *TokenIssuerListBuilder) Build() (list *TokenIssuerList, err error) { + items := make([]*TokenIssuer, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(TokenIssuerList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/token_issuer_list_type_json.go b/clientapi/clustersmgmt/v1/token_issuer_list_type_json.go new file mode 100644 index 00000000..8ef9027b --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_issuer_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTokenIssuerList writes a list of values of the 'token_issuer' type to +// the given writer. +func MarshalTokenIssuerList(list []*TokenIssuer, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTokenIssuerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTokenIssuerList writes a list of value of the 'token_issuer' type to +// the given stream. +func WriteTokenIssuerList(list []*TokenIssuer, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteTokenIssuer(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalTokenIssuerList reads a list of values of the 'token_issuer' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalTokenIssuerList(source interface{}) (items []*TokenIssuer, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadTokenIssuerList(iterator) + err = iterator.Error + return +} + +// ReadTokenIssuerList reads list of values of the ”token_issuer' type from +// the given iterator. +func ReadTokenIssuerList(iterator *jsoniter.Iterator) []*TokenIssuer { + list := []*TokenIssuer{} + for iterator.ReadArray() { + item := ReadTokenIssuer(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/token_issuer_type.go b/clientapi/clustersmgmt/v1/token_issuer_type.go new file mode 100644 index 00000000..f34ca667 --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_issuer_type.go @@ -0,0 +1,219 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TokenIssuer represents the values of the 'token_issuer' type. +// +// Representation of a token issuer used in an external authentication. +type TokenIssuer struct { + bitmap_ uint32 + ca string + url string + audiences []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *TokenIssuer) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// CA returns the value of the 'CA' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Certificate bundle to use to validate server certificates for the configured URL. +func (o *TokenIssuer) CA() string { + if o != nil && o.bitmap_&1 != 0 { + return o.ca + } + return "" +} + +// GetCA returns the value of the 'CA' attribute and +// a flag indicating if the attribute has a value. +// +// Certificate bundle to use to validate server certificates for the configured URL. +func (o *TokenIssuer) GetCA() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.ca + } + return +} + +// URL returns the value of the 'URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// URL is the serving URL of the token issuer. +func (o *TokenIssuer) URL() string { + if o != nil && o.bitmap_&2 != 0 { + return o.url + } + return "" +} + +// GetURL returns the value of the 'URL' attribute and +// a flag indicating if the attribute has a value. +// +// URL is the serving URL of the token issuer. +func (o *TokenIssuer) GetURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.url + } + return +} + +// Audiences returns the value of the 'audiences' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Audiences is an array of audiences that the token was issued for. +// Valid tokens must include at least one of these values in their +// "aud" claim. +// Must be set to exactly one value. +func (o *TokenIssuer) Audiences() []string { + if o != nil && o.bitmap_&4 != 0 { + return o.audiences + } + return nil +} + +// GetAudiences returns the value of the 'audiences' attribute and +// a flag indicating if the attribute has a value. +// +// Audiences is an array of audiences that the token was issued for. +// Valid tokens must include at least one of these values in their +// "aud" claim. +// Must be set to exactly one value. +func (o *TokenIssuer) GetAudiences() (value []string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.audiences + } + return +} + +// TokenIssuerListKind is the name of the type used to represent list of objects of +// type 'token_issuer'. +const TokenIssuerListKind = "TokenIssuerList" + +// TokenIssuerListLinkKind is the name of the type used to represent links to list +// of objects of type 'token_issuer'. +const TokenIssuerListLinkKind = "TokenIssuerListLink" + +// TokenIssuerNilKind is the name of the type used to nil lists of objects of +// type 'token_issuer'. +const TokenIssuerListNilKind = "TokenIssuerListNil" + +// TokenIssuerList is a list of values of the 'token_issuer' type. +type TokenIssuerList struct { + href string + link bool + items []*TokenIssuer +} + +// Len returns the length of the list. +func (l *TokenIssuerList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *TokenIssuerList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *TokenIssuerList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *TokenIssuerList) SetItems(items []*TokenIssuer) { + l.items = items +} + +// Items returns the items of the list. +func (l *TokenIssuerList) Items() []*TokenIssuer { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *TokenIssuerList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *TokenIssuerList) Get(i int) *TokenIssuer { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *TokenIssuerList) Slice() []*TokenIssuer { + var slice []*TokenIssuer + if l == nil { + slice = make([]*TokenIssuer, 0) + } else { + slice = make([]*TokenIssuer, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *TokenIssuerList) Each(f func(item *TokenIssuer) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *TokenIssuerList) Range(f func(index int, item *TokenIssuer) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/token_issuer_type_json.go b/clientapi/clustersmgmt/v1/token_issuer_type_json.go new file mode 100644 index 00000000..ec4a5c47 --- /dev/null +++ b/clientapi/clustersmgmt/v1/token_issuer_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTokenIssuer writes a value of the 'token_issuer' type to the given writer. +func MarshalTokenIssuer(object *TokenIssuer, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTokenIssuer(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTokenIssuer writes a value of the 'token_issuer' type to the given stream. +func WriteTokenIssuer(object *TokenIssuer, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("ca") + stream.WriteString(object.ca) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("url") + stream.WriteString(object.url) + count++ + } + present_ = object.bitmap_&4 != 0 && object.audiences != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("audiences") + WriteStringList(object.audiences, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalTokenIssuer reads a value of the 'token_issuer' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalTokenIssuer(source interface{}) (object *TokenIssuer, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadTokenIssuer(iterator) + err = iterator.Error + return +} + +// ReadTokenIssuer reads a value of the 'token_issuer' type from the given iterator. +func ReadTokenIssuer(iterator *jsoniter.Iterator) *TokenIssuer { + object := &TokenIssuer{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "ca": + value := iterator.ReadString() + object.ca = value + object.bitmap_ |= 1 + case "url": + value := iterator.ReadString() + object.url = value + object.bitmap_ |= 2 + case "audiences": + value := ReadStringList(iterator) + object.audiences = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/trusted_ip_builder.go b/clientapi/clustersmgmt/v1/trusted_ip_builder.go new file mode 100644 index 00000000..4f9a68f8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/trusted_ip_builder.go @@ -0,0 +1,89 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TrustedIpBuilder contains the data and logic needed to build 'trusted_ip' objects. +// +// Representation of a trusted ip address in clusterdeployment. +type TrustedIpBuilder struct { + bitmap_ uint32 + id string + href string + enabled bool +} + +// NewTrustedIp creates a new builder of 'trusted_ip' objects. +func NewTrustedIp() *TrustedIpBuilder { + return &TrustedIpBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *TrustedIpBuilder) Link(value bool) *TrustedIpBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *TrustedIpBuilder) ID(value string) *TrustedIpBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *TrustedIpBuilder) HREF(value string) *TrustedIpBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *TrustedIpBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *TrustedIpBuilder) Enabled(value bool) *TrustedIpBuilder { + b.enabled = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *TrustedIpBuilder) Copy(object *TrustedIp) *TrustedIpBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.enabled = object.enabled + return b +} + +// Build creates a 'trusted_ip' object using the configuration stored in the builder. +func (b *TrustedIpBuilder) Build() (object *TrustedIp, err error) { + object = new(TrustedIp) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.enabled = b.enabled + return +} diff --git a/clientapi/clustersmgmt/v1/trusted_ip_list_builder.go b/clientapi/clustersmgmt/v1/trusted_ip_list_builder.go new file mode 100644 index 00000000..ceed0f0c --- /dev/null +++ b/clientapi/clustersmgmt/v1/trusted_ip_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TrustedIpListBuilder contains the data and logic needed to build +// 'trusted_ip' objects. +type TrustedIpListBuilder struct { + items []*TrustedIpBuilder +} + +// NewTrustedIpList creates a new builder of 'trusted_ip' objects. +func NewTrustedIpList() *TrustedIpListBuilder { + return new(TrustedIpListBuilder) +} + +// Items sets the items of the list. +func (b *TrustedIpListBuilder) Items(values ...*TrustedIpBuilder) *TrustedIpListBuilder { + b.items = make([]*TrustedIpBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *TrustedIpListBuilder) 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 *TrustedIpListBuilder) Copy(list *TrustedIpList) *TrustedIpListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*TrustedIpBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewTrustedIp().Copy(v) + } + } + return b +} + +// Build creates a list of 'trusted_ip' objects using the +// configuration stored in the builder. +func (b *TrustedIpListBuilder) Build() (list *TrustedIpList, err error) { + items := make([]*TrustedIp, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(TrustedIpList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/trusted_ip_list_type_json.go b/clientapi/clustersmgmt/v1/trusted_ip_list_type_json.go new file mode 100644 index 00000000..1a3fc42e --- /dev/null +++ b/clientapi/clustersmgmt/v1/trusted_ip_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTrustedIpList writes a list of values of the 'trusted_ip' type to +// the given writer. +func MarshalTrustedIpList(list []*TrustedIp, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTrustedIpList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTrustedIpList writes a list of value of the 'trusted_ip' type to +// the given stream. +func WriteTrustedIpList(list []*TrustedIp, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteTrustedIp(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalTrustedIpList reads a list of values of the 'trusted_ip' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalTrustedIpList(source interface{}) (items []*TrustedIp, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadTrustedIpList(iterator) + err = iterator.Error + return +} + +// ReadTrustedIpList reads list of values of the ”trusted_ip' type from +// the given iterator. +func ReadTrustedIpList(iterator *jsoniter.Iterator) []*TrustedIp { + list := []*TrustedIp{} + for iterator.ReadArray() { + item := ReadTrustedIp(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/trusted_ip_type.go b/clientapi/clustersmgmt/v1/trusted_ip_type.go new file mode 100644 index 00000000..c8dfb750 --- /dev/null +++ b/clientapi/clustersmgmt/v1/trusted_ip_type.go @@ -0,0 +1,265 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TrustedIpKind is the name of the type used to represent objects +// of type 'trusted_ip'. +const TrustedIpKind = "TrustedIp" + +// TrustedIpLinkKind is the name of the type used to represent links +// to objects of type 'trusted_ip'. +const TrustedIpLinkKind = "TrustedIpLink" + +// TrustedIpNilKind is the name of the type used to nil references +// to objects of type 'trusted_ip'. +const TrustedIpNilKind = "TrustedIpNil" + +// TrustedIp represents the values of the 'trusted_ip' type. +// +// Representation of a trusted ip address in clusterdeployment. +type TrustedIp struct { + bitmap_ uint32 + id string + href string + enabled bool +} + +// Kind returns the name of the type of the object. +func (o *TrustedIp) Kind() string { + if o == nil { + return TrustedIpNilKind + } + if o.bitmap_&1 != 0 { + return TrustedIpLinkKind + } + return TrustedIpKind +} + +// Link returns true if this is a link. +func (o *TrustedIp) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *TrustedIp) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *TrustedIp) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *TrustedIp) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *TrustedIp) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *TrustedIp) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The boolean set to show if the ip is enabled. +func (o *TrustedIp) Enabled() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// The boolean set to show if the ip is enabled. +func (o *TrustedIp) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.enabled + } + return +} + +// TrustedIpListKind is the name of the type used to represent list of objects of +// type 'trusted_ip'. +const TrustedIpListKind = "TrustedIpList" + +// TrustedIpListLinkKind is the name of the type used to represent links to list +// of objects of type 'trusted_ip'. +const TrustedIpListLinkKind = "TrustedIpListLink" + +// TrustedIpNilKind is the name of the type used to nil lists of objects of +// type 'trusted_ip'. +const TrustedIpListNilKind = "TrustedIpListNil" + +// TrustedIpList is a list of values of the 'trusted_ip' type. +type TrustedIpList struct { + href string + link bool + items []*TrustedIp +} + +// Kind returns the name of the type of the object. +func (l *TrustedIpList) Kind() string { + if l == nil { + return TrustedIpListNilKind + } + if l.link { + return TrustedIpListLinkKind + } + return TrustedIpListKind +} + +// Link returns true iif this is a link. +func (l *TrustedIpList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *TrustedIpList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *TrustedIpList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *TrustedIpList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *TrustedIpList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *TrustedIpList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *TrustedIpList) SetItems(items []*TrustedIp) { + l.items = items +} + +// Items returns the items of the list. +func (l *TrustedIpList) Items() []*TrustedIp { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *TrustedIpList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *TrustedIpList) Get(i int) *TrustedIp { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *TrustedIpList) Slice() []*TrustedIp { + var slice []*TrustedIp + if l == nil { + slice = make([]*TrustedIp, 0) + } else { + slice = make([]*TrustedIp, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *TrustedIpList) Each(f func(item *TrustedIp) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *TrustedIpList) Range(f func(index int, item *TrustedIp) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/trusted_ip_type_json.go b/clientapi/clustersmgmt/v1/trusted_ip_type_json.go new file mode 100644 index 00000000..03465bfc --- /dev/null +++ b/clientapi/clustersmgmt/v1/trusted_ip_type_json.go @@ -0,0 +1,120 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTrustedIp writes a value of the 'trusted_ip' type to the given writer. +func MarshalTrustedIp(object *TrustedIp, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTrustedIp(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTrustedIp writes a value of the 'trusted_ip' type to the given stream. +func WriteTrustedIp(object *TrustedIp, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(TrustedIpLinkKind) + } else { + stream.WriteString(TrustedIpKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalTrustedIp reads a value of the 'trusted_ip' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalTrustedIp(source interface{}) (object *TrustedIp, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadTrustedIp(iterator) + err = iterator.Error + return +} + +// ReadTrustedIp reads a value of the 'trusted_ip' type from the given iterator. +func ReadTrustedIp(iterator *jsoniter.Iterator) *TrustedIp { + object := &TrustedIp{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == TrustedIpLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/tuning_config_builder.go b/clientapi/clustersmgmt/v1/tuning_config_builder.go new file mode 100644 index 00000000..c5268e3c --- /dev/null +++ b/clientapi/clustersmgmt/v1/tuning_config_builder.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TuningConfigBuilder contains the data and logic needed to build 'tuning_config' objects. +// +// Representation of a tuning config. +type TuningConfigBuilder struct { + bitmap_ uint32 + id string + href string + name string + spec interface{} +} + +// NewTuningConfig creates a new builder of 'tuning_config' objects. +func NewTuningConfig() *TuningConfigBuilder { + return &TuningConfigBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *TuningConfigBuilder) Link(value bool) *TuningConfigBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *TuningConfigBuilder) ID(value string) *TuningConfigBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *TuningConfigBuilder) HREF(value string) *TuningConfigBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *TuningConfigBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *TuningConfigBuilder) Name(value string) *TuningConfigBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// Spec sets the value of the 'spec' attribute to the given value. +func (b *TuningConfigBuilder) Spec(value interface{}) *TuningConfigBuilder { + b.spec = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *TuningConfigBuilder) Copy(object *TuningConfig) *TuningConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.name = object.name + b.spec = object.spec + return b +} + +// Build creates a 'tuning_config' object using the configuration stored in the builder. +func (b *TuningConfigBuilder) Build() (object *TuningConfig, err error) { + object = new(TuningConfig) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.name = b.name + object.spec = b.spec + return +} diff --git a/clientapi/clustersmgmt/v1/tuning_config_list_builder.go b/clientapi/clustersmgmt/v1/tuning_config_list_builder.go new file mode 100644 index 00000000..3e4c29d6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/tuning_config_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TuningConfigListBuilder contains the data and logic needed to build +// 'tuning_config' objects. +type TuningConfigListBuilder struct { + items []*TuningConfigBuilder +} + +// NewTuningConfigList creates a new builder of 'tuning_config' objects. +func NewTuningConfigList() *TuningConfigListBuilder { + return new(TuningConfigListBuilder) +} + +// Items sets the items of the list. +func (b *TuningConfigListBuilder) Items(values ...*TuningConfigBuilder) *TuningConfigListBuilder { + b.items = make([]*TuningConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *TuningConfigListBuilder) 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 *TuningConfigListBuilder) Copy(list *TuningConfigList) *TuningConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*TuningConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewTuningConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'tuning_config' objects using the +// configuration stored in the builder. +func (b *TuningConfigListBuilder) Build() (list *TuningConfigList, err error) { + items := make([]*TuningConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(TuningConfigList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/tuning_config_list_type_json.go b/clientapi/clustersmgmt/v1/tuning_config_list_type_json.go new file mode 100644 index 00000000..73609322 --- /dev/null +++ b/clientapi/clustersmgmt/v1/tuning_config_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTuningConfigList writes a list of values of the 'tuning_config' type to +// the given writer. +func MarshalTuningConfigList(list []*TuningConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTuningConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTuningConfigList writes a list of value of the 'tuning_config' type to +// the given stream. +func WriteTuningConfigList(list []*TuningConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteTuningConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalTuningConfigList reads a list of values of the 'tuning_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalTuningConfigList(source interface{}) (items []*TuningConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadTuningConfigList(iterator) + err = iterator.Error + return +} + +// ReadTuningConfigList reads list of values of the ”tuning_config' type from +// the given iterator. +func ReadTuningConfigList(iterator *jsoniter.Iterator) []*TuningConfig { + list := []*TuningConfig{} + for iterator.ReadArray() { + item := ReadTuningConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/tuning_config_type.go b/clientapi/clustersmgmt/v1/tuning_config_type.go new file mode 100644 index 00000000..cb9a10e4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/tuning_config_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// TuningConfigKind is the name of the type used to represent objects +// of type 'tuning_config'. +const TuningConfigKind = "TuningConfig" + +// TuningConfigLinkKind is the name of the type used to represent links +// to objects of type 'tuning_config'. +const TuningConfigLinkKind = "TuningConfigLink" + +// TuningConfigNilKind is the name of the type used to nil references +// to objects of type 'tuning_config'. +const TuningConfigNilKind = "TuningConfigNil" + +// TuningConfig represents the values of the 'tuning_config' type. +// +// Representation of a tuning config. +type TuningConfig struct { + bitmap_ uint32 + id string + href string + name string + spec interface{} +} + +// Kind returns the name of the type of the object. +func (o *TuningConfig) Kind() string { + if o == nil { + return TuningConfigNilKind + } + if o.bitmap_&1 != 0 { + return TuningConfigLinkKind + } + return TuningConfigKind +} + +// Link returns true if this is a link. +func (o *TuningConfig) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *TuningConfig) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *TuningConfig) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *TuningConfig) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *TuningConfig) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *TuningConfig) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the tuning config. +func (o *TuningConfig) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the tuning config. +func (o *TuningConfig) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// Spec returns the value of the 'spec' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Spec of the tuning config. +func (o *TuningConfig) Spec() interface{} { + if o != nil && o.bitmap_&16 != 0 { + return o.spec + } + return nil +} + +// GetSpec returns the value of the 'spec' attribute and +// a flag indicating if the attribute has a value. +// +// Spec of the tuning config. +func (o *TuningConfig) GetSpec() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.spec + } + return +} + +// TuningConfigListKind is the name of the type used to represent list of objects of +// type 'tuning_config'. +const TuningConfigListKind = "TuningConfigList" + +// TuningConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'tuning_config'. +const TuningConfigListLinkKind = "TuningConfigListLink" + +// TuningConfigNilKind is the name of the type used to nil lists of objects of +// type 'tuning_config'. +const TuningConfigListNilKind = "TuningConfigListNil" + +// TuningConfigList is a list of values of the 'tuning_config' type. +type TuningConfigList struct { + href string + link bool + items []*TuningConfig +} + +// Kind returns the name of the type of the object. +func (l *TuningConfigList) Kind() string { + if l == nil { + return TuningConfigListNilKind + } + if l.link { + return TuningConfigListLinkKind + } + return TuningConfigListKind +} + +// Link returns true iif this is a link. +func (l *TuningConfigList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *TuningConfigList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *TuningConfigList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *TuningConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *TuningConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *TuningConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *TuningConfigList) SetItems(items []*TuningConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *TuningConfigList) Items() []*TuningConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *TuningConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *TuningConfigList) Get(i int) *TuningConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *TuningConfigList) Slice() []*TuningConfig { + var slice []*TuningConfig + if l == nil { + slice = make([]*TuningConfig, 0) + } else { + slice = make([]*TuningConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *TuningConfigList) Each(f func(item *TuningConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *TuningConfigList) Range(f func(index int, item *TuningConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/tuning_config_type_json.go b/clientapi/clustersmgmt/v1/tuning_config_type_json.go new file mode 100644 index 00000000..23445b90 --- /dev/null +++ b/clientapi/clustersmgmt/v1/tuning_config_type_json.go @@ -0,0 +1,134 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalTuningConfig writes a value of the 'tuning_config' type to the given writer. +func MarshalTuningConfig(object *TuningConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteTuningConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteTuningConfig writes a value of the 'tuning_config' type to the given stream. +func WriteTuningConfig(object *TuningConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(TuningConfigLinkKind) + } else { + stream.WriteString(TuningConfigKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("spec") + stream.WriteVal(object.spec) + } + stream.WriteObjectEnd() +} + +// UnmarshalTuningConfig reads a value of the 'tuning_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalTuningConfig(source interface{}) (object *TuningConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadTuningConfig(iterator) + err = iterator.Error + return +} + +// ReadTuningConfig reads a value of the 'tuning_config' type from the given iterator. +func ReadTuningConfig(iterator *jsoniter.Iterator) *TuningConfig { + object := &TuningConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == TuningConfigLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + case "spec": + var value interface{} + iterator.ReadVal(&value) + object.spec = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/upgrade_policy_builder.go b/clientapi/clustersmgmt/v1/upgrade_policy_builder.go new file mode 100644 index 00000000..57b59175 --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_policy_builder.go @@ -0,0 +1,157 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// UpgradePolicyBuilder contains the data and logic needed to build 'upgrade_policy' objects. +// +// Representation of an upgrade policy that can be set for a cluster. +type UpgradePolicyBuilder struct { + bitmap_ uint32 + id string + href string + clusterID string + nextRun time.Time + schedule string + scheduleType ScheduleType + upgradeType UpgradeType + version string + enableMinorVersionUpgrades bool +} + +// NewUpgradePolicy creates a new builder of 'upgrade_policy' objects. +func NewUpgradePolicy() *UpgradePolicyBuilder { + return &UpgradePolicyBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *UpgradePolicyBuilder) Link(value bool) *UpgradePolicyBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *UpgradePolicyBuilder) ID(value string) *UpgradePolicyBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *UpgradePolicyBuilder) HREF(value string) *UpgradePolicyBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *UpgradePolicyBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *UpgradePolicyBuilder) ClusterID(value string) *UpgradePolicyBuilder { + b.clusterID = value + b.bitmap_ |= 8 + return b +} + +// EnableMinorVersionUpgrades sets the value of the 'enable_minor_version_upgrades' attribute to the given value. +func (b *UpgradePolicyBuilder) EnableMinorVersionUpgrades(value bool) *UpgradePolicyBuilder { + b.enableMinorVersionUpgrades = value + b.bitmap_ |= 16 + return b +} + +// NextRun sets the value of the 'next_run' attribute to the given value. +func (b *UpgradePolicyBuilder) NextRun(value time.Time) *UpgradePolicyBuilder { + b.nextRun = value + b.bitmap_ |= 32 + return b +} + +// Schedule sets the value of the 'schedule' attribute to the given value. +func (b *UpgradePolicyBuilder) Schedule(value string) *UpgradePolicyBuilder { + b.schedule = value + b.bitmap_ |= 64 + return b +} + +// ScheduleType sets the value of the 'schedule_type' attribute to the given value. +// +// ScheduleType defines which type of scheduling should be used for the upgrade policy. +func (b *UpgradePolicyBuilder) ScheduleType(value ScheduleType) *UpgradePolicyBuilder { + b.scheduleType = value + b.bitmap_ |= 128 + return b +} + +// UpgradeType sets the value of the 'upgrade_type' attribute to the given value. +// +// UpgradeType defines which type of upgrade should be used. +func (b *UpgradePolicyBuilder) UpgradeType(value UpgradeType) *UpgradePolicyBuilder { + b.upgradeType = value + b.bitmap_ |= 256 + return b +} + +// Version sets the value of the 'version' attribute to the given value. +func (b *UpgradePolicyBuilder) Version(value string) *UpgradePolicyBuilder { + b.version = value + b.bitmap_ |= 512 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *UpgradePolicyBuilder) Copy(object *UpgradePolicy) *UpgradePolicyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.clusterID = object.clusterID + b.enableMinorVersionUpgrades = object.enableMinorVersionUpgrades + b.nextRun = object.nextRun + b.schedule = object.schedule + b.scheduleType = object.scheduleType + b.upgradeType = object.upgradeType + b.version = object.version + return b +} + +// Build creates a 'upgrade_policy' object using the configuration stored in the builder. +func (b *UpgradePolicyBuilder) Build() (object *UpgradePolicy, err error) { + object = new(UpgradePolicy) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.clusterID = b.clusterID + object.enableMinorVersionUpgrades = b.enableMinorVersionUpgrades + object.nextRun = b.nextRun + object.schedule = b.schedule + object.scheduleType = b.scheduleType + object.upgradeType = b.upgradeType + object.version = b.version + return +} diff --git a/clientapi/clustersmgmt/v1/upgrade_policy_list_builder.go b/clientapi/clustersmgmt/v1/upgrade_policy_list_builder.go new file mode 100644 index 00000000..f060e448 --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_policy_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// UpgradePolicyListBuilder contains the data and logic needed to build +// 'upgrade_policy' objects. +type UpgradePolicyListBuilder struct { + items []*UpgradePolicyBuilder +} + +// NewUpgradePolicyList creates a new builder of 'upgrade_policy' objects. +func NewUpgradePolicyList() *UpgradePolicyListBuilder { + return new(UpgradePolicyListBuilder) +} + +// Items sets the items of the list. +func (b *UpgradePolicyListBuilder) Items(values ...*UpgradePolicyBuilder) *UpgradePolicyListBuilder { + b.items = make([]*UpgradePolicyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *UpgradePolicyListBuilder) 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 *UpgradePolicyListBuilder) Copy(list *UpgradePolicyList) *UpgradePolicyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*UpgradePolicyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewUpgradePolicy().Copy(v) + } + } + return b +} + +// Build creates a list of 'upgrade_policy' objects using the +// configuration stored in the builder. +func (b *UpgradePolicyListBuilder) Build() (list *UpgradePolicyList, err error) { + items := make([]*UpgradePolicy, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(UpgradePolicyList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/upgrade_policy_list_type_json.go b/clientapi/clustersmgmt/v1/upgrade_policy_list_type_json.go new file mode 100644 index 00000000..7dfbf6be --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_policy_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalUpgradePolicyList writes a list of values of the 'upgrade_policy' type to +// the given writer. +func MarshalUpgradePolicyList(list []*UpgradePolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteUpgradePolicyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteUpgradePolicyList writes a list of value of the 'upgrade_policy' type to +// the given stream. +func WriteUpgradePolicyList(list []*UpgradePolicy, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteUpgradePolicy(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalUpgradePolicyList reads a list of values of the 'upgrade_policy' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalUpgradePolicyList(source interface{}) (items []*UpgradePolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadUpgradePolicyList(iterator) + err = iterator.Error + return +} + +// ReadUpgradePolicyList reads list of values of the ”upgrade_policy' type from +// the given iterator. +func ReadUpgradePolicyList(iterator *jsoniter.Iterator) []*UpgradePolicy { + list := []*UpgradePolicy{} + for iterator.ReadArray() { + item := ReadUpgradePolicy(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/upgrade_policy_state_builder.go b/clientapi/clustersmgmt/v1/upgrade_policy_state_builder.go new file mode 100644 index 00000000..398581b4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_policy_state_builder.go @@ -0,0 +1,101 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// UpgradePolicyStateBuilder contains the data and logic needed to build 'upgrade_policy_state' objects. +// +// Representation of an upgrade policy state that that is set for a cluster. +type UpgradePolicyStateBuilder struct { + bitmap_ uint32 + id string + href string + description string + value UpgradePolicyStateValue +} + +// NewUpgradePolicyState creates a new builder of 'upgrade_policy_state' objects. +func NewUpgradePolicyState() *UpgradePolicyStateBuilder { + return &UpgradePolicyStateBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *UpgradePolicyStateBuilder) Link(value bool) *UpgradePolicyStateBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *UpgradePolicyStateBuilder) ID(value string) *UpgradePolicyStateBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *UpgradePolicyStateBuilder) HREF(value string) *UpgradePolicyStateBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *UpgradePolicyStateBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *UpgradePolicyStateBuilder) Description(value string) *UpgradePolicyStateBuilder { + b.description = value + b.bitmap_ |= 8 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +// +// Overall state of a cluster upgrade policy. +func (b *UpgradePolicyStateBuilder) Value(value UpgradePolicyStateValue) *UpgradePolicyStateBuilder { + b.value = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *UpgradePolicyStateBuilder) Copy(object *UpgradePolicyState) *UpgradePolicyStateBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.description = object.description + b.value = object.value + return b +} + +// Build creates a 'upgrade_policy_state' object using the configuration stored in the builder. +func (b *UpgradePolicyStateBuilder) Build() (object *UpgradePolicyState, err error) { + object = new(UpgradePolicyState) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.description = b.description + object.value = b.value + return +} diff --git a/clientapi/clustersmgmt/v1/upgrade_policy_state_list_builder.go b/clientapi/clustersmgmt/v1/upgrade_policy_state_list_builder.go new file mode 100644 index 00000000..4bd46f50 --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_policy_state_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// UpgradePolicyStateListBuilder contains the data and logic needed to build +// 'upgrade_policy_state' objects. +type UpgradePolicyStateListBuilder struct { + items []*UpgradePolicyStateBuilder +} + +// NewUpgradePolicyStateList creates a new builder of 'upgrade_policy_state' objects. +func NewUpgradePolicyStateList() *UpgradePolicyStateListBuilder { + return new(UpgradePolicyStateListBuilder) +} + +// Items sets the items of the list. +func (b *UpgradePolicyStateListBuilder) Items(values ...*UpgradePolicyStateBuilder) *UpgradePolicyStateListBuilder { + b.items = make([]*UpgradePolicyStateBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *UpgradePolicyStateListBuilder) 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 *UpgradePolicyStateListBuilder) Copy(list *UpgradePolicyStateList) *UpgradePolicyStateListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*UpgradePolicyStateBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewUpgradePolicyState().Copy(v) + } + } + return b +} + +// Build creates a list of 'upgrade_policy_state' objects using the +// configuration stored in the builder. +func (b *UpgradePolicyStateListBuilder) Build() (list *UpgradePolicyStateList, err error) { + items := make([]*UpgradePolicyState, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(UpgradePolicyStateList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/upgrade_policy_state_list_type_json.go b/clientapi/clustersmgmt/v1/upgrade_policy_state_list_type_json.go new file mode 100644 index 00000000..1d4ef2ac --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_policy_state_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalUpgradePolicyStateList writes a list of values of the 'upgrade_policy_state' type to +// the given writer. +func MarshalUpgradePolicyStateList(list []*UpgradePolicyState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteUpgradePolicyStateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteUpgradePolicyStateList writes a list of value of the 'upgrade_policy_state' type to +// the given stream. +func WriteUpgradePolicyStateList(list []*UpgradePolicyState, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteUpgradePolicyState(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalUpgradePolicyStateList reads a list of values of the 'upgrade_policy_state' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalUpgradePolicyStateList(source interface{}) (items []*UpgradePolicyState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadUpgradePolicyStateList(iterator) + err = iterator.Error + return +} + +// ReadUpgradePolicyStateList reads list of values of the ”upgrade_policy_state' type from +// the given iterator. +func ReadUpgradePolicyStateList(iterator *jsoniter.Iterator) []*UpgradePolicyState { + list := []*UpgradePolicyState{} + for iterator.ReadArray() { + item := ReadUpgradePolicyState(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/upgrade_policy_state_type.go b/clientapi/clustersmgmt/v1/upgrade_policy_state_type.go new file mode 100644 index 00000000..dc1a29e0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_policy_state_type.go @@ -0,0 +1,291 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// UpgradePolicyStateKind is the name of the type used to represent objects +// of type 'upgrade_policy_state'. +const UpgradePolicyStateKind = "UpgradePolicyState" + +// UpgradePolicyStateLinkKind is the name of the type used to represent links +// to objects of type 'upgrade_policy_state'. +const UpgradePolicyStateLinkKind = "UpgradePolicyStateLink" + +// UpgradePolicyStateNilKind is the name of the type used to nil references +// to objects of type 'upgrade_policy_state'. +const UpgradePolicyStateNilKind = "UpgradePolicyStateNil" + +// UpgradePolicyState represents the values of the 'upgrade_policy_state' type. +// +// Representation of an upgrade policy state that that is set for a cluster. +type UpgradePolicyState struct { + bitmap_ uint32 + id string + href string + description string + value UpgradePolicyStateValue +} + +// Kind returns the name of the type of the object. +func (o *UpgradePolicyState) Kind() string { + if o == nil { + return UpgradePolicyStateNilKind + } + if o.bitmap_&1 != 0 { + return UpgradePolicyStateLinkKind + } + return UpgradePolicyStateKind +} + +// Link returns true if this is a link. +func (o *UpgradePolicyState) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *UpgradePolicyState) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *UpgradePolicyState) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *UpgradePolicyState) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *UpgradePolicyState) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *UpgradePolicyState) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Description of the state. +func (o *UpgradePolicyState) Description() string { + if o != nil && o.bitmap_&8 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Description of the state. +func (o *UpgradePolicyState) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.description + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// State value can be 'pending', 'scheduled', 'cancelled', 'started', 'delayed', +// 'failed' or 'completed'. +func (o *UpgradePolicyState) Value() UpgradePolicyStateValue { + if o != nil && o.bitmap_&16 != 0 { + return o.value + } + return UpgradePolicyStateValue("") +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// State value can be 'pending', 'scheduled', 'cancelled', 'started', 'delayed', +// 'failed' or 'completed'. +func (o *UpgradePolicyState) GetValue() (value UpgradePolicyStateValue, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.value + } + return +} + +// UpgradePolicyStateListKind is the name of the type used to represent list of objects of +// type 'upgrade_policy_state'. +const UpgradePolicyStateListKind = "UpgradePolicyStateList" + +// UpgradePolicyStateListLinkKind is the name of the type used to represent links to list +// of objects of type 'upgrade_policy_state'. +const UpgradePolicyStateListLinkKind = "UpgradePolicyStateListLink" + +// UpgradePolicyStateNilKind is the name of the type used to nil lists of objects of +// type 'upgrade_policy_state'. +const UpgradePolicyStateListNilKind = "UpgradePolicyStateListNil" + +// UpgradePolicyStateList is a list of values of the 'upgrade_policy_state' type. +type UpgradePolicyStateList struct { + href string + link bool + items []*UpgradePolicyState +} + +// Kind returns the name of the type of the object. +func (l *UpgradePolicyStateList) Kind() string { + if l == nil { + return UpgradePolicyStateListNilKind + } + if l.link { + return UpgradePolicyStateListLinkKind + } + return UpgradePolicyStateListKind +} + +// Link returns true iif this is a link. +func (l *UpgradePolicyStateList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *UpgradePolicyStateList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *UpgradePolicyStateList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *UpgradePolicyStateList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *UpgradePolicyStateList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *UpgradePolicyStateList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *UpgradePolicyStateList) SetItems(items []*UpgradePolicyState) { + l.items = items +} + +// Items returns the items of the list. +func (l *UpgradePolicyStateList) Items() []*UpgradePolicyState { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *UpgradePolicyStateList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *UpgradePolicyStateList) Get(i int) *UpgradePolicyState { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *UpgradePolicyStateList) Slice() []*UpgradePolicyState { + var slice []*UpgradePolicyState + if l == nil { + slice = make([]*UpgradePolicyState, 0) + } else { + slice = make([]*UpgradePolicyState, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *UpgradePolicyStateList) Each(f func(item *UpgradePolicyState) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *UpgradePolicyStateList) Range(f func(index int, item *UpgradePolicyState) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/upgrade_policy_state_type_json.go b/clientapi/clustersmgmt/v1/upgrade_policy_state_type_json.go new file mode 100644 index 00000000..d044f649 --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_policy_state_type_json.go @@ -0,0 +1,134 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalUpgradePolicyState writes a value of the 'upgrade_policy_state' type to the given writer. +func MarshalUpgradePolicyState(object *UpgradePolicyState, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteUpgradePolicyState(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteUpgradePolicyState writes a value of the 'upgrade_policy_state' type to the given stream. +func WriteUpgradePolicyState(object *UpgradePolicyState, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(UpgradePolicyStateLinkKind) + } else { + stream.WriteString(UpgradePolicyStateKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(string(object.value)) + } + stream.WriteObjectEnd() +} + +// UnmarshalUpgradePolicyState reads a value of the 'upgrade_policy_state' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalUpgradePolicyState(source interface{}) (object *UpgradePolicyState, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadUpgradePolicyState(iterator) + err = iterator.Error + return +} + +// ReadUpgradePolicyState reads a value of the 'upgrade_policy_state' type from the given iterator. +func ReadUpgradePolicyState(iterator *jsoniter.Iterator) *UpgradePolicyState { + object := &UpgradePolicyState{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == UpgradePolicyStateLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 8 + case "value": + text := iterator.ReadString() + value := UpgradePolicyStateValue(text) + object.value = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/upgrade_policy_state_value_list_type_json.go b/clientapi/clustersmgmt/v1/upgrade_policy_state_value_list_type_json.go new file mode 100644 index 00000000..b75989ec --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_policy_state_value_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalUpgradePolicyStateValueList writes a list of values of the 'upgrade_policy_state_value' type to +// the given writer. +func MarshalUpgradePolicyStateValueList(list []UpgradePolicyStateValue, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteUpgradePolicyStateValueList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteUpgradePolicyStateValueList writes a list of value of the 'upgrade_policy_state_value' type to +// the given stream. +func WriteUpgradePolicyStateValueList(list []UpgradePolicyStateValue, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalUpgradePolicyStateValueList reads a list of values of the 'upgrade_policy_state_value' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalUpgradePolicyStateValueList(source interface{}) (items []UpgradePolicyStateValue, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadUpgradePolicyStateValueList(iterator) + err = iterator.Error + return +} + +// ReadUpgradePolicyStateValueList reads list of values of the ”upgrade_policy_state_value' type from +// the given iterator. +func ReadUpgradePolicyStateValueList(iterator *jsoniter.Iterator) []UpgradePolicyStateValue { + list := []UpgradePolicyStateValue{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := UpgradePolicyStateValue(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/upgrade_policy_state_value_type.go b/clientapi/clustersmgmt/v1/upgrade_policy_state_value_type.go new file mode 100644 index 00000000..478246ee --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_policy_state_value_type.go @@ -0,0 +1,41 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// UpgradePolicyStateValue represents the values of the 'upgrade_policy_state_value' enumerated type. +type UpgradePolicyStateValue string + +const ( + // Upgrade got cancelled (temporary state - the policy will get removed). + UpgradePolicyStateValueCancelled UpgradePolicyStateValue = "cancelled" + // Upgrade completed (temporary state - the policy will be removed in case of + // manual upgrade, or move back to pending in case of automatic upgrade) + UpgradePolicyStateValueCompleted UpgradePolicyStateValue = "completed" + // Upgrade is taking longer than expected + UpgradePolicyStateValueDelayed UpgradePolicyStateValue = "delayed" + // Upgrade failed + UpgradePolicyStateValueFailed UpgradePolicyStateValue = "failed" + // Upgrade policy set but an upgrade wasn't scheduled yet + UpgradePolicyStateValuePending UpgradePolicyStateValue = "pending" + // Upgrade policy set and was scheduled + UpgradePolicyStateValueScheduled UpgradePolicyStateValue = "scheduled" + // Upgrade started + UpgradePolicyStateValueStarted UpgradePolicyStateValue = "started" +) diff --git a/clientapi/clustersmgmt/v1/upgrade_policy_type.go b/clientapi/clustersmgmt/v1/upgrade_policy_type.go new file mode 100644 index 00000000..26445756 --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_policy_type.go @@ -0,0 +1,413 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// UpgradePolicyKind is the name of the type used to represent objects +// of type 'upgrade_policy'. +const UpgradePolicyKind = "UpgradePolicy" + +// UpgradePolicyLinkKind is the name of the type used to represent links +// to objects of type 'upgrade_policy'. +const UpgradePolicyLinkKind = "UpgradePolicyLink" + +// UpgradePolicyNilKind is the name of the type used to nil references +// to objects of type 'upgrade_policy'. +const UpgradePolicyNilKind = "UpgradePolicyNil" + +// UpgradePolicy represents the values of the 'upgrade_policy' type. +// +// Representation of an upgrade policy that can be set for a cluster. +type UpgradePolicy struct { + bitmap_ uint32 + id string + href string + clusterID string + nextRun time.Time + schedule string + scheduleType ScheduleType + upgradeType UpgradeType + version string + enableMinorVersionUpgrades bool +} + +// Kind returns the name of the type of the object. +func (o *UpgradePolicy) Kind() string { + if o == nil { + return UpgradePolicyNilKind + } + if o.bitmap_&1 != 0 { + return UpgradePolicyLinkKind + } + return UpgradePolicyKind +} + +// Link returns true if this is a link. +func (o *UpgradePolicy) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *UpgradePolicy) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *UpgradePolicy) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *UpgradePolicy) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *UpgradePolicy) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *UpgradePolicy) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster ID this upgrade policy is defined for. +func (o *UpgradePolicy) ClusterID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster ID this upgrade policy is defined for. +func (o *UpgradePolicy) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clusterID + } + return +} + +// EnableMinorVersionUpgrades returns the value of the 'enable_minor_version_upgrades' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if minor version upgrades are allowed for automatic upgrades (for manual it's always allowed). +func (o *UpgradePolicy) EnableMinorVersionUpgrades() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.enableMinorVersionUpgrades + } + return false +} + +// GetEnableMinorVersionUpgrades returns the value of the 'enable_minor_version_upgrades' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if minor version upgrades are allowed for automatic upgrades (for manual it's always allowed). +func (o *UpgradePolicy) GetEnableMinorVersionUpgrades() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.enableMinorVersionUpgrades + } + return +} + +// NextRun returns the value of the 'next_run' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Next time the upgrade should run. +func (o *UpgradePolicy) NextRun() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.nextRun + } + return time.Time{} +} + +// GetNextRun returns the value of the 'next_run' attribute and +// a flag indicating if the attribute has a value. +// +// Next time the upgrade should run. +func (o *UpgradePolicy) GetNextRun() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.nextRun + } + return +} + +// Schedule returns the value of the 'schedule' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Schedule cron expression that defines automatic upgrade scheduling. +func (o *UpgradePolicy) Schedule() string { + if o != nil && o.bitmap_&64 != 0 { + return o.schedule + } + return "" +} + +// GetSchedule returns the value of the 'schedule' attribute and +// a flag indicating if the attribute has a value. +// +// Schedule cron expression that defines automatic upgrade scheduling. +func (o *UpgradePolicy) GetSchedule() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.schedule + } + return +} + +// ScheduleType returns the value of the 'schedule_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Schedule type of the upgrade. +func (o *UpgradePolicy) ScheduleType() ScheduleType { + if o != nil && o.bitmap_&128 != 0 { + return o.scheduleType + } + return ScheduleType("") +} + +// GetScheduleType returns the value of the 'schedule_type' attribute and +// a flag indicating if the attribute has a value. +// +// Schedule type of the upgrade. +func (o *UpgradePolicy) GetScheduleType() (value ScheduleType, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.scheduleType + } + return +} + +// UpgradeType returns the value of the 'upgrade_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Upgrade type specify the type of the upgrade. +func (o *UpgradePolicy) UpgradeType() UpgradeType { + if o != nil && o.bitmap_&256 != 0 { + return o.upgradeType + } + return UpgradeType("") +} + +// GetUpgradeType returns the value of the 'upgrade_type' attribute and +// a flag indicating if the attribute has a value. +// +// Upgrade type specify the type of the upgrade. +func (o *UpgradePolicy) GetUpgradeType() (value UpgradeType, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.upgradeType + } + return +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Version is the desired upgrade version. +func (o *UpgradePolicy) Version() string { + if o != nil && o.bitmap_&512 != 0 { + return o.version + } + return "" +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +// +// Version is the desired upgrade version. +func (o *UpgradePolicy) GetVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.version + } + return +} + +// UpgradePolicyListKind is the name of the type used to represent list of objects of +// type 'upgrade_policy'. +const UpgradePolicyListKind = "UpgradePolicyList" + +// UpgradePolicyListLinkKind is the name of the type used to represent links to list +// of objects of type 'upgrade_policy'. +const UpgradePolicyListLinkKind = "UpgradePolicyListLink" + +// UpgradePolicyNilKind is the name of the type used to nil lists of objects of +// type 'upgrade_policy'. +const UpgradePolicyListNilKind = "UpgradePolicyListNil" + +// UpgradePolicyList is a list of values of the 'upgrade_policy' type. +type UpgradePolicyList struct { + href string + link bool + items []*UpgradePolicy +} + +// Kind returns the name of the type of the object. +func (l *UpgradePolicyList) Kind() string { + if l == nil { + return UpgradePolicyListNilKind + } + if l.link { + return UpgradePolicyListLinkKind + } + return UpgradePolicyListKind +} + +// Link returns true iif this is a link. +func (l *UpgradePolicyList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *UpgradePolicyList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *UpgradePolicyList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *UpgradePolicyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *UpgradePolicyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *UpgradePolicyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *UpgradePolicyList) SetItems(items []*UpgradePolicy) { + l.items = items +} + +// Items returns the items of the list. +func (l *UpgradePolicyList) Items() []*UpgradePolicy { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *UpgradePolicyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *UpgradePolicyList) Get(i int) *UpgradePolicy { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *UpgradePolicyList) Slice() []*UpgradePolicy { + var slice []*UpgradePolicy + if l == nil { + slice = make([]*UpgradePolicy, 0) + } else { + slice = make([]*UpgradePolicy, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *UpgradePolicyList) Each(f func(item *UpgradePolicy) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *UpgradePolicyList) Range(f func(index int, item *UpgradePolicy) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/upgrade_policy_type_json.go b/clientapi/clustersmgmt/v1/upgrade_policy_type_json.go new file mode 100644 index 00000000..8b386fd7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_policy_type_json.go @@ -0,0 +1,205 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalUpgradePolicy writes a value of the 'upgrade_policy' type to the given writer. +func MarshalUpgradePolicy(object *UpgradePolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteUpgradePolicy(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteUpgradePolicy writes a value of the 'upgrade_policy' type to the given stream. +func WriteUpgradePolicy(object *UpgradePolicy, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(UpgradePolicyLinkKind) + } else { + stream.WriteString(UpgradePolicyKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enable_minor_version_upgrades") + stream.WriteBool(object.enableMinorVersionUpgrades) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("next_run") + stream.WriteString((object.nextRun).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("schedule") + stream.WriteString(object.schedule) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("schedule_type") + stream.WriteString(string(object.scheduleType)) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("upgrade_type") + stream.WriteString(string(object.upgradeType)) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + stream.WriteString(object.version) + } + stream.WriteObjectEnd() +} + +// UnmarshalUpgradePolicy reads a value of the 'upgrade_policy' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalUpgradePolicy(source interface{}) (object *UpgradePolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadUpgradePolicy(iterator) + err = iterator.Error + return +} + +// ReadUpgradePolicy reads a value of the 'upgrade_policy' type from the given iterator. +func ReadUpgradePolicy(iterator *jsoniter.Iterator) *UpgradePolicy { + object := &UpgradePolicy{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == UpgradePolicyLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 8 + case "enable_minor_version_upgrades": + value := iterator.ReadBool() + object.enableMinorVersionUpgrades = value + object.bitmap_ |= 16 + case "next_run": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.nextRun = value + object.bitmap_ |= 32 + case "schedule": + value := iterator.ReadString() + object.schedule = value + object.bitmap_ |= 64 + case "schedule_type": + text := iterator.ReadString() + value := ScheduleType(text) + object.scheduleType = value + object.bitmap_ |= 128 + case "upgrade_type": + text := iterator.ReadString() + value := UpgradeType(text) + object.upgradeType = value + object.bitmap_ |= 256 + case "version": + value := iterator.ReadString() + object.version = value + object.bitmap_ |= 512 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/upgrade_type_list_type_json.go b/clientapi/clustersmgmt/v1/upgrade_type_list_type_json.go new file mode 100644 index 00000000..49b2b0fb --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_type_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalUpgradeTypeList writes a list of values of the 'upgrade_type' type to +// the given writer. +func MarshalUpgradeTypeList(list []UpgradeType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteUpgradeTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteUpgradeTypeList writes a list of value of the 'upgrade_type' type to +// the given stream. +func WriteUpgradeTypeList(list []UpgradeType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalUpgradeTypeList reads a list of values of the 'upgrade_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalUpgradeTypeList(source interface{}) (items []UpgradeType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadUpgradeTypeList(iterator) + err = iterator.Error + return +} + +// ReadUpgradeTypeList reads list of values of the ”upgrade_type' type from +// the given iterator. +func ReadUpgradeTypeList(iterator *jsoniter.Iterator) []UpgradeType { + list := []UpgradeType{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := UpgradeType(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/upgrade_type_type.go b/clientapi/clustersmgmt/v1/upgrade_type_type.go new file mode 100644 index 00000000..459b6e2a --- /dev/null +++ b/clientapi/clustersmgmt/v1/upgrade_type_type.go @@ -0,0 +1,34 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// UpgradeType represents the values of the 'upgrade_type' enumerated type. +type UpgradeType string + +const ( + // Upgrade of OSD cluster, which will upgrade the cluster's control plane, and all the node pools. + UpgradeTypeOSD UpgradeType = "OSD" + // Upgrade of an AddOn + UpgradeTypeAddOn UpgradeType = "ADDON" + // Control plane upgrade, relevant only for hosted control plane clusters. + UpgradeTypeControlPlane UpgradeType = "ControlPlane" + // Node pool upgrade, relevant only for hosted control plane clusters. + UpgradeTypeNodePool UpgradeType = "NodePool" +) diff --git a/clientapi/clustersmgmt/v1/user_builder.go b/clientapi/clustersmgmt/v1/user_builder.go new file mode 100644 index 00000000..fb2188e4 --- /dev/null +++ b/clientapi/clustersmgmt/v1/user_builder.go @@ -0,0 +1,79 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// UserBuilder contains the data and logic needed to build 'user' objects. +// +// Representation of a user. +type UserBuilder struct { + bitmap_ uint32 + id string + href string +} + +// NewUser creates a new builder of 'user' objects. +func NewUser() *UserBuilder { + return &UserBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *UserBuilder) Link(value bool) *UserBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *UserBuilder) ID(value string) *UserBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *UserBuilder) HREF(value string) *UserBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *UserBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *UserBuilder) Copy(object *User) *UserBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + return b +} + +// Build creates a 'user' object using the configuration stored in the builder. +func (b *UserBuilder) Build() (object *User, err error) { + object = new(User) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + return +} diff --git a/clientapi/clustersmgmt/v1/user_list_builder.go b/clientapi/clustersmgmt/v1/user_list_builder.go new file mode 100644 index 00000000..75e46102 --- /dev/null +++ b/clientapi/clustersmgmt/v1/user_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// UserListBuilder contains the data and logic needed to build +// 'user' objects. +type UserListBuilder struct { + items []*UserBuilder +} + +// NewUserList creates a new builder of 'user' objects. +func NewUserList() *UserListBuilder { + return new(UserListBuilder) +} + +// Items sets the items of the list. +func (b *UserListBuilder) Items(values ...*UserBuilder) *UserListBuilder { + b.items = make([]*UserBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *UserListBuilder) 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 *UserListBuilder) Copy(list *UserList) *UserListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*UserBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewUser().Copy(v) + } + } + return b +} + +// Build creates a list of 'user' objects using the +// configuration stored in the builder. +func (b *UserListBuilder) Build() (list *UserList, err error) { + items := make([]*User, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(UserList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/user_list_type_json.go b/clientapi/clustersmgmt/v1/user_list_type_json.go new file mode 100644 index 00000000..c85577fc --- /dev/null +++ b/clientapi/clustersmgmt/v1/user_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalUserList writes a list of values of the 'user' type to +// the given writer. +func MarshalUserList(list []*User, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteUserList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteUserList writes a list of value of the 'user' type to +// the given stream. +func WriteUserList(list []*User, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteUser(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalUserList reads a list of values of the 'user' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalUserList(source interface{}) (items []*User, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadUserList(iterator) + err = iterator.Error + return +} + +// ReadUserList reads list of values of the ”user' type from +// the given iterator. +func ReadUserList(iterator *jsoniter.Iterator) []*User { + list := []*User{} + for iterator.ReadArray() { + item := ReadUser(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/user_type.go b/clientapi/clustersmgmt/v1/user_type.go new file mode 100644 index 00000000..b304cbda --- /dev/null +++ b/clientapi/clustersmgmt/v1/user_type.go @@ -0,0 +1,241 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// UserKind is the name of the type used to represent objects +// of type 'user'. +const UserKind = "User" + +// UserLinkKind is the name of the type used to represent links +// to objects of type 'user'. +const UserLinkKind = "UserLink" + +// UserNilKind is the name of the type used to nil references +// to objects of type 'user'. +const UserNilKind = "UserNil" + +// User represents the values of the 'user' type. +// +// Representation of a user. +type User struct { + bitmap_ uint32 + id string + href string +} + +// Kind returns the name of the type of the object. +func (o *User) Kind() string { + if o == nil { + return UserNilKind + } + if o.bitmap_&1 != 0 { + return UserLinkKind + } + return UserKind +} + +// Link returns true if this is a link. +func (o *User) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *User) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *User) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *User) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *User) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *User) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// UserListKind is the name of the type used to represent list of objects of +// type 'user'. +const UserListKind = "UserList" + +// UserListLinkKind is the name of the type used to represent links to list +// of objects of type 'user'. +const UserListLinkKind = "UserListLink" + +// UserNilKind is the name of the type used to nil lists of objects of +// type 'user'. +const UserListNilKind = "UserListNil" + +// UserList is a list of values of the 'user' type. +type UserList struct { + href string + link bool + items []*User +} + +// Kind returns the name of the type of the object. +func (l *UserList) Kind() string { + if l == nil { + return UserListNilKind + } + if l.link { + return UserListLinkKind + } + return UserListKind +} + +// Link returns true iif this is a link. +func (l *UserList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *UserList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *UserList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *UserList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *UserList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *UserList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *UserList) SetItems(items []*User) { + l.items = items +} + +// Items returns the items of the list. +func (l *UserList) Items() []*User { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *UserList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *UserList) Get(i int) *User { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *UserList) Slice() []*User { + var slice []*User + if l == nil { + slice = make([]*User, 0) + } else { + slice = make([]*User, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *UserList) Each(f func(item *User) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *UserList) Range(f func(index int, item *User) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/user_type_json.go b/clientapi/clustersmgmt/v1/user_type_json.go new file mode 100644 index 00000000..e4309166 --- /dev/null +++ b/clientapi/clustersmgmt/v1/user_type_json.go @@ -0,0 +1,106 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalUser writes a value of the 'user' type to the given writer. +func MarshalUser(object *User, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteUser(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteUser writes a value of the 'user' type to the given stream. +func WriteUser(object *User, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(UserLinkKind) + } else { + stream.WriteString(UserKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + } + stream.WriteObjectEnd() +} + +// UnmarshalUser reads a value of the 'user' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalUser(source interface{}) (object *User, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadUser(iterator) + err = iterator.Error + return +} + +// ReadUser reads a value of the 'user' type from the given iterator. +func ReadUser(iterator *jsoniter.Iterator) *User { + object := &User{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == UserLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/username_claim_builder.go b/clientapi/clustersmgmt/v1/username_claim_builder.go new file mode 100644 index 00000000..d86e7a8f --- /dev/null +++ b/clientapi/clustersmgmt/v1/username_claim_builder.go @@ -0,0 +1,83 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// UsernameClaimBuilder contains the data and logic needed to build 'username_claim' objects. +// +// The username claim mapping. +type UsernameClaimBuilder struct { + bitmap_ uint32 + claim string + prefix string + prefixPolicy string +} + +// NewUsernameClaim creates a new builder of 'username_claim' objects. +func NewUsernameClaim() *UsernameClaimBuilder { + return &UsernameClaimBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *UsernameClaimBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Claim sets the value of the 'claim' attribute to the given value. +func (b *UsernameClaimBuilder) Claim(value string) *UsernameClaimBuilder { + b.claim = value + b.bitmap_ |= 1 + return b +} + +// Prefix sets the value of the 'prefix' attribute to the given value. +func (b *UsernameClaimBuilder) Prefix(value string) *UsernameClaimBuilder { + b.prefix = value + b.bitmap_ |= 2 + return b +} + +// PrefixPolicy sets the value of the 'prefix_policy' attribute to the given value. +func (b *UsernameClaimBuilder) PrefixPolicy(value string) *UsernameClaimBuilder { + b.prefixPolicy = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *UsernameClaimBuilder) Copy(object *UsernameClaim) *UsernameClaimBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.claim = object.claim + b.prefix = object.prefix + b.prefixPolicy = object.prefixPolicy + return b +} + +// Build creates a 'username_claim' object using the configuration stored in the builder. +func (b *UsernameClaimBuilder) Build() (object *UsernameClaim, err error) { + object = new(UsernameClaim) + object.bitmap_ = b.bitmap_ + object.claim = b.claim + object.prefix = b.prefix + object.prefixPolicy = b.prefixPolicy + return +} diff --git a/clientapi/clustersmgmt/v1/username_claim_list_builder.go b/clientapi/clustersmgmt/v1/username_claim_list_builder.go new file mode 100644 index 00000000..b2e5c156 --- /dev/null +++ b/clientapi/clustersmgmt/v1/username_claim_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// UsernameClaimListBuilder contains the data and logic needed to build +// 'username_claim' objects. +type UsernameClaimListBuilder struct { + items []*UsernameClaimBuilder +} + +// NewUsernameClaimList creates a new builder of 'username_claim' objects. +func NewUsernameClaimList() *UsernameClaimListBuilder { + return new(UsernameClaimListBuilder) +} + +// Items sets the items of the list. +func (b *UsernameClaimListBuilder) Items(values ...*UsernameClaimBuilder) *UsernameClaimListBuilder { + b.items = make([]*UsernameClaimBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *UsernameClaimListBuilder) 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 *UsernameClaimListBuilder) Copy(list *UsernameClaimList) *UsernameClaimListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*UsernameClaimBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewUsernameClaim().Copy(v) + } + } + return b +} + +// Build creates a list of 'username_claim' objects using the +// configuration stored in the builder. +func (b *UsernameClaimListBuilder) Build() (list *UsernameClaimList, err error) { + items := make([]*UsernameClaim, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(UsernameClaimList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/username_claim_list_type_json.go b/clientapi/clustersmgmt/v1/username_claim_list_type_json.go new file mode 100644 index 00000000..9da07078 --- /dev/null +++ b/clientapi/clustersmgmt/v1/username_claim_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalUsernameClaimList writes a list of values of the 'username_claim' type to +// the given writer. +func MarshalUsernameClaimList(list []*UsernameClaim, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteUsernameClaimList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteUsernameClaimList writes a list of value of the 'username_claim' type to +// the given stream. +func WriteUsernameClaimList(list []*UsernameClaim, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteUsernameClaim(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalUsernameClaimList reads a list of values of the 'username_claim' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalUsernameClaimList(source interface{}) (items []*UsernameClaim, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadUsernameClaimList(iterator) + err = iterator.Error + return +} + +// ReadUsernameClaimList reads list of values of the ”username_claim' type from +// the given iterator. +func ReadUsernameClaimList(iterator *jsoniter.Iterator) []*UsernameClaim { + list := []*UsernameClaim{} + for iterator.ReadArray() { + item := ReadUsernameClaim(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/username_claim_type.go b/clientapi/clustersmgmt/v1/username_claim_type.go new file mode 100644 index 00000000..483e71c8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/username_claim_type.go @@ -0,0 +1,223 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// UsernameClaim represents the values of the 'username_claim' type. +// +// The username claim mapping. +type UsernameClaim struct { + bitmap_ uint32 + claim string + prefix string + prefixPolicy string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *UsernameClaim) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Claim returns the value of the 'claim' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The claim used in the token. +func (o *UsernameClaim) Claim() string { + if o != nil && o.bitmap_&1 != 0 { + return o.claim + } + return "" +} + +// GetClaim returns the value of the 'claim' attribute and +// a flag indicating if the attribute has a value. +// +// The claim used in the token. +func (o *UsernameClaim) GetClaim() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.claim + } + return +} + +// Prefix returns the value of the 'prefix' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// A prefix contatenated in the claim (Optional). +func (o *UsernameClaim) Prefix() string { + if o != nil && o.bitmap_&2 != 0 { + return o.prefix + } + return "" +} + +// GetPrefix returns the value of the 'prefix' attribute and +// a flag indicating if the attribute has a value. +// +// A prefix contatenated in the claim (Optional). +func (o *UsernameClaim) GetPrefix() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.prefix + } + return +} + +// PrefixPolicy returns the value of the 'prefix_policy' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// PrefixPolicy specifies how a prefix should apply. +// +// By default, claims other than `email` will be prefixed with the issuer URL to +// prevent naming clashes with other plugins. +// +// Set to "NoPrefix" to disable prefixing. +func (o *UsernameClaim) PrefixPolicy() string { + if o != nil && o.bitmap_&4 != 0 { + return o.prefixPolicy + } + return "" +} + +// GetPrefixPolicy returns the value of the 'prefix_policy' attribute and +// a flag indicating if the attribute has a value. +// +// PrefixPolicy specifies how a prefix should apply. +// +// By default, claims other than `email` will be prefixed with the issuer URL to +// prevent naming clashes with other plugins. +// +// Set to "NoPrefix" to disable prefixing. +func (o *UsernameClaim) GetPrefixPolicy() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.prefixPolicy + } + return +} + +// UsernameClaimListKind is the name of the type used to represent list of objects of +// type 'username_claim'. +const UsernameClaimListKind = "UsernameClaimList" + +// UsernameClaimListLinkKind is the name of the type used to represent links to list +// of objects of type 'username_claim'. +const UsernameClaimListLinkKind = "UsernameClaimListLink" + +// UsernameClaimNilKind is the name of the type used to nil lists of objects of +// type 'username_claim'. +const UsernameClaimListNilKind = "UsernameClaimListNil" + +// UsernameClaimList is a list of values of the 'username_claim' type. +type UsernameClaimList struct { + href string + link bool + items []*UsernameClaim +} + +// Len returns the length of the list. +func (l *UsernameClaimList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *UsernameClaimList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *UsernameClaimList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *UsernameClaimList) SetItems(items []*UsernameClaim) { + l.items = items +} + +// Items returns the items of the list. +func (l *UsernameClaimList) Items() []*UsernameClaim { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *UsernameClaimList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *UsernameClaimList) Get(i int) *UsernameClaim { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *UsernameClaimList) Slice() []*UsernameClaim { + var slice []*UsernameClaim + if l == nil { + slice = make([]*UsernameClaim, 0) + } else { + slice = make([]*UsernameClaim, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *UsernameClaimList) Each(f func(item *UsernameClaim) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *UsernameClaimList) Range(f func(index int, item *UsernameClaim) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/username_claim_type_json.go b/clientapi/clustersmgmt/v1/username_claim_type_json.go new file mode 100644 index 00000000..859b2528 --- /dev/null +++ b/clientapi/clustersmgmt/v1/username_claim_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalUsernameClaim writes a value of the 'username_claim' type to the given writer. +func MarshalUsernameClaim(object *UsernameClaim, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteUsernameClaim(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteUsernameClaim writes a value of the 'username_claim' type to the given stream. +func WriteUsernameClaim(object *UsernameClaim, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("claim") + stream.WriteString(object.claim) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("prefix") + stream.WriteString(object.prefix) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("prefix_policy") + stream.WriteString(object.prefixPolicy) + } + stream.WriteObjectEnd() +} + +// UnmarshalUsernameClaim reads a value of the 'username_claim' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalUsernameClaim(source interface{}) (object *UsernameClaim, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadUsernameClaim(iterator) + err = iterator.Error + return +} + +// ReadUsernameClaim reads a value of the 'username_claim' type from the given iterator. +func ReadUsernameClaim(iterator *jsoniter.Iterator) *UsernameClaim { + object := &UsernameClaim{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "claim": + value := iterator.ReadString() + object.claim = value + object.bitmap_ |= 1 + case "prefix": + value := iterator.ReadString() + object.prefix = value + object.bitmap_ |= 2 + case "prefix_policy": + value := iterator.ReadString() + object.prefixPolicy = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/value_builder.go b/clientapi/clustersmgmt/v1/value_builder.go new file mode 100644 index 00000000..1a83dfdc --- /dev/null +++ b/clientapi/clustersmgmt/v1/value_builder.go @@ -0,0 +1,90 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ValueBuilder contains the data and logic needed to build 'value' objects. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +type ValueBuilder struct { + bitmap_ uint32 + unit string + value float64 +} + +// NewValue creates a new builder of 'value' objects. +func NewValue() *ValueBuilder { + return &ValueBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ValueBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Unit sets the value of the 'unit' attribute to the given value. +func (b *ValueBuilder) Unit(value string) *ValueBuilder { + b.unit = value + b.bitmap_ |= 1 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *ValueBuilder) Value(value float64) *ValueBuilder { + b.value = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ValueBuilder) Copy(object *Value) *ValueBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.unit = object.unit + b.value = object.value + return b +} + +// Build creates a 'value' object using the configuration stored in the builder. +func (b *ValueBuilder) Build() (object *Value, err error) { + object = new(Value) + object.bitmap_ = b.bitmap_ + object.unit = b.unit + object.value = b.value + return +} diff --git a/clientapi/clustersmgmt/v1/value_list_builder.go b/clientapi/clustersmgmt/v1/value_list_builder.go new file mode 100644 index 00000000..25968038 --- /dev/null +++ b/clientapi/clustersmgmt/v1/value_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// ValueListBuilder contains the data and logic needed to build +// 'value' objects. +type ValueListBuilder struct { + items []*ValueBuilder +} + +// NewValueList creates a new builder of 'value' objects. +func NewValueList() *ValueListBuilder { + return new(ValueListBuilder) +} + +// Items sets the items of the list. +func (b *ValueListBuilder) Items(values ...*ValueBuilder) *ValueListBuilder { + b.items = make([]*ValueBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ValueListBuilder) 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 *ValueListBuilder) Copy(list *ValueList) *ValueListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ValueBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewValue().Copy(v) + } + } + return b +} + +// Build creates a list of 'value' objects using the +// configuration stored in the builder. +func (b *ValueListBuilder) Build() (list *ValueList, err error) { + items := make([]*Value, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ValueList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/value_list_type_json.go b/clientapi/clustersmgmt/v1/value_list_type_json.go new file mode 100644 index 00000000..e1734ef3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/value_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalValueList writes a list of values of the 'value' type to +// the given writer. +func MarshalValueList(list []*Value, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteValueList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteValueList writes a list of value of the 'value' type to +// the given stream. +func WriteValueList(list []*Value, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteValue(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalValueList reads a list of values of the 'value' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalValueList(source interface{}) (items []*Value, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadValueList(iterator) + err = iterator.Error + return +} + +// ReadValueList reads list of values of the ”value' type from +// the given iterator. +func ReadValueList(iterator *jsoniter.Iterator) []*Value { + list := []*Value{} + for iterator.ReadArray() { + item := ReadValue(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/value_type.go b/clientapi/clustersmgmt/v1/value_type.go new file mode 100644 index 00000000..854d3f0c --- /dev/null +++ b/clientapi/clustersmgmt/v1/value_type.go @@ -0,0 +1,206 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// Value represents the values of the 'value' type. +// +// Numeric value and the unit used to measure it. +// +// Units are not mandatory, and they're not specified for some resources. For +// resources that use bytes, the accepted units are: +// +// - 1 B = 1 byte +// - 1 KB = 10^3 bytes +// - 1 MB = 10^6 bytes +// - 1 GB = 10^9 bytes +// - 1 TB = 10^12 bytes +// - 1 PB = 10^15 bytes +// +// - 1 B = 1 byte +// - 1 KiB = 2^10 bytes +// - 1 MiB = 2^20 bytes +// - 1 GiB = 2^30 bytes +// - 1 TiB = 2^40 bytes +// - 1 PiB = 2^50 bytes +type Value struct { + bitmap_ uint32 + unit string + value float64 +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Value) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Unit returns the value of the 'unit' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the unit used to measure the value. +func (o *Value) Unit() string { + if o != nil && o.bitmap_&1 != 0 { + return o.unit + } + return "" +} + +// GetUnit returns the value of the 'unit' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the unit used to measure the value. +func (o *Value) GetUnit() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.unit + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Numeric value. +func (o *Value) Value() float64 { + if o != nil && o.bitmap_&2 != 0 { + return o.value + } + return 0.0 +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Numeric value. +func (o *Value) GetValue() (value float64, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.value + } + return +} + +// ValueListKind is the name of the type used to represent list of objects of +// type 'value'. +const ValueListKind = "ValueList" + +// ValueListLinkKind is the name of the type used to represent links to list +// of objects of type 'value'. +const ValueListLinkKind = "ValueListLink" + +// ValueNilKind is the name of the type used to nil lists of objects of +// type 'value'. +const ValueListNilKind = "ValueListNil" + +// ValueList is a list of values of the 'value' type. +type ValueList struct { + href string + link bool + items []*Value +} + +// Len returns the length of the list. +func (l *ValueList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ValueList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ValueList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ValueList) SetItems(items []*Value) { + l.items = items +} + +// Items returns the items of the list. +func (l *ValueList) Items() []*Value { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ValueList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ValueList) Get(i int) *Value { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ValueList) Slice() []*Value { + var slice []*Value + if l == nil { + slice = make([]*Value, 0) + } else { + slice = make([]*Value, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ValueList) Each(f func(item *Value) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ValueList) Range(f func(index int, item *Value) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/value_type_json.go b/clientapi/clustersmgmt/v1/value_type_json.go new file mode 100644 index 00000000..1af37012 --- /dev/null +++ b/clientapi/clustersmgmt/v1/value_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalValue writes a value of the 'value' type to the given writer. +func MarshalValue(object *Value, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteValue(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteValue writes a value of the 'value' type to the given stream. +func WriteValue(object *Value, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("unit") + stream.WriteString(object.unit) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteFloat64(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalValue reads a value of the 'value' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalValue(source interface{}) (object *Value, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadValue(iterator) + err = iterator.Error + return +} + +// ReadValue reads a value of the 'value' type from the given iterator. +func ReadValue(iterator *jsoniter.Iterator) *Value { + object := &Value{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "unit": + value := iterator.ReadString() + object.unit = value + object.bitmap_ |= 1 + case "value": + value := iterator.ReadFloat64() + object.value = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/version_builder.go b/clientapi/clustersmgmt/v1/version_builder.go new file mode 100644 index 00000000..333752f8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_builder.go @@ -0,0 +1,260 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// VersionBuilder contains the data and logic needed to build 'version' objects. +// +// Representation of an _OpenShift_ version. +type VersionBuilder struct { + bitmap_ uint32 + id string + href string + availableUpgrades []string + channelGroup string + endOfLifeTimestamp time.Time + imageOverrides *ImageOverridesBuilder + rawID string + releaseImage string + releaseImages *ReleaseImagesBuilder + gcpMarketplaceEnabled bool + rosaEnabled bool + default_ bool + enabled bool + hostedControlPlaneDefault bool + hostedControlPlaneEnabled bool + wifEnabled bool +} + +// NewVersion creates a new builder of 'version' objects. +func NewVersion() *VersionBuilder { + return &VersionBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *VersionBuilder) Link(value bool) *VersionBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *VersionBuilder) ID(value string) *VersionBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *VersionBuilder) HREF(value string) *VersionBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *VersionBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// GCPMarketplaceEnabled sets the value of the 'GCP_marketplace_enabled' attribute to the given value. +func (b *VersionBuilder) GCPMarketplaceEnabled(value bool) *VersionBuilder { + b.gcpMarketplaceEnabled = value + b.bitmap_ |= 8 + return b +} + +// ROSAEnabled sets the value of the 'ROSA_enabled' attribute to the given value. +func (b *VersionBuilder) ROSAEnabled(value bool) *VersionBuilder { + b.rosaEnabled = value + b.bitmap_ |= 16 + return b +} + +// AvailableUpgrades sets the value of the 'available_upgrades' attribute to the given values. +func (b *VersionBuilder) AvailableUpgrades(values ...string) *VersionBuilder { + b.availableUpgrades = make([]string, len(values)) + copy(b.availableUpgrades, values) + b.bitmap_ |= 32 + return b +} + +// ChannelGroup sets the value of the 'channel_group' attribute to the given value. +func (b *VersionBuilder) ChannelGroup(value string) *VersionBuilder { + b.channelGroup = value + b.bitmap_ |= 64 + return b +} + +// Default sets the value of the 'default' attribute to the given value. +func (b *VersionBuilder) Default(value bool) *VersionBuilder { + b.default_ = value + b.bitmap_ |= 128 + return b +} + +// Enabled sets the value of the 'enabled' attribute to the given value. +func (b *VersionBuilder) Enabled(value bool) *VersionBuilder { + b.enabled = value + b.bitmap_ |= 256 + return b +} + +// EndOfLifeTimestamp sets the value of the 'end_of_life_timestamp' attribute to the given value. +func (b *VersionBuilder) EndOfLifeTimestamp(value time.Time) *VersionBuilder { + b.endOfLifeTimestamp = value + b.bitmap_ |= 512 + return b +} + +// HostedControlPlaneDefault sets the value of the 'hosted_control_plane_default' attribute to the given value. +func (b *VersionBuilder) HostedControlPlaneDefault(value bool) *VersionBuilder { + b.hostedControlPlaneDefault = value + b.bitmap_ |= 1024 + return b +} + +// HostedControlPlaneEnabled sets the value of the 'hosted_control_plane_enabled' attribute to the given value. +func (b *VersionBuilder) HostedControlPlaneEnabled(value bool) *VersionBuilder { + b.hostedControlPlaneEnabled = value + b.bitmap_ |= 2048 + return b +} + +// ImageOverrides sets the value of the 'image_overrides' attribute to the given value. +// +// ImageOverrides holds the lists of available images per cloud provider. +func (b *VersionBuilder) ImageOverrides(value *ImageOverridesBuilder) *VersionBuilder { + b.imageOverrides = value + if value != nil { + b.bitmap_ |= 4096 + } else { + b.bitmap_ &^= 4096 + } + return b +} + +// RawID sets the value of the 'raw_ID' attribute to the given value. +func (b *VersionBuilder) RawID(value string) *VersionBuilder { + b.rawID = value + b.bitmap_ |= 8192 + return b +} + +// ReleaseImage sets the value of the 'release_image' attribute to the given value. +func (b *VersionBuilder) ReleaseImage(value string) *VersionBuilder { + b.releaseImage = value + b.bitmap_ |= 16384 + return b +} + +// ReleaseImages sets the value of the 'release_images' attribute to the given value. +func (b *VersionBuilder) ReleaseImages(value *ReleaseImagesBuilder) *VersionBuilder { + b.releaseImages = value + if value != nil { + b.bitmap_ |= 32768 + } else { + b.bitmap_ &^= 32768 + } + return b +} + +// WifEnabled sets the value of the 'wif_enabled' attribute to the given value. +func (b *VersionBuilder) WifEnabled(value bool) *VersionBuilder { + b.wifEnabled = value + b.bitmap_ |= 65536 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *VersionBuilder) Copy(object *Version) *VersionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.gcpMarketplaceEnabled = object.gcpMarketplaceEnabled + b.rosaEnabled = object.rosaEnabled + if object.availableUpgrades != nil { + b.availableUpgrades = make([]string, len(object.availableUpgrades)) + copy(b.availableUpgrades, object.availableUpgrades) + } else { + b.availableUpgrades = nil + } + b.channelGroup = object.channelGroup + b.default_ = object.default_ + b.enabled = object.enabled + b.endOfLifeTimestamp = object.endOfLifeTimestamp + b.hostedControlPlaneDefault = object.hostedControlPlaneDefault + b.hostedControlPlaneEnabled = object.hostedControlPlaneEnabled + if object.imageOverrides != nil { + b.imageOverrides = NewImageOverrides().Copy(object.imageOverrides) + } else { + b.imageOverrides = nil + } + b.rawID = object.rawID + b.releaseImage = object.releaseImage + if object.releaseImages != nil { + b.releaseImages = NewReleaseImages().Copy(object.releaseImages) + } else { + b.releaseImages = nil + } + b.wifEnabled = object.wifEnabled + return b +} + +// Build creates a 'version' object using the configuration stored in the builder. +func (b *VersionBuilder) Build() (object *Version, err error) { + object = new(Version) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.gcpMarketplaceEnabled = b.gcpMarketplaceEnabled + object.rosaEnabled = b.rosaEnabled + if b.availableUpgrades != nil { + object.availableUpgrades = make([]string, len(b.availableUpgrades)) + copy(object.availableUpgrades, b.availableUpgrades) + } + object.channelGroup = b.channelGroup + object.default_ = b.default_ + object.enabled = b.enabled + object.endOfLifeTimestamp = b.endOfLifeTimestamp + object.hostedControlPlaneDefault = b.hostedControlPlaneDefault + object.hostedControlPlaneEnabled = b.hostedControlPlaneEnabled + if b.imageOverrides != nil { + object.imageOverrides, err = b.imageOverrides.Build() + if err != nil { + return + } + } + object.rawID = b.rawID + object.releaseImage = b.releaseImage + if b.releaseImages != nil { + object.releaseImages, err = b.releaseImages.Build() + if err != nil { + return + } + } + object.wifEnabled = b.wifEnabled + return +} diff --git a/clientapi/clustersmgmt/v1/version_gate_agreement_builder.go b/clientapi/clustersmgmt/v1/version_gate_agreement_builder.go new file mode 100644 index 00000000..37454695 --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_gate_agreement_builder.go @@ -0,0 +1,118 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// VersionGateAgreementBuilder contains the data and logic needed to build 'version_gate_agreement' objects. +// +// VersionGateAgreement represents a version gate that the user agreed to for a specific cluster. +type VersionGateAgreementBuilder struct { + bitmap_ uint32 + id string + href string + agreedTimestamp time.Time + versionGate *VersionGateBuilder +} + +// NewVersionGateAgreement creates a new builder of 'version_gate_agreement' objects. +func NewVersionGateAgreement() *VersionGateAgreementBuilder { + return &VersionGateAgreementBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *VersionGateAgreementBuilder) Link(value bool) *VersionGateAgreementBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *VersionGateAgreementBuilder) ID(value string) *VersionGateAgreementBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *VersionGateAgreementBuilder) HREF(value string) *VersionGateAgreementBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *VersionGateAgreementBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AgreedTimestamp sets the value of the 'agreed_timestamp' attribute to the given value. +func (b *VersionGateAgreementBuilder) AgreedTimestamp(value time.Time) *VersionGateAgreementBuilder { + b.agreedTimestamp = value + b.bitmap_ |= 8 + return b +} + +// VersionGate sets the value of the 'version_gate' attribute to the given value. +// +// Representation of an _OpenShift_ version gate. +func (b *VersionGateAgreementBuilder) VersionGate(value *VersionGateBuilder) *VersionGateAgreementBuilder { + b.versionGate = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *VersionGateAgreementBuilder) Copy(object *VersionGateAgreement) *VersionGateAgreementBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.agreedTimestamp = object.agreedTimestamp + if object.versionGate != nil { + b.versionGate = NewVersionGate().Copy(object.versionGate) + } else { + b.versionGate = nil + } + return b +} + +// Build creates a 'version_gate_agreement' object using the configuration stored in the builder. +func (b *VersionGateAgreementBuilder) Build() (object *VersionGateAgreement, err error) { + object = new(VersionGateAgreement) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.agreedTimestamp = b.agreedTimestamp + if b.versionGate != nil { + object.versionGate, err = b.versionGate.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/version_gate_agreement_list_builder.go b/clientapi/clustersmgmt/v1/version_gate_agreement_list_builder.go new file mode 100644 index 00000000..e97423aa --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_gate_agreement_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// VersionGateAgreementListBuilder contains the data and logic needed to build +// 'version_gate_agreement' objects. +type VersionGateAgreementListBuilder struct { + items []*VersionGateAgreementBuilder +} + +// NewVersionGateAgreementList creates a new builder of 'version_gate_agreement' objects. +func NewVersionGateAgreementList() *VersionGateAgreementListBuilder { + return new(VersionGateAgreementListBuilder) +} + +// Items sets the items of the list. +func (b *VersionGateAgreementListBuilder) Items(values ...*VersionGateAgreementBuilder) *VersionGateAgreementListBuilder { + b.items = make([]*VersionGateAgreementBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *VersionGateAgreementListBuilder) 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 *VersionGateAgreementListBuilder) Copy(list *VersionGateAgreementList) *VersionGateAgreementListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*VersionGateAgreementBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewVersionGateAgreement().Copy(v) + } + } + return b +} + +// Build creates a list of 'version_gate_agreement' objects using the +// configuration stored in the builder. +func (b *VersionGateAgreementListBuilder) Build() (list *VersionGateAgreementList, err error) { + items := make([]*VersionGateAgreement, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(VersionGateAgreementList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/version_gate_agreement_list_type_json.go b/clientapi/clustersmgmt/v1/version_gate_agreement_list_type_json.go new file mode 100644 index 00000000..7cce357c --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_gate_agreement_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalVersionGateAgreementList writes a list of values of the 'version_gate_agreement' type to +// the given writer. +func MarshalVersionGateAgreementList(list []*VersionGateAgreement, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteVersionGateAgreementList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteVersionGateAgreementList writes a list of value of the 'version_gate_agreement' type to +// the given stream. +func WriteVersionGateAgreementList(list []*VersionGateAgreement, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteVersionGateAgreement(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalVersionGateAgreementList reads a list of values of the 'version_gate_agreement' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalVersionGateAgreementList(source interface{}) (items []*VersionGateAgreement, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadVersionGateAgreementList(iterator) + err = iterator.Error + return +} + +// ReadVersionGateAgreementList reads list of values of the ”version_gate_agreement' type from +// the given iterator. +func ReadVersionGateAgreementList(iterator *jsoniter.Iterator) []*VersionGateAgreement { + list := []*VersionGateAgreement{} + for iterator.ReadArray() { + item := ReadVersionGateAgreement(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/version_gate_agreement_type.go b/clientapi/clustersmgmt/v1/version_gate_agreement_type.go new file mode 100644 index 00000000..f8781a7f --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_gate_agreement_type.go @@ -0,0 +1,293 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// VersionGateAgreementKind is the name of the type used to represent objects +// of type 'version_gate_agreement'. +const VersionGateAgreementKind = "VersionGateAgreement" + +// VersionGateAgreementLinkKind is the name of the type used to represent links +// to objects of type 'version_gate_agreement'. +const VersionGateAgreementLinkKind = "VersionGateAgreementLink" + +// VersionGateAgreementNilKind is the name of the type used to nil references +// to objects of type 'version_gate_agreement'. +const VersionGateAgreementNilKind = "VersionGateAgreementNil" + +// VersionGateAgreement represents the values of the 'version_gate_agreement' type. +// +// VersionGateAgreement represents a version gate that the user agreed to for a specific cluster. +type VersionGateAgreement struct { + bitmap_ uint32 + id string + href string + agreedTimestamp time.Time + versionGate *VersionGate +} + +// Kind returns the name of the type of the object. +func (o *VersionGateAgreement) Kind() string { + if o == nil { + return VersionGateAgreementNilKind + } + if o.bitmap_&1 != 0 { + return VersionGateAgreementLinkKind + } + return VersionGateAgreementKind +} + +// Link returns true if this is a link. +func (o *VersionGateAgreement) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *VersionGateAgreement) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *VersionGateAgreement) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *VersionGateAgreement) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *VersionGateAgreement) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *VersionGateAgreement) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AgreedTimestamp returns the value of the 'agreed_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The time the user agreed to the version gate +func (o *VersionGateAgreement) AgreedTimestamp() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.agreedTimestamp + } + return time.Time{} +} + +// GetAgreedTimestamp returns the value of the 'agreed_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// The time the user agreed to the version gate +func (o *VersionGateAgreement) GetAgreedTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.agreedTimestamp + } + return +} + +// VersionGate returns the value of the 'version_gate' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// link to the version gate that the user agreed to +func (o *VersionGateAgreement) VersionGate() *VersionGate { + if o != nil && o.bitmap_&16 != 0 { + return o.versionGate + } + return nil +} + +// GetVersionGate returns the value of the 'version_gate' attribute and +// a flag indicating if the attribute has a value. +// +// link to the version gate that the user agreed to +func (o *VersionGateAgreement) GetVersionGate() (value *VersionGate, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.versionGate + } + return +} + +// VersionGateAgreementListKind is the name of the type used to represent list of objects of +// type 'version_gate_agreement'. +const VersionGateAgreementListKind = "VersionGateAgreementList" + +// VersionGateAgreementListLinkKind is the name of the type used to represent links to list +// of objects of type 'version_gate_agreement'. +const VersionGateAgreementListLinkKind = "VersionGateAgreementListLink" + +// VersionGateAgreementNilKind is the name of the type used to nil lists of objects of +// type 'version_gate_agreement'. +const VersionGateAgreementListNilKind = "VersionGateAgreementListNil" + +// VersionGateAgreementList is a list of values of the 'version_gate_agreement' type. +type VersionGateAgreementList struct { + href string + link bool + items []*VersionGateAgreement +} + +// Kind returns the name of the type of the object. +func (l *VersionGateAgreementList) Kind() string { + if l == nil { + return VersionGateAgreementListNilKind + } + if l.link { + return VersionGateAgreementListLinkKind + } + return VersionGateAgreementListKind +} + +// Link returns true iif this is a link. +func (l *VersionGateAgreementList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *VersionGateAgreementList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *VersionGateAgreementList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *VersionGateAgreementList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *VersionGateAgreementList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *VersionGateAgreementList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *VersionGateAgreementList) SetItems(items []*VersionGateAgreement) { + l.items = items +} + +// Items returns the items of the list. +func (l *VersionGateAgreementList) Items() []*VersionGateAgreement { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *VersionGateAgreementList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *VersionGateAgreementList) Get(i int) *VersionGateAgreement { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *VersionGateAgreementList) Slice() []*VersionGateAgreement { + var slice []*VersionGateAgreement + if l == nil { + slice = make([]*VersionGateAgreement, 0) + } else { + slice = make([]*VersionGateAgreement, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *VersionGateAgreementList) Each(f func(item *VersionGateAgreement) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *VersionGateAgreementList) Range(f func(index int, item *VersionGateAgreement) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/version_gate_agreement_type_json.go b/clientapi/clustersmgmt/v1/version_gate_agreement_type_json.go new file mode 100644 index 00000000..c8a83eaa --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_gate_agreement_type_json.go @@ -0,0 +1,138 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalVersionGateAgreement writes a value of the 'version_gate_agreement' type to the given writer. +func MarshalVersionGateAgreement(object *VersionGateAgreement, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteVersionGateAgreement(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteVersionGateAgreement writes a value of the 'version_gate_agreement' type to the given stream. +func WriteVersionGateAgreement(object *VersionGateAgreement, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(VersionGateAgreementLinkKind) + } else { + stream.WriteString(VersionGateAgreementKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("agreed_timestamp") + stream.WriteString((object.agreedTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 && object.versionGate != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version_gate") + WriteVersionGate(object.versionGate, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalVersionGateAgreement reads a value of the 'version_gate_agreement' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalVersionGateAgreement(source interface{}) (object *VersionGateAgreement, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadVersionGateAgreement(iterator) + err = iterator.Error + return +} + +// ReadVersionGateAgreement reads a value of the 'version_gate_agreement' type from the given iterator. +func ReadVersionGateAgreement(iterator *jsoniter.Iterator) *VersionGateAgreement { + object := &VersionGateAgreement{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == VersionGateAgreementLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "agreed_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.agreedTimestamp = value + object.bitmap_ |= 8 + case "version_gate": + value := ReadVersionGate(iterator) + object.versionGate = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/version_gate_builder.go b/clientapi/clustersmgmt/v1/version_gate_builder.go new file mode 100644 index 00000000..82962dbc --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_gate_builder.go @@ -0,0 +1,173 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// VersionGateBuilder contains the data and logic needed to build 'version_gate' objects. +// +// Representation of an _OpenShift_ version gate. +type VersionGateBuilder struct { + bitmap_ uint32 + id string + href string + clusterCondition string + creationTimestamp time.Time + description string + documentationURL string + label string + value string + versionRawIDPrefix string + warningMessage string + stsOnly bool +} + +// NewVersionGate creates a new builder of 'version_gate' objects. +func NewVersionGate() *VersionGateBuilder { + return &VersionGateBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *VersionGateBuilder) Link(value bool) *VersionGateBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *VersionGateBuilder) ID(value string) *VersionGateBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *VersionGateBuilder) HREF(value string) *VersionGateBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *VersionGateBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// STSOnly sets the value of the 'STS_only' attribute to the given value. +func (b *VersionGateBuilder) STSOnly(value bool) *VersionGateBuilder { + b.stsOnly = value + b.bitmap_ |= 8 + return b +} + +// ClusterCondition sets the value of the 'cluster_condition' attribute to the given value. +func (b *VersionGateBuilder) ClusterCondition(value string) *VersionGateBuilder { + b.clusterCondition = value + b.bitmap_ |= 16 + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *VersionGateBuilder) CreationTimestamp(value time.Time) *VersionGateBuilder { + b.creationTimestamp = value + b.bitmap_ |= 32 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *VersionGateBuilder) Description(value string) *VersionGateBuilder { + b.description = value + b.bitmap_ |= 64 + return b +} + +// DocumentationURL sets the value of the 'documentation_URL' attribute to the given value. +func (b *VersionGateBuilder) DocumentationURL(value string) *VersionGateBuilder { + b.documentationURL = value + b.bitmap_ |= 128 + return b +} + +// Label sets the value of the 'label' attribute to the given value. +func (b *VersionGateBuilder) Label(value string) *VersionGateBuilder { + b.label = value + b.bitmap_ |= 256 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *VersionGateBuilder) Value(value string) *VersionGateBuilder { + b.value = value + b.bitmap_ |= 512 + return b +} + +// VersionRawIDPrefix sets the value of the 'version_raw_ID_prefix' attribute to the given value. +func (b *VersionGateBuilder) VersionRawIDPrefix(value string) *VersionGateBuilder { + b.versionRawIDPrefix = value + b.bitmap_ |= 1024 + return b +} + +// WarningMessage sets the value of the 'warning_message' attribute to the given value. +func (b *VersionGateBuilder) WarningMessage(value string) *VersionGateBuilder { + b.warningMessage = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *VersionGateBuilder) Copy(object *VersionGate) *VersionGateBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.stsOnly = object.stsOnly + b.clusterCondition = object.clusterCondition + b.creationTimestamp = object.creationTimestamp + b.description = object.description + b.documentationURL = object.documentationURL + b.label = object.label + b.value = object.value + b.versionRawIDPrefix = object.versionRawIDPrefix + b.warningMessage = object.warningMessage + return b +} + +// Build creates a 'version_gate' object using the configuration stored in the builder. +func (b *VersionGateBuilder) Build() (object *VersionGate, err error) { + object = new(VersionGate) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.stsOnly = b.stsOnly + object.clusterCondition = b.clusterCondition + object.creationTimestamp = b.creationTimestamp + object.description = b.description + object.documentationURL = b.documentationURL + object.label = b.label + object.value = b.value + object.versionRawIDPrefix = b.versionRawIDPrefix + object.warningMessage = b.warningMessage + return +} diff --git a/clientapi/clustersmgmt/v1/version_gate_list_builder.go b/clientapi/clustersmgmt/v1/version_gate_list_builder.go new file mode 100644 index 00000000..90921289 --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_gate_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// VersionGateListBuilder contains the data and logic needed to build +// 'version_gate' objects. +type VersionGateListBuilder struct { + items []*VersionGateBuilder +} + +// NewVersionGateList creates a new builder of 'version_gate' objects. +func NewVersionGateList() *VersionGateListBuilder { + return new(VersionGateListBuilder) +} + +// Items sets the items of the list. +func (b *VersionGateListBuilder) Items(values ...*VersionGateBuilder) *VersionGateListBuilder { + b.items = make([]*VersionGateBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *VersionGateListBuilder) 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 *VersionGateListBuilder) Copy(list *VersionGateList) *VersionGateListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*VersionGateBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewVersionGate().Copy(v) + } + } + return b +} + +// Build creates a list of 'version_gate' objects using the +// configuration stored in the builder. +func (b *VersionGateListBuilder) Build() (list *VersionGateList, err error) { + items := make([]*VersionGate, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(VersionGateList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/version_gate_list_type_json.go b/clientapi/clustersmgmt/v1/version_gate_list_type_json.go new file mode 100644 index 00000000..8a28d136 --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_gate_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalVersionGateList writes a list of values of the 'version_gate' type to +// the given writer. +func MarshalVersionGateList(list []*VersionGate, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteVersionGateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteVersionGateList writes a list of value of the 'version_gate' type to +// the given stream. +func WriteVersionGateList(list []*VersionGate, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteVersionGate(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalVersionGateList reads a list of values of the 'version_gate' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalVersionGateList(source interface{}) (items []*VersionGate, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadVersionGateList(iterator) + err = iterator.Error + return +} + +// ReadVersionGateList reads list of values of the ”version_gate' type from +// the given iterator. +func ReadVersionGateList(iterator *jsoniter.Iterator) []*VersionGate { + list := []*VersionGate{} + for iterator.ReadArray() { + item := ReadVersionGate(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/version_gate_type.go b/clientapi/clustersmgmt/v1/version_gate_type.go new file mode 100644 index 00000000..25a585dc --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_gate_type.go @@ -0,0 +1,467 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// VersionGateKind is the name of the type used to represent objects +// of type 'version_gate'. +const VersionGateKind = "VersionGate" + +// VersionGateLinkKind is the name of the type used to represent links +// to objects of type 'version_gate'. +const VersionGateLinkKind = "VersionGateLink" + +// VersionGateNilKind is the name of the type used to nil references +// to objects of type 'version_gate'. +const VersionGateNilKind = "VersionGateNil" + +// VersionGate represents the values of the 'version_gate' type. +// +// Representation of an _OpenShift_ version gate. +type VersionGate struct { + bitmap_ uint32 + id string + href string + clusterCondition string + creationTimestamp time.Time + description string + documentationURL string + label string + value string + versionRawIDPrefix string + warningMessage string + stsOnly bool +} + +// Kind returns the name of the type of the object. +func (o *VersionGate) Kind() string { + if o == nil { + return VersionGateNilKind + } + if o.bitmap_&1 != 0 { + return VersionGateLinkKind + } + return VersionGateKind +} + +// Link returns true if this is a link. +func (o *VersionGate) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *VersionGate) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *VersionGate) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *VersionGate) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *VersionGate) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *VersionGate) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// STSOnly returns the value of the 'STS_only' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// STSOnly indicates if this version gate is for STS clusters only, +// deprecated: to be replaced with ClusterCondition +func (o *VersionGate) STSOnly() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.stsOnly + } + return false +} + +// GetSTSOnly returns the value of the 'STS_only' attribute and +// a flag indicating if the attribute has a value. +// +// STSOnly indicates if this version gate is for STS clusters only, +// deprecated: to be replaced with ClusterCondition +func (o *VersionGate) GetSTSOnly() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.stsOnly + } + return +} + +// ClusterCondition returns the value of the 'cluster_condition' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ClusterCondition aims at selecting the clusters targeted by this version gate, +// ignored if STSOnly is true +func (o *VersionGate) ClusterCondition() string { + if o != nil && o.bitmap_&16 != 0 { + return o.clusterCondition + } + return "" +} + +// GetClusterCondition returns the value of the 'cluster_condition' attribute and +// a flag indicating if the attribute has a value. +// +// ClusterCondition aims at selecting the clusters targeted by this version gate, +// ignored if STSOnly is true +func (o *VersionGate) GetClusterCondition() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.clusterCondition + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// CreationTimestamp is the date and time when the version gate was created, +// format defined in https://www.ietf.org/rfc/rfc3339.txt[RC3339]. +func (o *VersionGate) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// CreationTimestamp is the date and time when the version gate was created, +// format defined in https://www.ietf.org/rfc/rfc3339.txt[RC3339]. +func (o *VersionGate) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Description of the version gate. +func (o *VersionGate) Description() string { + if o != nil && o.bitmap_&64 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Description of the version gate. +func (o *VersionGate) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.description + } + return +} + +// DocumentationURL returns the value of the 'documentation_URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DocumentationURL is the URL for the documentation of the version gate. +func (o *VersionGate) DocumentationURL() string { + if o != nil && o.bitmap_&128 != 0 { + return o.documentationURL + } + return "" +} + +// GetDocumentationURL returns the value of the 'documentation_URL' attribute and +// a flag indicating if the attribute has a value. +// +// DocumentationURL is the URL for the documentation of the version gate. +func (o *VersionGate) GetDocumentationURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.documentationURL + } + return +} + +// Label returns the value of the 'label' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Label representing the version gate in OpenShift. +func (o *VersionGate) Label() string { + if o != nil && o.bitmap_&256 != 0 { + return o.label + } + return "" +} + +// GetLabel returns the value of the 'label' attribute and +// a flag indicating if the attribute has a value. +// +// Label representing the version gate in OpenShift. +func (o *VersionGate) GetLabel() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.label + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Value represents the required value of the label. +func (o *VersionGate) Value() string { + if o != nil && o.bitmap_&512 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Value represents the required value of the label. +func (o *VersionGate) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.value + } + return +} + +// VersionRawIDPrefix returns the value of the 'version_raw_ID_prefix' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// VersionRawIDPrefix represents the versions prefix that the gate applies to. +func (o *VersionGate) VersionRawIDPrefix() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.versionRawIDPrefix + } + return "" +} + +// GetVersionRawIDPrefix returns the value of the 'version_raw_ID_prefix' attribute and +// a flag indicating if the attribute has a value. +// +// VersionRawIDPrefix represents the versions prefix that the gate applies to. +func (o *VersionGate) GetVersionRawIDPrefix() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.versionRawIDPrefix + } + return +} + +// WarningMessage returns the value of the 'warning_message' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// WarningMessage is a warning that will be displayed to the user before they acknowledge the gate +func (o *VersionGate) WarningMessage() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.warningMessage + } + return "" +} + +// GetWarningMessage returns the value of the 'warning_message' attribute and +// a flag indicating if the attribute has a value. +// +// WarningMessage is a warning that will be displayed to the user before they acknowledge the gate +func (o *VersionGate) GetWarningMessage() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.warningMessage + } + return +} + +// VersionGateListKind is the name of the type used to represent list of objects of +// type 'version_gate'. +const VersionGateListKind = "VersionGateList" + +// VersionGateListLinkKind is the name of the type used to represent links to list +// of objects of type 'version_gate'. +const VersionGateListLinkKind = "VersionGateListLink" + +// VersionGateNilKind is the name of the type used to nil lists of objects of +// type 'version_gate'. +const VersionGateListNilKind = "VersionGateListNil" + +// VersionGateList is a list of values of the 'version_gate' type. +type VersionGateList struct { + href string + link bool + items []*VersionGate +} + +// Kind returns the name of the type of the object. +func (l *VersionGateList) Kind() string { + if l == nil { + return VersionGateListNilKind + } + if l.link { + return VersionGateListLinkKind + } + return VersionGateListKind +} + +// Link returns true iif this is a link. +func (l *VersionGateList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *VersionGateList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *VersionGateList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *VersionGateList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *VersionGateList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *VersionGateList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *VersionGateList) SetItems(items []*VersionGate) { + l.items = items +} + +// Items returns the items of the list. +func (l *VersionGateList) Items() []*VersionGate { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *VersionGateList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *VersionGateList) Get(i int) *VersionGate { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *VersionGateList) Slice() []*VersionGate { + var slice []*VersionGate + if l == nil { + slice = make([]*VersionGate, 0) + } else { + slice = make([]*VersionGate, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *VersionGateList) Each(f func(item *VersionGate) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *VersionGateList) Range(f func(index int, item *VersionGate) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/version_gate_type_json.go b/clientapi/clustersmgmt/v1/version_gate_type_json.go new file mode 100644 index 00000000..bb3d2dcb --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_gate_type_json.go @@ -0,0 +1,229 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalVersionGate writes a value of the 'version_gate' type to the given writer. +func MarshalVersionGate(object *VersionGate, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteVersionGate(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteVersionGate writes a value of the 'version_gate' type to the given stream. +func WriteVersionGate(object *VersionGate, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(VersionGateLinkKind) + } else { + stream.WriteString(VersionGateKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sts_only") + stream.WriteBool(object.stsOnly) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_condition") + stream.WriteString(object.clusterCondition) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("documentation_url") + stream.WriteString(object.documentationURL) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("label") + stream.WriteString(object.label) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version_raw_id_prefix") + stream.WriteString(object.versionRawIDPrefix) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("warning_message") + stream.WriteString(object.warningMessage) + } + stream.WriteObjectEnd() +} + +// UnmarshalVersionGate reads a value of the 'version_gate' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalVersionGate(source interface{}) (object *VersionGate, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadVersionGate(iterator) + err = iterator.Error + return +} + +// ReadVersionGate reads a value of the 'version_gate' type from the given iterator. +func ReadVersionGate(iterator *jsoniter.Iterator) *VersionGate { + object := &VersionGate{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == VersionGateLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "sts_only": + value := iterator.ReadBool() + object.stsOnly = value + object.bitmap_ |= 8 + case "cluster_condition": + value := iterator.ReadString() + object.clusterCondition = value + object.bitmap_ |= 16 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 32 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 64 + case "documentation_url": + value := iterator.ReadString() + object.documentationURL = value + object.bitmap_ |= 128 + case "label": + value := iterator.ReadString() + object.label = value + object.bitmap_ |= 256 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 512 + case "version_raw_id_prefix": + value := iterator.ReadString() + object.versionRawIDPrefix = value + object.bitmap_ |= 1024 + case "warning_message": + value := iterator.ReadString() + object.warningMessage = value + object.bitmap_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/version_list_builder.go b/clientapi/clustersmgmt/v1/version_list_builder.go new file mode 100644 index 00000000..97da35f0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// VersionListBuilder contains the data and logic needed to build +// 'version' objects. +type VersionListBuilder struct { + items []*VersionBuilder +} + +// NewVersionList creates a new builder of 'version' objects. +func NewVersionList() *VersionListBuilder { + return new(VersionListBuilder) +} + +// Items sets the items of the list. +func (b *VersionListBuilder) Items(values ...*VersionBuilder) *VersionListBuilder { + b.items = make([]*VersionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *VersionListBuilder) 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 *VersionListBuilder) Copy(list *VersionList) *VersionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*VersionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewVersion().Copy(v) + } + } + return b +} + +// Build creates a list of 'version' objects using the +// configuration stored in the builder. +func (b *VersionListBuilder) Build() (list *VersionList, err error) { + items := make([]*Version, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(VersionList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/version_list_type_json.go b/clientapi/clustersmgmt/v1/version_list_type_json.go new file mode 100644 index 00000000..b8d55e9f --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalVersionList writes a list of values of the 'version' type to +// the given writer. +func MarshalVersionList(list []*Version, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteVersionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteVersionList writes a list of value of the 'version' type to +// the given stream. +func WriteVersionList(list []*Version, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteVersion(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalVersionList reads a list of values of the 'version' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalVersionList(source interface{}) (items []*Version, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadVersionList(iterator) + err = iterator.Error + return +} + +// ReadVersionList reads list of values of the ”version' type from +// the given iterator. +func ReadVersionList(iterator *jsoniter.Iterator) []*Version { + list := []*Version{} + for iterator.ReadArray() { + item := ReadVersion(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/version_type.go b/clientapi/clustersmgmt/v1/version_type.go new file mode 100644 index 00000000..716f9374 --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_type.go @@ -0,0 +1,591 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + time "time" +) + +// VersionKind is the name of the type used to represent objects +// of type 'version'. +const VersionKind = "Version" + +// VersionLinkKind is the name of the type used to represent links +// to objects of type 'version'. +const VersionLinkKind = "VersionLink" + +// VersionNilKind is the name of the type used to nil references +// to objects of type 'version'. +const VersionNilKind = "VersionNil" + +// Version represents the values of the 'version' type. +// +// Representation of an _OpenShift_ version. +type Version struct { + bitmap_ uint32 + id string + href string + availableUpgrades []string + channelGroup string + endOfLifeTimestamp time.Time + imageOverrides *ImageOverrides + rawID string + releaseImage string + releaseImages *ReleaseImages + gcpMarketplaceEnabled bool + rosaEnabled bool + default_ bool + enabled bool + hostedControlPlaneDefault bool + hostedControlPlaneEnabled bool + wifEnabled bool +} + +// Kind returns the name of the type of the object. +func (o *Version) Kind() string { + if o == nil { + return VersionNilKind + } + if o.bitmap_&1 != 0 { + return VersionLinkKind + } + return VersionKind +} + +// Link returns true if this is a link. +func (o *Version) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Version) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Version) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Version) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Version) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Version) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// GCPMarketplaceEnabled returns the value of the 'GCP_marketplace_enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// GCPMarketplaceEnabled indicates if this version can be used to create GCP Marketplace clusters. +func (o *Version) GCPMarketplaceEnabled() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.gcpMarketplaceEnabled + } + return false +} + +// GetGCPMarketplaceEnabled returns the value of the 'GCP_marketplace_enabled' attribute and +// a flag indicating if the attribute has a value. +// +// GCPMarketplaceEnabled indicates if this version can be used to create GCP Marketplace clusters. +func (o *Version) GetGCPMarketplaceEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.gcpMarketplaceEnabled + } + return +} + +// ROSAEnabled returns the value of the 'ROSA_enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ROSAEnabled indicates whether this version can be used to create ROSA clusters. +func (o *Version) ROSAEnabled() bool { + if o != nil && o.bitmap_&16 != 0 { + return o.rosaEnabled + } + return false +} + +// GetROSAEnabled returns the value of the 'ROSA_enabled' attribute and +// a flag indicating if the attribute has a value. +// +// ROSAEnabled indicates whether this version can be used to create ROSA clusters. +func (o *Version) GetROSAEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.rosaEnabled + } + return +} + +// AvailableUpgrades returns the value of the 'available_upgrades' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AvailableUpgrades is the list of versions this version can be upgraded to. +func (o *Version) AvailableUpgrades() []string { + if o != nil && o.bitmap_&32 != 0 { + return o.availableUpgrades + } + return nil +} + +// GetAvailableUpgrades returns the value of the 'available_upgrades' attribute and +// a flag indicating if the attribute has a value. +// +// AvailableUpgrades is the list of versions this version can be upgraded to. +func (o *Version) GetAvailableUpgrades() (value []string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.availableUpgrades + } + return +} + +// ChannelGroup returns the value of the 'channel_group' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ChannelGroup is the name of the group where this image belongs. +// ChannelGroup is a mechanism to partition the images to different groups, +// each image belongs to only a single group. +func (o *Version) ChannelGroup() string { + if o != nil && o.bitmap_&64 != 0 { + return o.channelGroup + } + return "" +} + +// GetChannelGroup returns the value of the 'channel_group' attribute and +// a flag indicating if the attribute has a value. +// +// ChannelGroup is the name of the group where this image belongs. +// ChannelGroup is a mechanism to partition the images to different groups, +// each image belongs to only a single group. +func (o *Version) GetChannelGroup() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.channelGroup + } + return +} + +// Default returns the value of the 'default' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this should be selected as the default version when a cluster is created +// without specifying explicitly the version. +func (o *Version) Default() bool { + if o != nil && o.bitmap_&128 != 0 { + return o.default_ + } + return false +} + +// GetDefault returns the value of the 'default' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this should be selected as the default version when a cluster is created +// without specifying explicitly the version. +func (o *Version) GetDefault() (value bool, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.default_ + } + return +} + +// Enabled returns the value of the 'enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates if this version can be used to create clusters. +func (o *Version) Enabled() bool { + if o != nil && o.bitmap_&256 != 0 { + return o.enabled + } + return false +} + +// GetEnabled returns the value of the 'enabled' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates if this version can be used to create clusters. +func (o *Version) GetEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.enabled + } + return +} + +// EndOfLifeTimestamp returns the value of the 'end_of_life_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// EndOfLifeTimestamp is the date and time when the version will get to End of Life, using the +// format defined in https://www.ietf.org/rfc/rfc3339.txt[RC3339]. +func (o *Version) EndOfLifeTimestamp() time.Time { + if o != nil && o.bitmap_&512 != 0 { + return o.endOfLifeTimestamp + } + return time.Time{} +} + +// GetEndOfLifeTimestamp returns the value of the 'end_of_life_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// EndOfLifeTimestamp is the date and time when the version will get to End of Life, using the +// format defined in https://www.ietf.org/rfc/rfc3339.txt[RC3339]. +func (o *Version) GetEndOfLifeTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.endOfLifeTimestamp + } + return +} + +// HostedControlPlaneDefault returns the value of the 'hosted_control_plane_default' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HostedControlPlaneDefault is a flag that indicates if this should be selected as the default version when a +// HCP cluster is created without specifying explicitly the version. +func (o *Version) HostedControlPlaneDefault() bool { + if o != nil && o.bitmap_&1024 != 0 { + return o.hostedControlPlaneDefault + } + return false +} + +// GetHostedControlPlaneDefault returns the value of the 'hosted_control_plane_default' attribute and +// a flag indicating if the attribute has a value. +// +// HostedControlPlaneDefault is a flag that indicates if this should be selected as the default version when a +// HCP cluster is created without specifying explicitly the version. +func (o *Version) GetHostedControlPlaneDefault() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.hostedControlPlaneDefault + } + return +} + +// HostedControlPlaneEnabled returns the value of the 'hosted_control_plane_enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// HostedControlPlaneEnabled indicates whether this version can be used to create HCP clusters. +func (o *Version) HostedControlPlaneEnabled() bool { + if o != nil && o.bitmap_&2048 != 0 { + return o.hostedControlPlaneEnabled + } + return false +} + +// GetHostedControlPlaneEnabled returns the value of the 'hosted_control_plane_enabled' attribute and +// a flag indicating if the attribute has a value. +// +// HostedControlPlaneEnabled indicates whether this version can be used to create HCP clusters. +func (o *Version) GetHostedControlPlaneEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.hostedControlPlaneEnabled + } + return +} + +// ImageOverrides returns the value of the 'image_overrides' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ImageOverrides contains the lists of images per cloud provider. +func (o *Version) ImageOverrides() *ImageOverrides { + if o != nil && o.bitmap_&4096 != 0 { + return o.imageOverrides + } + return nil +} + +// GetImageOverrides returns the value of the 'image_overrides' attribute and +// a flag indicating if the attribute has a value. +// +// ImageOverrides contains the lists of images per cloud provider. +func (o *Version) GetImageOverrides() (value *ImageOverrides, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.imageOverrides + } + return +} + +// RawID returns the value of the 'raw_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// RawID is the id of the version - without channel group and prefix. +func (o *Version) RawID() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.rawID + } + return "" +} + +// GetRawID returns the value of the 'raw_ID' attribute and +// a flag indicating if the attribute has a value. +// +// RawID is the id of the version - without channel group and prefix. +func (o *Version) GetRawID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.rawID + } + return +} + +// ReleaseImage returns the value of the 'release_image' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ReleaseImage contains the URI of Openshift release image for amd64 architecture. +func (o *Version) ReleaseImage() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.releaseImage + } + return "" +} + +// GetReleaseImage returns the value of the 'release_image' attribute and +// a flag indicating if the attribute has a value. +// +// ReleaseImage contains the URI of Openshift release image for amd64 architecture. +func (o *Version) GetReleaseImage() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.releaseImage + } + return +} + +// ReleaseImages returns the value of the 'release_images' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ReleaseImages contains the URI of OpenShift release images for arm64 and multi architectures. +func (o *Version) ReleaseImages() *ReleaseImages { + if o != nil && o.bitmap_&32768 != 0 { + return o.releaseImages + } + return nil +} + +// GetReleaseImages returns the value of the 'release_images' attribute and +// a flag indicating if the attribute has a value. +// +// ReleaseImages contains the URI of OpenShift release images for arm64 and multi architectures. +func (o *Version) GetReleaseImages() (value *ReleaseImages, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.releaseImages + } + return +} + +// WifEnabled returns the value of the 'wif_enabled' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// WifEnabled is a flag that indicates whether this version is enabled for Workload Identity Federation. +func (o *Version) WifEnabled() bool { + if o != nil && o.bitmap_&65536 != 0 { + return o.wifEnabled + } + return false +} + +// GetWifEnabled returns the value of the 'wif_enabled' attribute and +// a flag indicating if the attribute has a value. +// +// WifEnabled is a flag that indicates whether this version is enabled for Workload Identity Federation. +func (o *Version) GetWifEnabled() (value bool, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.wifEnabled + } + return +} + +// VersionListKind is the name of the type used to represent list of objects of +// type 'version'. +const VersionListKind = "VersionList" + +// VersionListLinkKind is the name of the type used to represent links to list +// of objects of type 'version'. +const VersionListLinkKind = "VersionListLink" + +// VersionNilKind is the name of the type used to nil lists of objects of +// type 'version'. +const VersionListNilKind = "VersionListNil" + +// VersionList is a list of values of the 'version' type. +type VersionList struct { + href string + link bool + items []*Version +} + +// Kind returns the name of the type of the object. +func (l *VersionList) Kind() string { + if l == nil { + return VersionListNilKind + } + if l.link { + return VersionListLinkKind + } + return VersionListKind +} + +// Link returns true iif this is a link. +func (l *VersionList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *VersionList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *VersionList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *VersionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *VersionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *VersionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *VersionList) SetItems(items []*Version) { + l.items = items +} + +// Items returns the items of the list. +func (l *VersionList) Items() []*Version { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *VersionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *VersionList) Get(i int) *Version { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *VersionList) Slice() []*Version { + var slice []*Version + if l == nil { + slice = make([]*Version, 0) + } else { + slice = make([]*Version, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *VersionList) Each(f func(item *Version) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *VersionList) Range(f func(index int, item *Version) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/version_type_json.go b/clientapi/clustersmgmt/v1/version_type_json.go new file mode 100644 index 00000000..4e18b905 --- /dev/null +++ b/clientapi/clustersmgmt/v1/version_type_json.go @@ -0,0 +1,294 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalVersion writes a value of the 'version' type to the given writer. +func MarshalVersion(object *Version, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteVersion(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteVersion writes a value of the 'version' type to the given stream. +func WriteVersion(object *Version, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(VersionLinkKind) + } else { + stream.WriteString(VersionKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp_marketplace_enabled") + stream.WriteBool(object.gcpMarketplaceEnabled) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("rosa_enabled") + stream.WriteBool(object.rosaEnabled) + count++ + } + present_ = object.bitmap_&32 != 0 && object.availableUpgrades != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("available_upgrades") + WriteStringList(object.availableUpgrades, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("channel_group") + stream.WriteString(object.channelGroup) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("default") + stream.WriteBool(object.default_) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("enabled") + stream.WriteBool(object.enabled) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("end_of_life_timestamp") + stream.WriteString((object.endOfLifeTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hosted_control_plane_default") + stream.WriteBool(object.hostedControlPlaneDefault) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("hosted_control_plane_enabled") + stream.WriteBool(object.hostedControlPlaneEnabled) + count++ + } + present_ = object.bitmap_&4096 != 0 && object.imageOverrides != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("image_overrides") + WriteImageOverrides(object.imageOverrides, stream) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("raw_id") + stream.WriteString(object.rawID) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("release_image") + stream.WriteString(object.releaseImage) + count++ + } + present_ = object.bitmap_&32768 != 0 && object.releaseImages != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("release_images") + WriteReleaseImages(object.releaseImages, stream) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("wif_enabled") + stream.WriteBool(object.wifEnabled) + } + stream.WriteObjectEnd() +} + +// UnmarshalVersion reads a value of the 'version' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalVersion(source interface{}) (object *Version, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadVersion(iterator) + err = iterator.Error + return +} + +// ReadVersion reads a value of the 'version' type from the given iterator. +func ReadVersion(iterator *jsoniter.Iterator) *Version { + object := &Version{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == VersionLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "gcp_marketplace_enabled": + value := iterator.ReadBool() + object.gcpMarketplaceEnabled = value + object.bitmap_ |= 8 + case "rosa_enabled": + value := iterator.ReadBool() + object.rosaEnabled = value + object.bitmap_ |= 16 + case "available_upgrades": + value := ReadStringList(iterator) + object.availableUpgrades = value + object.bitmap_ |= 32 + case "channel_group": + value := iterator.ReadString() + object.channelGroup = value + object.bitmap_ |= 64 + case "default": + value := iterator.ReadBool() + object.default_ = value + object.bitmap_ |= 128 + case "enabled": + value := iterator.ReadBool() + object.enabled = value + object.bitmap_ |= 256 + case "end_of_life_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.endOfLifeTimestamp = value + object.bitmap_ |= 512 + case "hosted_control_plane_default": + value := iterator.ReadBool() + object.hostedControlPlaneDefault = value + object.bitmap_ |= 1024 + case "hosted_control_plane_enabled": + value := iterator.ReadBool() + object.hostedControlPlaneEnabled = value + object.bitmap_ |= 2048 + case "image_overrides": + value := ReadImageOverrides(iterator) + object.imageOverrides = value + object.bitmap_ |= 4096 + case "raw_id": + value := iterator.ReadString() + object.rawID = value + object.bitmap_ |= 8192 + case "release_image": + value := iterator.ReadString() + object.releaseImage = value + object.bitmap_ |= 16384 + case "release_images": + value := ReadReleaseImages(iterator) + object.releaseImages = value + object.bitmap_ |= 32768 + case "wif_enabled": + value := iterator.ReadBool() + object.wifEnabled = value + object.bitmap_ |= 65536 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/wif_access_method_list_type_json.go b/clientapi/clustersmgmt/v1/wif_access_method_list_type_json.go new file mode 100644 index 00000000..6577f04f --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_access_method_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifAccessMethodList writes a list of values of the 'wif_access_method' type to +// the given writer. +func MarshalWifAccessMethodList(list []WifAccessMethod, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifAccessMethodList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifAccessMethodList writes a list of value of the 'wif_access_method' type to +// the given stream. +func WriteWifAccessMethodList(list []WifAccessMethod, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalWifAccessMethodList reads a list of values of the 'wif_access_method' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalWifAccessMethodList(source interface{}) (items []WifAccessMethod, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadWifAccessMethodList(iterator) + err = iterator.Error + return +} + +// ReadWifAccessMethodList reads list of values of the ”wif_access_method' type from +// the given iterator. +func ReadWifAccessMethodList(iterator *jsoniter.Iterator) []WifAccessMethod { + list := []WifAccessMethod{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := WifAccessMethod(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/wif_access_method_type.go b/clientapi/clustersmgmt/v1/wif_access_method_type.go new file mode 100644 index 00000000..c5a12117 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_access_method_type.go @@ -0,0 +1,32 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifAccessMethod represents the values of the 'wif_access_method' enumerated type. +type WifAccessMethod string + +const ( + // + WifAccessMethodImpersonate WifAccessMethod = "impersonate" + // + WifAccessMethodVm WifAccessMethod = "vm" + // + WifAccessMethodWif WifAccessMethod = "wif" +) diff --git a/clientapi/clustersmgmt/v1/wif_config_builder.go b/clientapi/clustersmgmt/v1/wif_config_builder.go new file mode 100644 index 00000000..40c66c74 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_config_builder.go @@ -0,0 +1,156 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifConfigBuilder contains the data and logic needed to build 'wif_config' objects. +// +// Definition of an wif_config resource. +type WifConfigBuilder struct { + bitmap_ uint32 + id string + href string + displayName string + gcp *WifGcpBuilder + organization *OrganizationLinkBuilder + wifTemplates []string +} + +// NewWifConfig creates a new builder of 'wif_config' objects. +func NewWifConfig() *WifConfigBuilder { + return &WifConfigBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *WifConfigBuilder) Link(value bool) *WifConfigBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *WifConfigBuilder) ID(value string) *WifConfigBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *WifConfigBuilder) HREF(value string) *WifConfigBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *WifConfigBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *WifConfigBuilder) DisplayName(value string) *WifConfigBuilder { + b.displayName = value + b.bitmap_ |= 8 + return b +} + +// Gcp sets the value of the 'gcp' attribute to the given value. +func (b *WifConfigBuilder) Gcp(value *WifGcpBuilder) *WifConfigBuilder { + b.gcp = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// Organization sets the value of the 'organization' attribute to the given value. +// +// Definition of an organization link. +func (b *WifConfigBuilder) Organization(value *OrganizationLinkBuilder) *WifConfigBuilder { + b.organization = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// WifTemplates sets the value of the 'wif_templates' attribute to the given values. +func (b *WifConfigBuilder) WifTemplates(values ...string) *WifConfigBuilder { + b.wifTemplates = make([]string, len(values)) + copy(b.wifTemplates, values) + b.bitmap_ |= 64 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *WifConfigBuilder) Copy(object *WifConfig) *WifConfigBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.displayName = object.displayName + if object.gcp != nil { + b.gcp = NewWifGcp().Copy(object.gcp) + } else { + b.gcp = nil + } + if object.organization != nil { + b.organization = NewOrganizationLink().Copy(object.organization) + } else { + b.organization = nil + } + if object.wifTemplates != nil { + b.wifTemplates = make([]string, len(object.wifTemplates)) + copy(b.wifTemplates, object.wifTemplates) + } else { + b.wifTemplates = nil + } + return b +} + +// Build creates a 'wif_config' object using the configuration stored in the builder. +func (b *WifConfigBuilder) Build() (object *WifConfig, err error) { + object = new(WifConfig) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.displayName = b.displayName + if b.gcp != nil { + object.gcp, err = b.gcp.Build() + if err != nil { + return + } + } + if b.organization != nil { + object.organization, err = b.organization.Build() + if err != nil { + return + } + } + if b.wifTemplates != nil { + object.wifTemplates = make([]string, len(b.wifTemplates)) + copy(object.wifTemplates, b.wifTemplates) + } + return +} diff --git a/clientapi/clustersmgmt/v1/wif_config_list_builder.go b/clientapi/clustersmgmt/v1/wif_config_list_builder.go new file mode 100644 index 00000000..fcebe96d --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_config_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifConfigListBuilder contains the data and logic needed to build +// 'wif_config' objects. +type WifConfigListBuilder struct { + items []*WifConfigBuilder +} + +// NewWifConfigList creates a new builder of 'wif_config' objects. +func NewWifConfigList() *WifConfigListBuilder { + return new(WifConfigListBuilder) +} + +// Items sets the items of the list. +func (b *WifConfigListBuilder) Items(values ...*WifConfigBuilder) *WifConfigListBuilder { + b.items = make([]*WifConfigBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *WifConfigListBuilder) 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 *WifConfigListBuilder) Copy(list *WifConfigList) *WifConfigListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*WifConfigBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewWifConfig().Copy(v) + } + } + return b +} + +// Build creates a list of 'wif_config' objects using the +// configuration stored in the builder. +func (b *WifConfigListBuilder) Build() (list *WifConfigList, err error) { + items := make([]*WifConfig, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(WifConfigList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/wif_config_list_type_json.go b/clientapi/clustersmgmt/v1/wif_config_list_type_json.go new file mode 100644 index 00000000..58a664e5 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_config_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifConfigList writes a list of values of the 'wif_config' type to +// the given writer. +func MarshalWifConfigList(list []*WifConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifConfigList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifConfigList writes a list of value of the 'wif_config' type to +// the given stream. +func WriteWifConfigList(list []*WifConfig, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteWifConfig(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalWifConfigList reads a list of values of the 'wif_config' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalWifConfigList(source interface{}) (items []*WifConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadWifConfigList(iterator) + err = iterator.Error + return +} + +// ReadWifConfigList reads list of values of the ”wif_config' type from +// the given iterator. +func ReadWifConfigList(iterator *jsoniter.Iterator) []*WifConfig { + list := []*WifConfig{} + for iterator.ReadArray() { + item := ReadWifConfig(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/wif_config_status_builder.go b/clientapi/clustersmgmt/v1/wif_config_status_builder.go new file mode 100644 index 00000000..30550c38 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_config_status_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifConfigStatusBuilder contains the data and logic needed to build 'wif_config_status' objects. +// +// Configuration status of a WifConfig. +type WifConfigStatusBuilder struct { + bitmap_ uint32 + description string + configured bool +} + +// NewWifConfigStatus creates a new builder of 'wif_config_status' objects. +func NewWifConfigStatus() *WifConfigStatusBuilder { + return &WifConfigStatusBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *WifConfigStatusBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Configured sets the value of the 'configured' attribute to the given value. +func (b *WifConfigStatusBuilder) Configured(value bool) *WifConfigStatusBuilder { + b.configured = value + b.bitmap_ |= 1 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *WifConfigStatusBuilder) Description(value string) *WifConfigStatusBuilder { + b.description = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *WifConfigStatusBuilder) Copy(object *WifConfigStatus) *WifConfigStatusBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.configured = object.configured + b.description = object.description + return b +} + +// Build creates a 'wif_config_status' object using the configuration stored in the builder. +func (b *WifConfigStatusBuilder) Build() (object *WifConfigStatus, err error) { + object = new(WifConfigStatus) + object.bitmap_ = b.bitmap_ + object.configured = b.configured + object.description = b.description + return +} diff --git a/clientapi/clustersmgmt/v1/wif_config_status_list_builder.go b/clientapi/clustersmgmt/v1/wif_config_status_list_builder.go new file mode 100644 index 00000000..ec157472 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_config_status_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifConfigStatusListBuilder contains the data and logic needed to build +// 'wif_config_status' objects. +type WifConfigStatusListBuilder struct { + items []*WifConfigStatusBuilder +} + +// NewWifConfigStatusList creates a new builder of 'wif_config_status' objects. +func NewWifConfigStatusList() *WifConfigStatusListBuilder { + return new(WifConfigStatusListBuilder) +} + +// Items sets the items of the list. +func (b *WifConfigStatusListBuilder) Items(values ...*WifConfigStatusBuilder) *WifConfigStatusListBuilder { + b.items = make([]*WifConfigStatusBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *WifConfigStatusListBuilder) 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 *WifConfigStatusListBuilder) Copy(list *WifConfigStatusList) *WifConfigStatusListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*WifConfigStatusBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewWifConfigStatus().Copy(v) + } + } + return b +} + +// Build creates a list of 'wif_config_status' objects using the +// configuration stored in the builder. +func (b *WifConfigStatusListBuilder) Build() (list *WifConfigStatusList, err error) { + items := make([]*WifConfigStatus, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(WifConfigStatusList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/wif_config_status_list_type_json.go b/clientapi/clustersmgmt/v1/wif_config_status_list_type_json.go new file mode 100644 index 00000000..c22f9da8 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_config_status_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifConfigStatusList writes a list of values of the 'wif_config_status' type to +// the given writer. +func MarshalWifConfigStatusList(list []*WifConfigStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifConfigStatusList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifConfigStatusList writes a list of value of the 'wif_config_status' type to +// the given stream. +func WriteWifConfigStatusList(list []*WifConfigStatus, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteWifConfigStatus(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalWifConfigStatusList reads a list of values of the 'wif_config_status' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalWifConfigStatusList(source interface{}) (items []*WifConfigStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadWifConfigStatusList(iterator) + err = iterator.Error + return +} + +// ReadWifConfigStatusList reads list of values of the ”wif_config_status' type from +// the given iterator. +func ReadWifConfigStatusList(iterator *jsoniter.Iterator) []*WifConfigStatus { + list := []*WifConfigStatus{} + for iterator.ReadArray() { + item := ReadWifConfigStatus(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/wif_config_status_type.go b/clientapi/clustersmgmt/v1/wif_config_status_type.go new file mode 100644 index 00000000..f30faaa7 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_config_status_type.go @@ -0,0 +1,197 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifConfigStatus represents the values of the 'wif_config_status' type. +// +// Configuration status of a WifConfig. +type WifConfigStatus struct { + bitmap_ uint32 + description string + configured bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *WifConfigStatus) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Configured returns the value of the 'configured' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Indicates the current status of the WifConfig resource configuration. +// - `false`: The WifConfig resource has a user configuration error. +// - `true`: The resources associated with the WifConfig object are properly configured and operational at the time of the check. +func (o *WifConfigStatus) Configured() bool { + if o != nil && o.bitmap_&1 != 0 { + return o.configured + } + return false +} + +// GetConfigured returns the value of the 'configured' attribute and +// a flag indicating if the attribute has a value. +// +// Indicates the current status of the WifConfig resource configuration. +// - `false`: The WifConfig resource has a user configuration error. +// - `true`: The resources associated with the WifConfig object are properly configured and operational at the time of the check. +func (o *WifConfigStatus) GetConfigured() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.configured + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Provides additional information about the WifConfig resource status. +// - When `Configured` is `false`, this field contains details about the user configuration error. +// - When `Configured` is `true`, this field may be empty or contain optional notes about the configuration. +func (o *WifConfigStatus) Description() string { + if o != nil && o.bitmap_&2 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Provides additional information about the WifConfig resource status. +// - When `Configured` is `false`, this field contains details about the user configuration error. +// - When `Configured` is `true`, this field may be empty or contain optional notes about the configuration. +func (o *WifConfigStatus) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.description + } + return +} + +// WifConfigStatusListKind is the name of the type used to represent list of objects of +// type 'wif_config_status'. +const WifConfigStatusListKind = "WifConfigStatusList" + +// WifConfigStatusListLinkKind is the name of the type used to represent links to list +// of objects of type 'wif_config_status'. +const WifConfigStatusListLinkKind = "WifConfigStatusListLink" + +// WifConfigStatusNilKind is the name of the type used to nil lists of objects of +// type 'wif_config_status'. +const WifConfigStatusListNilKind = "WifConfigStatusListNil" + +// WifConfigStatusList is a list of values of the 'wif_config_status' type. +type WifConfigStatusList struct { + href string + link bool + items []*WifConfigStatus +} + +// Len returns the length of the list. +func (l *WifConfigStatusList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *WifConfigStatusList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *WifConfigStatusList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *WifConfigStatusList) SetItems(items []*WifConfigStatus) { + l.items = items +} + +// Items returns the items of the list. +func (l *WifConfigStatusList) Items() []*WifConfigStatus { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *WifConfigStatusList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *WifConfigStatusList) Get(i int) *WifConfigStatus { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *WifConfigStatusList) Slice() []*WifConfigStatus { + var slice []*WifConfigStatus + if l == nil { + slice = make([]*WifConfigStatus, 0) + } else { + slice = make([]*WifConfigStatus, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *WifConfigStatusList) Each(f func(item *WifConfigStatus) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *WifConfigStatusList) Range(f func(index int, item *WifConfigStatus) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/wif_config_status_type_json.go b/clientapi/clustersmgmt/v1/wif_config_status_type_json.go new file mode 100644 index 00000000..1555f8e0 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_config_status_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifConfigStatus writes a value of the 'wif_config_status' type to the given writer. +func MarshalWifConfigStatus(object *WifConfigStatus, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifConfigStatus(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifConfigStatus writes a value of the 'wif_config_status' type to the given stream. +func WriteWifConfigStatus(object *WifConfigStatus, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("configured") + stream.WriteBool(object.configured) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + } + stream.WriteObjectEnd() +} + +// UnmarshalWifConfigStatus reads a value of the 'wif_config_status' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalWifConfigStatus(source interface{}) (object *WifConfigStatus, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadWifConfigStatus(iterator) + err = iterator.Error + return +} + +// ReadWifConfigStatus reads a value of the 'wif_config_status' type from the given iterator. +func ReadWifConfigStatus(iterator *jsoniter.Iterator) *WifConfigStatus { + object := &WifConfigStatus{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "configured": + value := iterator.ReadBool() + object.configured = value + object.bitmap_ |= 1 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/wif_config_type.go b/clientapi/clustersmgmt/v1/wif_config_type.go new file mode 100644 index 00000000..e14c974f --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_config_type.go @@ -0,0 +1,337 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifConfigKind is the name of the type used to represent objects +// of type 'wif_config'. +const WifConfigKind = "WifConfig" + +// WifConfigLinkKind is the name of the type used to represent links +// to objects of type 'wif_config'. +const WifConfigLinkKind = "WifConfigLink" + +// WifConfigNilKind is the name of the type used to nil references +// to objects of type 'wif_config'. +const WifConfigNilKind = "WifConfigNil" + +// WifConfig represents the values of the 'wif_config' type. +// +// Definition of an wif_config resource. +type WifConfig struct { + bitmap_ uint32 + id string + href string + displayName string + gcp *WifGcp + organization *OrganizationLink + wifTemplates []string +} + +// Kind returns the name of the type of the object. +func (o *WifConfig) Kind() string { + if o == nil { + return WifConfigNilKind + } + if o.bitmap_&1 != 0 { + return WifConfigLinkKind + } + return WifConfigKind +} + +// Link returns true if this is a link. +func (o *WifConfig) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *WifConfig) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *WifConfig) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *WifConfig) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *WifConfig) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *WifConfig) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name OCM clients will display for this wif_config. +func (o *WifConfig) DisplayName() string { + if o != nil && o.bitmap_&8 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +// +// The name OCM clients will display for this wif_config. +func (o *WifConfig) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.displayName + } + return +} + +// Gcp returns the value of the 'gcp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Holds GCP related data. +func (o *WifConfig) Gcp() *WifGcp { + if o != nil && o.bitmap_&16 != 0 { + return o.gcp + } + return nil +} + +// GetGcp returns the value of the 'gcp' attribute and +// a flag indicating if the attribute has a value. +// +// Holds GCP related data. +func (o *WifConfig) GetGcp() (value *WifGcp, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.gcp + } + return +} + +// Organization returns the value of the 'organization' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The OCM organization that this wif_config resource belongs to. +func (o *WifConfig) Organization() *OrganizationLink { + if o != nil && o.bitmap_&32 != 0 { + return o.organization + } + return nil +} + +// GetOrganization returns the value of the 'organization' attribute and +// a flag indicating if the attribute has a value. +// +// The OCM organization that this wif_config resource belongs to. +func (o *WifConfig) GetOrganization() (value *OrganizationLink, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.organization + } + return +} + +// WifTemplates returns the value of the 'wif_templates' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Wif template(s) used to configure IAM resources +func (o *WifConfig) WifTemplates() []string { + if o != nil && o.bitmap_&64 != 0 { + return o.wifTemplates + } + return nil +} + +// GetWifTemplates returns the value of the 'wif_templates' attribute and +// a flag indicating if the attribute has a value. +// +// Wif template(s) used to configure IAM resources +func (o *WifConfig) GetWifTemplates() (value []string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.wifTemplates + } + return +} + +// WifConfigListKind is the name of the type used to represent list of objects of +// type 'wif_config'. +const WifConfigListKind = "WifConfigList" + +// WifConfigListLinkKind is the name of the type used to represent links to list +// of objects of type 'wif_config'. +const WifConfigListLinkKind = "WifConfigListLink" + +// WifConfigNilKind is the name of the type used to nil lists of objects of +// type 'wif_config'. +const WifConfigListNilKind = "WifConfigListNil" + +// WifConfigList is a list of values of the 'wif_config' type. +type WifConfigList struct { + href string + link bool + items []*WifConfig +} + +// Kind returns the name of the type of the object. +func (l *WifConfigList) Kind() string { + if l == nil { + return WifConfigListNilKind + } + if l.link { + return WifConfigListLinkKind + } + return WifConfigListKind +} + +// Link returns true iif this is a link. +func (l *WifConfigList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *WifConfigList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *WifConfigList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *WifConfigList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *WifConfigList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *WifConfigList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *WifConfigList) SetItems(items []*WifConfig) { + l.items = items +} + +// Items returns the items of the list. +func (l *WifConfigList) Items() []*WifConfig { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *WifConfigList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *WifConfigList) Get(i int) *WifConfig { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *WifConfigList) Slice() []*WifConfig { + var slice []*WifConfig + if l == nil { + slice = make([]*WifConfig, 0) + } else { + slice = make([]*WifConfig, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *WifConfigList) Each(f func(item *WifConfig) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *WifConfigList) Range(f func(index int, item *WifConfig) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/wif_config_type_json.go b/clientapi/clustersmgmt/v1/wif_config_type_json.go new file mode 100644 index 00000000..b9cc1f6a --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_config_type_json.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifConfig writes a value of the 'wif_config' type to the given writer. +func MarshalWifConfig(object *WifConfig, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifConfig(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifConfig writes a value of the 'wif_config' type to the given stream. +func WriteWifConfig(object *WifConfig, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(WifConfigLinkKind) + } else { + stream.WriteString(WifConfigKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&16 != 0 && object.gcp != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("gcp") + WriteWifGcp(object.gcp, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.organization != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("organization") + WriteOrganizationLink(object.organization, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.wifTemplates != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("wif_templates") + WriteStringList(object.wifTemplates, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalWifConfig reads a value of the 'wif_config' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalWifConfig(source interface{}) (object *WifConfig, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadWifConfig(iterator) + err = iterator.Error + return +} + +// ReadWifConfig reads a value of the 'wif_config' type from the given iterator. +func ReadWifConfig(iterator *jsoniter.Iterator) *WifConfig { + object := &WifConfig{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == WifConfigLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 8 + case "gcp": + value := ReadWifGcp(iterator) + object.gcp = value + object.bitmap_ |= 16 + case "organization": + value := ReadOrganizationLink(iterator) + object.organization = value + object.bitmap_ |= 32 + case "wif_templates": + value := ReadStringList(iterator) + object.wifTemplates = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/wif_credential_request_builder.go b/clientapi/clustersmgmt/v1/wif_credential_request_builder.go new file mode 100644 index 00000000..0095c0d9 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_credential_request_builder.go @@ -0,0 +1,93 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifCredentialRequestBuilder contains the data and logic needed to build 'wif_credential_request' objects. +type WifCredentialRequestBuilder struct { + bitmap_ uint32 + secretRef *WifSecretRefBuilder + serviceAccountNames []string +} + +// NewWifCredentialRequest creates a new builder of 'wif_credential_request' objects. +func NewWifCredentialRequest() *WifCredentialRequestBuilder { + return &WifCredentialRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *WifCredentialRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// SecretRef sets the value of the 'secret_ref' attribute to the given value. +func (b *WifCredentialRequestBuilder) SecretRef(value *WifSecretRefBuilder) *WifCredentialRequestBuilder { + b.secretRef = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// ServiceAccountNames sets the value of the 'service_account_names' attribute to the given values. +func (b *WifCredentialRequestBuilder) ServiceAccountNames(values ...string) *WifCredentialRequestBuilder { + b.serviceAccountNames = make([]string, len(values)) + copy(b.serviceAccountNames, values) + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *WifCredentialRequestBuilder) Copy(object *WifCredentialRequest) *WifCredentialRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.secretRef != nil { + b.secretRef = NewWifSecretRef().Copy(object.secretRef) + } else { + b.secretRef = nil + } + if object.serviceAccountNames != nil { + b.serviceAccountNames = make([]string, len(object.serviceAccountNames)) + copy(b.serviceAccountNames, object.serviceAccountNames) + } else { + b.serviceAccountNames = nil + } + return b +} + +// Build creates a 'wif_credential_request' object using the configuration stored in the builder. +func (b *WifCredentialRequestBuilder) Build() (object *WifCredentialRequest, err error) { + object = new(WifCredentialRequest) + object.bitmap_ = b.bitmap_ + if b.secretRef != nil { + object.secretRef, err = b.secretRef.Build() + if err != nil { + return + } + } + if b.serviceAccountNames != nil { + object.serviceAccountNames = make([]string, len(b.serviceAccountNames)) + copy(object.serviceAccountNames, b.serviceAccountNames) + } + return +} diff --git a/clientapi/clustersmgmt/v1/wif_credential_request_list_builder.go b/clientapi/clustersmgmt/v1/wif_credential_request_list_builder.go new file mode 100644 index 00000000..78a01639 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_credential_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifCredentialRequestListBuilder contains the data and logic needed to build +// 'wif_credential_request' objects. +type WifCredentialRequestListBuilder struct { + items []*WifCredentialRequestBuilder +} + +// NewWifCredentialRequestList creates a new builder of 'wif_credential_request' objects. +func NewWifCredentialRequestList() *WifCredentialRequestListBuilder { + return new(WifCredentialRequestListBuilder) +} + +// Items sets the items of the list. +func (b *WifCredentialRequestListBuilder) Items(values ...*WifCredentialRequestBuilder) *WifCredentialRequestListBuilder { + b.items = make([]*WifCredentialRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *WifCredentialRequestListBuilder) 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 *WifCredentialRequestListBuilder) Copy(list *WifCredentialRequestList) *WifCredentialRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*WifCredentialRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewWifCredentialRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'wif_credential_request' objects using the +// configuration stored in the builder. +func (b *WifCredentialRequestListBuilder) Build() (list *WifCredentialRequestList, err error) { + items := make([]*WifCredentialRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(WifCredentialRequestList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/wif_credential_request_list_type_json.go b/clientapi/clustersmgmt/v1/wif_credential_request_list_type_json.go new file mode 100644 index 00000000..9ced5a31 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_credential_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifCredentialRequestList writes a list of values of the 'wif_credential_request' type to +// the given writer. +func MarshalWifCredentialRequestList(list []*WifCredentialRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifCredentialRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifCredentialRequestList writes a list of value of the 'wif_credential_request' type to +// the given stream. +func WriteWifCredentialRequestList(list []*WifCredentialRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteWifCredentialRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalWifCredentialRequestList reads a list of values of the 'wif_credential_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalWifCredentialRequestList(source interface{}) (items []*WifCredentialRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadWifCredentialRequestList(iterator) + err = iterator.Error + return +} + +// ReadWifCredentialRequestList reads list of values of the ”wif_credential_request' type from +// the given iterator. +func ReadWifCredentialRequestList(iterator *jsoniter.Iterator) []*WifCredentialRequest { + list := []*WifCredentialRequest{} + for iterator.ReadArray() { + item := ReadWifCredentialRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/wif_credential_request_type.go b/clientapi/clustersmgmt/v1/wif_credential_request_type.go new file mode 100644 index 00000000..cbd61d5a --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_credential_request_type.go @@ -0,0 +1,179 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifCredentialRequest represents the values of the 'wif_credential_request' type. +type WifCredentialRequest struct { + bitmap_ uint32 + secretRef *WifSecretRef + serviceAccountNames []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *WifCredentialRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// SecretRef returns the value of the 'secret_ref' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifCredentialRequest) SecretRef() *WifSecretRef { + if o != nil && o.bitmap_&1 != 0 { + return o.secretRef + } + return nil +} + +// GetSecretRef returns the value of the 'secret_ref' attribute and +// a flag indicating if the attribute has a value. +func (o *WifCredentialRequest) GetSecretRef() (value *WifSecretRef, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.secretRef + } + return +} + +// ServiceAccountNames returns the value of the 'service_account_names' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifCredentialRequest) ServiceAccountNames() []string { + if o != nil && o.bitmap_&2 != 0 { + return o.serviceAccountNames + } + return nil +} + +// GetServiceAccountNames returns the value of the 'service_account_names' attribute and +// a flag indicating if the attribute has a value. +func (o *WifCredentialRequest) GetServiceAccountNames() (value []string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.serviceAccountNames + } + return +} + +// WifCredentialRequestListKind is the name of the type used to represent list of objects of +// type 'wif_credential_request'. +const WifCredentialRequestListKind = "WifCredentialRequestList" + +// WifCredentialRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'wif_credential_request'. +const WifCredentialRequestListLinkKind = "WifCredentialRequestListLink" + +// WifCredentialRequestNilKind is the name of the type used to nil lists of objects of +// type 'wif_credential_request'. +const WifCredentialRequestListNilKind = "WifCredentialRequestListNil" + +// WifCredentialRequestList is a list of values of the 'wif_credential_request' type. +type WifCredentialRequestList struct { + href string + link bool + items []*WifCredentialRequest +} + +// Len returns the length of the list. +func (l *WifCredentialRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *WifCredentialRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *WifCredentialRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *WifCredentialRequestList) SetItems(items []*WifCredentialRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *WifCredentialRequestList) Items() []*WifCredentialRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *WifCredentialRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *WifCredentialRequestList) Get(i int) *WifCredentialRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *WifCredentialRequestList) Slice() []*WifCredentialRequest { + var slice []*WifCredentialRequest + if l == nil { + slice = make([]*WifCredentialRequest, 0) + } else { + slice = make([]*WifCredentialRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *WifCredentialRequestList) Each(f func(item *WifCredentialRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *WifCredentialRequestList) Range(f func(index int, item *WifCredentialRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/wif_credential_request_type_json.go b/clientapi/clustersmgmt/v1/wif_credential_request_type_json.go new file mode 100644 index 00000000..cf0a6327 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_credential_request_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifCredentialRequest writes a value of the 'wif_credential_request' type to the given writer. +func MarshalWifCredentialRequest(object *WifCredentialRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifCredentialRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifCredentialRequest writes a value of the 'wif_credential_request' type to the given stream. +func WriteWifCredentialRequest(object *WifCredentialRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.secretRef != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("secret_ref") + WriteWifSecretRef(object.secretRef, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.serviceAccountNames != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_account_names") + WriteStringList(object.serviceAccountNames, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalWifCredentialRequest reads a value of the 'wif_credential_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalWifCredentialRequest(source interface{}) (object *WifCredentialRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadWifCredentialRequest(iterator) + err = iterator.Error + return +} + +// ReadWifCredentialRequest reads a value of the 'wif_credential_request' type from the given iterator. +func ReadWifCredentialRequest(iterator *jsoniter.Iterator) *WifCredentialRequest { + object := &WifCredentialRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "secret_ref": + value := ReadWifSecretRef(iterator) + object.secretRef = value + object.bitmap_ |= 1 + case "service_account_names": + value := ReadStringList(iterator) + object.serviceAccountNames = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/wif_gcp_builder.go b/clientapi/clustersmgmt/v1/wif_gcp_builder.go new file mode 100644 index 00000000..3862517f --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_gcp_builder.go @@ -0,0 +1,163 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifGcpBuilder contains the data and logic needed to build 'wif_gcp' objects. +type WifGcpBuilder struct { + bitmap_ uint32 + impersonatorEmail string + projectId string + projectNumber string + rolePrefix string + serviceAccounts []*WifServiceAccountBuilder + support *WifSupportBuilder + workloadIdentityPool *WifPoolBuilder +} + +// NewWifGcp creates a new builder of 'wif_gcp' objects. +func NewWifGcp() *WifGcpBuilder { + return &WifGcpBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *WifGcpBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ImpersonatorEmail sets the value of the 'impersonator_email' attribute to the given value. +func (b *WifGcpBuilder) ImpersonatorEmail(value string) *WifGcpBuilder { + b.impersonatorEmail = value + b.bitmap_ |= 1 + return b +} + +// ProjectId sets the value of the 'project_id' attribute to the given value. +func (b *WifGcpBuilder) ProjectId(value string) *WifGcpBuilder { + b.projectId = value + b.bitmap_ |= 2 + return b +} + +// ProjectNumber sets the value of the 'project_number' attribute to the given value. +func (b *WifGcpBuilder) ProjectNumber(value string) *WifGcpBuilder { + b.projectNumber = value + b.bitmap_ |= 4 + return b +} + +// RolePrefix sets the value of the 'role_prefix' attribute to the given value. +func (b *WifGcpBuilder) RolePrefix(value string) *WifGcpBuilder { + b.rolePrefix = value + b.bitmap_ |= 8 + return b +} + +// ServiceAccounts sets the value of the 'service_accounts' attribute to the given values. +func (b *WifGcpBuilder) ServiceAccounts(values ...*WifServiceAccountBuilder) *WifGcpBuilder { + b.serviceAccounts = make([]*WifServiceAccountBuilder, len(values)) + copy(b.serviceAccounts, values) + b.bitmap_ |= 16 + return b +} + +// Support sets the value of the 'support' attribute to the given value. +func (b *WifGcpBuilder) Support(value *WifSupportBuilder) *WifGcpBuilder { + b.support = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// WorkloadIdentityPool sets the value of the 'workload_identity_pool' attribute to the given value. +func (b *WifGcpBuilder) WorkloadIdentityPool(value *WifPoolBuilder) *WifGcpBuilder { + b.workloadIdentityPool = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *WifGcpBuilder) Copy(object *WifGcp) *WifGcpBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.impersonatorEmail = object.impersonatorEmail + b.projectId = object.projectId + b.projectNumber = object.projectNumber + b.rolePrefix = object.rolePrefix + if object.serviceAccounts != nil { + b.serviceAccounts = make([]*WifServiceAccountBuilder, len(object.serviceAccounts)) + for i, v := range object.serviceAccounts { + b.serviceAccounts[i] = NewWifServiceAccount().Copy(v) + } + } else { + b.serviceAccounts = nil + } + if object.support != nil { + b.support = NewWifSupport().Copy(object.support) + } else { + b.support = nil + } + if object.workloadIdentityPool != nil { + b.workloadIdentityPool = NewWifPool().Copy(object.workloadIdentityPool) + } else { + b.workloadIdentityPool = nil + } + return b +} + +// Build creates a 'wif_gcp' object using the configuration stored in the builder. +func (b *WifGcpBuilder) Build() (object *WifGcp, err error) { + object = new(WifGcp) + object.bitmap_ = b.bitmap_ + object.impersonatorEmail = b.impersonatorEmail + object.projectId = b.projectId + object.projectNumber = b.projectNumber + object.rolePrefix = b.rolePrefix + if b.serviceAccounts != nil { + object.serviceAccounts = make([]*WifServiceAccount, len(b.serviceAccounts)) + for i, v := range b.serviceAccounts { + object.serviceAccounts[i], err = v.Build() + if err != nil { + return + } + } + } + if b.support != nil { + object.support, err = b.support.Build() + if err != nil { + return + } + } + if b.workloadIdentityPool != nil { + object.workloadIdentityPool, err = b.workloadIdentityPool.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/wif_gcp_list_builder.go b/clientapi/clustersmgmt/v1/wif_gcp_list_builder.go new file mode 100644 index 00000000..3fbbedbc --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_gcp_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifGcpListBuilder contains the data and logic needed to build +// 'wif_gcp' objects. +type WifGcpListBuilder struct { + items []*WifGcpBuilder +} + +// NewWifGcpList creates a new builder of 'wif_gcp' objects. +func NewWifGcpList() *WifGcpListBuilder { + return new(WifGcpListBuilder) +} + +// Items sets the items of the list. +func (b *WifGcpListBuilder) Items(values ...*WifGcpBuilder) *WifGcpListBuilder { + b.items = make([]*WifGcpBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *WifGcpListBuilder) 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 *WifGcpListBuilder) Copy(list *WifGcpList) *WifGcpListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*WifGcpBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewWifGcp().Copy(v) + } + } + return b +} + +// Build creates a list of 'wif_gcp' objects using the +// configuration stored in the builder. +func (b *WifGcpListBuilder) Build() (list *WifGcpList, err error) { + items := make([]*WifGcp, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(WifGcpList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/wif_gcp_list_type_json.go b/clientapi/clustersmgmt/v1/wif_gcp_list_type_json.go new file mode 100644 index 00000000..b4c9e550 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_gcp_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifGcpList writes a list of values of the 'wif_gcp' type to +// the given writer. +func MarshalWifGcpList(list []*WifGcp, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifGcpList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifGcpList writes a list of value of the 'wif_gcp' type to +// the given stream. +func WriteWifGcpList(list []*WifGcp, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteWifGcp(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalWifGcpList reads a list of values of the 'wif_gcp' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalWifGcpList(source interface{}) (items []*WifGcp, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadWifGcpList(iterator) + err = iterator.Error + return +} + +// ReadWifGcpList reads list of values of the ”wif_gcp' type from +// the given iterator. +func ReadWifGcpList(iterator *jsoniter.Iterator) []*WifGcp { + list := []*WifGcp{} + for iterator.ReadArray() { + item := ReadWifGcp(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/wif_gcp_type.go b/clientapi/clustersmgmt/v1/wif_gcp_type.go new file mode 100644 index 00000000..0fcded6d --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_gcp_type.go @@ -0,0 +1,311 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifGcp represents the values of the 'wif_gcp' type. +type WifGcp struct { + bitmap_ uint32 + impersonatorEmail string + projectId string + projectNumber string + rolePrefix string + serviceAccounts []*WifServiceAccount + support *WifSupport + workloadIdentityPool *WifPool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *WifGcp) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ImpersonatorEmail returns the value of the 'impersonator_email' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// This is the service account email that OCM will use to access other SAs. +func (o *WifGcp) ImpersonatorEmail() string { + if o != nil && o.bitmap_&1 != 0 { + return o.impersonatorEmail + } + return "" +} + +// GetImpersonatorEmail returns the value of the 'impersonator_email' attribute and +// a flag indicating if the attribute has a value. +// +// This is the service account email that OCM will use to access other SAs. +func (o *WifGcp) GetImpersonatorEmail() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.impersonatorEmail + } + return +} + +// ProjectId returns the value of the 'project_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// This represents the GCP project ID in which the wif resources will be configured. +func (o *WifGcp) ProjectId() string { + if o != nil && o.bitmap_&2 != 0 { + return o.projectId + } + return "" +} + +// GetProjectId returns the value of the 'project_id' attribute and +// a flag indicating if the attribute has a value. +// +// This represents the GCP project ID in which the wif resources will be configured. +func (o *WifGcp) GetProjectId() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.projectId + } + return +} + +// ProjectNumber returns the value of the 'project_number' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// This represents the GCP project number in which the wif resources will be configured. +func (o *WifGcp) ProjectNumber() string { + if o != nil && o.bitmap_&4 != 0 { + return o.projectNumber + } + return "" +} + +// GetProjectNumber returns the value of the 'project_number' attribute and +// a flag indicating if the attribute has a value. +// +// This represents the GCP project number in which the wif resources will be configured. +func (o *WifGcp) GetProjectNumber() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.projectNumber + } + return +} + +// RolePrefix returns the value of the 'role_prefix' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Prefix for naming GCP custom roles configured. +func (o *WifGcp) RolePrefix() string { + if o != nil && o.bitmap_&8 != 0 { + return o.rolePrefix + } + return "" +} + +// GetRolePrefix returns the value of the 'role_prefix' attribute and +// a flag indicating if the attribute has a value. +// +// Prefix for naming GCP custom roles configured. +func (o *WifGcp) GetRolePrefix() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.rolePrefix + } + return +} + +// ServiceAccounts returns the value of the 'service_accounts' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The list of service accounts and their associated roles that will need to be +// configured on the user's GCP project. +func (o *WifGcp) ServiceAccounts() []*WifServiceAccount { + if o != nil && o.bitmap_&16 != 0 { + return o.serviceAccounts + } + return nil +} + +// GetServiceAccounts returns the value of the 'service_accounts' attribute and +// a flag indicating if the attribute has a value. +// +// The list of service accounts and their associated roles that will need to be +// configured on the user's GCP project. +func (o *WifGcp) GetServiceAccounts() (value []*WifServiceAccount, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.serviceAccounts + } + return +} + +// Support returns the value of the 'support' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Defines the access configuration for support. +func (o *WifGcp) Support() *WifSupport { + if o != nil && o.bitmap_&32 != 0 { + return o.support + } + return nil +} + +// GetSupport returns the value of the 'support' attribute and +// a flag indicating if the attribute has a value. +// +// Defines the access configuration for support. +func (o *WifGcp) GetSupport() (value *WifSupport, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.support + } + return +} + +// WorkloadIdentityPool returns the value of the 'workload_identity_pool' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The workload identity configuration data that will be used to create the +// workload identity pool on the user's account. +func (o *WifGcp) WorkloadIdentityPool() *WifPool { + if o != nil && o.bitmap_&64 != 0 { + return o.workloadIdentityPool + } + return nil +} + +// GetWorkloadIdentityPool returns the value of the 'workload_identity_pool' attribute and +// a flag indicating if the attribute has a value. +// +// The workload identity configuration data that will be used to create the +// workload identity pool on the user's account. +func (o *WifGcp) GetWorkloadIdentityPool() (value *WifPool, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.workloadIdentityPool + } + return +} + +// WifGcpListKind is the name of the type used to represent list of objects of +// type 'wif_gcp'. +const WifGcpListKind = "WifGcpList" + +// WifGcpListLinkKind is the name of the type used to represent links to list +// of objects of type 'wif_gcp'. +const WifGcpListLinkKind = "WifGcpListLink" + +// WifGcpNilKind is the name of the type used to nil lists of objects of +// type 'wif_gcp'. +const WifGcpListNilKind = "WifGcpListNil" + +// WifGcpList is a list of values of the 'wif_gcp' type. +type WifGcpList struct { + href string + link bool + items []*WifGcp +} + +// Len returns the length of the list. +func (l *WifGcpList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *WifGcpList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *WifGcpList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *WifGcpList) SetItems(items []*WifGcp) { + l.items = items +} + +// Items returns the items of the list. +func (l *WifGcpList) Items() []*WifGcp { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *WifGcpList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *WifGcpList) Get(i int) *WifGcp { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *WifGcpList) Slice() []*WifGcp { + var slice []*WifGcp + if l == nil { + slice = make([]*WifGcp, 0) + } else { + slice = make([]*WifGcp, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *WifGcpList) Each(f func(item *WifGcp) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *WifGcpList) Range(f func(index int, item *WifGcp) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/wif_gcp_type_json.go b/clientapi/clustersmgmt/v1/wif_gcp_type_json.go new file mode 100644 index 00000000..ab49a955 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_gcp_type_json.go @@ -0,0 +1,164 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifGcp writes a value of the 'wif_gcp' type to the given writer. +func MarshalWifGcp(object *WifGcp, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifGcp(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifGcp writes a value of the 'wif_gcp' type to the given stream. +func WriteWifGcp(object *WifGcp, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("impersonator_email") + stream.WriteString(object.impersonatorEmail) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("project_id") + stream.WriteString(object.projectId) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("project_number") + stream.WriteString(object.projectNumber) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role_prefix") + stream.WriteString(object.rolePrefix) + count++ + } + present_ = object.bitmap_&16 != 0 && object.serviceAccounts != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_accounts") + WriteWifServiceAccountList(object.serviceAccounts, stream) + count++ + } + present_ = object.bitmap_&32 != 0 && object.support != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("support") + WriteWifSupport(object.support, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.workloadIdentityPool != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("workload_identity_pool") + WriteWifPool(object.workloadIdentityPool, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalWifGcp reads a value of the 'wif_gcp' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalWifGcp(source interface{}) (object *WifGcp, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadWifGcp(iterator) + err = iterator.Error + return +} + +// ReadWifGcp reads a value of the 'wif_gcp' type from the given iterator. +func ReadWifGcp(iterator *jsoniter.Iterator) *WifGcp { + object := &WifGcp{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "impersonator_email": + value := iterator.ReadString() + object.impersonatorEmail = value + object.bitmap_ |= 1 + case "project_id": + value := iterator.ReadString() + object.projectId = value + object.bitmap_ |= 2 + case "project_number": + value := iterator.ReadString() + object.projectNumber = value + object.bitmap_ |= 4 + case "role_prefix": + value := iterator.ReadString() + object.rolePrefix = value + object.bitmap_ |= 8 + case "service_accounts": + value := ReadWifServiceAccountList(iterator) + object.serviceAccounts = value + object.bitmap_ |= 16 + case "support": + value := ReadWifSupport(iterator) + object.support = value + object.bitmap_ |= 32 + case "workload_identity_pool": + value := ReadWifPool(iterator) + object.workloadIdentityPool = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/wif_identity_provider_builder.go b/clientapi/clustersmgmt/v1/wif_identity_provider_builder.go new file mode 100644 index 00000000..17746154 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_identity_provider_builder.go @@ -0,0 +1,100 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifIdentityProviderBuilder contains the data and logic needed to build 'wif_identity_provider' objects. +type WifIdentityProviderBuilder struct { + bitmap_ uint32 + allowedAudiences []string + identityProviderId string + issuerUrl string + jwks string +} + +// NewWifIdentityProvider creates a new builder of 'wif_identity_provider' objects. +func NewWifIdentityProvider() *WifIdentityProviderBuilder { + return &WifIdentityProviderBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *WifIdentityProviderBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AllowedAudiences sets the value of the 'allowed_audiences' attribute to the given values. +func (b *WifIdentityProviderBuilder) AllowedAudiences(values ...string) *WifIdentityProviderBuilder { + b.allowedAudiences = make([]string, len(values)) + copy(b.allowedAudiences, values) + b.bitmap_ |= 1 + return b +} + +// IdentityProviderId sets the value of the 'identity_provider_id' attribute to the given value. +func (b *WifIdentityProviderBuilder) IdentityProviderId(value string) *WifIdentityProviderBuilder { + b.identityProviderId = value + b.bitmap_ |= 2 + return b +} + +// IssuerUrl sets the value of the 'issuer_url' attribute to the given value. +func (b *WifIdentityProviderBuilder) IssuerUrl(value string) *WifIdentityProviderBuilder { + b.issuerUrl = value + b.bitmap_ |= 4 + return b +} + +// Jwks sets the value of the 'jwks' attribute to the given value. +func (b *WifIdentityProviderBuilder) Jwks(value string) *WifIdentityProviderBuilder { + b.jwks = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *WifIdentityProviderBuilder) Copy(object *WifIdentityProvider) *WifIdentityProviderBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.allowedAudiences != nil { + b.allowedAudiences = make([]string, len(object.allowedAudiences)) + copy(b.allowedAudiences, object.allowedAudiences) + } else { + b.allowedAudiences = nil + } + b.identityProviderId = object.identityProviderId + b.issuerUrl = object.issuerUrl + b.jwks = object.jwks + return b +} + +// Build creates a 'wif_identity_provider' object using the configuration stored in the builder. +func (b *WifIdentityProviderBuilder) Build() (object *WifIdentityProvider, err error) { + object = new(WifIdentityProvider) + object.bitmap_ = b.bitmap_ + if b.allowedAudiences != nil { + object.allowedAudiences = make([]string, len(b.allowedAudiences)) + copy(object.allowedAudiences, b.allowedAudiences) + } + object.identityProviderId = b.identityProviderId + object.issuerUrl = b.issuerUrl + object.jwks = b.jwks + return +} diff --git a/clientapi/clustersmgmt/v1/wif_identity_provider_list_builder.go b/clientapi/clustersmgmt/v1/wif_identity_provider_list_builder.go new file mode 100644 index 00000000..754e5276 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_identity_provider_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifIdentityProviderListBuilder contains the data and logic needed to build +// 'wif_identity_provider' objects. +type WifIdentityProviderListBuilder struct { + items []*WifIdentityProviderBuilder +} + +// NewWifIdentityProviderList creates a new builder of 'wif_identity_provider' objects. +func NewWifIdentityProviderList() *WifIdentityProviderListBuilder { + return new(WifIdentityProviderListBuilder) +} + +// Items sets the items of the list. +func (b *WifIdentityProviderListBuilder) Items(values ...*WifIdentityProviderBuilder) *WifIdentityProviderListBuilder { + b.items = make([]*WifIdentityProviderBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *WifIdentityProviderListBuilder) 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 *WifIdentityProviderListBuilder) Copy(list *WifIdentityProviderList) *WifIdentityProviderListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*WifIdentityProviderBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewWifIdentityProvider().Copy(v) + } + } + return b +} + +// Build creates a list of 'wif_identity_provider' objects using the +// configuration stored in the builder. +func (b *WifIdentityProviderListBuilder) Build() (list *WifIdentityProviderList, err error) { + items := make([]*WifIdentityProvider, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(WifIdentityProviderList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/wif_identity_provider_list_type_json.go b/clientapi/clustersmgmt/v1/wif_identity_provider_list_type_json.go new file mode 100644 index 00000000..1a74a4ae --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_identity_provider_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifIdentityProviderList writes a list of values of the 'wif_identity_provider' type to +// the given writer. +func MarshalWifIdentityProviderList(list []*WifIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifIdentityProviderList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifIdentityProviderList writes a list of value of the 'wif_identity_provider' type to +// the given stream. +func WriteWifIdentityProviderList(list []*WifIdentityProvider, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteWifIdentityProvider(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalWifIdentityProviderList reads a list of values of the 'wif_identity_provider' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalWifIdentityProviderList(source interface{}) (items []*WifIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadWifIdentityProviderList(iterator) + err = iterator.Error + return +} + +// ReadWifIdentityProviderList reads list of values of the ”wif_identity_provider' type from +// the given iterator. +func ReadWifIdentityProviderList(iterator *jsoniter.Iterator) []*WifIdentityProvider { + list := []*WifIdentityProvider{} + for iterator.ReadArray() { + item := ReadWifIdentityProvider(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/wif_identity_provider_type.go b/clientapi/clustersmgmt/v1/wif_identity_provider_type.go new file mode 100644 index 00000000..abafb7a1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_identity_provider_type.go @@ -0,0 +1,219 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifIdentityProvider represents the values of the 'wif_identity_provider' type. +type WifIdentityProvider struct { + bitmap_ uint32 + allowedAudiences []string + identityProviderId string + issuerUrl string + jwks string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *WifIdentityProvider) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AllowedAudiences returns the value of the 'allowed_audiences' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifIdentityProvider) AllowedAudiences() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.allowedAudiences + } + return nil +} + +// GetAllowedAudiences returns the value of the 'allowed_audiences' attribute and +// a flag indicating if the attribute has a value. +func (o *WifIdentityProvider) GetAllowedAudiences() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.allowedAudiences + } + return +} + +// IdentityProviderId returns the value of the 'identity_provider_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifIdentityProvider) IdentityProviderId() string { + if o != nil && o.bitmap_&2 != 0 { + return o.identityProviderId + } + return "" +} + +// GetIdentityProviderId returns the value of the 'identity_provider_id' attribute and +// a flag indicating if the attribute has a value. +func (o *WifIdentityProvider) GetIdentityProviderId() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.identityProviderId + } + return +} + +// IssuerUrl returns the value of the 'issuer_url' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifIdentityProvider) IssuerUrl() string { + if o != nil && o.bitmap_&4 != 0 { + return o.issuerUrl + } + return "" +} + +// GetIssuerUrl returns the value of the 'issuer_url' attribute and +// a flag indicating if the attribute has a value. +func (o *WifIdentityProvider) GetIssuerUrl() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.issuerUrl + } + return +} + +// Jwks returns the value of the 'jwks' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifIdentityProvider) Jwks() string { + if o != nil && o.bitmap_&8 != 0 { + return o.jwks + } + return "" +} + +// GetJwks returns the value of the 'jwks' attribute and +// a flag indicating if the attribute has a value. +func (o *WifIdentityProvider) GetJwks() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.jwks + } + return +} + +// WifIdentityProviderListKind is the name of the type used to represent list of objects of +// type 'wif_identity_provider'. +const WifIdentityProviderListKind = "WifIdentityProviderList" + +// WifIdentityProviderListLinkKind is the name of the type used to represent links to list +// of objects of type 'wif_identity_provider'. +const WifIdentityProviderListLinkKind = "WifIdentityProviderListLink" + +// WifIdentityProviderNilKind is the name of the type used to nil lists of objects of +// type 'wif_identity_provider'. +const WifIdentityProviderListNilKind = "WifIdentityProviderListNil" + +// WifIdentityProviderList is a list of values of the 'wif_identity_provider' type. +type WifIdentityProviderList struct { + href string + link bool + items []*WifIdentityProvider +} + +// Len returns the length of the list. +func (l *WifIdentityProviderList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *WifIdentityProviderList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *WifIdentityProviderList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *WifIdentityProviderList) SetItems(items []*WifIdentityProvider) { + l.items = items +} + +// Items returns the items of the list. +func (l *WifIdentityProviderList) Items() []*WifIdentityProvider { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *WifIdentityProviderList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *WifIdentityProviderList) Get(i int) *WifIdentityProvider { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *WifIdentityProviderList) Slice() []*WifIdentityProvider { + var slice []*WifIdentityProvider + if l == nil { + slice = make([]*WifIdentityProvider, 0) + } else { + slice = make([]*WifIdentityProvider, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *WifIdentityProviderList) Each(f func(item *WifIdentityProvider) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *WifIdentityProviderList) Range(f func(index int, item *WifIdentityProvider) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/wif_identity_provider_type_json.go b/clientapi/clustersmgmt/v1/wif_identity_provider_type_json.go new file mode 100644 index 00000000..f0b6ff47 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_identity_provider_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifIdentityProvider writes a value of the 'wif_identity_provider' type to the given writer. +func MarshalWifIdentityProvider(object *WifIdentityProvider, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifIdentityProvider(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifIdentityProvider writes a value of the 'wif_identity_provider' type to the given stream. +func WriteWifIdentityProvider(object *WifIdentityProvider, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.allowedAudiences != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("allowed_audiences") + WriteStringList(object.allowedAudiences, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("identity_provider_id") + stream.WriteString(object.identityProviderId) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("issuer_url") + stream.WriteString(object.issuerUrl) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("jwks") + stream.WriteString(object.jwks) + } + stream.WriteObjectEnd() +} + +// UnmarshalWifIdentityProvider reads a value of the 'wif_identity_provider' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalWifIdentityProvider(source interface{}) (object *WifIdentityProvider, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadWifIdentityProvider(iterator) + err = iterator.Error + return +} + +// ReadWifIdentityProvider reads a value of the 'wif_identity_provider' type from the given iterator. +func ReadWifIdentityProvider(iterator *jsoniter.Iterator) *WifIdentityProvider { + object := &WifIdentityProvider{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "allowed_audiences": + value := ReadStringList(iterator) + object.allowedAudiences = value + object.bitmap_ |= 1 + case "identity_provider_id": + value := iterator.ReadString() + object.identityProviderId = value + object.bitmap_ |= 2 + case "issuer_url": + value := iterator.ReadString() + object.issuerUrl = value + object.bitmap_ |= 4 + case "jwks": + value := iterator.ReadString() + object.jwks = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/wif_pool_builder.go b/clientapi/clustersmgmt/v1/wif_pool_builder.go new file mode 100644 index 00000000..3af5e945 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_pool_builder.go @@ -0,0 +1,94 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifPoolBuilder contains the data and logic needed to build 'wif_pool' objects. +type WifPoolBuilder struct { + bitmap_ uint32 + identityProvider *WifIdentityProviderBuilder + poolId string + poolName string +} + +// NewWifPool creates a new builder of 'wif_pool' objects. +func NewWifPool() *WifPoolBuilder { + return &WifPoolBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *WifPoolBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// IdentityProvider sets the value of the 'identity_provider' attribute to the given value. +func (b *WifPoolBuilder) IdentityProvider(value *WifIdentityProviderBuilder) *WifPoolBuilder { + b.identityProvider = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// PoolId sets the value of the 'pool_id' attribute to the given value. +func (b *WifPoolBuilder) PoolId(value string) *WifPoolBuilder { + b.poolId = value + b.bitmap_ |= 2 + return b +} + +// PoolName sets the value of the 'pool_name' attribute to the given value. +func (b *WifPoolBuilder) PoolName(value string) *WifPoolBuilder { + b.poolName = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *WifPoolBuilder) Copy(object *WifPool) *WifPoolBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.identityProvider != nil { + b.identityProvider = NewWifIdentityProvider().Copy(object.identityProvider) + } else { + b.identityProvider = nil + } + b.poolId = object.poolId + b.poolName = object.poolName + return b +} + +// Build creates a 'wif_pool' object using the configuration stored in the builder. +func (b *WifPoolBuilder) Build() (object *WifPool, err error) { + object = new(WifPool) + object.bitmap_ = b.bitmap_ + if b.identityProvider != nil { + object.identityProvider, err = b.identityProvider.Build() + if err != nil { + return + } + } + object.poolId = b.poolId + object.poolName = b.poolName + return +} diff --git a/clientapi/clustersmgmt/v1/wif_pool_list_builder.go b/clientapi/clustersmgmt/v1/wif_pool_list_builder.go new file mode 100644 index 00000000..ded9d8eb --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_pool_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifPoolListBuilder contains the data and logic needed to build +// 'wif_pool' objects. +type WifPoolListBuilder struct { + items []*WifPoolBuilder +} + +// NewWifPoolList creates a new builder of 'wif_pool' objects. +func NewWifPoolList() *WifPoolListBuilder { + return new(WifPoolListBuilder) +} + +// Items sets the items of the list. +func (b *WifPoolListBuilder) Items(values ...*WifPoolBuilder) *WifPoolListBuilder { + b.items = make([]*WifPoolBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *WifPoolListBuilder) 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 *WifPoolListBuilder) Copy(list *WifPoolList) *WifPoolListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*WifPoolBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewWifPool().Copy(v) + } + } + return b +} + +// Build creates a list of 'wif_pool' objects using the +// configuration stored in the builder. +func (b *WifPoolListBuilder) Build() (list *WifPoolList, err error) { + items := make([]*WifPool, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(WifPoolList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/wif_pool_list_type_json.go b/clientapi/clustersmgmt/v1/wif_pool_list_type_json.go new file mode 100644 index 00000000..1422cba2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_pool_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifPoolList writes a list of values of the 'wif_pool' type to +// the given writer. +func MarshalWifPoolList(list []*WifPool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifPoolList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifPoolList writes a list of value of the 'wif_pool' type to +// the given stream. +func WriteWifPoolList(list []*WifPool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteWifPool(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalWifPoolList reads a list of values of the 'wif_pool' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalWifPoolList(source interface{}) (items []*WifPool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadWifPoolList(iterator) + err = iterator.Error + return +} + +// ReadWifPoolList reads list of values of the ”wif_pool' type from +// the given iterator. +func ReadWifPoolList(iterator *jsoniter.Iterator) []*WifPool { + list := []*WifPool{} + for iterator.ReadArray() { + item := ReadWifPool(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/wif_pool_type.go b/clientapi/clustersmgmt/v1/wif_pool_type.go new file mode 100644 index 00000000..3ab17d69 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_pool_type.go @@ -0,0 +1,213 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifPool represents the values of the 'wif_pool' type. +type WifPool struct { + bitmap_ uint32 + identityProvider *WifIdentityProvider + poolId string + poolName string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *WifPool) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// IdentityProvider returns the value of the 'identity_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Identity provider configuration data that will be created as part of the +// workload identity pool. +func (o *WifPool) IdentityProvider() *WifIdentityProvider { + if o != nil && o.bitmap_&1 != 0 { + return o.identityProvider + } + return nil +} + +// GetIdentityProvider returns the value of the 'identity_provider' attribute and +// a flag indicating if the attribute has a value. +// +// Identity provider configuration data that will be created as part of the +// workload identity pool. +func (o *WifPool) GetIdentityProvider() (value *WifIdentityProvider, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.identityProvider + } + return +} + +// PoolId returns the value of the 'pool_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Id of the workload identity pool. +func (o *WifPool) PoolId() string { + if o != nil && o.bitmap_&2 != 0 { + return o.poolId + } + return "" +} + +// GetPoolId returns the value of the 'pool_id' attribute and +// a flag indicating if the attribute has a value. +// +// The Id of the workload identity pool. +func (o *WifPool) GetPoolId() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.poolId + } + return +} + +// PoolName returns the value of the 'pool_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The display name of the workload identity pool. +func (o *WifPool) PoolName() string { + if o != nil && o.bitmap_&4 != 0 { + return o.poolName + } + return "" +} + +// GetPoolName returns the value of the 'pool_name' attribute and +// a flag indicating if the attribute has a value. +// +// The display name of the workload identity pool. +func (o *WifPool) GetPoolName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.poolName + } + return +} + +// WifPoolListKind is the name of the type used to represent list of objects of +// type 'wif_pool'. +const WifPoolListKind = "WifPoolList" + +// WifPoolListLinkKind is the name of the type used to represent links to list +// of objects of type 'wif_pool'. +const WifPoolListLinkKind = "WifPoolListLink" + +// WifPoolNilKind is the name of the type used to nil lists of objects of +// type 'wif_pool'. +const WifPoolListNilKind = "WifPoolListNil" + +// WifPoolList is a list of values of the 'wif_pool' type. +type WifPoolList struct { + href string + link bool + items []*WifPool +} + +// Len returns the length of the list. +func (l *WifPoolList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *WifPoolList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *WifPoolList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *WifPoolList) SetItems(items []*WifPool) { + l.items = items +} + +// Items returns the items of the list. +func (l *WifPoolList) Items() []*WifPool { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *WifPoolList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *WifPoolList) Get(i int) *WifPool { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *WifPoolList) Slice() []*WifPool { + var slice []*WifPool + if l == nil { + slice = make([]*WifPool, 0) + } else { + slice = make([]*WifPool, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *WifPoolList) Each(f func(item *WifPool) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *WifPoolList) Range(f func(index int, item *WifPool) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/wif_pool_type_json.go b/clientapi/clustersmgmt/v1/wif_pool_type_json.go new file mode 100644 index 00000000..711dbed2 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_pool_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifPool writes a value of the 'wif_pool' type to the given writer. +func MarshalWifPool(object *WifPool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifPool(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifPool writes a value of the 'wif_pool' type to the given stream. +func WriteWifPool(object *WifPool, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.identityProvider != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("identity_provider") + WriteWifIdentityProvider(object.identityProvider, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("pool_id") + stream.WriteString(object.poolId) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("pool_name") + stream.WriteString(object.poolName) + } + stream.WriteObjectEnd() +} + +// UnmarshalWifPool reads a value of the 'wif_pool' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalWifPool(source interface{}) (object *WifPool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadWifPool(iterator) + err = iterator.Error + return +} + +// ReadWifPool reads a value of the 'wif_pool' type from the given iterator. +func ReadWifPool(iterator *jsoniter.Iterator) *WifPool { + object := &WifPool{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "identity_provider": + value := ReadWifIdentityProvider(iterator) + object.identityProvider = value + object.bitmap_ |= 1 + case "pool_id": + value := iterator.ReadString() + object.poolId = value + object.bitmap_ |= 2 + case "pool_name": + value := iterator.ReadString() + object.poolName = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/wif_role_builder.go b/clientapi/clustersmgmt/v1/wif_role_builder.go new file mode 100644 index 00000000..8bdcd64b --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_role_builder.go @@ -0,0 +1,90 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifRoleBuilder contains the data and logic needed to build 'wif_role' objects. +type WifRoleBuilder struct { + bitmap_ uint32 + permissions []string + roleId string + predefined bool +} + +// NewWifRole creates a new builder of 'wif_role' objects. +func NewWifRole() *WifRoleBuilder { + return &WifRoleBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *WifRoleBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Permissions sets the value of the 'permissions' attribute to the given values. +func (b *WifRoleBuilder) Permissions(values ...string) *WifRoleBuilder { + b.permissions = make([]string, len(values)) + copy(b.permissions, values) + b.bitmap_ |= 1 + return b +} + +// Predefined sets the value of the 'predefined' attribute to the given value. +func (b *WifRoleBuilder) Predefined(value bool) *WifRoleBuilder { + b.predefined = value + b.bitmap_ |= 2 + return b +} + +// RoleId sets the value of the 'role_id' attribute to the given value. +func (b *WifRoleBuilder) RoleId(value string) *WifRoleBuilder { + b.roleId = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *WifRoleBuilder) Copy(object *WifRole) *WifRoleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.permissions != nil { + b.permissions = make([]string, len(object.permissions)) + copy(b.permissions, object.permissions) + } else { + b.permissions = nil + } + b.predefined = object.predefined + b.roleId = object.roleId + return b +} + +// Build creates a 'wif_role' object using the configuration stored in the builder. +func (b *WifRoleBuilder) Build() (object *WifRole, err error) { + object = new(WifRole) + object.bitmap_ = b.bitmap_ + if b.permissions != nil { + object.permissions = make([]string, len(b.permissions)) + copy(object.permissions, b.permissions) + } + object.predefined = b.predefined + object.roleId = b.roleId + return +} diff --git a/clientapi/clustersmgmt/v1/wif_role_list_builder.go b/clientapi/clustersmgmt/v1/wif_role_list_builder.go new file mode 100644 index 00000000..d08d8e37 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_role_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifRoleListBuilder contains the data and logic needed to build +// 'wif_role' objects. +type WifRoleListBuilder struct { + items []*WifRoleBuilder +} + +// NewWifRoleList creates a new builder of 'wif_role' objects. +func NewWifRoleList() *WifRoleListBuilder { + return new(WifRoleListBuilder) +} + +// Items sets the items of the list. +func (b *WifRoleListBuilder) Items(values ...*WifRoleBuilder) *WifRoleListBuilder { + b.items = make([]*WifRoleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *WifRoleListBuilder) 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 *WifRoleListBuilder) Copy(list *WifRoleList) *WifRoleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*WifRoleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewWifRole().Copy(v) + } + } + return b +} + +// Build creates a list of 'wif_role' objects using the +// configuration stored in the builder. +func (b *WifRoleListBuilder) Build() (list *WifRoleList, err error) { + items := make([]*WifRole, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(WifRoleList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/wif_role_list_type_json.go b/clientapi/clustersmgmt/v1/wif_role_list_type_json.go new file mode 100644 index 00000000..ea3df434 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_role_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifRoleList writes a list of values of the 'wif_role' type to +// the given writer. +func MarshalWifRoleList(list []*WifRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifRoleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifRoleList writes a list of value of the 'wif_role' type to +// the given stream. +func WriteWifRoleList(list []*WifRole, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteWifRole(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalWifRoleList reads a list of values of the 'wif_role' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalWifRoleList(source interface{}) (items []*WifRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadWifRoleList(iterator) + err = iterator.Error + return +} + +// ReadWifRoleList reads list of values of the ”wif_role' type from +// the given iterator. +func ReadWifRoleList(iterator *jsoniter.Iterator) []*WifRole { + list := []*WifRole{} + for iterator.ReadArray() { + item := ReadWifRole(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/wif_role_type.go b/clientapi/clustersmgmt/v1/wif_role_type.go new file mode 100644 index 00000000..118ba883 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_role_type.go @@ -0,0 +1,199 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifRole represents the values of the 'wif_role' type. +type WifRole struct { + bitmap_ uint32 + permissions []string + roleId string + predefined bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *WifRole) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Permissions returns the value of the 'permissions' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifRole) Permissions() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.permissions + } + return nil +} + +// GetPermissions returns the value of the 'permissions' attribute and +// a flag indicating if the attribute has a value. +func (o *WifRole) GetPermissions() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.permissions + } + return +} + +// Predefined returns the value of the 'predefined' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifRole) Predefined() bool { + if o != nil && o.bitmap_&2 != 0 { + return o.predefined + } + return false +} + +// GetPredefined returns the value of the 'predefined' attribute and +// a flag indicating if the attribute has a value. +func (o *WifRole) GetPredefined() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.predefined + } + return +} + +// RoleId returns the value of the 'role_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifRole) RoleId() string { + if o != nil && o.bitmap_&4 != 0 { + return o.roleId + } + return "" +} + +// GetRoleId returns the value of the 'role_id' attribute and +// a flag indicating if the attribute has a value. +func (o *WifRole) GetRoleId() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.roleId + } + return +} + +// WifRoleListKind is the name of the type used to represent list of objects of +// type 'wif_role'. +const WifRoleListKind = "WifRoleList" + +// WifRoleListLinkKind is the name of the type used to represent links to list +// of objects of type 'wif_role'. +const WifRoleListLinkKind = "WifRoleListLink" + +// WifRoleNilKind is the name of the type used to nil lists of objects of +// type 'wif_role'. +const WifRoleListNilKind = "WifRoleListNil" + +// WifRoleList is a list of values of the 'wif_role' type. +type WifRoleList struct { + href string + link bool + items []*WifRole +} + +// Len returns the length of the list. +func (l *WifRoleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *WifRoleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *WifRoleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *WifRoleList) SetItems(items []*WifRole) { + l.items = items +} + +// Items returns the items of the list. +func (l *WifRoleList) Items() []*WifRole { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *WifRoleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *WifRoleList) Get(i int) *WifRole { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *WifRoleList) Slice() []*WifRole { + var slice []*WifRole + if l == nil { + slice = make([]*WifRole, 0) + } else { + slice = make([]*WifRole, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *WifRoleList) Each(f func(item *WifRole) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *WifRoleList) Range(f func(index int, item *WifRole) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/wif_role_type_json.go b/clientapi/clustersmgmt/v1/wif_role_type_json.go new file mode 100644 index 00000000..3346b452 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_role_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifRole writes a value of the 'wif_role' type to the given writer. +func MarshalWifRole(object *WifRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifRole(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifRole writes a value of the 'wif_role' type to the given stream. +func WriteWifRole(object *WifRole, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.permissions != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("permissions") + WriteStringList(object.permissions, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("predefined") + stream.WriteBool(object.predefined) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role_id") + stream.WriteString(object.roleId) + } + stream.WriteObjectEnd() +} + +// UnmarshalWifRole reads a value of the 'wif_role' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalWifRole(source interface{}) (object *WifRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadWifRole(iterator) + err = iterator.Error + return +} + +// ReadWifRole reads a value of the 'wif_role' type from the given iterator. +func ReadWifRole(iterator *jsoniter.Iterator) *WifRole { + object := &WifRole{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "permissions": + value := ReadStringList(iterator) + object.permissions = value + object.bitmap_ |= 1 + case "predefined": + value := iterator.ReadBool() + object.predefined = value + object.bitmap_ |= 2 + case "role_id": + value := iterator.ReadString() + object.roleId = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/wif_secret_ref_builder.go b/clientapi/clustersmgmt/v1/wif_secret_ref_builder.go new file mode 100644 index 00000000..daeba04f --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_secret_ref_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifSecretRefBuilder contains the data and logic needed to build 'wif_secret_ref' objects. +type WifSecretRefBuilder struct { + bitmap_ uint32 + name string + namespace string +} + +// NewWifSecretRef creates a new builder of 'wif_secret_ref' objects. +func NewWifSecretRef() *WifSecretRefBuilder { + return &WifSecretRefBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *WifSecretRefBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *WifSecretRefBuilder) Name(value string) *WifSecretRefBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Namespace sets the value of the 'namespace' attribute to the given value. +func (b *WifSecretRefBuilder) Namespace(value string) *WifSecretRefBuilder { + b.namespace = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *WifSecretRefBuilder) Copy(object *WifSecretRef) *WifSecretRefBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + b.namespace = object.namespace + return b +} + +// Build creates a 'wif_secret_ref' object using the configuration stored in the builder. +func (b *WifSecretRefBuilder) Build() (object *WifSecretRef, err error) { + object = new(WifSecretRef) + object.bitmap_ = b.bitmap_ + object.name = b.name + object.namespace = b.namespace + return +} diff --git a/clientapi/clustersmgmt/v1/wif_secret_ref_list_builder.go b/clientapi/clustersmgmt/v1/wif_secret_ref_list_builder.go new file mode 100644 index 00000000..6f69120e --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_secret_ref_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifSecretRefListBuilder contains the data and logic needed to build +// 'wif_secret_ref' objects. +type WifSecretRefListBuilder struct { + items []*WifSecretRefBuilder +} + +// NewWifSecretRefList creates a new builder of 'wif_secret_ref' objects. +func NewWifSecretRefList() *WifSecretRefListBuilder { + return new(WifSecretRefListBuilder) +} + +// Items sets the items of the list. +func (b *WifSecretRefListBuilder) Items(values ...*WifSecretRefBuilder) *WifSecretRefListBuilder { + b.items = make([]*WifSecretRefBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *WifSecretRefListBuilder) 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 *WifSecretRefListBuilder) Copy(list *WifSecretRefList) *WifSecretRefListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*WifSecretRefBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewWifSecretRef().Copy(v) + } + } + return b +} + +// Build creates a list of 'wif_secret_ref' objects using the +// configuration stored in the builder. +func (b *WifSecretRefListBuilder) Build() (list *WifSecretRefList, err error) { + items := make([]*WifSecretRef, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(WifSecretRefList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/wif_secret_ref_list_type_json.go b/clientapi/clustersmgmt/v1/wif_secret_ref_list_type_json.go new file mode 100644 index 00000000..9792fe94 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_secret_ref_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifSecretRefList writes a list of values of the 'wif_secret_ref' type to +// the given writer. +func MarshalWifSecretRefList(list []*WifSecretRef, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifSecretRefList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifSecretRefList writes a list of value of the 'wif_secret_ref' type to +// the given stream. +func WriteWifSecretRefList(list []*WifSecretRef, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteWifSecretRef(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalWifSecretRefList reads a list of values of the 'wif_secret_ref' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalWifSecretRefList(source interface{}) (items []*WifSecretRef, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadWifSecretRefList(iterator) + err = iterator.Error + return +} + +// ReadWifSecretRefList reads list of values of the ”wif_secret_ref' type from +// the given iterator. +func ReadWifSecretRefList(iterator *jsoniter.Iterator) []*WifSecretRef { + list := []*WifSecretRef{} + for iterator.ReadArray() { + item := ReadWifSecretRef(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/wif_secret_ref_type.go b/clientapi/clustersmgmt/v1/wif_secret_ref_type.go new file mode 100644 index 00000000..bfb098e6 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_secret_ref_type.go @@ -0,0 +1,179 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifSecretRef represents the values of the 'wif_secret_ref' type. +type WifSecretRef struct { + bitmap_ uint32 + name string + namespace string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *WifSecretRef) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifSecretRef) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *WifSecretRef) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Namespace returns the value of the 'namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifSecretRef) Namespace() string { + if o != nil && o.bitmap_&2 != 0 { + return o.namespace + } + return "" +} + +// GetNamespace returns the value of the 'namespace' attribute and +// a flag indicating if the attribute has a value. +func (o *WifSecretRef) GetNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.namespace + } + return +} + +// WifSecretRefListKind is the name of the type used to represent list of objects of +// type 'wif_secret_ref'. +const WifSecretRefListKind = "WifSecretRefList" + +// WifSecretRefListLinkKind is the name of the type used to represent links to list +// of objects of type 'wif_secret_ref'. +const WifSecretRefListLinkKind = "WifSecretRefListLink" + +// WifSecretRefNilKind is the name of the type used to nil lists of objects of +// type 'wif_secret_ref'. +const WifSecretRefListNilKind = "WifSecretRefListNil" + +// WifSecretRefList is a list of values of the 'wif_secret_ref' type. +type WifSecretRefList struct { + href string + link bool + items []*WifSecretRef +} + +// Len returns the length of the list. +func (l *WifSecretRefList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *WifSecretRefList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *WifSecretRefList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *WifSecretRefList) SetItems(items []*WifSecretRef) { + l.items = items +} + +// Items returns the items of the list. +func (l *WifSecretRefList) Items() []*WifSecretRef { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *WifSecretRefList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *WifSecretRefList) Get(i int) *WifSecretRef { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *WifSecretRefList) Slice() []*WifSecretRef { + var slice []*WifSecretRef + if l == nil { + slice = make([]*WifSecretRef, 0) + } else { + slice = make([]*WifSecretRef, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *WifSecretRefList) Each(f func(item *WifSecretRef) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *WifSecretRefList) Range(f func(index int, item *WifSecretRef) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/wif_secret_ref_type_json.go b/clientapi/clustersmgmt/v1/wif_secret_ref_type_json.go new file mode 100644 index 00000000..de23ac34 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_secret_ref_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifSecretRef writes a value of the 'wif_secret_ref' type to the given writer. +func MarshalWifSecretRef(object *WifSecretRef, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifSecretRef(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifSecretRef writes a value of the 'wif_secret_ref' type to the given stream. +func WriteWifSecretRef(object *WifSecretRef, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("namespace") + stream.WriteString(object.namespace) + } + stream.WriteObjectEnd() +} + +// UnmarshalWifSecretRef reads a value of the 'wif_secret_ref' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalWifSecretRef(source interface{}) (object *WifSecretRef, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadWifSecretRef(iterator) + err = iterator.Error + return +} + +// ReadWifSecretRef reads a value of the 'wif_secret_ref' type from the given iterator. +func ReadWifSecretRef(iterator *jsoniter.Iterator) *WifSecretRef { + object := &WifSecretRef{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "namespace": + value := iterator.ReadString() + object.namespace = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/wif_service_account_builder.go b/clientapi/clustersmgmt/v1/wif_service_account_builder.go new file mode 100644 index 00000000..3fe7a107 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_service_account_builder.go @@ -0,0 +1,130 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifServiceAccountBuilder contains the data and logic needed to build 'wif_service_account' objects. +type WifServiceAccountBuilder struct { + bitmap_ uint32 + accessMethod WifAccessMethod + credentialRequest *WifCredentialRequestBuilder + osdRole string + roles []*WifRoleBuilder + serviceAccountId string +} + +// NewWifServiceAccount creates a new builder of 'wif_service_account' objects. +func NewWifServiceAccount() *WifServiceAccountBuilder { + return &WifServiceAccountBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *WifServiceAccountBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AccessMethod sets the value of the 'access_method' attribute to the given value. +func (b *WifServiceAccountBuilder) AccessMethod(value WifAccessMethod) *WifServiceAccountBuilder { + b.accessMethod = value + b.bitmap_ |= 1 + return b +} + +// CredentialRequest sets the value of the 'credential_request' attribute to the given value. +func (b *WifServiceAccountBuilder) CredentialRequest(value *WifCredentialRequestBuilder) *WifServiceAccountBuilder { + b.credentialRequest = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// OsdRole sets the value of the 'osd_role' attribute to the given value. +func (b *WifServiceAccountBuilder) OsdRole(value string) *WifServiceAccountBuilder { + b.osdRole = value + b.bitmap_ |= 4 + return b +} + +// Roles sets the value of the 'roles' attribute to the given values. +func (b *WifServiceAccountBuilder) Roles(values ...*WifRoleBuilder) *WifServiceAccountBuilder { + b.roles = make([]*WifRoleBuilder, len(values)) + copy(b.roles, values) + b.bitmap_ |= 8 + return b +} + +// ServiceAccountId sets the value of the 'service_account_id' attribute to the given value. +func (b *WifServiceAccountBuilder) ServiceAccountId(value string) *WifServiceAccountBuilder { + b.serviceAccountId = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *WifServiceAccountBuilder) Copy(object *WifServiceAccount) *WifServiceAccountBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.accessMethod = object.accessMethod + if object.credentialRequest != nil { + b.credentialRequest = NewWifCredentialRequest().Copy(object.credentialRequest) + } else { + b.credentialRequest = nil + } + b.osdRole = object.osdRole + if object.roles != nil { + b.roles = make([]*WifRoleBuilder, len(object.roles)) + for i, v := range object.roles { + b.roles[i] = NewWifRole().Copy(v) + } + } else { + b.roles = nil + } + b.serviceAccountId = object.serviceAccountId + return b +} + +// Build creates a 'wif_service_account' object using the configuration stored in the builder. +func (b *WifServiceAccountBuilder) Build() (object *WifServiceAccount, err error) { + object = new(WifServiceAccount) + object.bitmap_ = b.bitmap_ + object.accessMethod = b.accessMethod + if b.credentialRequest != nil { + object.credentialRequest, err = b.credentialRequest.Build() + if err != nil { + return + } + } + object.osdRole = b.osdRole + if b.roles != nil { + object.roles = make([]*WifRole, len(b.roles)) + for i, v := range b.roles { + object.roles[i], err = v.Build() + if err != nil { + return + } + } + } + object.serviceAccountId = b.serviceAccountId + return +} diff --git a/clientapi/clustersmgmt/v1/wif_service_account_list_builder.go b/clientapi/clustersmgmt/v1/wif_service_account_list_builder.go new file mode 100644 index 00000000..dc584e66 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_service_account_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifServiceAccountListBuilder contains the data and logic needed to build +// 'wif_service_account' objects. +type WifServiceAccountListBuilder struct { + items []*WifServiceAccountBuilder +} + +// NewWifServiceAccountList creates a new builder of 'wif_service_account' objects. +func NewWifServiceAccountList() *WifServiceAccountListBuilder { + return new(WifServiceAccountListBuilder) +} + +// Items sets the items of the list. +func (b *WifServiceAccountListBuilder) Items(values ...*WifServiceAccountBuilder) *WifServiceAccountListBuilder { + b.items = make([]*WifServiceAccountBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *WifServiceAccountListBuilder) 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 *WifServiceAccountListBuilder) Copy(list *WifServiceAccountList) *WifServiceAccountListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*WifServiceAccountBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewWifServiceAccount().Copy(v) + } + } + return b +} + +// Build creates a list of 'wif_service_account' objects using the +// configuration stored in the builder. +func (b *WifServiceAccountListBuilder) Build() (list *WifServiceAccountList, err error) { + items := make([]*WifServiceAccount, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(WifServiceAccountList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/wif_service_account_list_type_json.go b/clientapi/clustersmgmt/v1/wif_service_account_list_type_json.go new file mode 100644 index 00000000..e6fa98d1 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_service_account_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifServiceAccountList writes a list of values of the 'wif_service_account' type to +// the given writer. +func MarshalWifServiceAccountList(list []*WifServiceAccount, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifServiceAccountList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifServiceAccountList writes a list of value of the 'wif_service_account' type to +// the given stream. +func WriteWifServiceAccountList(list []*WifServiceAccount, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteWifServiceAccount(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalWifServiceAccountList reads a list of values of the 'wif_service_account' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalWifServiceAccountList(source interface{}) (items []*WifServiceAccount, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadWifServiceAccountList(iterator) + err = iterator.Error + return +} + +// ReadWifServiceAccountList reads list of values of the ”wif_service_account' type from +// the given iterator. +func ReadWifServiceAccountList(iterator *jsoniter.Iterator) []*WifServiceAccount { + list := []*WifServiceAccount{} + for iterator.ReadArray() { + item := ReadWifServiceAccount(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/wif_service_account_type.go b/clientapi/clustersmgmt/v1/wif_service_account_type.go new file mode 100644 index 00000000..e189d01b --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_service_account_type.go @@ -0,0 +1,239 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifServiceAccount represents the values of the 'wif_service_account' type. +type WifServiceAccount struct { + bitmap_ uint32 + accessMethod WifAccessMethod + credentialRequest *WifCredentialRequest + osdRole string + roles []*WifRole + serviceAccountId string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *WifServiceAccount) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AccessMethod returns the value of the 'access_method' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifServiceAccount) AccessMethod() WifAccessMethod { + if o != nil && o.bitmap_&1 != 0 { + return o.accessMethod + } + return WifAccessMethod("") +} + +// GetAccessMethod returns the value of the 'access_method' attribute and +// a flag indicating if the attribute has a value. +func (o *WifServiceAccount) GetAccessMethod() (value WifAccessMethod, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.accessMethod + } + return +} + +// CredentialRequest returns the value of the 'credential_request' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifServiceAccount) CredentialRequest() *WifCredentialRequest { + if o != nil && o.bitmap_&2 != 0 { + return o.credentialRequest + } + return nil +} + +// GetCredentialRequest returns the value of the 'credential_request' attribute and +// a flag indicating if the attribute has a value. +func (o *WifServiceAccount) GetCredentialRequest() (value *WifCredentialRequest, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.credentialRequest + } + return +} + +// OsdRole returns the value of the 'osd_role' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifServiceAccount) OsdRole() string { + if o != nil && o.bitmap_&4 != 0 { + return o.osdRole + } + return "" +} + +// GetOsdRole returns the value of the 'osd_role' attribute and +// a flag indicating if the attribute has a value. +func (o *WifServiceAccount) GetOsdRole() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.osdRole + } + return +} + +// Roles returns the value of the 'roles' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifServiceAccount) Roles() []*WifRole { + if o != nil && o.bitmap_&8 != 0 { + return o.roles + } + return nil +} + +// GetRoles returns the value of the 'roles' attribute and +// a flag indicating if the attribute has a value. +func (o *WifServiceAccount) GetRoles() (value []*WifRole, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.roles + } + return +} + +// ServiceAccountId returns the value of the 'service_account_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifServiceAccount) ServiceAccountId() string { + if o != nil && o.bitmap_&16 != 0 { + return o.serviceAccountId + } + return "" +} + +// GetServiceAccountId returns the value of the 'service_account_id' attribute and +// a flag indicating if the attribute has a value. +func (o *WifServiceAccount) GetServiceAccountId() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.serviceAccountId + } + return +} + +// WifServiceAccountListKind is the name of the type used to represent list of objects of +// type 'wif_service_account'. +const WifServiceAccountListKind = "WifServiceAccountList" + +// WifServiceAccountListLinkKind is the name of the type used to represent links to list +// of objects of type 'wif_service_account'. +const WifServiceAccountListLinkKind = "WifServiceAccountListLink" + +// WifServiceAccountNilKind is the name of the type used to nil lists of objects of +// type 'wif_service_account'. +const WifServiceAccountListNilKind = "WifServiceAccountListNil" + +// WifServiceAccountList is a list of values of the 'wif_service_account' type. +type WifServiceAccountList struct { + href string + link bool + items []*WifServiceAccount +} + +// Len returns the length of the list. +func (l *WifServiceAccountList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *WifServiceAccountList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *WifServiceAccountList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *WifServiceAccountList) SetItems(items []*WifServiceAccount) { + l.items = items +} + +// Items returns the items of the list. +func (l *WifServiceAccountList) Items() []*WifServiceAccount { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *WifServiceAccountList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *WifServiceAccountList) Get(i int) *WifServiceAccount { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *WifServiceAccountList) Slice() []*WifServiceAccount { + var slice []*WifServiceAccount + if l == nil { + slice = make([]*WifServiceAccount, 0) + } else { + slice = make([]*WifServiceAccount, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *WifServiceAccountList) Each(f func(item *WifServiceAccount) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *WifServiceAccountList) Range(f func(index int, item *WifServiceAccount) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/wif_service_account_type_json.go b/clientapi/clustersmgmt/v1/wif_service_account_type_json.go new file mode 100644 index 00000000..773a0fdf --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_service_account_type_json.go @@ -0,0 +1,139 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifServiceAccount writes a value of the 'wif_service_account' type to the given writer. +func MarshalWifServiceAccount(object *WifServiceAccount, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifServiceAccount(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifServiceAccount writes a value of the 'wif_service_account' type to the given stream. +func WriteWifServiceAccount(object *WifServiceAccount, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("access_method") + stream.WriteString(string(object.accessMethod)) + count++ + } + present_ = object.bitmap_&2 != 0 && object.credentialRequest != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("credential_request") + WriteWifCredentialRequest(object.credentialRequest, stream) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("osd_role") + stream.WriteString(object.osdRole) + count++ + } + present_ = object.bitmap_&8 != 0 && object.roles != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("roles") + WriteWifRoleList(object.roles, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_account_id") + stream.WriteString(object.serviceAccountId) + } + stream.WriteObjectEnd() +} + +// UnmarshalWifServiceAccount reads a value of the 'wif_service_account' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalWifServiceAccount(source interface{}) (object *WifServiceAccount, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadWifServiceAccount(iterator) + err = iterator.Error + return +} + +// ReadWifServiceAccount reads a value of the 'wif_service_account' type from the given iterator. +func ReadWifServiceAccount(iterator *jsoniter.Iterator) *WifServiceAccount { + object := &WifServiceAccount{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "access_method": + text := iterator.ReadString() + value := WifAccessMethod(text) + object.accessMethod = value + object.bitmap_ |= 1 + case "credential_request": + value := ReadWifCredentialRequest(iterator) + object.credentialRequest = value + object.bitmap_ |= 2 + case "osd_role": + value := iterator.ReadString() + object.osdRole = value + object.bitmap_ |= 4 + case "roles": + value := ReadWifRoleList(iterator) + object.roles = value + object.bitmap_ |= 8 + case "service_account_id": + value := iterator.ReadString() + object.serviceAccountId = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/wif_support_builder.go b/clientapi/clustersmgmt/v1/wif_support_builder.go new file mode 100644 index 00000000..6cb190b3 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_support_builder.go @@ -0,0 +1,87 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifSupportBuilder contains the data and logic needed to build 'wif_support' objects. +type WifSupportBuilder struct { + bitmap_ uint32 + principal string + roles []*WifRoleBuilder +} + +// NewWifSupport creates a new builder of 'wif_support' objects. +func NewWifSupport() *WifSupportBuilder { + return &WifSupportBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *WifSupportBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Principal sets the value of the 'principal' attribute to the given value. +func (b *WifSupportBuilder) Principal(value string) *WifSupportBuilder { + b.principal = value + b.bitmap_ |= 1 + return b +} + +// Roles sets the value of the 'roles' attribute to the given values. +func (b *WifSupportBuilder) Roles(values ...*WifRoleBuilder) *WifSupportBuilder { + b.roles = make([]*WifRoleBuilder, len(values)) + copy(b.roles, values) + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *WifSupportBuilder) Copy(object *WifSupport) *WifSupportBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.principal = object.principal + if object.roles != nil { + b.roles = make([]*WifRoleBuilder, len(object.roles)) + for i, v := range object.roles { + b.roles[i] = NewWifRole().Copy(v) + } + } else { + b.roles = nil + } + return b +} + +// Build creates a 'wif_support' object using the configuration stored in the builder. +func (b *WifSupportBuilder) Build() (object *WifSupport, err error) { + object = new(WifSupport) + object.bitmap_ = b.bitmap_ + object.principal = b.principal + if b.roles != nil { + object.roles = make([]*WifRole, len(b.roles)) + for i, v := range b.roles { + object.roles[i], err = v.Build() + if err != nil { + return + } + } + } + return +} diff --git a/clientapi/clustersmgmt/v1/wif_support_list_builder.go b/clientapi/clustersmgmt/v1/wif_support_list_builder.go new file mode 100644 index 00000000..c4e7e07f --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_support_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifSupportListBuilder contains the data and logic needed to build +// 'wif_support' objects. +type WifSupportListBuilder struct { + items []*WifSupportBuilder +} + +// NewWifSupportList creates a new builder of 'wif_support' objects. +func NewWifSupportList() *WifSupportListBuilder { + return new(WifSupportListBuilder) +} + +// Items sets the items of the list. +func (b *WifSupportListBuilder) Items(values ...*WifSupportBuilder) *WifSupportListBuilder { + b.items = make([]*WifSupportBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *WifSupportListBuilder) 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 *WifSupportListBuilder) Copy(list *WifSupportList) *WifSupportListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*WifSupportBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewWifSupport().Copy(v) + } + } + return b +} + +// Build creates a list of 'wif_support' objects using the +// configuration stored in the builder. +func (b *WifSupportListBuilder) Build() (list *WifSupportList, err error) { + items := make([]*WifSupport, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(WifSupportList) + list.items = items + return +} diff --git a/clientapi/clustersmgmt/v1/wif_support_list_type_json.go b/clientapi/clustersmgmt/v1/wif_support_list_type_json.go new file mode 100644 index 00000000..3d678cfc --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_support_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifSupportList writes a list of values of the 'wif_support' type to +// the given writer. +func MarshalWifSupportList(list []*WifSupport, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifSupportList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifSupportList writes a list of value of the 'wif_support' type to +// the given stream. +func WriteWifSupportList(list []*WifSupport, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteWifSupport(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalWifSupportList reads a list of values of the 'wif_support' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalWifSupportList(source interface{}) (items []*WifSupport, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadWifSupportList(iterator) + err = iterator.Error + return +} + +// ReadWifSupportList reads list of values of the ”wif_support' type from +// the given iterator. +func ReadWifSupportList(iterator *jsoniter.Iterator) []*WifSupport { + list := []*WifSupport{} + for iterator.ReadArray() { + item := ReadWifSupport(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/wif_support_type.go b/clientapi/clustersmgmt/v1/wif_support_type.go new file mode 100644 index 00000000..56bcd762 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_support_type.go @@ -0,0 +1,179 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WifSupport represents the values of the 'wif_support' type. +type WifSupport struct { + bitmap_ uint32 + principal string + roles []*WifRole +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *WifSupport) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Principal returns the value of the 'principal' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifSupport) Principal() string { + if o != nil && o.bitmap_&1 != 0 { + return o.principal + } + return "" +} + +// GetPrincipal returns the value of the 'principal' attribute and +// a flag indicating if the attribute has a value. +func (o *WifSupport) GetPrincipal() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.principal + } + return +} + +// Roles returns the value of the 'roles' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *WifSupport) Roles() []*WifRole { + if o != nil && o.bitmap_&2 != 0 { + return o.roles + } + return nil +} + +// GetRoles returns the value of the 'roles' attribute and +// a flag indicating if the attribute has a value. +func (o *WifSupport) GetRoles() (value []*WifRole, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.roles + } + return +} + +// WifSupportListKind is the name of the type used to represent list of objects of +// type 'wif_support'. +const WifSupportListKind = "WifSupportList" + +// WifSupportListLinkKind is the name of the type used to represent links to list +// of objects of type 'wif_support'. +const WifSupportListLinkKind = "WifSupportListLink" + +// WifSupportNilKind is the name of the type used to nil lists of objects of +// type 'wif_support'. +const WifSupportListNilKind = "WifSupportListNil" + +// WifSupportList is a list of values of the 'wif_support' type. +type WifSupportList struct { + href string + link bool + items []*WifSupport +} + +// Len returns the length of the list. +func (l *WifSupportList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *WifSupportList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *WifSupportList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *WifSupportList) SetItems(items []*WifSupport) { + l.items = items +} + +// Items returns the items of the list. +func (l *WifSupportList) Items() []*WifSupport { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *WifSupportList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *WifSupportList) Get(i int) *WifSupport { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *WifSupportList) Slice() []*WifSupport { + var slice []*WifSupport + if l == nil { + slice = make([]*WifSupport, 0) + } else { + slice = make([]*WifSupport, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *WifSupportList) Each(f func(item *WifSupport) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *WifSupportList) Range(f func(index int, item *WifSupport) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/clustersmgmt/v1/wif_support_type_json.go b/clientapi/clustersmgmt/v1/wif_support_type_json.go new file mode 100644 index 00000000..94ee9144 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wif_support_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWifSupport writes a value of the 'wif_support' type to the given writer. +func MarshalWifSupport(object *WifSupport, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWifSupport(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWifSupport writes a value of the 'wif_support' type to the given stream. +func WriteWifSupport(object *WifSupport, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("principal") + stream.WriteString(object.principal) + count++ + } + present_ = object.bitmap_&2 != 0 && object.roles != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("roles") + WriteWifRoleList(object.roles, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalWifSupport reads a value of the 'wif_support' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalWifSupport(source interface{}) (object *WifSupport, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadWifSupport(iterator) + err = iterator.Error + return +} + +// ReadWifSupport reads a value of the 'wif_support' type from the given iterator. +func ReadWifSupport(iterator *jsoniter.Iterator) *WifSupport { + object := &WifSupport{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "principal": + value := iterator.ReadString() + object.principal = value + object.bitmap_ |= 1 + case "roles": + value := ReadWifRoleList(iterator) + object.roles = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/clustersmgmt/v1/wildcard_policy_list_type_json.go b/clientapi/clustersmgmt/v1/wildcard_policy_list_type_json.go new file mode 100644 index 00000000..7d5c8280 --- /dev/null +++ b/clientapi/clustersmgmt/v1/wildcard_policy_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalWildcardPolicyList writes a list of values of the 'wildcard_policy' type to +// the given writer. +func MarshalWildcardPolicyList(list []WildcardPolicy, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteWildcardPolicyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteWildcardPolicyList writes a list of value of the 'wildcard_policy' type to +// the given stream. +func WriteWildcardPolicyList(list []WildcardPolicy, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalWildcardPolicyList reads a list of values of the 'wildcard_policy' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalWildcardPolicyList(source interface{}) (items []WildcardPolicy, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadWildcardPolicyList(iterator) + err = iterator.Error + return +} + +// ReadWildcardPolicyList reads list of values of the ”wildcard_policy' type from +// the given iterator. +func ReadWildcardPolicyList(iterator *jsoniter.Iterator) []WildcardPolicy { + list := []WildcardPolicy{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := WildcardPolicy(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/clustersmgmt/v1/wildcard_policy_type.go b/clientapi/clustersmgmt/v1/wildcard_policy_type.go new file mode 100644 index 00000000..f74b5ccb --- /dev/null +++ b/clientapi/clustersmgmt/v1/wildcard_policy_type.go @@ -0,0 +1,30 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1 + +// WildcardPolicy represents the values of the 'wildcard_policy' enumerated type. +type WildcardPolicy string + +const ( + // Wildcards Allowed. + WildcardPolicyWildcardsAllowed WildcardPolicy = "WildcardsAllowed" + // Wildcards Disallowed. + WildcardPolicyWildcardsDisallowed WildcardPolicy = "WildcardsDisallowed" +) diff --git a/clientapi/dependencymagnet/doc.go b/clientapi/dependencymagnet/doc.go new file mode 100644 index 00000000..fd8a8b79 --- /dev/null +++ b/clientapi/dependencymagnet/doc.go @@ -0,0 +1,22 @@ +//go:build tools +// +build tools + +// go mod won't pull in code that isn't depended upon, but we have some code we don't depend on from code that must be included +// for our build to work. +package dependencymagnet + +import ( + // this gives us clear dependency control of our generator, easy replaces for development, ease of vendored inspection, and fully local builds. + _ "github.com/openshift-online/ocm-api-model/clientapi/model/access_transparency/v1" + _ "github.com/openshift-online/ocm-api-model/clientapi/model/accounts_mgmt/v1" + _ "github.com/openshift-online/ocm-api-model/clientapi/model/addons_mgmt/v1" + _ "github.com/openshift-online/ocm-api-model/clientapi/model/aro_hcp/v1alpha1" + _ "github.com/openshift-online/ocm-api-model/clientapi/model/authorizations/v1" + _ "github.com/openshift-online/ocm-api-model/clientapi/model/clusters_mgmt/v1" + _ "github.com/openshift-online/ocm-api-model/clientapi/model/job_queue/v1" + _ "github.com/openshift-online/ocm-api-model/clientapi/model/osd_fleet_mgmt/v1" + _ "github.com/openshift-online/ocm-api-model/clientapi/model/service_logs/v1" + _ "github.com/openshift-online/ocm-api-model/clientapi/model/service_mgmt/v1" + _ "github.com/openshift-online/ocm-api-model/clientapi/model/status_board/v1" + _ "github.com/openshift-online/ocm-api-model/clientapi/model/web_rca/v1" +) diff --git a/clientapi/go.mod b/clientapi/go.mod new file mode 100644 index 00000000..687cab80 --- /dev/null +++ b/clientapi/go.mod @@ -0,0 +1,13 @@ +module github.com/openshift-online/ocm-api-model/clientapi + +go 1.23.0 + +// this must not transitively depend on metamodel and must be as close to zero dep as possible. +// we can later eliminate json-iter + +require github.com/json-iterator/go v1.1.12 + +require ( + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect +) diff --git a/clientapi/go.sum b/clientapi/go.sum new file mode 100644 index 00000000..f509429c --- /dev/null +++ b/clientapi/go.sum @@ -0,0 +1,16 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/clientapi/helpers/json_helpers.go b/clientapi/helpers/json_helpers.go new file mode 100644 index 00000000..5aa397ad --- /dev/null +++ b/clientapi/helpers/json_helpers.go @@ -0,0 +1,210 @@ +/* +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 helpers // github.com/openshift-online/ocm-api-model/clientapi/helpers + +import ( + "fmt" + "io" + "net/url" + "strconv" + "time" + + jsoniter "github.com/json-iterator/go" +) + +// NewIterator creates a new JSON iterator that will read to the given source, which +// can be a slice of bytes, a string, a reader or an existing iterator. +func NewIterator(source interface{}) (iterator *jsoniter.Iterator, err error) { + config := jsoniter.Config{} + api := config.Froze() + switch typed := source.(type) { + case []byte: + iterator = jsoniter.ParseBytes(api, typed) + case string: + iterator = jsoniter.ParseString(api, typed) + case io.Reader: + iterator = jsoniter.Parse(api, typed, 4096) + case *jsoniter.Iterator: + iterator = typed + default: + err = fmt.Errorf( + "expected slice of bytes, string, reader or iterator but got '%T'", + source, + ) + } + return +} + +// NewStream creates a new JSON stream that will write to the given writer. +func NewStream(writer io.Writer) *jsoniter.Stream { + config := jsoniter.Config{ + IndentionStep: 2, + } + api := config.Froze() + return jsoniter.NewStream(api, writer, 0) +} + +// NewBoolean allocates a new bool in the heap and returns a pointer to it. +func NewBoolean(value bool) *bool { + return &value +} + +// NewInteger allocates a new integer in the heap and returns a pointer to it. +func NewInteger(value int) *int { + return &value +} + +// NewFloat allocates a new floating point value in the heap and returns an pointer +// to it. +func NewFloat(value float64) *float64 { + return &value +} + +// NewString allocates a new string in the heap and returns a pointer to it. +func NewString(value string) *string { + return &value +} + +// NewDate allocates a new date in the heap and returns a pointer to it. +func NewDate(value time.Time) *time.Time { + return &value +} + +// ParseInteger reads a string and parses it to integer, +// if an error occurred it returns a non-nil error. +func ParseInteger(query url.Values, parameterName string) (*int, error) { + values := query[parameterName] + count := len(values) + if count == 0 { + return nil, nil + } + if count > 1 { + err := fmt.Errorf( + "expected at most one value for parameter '%s' but got %d", + parameterName, count, + ) + return nil, err + } + value := values[0] + parsedInt64, err := strconv.ParseInt(value, 10, 64) + if err != nil { + return nil, fmt.Errorf( + "value '%s' isn't valid for the '%s' parameter because it isn't an integer: %v", + value, parameterName, err, + ) + } + parsedInt := int(parsedInt64) + return &parsedInt, nil +} + +// ParseFloat reads a string and parses it to float, +// if an error occurred it returns a non-nil error. +func ParseFloat(query url.Values, parameterName string) (*float64, error) { + values := query[parameterName] + count := len(values) + if count == 0 { + return nil, nil + } + if count > 1 { + err := fmt.Errorf( + "expected at most one value for parameter '%s' but got %d", + parameterName, count, + ) + return nil, err + } + value := values[0] + parsedFloat, err := strconv.ParseFloat(value, 64) + if err != nil { + return nil, fmt.Errorf( + "value '%s' isn't valid for the '%s' parameter because it isn't a float: %v", + value, parameterName, err, + ) + } + return &parsedFloat, nil +} + +// ParseString returns a pointer to the string and nil error. +func ParseString(query url.Values, parameterName string) (*string, error) { + values := query[parameterName] + count := len(values) + if count == 0 { + return nil, nil + } + if count > 1 { + err := fmt.Errorf( + "expected at most one value for parameter '%s' but got %d", + parameterName, count, + ) + return nil, err + } + return &values[0], nil +} + +// ParseBoolean reads a string and parses it to boolean, +// if an error occurred it returns a non-nil error. +func ParseBoolean(query url.Values, parameterName string) (*bool, error) { + values := query[parameterName] + count := len(values) + if count == 0 { + return nil, nil + } + if count > 1 { + err := fmt.Errorf( + "expected at most one value for parameter '%s' but got %d", + parameterName, count, + ) + return nil, err + } + value := values[0] + parsedBool, err := strconv.ParseBool(value) + if err != nil { + return nil, fmt.Errorf( + "value '%s' isn't valid for the '%s' parameter because it isn't a boolean: %v", + value, parameterName, err, + ) + } + return &parsedBool, nil +} + +// ParseDate reads a string and parses it to a time.Time, +// if an error occurred it returns a non-nil error. +func ParseDate(query url.Values, parameterName string) (*time.Time, error) { + values := query[parameterName] + count := len(values) + if count == 0 { + return nil, nil + } + if count > 1 { + err := fmt.Errorf( + "expected at most one value for parameter '%s' but got %d", + parameterName, count, + ) + return nil, err + } + value := values[0] + parsedTime, err := time.Parse(time.RFC3339, value) + if err != nil { + return nil, fmt.Errorf( + "value '%s' isn't valid for the '%s' parameter because it isn't a date: %v", + value, parameterName, err, + ) + } + return &parsedTime, nil +} diff --git a/clientapi/jobqueue/v1/boolean_list_type_json.go b/clientapi/jobqueue/v1/boolean_list_type_json.go new file mode 100644 index 00000000..76b12224 --- /dev/null +++ b/clientapi/jobqueue/v1/boolean_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBooleanList writes a list of values of the 'boolean' type to +// the given writer. +func MarshalBooleanList(list []bool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBooleanList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBooleanList writes a list of value of the 'boolean' type to +// the given stream. +func WriteBooleanList(list []bool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteBool(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalBooleanList reads a list of values of the 'boolean' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBooleanList(source interface{}) (items []bool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBooleanList(iterator) + err = iterator.Error + return +} + +// ReadBooleanList reads list of values of the ”boolean' type from +// the given iterator. +func ReadBooleanList(iterator *jsoniter.Iterator) []bool { + list := []bool{} + for iterator.ReadArray() { + item := iterator.ReadBool() + list = append(list, item) + } + return list +} diff --git a/clientapi/jobqueue/v1/date_list_type_json.go b/clientapi/jobqueue/v1/date_list_type_json.go new file mode 100644 index 00000000..19e9aa26 --- /dev/null +++ b/clientapi/jobqueue/v1/date_list_type_json.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDateList writes a list of values of the 'date' type to +// the given writer. +func MarshalDateList(list []time.Time, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDateList writes a list of value of the 'date' type to +// the given stream. +func WriteDateList(list []time.Time, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString((value).Format(time.RFC3339)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDateList reads a list of values of the 'date' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDateList(source interface{}) (items []time.Time, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDateList(iterator) + err = iterator.Error + return +} + +// ReadDateList reads list of values of the ”date' type from +// the given iterator. +func ReadDateList(iterator *jsoniter.Iterator) []time.Time { + list := []time.Time{} + for iterator.ReadArray() { + text := iterator.ReadString() + item, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + list = append(list, item) + } + return list +} diff --git a/clientapi/jobqueue/v1/float_list_type_json.go b/clientapi/jobqueue/v1/float_list_type_json.go new file mode 100644 index 00000000..db5f895d --- /dev/null +++ b/clientapi/jobqueue/v1/float_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFloatList writes a list of values of the 'float' type to +// the given writer. +func MarshalFloatList(list []float64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFloatList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFloatList writes a list of value of the 'float' type to +// the given stream. +func WriteFloatList(list []float64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteFloat64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalFloatList reads a list of values of the 'float' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFloatList(source interface{}) (items []float64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFloatList(iterator) + err = iterator.Error + return +} + +// ReadFloatList reads list of values of the ”float' type from +// the given iterator. +func ReadFloatList(iterator *jsoniter.Iterator) []float64 { + list := []float64{} + for iterator.ReadArray() { + item := iterator.ReadFloat64() + list = append(list, item) + } + return list +} diff --git a/clientapi/jobqueue/v1/integer_list_type_json.go b/clientapi/jobqueue/v1/integer_list_type_json.go new file mode 100644 index 00000000..7cb38831 --- /dev/null +++ b/clientapi/jobqueue/v1/integer_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIntegerList writes a list of values of the 'integer' type to +// the given writer. +func MarshalIntegerList(list []int, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIntegerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIntegerList writes a list of value of the 'integer' type to +// the given stream. +func WriteIntegerList(list []int, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalIntegerList reads a list of values of the 'integer' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIntegerList(source interface{}) (items []int, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIntegerList(iterator) + err = iterator.Error + return +} + +// ReadIntegerList reads list of values of the ”integer' type from +// the given iterator. +func ReadIntegerList(iterator *jsoniter.Iterator) []int { + list := []int{} + for iterator.ReadArray() { + item := iterator.ReadInt() + list = append(list, item) + } + return list +} diff --git a/clientapi/jobqueue/v1/interface_list_type_json.go b/clientapi/jobqueue/v1/interface_list_type_json.go new file mode 100644 index 00000000..e2be2cfd --- /dev/null +++ b/clientapi/jobqueue/v1/interface_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInterfaceList writes a list of values of the 'interface' type to +// the given writer. +func MarshalInterfaceList(list []interface{}, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInterfaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInterfaceList writes a list of value of the 'interface' type to +// the given stream. +func WriteInterfaceList(list []interface{}, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteVal(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalInterfaceList reads a list of values of the 'interface' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInterfaceList(source interface{}) (items []interface{}, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInterfaceList(iterator) + err = iterator.Error + return +} + +// ReadInterfaceList reads list of values of the ”interface' type from +// the given iterator. +func ReadInterfaceList(iterator *jsoniter.Iterator) []interface{} { + list := []interface{}{} + for iterator.ReadArray() { + var item interface{} + iterator.ReadVal(&item) + list = append(list, item) + } + return list +} diff --git a/clientapi/jobqueue/v1/job_builder.go b/clientapi/jobqueue/v1/job_builder.go new file mode 100644 index 00000000..00c60a25 --- /dev/null +++ b/clientapi/jobqueue/v1/job_builder.go @@ -0,0 +1,143 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + time "time" +) + +// JobBuilder contains the data and logic needed to build 'job' objects. +// +// This struct is a job in a Job Queue. +type JobBuilder struct { + bitmap_ uint32 + id string + href string + abandonedAt time.Time + arguments string + attempts int + createdAt time.Time + receiptId string + updatedAt time.Time +} + +// NewJob creates a new builder of 'job' objects. +func NewJob() *JobBuilder { + return &JobBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *JobBuilder) Link(value bool) *JobBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *JobBuilder) ID(value string) *JobBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *JobBuilder) HREF(value string) *JobBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *JobBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// AbandonedAt sets the value of the 'abandoned_at' attribute to the given value. +func (b *JobBuilder) AbandonedAt(value time.Time) *JobBuilder { + b.abandonedAt = value + b.bitmap_ |= 8 + return b +} + +// Arguments sets the value of the 'arguments' attribute to the given value. +func (b *JobBuilder) Arguments(value string) *JobBuilder { + b.arguments = value + b.bitmap_ |= 16 + return b +} + +// Attempts sets the value of the 'attempts' attribute to the given value. +func (b *JobBuilder) Attempts(value int) *JobBuilder { + b.attempts = value + b.bitmap_ |= 32 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *JobBuilder) CreatedAt(value time.Time) *JobBuilder { + b.createdAt = value + b.bitmap_ |= 64 + return b +} + +// ReceiptId sets the value of the 'receipt_id' attribute to the given value. +func (b *JobBuilder) ReceiptId(value string) *JobBuilder { + b.receiptId = value + b.bitmap_ |= 128 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *JobBuilder) UpdatedAt(value time.Time) *JobBuilder { + b.updatedAt = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *JobBuilder) Copy(object *Job) *JobBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.abandonedAt = object.abandonedAt + b.arguments = object.arguments + b.attempts = object.attempts + b.createdAt = object.createdAt + b.receiptId = object.receiptId + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'job' object using the configuration stored in the builder. +func (b *JobBuilder) Build() (object *Job, err error) { + object = new(Job) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.abandonedAt = b.abandonedAt + object.arguments = b.arguments + object.attempts = b.attempts + object.createdAt = b.createdAt + object.receiptId = b.receiptId + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/jobqueue/v1/job_list_builder.go b/clientapi/jobqueue/v1/job_list_builder.go new file mode 100644 index 00000000..730ff24a --- /dev/null +++ b/clientapi/jobqueue/v1/job_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +// JobListBuilder contains the data and logic needed to build +// 'job' objects. +type JobListBuilder struct { + items []*JobBuilder +} + +// NewJobList creates a new builder of 'job' objects. +func NewJobList() *JobListBuilder { + return new(JobListBuilder) +} + +// Items sets the items of the list. +func (b *JobListBuilder) Items(values ...*JobBuilder) *JobListBuilder { + b.items = make([]*JobBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *JobListBuilder) 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 *JobListBuilder) Copy(list *JobList) *JobListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*JobBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewJob().Copy(v) + } + } + return b +} + +// Build creates a list of 'job' objects using the +// configuration stored in the builder. +func (b *JobListBuilder) Build() (list *JobList, err error) { + items := make([]*Job, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(JobList) + list.items = items + return +} diff --git a/clientapi/jobqueue/v1/job_list_type_json.go b/clientapi/jobqueue/v1/job_list_type_json.go new file mode 100644 index 00000000..7c3d7b3d --- /dev/null +++ b/clientapi/jobqueue/v1/job_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalJobList writes a list of values of the 'job' type to +// the given writer. +func MarshalJobList(list []*Job, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteJobList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteJobList writes a list of value of the 'job' type to +// the given stream. +func WriteJobList(list []*Job, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteJob(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalJobList reads a list of values of the 'job' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalJobList(source interface{}) (items []*Job, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadJobList(iterator) + err = iterator.Error + return +} + +// ReadJobList reads list of values of the ”job' type from +// the given iterator. +func ReadJobList(iterator *jsoniter.Iterator) []*Job { + list := []*Job{} + for iterator.ReadArray() { + item := ReadJob(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/jobqueue/v1/job_type.go b/clientapi/jobqueue/v1/job_type.go new file mode 100644 index 00000000..3a611f3a --- /dev/null +++ b/clientapi/jobqueue/v1/job_type.go @@ -0,0 +1,381 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + time "time" +) + +// JobKind is the name of the type used to represent objects +// of type 'job'. +const JobKind = "Job" + +// JobLinkKind is the name of the type used to represent links +// to objects of type 'job'. +const JobLinkKind = "JobLink" + +// JobNilKind is the name of the type used to nil references +// to objects of type 'job'. +const JobNilKind = "JobNil" + +// Job represents the values of the 'job' type. +// +// This struct is a job in a Job Queue. +type Job struct { + bitmap_ uint32 + id string + href string + abandonedAt time.Time + arguments string + attempts int + createdAt time.Time + receiptId string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *Job) Kind() string { + if o == nil { + return JobNilKind + } + if o.bitmap_&1 != 0 { + return JobLinkKind + } + return JobKind +} + +// Link returns true if this is a link. +func (o *Job) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Job) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Job) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Job) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Job) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Job) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// AbandonedAt returns the value of the 'abandoned_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DLQ sent timestamp +func (o *Job) AbandonedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.abandonedAt + } + return time.Time{} +} + +// GetAbandonedAt returns the value of the 'abandoned_at' attribute and +// a flag indicating if the attribute has a value. +// +// DLQ sent timestamp +func (o *Job) GetAbandonedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.abandonedAt + } + return +} + +// Arguments returns the value of the 'arguments' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Arguments to run Job with. +func (o *Job) Arguments() string { + if o != nil && o.bitmap_&16 != 0 { + return o.arguments + } + return "" +} + +// GetArguments returns the value of the 'arguments' attribute and +// a flag indicating if the attribute has a value. +// +// Arguments to run Job with. +func (o *Job) GetArguments() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.arguments + } + return +} + +// Attempts returns the value of the 'attempts' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Number of retries. +func (o *Job) Attempts() int { + if o != nil && o.bitmap_&32 != 0 { + return o.attempts + } + return 0 +} + +// GetAttempts returns the value of the 'attempts' attribute and +// a flag indicating if the attribute has a value. +// +// Number of retries. +func (o *Job) GetAttempts() (value int, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.attempts + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Job) CreatedAt() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Job) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.createdAt + } + return +} + +// ReceiptId returns the value of the 'receipt_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Each time a specific job is pop'd, the receiptId will change, while the ID stays the same. +func (o *Job) ReceiptId() string { + if o != nil && o.bitmap_&128 != 0 { + return o.receiptId + } + return "" +} + +// GetReceiptId returns the value of the 'receipt_id' attribute and +// a flag indicating if the attribute has a value. +// +// Each time a specific job is pop'd, the receiptId will change, while the ID stays the same. +func (o *Job) GetReceiptId() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.receiptId + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Job) UpdatedAt() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Job) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.updatedAt + } + return +} + +// JobListKind is the name of the type used to represent list of objects of +// type 'job'. +const JobListKind = "JobList" + +// JobListLinkKind is the name of the type used to represent links to list +// of objects of type 'job'. +const JobListLinkKind = "JobListLink" + +// JobNilKind is the name of the type used to nil lists of objects of +// type 'job'. +const JobListNilKind = "JobListNil" + +// JobList is a list of values of the 'job' type. +type JobList struct { + href string + link bool + items []*Job +} + +// Kind returns the name of the type of the object. +func (l *JobList) Kind() string { + if l == nil { + return JobListNilKind + } + if l.link { + return JobListLinkKind + } + return JobListKind +} + +// Link returns true iif this is a link. +func (l *JobList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *JobList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *JobList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *JobList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *JobList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *JobList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *JobList) SetItems(items []*Job) { + l.items = items +} + +// Items returns the items of the list. +func (l *JobList) Items() []*Job { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *JobList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *JobList) Get(i int) *Job { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *JobList) Slice() []*Job { + var slice []*Job + if l == nil { + slice = make([]*Job, 0) + } else { + slice = make([]*Job, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *JobList) Each(f func(item *Job) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *JobList) Range(f func(index int, item *Job) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/jobqueue/v1/job_type_json.go b/clientapi/jobqueue/v1/job_type_json.go new file mode 100644 index 00000000..c6307388 --- /dev/null +++ b/clientapi/jobqueue/v1/job_type_json.go @@ -0,0 +1,198 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalJob writes a value of the 'job' type to the given writer. +func MarshalJob(object *Job, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteJob(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteJob writes a value of the 'job' type to the given stream. +func WriteJob(object *Job, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(JobLinkKind) + } else { + stream.WriteString(JobKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("abandoned_at") + stream.WriteString((object.abandonedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("arguments") + stream.WriteString(object.arguments) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("attempts") + stream.WriteInt(object.attempts) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("receipt_id") + stream.WriteString(object.receiptId) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalJob reads a value of the 'job' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalJob(source interface{}) (object *Job, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadJob(iterator) + err = iterator.Error + return +} + +// ReadJob reads a value of the 'job' type from the given iterator. +func ReadJob(iterator *jsoniter.Iterator) *Job { + object := &Job{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == JobLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "abandoned_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.abandonedAt = value + object.bitmap_ |= 8 + case "arguments": + value := iterator.ReadString() + object.arguments = value + object.bitmap_ |= 16 + case "attempts": + value := iterator.ReadInt() + object.attempts = value + object.bitmap_ |= 32 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 64 + case "receipt_id": + value := iterator.ReadString() + object.receiptId = value + object.bitmap_ |= 128 + 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_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/jobqueue/v1/long_list_type_json.go b/clientapi/jobqueue/v1/long_list_type_json.go new file mode 100644 index 00000000..4e1925e5 --- /dev/null +++ b/clientapi/jobqueue/v1/long_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLongList writes a list of values of the 'long' type to +// the given writer. +func MarshalLongList(list []int64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLongList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLongList writes a list of value of the 'long' type to +// the given stream. +func WriteLongList(list []int64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalLongList reads a list of values of the 'long' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLongList(source interface{}) (items []int64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLongList(iterator) + err = iterator.Error + return +} + +// ReadLongList reads list of values of the ”long' type from +// the given iterator. +func ReadLongList(iterator *jsoniter.Iterator) []int64 { + list := []int64{} + for iterator.ReadArray() { + item := iterator.ReadInt64() + list = append(list, item) + } + return list +} diff --git a/clientapi/jobqueue/v1/metadata_reader.go b/clientapi/jobqueue/v1/metadata_reader.go new file mode 100644 index 00000000..d16f3045 --- /dev/null +++ b/clientapi/jobqueue/v1/metadata_reader.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMetadata writes a value of the metadata type to the given target, which +// can be a writer or a JSON encoder. +func MarshalMetadata(object *Metadata, writer io.Writer) error { + stream := helpers.NewStream(writer) + writeMetadata(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} +func writeMetadata(object *Metadata, stream *jsoniter.Stream) { + stream.WriteObjectStart() + if object.bitmap_&1 != 0 { + stream.WriteObjectField("server_version") + stream.WriteString(object.serverVersion) + } + stream.WriteObjectEnd() +} + +// UnmarshalMetadata reads a value of the metadata type from the given source, which +// which can be a reader, a slice of byte or a string. +func UnmarshalMetadata(source interface{}) (object *Metadata, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = readMetadata(iterator) + err = iterator.Error + return +} +func readMetadata(iterator *jsoniter.Iterator) *Metadata { + object := &Metadata{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "server_version": + object.serverVersion = iterator.ReadString() + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/jobqueue/v1/metadata_type.go b/clientapi/jobqueue/v1/metadata_type.go new file mode 100644 index 00000000..48135cd0 --- /dev/null +++ b/clientapi/jobqueue/v1/metadata_type.go @@ -0,0 +1,44 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +// Metadata contains the version metadata. +type Metadata struct { + bitmap_ uint32 + serverVersion string +} + +// ServerVersion returns the version of the server. +func (m *Metadata) ServerVersion() string { + if m != nil && m.bitmap_&1 != 0 { + return m.serverVersion + } + return "" +} + +// GetServerVersion returns the value of the server version and a flag indicating if +// the attribute has a value. +func (m *Metadata) GetServerVersion() (value string, ok bool) { + ok = m != nil && m.bitmap_&1 != 0 + if ok { + value = m.serverVersion + } + return +} diff --git a/clientapi/jobqueue/v1/queue_builder.go b/clientapi/jobqueue/v1/queue_builder.go new file mode 100644 index 00000000..1e25b858 --- /dev/null +++ b/clientapi/jobqueue/v1/queue_builder.go @@ -0,0 +1,131 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + time "time" +) + +// QueueBuilder contains the data and logic needed to build 'queue' objects. +type QueueBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + maxAttempts int + maxRunTime int + name string + updatedAt time.Time +} + +// NewQueue creates a new builder of 'queue' objects. +func NewQueue() *QueueBuilder { + return &QueueBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *QueueBuilder) Link(value bool) *QueueBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *QueueBuilder) ID(value string) *QueueBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *QueueBuilder) HREF(value string) *QueueBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *QueueBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *QueueBuilder) CreatedAt(value time.Time) *QueueBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// MaxAttempts sets the value of the 'max_attempts' attribute to the given value. +func (b *QueueBuilder) MaxAttempts(value int) *QueueBuilder { + b.maxAttempts = value + b.bitmap_ |= 16 + return b +} + +// MaxRunTime sets the value of the 'max_run_time' attribute to the given value. +func (b *QueueBuilder) MaxRunTime(value int) *QueueBuilder { + b.maxRunTime = value + b.bitmap_ |= 32 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *QueueBuilder) Name(value string) *QueueBuilder { + b.name = value + b.bitmap_ |= 64 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *QueueBuilder) UpdatedAt(value time.Time) *QueueBuilder { + b.updatedAt = value + b.bitmap_ |= 128 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *QueueBuilder) Copy(object *Queue) *QueueBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.maxAttempts = object.maxAttempts + b.maxRunTime = object.maxRunTime + b.name = object.name + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'queue' object using the configuration stored in the builder. +func (b *QueueBuilder) Build() (object *Queue, err error) { + object = new(Queue) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.maxAttempts = b.maxAttempts + object.maxRunTime = b.maxRunTime + object.name = b.name + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/jobqueue/v1/queue_list_builder.go b/clientapi/jobqueue/v1/queue_list_builder.go new file mode 100644 index 00000000..a5b9f7d0 --- /dev/null +++ b/clientapi/jobqueue/v1/queue_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +// QueueListBuilder contains the data and logic needed to build +// 'queue' objects. +type QueueListBuilder struct { + items []*QueueBuilder +} + +// NewQueueList creates a new builder of 'queue' objects. +func NewQueueList() *QueueListBuilder { + return new(QueueListBuilder) +} + +// Items sets the items of the list. +func (b *QueueListBuilder) Items(values ...*QueueBuilder) *QueueListBuilder { + b.items = make([]*QueueBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *QueueListBuilder) 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 *QueueListBuilder) Copy(list *QueueList) *QueueListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*QueueBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewQueue().Copy(v) + } + } + return b +} + +// Build creates a list of 'queue' objects using the +// configuration stored in the builder. +func (b *QueueListBuilder) Build() (list *QueueList, err error) { + items := make([]*Queue, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(QueueList) + list.items = items + return +} diff --git a/clientapi/jobqueue/v1/queue_list_type_json.go b/clientapi/jobqueue/v1/queue_list_type_json.go new file mode 100644 index 00000000..0246ecea --- /dev/null +++ b/clientapi/jobqueue/v1/queue_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalQueueList writes a list of values of the 'queue' type to +// the given writer. +func MarshalQueueList(list []*Queue, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteQueueList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteQueueList writes a list of value of the 'queue' type to +// the given stream. +func WriteQueueList(list []*Queue, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteQueue(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalQueueList reads a list of values of the 'queue' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalQueueList(source interface{}) (items []*Queue, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadQueueList(iterator) + err = iterator.Error + return +} + +// ReadQueueList reads list of values of the ”queue' type from +// the given iterator. +func ReadQueueList(iterator *jsoniter.Iterator) []*Queue { + list := []*Queue{} + for iterator.ReadArray() { + item := ReadQueue(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/jobqueue/v1/queue_type.go b/clientapi/jobqueue/v1/queue_type.go new file mode 100644 index 00000000..50322250 --- /dev/null +++ b/clientapi/jobqueue/v1/queue_type.go @@ -0,0 +1,347 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + time "time" +) + +// QueueKind is the name of the type used to represent objects +// of type 'queue'. +const QueueKind = "Queue" + +// QueueLinkKind is the name of the type used to represent links +// to objects of type 'queue'. +const QueueLinkKind = "QueueLink" + +// QueueNilKind is the name of the type used to nil references +// to objects of type 'queue'. +const QueueNilKind = "QueueNil" + +// Queue represents the values of the 'queue' type. +type Queue struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + maxAttempts int + maxRunTime int + name string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *Queue) Kind() string { + if o == nil { + return QueueNilKind + } + if o.bitmap_&1 != 0 { + return QueueLinkKind + } + return QueueKind +} + +// Link returns true if this is a link. +func (o *Queue) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Queue) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Queue) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Queue) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Queue) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Queue) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Queue) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Queue) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// MaxAttempts returns the value of the 'max_attempts' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// SQS Visibility Timeout +func (o *Queue) MaxAttempts() int { + if o != nil && o.bitmap_&16 != 0 { + return o.maxAttempts + } + return 0 +} + +// GetMaxAttempts returns the value of the 'max_attempts' attribute and +// a flag indicating if the attribute has a value. +// +// SQS Visibility Timeout +func (o *Queue) GetMaxAttempts() (value int, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.maxAttempts + } + return +} + +// MaxRunTime returns the value of the 'max_run_time' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Queue) MaxRunTime() int { + if o != nil && o.bitmap_&32 != 0 { + return o.maxRunTime + } + return 0 +} + +// GetMaxRunTime returns the value of the 'max_run_time' attribute and +// a flag indicating if the attribute has a value. +func (o *Queue) GetMaxRunTime() (value int, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.maxRunTime + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Queue) Name() string { + if o != nil && o.bitmap_&64 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *Queue) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.name + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Queue) UpdatedAt() time.Time { + if o != nil && o.bitmap_&128 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Queue) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.updatedAt + } + return +} + +// QueueListKind is the name of the type used to represent list of objects of +// type 'queue'. +const QueueListKind = "QueueList" + +// QueueListLinkKind is the name of the type used to represent links to list +// of objects of type 'queue'. +const QueueListLinkKind = "QueueListLink" + +// QueueNilKind is the name of the type used to nil lists of objects of +// type 'queue'. +const QueueListNilKind = "QueueListNil" + +// QueueList is a list of values of the 'queue' type. +type QueueList struct { + href string + link bool + items []*Queue +} + +// Kind returns the name of the type of the object. +func (l *QueueList) Kind() string { + if l == nil { + return QueueListNilKind + } + if l.link { + return QueueListLinkKind + } + return QueueListKind +} + +// Link returns true iif this is a link. +func (l *QueueList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *QueueList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *QueueList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *QueueList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *QueueList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *QueueList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *QueueList) SetItems(items []*Queue) { + l.items = items +} + +// Items returns the items of the list. +func (l *QueueList) Items() []*Queue { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *QueueList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *QueueList) Get(i int) *Queue { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *QueueList) Slice() []*Queue { + var slice []*Queue + if l == nil { + slice = make([]*Queue, 0) + } else { + slice = make([]*Queue, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *QueueList) Each(f func(item *Queue) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *QueueList) Range(f func(index int, item *Queue) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/jobqueue/v1/queue_type_json.go b/clientapi/jobqueue/v1/queue_type_json.go new file mode 100644 index 00000000..5a56d910 --- /dev/null +++ b/clientapi/jobqueue/v1/queue_type_json.go @@ -0,0 +1,181 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalQueue writes a value of the 'queue' type to the given writer. +func MarshalQueue(object *Queue, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteQueue(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteQueue writes a value of the 'queue' type to the given stream. +func WriteQueue(object *Queue, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(QueueLinkKind) + } else { + stream.WriteString(QueueKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_attempts") + stream.WriteInt(object.maxAttempts) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("max_run_time") + stream.WriteInt(object.maxRunTime) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalQueue reads a value of the 'queue' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalQueue(source interface{}) (object *Queue, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadQueue(iterator) + err = iterator.Error + return +} + +// ReadQueue reads a value of the 'queue' type from the given iterator. +func ReadQueue(iterator *jsoniter.Iterator) *Queue { + object := &Queue{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == QueueLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "max_attempts": + value := iterator.ReadInt() + object.maxAttempts = value + object.bitmap_ |= 16 + case "max_run_time": + value := iterator.ReadInt() + object.maxRunTime = value + object.bitmap_ |= 32 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 64 + 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_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/jobqueue/v1/string_list_type_json.go b/clientapi/jobqueue/v1/string_list_type_json.go new file mode 100644 index 00000000..a5237532 --- /dev/null +++ b/clientapi/jobqueue/v1/string_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/jobqueue/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStringList writes a list of values of the 'string' type to +// the given writer. +func MarshalStringList(list []string, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStringList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStringList writes a list of value of the 'string' type to +// the given stream. +func WriteStringList(list []string, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalStringList reads a list of values of the 'string' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStringList(source interface{}) (items []string, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStringList(iterator) + err = iterator.Error + return +} + +// ReadStringList reads list of values of the ”string' type from +// the given iterator. +func ReadStringList(iterator *jsoniter.Iterator) []string { + list := []string{} + for iterator.ReadArray() { + item := iterator.ReadString() + list = append(list, item) + } + return list +} diff --git a/model/access_transparency/v1/access_protection_resource.model b/clientapi/model/access_transparency/v1/access_protection_resource.model similarity index 100% rename from model/access_transparency/v1/access_protection_resource.model rename to clientapi/model/access_transparency/v1/access_protection_resource.model diff --git a/model/access_transparency/v1/access_protection_type.model b/clientapi/model/access_transparency/v1/access_protection_type.model similarity index 100% rename from model/access_transparency/v1/access_protection_type.model rename to clientapi/model/access_transparency/v1/access_protection_type.model diff --git a/model/access_transparency/v1/access_request_post_request_type.model b/clientapi/model/access_transparency/v1/access_request_post_request_type.model similarity index 100% rename from model/access_transparency/v1/access_request_post_request_type.model rename to clientapi/model/access_transparency/v1/access_request_post_request_type.model diff --git a/model/access_transparency/v1/access_request_resource.model b/clientapi/model/access_transparency/v1/access_request_resource.model similarity index 100% rename from model/access_transparency/v1/access_request_resource.model rename to clientapi/model/access_transparency/v1/access_request_resource.model diff --git a/model/access_transparency/v1/access_request_state.model b/clientapi/model/access_transparency/v1/access_request_state.model similarity index 100% rename from model/access_transparency/v1/access_request_state.model rename to clientapi/model/access_transparency/v1/access_request_state.model diff --git a/model/access_transparency/v1/access_request_status_type.model b/clientapi/model/access_transparency/v1/access_request_status_type.model similarity index 100% rename from model/access_transparency/v1/access_request_status_type.model rename to clientapi/model/access_transparency/v1/access_request_status_type.model diff --git a/model/access_transparency/v1/access_request_type.model b/clientapi/model/access_transparency/v1/access_request_type.model similarity index 100% rename from model/access_transparency/v1/access_request_type.model rename to clientapi/model/access_transparency/v1/access_request_type.model diff --git a/model/access_transparency/v1/access_requests_resource.model b/clientapi/model/access_transparency/v1/access_requests_resource.model similarity index 100% rename from model/access_transparency/v1/access_requests_resource.model rename to clientapi/model/access_transparency/v1/access_requests_resource.model diff --git a/model/access_transparency/v1/decision_decision_type.model b/clientapi/model/access_transparency/v1/decision_decision_type.model similarity index 100% rename from model/access_transparency/v1/decision_decision_type.model rename to clientapi/model/access_transparency/v1/decision_decision_type.model diff --git a/model/access_transparency/v1/decision_resource.model b/clientapi/model/access_transparency/v1/decision_resource.model similarity index 100% rename from model/access_transparency/v1/decision_resource.model rename to clientapi/model/access_transparency/v1/decision_resource.model diff --git a/model/access_transparency/v1/decision_type.model b/clientapi/model/access_transparency/v1/decision_type.model similarity index 100% rename from model/access_transparency/v1/decision_type.model rename to clientapi/model/access_transparency/v1/decision_type.model diff --git a/model/access_transparency/v1/decisions_resource.model b/clientapi/model/access_transparency/v1/decisions_resource.model similarity index 100% rename from model/access_transparency/v1/decisions_resource.model rename to clientapi/model/access_transparency/v1/decisions_resource.model diff --git a/clientapi/model/access_transparency/v1/doc.go b/clientapi/model/access_transparency/v1/doc.go new file mode 100644 index 00000000..f1a4b049 --- /dev/null +++ b/clientapi/model/access_transparency/v1/doc.go @@ -0,0 +1,2 @@ +// this file exists so that it is possible to vendor the model into another go module for generating the client. +package v1 diff --git a/model/access_transparency/v1/root_resource.model b/clientapi/model/access_transparency/v1/root_resource.model similarity index 100% rename from model/access_transparency/v1/root_resource.model rename to clientapi/model/access_transparency/v1/root_resource.model diff --git a/model/accounts_mgmt/v1/access_token_auth_type.model b/clientapi/model/accounts_mgmt/v1/access_token_auth_type.model similarity index 100% rename from model/accounts_mgmt/v1/access_token_auth_type.model rename to clientapi/model/accounts_mgmt/v1/access_token_auth_type.model diff --git a/model/accounts_mgmt/v1/access_token_resource.model b/clientapi/model/accounts_mgmt/v1/access_token_resource.model similarity index 100% rename from model/accounts_mgmt/v1/access_token_resource.model rename to clientapi/model/accounts_mgmt/v1/access_token_resource.model diff --git a/model/accounts_mgmt/v1/access_token_type.model b/clientapi/model/accounts_mgmt/v1/access_token_type.model similarity index 100% rename from model/accounts_mgmt/v1/access_token_type.model rename to clientapi/model/accounts_mgmt/v1/access_token_type.model diff --git a/model/accounts_mgmt/v1/account_resource.model b/clientapi/model/accounts_mgmt/v1/account_resource.model similarity index 100% rename from model/accounts_mgmt/v1/account_resource.model rename to clientapi/model/accounts_mgmt/v1/account_resource.model diff --git a/model/accounts_mgmt/v1/account_type.model b/clientapi/model/accounts_mgmt/v1/account_type.model similarity index 100% rename from model/accounts_mgmt/v1/account_type.model rename to clientapi/model/accounts_mgmt/v1/account_type.model diff --git a/model/accounts_mgmt/v1/accounts_resource.model b/clientapi/model/accounts_mgmt/v1/accounts_resource.model similarity index 100% rename from model/accounts_mgmt/v1/accounts_resource.model rename to clientapi/model/accounts_mgmt/v1/accounts_resource.model diff --git a/model/accounts_mgmt/v1/action_type.model b/clientapi/model/accounts_mgmt/v1/action_type.model similarity index 100% rename from model/accounts_mgmt/v1/action_type.model rename to clientapi/model/accounts_mgmt/v1/action_type.model diff --git a/model/accounts_mgmt/v1/billing_model_item_type.model b/clientapi/model/accounts_mgmt/v1/billing_model_item_type.model similarity index 100% rename from model/accounts_mgmt/v1/billing_model_item_type.model rename to clientapi/model/accounts_mgmt/v1/billing_model_item_type.model diff --git a/model/accounts_mgmt/v1/billing_model_resource.model b/clientapi/model/accounts_mgmt/v1/billing_model_resource.model similarity index 100% rename from model/accounts_mgmt/v1/billing_model_resource.model rename to clientapi/model/accounts_mgmt/v1/billing_model_resource.model diff --git a/model/accounts_mgmt/v1/billing_model_type.model b/clientapi/model/accounts_mgmt/v1/billing_model_type.model similarity index 100% rename from model/accounts_mgmt/v1/billing_model_type.model rename to clientapi/model/accounts_mgmt/v1/billing_model_type.model diff --git a/model/accounts_mgmt/v1/billing_models_resource.model b/clientapi/model/accounts_mgmt/v1/billing_models_resource.model similarity index 100% rename from model/accounts_mgmt/v1/billing_models_resource.model rename to clientapi/model/accounts_mgmt/v1/billing_models_resource.model diff --git a/model/accounts_mgmt/v1/capabilities_resource.model b/clientapi/model/accounts_mgmt/v1/capabilities_resource.model similarity index 100% rename from model/accounts_mgmt/v1/capabilities_resource.model rename to clientapi/model/accounts_mgmt/v1/capabilities_resource.model diff --git a/model/accounts_mgmt/v1/capability_type.model b/clientapi/model/accounts_mgmt/v1/capability_type.model similarity index 100% rename from model/accounts_mgmt/v1/capability_type.model rename to clientapi/model/accounts_mgmt/v1/capability_type.model diff --git a/model/accounts_mgmt/v1/cloud_account_type.model b/clientapi/model/accounts_mgmt/v1/cloud_account_type.model similarity index 100% rename from model/accounts_mgmt/v1/cloud_account_type.model rename to clientapi/model/accounts_mgmt/v1/cloud_account_type.model diff --git a/model/accounts_mgmt/v1/cloud_resource.model b/clientapi/model/accounts_mgmt/v1/cloud_resource.model similarity index 100% rename from model/accounts_mgmt/v1/cloud_resource.model rename to clientapi/model/accounts_mgmt/v1/cloud_resource.model diff --git a/model/accounts_mgmt/v1/cloud_resource_type.model b/clientapi/model/accounts_mgmt/v1/cloud_resource_type.model similarity index 100% rename from model/accounts_mgmt/v1/cloud_resource_type.model rename to clientapi/model/accounts_mgmt/v1/cloud_resource_type.model diff --git a/model/accounts_mgmt/v1/cloud_resources.model b/clientapi/model/accounts_mgmt/v1/cloud_resources.model similarity index 100% rename from model/accounts_mgmt/v1/cloud_resources.model rename to clientapi/model/accounts_mgmt/v1/cloud_resources.model diff --git a/model/accounts_mgmt/v1/cluster_authorization_request_type.model b/clientapi/model/accounts_mgmt/v1/cluster_authorization_request_type.model similarity index 100% rename from model/accounts_mgmt/v1/cluster_authorization_request_type.model rename to clientapi/model/accounts_mgmt/v1/cluster_authorization_request_type.model diff --git a/model/accounts_mgmt/v1/cluster_authorization_response_type.model b/clientapi/model/accounts_mgmt/v1/cluster_authorization_response_type.model similarity index 100% rename from model/accounts_mgmt/v1/cluster_authorization_response_type.model rename to clientapi/model/accounts_mgmt/v1/cluster_authorization_response_type.model diff --git a/model/accounts_mgmt/v1/cluster_authorizations_resource.model b/clientapi/model/accounts_mgmt/v1/cluster_authorizations_resource.model similarity index 100% rename from model/accounts_mgmt/v1/cluster_authorizations_resource.model rename to clientapi/model/accounts_mgmt/v1/cluster_authorizations_resource.model diff --git a/model/accounts_mgmt/v1/cluster_metrics_nodes_type.model b/clientapi/model/accounts_mgmt/v1/cluster_metrics_nodes_type.model similarity index 100% rename from model/accounts_mgmt/v1/cluster_metrics_nodes_type.model rename to clientapi/model/accounts_mgmt/v1/cluster_metrics_nodes_type.model diff --git a/model/accounts_mgmt/v1/cluster_registration_request_type.model b/clientapi/model/accounts_mgmt/v1/cluster_registration_request_type.model similarity index 100% rename from model/accounts_mgmt/v1/cluster_registration_request_type.model rename to clientapi/model/accounts_mgmt/v1/cluster_registration_request_type.model diff --git a/model/accounts_mgmt/v1/cluster_registration_response_type.model b/clientapi/model/accounts_mgmt/v1/cluster_registration_response_type.model similarity index 100% rename from model/accounts_mgmt/v1/cluster_registration_response_type.model rename to clientapi/model/accounts_mgmt/v1/cluster_registration_response_type.model diff --git a/model/accounts_mgmt/v1/cluster_registrations_resource.model b/clientapi/model/accounts_mgmt/v1/cluster_registrations_resource.model similarity index 100% rename from model/accounts_mgmt/v1/cluster_registrations_resource.model rename to clientapi/model/accounts_mgmt/v1/cluster_registrations_resource.model diff --git a/model/accounts_mgmt/v1/cluster_resource_type.model b/clientapi/model/accounts_mgmt/v1/cluster_resource_type.model similarity index 100% rename from model/accounts_mgmt/v1/cluster_resource_type.model rename to clientapi/model/accounts_mgmt/v1/cluster_resource_type.model diff --git a/model/accounts_mgmt/v1/cluster_upgrade_type.model b/clientapi/model/accounts_mgmt/v1/cluster_upgrade_type.model similarity index 100% rename from model/accounts_mgmt/v1/cluster_upgrade_type.model rename to clientapi/model/accounts_mgmt/v1/cluster_upgrade_type.model diff --git a/model/accounts_mgmt/v1/contract_dimension_type.model b/clientapi/model/accounts_mgmt/v1/contract_dimension_type.model similarity index 100% rename from model/accounts_mgmt/v1/contract_dimension_type.model rename to clientapi/model/accounts_mgmt/v1/contract_dimension_type.model diff --git a/model/accounts_mgmt/v1/contract_type.model b/clientapi/model/accounts_mgmt/v1/contract_type.model similarity index 100% rename from model/accounts_mgmt/v1/contract_type.model rename to clientapi/model/accounts_mgmt/v1/contract_type.model diff --git a/model/accounts_mgmt/v1/current_access_resource.model b/clientapi/model/accounts_mgmt/v1/current_access_resource.model similarity index 100% rename from model/accounts_mgmt/v1/current_access_resource.model rename to clientapi/model/accounts_mgmt/v1/current_access_resource.model diff --git a/model/accounts_mgmt/v1/current_account_resource.model b/clientapi/model/accounts_mgmt/v1/current_account_resource.model similarity index 100% rename from model/accounts_mgmt/v1/current_account_resource.model rename to clientapi/model/accounts_mgmt/v1/current_account_resource.model diff --git a/model/accounts_mgmt/v1/default_capabilities_resource.model b/clientapi/model/accounts_mgmt/v1/default_capabilities_resource.model similarity index 100% rename from model/accounts_mgmt/v1/default_capabilities_resource.model rename to clientapi/model/accounts_mgmt/v1/default_capabilities_resource.model diff --git a/model/accounts_mgmt/v1/default_capability_resource.model b/clientapi/model/accounts_mgmt/v1/default_capability_resource.model similarity index 100% rename from model/accounts_mgmt/v1/default_capability_resource.model rename to clientapi/model/accounts_mgmt/v1/default_capability_resource.model diff --git a/model/accounts_mgmt/v1/default_capability_type.model b/clientapi/model/accounts_mgmt/v1/default_capability_type.model similarity index 100% rename from model/accounts_mgmt/v1/default_capability_type.model rename to clientapi/model/accounts_mgmt/v1/default_capability_type.model diff --git a/model/accounts_mgmt/v1/deleted_subscription_type.model b/clientapi/model/accounts_mgmt/v1/deleted_subscription_type.model similarity index 100% rename from model/accounts_mgmt/v1/deleted_subscription_type.model rename to clientapi/model/accounts_mgmt/v1/deleted_subscription_type.model diff --git a/model/accounts_mgmt/v1/deleted_subscriptions_resource.model b/clientapi/model/accounts_mgmt/v1/deleted_subscriptions_resource.model similarity index 100% rename from model/accounts_mgmt/v1/deleted_subscriptions_resource.model rename to clientapi/model/accounts_mgmt/v1/deleted_subscriptions_resource.model diff --git a/clientapi/model/accounts_mgmt/v1/doc.go b/clientapi/model/accounts_mgmt/v1/doc.go new file mode 100644 index 00000000..f1a4b049 --- /dev/null +++ b/clientapi/model/accounts_mgmt/v1/doc.go @@ -0,0 +1,2 @@ +// this file exists so that it is possible to vendor the model into another go module for generating the client. +package v1 diff --git a/model/accounts_mgmt/v1/feature_toggle_query_request_type.model b/clientapi/model/accounts_mgmt/v1/feature_toggle_query_request_type.model similarity index 100% rename from model/accounts_mgmt/v1/feature_toggle_query_request_type.model rename to clientapi/model/accounts_mgmt/v1/feature_toggle_query_request_type.model diff --git a/model/accounts_mgmt/v1/feature_toggle_query_resource.model b/clientapi/model/accounts_mgmt/v1/feature_toggle_query_resource.model similarity index 100% rename from model/accounts_mgmt/v1/feature_toggle_query_resource.model rename to clientapi/model/accounts_mgmt/v1/feature_toggle_query_resource.model diff --git a/model/accounts_mgmt/v1/feature_toggle_resource.model b/clientapi/model/accounts_mgmt/v1/feature_toggle_resource.model similarity index 100% rename from model/accounts_mgmt/v1/feature_toggle_resource.model rename to clientapi/model/accounts_mgmt/v1/feature_toggle_resource.model diff --git a/model/accounts_mgmt/v1/feature_toggle_type.model b/clientapi/model/accounts_mgmt/v1/feature_toggle_type.model similarity index 100% rename from model/accounts_mgmt/v1/feature_toggle_type.model rename to clientapi/model/accounts_mgmt/v1/feature_toggle_type.model diff --git a/model/accounts_mgmt/v1/features_toggle_resource.model b/clientapi/model/accounts_mgmt/v1/features_toggle_resource.model similarity index 100% rename from model/accounts_mgmt/v1/features_toggle_resource.model rename to clientapi/model/accounts_mgmt/v1/features_toggle_resource.model diff --git a/model/accounts_mgmt/v1/generic_label_resource.model b/clientapi/model/accounts_mgmt/v1/generic_label_resource.model similarity index 100% rename from model/accounts_mgmt/v1/generic_label_resource.model rename to clientapi/model/accounts_mgmt/v1/generic_label_resource.model diff --git a/model/accounts_mgmt/v1/generic_labels_resource.model b/clientapi/model/accounts_mgmt/v1/generic_labels_resource.model similarity index 100% rename from model/accounts_mgmt/v1/generic_labels_resource.model rename to clientapi/model/accounts_mgmt/v1/generic_labels_resource.model diff --git a/model/accounts_mgmt/v1/generic_notify_details_response_type.model b/clientapi/model/accounts_mgmt/v1/generic_notify_details_response_type.model similarity index 100% rename from model/accounts_mgmt/v1/generic_notify_details_response_type.model rename to clientapi/model/accounts_mgmt/v1/generic_notify_details_response_type.model diff --git a/model/accounts_mgmt/v1/label_type.model b/clientapi/model/accounts_mgmt/v1/label_type.model similarity index 100% rename from model/accounts_mgmt/v1/label_type.model rename to clientapi/model/accounts_mgmt/v1/label_type.model diff --git a/model/accounts_mgmt/v1/labels_resource.model b/clientapi/model/accounts_mgmt/v1/labels_resource.model similarity index 100% rename from model/accounts_mgmt/v1/labels_resource.model rename to clientapi/model/accounts_mgmt/v1/labels_resource.model diff --git a/model/accounts_mgmt/v1/notify_details_request_type.model b/clientapi/model/accounts_mgmt/v1/notify_details_request_type.model similarity index 100% rename from model/accounts_mgmt/v1/notify_details_request_type.model rename to clientapi/model/accounts_mgmt/v1/notify_details_request_type.model diff --git a/model/accounts_mgmt/v1/notify_details_resource.model b/clientapi/model/accounts_mgmt/v1/notify_details_resource.model similarity index 100% rename from model/accounts_mgmt/v1/notify_details_resource.model rename to clientapi/model/accounts_mgmt/v1/notify_details_resource.model diff --git a/model/accounts_mgmt/v1/notify_details_response_type.model b/clientapi/model/accounts_mgmt/v1/notify_details_response_type.model similarity index 100% rename from model/accounts_mgmt/v1/notify_details_response_type.model rename to clientapi/model/accounts_mgmt/v1/notify_details_response_type.model diff --git a/model/accounts_mgmt/v1/organization_resource.model b/clientapi/model/accounts_mgmt/v1/organization_resource.model similarity index 100% rename from model/accounts_mgmt/v1/organization_resource.model rename to clientapi/model/accounts_mgmt/v1/organization_resource.model diff --git a/model/accounts_mgmt/v1/organization_type.model b/clientapi/model/accounts_mgmt/v1/organization_type.model similarity index 100% rename from model/accounts_mgmt/v1/organization_type.model rename to clientapi/model/accounts_mgmt/v1/organization_type.model diff --git a/model/accounts_mgmt/v1/organizations_resource.model b/clientapi/model/accounts_mgmt/v1/organizations_resource.model similarity index 100% rename from model/accounts_mgmt/v1/organizations_resource.model rename to clientapi/model/accounts_mgmt/v1/organizations_resource.model diff --git a/model/accounts_mgmt/v1/permission_resource.model b/clientapi/model/accounts_mgmt/v1/permission_resource.model similarity index 100% rename from model/accounts_mgmt/v1/permission_resource.model rename to clientapi/model/accounts_mgmt/v1/permission_resource.model diff --git a/model/accounts_mgmt/v1/permission_type.model b/clientapi/model/accounts_mgmt/v1/permission_type.model similarity index 100% rename from model/accounts_mgmt/v1/permission_type.model rename to clientapi/model/accounts_mgmt/v1/permission_type.model diff --git a/model/accounts_mgmt/v1/permissions_resource.model b/clientapi/model/accounts_mgmt/v1/permissions_resource.model similarity index 100% rename from model/accounts_mgmt/v1/permissions_resource.model rename to clientapi/model/accounts_mgmt/v1/permissions_resource.model diff --git a/model/accounts_mgmt/v1/plan_type.model b/clientapi/model/accounts_mgmt/v1/plan_type.model similarity index 100% rename from model/accounts_mgmt/v1/plan_type.model rename to clientapi/model/accounts_mgmt/v1/plan_type.model diff --git a/model/accounts_mgmt/v1/pull_secret_resource.model b/clientapi/model/accounts_mgmt/v1/pull_secret_resource.model similarity index 100% rename from model/accounts_mgmt/v1/pull_secret_resource.model rename to clientapi/model/accounts_mgmt/v1/pull_secret_resource.model diff --git a/model/accounts_mgmt/v1/pull_secrets_request_type.model b/clientapi/model/accounts_mgmt/v1/pull_secrets_request_type.model similarity index 100% rename from model/accounts_mgmt/v1/pull_secrets_request_type.model rename to clientapi/model/accounts_mgmt/v1/pull_secrets_request_type.model diff --git a/model/accounts_mgmt/v1/pull_secrets_resource.model b/clientapi/model/accounts_mgmt/v1/pull_secrets_resource.model similarity index 100% rename from model/accounts_mgmt/v1/pull_secrets_resource.model rename to clientapi/model/accounts_mgmt/v1/pull_secrets_resource.model diff --git a/model/accounts_mgmt/v1/quota_authorization_request_type.model b/clientapi/model/accounts_mgmt/v1/quota_authorization_request_type.model similarity index 100% rename from model/accounts_mgmt/v1/quota_authorization_request_type.model rename to clientapi/model/accounts_mgmt/v1/quota_authorization_request_type.model diff --git a/model/accounts_mgmt/v1/quota_authorization_response_type.model b/clientapi/model/accounts_mgmt/v1/quota_authorization_response_type.model similarity index 100% rename from model/accounts_mgmt/v1/quota_authorization_response_type.model rename to clientapi/model/accounts_mgmt/v1/quota_authorization_response_type.model diff --git a/model/accounts_mgmt/v1/quota_authorizations_resource.model b/clientapi/model/accounts_mgmt/v1/quota_authorizations_resource.model similarity index 100% rename from model/accounts_mgmt/v1/quota_authorizations_resource.model rename to clientapi/model/accounts_mgmt/v1/quota_authorizations_resource.model diff --git a/model/accounts_mgmt/v1/quota_cost_resource.model b/clientapi/model/accounts_mgmt/v1/quota_cost_resource.model similarity index 100% rename from model/accounts_mgmt/v1/quota_cost_resource.model rename to clientapi/model/accounts_mgmt/v1/quota_cost_resource.model diff --git a/model/accounts_mgmt/v1/quota_cost_type.model b/clientapi/model/accounts_mgmt/v1/quota_cost_type.model similarity index 100% rename from model/accounts_mgmt/v1/quota_cost_type.model rename to clientapi/model/accounts_mgmt/v1/quota_cost_type.model diff --git a/model/accounts_mgmt/v1/quota_rules_resource.model b/clientapi/model/accounts_mgmt/v1/quota_rules_resource.model similarity index 100% rename from model/accounts_mgmt/v1/quota_rules_resource.model rename to clientapi/model/accounts_mgmt/v1/quota_rules_resource.model diff --git a/model/accounts_mgmt/v1/quota_rules_type.model b/clientapi/model/accounts_mgmt/v1/quota_rules_type.model similarity index 100% rename from model/accounts_mgmt/v1/quota_rules_type.model rename to clientapi/model/accounts_mgmt/v1/quota_rules_type.model diff --git a/model/accounts_mgmt/v1/registries_resource.model b/clientapi/model/accounts_mgmt/v1/registries_resource.model similarity index 100% rename from model/accounts_mgmt/v1/registries_resource.model rename to clientapi/model/accounts_mgmt/v1/registries_resource.model diff --git a/model/accounts_mgmt/v1/registry_credential_resource.model b/clientapi/model/accounts_mgmt/v1/registry_credential_resource.model similarity index 100% rename from model/accounts_mgmt/v1/registry_credential_resource.model rename to clientapi/model/accounts_mgmt/v1/registry_credential_resource.model diff --git a/model/accounts_mgmt/v1/registry_credential_type.model b/clientapi/model/accounts_mgmt/v1/registry_credential_type.model similarity index 100% rename from model/accounts_mgmt/v1/registry_credential_type.model rename to clientapi/model/accounts_mgmt/v1/registry_credential_type.model diff --git a/model/accounts_mgmt/v1/registry_credentials_resource.model b/clientapi/model/accounts_mgmt/v1/registry_credentials_resource.model similarity index 100% rename from model/accounts_mgmt/v1/registry_credentials_resource.model rename to clientapi/model/accounts_mgmt/v1/registry_credentials_resource.model diff --git a/model/accounts_mgmt/v1/registry_resource.model b/clientapi/model/accounts_mgmt/v1/registry_resource.model similarity index 100% rename from model/accounts_mgmt/v1/registry_resource.model rename to clientapi/model/accounts_mgmt/v1/registry_resource.model diff --git a/model/accounts_mgmt/v1/registry_type.model b/clientapi/model/accounts_mgmt/v1/registry_type.model similarity index 100% rename from model/accounts_mgmt/v1/registry_type.model rename to clientapi/model/accounts_mgmt/v1/registry_type.model diff --git a/model/accounts_mgmt/v1/related_resource_type.model b/clientapi/model/accounts_mgmt/v1/related_resource_type.model similarity index 100% rename from model/accounts_mgmt/v1/related_resource_type.model rename to clientapi/model/accounts_mgmt/v1/related_resource_type.model diff --git a/model/accounts_mgmt/v1/reserved_resource_type.model b/clientapi/model/accounts_mgmt/v1/reserved_resource_type.model similarity index 100% rename from model/accounts_mgmt/v1/reserved_resource_type.model rename to clientapi/model/accounts_mgmt/v1/reserved_resource_type.model diff --git a/model/accounts_mgmt/v1/resource_quota_resource.model b/clientapi/model/accounts_mgmt/v1/resource_quota_resource.model similarity index 100% rename from model/accounts_mgmt/v1/resource_quota_resource.model rename to clientapi/model/accounts_mgmt/v1/resource_quota_resource.model diff --git a/model/accounts_mgmt/v1/resource_quota_type.model b/clientapi/model/accounts_mgmt/v1/resource_quota_type.model similarity index 100% rename from model/accounts_mgmt/v1/resource_quota_type.model rename to clientapi/model/accounts_mgmt/v1/resource_quota_type.model diff --git a/model/accounts_mgmt/v1/resource_quotas_resource.model b/clientapi/model/accounts_mgmt/v1/resource_quotas_resource.model similarity index 100% rename from model/accounts_mgmt/v1/resource_quotas_resource.model rename to clientapi/model/accounts_mgmt/v1/resource_quotas_resource.model diff --git a/model/accounts_mgmt/v1/resource_type.model b/clientapi/model/accounts_mgmt/v1/resource_type.model similarity index 100% rename from model/accounts_mgmt/v1/resource_type.model rename to clientapi/model/accounts_mgmt/v1/resource_type.model diff --git a/model/accounts_mgmt/v1/role_binding_resource.model b/clientapi/model/accounts_mgmt/v1/role_binding_resource.model similarity index 100% rename from model/accounts_mgmt/v1/role_binding_resource.model rename to clientapi/model/accounts_mgmt/v1/role_binding_resource.model diff --git a/model/accounts_mgmt/v1/role_binding_type.model b/clientapi/model/accounts_mgmt/v1/role_binding_type.model similarity index 100% rename from model/accounts_mgmt/v1/role_binding_type.model rename to clientapi/model/accounts_mgmt/v1/role_binding_type.model diff --git a/model/accounts_mgmt/v1/role_bindings_resource.model b/clientapi/model/accounts_mgmt/v1/role_bindings_resource.model similarity index 100% rename from model/accounts_mgmt/v1/role_bindings_resource.model rename to clientapi/model/accounts_mgmt/v1/role_bindings_resource.model diff --git a/model/accounts_mgmt/v1/role_resource.model b/clientapi/model/accounts_mgmt/v1/role_resource.model similarity index 100% rename from model/accounts_mgmt/v1/role_resource.model rename to clientapi/model/accounts_mgmt/v1/role_resource.model diff --git a/model/accounts_mgmt/v1/role_type.model b/clientapi/model/accounts_mgmt/v1/role_type.model similarity index 100% rename from model/accounts_mgmt/v1/role_type.model rename to clientapi/model/accounts_mgmt/v1/role_type.model diff --git a/model/accounts_mgmt/v1/roles_resource.model b/clientapi/model/accounts_mgmt/v1/roles_resource.model similarity index 100% rename from model/accounts_mgmt/v1/roles_resource.model rename to clientapi/model/accounts_mgmt/v1/roles_resource.model diff --git a/model/accounts_mgmt/v1/root_resource.model b/clientapi/model/accounts_mgmt/v1/root_resource.model similarity index 100% rename from model/accounts_mgmt/v1/root_resource.model rename to clientapi/model/accounts_mgmt/v1/root_resource.model diff --git a/model/accounts_mgmt/v1/sku_rule_resource.model b/clientapi/model/accounts_mgmt/v1/sku_rule_resource.model similarity index 100% rename from model/accounts_mgmt/v1/sku_rule_resource.model rename to clientapi/model/accounts_mgmt/v1/sku_rule_resource.model diff --git a/model/accounts_mgmt/v1/sku_rule_type.model b/clientapi/model/accounts_mgmt/v1/sku_rule_type.model similarity index 100% rename from model/accounts_mgmt/v1/sku_rule_type.model rename to clientapi/model/accounts_mgmt/v1/sku_rule_type.model diff --git a/model/accounts_mgmt/v1/sku_rules_resource.model b/clientapi/model/accounts_mgmt/v1/sku_rules_resource.model similarity index 100% rename from model/accounts_mgmt/v1/sku_rules_resource.model rename to clientapi/model/accounts_mgmt/v1/sku_rules_resource.model diff --git a/model/accounts_mgmt/v1/subscription_metrics_type.model b/clientapi/model/accounts_mgmt/v1/subscription_metrics_type.model similarity index 100% rename from model/accounts_mgmt/v1/subscription_metrics_type.model rename to clientapi/model/accounts_mgmt/v1/subscription_metrics_type.model diff --git a/model/accounts_mgmt/v1/subscription_registration_type.model b/clientapi/model/accounts_mgmt/v1/subscription_registration_type.model similarity index 100% rename from model/accounts_mgmt/v1/subscription_registration_type.model rename to clientapi/model/accounts_mgmt/v1/subscription_registration_type.model diff --git a/model/accounts_mgmt/v1/subscription_reserved_resource_resource.model b/clientapi/model/accounts_mgmt/v1/subscription_reserved_resource_resource.model similarity index 100% rename from model/accounts_mgmt/v1/subscription_reserved_resource_resource.model rename to clientapi/model/accounts_mgmt/v1/subscription_reserved_resource_resource.model diff --git a/model/accounts_mgmt/v1/subscription_reserved_resources_resource.model b/clientapi/model/accounts_mgmt/v1/subscription_reserved_resources_resource.model similarity index 100% rename from model/accounts_mgmt/v1/subscription_reserved_resources_resource.model rename to clientapi/model/accounts_mgmt/v1/subscription_reserved_resources_resource.model diff --git a/model/accounts_mgmt/v1/subscription_resource.model b/clientapi/model/accounts_mgmt/v1/subscription_resource.model similarity index 100% rename from model/accounts_mgmt/v1/subscription_resource.model rename to clientapi/model/accounts_mgmt/v1/subscription_resource.model diff --git a/model/accounts_mgmt/v1/subscription_type.model b/clientapi/model/accounts_mgmt/v1/subscription_type.model similarity index 100% rename from model/accounts_mgmt/v1/subscription_type.model rename to clientapi/model/accounts_mgmt/v1/subscription_type.model diff --git a/model/accounts_mgmt/v1/subscriptions_resource.model b/clientapi/model/accounts_mgmt/v1/subscriptions_resource.model similarity index 100% rename from model/accounts_mgmt/v1/subscriptions_resource.model rename to clientapi/model/accounts_mgmt/v1/subscriptions_resource.model diff --git a/model/accounts_mgmt/v1/summary_dashboard_resource.model b/clientapi/model/accounts_mgmt/v1/summary_dashboard_resource.model similarity index 100% rename from model/accounts_mgmt/v1/summary_dashboard_resource.model rename to clientapi/model/accounts_mgmt/v1/summary_dashboard_resource.model diff --git a/model/accounts_mgmt/v1/summary_dashboard_type.model b/clientapi/model/accounts_mgmt/v1/summary_dashboard_type.model similarity index 100% rename from model/accounts_mgmt/v1/summary_dashboard_type.model rename to clientapi/model/accounts_mgmt/v1/summary_dashboard_type.model diff --git a/model/accounts_mgmt/v1/summary_metrics_type.model b/clientapi/model/accounts_mgmt/v1/summary_metrics_type.model similarity index 100% rename from model/accounts_mgmt/v1/summary_metrics_type.model rename to clientapi/model/accounts_mgmt/v1/summary_metrics_type.model diff --git a/model/accounts_mgmt/v1/summary_vector_type.model b/clientapi/model/accounts_mgmt/v1/summary_vector_type.model similarity index 100% rename from model/accounts_mgmt/v1/summary_vector_type.model rename to clientapi/model/accounts_mgmt/v1/summary_vector_type.model diff --git a/model/accounts_mgmt/v1/support_case_request_type.model b/clientapi/model/accounts_mgmt/v1/support_case_request_type.model similarity index 100% rename from model/accounts_mgmt/v1/support_case_request_type.model rename to clientapi/model/accounts_mgmt/v1/support_case_request_type.model diff --git a/model/accounts_mgmt/v1/support_case_resource.model b/clientapi/model/accounts_mgmt/v1/support_case_resource.model similarity index 100% rename from model/accounts_mgmt/v1/support_case_resource.model rename to clientapi/model/accounts_mgmt/v1/support_case_resource.model diff --git a/model/accounts_mgmt/v1/support_case_response_type.model b/clientapi/model/accounts_mgmt/v1/support_case_response_type.model similarity index 100% rename from model/accounts_mgmt/v1/support_case_response_type.model rename to clientapi/model/accounts_mgmt/v1/support_case_response_type.model diff --git a/model/accounts_mgmt/v1/support_cases_resource.model b/clientapi/model/accounts_mgmt/v1/support_cases_resource.model similarity index 100% rename from model/accounts_mgmt/v1/support_cases_resource.model rename to clientapi/model/accounts_mgmt/v1/support_cases_resource.model diff --git a/model/accounts_mgmt/v1/template_parameter_type.model b/clientapi/model/accounts_mgmt/v1/template_parameter_type.model similarity index 100% rename from model/accounts_mgmt/v1/template_parameter_type.model rename to clientapi/model/accounts_mgmt/v1/template_parameter_type.model diff --git a/model/accounts_mgmt/v1/token_authorization_request_type.model b/clientapi/model/accounts_mgmt/v1/token_authorization_request_type.model similarity index 100% rename from model/accounts_mgmt/v1/token_authorization_request_type.model rename to clientapi/model/accounts_mgmt/v1/token_authorization_request_type.model diff --git a/model/accounts_mgmt/v1/token_authorization_resource.model b/clientapi/model/accounts_mgmt/v1/token_authorization_resource.model similarity index 100% rename from model/accounts_mgmt/v1/token_authorization_resource.model rename to clientapi/model/accounts_mgmt/v1/token_authorization_resource.model diff --git a/model/accounts_mgmt/v1/token_authorization_response_type.model b/clientapi/model/accounts_mgmt/v1/token_authorization_response_type.model similarity index 100% rename from model/accounts_mgmt/v1/token_authorization_response_type.model rename to clientapi/model/accounts_mgmt/v1/token_authorization_response_type.model diff --git a/model/accounts_mgmt/v1/value_unit_type.model b/clientapi/model/accounts_mgmt/v1/value_unit_type.model similarity index 100% rename from model/accounts_mgmt/v1/value_unit_type.model rename to clientapi/model/accounts_mgmt/v1/value_unit_type.model diff --git a/model/addons_mgmt/v1/addon_cluster_resources.model b/clientapi/model/addons_mgmt/v1/addon_cluster_resources.model similarity index 100% rename from model/addons_mgmt/v1/addon_cluster_resources.model rename to clientapi/model/addons_mgmt/v1/addon_cluster_resources.model diff --git a/model/addons_mgmt/v1/addon_clusters_resource.model b/clientapi/model/addons_mgmt/v1/addon_clusters_resource.model similarity index 100% rename from model/addons_mgmt/v1/addon_clusters_resource.model rename to clientapi/model/addons_mgmt/v1/addon_clusters_resource.model diff --git a/model/addons_mgmt/v1/addon_config_type.model b/clientapi/model/addons_mgmt/v1/addon_config_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_config_type.model rename to clientapi/model/addons_mgmt/v1/addon_config_type.model diff --git a/model/addons_mgmt/v1/addon_credential_request_type.model b/clientapi/model/addons_mgmt/v1/addon_credential_request_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_credential_request_type.model rename to clientapi/model/addons_mgmt/v1/addon_credential_request_type.model diff --git a/model/addons_mgmt/v1/addon_environment_variable_type.model b/clientapi/model/addons_mgmt/v1/addon_environment_variable_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_environment_variable_type.model rename to clientapi/model/addons_mgmt/v1/addon_environment_variable_type.model diff --git a/model/addons_mgmt/v1/addon_inquiries_resource.model b/clientapi/model/addons_mgmt/v1/addon_inquiries_resource.model similarity index 100% rename from model/addons_mgmt/v1/addon_inquiries_resource.model rename to clientapi/model/addons_mgmt/v1/addon_inquiries_resource.model diff --git a/model/addons_mgmt/v1/addon_inquiry_resource.model b/clientapi/model/addons_mgmt/v1/addon_inquiry_resource.model similarity index 100% rename from model/addons_mgmt/v1/addon_inquiry_resource.model rename to clientapi/model/addons_mgmt/v1/addon_inquiry_resource.model diff --git a/model/addons_mgmt/v1/addon_install_mode_type.model b/clientapi/model/addons_mgmt/v1/addon_install_mode_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_install_mode_type.model rename to clientapi/model/addons_mgmt/v1/addon_install_mode_type.model diff --git a/model/addons_mgmt/v1/addon_installation_billing_model_type.model b/clientapi/model/addons_mgmt/v1/addon_installation_billing_model_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_installation_billing_model_type.model rename to clientapi/model/addons_mgmt/v1/addon_installation_billing_model_type.model diff --git a/model/addons_mgmt/v1/addon_installation_billing_type.model b/clientapi/model/addons_mgmt/v1/addon_installation_billing_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_installation_billing_type.model rename to clientapi/model/addons_mgmt/v1/addon_installation_billing_type.model diff --git a/model/addons_mgmt/v1/addon_installation_object_reference_type.model b/clientapi/model/addons_mgmt/v1/addon_installation_object_reference_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_installation_object_reference_type.model rename to clientapi/model/addons_mgmt/v1/addon_installation_object_reference_type.model diff --git a/model/addons_mgmt/v1/addon_installation_parameter_type.model b/clientapi/model/addons_mgmt/v1/addon_installation_parameter_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_installation_parameter_type.model rename to clientapi/model/addons_mgmt/v1/addon_installation_parameter_type.model diff --git a/model/addons_mgmt/v1/addon_installation_parameters_type.model b/clientapi/model/addons_mgmt/v1/addon_installation_parameters_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_installation_parameters_type.model rename to clientapi/model/addons_mgmt/v1/addon_installation_parameters_type.model diff --git a/model/addons_mgmt/v1/addon_installation_resource.model b/clientapi/model/addons_mgmt/v1/addon_installation_resource.model similarity index 100% rename from model/addons_mgmt/v1/addon_installation_resource.model rename to clientapi/model/addons_mgmt/v1/addon_installation_resource.model diff --git a/model/addons_mgmt/v1/addon_installation_state_type.model b/clientapi/model/addons_mgmt/v1/addon_installation_state_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_installation_state_type.model rename to clientapi/model/addons_mgmt/v1/addon_installation_state_type.model diff --git a/model/addons_mgmt/v1/addon_installation_type.model b/clientapi/model/addons_mgmt/v1/addon_installation_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_installation_type.model rename to clientapi/model/addons_mgmt/v1/addon_installation_type.model diff --git a/model/addons_mgmt/v1/addon_installations_resource.model b/clientapi/model/addons_mgmt/v1/addon_installations_resource.model similarity index 100% rename from model/addons_mgmt/v1/addon_installations_resource.model rename to clientapi/model/addons_mgmt/v1/addon_installations_resource.model diff --git a/model/addons_mgmt/v1/addon_metrics_federation_type.model b/clientapi/model/addons_mgmt/v1/addon_metrics_federation_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_metrics_federation_type.model rename to clientapi/model/addons_mgmt/v1/addon_metrics_federation_type.model diff --git a/model/addons_mgmt/v1/addon_namespace_type.model b/clientapi/model/addons_mgmt/v1/addon_namespace_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_namespace_type.model rename to clientapi/model/addons_mgmt/v1/addon_namespace_type.model diff --git a/model/addons_mgmt/v1/addon_parameter_option_type.model b/clientapi/model/addons_mgmt/v1/addon_parameter_option_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_parameter_option_type.model rename to clientapi/model/addons_mgmt/v1/addon_parameter_option_type.model diff --git a/model/addons_mgmt/v1/addon_parameter_type.model b/clientapi/model/addons_mgmt/v1/addon_parameter_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_parameter_type.model rename to clientapi/model/addons_mgmt/v1/addon_parameter_type.model diff --git a/model/addons_mgmt/v1/addon_parameter_value_type.model b/clientapi/model/addons_mgmt/v1/addon_parameter_value_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_parameter_value_type.model rename to clientapi/model/addons_mgmt/v1/addon_parameter_value_type.model diff --git a/model/addons_mgmt/v1/addon_parameters_type.model b/clientapi/model/addons_mgmt/v1/addon_parameters_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_parameters_type.model rename to clientapi/model/addons_mgmt/v1/addon_parameters_type.model diff --git a/model/addons_mgmt/v1/addon_requirement_resource_type.model b/clientapi/model/addons_mgmt/v1/addon_requirement_resource_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_requirement_resource_type.model rename to clientapi/model/addons_mgmt/v1/addon_requirement_resource_type.model diff --git a/model/addons_mgmt/v1/addon_requirement_status_type.model b/clientapi/model/addons_mgmt/v1/addon_requirement_status_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_requirement_status_type.model rename to clientapi/model/addons_mgmt/v1/addon_requirement_status_type.model diff --git a/model/addons_mgmt/v1/addon_requirement_type.model b/clientapi/model/addons_mgmt/v1/addon_requirement_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_requirement_type.model rename to clientapi/model/addons_mgmt/v1/addon_requirement_type.model diff --git a/model/addons_mgmt/v1/addon_resource.model b/clientapi/model/addons_mgmt/v1/addon_resource.model similarity index 100% rename from model/addons_mgmt/v1/addon_resource.model rename to clientapi/model/addons_mgmt/v1/addon_resource.model diff --git a/model/addons_mgmt/v1/addon_secret_propagation_type.model b/clientapi/model/addons_mgmt/v1/addon_secret_propagation_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_secret_propagation_type.model rename to clientapi/model/addons_mgmt/v1/addon_secret_propagation_type.model diff --git a/model/addons_mgmt/v1/addon_status_condition_type.model b/clientapi/model/addons_mgmt/v1/addon_status_condition_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_status_condition_type.model rename to clientapi/model/addons_mgmt/v1/addon_status_condition_type.model diff --git a/model/addons_mgmt/v1/addon_status_condition_type_type.model b/clientapi/model/addons_mgmt/v1/addon_status_condition_type_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_status_condition_type_type.model rename to clientapi/model/addons_mgmt/v1/addon_status_condition_type_type.model diff --git a/model/addons_mgmt/v1/addon_status_condition_value_type.model b/clientapi/model/addons_mgmt/v1/addon_status_condition_value_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_status_condition_value_type.model rename to clientapi/model/addons_mgmt/v1/addon_status_condition_value_type.model diff --git a/model/addons_mgmt/v1/addon_status_conditions_resource.model b/clientapi/model/addons_mgmt/v1/addon_status_conditions_resource.model similarity index 100% rename from model/addons_mgmt/v1/addon_status_conditions_resource.model rename to clientapi/model/addons_mgmt/v1/addon_status_conditions_resource.model diff --git a/model/addons_mgmt/v1/addon_status_resource.model b/clientapi/model/addons_mgmt/v1/addon_status_resource.model similarity index 100% rename from model/addons_mgmt/v1/addon_status_resource.model rename to clientapi/model/addons_mgmt/v1/addon_status_resource.model diff --git a/model/addons_mgmt/v1/addon_status_type.model b/clientapi/model/addons_mgmt/v1/addon_status_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_status_type.model rename to clientapi/model/addons_mgmt/v1/addon_status_type.model diff --git a/model/addons_mgmt/v1/addon_statuses_resource.model b/clientapi/model/addons_mgmt/v1/addon_statuses_resource.model similarity index 100% rename from model/addons_mgmt/v1/addon_statuses_resource.model rename to clientapi/model/addons_mgmt/v1/addon_statuses_resource.model diff --git a/model/addons_mgmt/v1/addon_sub_operator_type.model b/clientapi/model/addons_mgmt/v1/addon_sub_operator_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_sub_operator_type.model rename to clientapi/model/addons_mgmt/v1/addon_sub_operator_type.model diff --git a/model/addons_mgmt/v1/addon_type.model b/clientapi/model/addons_mgmt/v1/addon_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_type.model rename to clientapi/model/addons_mgmt/v1/addon_type.model diff --git a/model/addons_mgmt/v1/addon_version_additional_catalog_sources_type.model b/clientapi/model/addons_mgmt/v1/addon_version_additional_catalog_sources_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_version_additional_catalog_sources_type.model rename to clientapi/model/addons_mgmt/v1/addon_version_additional_catalog_sources_type.model diff --git a/model/addons_mgmt/v1/addon_version_monitoring_stack_resource_type.model b/clientapi/model/addons_mgmt/v1/addon_version_monitoring_stack_resource_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_version_monitoring_stack_resource_type.model rename to clientapi/model/addons_mgmt/v1/addon_version_monitoring_stack_resource_type.model diff --git a/model/addons_mgmt/v1/addon_version_monitoring_stack_resources_type.model b/clientapi/model/addons_mgmt/v1/addon_version_monitoring_stack_resources_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_version_monitoring_stack_resources_type.model rename to clientapi/model/addons_mgmt/v1/addon_version_monitoring_stack_resources_type.model diff --git a/model/addons_mgmt/v1/addon_version_monitoring_stack_type.model b/clientapi/model/addons_mgmt/v1/addon_version_monitoring_stack_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_version_monitoring_stack_type.model rename to clientapi/model/addons_mgmt/v1/addon_version_monitoring_stack_type.model diff --git a/model/addons_mgmt/v1/addon_version_resource.model b/clientapi/model/addons_mgmt/v1/addon_version_resource.model similarity index 100% rename from model/addons_mgmt/v1/addon_version_resource.model rename to clientapi/model/addons_mgmt/v1/addon_version_resource.model diff --git a/model/addons_mgmt/v1/addon_version_type.model b/clientapi/model/addons_mgmt/v1/addon_version_type.model similarity index 100% rename from model/addons_mgmt/v1/addon_version_type.model rename to clientapi/model/addons_mgmt/v1/addon_version_type.model diff --git a/model/addons_mgmt/v1/addon_versions_resource.model b/clientapi/model/addons_mgmt/v1/addon_versions_resource.model similarity index 100% rename from model/addons_mgmt/v1/addon_versions_resource.model rename to clientapi/model/addons_mgmt/v1/addon_versions_resource.model diff --git a/model/addons_mgmt/v1/addons_resource.model b/clientapi/model/addons_mgmt/v1/addons_resource.model similarity index 100% rename from model/addons_mgmt/v1/addons_resource.model rename to clientapi/model/addons_mgmt/v1/addons_resource.model diff --git a/clientapi/model/addons_mgmt/v1/doc.go b/clientapi/model/addons_mgmt/v1/doc.go new file mode 100644 index 00000000..f1a4b049 --- /dev/null +++ b/clientapi/model/addons_mgmt/v1/doc.go @@ -0,0 +1,2 @@ +// this file exists so that it is possible to vendor the model into another go module for generating the client. +package v1 diff --git a/model/addons_mgmt/v1/root_resource.model b/clientapi/model/addons_mgmt/v1/root_resource.model similarity index 100% rename from model/addons_mgmt/v1/root_resource.model rename to clientapi/model/addons_mgmt/v1/root_resource.model diff --git a/model/aro_hcp/v1alpha1/cluster_resource.model b/clientapi/model/aro_hcp/v1alpha1/cluster_resource.model similarity index 100% rename from model/aro_hcp/v1alpha1/cluster_resource.model rename to clientapi/model/aro_hcp/v1alpha1/cluster_resource.model diff --git a/model/aro_hcp/v1alpha1/cluster_status_resource.model b/clientapi/model/aro_hcp/v1alpha1/cluster_status_resource.model similarity index 100% rename from model/aro_hcp/v1alpha1/cluster_status_resource.model rename to clientapi/model/aro_hcp/v1alpha1/cluster_status_resource.model diff --git a/model/aro_hcp/v1alpha1/cluster_status_type.model b/clientapi/model/aro_hcp/v1alpha1/cluster_status_type.model similarity index 100% rename from model/aro_hcp/v1alpha1/cluster_status_type.model rename to clientapi/model/aro_hcp/v1alpha1/cluster_status_type.model diff --git a/model/aro_hcp/v1alpha1/cluster_type.model b/clientapi/model/aro_hcp/v1alpha1/cluster_type.model similarity index 100% rename from model/aro_hcp/v1alpha1/cluster_type.model rename to clientapi/model/aro_hcp/v1alpha1/cluster_type.model diff --git a/model/aro_hcp/v1alpha1/clusters_resource.model b/clientapi/model/aro_hcp/v1alpha1/clusters_resource.model similarity index 100% rename from model/aro_hcp/v1alpha1/clusters_resource.model rename to clientapi/model/aro_hcp/v1alpha1/clusters_resource.model diff --git a/clientapi/model/aro_hcp/v1alpha1/doc.go b/clientapi/model/aro_hcp/v1alpha1/doc.go new file mode 100644 index 00000000..f1a4b049 --- /dev/null +++ b/clientapi/model/aro_hcp/v1alpha1/doc.go @@ -0,0 +1,2 @@ +// this file exists so that it is possible to vendor the model into another go module for generating the client. +package v1 diff --git a/model/aro_hcp/v1alpha1/inflight_check_resource.model b/clientapi/model/aro_hcp/v1alpha1/inflight_check_resource.model similarity index 100% rename from model/aro_hcp/v1alpha1/inflight_check_resource.model rename to clientapi/model/aro_hcp/v1alpha1/inflight_check_resource.model diff --git a/model/aro_hcp/v1alpha1/inflight_check_type.model b/clientapi/model/aro_hcp/v1alpha1/inflight_check_type.model similarity index 100% rename from model/aro_hcp/v1alpha1/inflight_check_type.model rename to clientapi/model/aro_hcp/v1alpha1/inflight_check_type.model diff --git a/model/aro_hcp/v1alpha1/inflight_checks_resource.model b/clientapi/model/aro_hcp/v1alpha1/inflight_checks_resource.model similarity index 100% rename from model/aro_hcp/v1alpha1/inflight_checks_resource.model rename to clientapi/model/aro_hcp/v1alpha1/inflight_checks_resource.model diff --git a/model/aro_hcp/v1alpha1/node_pool_resource.model b/clientapi/model/aro_hcp/v1alpha1/node_pool_resource.model similarity index 100% rename from model/aro_hcp/v1alpha1/node_pool_resource.model rename to clientapi/model/aro_hcp/v1alpha1/node_pool_resource.model diff --git a/model/aro_hcp/v1alpha1/node_pool_status_resource.model b/clientapi/model/aro_hcp/v1alpha1/node_pool_status_resource.model similarity index 100% rename from model/aro_hcp/v1alpha1/node_pool_status_resource.model rename to clientapi/model/aro_hcp/v1alpha1/node_pool_status_resource.model diff --git a/model/aro_hcp/v1alpha1/node_pool_status_type.model b/clientapi/model/aro_hcp/v1alpha1/node_pool_status_type.model similarity index 100% rename from model/aro_hcp/v1alpha1/node_pool_status_type.model rename to clientapi/model/aro_hcp/v1alpha1/node_pool_status_type.model diff --git a/model/aro_hcp/v1alpha1/node_pool_type.model b/clientapi/model/aro_hcp/v1alpha1/node_pool_type.model similarity index 100% rename from model/aro_hcp/v1alpha1/node_pool_type.model rename to clientapi/model/aro_hcp/v1alpha1/node_pool_type.model diff --git a/model/aro_hcp/v1alpha1/node_pools_resource.model b/clientapi/model/aro_hcp/v1alpha1/node_pools_resource.model similarity index 100% rename from model/aro_hcp/v1alpha1/node_pools_resource.model rename to clientapi/model/aro_hcp/v1alpha1/node_pools_resource.model diff --git a/model/aro_hcp/v1alpha1/root_resource.model b/clientapi/model/aro_hcp/v1alpha1/root_resource.model similarity index 100% rename from model/aro_hcp/v1alpha1/root_resource.model rename to clientapi/model/aro_hcp/v1alpha1/root_resource.model diff --git a/model/authorizations/v1/access_review_request_type.model b/clientapi/model/authorizations/v1/access_review_request_type.model similarity index 100% rename from model/authorizations/v1/access_review_request_type.model rename to clientapi/model/authorizations/v1/access_review_request_type.model diff --git a/model/authorizations/v1/access_review_resource.model b/clientapi/model/authorizations/v1/access_review_resource.model similarity index 100% rename from model/authorizations/v1/access_review_resource.model rename to clientapi/model/authorizations/v1/access_review_resource.model diff --git a/model/authorizations/v1/access_review_response_type.model b/clientapi/model/authorizations/v1/access_review_response_type.model similarity index 100% rename from model/authorizations/v1/access_review_response_type.model rename to clientapi/model/authorizations/v1/access_review_response_type.model diff --git a/model/authorizations/v1/capability_review_request_type.model b/clientapi/model/authorizations/v1/capability_review_request_type.model similarity index 100% rename from model/authorizations/v1/capability_review_request_type.model rename to clientapi/model/authorizations/v1/capability_review_request_type.model diff --git a/model/authorizations/v1/capability_review_resource.model b/clientapi/model/authorizations/v1/capability_review_resource.model similarity index 100% rename from model/authorizations/v1/capability_review_resource.model rename to clientapi/model/authorizations/v1/capability_review_resource.model diff --git a/model/authorizations/v1/capability_review_response_type.model b/clientapi/model/authorizations/v1/capability_review_response_type.model similarity index 100% rename from model/authorizations/v1/capability_review_response_type.model rename to clientapi/model/authorizations/v1/capability_review_response_type.model diff --git a/clientapi/model/authorizations/v1/doc.go b/clientapi/model/authorizations/v1/doc.go new file mode 100644 index 00000000..f1a4b049 --- /dev/null +++ b/clientapi/model/authorizations/v1/doc.go @@ -0,0 +1,2 @@ +// this file exists so that it is possible to vendor the model into another go module for generating the client. +package v1 diff --git a/model/authorizations/v1/export_control_review_request_type.model b/clientapi/model/authorizations/v1/export_control_review_request_type.model similarity index 100% rename from model/authorizations/v1/export_control_review_request_type.model rename to clientapi/model/authorizations/v1/export_control_review_request_type.model diff --git a/model/authorizations/v1/export_control_review_resource.model b/clientapi/model/authorizations/v1/export_control_review_resource.model similarity index 100% rename from model/authorizations/v1/export_control_review_resource.model rename to clientapi/model/authorizations/v1/export_control_review_resource.model diff --git a/model/authorizations/v1/export_control_review_response_type.model b/clientapi/model/authorizations/v1/export_control_review_response_type.model similarity index 100% rename from model/authorizations/v1/export_control_review_response_type.model rename to clientapi/model/authorizations/v1/export_control_review_response_type.model diff --git a/model/authorizations/v1/feature_review_request_type.model b/clientapi/model/authorizations/v1/feature_review_request_type.model similarity index 100% rename from model/authorizations/v1/feature_review_request_type.model rename to clientapi/model/authorizations/v1/feature_review_request_type.model diff --git a/model/authorizations/v1/feature_review_resource.model b/clientapi/model/authorizations/v1/feature_review_resource.model similarity index 100% rename from model/authorizations/v1/feature_review_resource.model rename to clientapi/model/authorizations/v1/feature_review_resource.model diff --git a/model/authorizations/v1/feature_review_response_type.model b/clientapi/model/authorizations/v1/feature_review_response_type.model similarity index 100% rename from model/authorizations/v1/feature_review_response_type.model rename to clientapi/model/authorizations/v1/feature_review_response_type.model diff --git a/model/authorizations/v1/resource_review_request_type.model b/clientapi/model/authorizations/v1/resource_review_request_type.model similarity index 100% rename from model/authorizations/v1/resource_review_request_type.model rename to clientapi/model/authorizations/v1/resource_review_request_type.model diff --git a/model/authorizations/v1/resource_review_resource.model b/clientapi/model/authorizations/v1/resource_review_resource.model similarity index 100% rename from model/authorizations/v1/resource_review_resource.model rename to clientapi/model/authorizations/v1/resource_review_resource.model diff --git a/model/authorizations/v1/resource_review_type.model b/clientapi/model/authorizations/v1/resource_review_type.model similarity index 100% rename from model/authorizations/v1/resource_review_type.model rename to clientapi/model/authorizations/v1/resource_review_type.model diff --git a/model/authorizations/v1/root_resource.model b/clientapi/model/authorizations/v1/root_resource.model similarity index 100% rename from model/authorizations/v1/root_resource.model rename to clientapi/model/authorizations/v1/root_resource.model diff --git a/model/authorizations/v1/self_access_review_request_type.model b/clientapi/model/authorizations/v1/self_access_review_request_type.model similarity index 100% rename from model/authorizations/v1/self_access_review_request_type.model rename to clientapi/model/authorizations/v1/self_access_review_request_type.model diff --git a/model/authorizations/v1/self_access_review_resource.model b/clientapi/model/authorizations/v1/self_access_review_resource.model similarity index 100% rename from model/authorizations/v1/self_access_review_resource.model rename to clientapi/model/authorizations/v1/self_access_review_resource.model diff --git a/model/authorizations/v1/self_access_review_response_type.model b/clientapi/model/authorizations/v1/self_access_review_response_type.model similarity index 100% rename from model/authorizations/v1/self_access_review_response_type.model rename to clientapi/model/authorizations/v1/self_access_review_response_type.model diff --git a/model/authorizations/v1/self_capability_review_request_type.model b/clientapi/model/authorizations/v1/self_capability_review_request_type.model similarity index 100% rename from model/authorizations/v1/self_capability_review_request_type.model rename to clientapi/model/authorizations/v1/self_capability_review_request_type.model diff --git a/model/authorizations/v1/self_capability_review_resource.model b/clientapi/model/authorizations/v1/self_capability_review_resource.model similarity index 100% rename from model/authorizations/v1/self_capability_review_resource.model rename to clientapi/model/authorizations/v1/self_capability_review_resource.model diff --git a/model/authorizations/v1/self_capability_review_response_type.model b/clientapi/model/authorizations/v1/self_capability_review_response_type.model similarity index 100% rename from model/authorizations/v1/self_capability_review_response_type.model rename to clientapi/model/authorizations/v1/self_capability_review_response_type.model diff --git a/model/authorizations/v1/self_feature_review_request_type.model b/clientapi/model/authorizations/v1/self_feature_review_request_type.model similarity index 100% rename from model/authorizations/v1/self_feature_review_request_type.model rename to clientapi/model/authorizations/v1/self_feature_review_request_type.model diff --git a/model/authorizations/v1/self_feature_review_resource.model b/clientapi/model/authorizations/v1/self_feature_review_resource.model similarity index 100% rename from model/authorizations/v1/self_feature_review_resource.model rename to clientapi/model/authorizations/v1/self_feature_review_resource.model diff --git a/model/authorizations/v1/self_feature_review_response_type.model b/clientapi/model/authorizations/v1/self_feature_review_response_type.model similarity index 100% rename from model/authorizations/v1/self_feature_review_response_type.model rename to clientapi/model/authorizations/v1/self_feature_review_response_type.model diff --git a/model/authorizations/v1/self_terms_review_request_type.model b/clientapi/model/authorizations/v1/self_terms_review_request_type.model similarity index 100% rename from model/authorizations/v1/self_terms_review_request_type.model rename to clientapi/model/authorizations/v1/self_terms_review_request_type.model diff --git a/model/authorizations/v1/self_terms_review_resource.model b/clientapi/model/authorizations/v1/self_terms_review_resource.model similarity index 100% rename from model/authorizations/v1/self_terms_review_resource.model rename to clientapi/model/authorizations/v1/self_terms_review_resource.model diff --git a/model/authorizations/v1/terms_review_request_type.model b/clientapi/model/authorizations/v1/terms_review_request_type.model similarity index 100% rename from model/authorizations/v1/terms_review_request_type.model rename to clientapi/model/authorizations/v1/terms_review_request_type.model diff --git a/model/authorizations/v1/terms_review_resource.model b/clientapi/model/authorizations/v1/terms_review_resource.model similarity index 100% rename from model/authorizations/v1/terms_review_resource.model rename to clientapi/model/authorizations/v1/terms_review_resource.model diff --git a/model/authorizations/v1/terms_review_response_type.model b/clientapi/model/authorizations/v1/terms_review_response_type.model similarity index 100% rename from model/authorizations/v1/terms_review_response_type.model rename to clientapi/model/authorizations/v1/terms_review_response_type.model diff --git a/model/clusters_mgmt/v1/UpgradePolicyStateValue.model b/clientapi/model/clusters_mgmt/v1/UpgradePolicyStateValue.model similarity index 100% rename from model/clusters_mgmt/v1/UpgradePolicyStateValue.model rename to clientapi/model/clusters_mgmt/v1/UpgradePolicyStateValue.model diff --git a/model/clusters_mgmt/v1/add_on_additional_catalog_sources_type.model b/clientapi/model/clusters_mgmt/v1/add_on_additional_catalog_sources_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_additional_catalog_sources_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_additional_catalog_sources_type.model diff --git a/model/clusters_mgmt/v1/add_on_config_type.model b/clientapi/model/clusters_mgmt/v1/add_on_config_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_config_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_config_type.model diff --git a/model/clusters_mgmt/v1/add_on_environment_variable_type.model b/clientapi/model/clusters_mgmt/v1/add_on_environment_variable_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_environment_variable_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_environment_variable_type.model diff --git a/model/clusters_mgmt/v1/add_on_inquiries_resource.model b/clientapi/model/clusters_mgmt/v1/add_on_inquiries_resource.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_inquiries_resource.model rename to clientapi/model/clusters_mgmt/v1/add_on_inquiries_resource.model diff --git a/model/clusters_mgmt/v1/add_on_inquiry_resource.model b/clientapi/model/clusters_mgmt/v1/add_on_inquiry_resource.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_inquiry_resource.model rename to clientapi/model/clusters_mgmt/v1/add_on_inquiry_resource.model diff --git a/model/clusters_mgmt/v1/add_on_install_mode_type.model b/clientapi/model/clusters_mgmt/v1/add_on_install_mode_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_install_mode_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_install_mode_type.model diff --git a/model/clusters_mgmt/v1/add_on_installation_billing.model b/clientapi/model/clusters_mgmt/v1/add_on_installation_billing.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_installation_billing.model rename to clientapi/model/clusters_mgmt/v1/add_on_installation_billing.model diff --git a/model/clusters_mgmt/v1/add_on_installation_parameter_type.model b/clientapi/model/clusters_mgmt/v1/add_on_installation_parameter_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_installation_parameter_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_installation_parameter_type.model diff --git a/model/clusters_mgmt/v1/add_on_installation_resource.model b/clientapi/model/clusters_mgmt/v1/add_on_installation_resource.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_installation_resource.model rename to clientapi/model/clusters_mgmt/v1/add_on_installation_resource.model diff --git a/model/clusters_mgmt/v1/add_on_installation_state_type.model b/clientapi/model/clusters_mgmt/v1/add_on_installation_state_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_installation_state_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_installation_state_type.model diff --git a/model/clusters_mgmt/v1/add_on_installation_type.model b/clientapi/model/clusters_mgmt/v1/add_on_installation_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_installation_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_installation_type.model diff --git a/model/clusters_mgmt/v1/add_on_installations_resource.model b/clientapi/model/clusters_mgmt/v1/add_on_installations_resource.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_installations_resource.model rename to clientapi/model/clusters_mgmt/v1/add_on_installations_resource.model diff --git a/model/clusters_mgmt/v1/add_on_namespace_type.model b/clientapi/model/clusters_mgmt/v1/add_on_namespace_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_namespace_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_namespace_type.model diff --git a/model/clusters_mgmt/v1/add_on_parameter_option_type.model b/clientapi/model/clusters_mgmt/v1/add_on_parameter_option_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_parameter_option_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_parameter_option_type.model diff --git a/model/clusters_mgmt/v1/add_on_parameter_type.model b/clientapi/model/clusters_mgmt/v1/add_on_parameter_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_parameter_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_parameter_type.model diff --git a/model/clusters_mgmt/v1/add_on_requirement_status_type.model b/clientapi/model/clusters_mgmt/v1/add_on_requirement_status_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_requirement_status_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_requirement_status_type.model diff --git a/model/clusters_mgmt/v1/add_on_requirement_type.model b/clientapi/model/clusters_mgmt/v1/add_on_requirement_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_requirement_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_requirement_type.model diff --git a/model/clusters_mgmt/v1/add_on_resource.model b/clientapi/model/clusters_mgmt/v1/add_on_resource.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_resource.model rename to clientapi/model/clusters_mgmt/v1/add_on_resource.model diff --git a/model/clusters_mgmt/v1/add_on_secret_propagation_type.model b/clientapi/model/clusters_mgmt/v1/add_on_secret_propagation_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_secret_propagation_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_secret_propagation_type.model diff --git a/model/clusters_mgmt/v1/add_on_sub_operator_type.model b/clientapi/model/clusters_mgmt/v1/add_on_sub_operator_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_sub_operator_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_sub_operator_type.model diff --git a/model/clusters_mgmt/v1/add_on_type.model b/clientapi/model/clusters_mgmt/v1/add_on_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_type.model diff --git a/model/clusters_mgmt/v1/add_on_version_resource.model b/clientapi/model/clusters_mgmt/v1/add_on_version_resource.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_version_resource.model rename to clientapi/model/clusters_mgmt/v1/add_on_version_resource.model diff --git a/model/clusters_mgmt/v1/add_on_version_type.model b/clientapi/model/clusters_mgmt/v1/add_on_version_type.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_version_type.model rename to clientapi/model/clusters_mgmt/v1/add_on_version_type.model diff --git a/model/clusters_mgmt/v1/add_on_versions_resource.model b/clientapi/model/clusters_mgmt/v1/add_on_versions_resource.model similarity index 100% rename from model/clusters_mgmt/v1/add_on_versions_resource.model rename to clientapi/model/clusters_mgmt/v1/add_on_versions_resource.model diff --git a/model/clusters_mgmt/v1/add_ons_resource.model b/clientapi/model/clusters_mgmt/v1/add_ons_resource.model similarity index 100% rename from model/clusters_mgmt/v1/add_ons_resource.model rename to clientapi/model/clusters_mgmt/v1/add_ons_resource.model diff --git a/model/clusters_mgmt/v1/addon_upgrade_policies_resource.model b/clientapi/model/clusters_mgmt/v1/addon_upgrade_policies_resource.model similarity index 100% rename from model/clusters_mgmt/v1/addon_upgrade_policies_resource.model rename to clientapi/model/clusters_mgmt/v1/addon_upgrade_policies_resource.model diff --git a/model/clusters_mgmt/v1/addon_upgrade_policy_resource.model b/clientapi/model/clusters_mgmt/v1/addon_upgrade_policy_resource.model similarity index 100% rename from model/clusters_mgmt/v1/addon_upgrade_policy_resource.model rename to clientapi/model/clusters_mgmt/v1/addon_upgrade_policy_resource.model diff --git a/model/clusters_mgmt/v1/addon_upgrade_policy_state_resource.model b/clientapi/model/clusters_mgmt/v1/addon_upgrade_policy_state_resource.model similarity index 100% rename from model/clusters_mgmt/v1/addon_upgrade_policy_state_resource.model rename to clientapi/model/clusters_mgmt/v1/addon_upgrade_policy_state_resource.model diff --git a/model/clusters_mgmt/v1/addon_upgrade_policy_state_type.model b/clientapi/model/clusters_mgmt/v1/addon_upgrade_policy_state_type.model similarity index 100% rename from model/clusters_mgmt/v1/addon_upgrade_policy_state_type.model rename to clientapi/model/clusters_mgmt/v1/addon_upgrade_policy_state_type.model diff --git a/model/clusters_mgmt/v1/addon_upgrade_policy_type.model b/clientapi/model/clusters_mgmt/v1/addon_upgrade_policy_type.model similarity index 100% rename from model/clusters_mgmt/v1/addon_upgrade_policy_type.model rename to clientapi/model/clusters_mgmt/v1/addon_upgrade_policy_type.model diff --git a/model/clusters_mgmt/v1/admin_credentials_type.model b/clientapi/model/clusters_mgmt/v1/admin_credentials_type.model similarity index 100% rename from model/clusters_mgmt/v1/admin_credentials_type.model rename to clientapi/model/clusters_mgmt/v1/admin_credentials_type.model diff --git a/model/clusters_mgmt/v1/alert_info_type.model b/clientapi/model/clusters_mgmt/v1/alert_info_type.model similarity index 100% rename from model/clusters_mgmt/v1/alert_info_type.model rename to clientapi/model/clusters_mgmt/v1/alert_info_type.model diff --git a/model/clusters_mgmt/v1/alert_severity_type.model b/clientapi/model/clusters_mgmt/v1/alert_severity_type.model similarity index 100% rename from model/clusters_mgmt/v1/alert_severity_type.model rename to clientapi/model/clusters_mgmt/v1/alert_severity_type.model diff --git a/model/clusters_mgmt/v1/alerts_info_type.model b/clientapi/model/clusters_mgmt/v1/alerts_info_type.model similarity index 100% rename from model/clusters_mgmt/v1/alerts_info_type.model rename to clientapi/model/clusters_mgmt/v1/alerts_info_type.model diff --git a/model/clusters_mgmt/v1/alerts_metric_query_resource.model b/clientapi/model/clusters_mgmt/v1/alerts_metric_query_resource.model similarity index 100% rename from model/clusters_mgmt/v1/alerts_metric_query_resource.model rename to clientapi/model/clusters_mgmt/v1/alerts_metric_query_resource.model diff --git a/model/clusters_mgmt/v1/ami_override_type.model b/clientapi/model/clusters_mgmt/v1/ami_override_type.model similarity index 100% rename from model/clusters_mgmt/v1/ami_override_type.model rename to clientapi/model/clusters_mgmt/v1/ami_override_type.model diff --git a/model/clusters_mgmt/v1/audit_log_type.model b/clientapi/model/clusters_mgmt/v1/audit_log_type.model similarity index 100% rename from model/clusters_mgmt/v1/audit_log_type.model rename to clientapi/model/clusters_mgmt/v1/audit_log_type.model diff --git a/model/clusters_mgmt/v1/autoscaler_resource.model b/clientapi/model/clusters_mgmt/v1/autoscaler_resource.model similarity index 100% rename from model/clusters_mgmt/v1/autoscaler_resource.model rename to clientapi/model/clusters_mgmt/v1/autoscaler_resource.model diff --git a/model/clusters_mgmt/v1/autoscaler_resource_limits_gpu_limit_type.model b/clientapi/model/clusters_mgmt/v1/autoscaler_resource_limits_gpu_limit_type.model similarity index 100% rename from model/clusters_mgmt/v1/autoscaler_resource_limits_gpu_limit_type.model rename to clientapi/model/clusters_mgmt/v1/autoscaler_resource_limits_gpu_limit_type.model diff --git a/model/clusters_mgmt/v1/autoscaler_resource_limits_type.model b/clientapi/model/clusters_mgmt/v1/autoscaler_resource_limits_type.model similarity index 100% rename from model/clusters_mgmt/v1/autoscaler_resource_limits_type.model rename to clientapi/model/clusters_mgmt/v1/autoscaler_resource_limits_type.model diff --git a/model/clusters_mgmt/v1/autoscaler_scale_down_config_type.model b/clientapi/model/clusters_mgmt/v1/autoscaler_scale_down_config_type.model similarity index 100% rename from model/clusters_mgmt/v1/autoscaler_scale_down_config_type.model rename to clientapi/model/clusters_mgmt/v1/autoscaler_scale_down_config_type.model diff --git a/model/clusters_mgmt/v1/available_regions_inquiry_resource.model b/clientapi/model/clusters_mgmt/v1/available_regions_inquiry_resource.model similarity index 100% rename from model/clusters_mgmt/v1/available_regions_inquiry_resource.model rename to clientapi/model/clusters_mgmt/v1/available_regions_inquiry_resource.model diff --git a/model/clusters_mgmt/v1/aws_etcd_enryption_type.model b/clientapi/model/clusters_mgmt/v1/aws_etcd_enryption_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_etcd_enryption_type.model rename to clientapi/model/clusters_mgmt/v1/aws_etcd_enryption_type.model diff --git a/model/clusters_mgmt/v1/aws_flavour_type.model b/clientapi/model/clusters_mgmt/v1/aws_flavour_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_flavour_type.model rename to clientapi/model/clusters_mgmt/v1/aws_flavour_type.model diff --git a/model/clusters_mgmt/v1/aws_http_token_state_type.model b/clientapi/model/clusters_mgmt/v1/aws_http_token_state_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_http_token_state_type.model rename to clientapi/model/clusters_mgmt/v1/aws_http_token_state_type.model diff --git a/model/clusters_mgmt/v1/aws_infrastructure_access_role_grant_resource.model b/clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_grant_resource.model similarity index 100% rename from model/clusters_mgmt/v1/aws_infrastructure_access_role_grant_resource.model rename to clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_grant_resource.model diff --git a/model/clusters_mgmt/v1/aws_infrastructure_access_role_grant_state_type.model b/clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_grant_state_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_infrastructure_access_role_grant_state_type.model rename to clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_grant_state_type.model diff --git a/model/clusters_mgmt/v1/aws_infrastructure_access_role_grant_type.model b/clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_grant_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_infrastructure_access_role_grant_type.model rename to clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_grant_type.model diff --git a/model/clusters_mgmt/v1/aws_infrastructure_access_role_grants_resource.model b/clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_grants_resource.model similarity index 100% rename from model/clusters_mgmt/v1/aws_infrastructure_access_role_grants_resource.model rename to clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_grants_resource.model diff --git a/model/clusters_mgmt/v1/aws_infrastructure_access_role_resource.model b/clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_resource.model similarity index 100% rename from model/clusters_mgmt/v1/aws_infrastructure_access_role_resource.model rename to clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_resource.model diff --git a/model/clusters_mgmt/v1/aws_infrastructure_access_role_state_type.model b/clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_state_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_infrastructure_access_role_state_type.model rename to clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_state_type.model diff --git a/model/clusters_mgmt/v1/aws_infrastructure_access_role_type.model b/clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_infrastructure_access_role_type.model rename to clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_role_type.model diff --git a/model/clusters_mgmt/v1/aws_infrastructure_access_roles_resource.model b/clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_roles_resource.model similarity index 100% rename from model/clusters_mgmt/v1/aws_infrastructure_access_roles_resource.model rename to clientapi/model/clusters_mgmt/v1/aws_infrastructure_access_roles_resource.model diff --git a/model/clusters_mgmt/v1/aws_inquiries_resource.model b/clientapi/model/clusters_mgmt/v1/aws_inquiries_resource.model similarity index 100% rename from model/clusters_mgmt/v1/aws_inquiries_resource.model rename to clientapi/model/clusters_mgmt/v1/aws_inquiries_resource.model diff --git a/model/clusters_mgmt/v1/aws_machine_pool_type.model b/clientapi/model/clusters_mgmt/v1/aws_machine_pool_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_machine_pool_type.model rename to clientapi/model/clusters_mgmt/v1/aws_machine_pool_type.model diff --git a/model/clusters_mgmt/v1/aws_node_pool_type.model b/clientapi/model/clusters_mgmt/v1/aws_node_pool_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_node_pool_type.model rename to clientapi/model/clusters_mgmt/v1/aws_node_pool_type.model diff --git a/model/clusters_mgmt/v1/aws_region_machine_types_resource.model b/clientapi/model/clusters_mgmt/v1/aws_region_machine_types_resource.model similarity index 100% rename from model/clusters_mgmt/v1/aws_region_machine_types_resource.model rename to clientapi/model/clusters_mgmt/v1/aws_region_machine_types_resource.model diff --git a/model/clusters_mgmt/v1/aws_resource.model b/clientapi/model/clusters_mgmt/v1/aws_resource.model similarity index 100% rename from model/clusters_mgmt/v1/aws_resource.model rename to clientapi/model/clusters_mgmt/v1/aws_resource.model diff --git a/model/clusters_mgmt/v1/aws_security_group_type.model b/clientapi/model/clusters_mgmt/v1/aws_security_group_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_security_group_type.model rename to clientapi/model/clusters_mgmt/v1/aws_security_group_type.model diff --git a/model/clusters_mgmt/v1/aws_shard_type.model b/clientapi/model/clusters_mgmt/v1/aws_shard_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_shard_type.model rename to clientapi/model/clusters_mgmt/v1/aws_shard_type.model diff --git a/model/clusters_mgmt/v1/aws_spot_market_options_type.model b/clientapi/model/clusters_mgmt/v1/aws_spot_market_options_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_spot_market_options_type.model rename to clientapi/model/clusters_mgmt/v1/aws_spot_market_options_type.model diff --git a/model/clusters_mgmt/v1/aws_sts_account_role_type.model b/clientapi/model/clusters_mgmt/v1/aws_sts_account_role_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_sts_account_role_type.model rename to clientapi/model/clusters_mgmt/v1/aws_sts_account_role_type.model diff --git a/model/clusters_mgmt/v1/aws_sts_account_roles_inquiry_resource.model b/clientapi/model/clusters_mgmt/v1/aws_sts_account_roles_inquiry_resource.model similarity index 100% rename from model/clusters_mgmt/v1/aws_sts_account_roles_inquiry_resource.model rename to clientapi/model/clusters_mgmt/v1/aws_sts_account_roles_inquiry_resource.model diff --git a/model/clusters_mgmt/v1/aws_sts_policies_inquiry_resource.model b/clientapi/model/clusters_mgmt/v1/aws_sts_policies_inquiry_resource.model similarity index 100% rename from model/clusters_mgmt/v1/aws_sts_policies_inquiry_resource.model rename to clientapi/model/clusters_mgmt/v1/aws_sts_policies_inquiry_resource.model diff --git a/model/clusters_mgmt/v1/aws_sts_policies_type.model b/clientapi/model/clusters_mgmt/v1/aws_sts_policies_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_sts_policies_type.model rename to clientapi/model/clusters_mgmt/v1/aws_sts_policies_type.model diff --git a/model/clusters_mgmt/v1/aws_sts_role_type.model b/clientapi/model/clusters_mgmt/v1/aws_sts_role_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_sts_role_type.model rename to clientapi/model/clusters_mgmt/v1/aws_sts_role_type.model diff --git a/model/clusters_mgmt/v1/aws_subnetwork_type.model b/clientapi/model/clusters_mgmt/v1/aws_subnetwork_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_subnetwork_type.model rename to clientapi/model/clusters_mgmt/v1/aws_subnetwork_type.model diff --git a/model/clusters_mgmt/v1/aws_type.model b/clientapi/model/clusters_mgmt/v1/aws_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_type.model rename to clientapi/model/clusters_mgmt/v1/aws_type.model diff --git a/model/clusters_mgmt/v1/aws_validate_credentials_resource.model b/clientapi/model/clusters_mgmt/v1/aws_validate_credentials_resource.model similarity index 100% rename from model/clusters_mgmt/v1/aws_validate_credentials_resource.model rename to clientapi/model/clusters_mgmt/v1/aws_validate_credentials_resource.model diff --git a/model/clusters_mgmt/v1/aws_volume_type.model b/clientapi/model/clusters_mgmt/v1/aws_volume_type.model similarity index 100% rename from model/clusters_mgmt/v1/aws_volume_type.model rename to clientapi/model/clusters_mgmt/v1/aws_volume_type.model diff --git a/model/clusters_mgmt/v1/azure_node_pool_type.model b/clientapi/model/clusters_mgmt/v1/azure_node_pool_type.model similarity index 100% rename from model/clusters_mgmt/v1/azure_node_pool_type.model rename to clientapi/model/clusters_mgmt/v1/azure_node_pool_type.model diff --git a/model/clusters_mgmt/v1/azure_nodes_outbound_connectivity_types.model b/clientapi/model/clusters_mgmt/v1/azure_nodes_outbound_connectivity_types.model similarity index 100% rename from model/clusters_mgmt/v1/azure_nodes_outbound_connectivity_types.model rename to clientapi/model/clusters_mgmt/v1/azure_nodes_outbound_connectivity_types.model diff --git a/model/clusters_mgmt/v1/azure_operators_authentication_types.model b/clientapi/model/clusters_mgmt/v1/azure_operators_authentication_types.model similarity index 100% rename from model/clusters_mgmt/v1/azure_operators_authentication_types.model rename to clientapi/model/clusters_mgmt/v1/azure_operators_authentication_types.model diff --git a/model/clusters_mgmt/v1/azure_type.model b/clientapi/model/clusters_mgmt/v1/azure_type.model similarity index 100% rename from model/clusters_mgmt/v1/azure_type.model rename to clientapi/model/clusters_mgmt/v1/azure_type.model diff --git a/model/clusters_mgmt/v1/billing_model_item_type.model b/clientapi/model/clusters_mgmt/v1/billing_model_item_type.model similarity index 100% rename from model/clusters_mgmt/v1/billing_model_item_type.model rename to clientapi/model/clusters_mgmt/v1/billing_model_item_type.model diff --git a/model/clusters_mgmt/v1/billing_model_type.model b/clientapi/model/clusters_mgmt/v1/billing_model_type.model similarity index 100% rename from model/clusters_mgmt/v1/billing_model_type.model rename to clientapi/model/clusters_mgmt/v1/billing_model_type.model diff --git a/model/clusters_mgmt/v1/break_glass_credential_resource.model b/clientapi/model/clusters_mgmt/v1/break_glass_credential_resource.model similarity index 100% rename from model/clusters_mgmt/v1/break_glass_credential_resource.model rename to clientapi/model/clusters_mgmt/v1/break_glass_credential_resource.model diff --git a/model/clusters_mgmt/v1/break_glass_credential_type.model b/clientapi/model/clusters_mgmt/v1/break_glass_credential_type.model similarity index 100% rename from model/clusters_mgmt/v1/break_glass_credential_type.model rename to clientapi/model/clusters_mgmt/v1/break_glass_credential_type.model diff --git a/model/clusters_mgmt/v1/break_glass_credentials_resource.model b/clientapi/model/clusters_mgmt/v1/break_glass_credentials_resource.model similarity index 100% rename from model/clusters_mgmt/v1/break_glass_credentials_resource.model rename to clientapi/model/clusters_mgmt/v1/break_glass_credentials_resource.model diff --git a/model/clusters_mgmt/v1/byo_oidc_type.model b/clientapi/model/clusters_mgmt/v1/byo_oidc_type.model similarity index 100% rename from model/clusters_mgmt/v1/byo_oidc_type.model rename to clientapi/model/clusters_mgmt/v1/byo_oidc_type.model diff --git a/model/clusters_mgmt/v1/ccs_type.model b/clientapi/model/clusters_mgmt/v1/ccs_type.model similarity index 100% rename from model/clusters_mgmt/v1/ccs_type.model rename to clientapi/model/clusters_mgmt/v1/ccs_type.model diff --git a/model/clusters_mgmt/v1/cloud_available_regions_resource.model b/clientapi/model/clusters_mgmt/v1/cloud_available_regions_resource.model similarity index 100% rename from model/clusters_mgmt/v1/cloud_available_regions_resource.model rename to clientapi/model/clusters_mgmt/v1/cloud_available_regions_resource.model diff --git a/model/clusters_mgmt/v1/cloud_provider_resource.model b/clientapi/model/clusters_mgmt/v1/cloud_provider_resource.model similarity index 100% rename from model/clusters_mgmt/v1/cloud_provider_resource.model rename to clientapi/model/clusters_mgmt/v1/cloud_provider_resource.model diff --git a/model/clusters_mgmt/v1/cloud_provider_type.model b/clientapi/model/clusters_mgmt/v1/cloud_provider_type.model similarity index 100% rename from model/clusters_mgmt/v1/cloud_provider_type.model rename to clientapi/model/clusters_mgmt/v1/cloud_provider_type.model diff --git a/model/clusters_mgmt/v1/cloud_providers_resource.model b/clientapi/model/clusters_mgmt/v1/cloud_providers_resource.model similarity index 100% rename from model/clusters_mgmt/v1/cloud_providers_resource.model rename to clientapi/model/clusters_mgmt/v1/cloud_providers_resource.model diff --git a/model/clusters_mgmt/v1/cloud_region_resource.model b/clientapi/model/clusters_mgmt/v1/cloud_region_resource.model similarity index 100% rename from model/clusters_mgmt/v1/cloud_region_resource.model rename to clientapi/model/clusters_mgmt/v1/cloud_region_resource.model diff --git a/model/clusters_mgmt/v1/cloud_region_type.model b/clientapi/model/clusters_mgmt/v1/cloud_region_type.model similarity index 100% rename from model/clusters_mgmt/v1/cloud_region_type.model rename to clientapi/model/clusters_mgmt/v1/cloud_region_type.model diff --git a/model/clusters_mgmt/v1/cloud_regions_resource.model b/clientapi/model/clusters_mgmt/v1/cloud_regions_resource.model similarity index 100% rename from model/clusters_mgmt/v1/cloud_regions_resource.model rename to clientapi/model/clusters_mgmt/v1/cloud_regions_resource.model diff --git a/model/clusters_mgmt/v1/cluster_api_type.model b/clientapi/model/clusters_mgmt/v1/cluster_api_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_api_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_api_type.model diff --git a/model/clusters_mgmt/v1/cluster_arch_type.model b/clientapi/model/clusters_mgmt/v1/cluster_arch_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_arch_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_arch_type.model diff --git a/model/clusters_mgmt/v1/cluster_autoscaler_type.model b/clientapi/model/clusters_mgmt/v1/cluster_autoscaler_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_autoscaler_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_autoscaler_type.model diff --git a/model/clusters_mgmt/v1/cluster_capabilities_type.model b/clientapi/model/clusters_mgmt/v1/cluster_capabilities_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_capabilities_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_capabilities_type.model diff --git a/model/clusters_mgmt/v1/cluster_configuration_mode_type.model b/clientapi/model/clusters_mgmt/v1/cluster_configuration_mode_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_configuration_mode_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_configuration_mode_type.model diff --git a/model/clusters_mgmt/v1/cluster_console_type.model b/clientapi/model/clusters_mgmt/v1/cluster_console_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_console_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_console_type.model diff --git a/model/clusters_mgmt/v1/cluster_credentials_type.model b/clientapi/model/clusters_mgmt/v1/cluster_credentials_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_credentials_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_credentials_type.model diff --git a/model/clusters_mgmt/v1/cluster_deployment_type.model b/clientapi/model/clusters_mgmt/v1/cluster_deployment_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_deployment_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_deployment_type.model diff --git a/model/clusters_mgmt/v1/cluster_health_state_type.model b/clientapi/model/clusters_mgmt/v1/cluster_health_state_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_health_state_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_health_state_type.model diff --git a/model/clusters_mgmt/v1/cluster_link_type.model b/clientapi/model/clusters_mgmt/v1/cluster_link_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_link_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_link_type.model diff --git a/model/clusters_mgmt/v1/cluster_migration_resource.model b/clientapi/model/clusters_mgmt/v1/cluster_migration_resource.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_migration_resource.model rename to clientapi/model/clusters_mgmt/v1/cluster_migration_resource.model diff --git a/model/clusters_mgmt/v1/cluster_migration_state_type.model b/clientapi/model/clusters_mgmt/v1/cluster_migration_state_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_migration_state_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_migration_state_type.model diff --git a/model/clusters_mgmt/v1/cluster_migration_type.model b/clientapi/model/clusters_mgmt/v1/cluster_migration_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_migration_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_migration_type.model diff --git a/model/clusters_mgmt/v1/cluster_migration_type_type.model b/clientapi/model/clusters_mgmt/v1/cluster_migration_type_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_migration_type_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_migration_type_type.model diff --git a/model/clusters_mgmt/v1/cluster_migrations_resource.model b/clientapi/model/clusters_mgmt/v1/cluster_migrations_resource.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_migrations_resource.model rename to clientapi/model/clusters_mgmt/v1/cluster_migrations_resource.model diff --git a/model/clusters_mgmt/v1/cluster_nodes_root_volume_type.model b/clientapi/model/clusters_mgmt/v1/cluster_nodes_root_volume_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_nodes_root_volume_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_nodes_root_volume_type.model diff --git a/model/clusters_mgmt/v1/cluster_nodes_type.model b/clientapi/model/clusters_mgmt/v1/cluster_nodes_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_nodes_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_nodes_type.model diff --git a/model/clusters_mgmt/v1/cluster_operator_info_type.model b/clientapi/model/clusters_mgmt/v1/cluster_operator_info_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_operator_info_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_operator_info_type.model diff --git a/model/clusters_mgmt/v1/cluster_operators_info_type.model b/clientapi/model/clusters_mgmt/v1/cluster_operators_info_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_operators_info_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_operators_info_type.model diff --git a/model/clusters_mgmt/v1/cluster_operators_metric_query_resource.model b/clientapi/model/clusters_mgmt/v1/cluster_operators_metric_query_resource.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_operators_metric_query_resource.model rename to clientapi/model/clusters_mgmt/v1/cluster_operators_metric_query_resource.model diff --git a/model/clusters_mgmt/v1/cluster_operators_state_type.model b/clientapi/model/clusters_mgmt/v1/cluster_operators_state_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_operators_state_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_operators_state_type.model diff --git a/model/clusters_mgmt/v1/cluster_registration_type.model b/clientapi/model/clusters_mgmt/v1/cluster_registration_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_registration_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_registration_type.model diff --git a/model/clusters_mgmt/v1/cluster_registry_config_type.model b/clientapi/model/clusters_mgmt/v1/cluster_registry_config_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_registry_config_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_registry_config_type.model diff --git a/model/clusters_mgmt/v1/cluster_resource.model b/clientapi/model/clusters_mgmt/v1/cluster_resource.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_resource.model rename to clientapi/model/clusters_mgmt/v1/cluster_resource.model diff --git a/model/clusters_mgmt/v1/cluster_state_type.model b/clientapi/model/clusters_mgmt/v1/cluster_state_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_state_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_state_type.model diff --git a/model/clusters_mgmt/v1/cluster_status_resource.model b/clientapi/model/clusters_mgmt/v1/cluster_status_resource.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_status_resource.model rename to clientapi/model/clusters_mgmt/v1/cluster_status_resource.model diff --git a/model/clusters_mgmt/v1/cluster_status_type.model b/clientapi/model/clusters_mgmt/v1/cluster_status_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_status_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_status_type.model diff --git a/model/clusters_mgmt/v1/cluster_type.model b/clientapi/model/clusters_mgmt/v1/cluster_type.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_type.model rename to clientapi/model/clusters_mgmt/v1/cluster_type.model diff --git a/model/clusters_mgmt/v1/cluster_vpc_resource.model b/clientapi/model/clusters_mgmt/v1/cluster_vpc_resource.model similarity index 100% rename from model/clusters_mgmt/v1/cluster_vpc_resource.model rename to clientapi/model/clusters_mgmt/v1/cluster_vpc_resource.model diff --git a/model/clusters_mgmt/v1/clusterdeployment_resource.model b/clientapi/model/clusters_mgmt/v1/clusterdeployment_resource.model similarity index 100% rename from model/clusters_mgmt/v1/clusterdeployment_resource.model rename to clientapi/model/clusters_mgmt/v1/clusterdeployment_resource.model diff --git a/model/clusters_mgmt/v1/clusters_resource.model b/clientapi/model/clusters_mgmt/v1/clusters_resource.model similarity index 100% rename from model/clusters_mgmt/v1/clusters_resource.model rename to clientapi/model/clusters_mgmt/v1/clusters_resource.model diff --git a/model/clusters_mgmt/v1/component_route_kind_type.model b/clientapi/model/clusters_mgmt/v1/component_route_kind_type.model similarity index 100% rename from model/clusters_mgmt/v1/component_route_kind_type.model rename to clientapi/model/clusters_mgmt/v1/component_route_kind_type.model diff --git a/model/clusters_mgmt/v1/component_route_type.model b/clientapi/model/clusters_mgmt/v1/component_route_type.model similarity index 100% rename from model/clusters_mgmt/v1/component_route_type.model rename to clientapi/model/clusters_mgmt/v1/component_route_type.model diff --git a/model/clusters_mgmt/v1/control_plane_resource.model b/clientapi/model/clusters_mgmt/v1/control_plane_resource.model similarity index 100% rename from model/clusters_mgmt/v1/control_plane_resource.model rename to clientapi/model/clusters_mgmt/v1/control_plane_resource.model diff --git a/model/clusters_mgmt/v1/control_plane_upgrade_policies_resource.model b/clientapi/model/clusters_mgmt/v1/control_plane_upgrade_policies_resource.model similarity index 100% rename from model/clusters_mgmt/v1/control_plane_upgrade_policies_resource.model rename to clientapi/model/clusters_mgmt/v1/control_plane_upgrade_policies_resource.model diff --git a/model/clusters_mgmt/v1/control_plane_upgrade_policy_resource.model b/clientapi/model/clusters_mgmt/v1/control_plane_upgrade_policy_resource.model similarity index 100% rename from model/clusters_mgmt/v1/control_plane_upgrade_policy_resource.model rename to clientapi/model/clusters_mgmt/v1/control_plane_upgrade_policy_resource.model diff --git a/model/clusters_mgmt/v1/control_plane_upgrade_policy_type.model b/clientapi/model/clusters_mgmt/v1/control_plane_upgrade_policy_type.model similarity index 100% rename from model/clusters_mgmt/v1/control_plane_upgrade_policy_type.model rename to clientapi/model/clusters_mgmt/v1/control_plane_upgrade_policy_type.model diff --git a/model/clusters_mgmt/v1/cpu_total_by_node_roles_os_metric_query_resource.model b/clientapi/model/clusters_mgmt/v1/cpu_total_by_node_roles_os_metric_query_resource.model similarity index 100% rename from model/clusters_mgmt/v1/cpu_total_by_node_roles_os_metric_query_resource.model rename to clientapi/model/clusters_mgmt/v1/cpu_total_by_node_roles_os_metric_query_resource.model diff --git a/model/clusters_mgmt/v1/cpu_total_node_role_os_metric_node_type.model b/clientapi/model/clusters_mgmt/v1/cpu_total_node_role_os_metric_node_type.model similarity index 100% rename from model/clusters_mgmt/v1/cpu_total_node_role_os_metric_node_type.model rename to clientapi/model/clusters_mgmt/v1/cpu_total_node_role_os_metric_node_type.model diff --git a/model/clusters_mgmt/v1/cpu_totals_node_role_os_metric_node_type.model b/clientapi/model/clusters_mgmt/v1/cpu_totals_node_role_os_metric_node_type.model similarity index 100% rename from model/clusters_mgmt/v1/cpu_totals_node_role_os_metric_node_type.model rename to clientapi/model/clusters_mgmt/v1/cpu_totals_node_role_os_metric_node_type.model diff --git a/model/clusters_mgmt/v1/credential_request_type.model b/clientapi/model/clusters_mgmt/v1/credential_request_type.model similarity index 100% rename from model/clusters_mgmt/v1/credential_request_type.model rename to clientapi/model/clusters_mgmt/v1/credential_request_type.model diff --git a/model/clusters_mgmt/v1/credentials_resource.model b/clientapi/model/clusters_mgmt/v1/credentials_resource.model similarity index 100% rename from model/clusters_mgmt/v1/credentials_resource.model rename to clientapi/model/clusters_mgmt/v1/credentials_resource.model diff --git a/model/clusters_mgmt/v1/delete_protection_resource.model b/clientapi/model/clusters_mgmt/v1/delete_protection_resource.model similarity index 100% rename from model/clusters_mgmt/v1/delete_protection_resource.model rename to clientapi/model/clusters_mgmt/v1/delete_protection_resource.model diff --git a/model/clusters_mgmt/v1/delete_protection_type.model b/clientapi/model/clusters_mgmt/v1/delete_protection_type.model similarity index 100% rename from model/clusters_mgmt/v1/delete_protection_type.model rename to clientapi/model/clusters_mgmt/v1/delete_protection_type.model diff --git a/model/clusters_mgmt/v1/dns_domain_resource.model b/clientapi/model/clusters_mgmt/v1/dns_domain_resource.model similarity index 100% rename from model/clusters_mgmt/v1/dns_domain_resource.model rename to clientapi/model/clusters_mgmt/v1/dns_domain_resource.model diff --git a/model/clusters_mgmt/v1/dns_domain_type.model b/clientapi/model/clusters_mgmt/v1/dns_domain_type.model similarity index 100% rename from model/clusters_mgmt/v1/dns_domain_type.model rename to clientapi/model/clusters_mgmt/v1/dns_domain_type.model diff --git a/model/clusters_mgmt/v1/dns_domains_resource.model b/clientapi/model/clusters_mgmt/v1/dns_domains_resource.model similarity index 100% rename from model/clusters_mgmt/v1/dns_domains_resource.model rename to clientapi/model/clusters_mgmt/v1/dns_domains_resource.model diff --git a/model/clusters_mgmt/v1/dns_type.model b/clientapi/model/clusters_mgmt/v1/dns_type.model similarity index 100% rename from model/clusters_mgmt/v1/dns_type.model rename to clientapi/model/clusters_mgmt/v1/dns_type.model diff --git a/clientapi/model/clusters_mgmt/v1/doc.go b/clientapi/model/clusters_mgmt/v1/doc.go new file mode 100644 index 00000000..f1a4b049 --- /dev/null +++ b/clientapi/model/clusters_mgmt/v1/doc.go @@ -0,0 +1,2 @@ +// this file exists so that it is possible to vendor the model into another go module for generating the client. +package v1 diff --git a/model/clusters_mgmt/v1/encryption_key_inquiry_type.model b/clientapi/model/clusters_mgmt/v1/encryption_key_inquiry_type.model similarity index 100% rename from model/clusters_mgmt/v1/encryption_key_inquiry_type.model rename to clientapi/model/clusters_mgmt/v1/encryption_key_inquiry_type.model diff --git a/model/clusters_mgmt/v1/encryption_keys_inquiry_resource.model b/clientapi/model/clusters_mgmt/v1/encryption_keys_inquiry_resource.model similarity index 100% rename from model/clusters_mgmt/v1/encryption_keys_inquiry_resource.model rename to clientapi/model/clusters_mgmt/v1/encryption_keys_inquiry_resource.model diff --git a/model/clusters_mgmt/v1/environment_resource.model b/clientapi/model/clusters_mgmt/v1/environment_resource.model similarity index 100% rename from model/clusters_mgmt/v1/environment_resource.model rename to clientapi/model/clusters_mgmt/v1/environment_resource.model diff --git a/model/clusters_mgmt/v1/environment_type.model b/clientapi/model/clusters_mgmt/v1/environment_type.model similarity index 100% rename from model/clusters_mgmt/v1/environment_type.model rename to clientapi/model/clusters_mgmt/v1/environment_type.model diff --git a/model/clusters_mgmt/v1/errors.model b/clientapi/model/clusters_mgmt/v1/errors.model similarity index 100% rename from model/clusters_mgmt/v1/errors.model rename to clientapi/model/clusters_mgmt/v1/errors.model diff --git a/model/clusters_mgmt/v1/event_type.model b/clientapi/model/clusters_mgmt/v1/event_type.model similarity index 100% rename from model/clusters_mgmt/v1/event_type.model rename to clientapi/model/clusters_mgmt/v1/event_type.model diff --git a/model/clusters_mgmt/v1/events_resource.model b/clientapi/model/clusters_mgmt/v1/events_resource.model similarity index 100% rename from model/clusters_mgmt/v1/events_resource.model rename to clientapi/model/clusters_mgmt/v1/events_resource.model diff --git a/model/clusters_mgmt/v1/external_auth_config_resource.model b/clientapi/model/clusters_mgmt/v1/external_auth_config_resource.model similarity index 100% rename from model/clusters_mgmt/v1/external_auth_config_resource.model rename to clientapi/model/clusters_mgmt/v1/external_auth_config_resource.model diff --git a/model/clusters_mgmt/v1/external_auth_config_type.model b/clientapi/model/clusters_mgmt/v1/external_auth_config_type.model similarity index 100% rename from model/clusters_mgmt/v1/external_auth_config_type.model rename to clientapi/model/clusters_mgmt/v1/external_auth_config_type.model diff --git a/model/clusters_mgmt/v1/external_auth_resource.model b/clientapi/model/clusters_mgmt/v1/external_auth_resource.model similarity index 100% rename from model/clusters_mgmt/v1/external_auth_resource.model rename to clientapi/model/clusters_mgmt/v1/external_auth_resource.model diff --git a/model/clusters_mgmt/v1/external_auth_type.model b/clientapi/model/clusters_mgmt/v1/external_auth_type.model similarity index 100% rename from model/clusters_mgmt/v1/external_auth_type.model rename to clientapi/model/clusters_mgmt/v1/external_auth_type.model diff --git a/model/clusters_mgmt/v1/external_auths_resource.model b/clientapi/model/clusters_mgmt/v1/external_auths_resource.model similarity index 100% rename from model/clusters_mgmt/v1/external_auths_resource.model rename to clientapi/model/clusters_mgmt/v1/external_auths_resource.model diff --git a/model/clusters_mgmt/v1/external_configuration_resource.model b/clientapi/model/clusters_mgmt/v1/external_configuration_resource.model similarity index 100% rename from model/clusters_mgmt/v1/external_configuration_resource.model rename to clientapi/model/clusters_mgmt/v1/external_configuration_resource.model diff --git a/model/clusters_mgmt/v1/external_configuration_type.model b/clientapi/model/clusters_mgmt/v1/external_configuration_type.model similarity index 100% rename from model/clusters_mgmt/v1/external_configuration_type.model rename to clientapi/model/clusters_mgmt/v1/external_configuration_type.model diff --git a/model/clusters_mgmt/v1/flavour_nodes_type.model b/clientapi/model/clusters_mgmt/v1/flavour_nodes_type.model similarity index 100% rename from model/clusters_mgmt/v1/flavour_nodes_type.model rename to clientapi/model/clusters_mgmt/v1/flavour_nodes_type.model diff --git a/model/clusters_mgmt/v1/flavour_resource.model b/clientapi/model/clusters_mgmt/v1/flavour_resource.model similarity index 100% rename from model/clusters_mgmt/v1/flavour_resource.model rename to clientapi/model/clusters_mgmt/v1/flavour_resource.model diff --git a/model/clusters_mgmt/v1/flavour_type.model b/clientapi/model/clusters_mgmt/v1/flavour_type.model similarity index 100% rename from model/clusters_mgmt/v1/flavour_type.model rename to clientapi/model/clusters_mgmt/v1/flavour_type.model diff --git a/model/clusters_mgmt/v1/flavours_resource.model b/clientapi/model/clusters_mgmt/v1/flavours_resource.model similarity index 100% rename from model/clusters_mgmt/v1/flavours_resource.model rename to clientapi/model/clusters_mgmt/v1/flavours_resource.model diff --git a/model/clusters_mgmt/v1/gcp_authentication_type.model b/clientapi/model/clusters_mgmt/v1/gcp_authentication_type.model similarity index 100% rename from model/clusters_mgmt/v1/gcp_authentication_type.model rename to clientapi/model/clusters_mgmt/v1/gcp_authentication_type.model diff --git a/model/clusters_mgmt/v1/gcp_encryption_key_type.model b/clientapi/model/clusters_mgmt/v1/gcp_encryption_key_type.model similarity index 100% rename from model/clusters_mgmt/v1/gcp_encryption_key_type.model rename to clientapi/model/clusters_mgmt/v1/gcp_encryption_key_type.model diff --git a/model/clusters_mgmt/v1/gcp_flavour_type.model b/clientapi/model/clusters_mgmt/v1/gcp_flavour_type.model similarity index 100% rename from model/clusters_mgmt/v1/gcp_flavour_type.model rename to clientapi/model/clusters_mgmt/v1/gcp_flavour_type.model diff --git a/model/clusters_mgmt/v1/gcp_image_override_type.model b/clientapi/model/clusters_mgmt/v1/gcp_image_override_type.model similarity index 100% rename from model/clusters_mgmt/v1/gcp_image_override_type.model rename to clientapi/model/clusters_mgmt/v1/gcp_image_override_type.model diff --git a/model/clusters_mgmt/v1/gcp_inquiries_resource.model b/clientapi/model/clusters_mgmt/v1/gcp_inquiries_resource.model similarity index 100% rename from model/clusters_mgmt/v1/gcp_inquiries_resource.model rename to clientapi/model/clusters_mgmt/v1/gcp_inquiries_resource.model diff --git a/model/clusters_mgmt/v1/gcp_machine_pool_type.model b/clientapi/model/clusters_mgmt/v1/gcp_machine_pool_type.model similarity index 100% rename from model/clusters_mgmt/v1/gcp_machine_pool_type.model rename to clientapi/model/clusters_mgmt/v1/gcp_machine_pool_type.model diff --git a/model/clusters_mgmt/v1/gcp_network_type.model b/clientapi/model/clusters_mgmt/v1/gcp_network_type.model similarity index 100% rename from model/clusters_mgmt/v1/gcp_network_type.model rename to clientapi/model/clusters_mgmt/v1/gcp_network_type.model diff --git a/model/clusters_mgmt/v1/gcp_private_service_connect_type.model b/clientapi/model/clusters_mgmt/v1/gcp_private_service_connect_type.model similarity index 100% rename from model/clusters_mgmt/v1/gcp_private_service_connect_type.model rename to clientapi/model/clusters_mgmt/v1/gcp_private_service_connect_type.model diff --git a/model/clusters_mgmt/v1/gcp_region_machine_types_resource.model b/clientapi/model/clusters_mgmt/v1/gcp_region_machine_types_resource.model similarity index 100% rename from model/clusters_mgmt/v1/gcp_region_machine_types_resource.model rename to clientapi/model/clusters_mgmt/v1/gcp_region_machine_types_resource.model diff --git a/model/clusters_mgmt/v1/gcp_resource.model b/clientapi/model/clusters_mgmt/v1/gcp_resource.model similarity index 100% rename from model/clusters_mgmt/v1/gcp_resource.model rename to clientapi/model/clusters_mgmt/v1/gcp_resource.model diff --git a/model/clusters_mgmt/v1/gcp_security_type.model b/clientapi/model/clusters_mgmt/v1/gcp_security_type.model similarity index 100% rename from model/clusters_mgmt/v1/gcp_security_type.model rename to clientapi/model/clusters_mgmt/v1/gcp_security_type.model diff --git a/model/clusters_mgmt/v1/gcp_type.model b/clientapi/model/clusters_mgmt/v1/gcp_type.model similarity index 100% rename from model/clusters_mgmt/v1/gcp_type.model rename to clientapi/model/clusters_mgmt/v1/gcp_type.model diff --git a/model/clusters_mgmt/v1/gcp_volume_type.model b/clientapi/model/clusters_mgmt/v1/gcp_volume_type.model similarity index 100% rename from model/clusters_mgmt/v1/gcp_volume_type.model rename to clientapi/model/clusters_mgmt/v1/gcp_volume_type.model diff --git a/model/clusters_mgmt/v1/group_resource.model b/clientapi/model/clusters_mgmt/v1/group_resource.model similarity index 100% rename from model/clusters_mgmt/v1/group_resource.model rename to clientapi/model/clusters_mgmt/v1/group_resource.model diff --git a/model/clusters_mgmt/v1/group_type.model b/clientapi/model/clusters_mgmt/v1/group_type.model similarity index 100% rename from model/clusters_mgmt/v1/group_type.model rename to clientapi/model/clusters_mgmt/v1/group_type.model diff --git a/model/clusters_mgmt/v1/groups_resource.model b/clientapi/model/clusters_mgmt/v1/groups_resource.model similarity index 100% rename from model/clusters_mgmt/v1/groups_resource.model rename to clientapi/model/clusters_mgmt/v1/groups_resource.model diff --git a/model/clusters_mgmt/v1/htpasswd_user_resource.model b/clientapi/model/clusters_mgmt/v1/htpasswd_user_resource.model similarity index 100% rename from model/clusters_mgmt/v1/htpasswd_user_resource.model rename to clientapi/model/clusters_mgmt/v1/htpasswd_user_resource.model diff --git a/model/clusters_mgmt/v1/htpasswd_user_type.model b/clientapi/model/clusters_mgmt/v1/htpasswd_user_type.model similarity index 100% rename from model/clusters_mgmt/v1/htpasswd_user_type.model rename to clientapi/model/clusters_mgmt/v1/htpasswd_user_type.model diff --git a/model/clusters_mgmt/v1/htpasswd_users_resource.model b/clientapi/model/clusters_mgmt/v1/htpasswd_users_resource.model similarity index 100% rename from model/clusters_mgmt/v1/htpasswd_users_resource.model rename to clientapi/model/clusters_mgmt/v1/htpasswd_users_resource.model diff --git a/model/clusters_mgmt/v1/hypershift_config_type.model b/clientapi/model/clusters_mgmt/v1/hypershift_config_type.model similarity index 100% rename from model/clusters_mgmt/v1/hypershift_config_type.model rename to clientapi/model/clusters_mgmt/v1/hypershift_config_type.model diff --git a/model/clusters_mgmt/v1/hypershift_resource.model b/clientapi/model/clusters_mgmt/v1/hypershift_resource.model similarity index 100% rename from model/clusters_mgmt/v1/hypershift_resource.model rename to clientapi/model/clusters_mgmt/v1/hypershift_resource.model diff --git a/model/clusters_mgmt/v1/hypershift_type.model b/clientapi/model/clusters_mgmt/v1/hypershift_type.model similarity index 100% rename from model/clusters_mgmt/v1/hypershift_type.model rename to clientapi/model/clusters_mgmt/v1/hypershift_type.model diff --git a/model/clusters_mgmt/v1/identity_provider_resource.model b/clientapi/model/clusters_mgmt/v1/identity_provider_resource.model similarity index 100% rename from model/clusters_mgmt/v1/identity_provider_resource.model rename to clientapi/model/clusters_mgmt/v1/identity_provider_resource.model diff --git a/model/clusters_mgmt/v1/identity_provider_type.model b/clientapi/model/clusters_mgmt/v1/identity_provider_type.model similarity index 100% rename from model/clusters_mgmt/v1/identity_provider_type.model rename to clientapi/model/clusters_mgmt/v1/identity_provider_type.model diff --git a/model/clusters_mgmt/v1/identity_providers_resource.model b/clientapi/model/clusters_mgmt/v1/identity_providers_resource.model similarity index 100% rename from model/clusters_mgmt/v1/identity_providers_resource.model rename to clientapi/model/clusters_mgmt/v1/identity_providers_resource.model diff --git a/model/clusters_mgmt/v1/image_overrides_type.model b/clientapi/model/clusters_mgmt/v1/image_overrides_type.model similarity index 100% rename from model/clusters_mgmt/v1/image_overrides_type.model rename to clientapi/model/clusters_mgmt/v1/image_overrides_type.model diff --git a/model/clusters_mgmt/v1/inflight_check_resource.model b/clientapi/model/clusters_mgmt/v1/inflight_check_resource.model similarity index 100% rename from model/clusters_mgmt/v1/inflight_check_resource.model rename to clientapi/model/clusters_mgmt/v1/inflight_check_resource.model diff --git a/model/clusters_mgmt/v1/inflight_check_state_type.model b/clientapi/model/clusters_mgmt/v1/inflight_check_state_type.model similarity index 100% rename from model/clusters_mgmt/v1/inflight_check_state_type.model rename to clientapi/model/clusters_mgmt/v1/inflight_check_state_type.model diff --git a/model/clusters_mgmt/v1/inflight_check_type.model b/clientapi/model/clusters_mgmt/v1/inflight_check_type.model similarity index 100% rename from model/clusters_mgmt/v1/inflight_check_type.model rename to clientapi/model/clusters_mgmt/v1/inflight_check_type.model diff --git a/model/clusters_mgmt/v1/inflight_checks_resource.model b/clientapi/model/clusters_mgmt/v1/inflight_checks_resource.model similarity index 100% rename from model/clusters_mgmt/v1/inflight_checks_resource.model rename to clientapi/model/clusters_mgmt/v1/inflight_checks_resource.model diff --git a/model/clusters_mgmt/v1/ingress_resource.model b/clientapi/model/clusters_mgmt/v1/ingress_resource.model similarity index 100% rename from model/clusters_mgmt/v1/ingress_resource.model rename to clientapi/model/clusters_mgmt/v1/ingress_resource.model diff --git a/model/clusters_mgmt/v1/ingress_type.model b/clientapi/model/clusters_mgmt/v1/ingress_type.model similarity index 100% rename from model/clusters_mgmt/v1/ingress_type.model rename to clientapi/model/clusters_mgmt/v1/ingress_type.model diff --git a/model/clusters_mgmt/v1/ingresses_resource.model b/clientapi/model/clusters_mgmt/v1/ingresses_resource.model similarity index 100% rename from model/clusters_mgmt/v1/ingresses_resource.model rename to clientapi/model/clusters_mgmt/v1/ingresses_resource.model diff --git a/model/clusters_mgmt/v1/instance_iam_roles.model b/clientapi/model/clusters_mgmt/v1/instance_iam_roles.model similarity index 100% rename from model/clusters_mgmt/v1/instance_iam_roles.model rename to clientapi/model/clusters_mgmt/v1/instance_iam_roles.model diff --git a/model/clusters_mgmt/v1/key_ring_inquiry_type.model b/clientapi/model/clusters_mgmt/v1/key_ring_inquiry_type.model similarity index 100% rename from model/clusters_mgmt/v1/key_ring_inquiry_type.model rename to clientapi/model/clusters_mgmt/v1/key_ring_inquiry_type.model diff --git a/model/clusters_mgmt/v1/key_rings_inquiry_resource.model b/clientapi/model/clusters_mgmt/v1/key_rings_inquiry_resource.model similarity index 100% rename from model/clusters_mgmt/v1/key_rings_inquiry_resource.model rename to clientapi/model/clusters_mgmt/v1/key_rings_inquiry_resource.model diff --git a/model/clusters_mgmt/v1/kubelet_config_resource.model b/clientapi/model/clusters_mgmt/v1/kubelet_config_resource.model similarity index 100% rename from model/clusters_mgmt/v1/kubelet_config_resource.model rename to clientapi/model/clusters_mgmt/v1/kubelet_config_resource.model diff --git a/model/clusters_mgmt/v1/kubelet_config_type.model b/clientapi/model/clusters_mgmt/v1/kubelet_config_type.model similarity index 100% rename from model/clusters_mgmt/v1/kubelet_config_type.model rename to clientapi/model/clusters_mgmt/v1/kubelet_config_type.model diff --git a/model/clusters_mgmt/v1/kubelet_configs_resource.model b/clientapi/model/clusters_mgmt/v1/kubelet_configs_resource.model similarity index 100% rename from model/clusters_mgmt/v1/kubelet_configs_resource.model rename to clientapi/model/clusters_mgmt/v1/kubelet_configs_resource.model diff --git a/model/clusters_mgmt/v1/label_resource.model b/clientapi/model/clusters_mgmt/v1/label_resource.model similarity index 100% rename from model/clusters_mgmt/v1/label_resource.model rename to clientapi/model/clusters_mgmt/v1/label_resource.model diff --git a/model/clusters_mgmt/v1/label_type.model b/clientapi/model/clusters_mgmt/v1/label_type.model similarity index 100% rename from model/clusters_mgmt/v1/label_type.model rename to clientapi/model/clusters_mgmt/v1/label_type.model diff --git a/model/clusters_mgmt/v1/labels_resource.model b/clientapi/model/clusters_mgmt/v1/labels_resource.model similarity index 100% rename from model/clusters_mgmt/v1/labels_resource.model rename to clientapi/model/clusters_mgmt/v1/labels_resource.model diff --git a/model/clusters_mgmt/v1/limited_support_reason_override_type.model b/clientapi/model/clusters_mgmt/v1/limited_support_reason_override_type.model similarity index 100% rename from model/clusters_mgmt/v1/limited_support_reason_override_type.model rename to clientapi/model/clusters_mgmt/v1/limited_support_reason_override_type.model diff --git a/model/clusters_mgmt/v1/limited_support_reason_resource.model b/clientapi/model/clusters_mgmt/v1/limited_support_reason_resource.model similarity index 100% rename from model/clusters_mgmt/v1/limited_support_reason_resource.model rename to clientapi/model/clusters_mgmt/v1/limited_support_reason_resource.model diff --git a/model/clusters_mgmt/v1/limited_support_reason_template_resource.model b/clientapi/model/clusters_mgmt/v1/limited_support_reason_template_resource.model similarity index 100% rename from model/clusters_mgmt/v1/limited_support_reason_template_resource.model rename to clientapi/model/clusters_mgmt/v1/limited_support_reason_template_resource.model diff --git a/model/clusters_mgmt/v1/limited_support_reason_template_type.model b/clientapi/model/clusters_mgmt/v1/limited_support_reason_template_type.model similarity index 100% rename from model/clusters_mgmt/v1/limited_support_reason_template_type.model rename to clientapi/model/clusters_mgmt/v1/limited_support_reason_template_type.model diff --git a/model/clusters_mgmt/v1/limited_support_reason_templates_resource.model b/clientapi/model/clusters_mgmt/v1/limited_support_reason_templates_resource.model similarity index 100% rename from model/clusters_mgmt/v1/limited_support_reason_templates_resource.model rename to clientapi/model/clusters_mgmt/v1/limited_support_reason_templates_resource.model diff --git a/model/clusters_mgmt/v1/limited_support_reason_type.model b/clientapi/model/clusters_mgmt/v1/limited_support_reason_type.model similarity index 100% rename from model/clusters_mgmt/v1/limited_support_reason_type.model rename to clientapi/model/clusters_mgmt/v1/limited_support_reason_type.model diff --git a/model/clusters_mgmt/v1/limited_support_reasons_resource.model b/clientapi/model/clusters_mgmt/v1/limited_support_reasons_resource.model similarity index 100% rename from model/clusters_mgmt/v1/limited_support_reasons_resource.model rename to clientapi/model/clusters_mgmt/v1/limited_support_reasons_resource.model diff --git a/model/clusters_mgmt/v1/listening_method_type.model b/clientapi/model/clusters_mgmt/v1/listening_method_type.model similarity index 100% rename from model/clusters_mgmt/v1/listening_method_type.model rename to clientapi/model/clusters_mgmt/v1/listening_method_type.model diff --git a/model/clusters_mgmt/v1/load_balancer_flavor_type.model b/clientapi/model/clusters_mgmt/v1/load_balancer_flavor_type.model similarity index 100% rename from model/clusters_mgmt/v1/load_balancer_flavor_type.model rename to clientapi/model/clusters_mgmt/v1/load_balancer_flavor_type.model diff --git a/model/clusters_mgmt/v1/load_balancer_quota_values_resource.model b/clientapi/model/clusters_mgmt/v1/load_balancer_quota_values_resource.model similarity index 100% rename from model/clusters_mgmt/v1/load_balancer_quota_values_resource.model rename to clientapi/model/clusters_mgmt/v1/load_balancer_quota_values_resource.model diff --git a/model/clusters_mgmt/v1/log_resource.model b/clientapi/model/clusters_mgmt/v1/log_resource.model similarity index 100% rename from model/clusters_mgmt/v1/log_resource.model rename to clientapi/model/clusters_mgmt/v1/log_resource.model diff --git a/model/clusters_mgmt/v1/log_type.model b/clientapi/model/clusters_mgmt/v1/log_type.model similarity index 100% rename from model/clusters_mgmt/v1/log_type.model rename to clientapi/model/clusters_mgmt/v1/log_type.model diff --git a/model/clusters_mgmt/v1/logs_resource.model b/clientapi/model/clusters_mgmt/v1/logs_resource.model similarity index 100% rename from model/clusters_mgmt/v1/logs_resource.model rename to clientapi/model/clusters_mgmt/v1/logs_resource.model diff --git a/model/clusters_mgmt/v1/machine_pool_autoscaling_type.model b/clientapi/model/clusters_mgmt/v1/machine_pool_autoscaling_type.model similarity index 100% rename from model/clusters_mgmt/v1/machine_pool_autoscaling_type.model rename to clientapi/model/clusters_mgmt/v1/machine_pool_autoscaling_type.model diff --git a/model/clusters_mgmt/v1/machine_pool_aws_security_group_filter_type.model b/clientapi/model/clusters_mgmt/v1/machine_pool_aws_security_group_filter_type.model similarity index 100% rename from model/clusters_mgmt/v1/machine_pool_aws_security_group_filter_type.model rename to clientapi/model/clusters_mgmt/v1/machine_pool_aws_security_group_filter_type.model diff --git a/model/clusters_mgmt/v1/machine_pool_resource.model b/clientapi/model/clusters_mgmt/v1/machine_pool_resource.model similarity index 100% rename from model/clusters_mgmt/v1/machine_pool_resource.model rename to clientapi/model/clusters_mgmt/v1/machine_pool_resource.model diff --git a/model/clusters_mgmt/v1/machine_pool_type.model b/clientapi/model/clusters_mgmt/v1/machine_pool_type.model similarity index 100% rename from model/clusters_mgmt/v1/machine_pool_type.model rename to clientapi/model/clusters_mgmt/v1/machine_pool_type.model diff --git a/model/clusters_mgmt/v1/machine_pools_resource.model b/clientapi/model/clusters_mgmt/v1/machine_pools_resource.model similarity index 100% rename from model/clusters_mgmt/v1/machine_pools_resource.model rename to clientapi/model/clusters_mgmt/v1/machine_pools_resource.model diff --git a/model/clusters_mgmt/v1/machine_type_category_type.model b/clientapi/model/clusters_mgmt/v1/machine_type_category_type.model similarity index 100% rename from model/clusters_mgmt/v1/machine_type_category_type.model rename to clientapi/model/clusters_mgmt/v1/machine_type_category_type.model diff --git a/model/clusters_mgmt/v1/machine_type_resource.model b/clientapi/model/clusters_mgmt/v1/machine_type_resource.model similarity index 100% rename from model/clusters_mgmt/v1/machine_type_resource.model rename to clientapi/model/clusters_mgmt/v1/machine_type_resource.model diff --git a/model/clusters_mgmt/v1/machine_type_size_type.model b/clientapi/model/clusters_mgmt/v1/machine_type_size_type.model similarity index 100% rename from model/clusters_mgmt/v1/machine_type_size_type.model rename to clientapi/model/clusters_mgmt/v1/machine_type_size_type.model diff --git a/model/clusters_mgmt/v1/machine_type_type.model b/clientapi/model/clusters_mgmt/v1/machine_type_type.model similarity index 100% rename from model/clusters_mgmt/v1/machine_type_type.model rename to clientapi/model/clusters_mgmt/v1/machine_type_type.model diff --git a/model/clusters_mgmt/v1/machine_types_resource.model b/clientapi/model/clusters_mgmt/v1/machine_types_resource.model similarity index 100% rename from model/clusters_mgmt/v1/machine_types_resource.model rename to clientapi/model/clusters_mgmt/v1/machine_types_resource.model diff --git a/model/clusters_mgmt/v1/managedservice_type.model b/clientapi/model/clusters_mgmt/v1/managedservice_type.model similarity index 100% rename from model/clusters_mgmt/v1/managedservice_type.model rename to clientapi/model/clusters_mgmt/v1/managedservice_type.model diff --git a/model/clusters_mgmt/v1/manifest_resource.model b/clientapi/model/clusters_mgmt/v1/manifest_resource.model similarity index 100% rename from model/clusters_mgmt/v1/manifest_resource.model rename to clientapi/model/clusters_mgmt/v1/manifest_resource.model diff --git a/model/clusters_mgmt/v1/manifest_type.model b/clientapi/model/clusters_mgmt/v1/manifest_type.model similarity index 100% rename from model/clusters_mgmt/v1/manifest_type.model rename to clientapi/model/clusters_mgmt/v1/manifest_type.model diff --git a/model/clusters_mgmt/v1/manifests_resource.model b/clientapi/model/clusters_mgmt/v1/manifests_resource.model similarity index 100% rename from model/clusters_mgmt/v1/manifests_resource.model rename to clientapi/model/clusters_mgmt/v1/manifests_resource.model diff --git a/model/clusters_mgmt/v1/metric_queries_resource.model b/clientapi/model/clusters_mgmt/v1/metric_queries_resource.model similarity index 100% rename from model/clusters_mgmt/v1/metric_queries_resource.model rename to clientapi/model/clusters_mgmt/v1/metric_queries_resource.model diff --git a/model/clusters_mgmt/v1/namespace_ownership_policy_type.model b/clientapi/model/clusters_mgmt/v1/namespace_ownership_policy_type.model similarity index 100% rename from model/clusters_mgmt/v1/namespace_ownership_policy_type.model rename to clientapi/model/clusters_mgmt/v1/namespace_ownership_policy_type.model diff --git a/model/clusters_mgmt/v1/network_type.model b/clientapi/model/clusters_mgmt/v1/network_type.model similarity index 100% rename from model/clusters_mgmt/v1/network_type.model rename to clientapi/model/clusters_mgmt/v1/network_type.model diff --git a/model/clusters_mgmt/v1/network_verification_resource.model b/clientapi/model/clusters_mgmt/v1/network_verification_resource.model similarity index 100% rename from model/clusters_mgmt/v1/network_verification_resource.model rename to clientapi/model/clusters_mgmt/v1/network_verification_resource.model diff --git a/model/clusters_mgmt/v1/network_verification_type.model b/clientapi/model/clusters_mgmt/v1/network_verification_type.model similarity index 100% rename from model/clusters_mgmt/v1/network_verification_type.model rename to clientapi/model/clusters_mgmt/v1/network_verification_type.model diff --git a/model/clusters_mgmt/v1/network_verifications_resource.model b/clientapi/model/clusters_mgmt/v1/network_verifications_resource.model similarity index 100% rename from model/clusters_mgmt/v1/network_verifications_resource.model rename to clientapi/model/clusters_mgmt/v1/network_verifications_resource.model diff --git a/model/clusters_mgmt/v1/node_info_type.model b/clientapi/model/clusters_mgmt/v1/node_info_type.model similarity index 100% rename from model/clusters_mgmt/v1/node_info_type.model rename to clientapi/model/clusters_mgmt/v1/node_info_type.model diff --git a/model/clusters_mgmt/v1/node_pool_autoscaling_type.model b/clientapi/model/clusters_mgmt/v1/node_pool_autoscaling_type.model similarity index 100% rename from model/clusters_mgmt/v1/node_pool_autoscaling_type.model rename to clientapi/model/clusters_mgmt/v1/node_pool_autoscaling_type.model diff --git a/model/clusters_mgmt/v1/node_pool_management_upgrade_type.model b/clientapi/model/clusters_mgmt/v1/node_pool_management_upgrade_type.model similarity index 100% rename from model/clusters_mgmt/v1/node_pool_management_upgrade_type.model rename to clientapi/model/clusters_mgmt/v1/node_pool_management_upgrade_type.model diff --git a/model/clusters_mgmt/v1/node_pool_resource.model b/clientapi/model/clusters_mgmt/v1/node_pool_resource.model similarity index 100% rename from model/clusters_mgmt/v1/node_pool_resource.model rename to clientapi/model/clusters_mgmt/v1/node_pool_resource.model diff --git a/model/clusters_mgmt/v1/node_pool_state_type.model b/clientapi/model/clusters_mgmt/v1/node_pool_state_type.model similarity index 100% rename from model/clusters_mgmt/v1/node_pool_state_type.model rename to clientapi/model/clusters_mgmt/v1/node_pool_state_type.model diff --git a/model/clusters_mgmt/v1/node_pool_status_type.model b/clientapi/model/clusters_mgmt/v1/node_pool_status_type.model similarity index 100% rename from model/clusters_mgmt/v1/node_pool_status_type.model rename to clientapi/model/clusters_mgmt/v1/node_pool_status_type.model diff --git a/model/clusters_mgmt/v1/node_pool_type.model b/clientapi/model/clusters_mgmt/v1/node_pool_type.model similarity index 100% rename from model/clusters_mgmt/v1/node_pool_type.model rename to clientapi/model/clusters_mgmt/v1/node_pool_type.model diff --git a/model/clusters_mgmt/v1/node_pool_upgrade_policies_resource.model b/clientapi/model/clusters_mgmt/v1/node_pool_upgrade_policies_resource.model similarity index 100% rename from model/clusters_mgmt/v1/node_pool_upgrade_policies_resource.model rename to clientapi/model/clusters_mgmt/v1/node_pool_upgrade_policies_resource.model diff --git a/model/clusters_mgmt/v1/node_pool_upgrade_policy_resource.model b/clientapi/model/clusters_mgmt/v1/node_pool_upgrade_policy_resource.model similarity index 100% rename from model/clusters_mgmt/v1/node_pool_upgrade_policy_resource.model rename to clientapi/model/clusters_mgmt/v1/node_pool_upgrade_policy_resource.model diff --git a/model/clusters_mgmt/v1/node_pool_upgrade_policy_type.model b/clientapi/model/clusters_mgmt/v1/node_pool_upgrade_policy_type.model similarity index 100% rename from model/clusters_mgmt/v1/node_pool_upgrade_policy_type.model rename to clientapi/model/clusters_mgmt/v1/node_pool_upgrade_policy_type.model diff --git a/model/clusters_mgmt/v1/node_pools_resource.model b/clientapi/model/clusters_mgmt/v1/node_pools_resource.model similarity index 100% rename from model/clusters_mgmt/v1/node_pools_resource.model rename to clientapi/model/clusters_mgmt/v1/node_pools_resource.model diff --git a/model/clusters_mgmt/v1/node_type.model b/clientapi/model/clusters_mgmt/v1/node_type.model similarity index 100% rename from model/clusters_mgmt/v1/node_type.model rename to clientapi/model/clusters_mgmt/v1/node_type.model diff --git a/model/clusters_mgmt/v1/nodes_info_type.model b/clientapi/model/clusters_mgmt/v1/nodes_info_type.model similarity index 100% rename from model/clusters_mgmt/v1/nodes_info_type.model rename to clientapi/model/clusters_mgmt/v1/nodes_info_type.model diff --git a/model/clusters_mgmt/v1/nodes_metric_query_resource.model b/clientapi/model/clusters_mgmt/v1/nodes_metric_query_resource.model similarity index 100% rename from model/clusters_mgmt/v1/nodes_metric_query_resource.model rename to clientapi/model/clusters_mgmt/v1/nodes_metric_query_resource.model diff --git a/model/clusters_mgmt/v1/oidc_config_resource.model b/clientapi/model/clusters_mgmt/v1/oidc_config_resource.model similarity index 100% rename from model/clusters_mgmt/v1/oidc_config_resource.model rename to clientapi/model/clusters_mgmt/v1/oidc_config_resource.model diff --git a/model/clusters_mgmt/v1/oidc_config_type.model b/clientapi/model/clusters_mgmt/v1/oidc_config_type.model similarity index 100% rename from model/clusters_mgmt/v1/oidc_config_type.model rename to clientapi/model/clusters_mgmt/v1/oidc_config_type.model diff --git a/model/clusters_mgmt/v1/oidc_configs_resource.model b/clientapi/model/clusters_mgmt/v1/oidc_configs_resource.model similarity index 100% rename from model/clusters_mgmt/v1/oidc_configs_resource.model rename to clientapi/model/clusters_mgmt/v1/oidc_configs_resource.model diff --git a/model/clusters_mgmt/v1/oidc_thumbprint_input_type.model b/clientapi/model/clusters_mgmt/v1/oidc_thumbprint_input_type.model similarity index 100% rename from model/clusters_mgmt/v1/oidc_thumbprint_input_type.model rename to clientapi/model/clusters_mgmt/v1/oidc_thumbprint_input_type.model diff --git a/model/clusters_mgmt/v1/oidc_thumbprint_resource.model b/clientapi/model/clusters_mgmt/v1/oidc_thumbprint_resource.model similarity index 100% rename from model/clusters_mgmt/v1/oidc_thumbprint_resource.model rename to clientapi/model/clusters_mgmt/v1/oidc_thumbprint_resource.model diff --git a/model/clusters_mgmt/v1/oidc_thumbprint_type.model b/clientapi/model/clusters_mgmt/v1/oidc_thumbprint_type.model similarity index 100% rename from model/clusters_mgmt/v1/oidc_thumbprint_type.model rename to clientapi/model/clusters_mgmt/v1/oidc_thumbprint_type.model diff --git a/model/clusters_mgmt/v1/operator_iam_role_resource.model b/clientapi/model/clusters_mgmt/v1/operator_iam_role_resource.model similarity index 100% rename from model/clusters_mgmt/v1/operator_iam_role_resource.model rename to clientapi/model/clusters_mgmt/v1/operator_iam_role_resource.model diff --git a/model/clusters_mgmt/v1/operator_iam_role_type.model b/clientapi/model/clusters_mgmt/v1/operator_iam_role_type.model similarity index 100% rename from model/clusters_mgmt/v1/operator_iam_role_type.model rename to clientapi/model/clusters_mgmt/v1/operator_iam_role_type.model diff --git a/model/clusters_mgmt/v1/operator_iam_roles_resource.model b/clientapi/model/clusters_mgmt/v1/operator_iam_roles_resource.model similarity index 100% rename from model/clusters_mgmt/v1/operator_iam_roles_resource.model rename to clientapi/model/clusters_mgmt/v1/operator_iam_roles_resource.model diff --git a/model/clusters_mgmt/v1/organization_link_type.model b/clientapi/model/clusters_mgmt/v1/organization_link_type.model similarity index 100% rename from model/clusters_mgmt/v1/organization_link_type.model rename to clientapi/model/clusters_mgmt/v1/organization_link_type.model diff --git a/model/clusters_mgmt/v1/pending_delete_cluster_resource.model b/clientapi/model/clusters_mgmt/v1/pending_delete_cluster_resource.model similarity index 100% rename from model/clusters_mgmt/v1/pending_delete_cluster_resource.model rename to clientapi/model/clusters_mgmt/v1/pending_delete_cluster_resource.model diff --git a/model/clusters_mgmt/v1/pending_delete_cluster_type.model b/clientapi/model/clusters_mgmt/v1/pending_delete_cluster_type.model similarity index 100% rename from model/clusters_mgmt/v1/pending_delete_cluster_type.model rename to clientapi/model/clusters_mgmt/v1/pending_delete_cluster_type.model diff --git a/model/clusters_mgmt/v1/pending_delete_clusters_resource.model b/clientapi/model/clusters_mgmt/v1/pending_delete_clusters_resource.model similarity index 100% rename from model/clusters_mgmt/v1/pending_delete_clusters_resource.model rename to clientapi/model/clusters_mgmt/v1/pending_delete_clusters_resource.model diff --git a/model/clusters_mgmt/v1/platform_type.model b/clientapi/model/clusters_mgmt/v1/platform_type.model similarity index 100% rename from model/clusters_mgmt/v1/platform_type.model rename to clientapi/model/clusters_mgmt/v1/platform_type.model diff --git a/model/clusters_mgmt/v1/private_link_cluster_configuration_type.model b/clientapi/model/clusters_mgmt/v1/private_link_cluster_configuration_type.model similarity index 100% rename from model/clusters_mgmt/v1/private_link_cluster_configuration_type.model rename to clientapi/model/clusters_mgmt/v1/private_link_cluster_configuration_type.model diff --git a/model/clusters_mgmt/v1/private_link_configuration_principal_resource.model b/clientapi/model/clusters_mgmt/v1/private_link_configuration_principal_resource.model similarity index 100% rename from model/clusters_mgmt/v1/private_link_configuration_principal_resource.model rename to clientapi/model/clusters_mgmt/v1/private_link_configuration_principal_resource.model diff --git a/model/clusters_mgmt/v1/private_link_configuration_principal_type.model b/clientapi/model/clusters_mgmt/v1/private_link_configuration_principal_type.model similarity index 100% rename from model/clusters_mgmt/v1/private_link_configuration_principal_type.model rename to clientapi/model/clusters_mgmt/v1/private_link_configuration_principal_type.model diff --git a/model/clusters_mgmt/v1/private_link_configuration_principals_resource.model b/clientapi/model/clusters_mgmt/v1/private_link_configuration_principals_resource.model similarity index 100% rename from model/clusters_mgmt/v1/private_link_configuration_principals_resource.model rename to clientapi/model/clusters_mgmt/v1/private_link_configuration_principals_resource.model diff --git a/model/clusters_mgmt/v1/private_link_configuration_principals_type.model b/clientapi/model/clusters_mgmt/v1/private_link_configuration_principals_type.model similarity index 100% rename from model/clusters_mgmt/v1/private_link_configuration_principals_type.model rename to clientapi/model/clusters_mgmt/v1/private_link_configuration_principals_type.model diff --git a/model/clusters_mgmt/v1/private_link_configuration_resource.model b/clientapi/model/clusters_mgmt/v1/private_link_configuration_resource.model similarity index 100% rename from model/clusters_mgmt/v1/private_link_configuration_resource.model rename to clientapi/model/clusters_mgmt/v1/private_link_configuration_resource.model diff --git a/model/clusters_mgmt/v1/private_link_configuration_type.model b/clientapi/model/clusters_mgmt/v1/private_link_configuration_type.model similarity index 100% rename from model/clusters_mgmt/v1/private_link_configuration_type.model rename to clientapi/model/clusters_mgmt/v1/private_link_configuration_type.model diff --git a/model/clusters_mgmt/v1/processor_type_type.model b/clientapi/model/clusters_mgmt/v1/processor_type_type.model similarity index 100% rename from model/clusters_mgmt/v1/processor_type_type.model rename to clientapi/model/clusters_mgmt/v1/processor_type_type.model diff --git a/model/clusters_mgmt/v1/product_minimal_version_resource.model b/clientapi/model/clusters_mgmt/v1/product_minimal_version_resource.model similarity index 100% rename from model/clusters_mgmt/v1/product_minimal_version_resource.model rename to clientapi/model/clusters_mgmt/v1/product_minimal_version_resource.model diff --git a/model/clusters_mgmt/v1/product_minimal_version_type.model b/clientapi/model/clusters_mgmt/v1/product_minimal_version_type.model similarity index 100% rename from model/clusters_mgmt/v1/product_minimal_version_type.model rename to clientapi/model/clusters_mgmt/v1/product_minimal_version_type.model diff --git a/model/clusters_mgmt/v1/product_minimal_versions_resource.model b/clientapi/model/clusters_mgmt/v1/product_minimal_versions_resource.model similarity index 100% rename from model/clusters_mgmt/v1/product_minimal_versions_resource.model rename to clientapi/model/clusters_mgmt/v1/product_minimal_versions_resource.model diff --git a/model/clusters_mgmt/v1/product_resource.model b/clientapi/model/clusters_mgmt/v1/product_resource.model similarity index 100% rename from model/clusters_mgmt/v1/product_resource.model rename to clientapi/model/clusters_mgmt/v1/product_resource.model diff --git a/model/clusters_mgmt/v1/product_technology_preview_resource.model b/clientapi/model/clusters_mgmt/v1/product_technology_preview_resource.model similarity index 100% rename from model/clusters_mgmt/v1/product_technology_preview_resource.model rename to clientapi/model/clusters_mgmt/v1/product_technology_preview_resource.model diff --git a/model/clusters_mgmt/v1/product_technology_preview_type.model b/clientapi/model/clusters_mgmt/v1/product_technology_preview_type.model similarity index 100% rename from model/clusters_mgmt/v1/product_technology_preview_type.model rename to clientapi/model/clusters_mgmt/v1/product_technology_preview_type.model diff --git a/model/clusters_mgmt/v1/product_technology_previews_resource.model b/clientapi/model/clusters_mgmt/v1/product_technology_previews_resource.model similarity index 100% rename from model/clusters_mgmt/v1/product_technology_previews_resource.model rename to clientapi/model/clusters_mgmt/v1/product_technology_previews_resource.model diff --git a/model/clusters_mgmt/v1/product_type.model b/clientapi/model/clusters_mgmt/v1/product_type.model similarity index 100% rename from model/clusters_mgmt/v1/product_type.model rename to clientapi/model/clusters_mgmt/v1/product_type.model diff --git a/model/clusters_mgmt/v1/products_resource.model b/clientapi/model/clusters_mgmt/v1/products_resource.model similarity index 100% rename from model/clusters_mgmt/v1/products_resource.model rename to clientapi/model/clusters_mgmt/v1/products_resource.model diff --git a/model/clusters_mgmt/v1/provider_data_inquiry_type.model b/clientapi/model/clusters_mgmt/v1/provider_data_inquiry_type.model similarity index 100% rename from model/clusters_mgmt/v1/provider_data_inquiry_type.model rename to clientapi/model/clusters_mgmt/v1/provider_data_inquiry_type.model diff --git a/model/clusters_mgmt/v1/provision_shard_resource.model b/clientapi/model/clusters_mgmt/v1/provision_shard_resource.model similarity index 100% rename from model/clusters_mgmt/v1/provision_shard_resource.model rename to clientapi/model/clusters_mgmt/v1/provision_shard_resource.model diff --git a/model/clusters_mgmt/v1/provision_shard_topology_type.model b/clientapi/model/clusters_mgmt/v1/provision_shard_topology_type.model similarity index 100% rename from model/clusters_mgmt/v1/provision_shard_topology_type.model rename to clientapi/model/clusters_mgmt/v1/provision_shard_topology_type.model diff --git a/model/clusters_mgmt/v1/provision_shard_type.model b/clientapi/model/clusters_mgmt/v1/provision_shard_type.model similarity index 100% rename from model/clusters_mgmt/v1/provision_shard_type.model rename to clientapi/model/clusters_mgmt/v1/provision_shard_type.model diff --git a/model/clusters_mgmt/v1/provision_shards_resource.model b/clientapi/model/clusters_mgmt/v1/provision_shards_resource.model similarity index 100% rename from model/clusters_mgmt/v1/provision_shards_resource.model rename to clientapi/model/clusters_mgmt/v1/provision_shards_resource.model diff --git a/model/clusters_mgmt/v1/proxy_type.model b/clientapi/model/clusters_mgmt/v1/proxy_type.model similarity index 100% rename from model/clusters_mgmt/v1/proxy_type.model rename to clientapi/model/clusters_mgmt/v1/proxy_type.model diff --git a/model/clusters_mgmt/v1/registry_allowlist_resource.model b/clientapi/model/clusters_mgmt/v1/registry_allowlist_resource.model similarity index 100% rename from model/clusters_mgmt/v1/registry_allowlist_resource.model rename to clientapi/model/clusters_mgmt/v1/registry_allowlist_resource.model diff --git a/model/clusters_mgmt/v1/registry_allowlist_type.model b/clientapi/model/clusters_mgmt/v1/registry_allowlist_type.model similarity index 100% rename from model/clusters_mgmt/v1/registry_allowlist_type.model rename to clientapi/model/clusters_mgmt/v1/registry_allowlist_type.model diff --git a/model/clusters_mgmt/v1/registry_allowlists_resource.model b/clientapi/model/clusters_mgmt/v1/registry_allowlists_resource.model similarity index 100% rename from model/clusters_mgmt/v1/registry_allowlists_resource.model rename to clientapi/model/clusters_mgmt/v1/registry_allowlists_resource.model diff --git a/model/clusters_mgmt/v1/release_image_details_type.model b/clientapi/model/clusters_mgmt/v1/release_image_details_type.model similarity index 100% rename from model/clusters_mgmt/v1/release_image_details_type.model rename to clientapi/model/clusters_mgmt/v1/release_image_details_type.model diff --git a/model/clusters_mgmt/v1/release_images_type.model b/clientapi/model/clusters_mgmt/v1/release_images_type.model similarity index 100% rename from model/clusters_mgmt/v1/release_images_type.model rename to clientapi/model/clusters_mgmt/v1/release_images_type.model diff --git a/model/clusters_mgmt/v1/resource_range_type.model b/clientapi/model/clusters_mgmt/v1/resource_range_type.model similarity index 100% rename from model/clusters_mgmt/v1/resource_range_type.model rename to clientapi/model/clusters_mgmt/v1/resource_range_type.model diff --git a/model/clusters_mgmt/v1/resource_resource.model b/clientapi/model/clusters_mgmt/v1/resource_resource.model similarity index 100% rename from model/clusters_mgmt/v1/resource_resource.model rename to clientapi/model/clusters_mgmt/v1/resource_resource.model diff --git a/model/clusters_mgmt/v1/resource_type.model b/clientapi/model/clusters_mgmt/v1/resource_type.model similarity index 100% rename from model/clusters_mgmt/v1/resource_type.model rename to clientapi/model/clusters_mgmt/v1/resource_type.model diff --git a/model/clusters_mgmt/v1/resources_resource.model b/clientapi/model/clusters_mgmt/v1/resources_resource.model similarity index 100% rename from model/clusters_mgmt/v1/resources_resource.model rename to clientapi/model/clusters_mgmt/v1/resources_resource.model diff --git a/model/clusters_mgmt/v1/role_policy_binding_status_type.model b/clientapi/model/clusters_mgmt/v1/role_policy_binding_status_type.model similarity index 100% rename from model/clusters_mgmt/v1/role_policy_binding_status_type.model rename to clientapi/model/clusters_mgmt/v1/role_policy_binding_status_type.model diff --git a/model/clusters_mgmt/v1/role_policy_binding_type.model b/clientapi/model/clusters_mgmt/v1/role_policy_binding_type.model similarity index 100% rename from model/clusters_mgmt/v1/role_policy_binding_type.model rename to clientapi/model/clusters_mgmt/v1/role_policy_binding_type.model diff --git a/model/clusters_mgmt/v1/role_policy_bindings_resource.model b/clientapi/model/clusters_mgmt/v1/role_policy_bindings_resource.model similarity index 100% rename from model/clusters_mgmt/v1/role_policy_bindings_resource.model rename to clientapi/model/clusters_mgmt/v1/role_policy_bindings_resource.model diff --git a/model/clusters_mgmt/v1/role_policy_type.model b/clientapi/model/clusters_mgmt/v1/role_policy_type.model similarity index 100% rename from model/clusters_mgmt/v1/role_policy_type.model rename to clientapi/model/clusters_mgmt/v1/role_policy_type.model diff --git a/model/clusters_mgmt/v1/root_resource.model b/clientapi/model/clusters_mgmt/v1/root_resource.model similarity index 100% rename from model/clusters_mgmt/v1/root_resource.model rename to clientapi/model/clusters_mgmt/v1/root_resource.model diff --git a/model/clusters_mgmt/v1/sdn_to_ovn_cluster_migration_type.model b/clientapi/model/clusters_mgmt/v1/sdn_to_ovn_cluster_migration_type.model similarity index 100% rename from model/clusters_mgmt/v1/sdn_to_ovn_cluster_migration_type.model rename to clientapi/model/clusters_mgmt/v1/sdn_to_ovn_cluster_migration_type.model diff --git a/model/clusters_mgmt/v1/server_config_type.model b/clientapi/model/clusters_mgmt/v1/server_config_type.model similarity index 100% rename from model/clusters_mgmt/v1/server_config_type.model rename to clientapi/model/clusters_mgmt/v1/server_config_type.model diff --git a/model/clusters_mgmt/v1/socket_total_by_node_roles_os_metric_query_resource.model b/clientapi/model/clusters_mgmt/v1/socket_total_by_node_roles_os_metric_query_resource.model similarity index 100% rename from model/clusters_mgmt/v1/socket_total_by_node_roles_os_metric_query_resource.model rename to clientapi/model/clusters_mgmt/v1/socket_total_by_node_roles_os_metric_query_resource.model diff --git a/model/clusters_mgmt/v1/socket_total_node_role_os_metric_node_type.model b/clientapi/model/clusters_mgmt/v1/socket_total_node_role_os_metric_node_type.model similarity index 100% rename from model/clusters_mgmt/v1/socket_total_node_role_os_metric_node_type.model rename to clientapi/model/clusters_mgmt/v1/socket_total_node_role_os_metric_node_type.model diff --git a/model/clusters_mgmt/v1/socket_totals_node_role_os_metric_node_type.model b/clientapi/model/clusters_mgmt/v1/socket_totals_node_role_os_metric_node_type.model similarity index 100% rename from model/clusters_mgmt/v1/socket_totals_node_role_os_metric_node_type.model rename to clientapi/model/clusters_mgmt/v1/socket_totals_node_role_os_metric_node_type.model diff --git a/model/clusters_mgmt/v1/storage_quota_type.model b/clientapi/model/clusters_mgmt/v1/storage_quota_type.model similarity index 100% rename from model/clusters_mgmt/v1/storage_quota_type.model rename to clientapi/model/clusters_mgmt/v1/storage_quota_type.model diff --git a/model/clusters_mgmt/v1/storage_quota_values_resource.model b/clientapi/model/clusters_mgmt/v1/storage_quota_values_resource.model similarity index 100% rename from model/clusters_mgmt/v1/storage_quota_values_resource.model rename to clientapi/model/clusters_mgmt/v1/storage_quota_values_resource.model diff --git a/model/clusters_mgmt/v1/sts_credential_request_type.model b/clientapi/model/clusters_mgmt/v1/sts_credential_request_type.model similarity index 100% rename from model/clusters_mgmt/v1/sts_credential_request_type.model rename to clientapi/model/clusters_mgmt/v1/sts_credential_request_type.model diff --git a/model/clusters_mgmt/v1/sts_credential_requests_inquiry_resource.model b/clientapi/model/clusters_mgmt/v1/sts_credential_requests_inquiry_resource.model similarity index 100% rename from model/clusters_mgmt/v1/sts_credential_requests_inquiry_resource.model rename to clientapi/model/clusters_mgmt/v1/sts_credential_requests_inquiry_resource.model diff --git a/model/clusters_mgmt/v1/sts_operator_type.model b/clientapi/model/clusters_mgmt/v1/sts_operator_type.model similarity index 100% rename from model/clusters_mgmt/v1/sts_operator_type.model rename to clientapi/model/clusters_mgmt/v1/sts_operator_type.model diff --git a/model/clusters_mgmt/v1/sts_support_jump_role_resource.model b/clientapi/model/clusters_mgmt/v1/sts_support_jump_role_resource.model similarity index 100% rename from model/clusters_mgmt/v1/sts_support_jump_role_resource.model rename to clientapi/model/clusters_mgmt/v1/sts_support_jump_role_resource.model diff --git a/model/clusters_mgmt/v1/sts_support_jump_role_type.model b/clientapi/model/clusters_mgmt/v1/sts_support_jump_role_type.model similarity index 100% rename from model/clusters_mgmt/v1/sts_support_jump_role_type.model rename to clientapi/model/clusters_mgmt/v1/sts_support_jump_role_type.model diff --git a/model/clusters_mgmt/v1/sts_type.model b/clientapi/model/clusters_mgmt/v1/sts_type.model similarity index 100% rename from model/clusters_mgmt/v1/sts_type.model rename to clientapi/model/clusters_mgmt/v1/sts_type.model diff --git a/model/clusters_mgmt/v1/subnet_network_verification_type.model b/clientapi/model/clusters_mgmt/v1/subnet_network_verification_type.model similarity index 100% rename from model/clusters_mgmt/v1/subnet_network_verification_type.model rename to clientapi/model/clusters_mgmt/v1/subnet_network_verification_type.model diff --git a/model/clusters_mgmt/v1/subscription_type.model b/clientapi/model/clusters_mgmt/v1/subscription_type.model similarity index 100% rename from model/clusters_mgmt/v1/subscription_type.model rename to clientapi/model/clusters_mgmt/v1/subscription_type.model diff --git a/model/clusters_mgmt/v1/syncset_resource.model b/clientapi/model/clusters_mgmt/v1/syncset_resource.model similarity index 100% rename from model/clusters_mgmt/v1/syncset_resource.model rename to clientapi/model/clusters_mgmt/v1/syncset_resource.model diff --git a/model/clusters_mgmt/v1/syncset_type.model b/clientapi/model/clusters_mgmt/v1/syncset_type.model similarity index 100% rename from model/clusters_mgmt/v1/syncset_type.model rename to clientapi/model/clusters_mgmt/v1/syncset_type.model diff --git a/model/clusters_mgmt/v1/syncsets_resource.model b/clientapi/model/clusters_mgmt/v1/syncsets_resource.model similarity index 100% rename from model/clusters_mgmt/v1/syncsets_resource.model rename to clientapi/model/clusters_mgmt/v1/syncsets_resource.model diff --git a/model/clusters_mgmt/v1/taint_type.model b/clientapi/model/clusters_mgmt/v1/taint_type.model similarity index 100% rename from model/clusters_mgmt/v1/taint_type.model rename to clientapi/model/clusters_mgmt/v1/taint_type.model diff --git a/model/clusters_mgmt/v1/trusted_ip_resource.model b/clientapi/model/clusters_mgmt/v1/trusted_ip_resource.model similarity index 100% rename from model/clusters_mgmt/v1/trusted_ip_resource.model rename to clientapi/model/clusters_mgmt/v1/trusted_ip_resource.model diff --git a/model/clusters_mgmt/v1/trusted_ips_resource.model b/clientapi/model/clusters_mgmt/v1/trusted_ips_resource.model similarity index 100% rename from model/clusters_mgmt/v1/trusted_ips_resource.model rename to clientapi/model/clusters_mgmt/v1/trusted_ips_resource.model diff --git a/model/clusters_mgmt/v1/trusted_ips_type.model b/clientapi/model/clusters_mgmt/v1/trusted_ips_type.model similarity index 100% rename from model/clusters_mgmt/v1/trusted_ips_type.model rename to clientapi/model/clusters_mgmt/v1/trusted_ips_type.model diff --git a/model/clusters_mgmt/v1/tuning_config_resource.model b/clientapi/model/clusters_mgmt/v1/tuning_config_resource.model similarity index 100% rename from model/clusters_mgmt/v1/tuning_config_resource.model rename to clientapi/model/clusters_mgmt/v1/tuning_config_resource.model diff --git a/model/clusters_mgmt/v1/tuning_config_type.model b/clientapi/model/clusters_mgmt/v1/tuning_config_type.model similarity index 100% rename from model/clusters_mgmt/v1/tuning_config_type.model rename to clientapi/model/clusters_mgmt/v1/tuning_config_type.model diff --git a/model/clusters_mgmt/v1/tuning_configs_resource.model b/clientapi/model/clusters_mgmt/v1/tuning_configs_resource.model similarity index 100% rename from model/clusters_mgmt/v1/tuning_configs_resource.model rename to clientapi/model/clusters_mgmt/v1/tuning_configs_resource.model diff --git a/model/clusters_mgmt/v1/upgrade_policies_resource.model b/clientapi/model/clusters_mgmt/v1/upgrade_policies_resource.model similarity index 100% rename from model/clusters_mgmt/v1/upgrade_policies_resource.model rename to clientapi/model/clusters_mgmt/v1/upgrade_policies_resource.model diff --git a/model/clusters_mgmt/v1/upgrade_policy_resource.model b/clientapi/model/clusters_mgmt/v1/upgrade_policy_resource.model similarity index 100% rename from model/clusters_mgmt/v1/upgrade_policy_resource.model rename to clientapi/model/clusters_mgmt/v1/upgrade_policy_resource.model diff --git a/model/clusters_mgmt/v1/upgrade_policy_schedule_type.model b/clientapi/model/clusters_mgmt/v1/upgrade_policy_schedule_type.model similarity index 100% rename from model/clusters_mgmt/v1/upgrade_policy_schedule_type.model rename to clientapi/model/clusters_mgmt/v1/upgrade_policy_schedule_type.model diff --git a/model/clusters_mgmt/v1/upgrade_policy_state_resource.model b/clientapi/model/clusters_mgmt/v1/upgrade_policy_state_resource.model similarity index 100% rename from model/clusters_mgmt/v1/upgrade_policy_state_resource.model rename to clientapi/model/clusters_mgmt/v1/upgrade_policy_state_resource.model diff --git a/model/clusters_mgmt/v1/upgrade_policy_state_type.model b/clientapi/model/clusters_mgmt/v1/upgrade_policy_state_type.model similarity index 100% rename from model/clusters_mgmt/v1/upgrade_policy_state_type.model rename to clientapi/model/clusters_mgmt/v1/upgrade_policy_state_type.model diff --git a/model/clusters_mgmt/v1/upgrade_policy_type.model b/clientapi/model/clusters_mgmt/v1/upgrade_policy_type.model similarity index 100% rename from model/clusters_mgmt/v1/upgrade_policy_type.model rename to clientapi/model/clusters_mgmt/v1/upgrade_policy_type.model diff --git a/model/clusters_mgmt/v1/upgrade_policy_upgrade_type.model b/clientapi/model/clusters_mgmt/v1/upgrade_policy_upgrade_type.model similarity index 100% rename from model/clusters_mgmt/v1/upgrade_policy_upgrade_type.model rename to clientapi/model/clusters_mgmt/v1/upgrade_policy_upgrade_type.model diff --git a/model/clusters_mgmt/v1/user_resource.model b/clientapi/model/clusters_mgmt/v1/user_resource.model similarity index 100% rename from model/clusters_mgmt/v1/user_resource.model rename to clientapi/model/clusters_mgmt/v1/user_resource.model diff --git a/model/clusters_mgmt/v1/user_type.model b/clientapi/model/clusters_mgmt/v1/user_type.model similarity index 100% rename from model/clusters_mgmt/v1/user_type.model rename to clientapi/model/clusters_mgmt/v1/user_type.model diff --git a/model/clusters_mgmt/v1/users_resource.model b/clientapi/model/clusters_mgmt/v1/users_resource.model similarity index 100% rename from model/clusters_mgmt/v1/users_resource.model rename to clientapi/model/clusters_mgmt/v1/users_resource.model diff --git a/model/clusters_mgmt/v1/value_type.model b/clientapi/model/clusters_mgmt/v1/value_type.model similarity index 100% rename from model/clusters_mgmt/v1/value_type.model rename to clientapi/model/clusters_mgmt/v1/value_type.model diff --git a/model/clusters_mgmt/v1/version_gate_agreement_resource.model b/clientapi/model/clusters_mgmt/v1/version_gate_agreement_resource.model similarity index 100% rename from model/clusters_mgmt/v1/version_gate_agreement_resource.model rename to clientapi/model/clusters_mgmt/v1/version_gate_agreement_resource.model diff --git a/model/clusters_mgmt/v1/version_gate_agreement_type.model b/clientapi/model/clusters_mgmt/v1/version_gate_agreement_type.model similarity index 100% rename from model/clusters_mgmt/v1/version_gate_agreement_type.model rename to clientapi/model/clusters_mgmt/v1/version_gate_agreement_type.model diff --git a/model/clusters_mgmt/v1/version_gate_agreements_resource.model b/clientapi/model/clusters_mgmt/v1/version_gate_agreements_resource.model similarity index 100% rename from model/clusters_mgmt/v1/version_gate_agreements_resource.model rename to clientapi/model/clusters_mgmt/v1/version_gate_agreements_resource.model diff --git a/model/clusters_mgmt/v1/version_gate_resource.model b/clientapi/model/clusters_mgmt/v1/version_gate_resource.model similarity index 100% rename from model/clusters_mgmt/v1/version_gate_resource.model rename to clientapi/model/clusters_mgmt/v1/version_gate_resource.model diff --git a/model/clusters_mgmt/v1/version_gate_type.model b/clientapi/model/clusters_mgmt/v1/version_gate_type.model similarity index 100% rename from model/clusters_mgmt/v1/version_gate_type.model rename to clientapi/model/clusters_mgmt/v1/version_gate_type.model diff --git a/model/clusters_mgmt/v1/version_gates_resource.model b/clientapi/model/clusters_mgmt/v1/version_gates_resource.model similarity index 100% rename from model/clusters_mgmt/v1/version_gates_resource.model rename to clientapi/model/clusters_mgmt/v1/version_gates_resource.model diff --git a/model/clusters_mgmt/v1/version_resource.model b/clientapi/model/clusters_mgmt/v1/version_resource.model similarity index 100% rename from model/clusters_mgmt/v1/version_resource.model rename to clientapi/model/clusters_mgmt/v1/version_resource.model diff --git a/model/clusters_mgmt/v1/version_type.model b/clientapi/model/clusters_mgmt/v1/version_type.model similarity index 100% rename from model/clusters_mgmt/v1/version_type.model rename to clientapi/model/clusters_mgmt/v1/version_type.model diff --git a/model/clusters_mgmt/v1/versions_resource.model b/clientapi/model/clusters_mgmt/v1/versions_resource.model similarity index 100% rename from model/clusters_mgmt/v1/versions_resource.model rename to clientapi/model/clusters_mgmt/v1/versions_resource.model diff --git a/model/clusters_mgmt/v1/vpc_inquiry_type.model b/clientapi/model/clusters_mgmt/v1/vpc_inquiry_type.model similarity index 100% rename from model/clusters_mgmt/v1/vpc_inquiry_type.model rename to clientapi/model/clusters_mgmt/v1/vpc_inquiry_type.model diff --git a/model/clusters_mgmt/v1/vpcs_inquiry_resource.model b/clientapi/model/clusters_mgmt/v1/vpcs_inquiry_resource.model similarity index 100% rename from model/clusters_mgmt/v1/vpcs_inquiry_resource.model rename to clientapi/model/clusters_mgmt/v1/vpcs_inquiry_resource.model diff --git a/model/clusters_mgmt/v1/wif_config_resource.model b/clientapi/model/clusters_mgmt/v1/wif_config_resource.model similarity index 100% rename from model/clusters_mgmt/v1/wif_config_resource.model rename to clientapi/model/clusters_mgmt/v1/wif_config_resource.model diff --git a/model/clusters_mgmt/v1/wif_config_status_resource.model b/clientapi/model/clusters_mgmt/v1/wif_config_status_resource.model similarity index 100% rename from model/clusters_mgmt/v1/wif_config_status_resource.model rename to clientapi/model/clusters_mgmt/v1/wif_config_status_resource.model diff --git a/model/clusters_mgmt/v1/wif_config_status_type.model b/clientapi/model/clusters_mgmt/v1/wif_config_status_type.model similarity index 100% rename from model/clusters_mgmt/v1/wif_config_status_type.model rename to clientapi/model/clusters_mgmt/v1/wif_config_status_type.model diff --git a/model/clusters_mgmt/v1/wif_config_type.model b/clientapi/model/clusters_mgmt/v1/wif_config_type.model similarity index 100% rename from model/clusters_mgmt/v1/wif_config_type.model rename to clientapi/model/clusters_mgmt/v1/wif_config_type.model diff --git a/model/clusters_mgmt/v1/wif_configs_resources.model b/clientapi/model/clusters_mgmt/v1/wif_configs_resources.model similarity index 100% rename from model/clusters_mgmt/v1/wif_configs_resources.model rename to clientapi/model/clusters_mgmt/v1/wif_configs_resources.model diff --git a/model/clusters_mgmt/v1/wif_service_account_type.model b/clientapi/model/clusters_mgmt/v1/wif_service_account_type.model similarity index 100% rename from model/clusters_mgmt/v1/wif_service_account_type.model rename to clientapi/model/clusters_mgmt/v1/wif_service_account_type.model diff --git a/model/clusters_mgmt/v1/wif_support_type.model b/clientapi/model/clusters_mgmt/v1/wif_support_type.model similarity index 100% rename from model/clusters_mgmt/v1/wif_support_type.model rename to clientapi/model/clusters_mgmt/v1/wif_support_type.model diff --git a/model/clusters_mgmt/v1/wildcard_policy_type.model b/clientapi/model/clusters_mgmt/v1/wildcard_policy_type.model similarity index 100% rename from model/clusters_mgmt/v1/wildcard_policy_type.model rename to clientapi/model/clusters_mgmt/v1/wildcard_policy_type.model diff --git a/clientapi/model/job_queue/v1/doc.go b/clientapi/model/job_queue/v1/doc.go new file mode 100644 index 00000000..f1a4b049 --- /dev/null +++ b/clientapi/model/job_queue/v1/doc.go @@ -0,0 +1,2 @@ +// this file exists so that it is possible to vendor the model into another go module for generating the client. +package v1 diff --git a/model/job_queue/v1/job_resource.model b/clientapi/model/job_queue/v1/job_resource.model similarity index 100% rename from model/job_queue/v1/job_resource.model rename to clientapi/model/job_queue/v1/job_resource.model diff --git a/model/job_queue/v1/job_type.model b/clientapi/model/job_queue/v1/job_type.model similarity index 100% rename from model/job_queue/v1/job_type.model rename to clientapi/model/job_queue/v1/job_type.model diff --git a/model/job_queue/v1/jobs_resource.model b/clientapi/model/job_queue/v1/jobs_resource.model similarity index 100% rename from model/job_queue/v1/jobs_resource.model rename to clientapi/model/job_queue/v1/jobs_resource.model diff --git a/model/job_queue/v1/queue_resource.model b/clientapi/model/job_queue/v1/queue_resource.model similarity index 100% rename from model/job_queue/v1/queue_resource.model rename to clientapi/model/job_queue/v1/queue_resource.model diff --git a/model/job_queue/v1/queue_type.model b/clientapi/model/job_queue/v1/queue_type.model similarity index 100% rename from model/job_queue/v1/queue_type.model rename to clientapi/model/job_queue/v1/queue_type.model diff --git a/model/job_queue/v1/queues_resource.model b/clientapi/model/job_queue/v1/queues_resource.model similarity index 100% rename from model/job_queue/v1/queues_resource.model rename to clientapi/model/job_queue/v1/queues_resource.model diff --git a/model/job_queue/v1/root_resource.model b/clientapi/model/job_queue/v1/root_resource.model similarity index 100% rename from model/job_queue/v1/root_resource.model rename to clientapi/model/job_queue/v1/root_resource.model diff --git a/model/osd_fleet_mgmt/v1/cluster_management_reference_type.model b/clientapi/model/osd_fleet_mgmt/v1/cluster_management_reference_type.model similarity index 100% rename from model/osd_fleet_mgmt/v1/cluster_management_reference_type.model rename to clientapi/model/osd_fleet_mgmt/v1/cluster_management_reference_type.model diff --git a/model/osd_fleet_mgmt/v1/dns_type.model b/clientapi/model/osd_fleet_mgmt/v1/dns_type.model similarity index 100% rename from model/osd_fleet_mgmt/v1/dns_type.model rename to clientapi/model/osd_fleet_mgmt/v1/dns_type.model diff --git a/clientapi/model/osd_fleet_mgmt/v1/doc.go b/clientapi/model/osd_fleet_mgmt/v1/doc.go new file mode 100644 index 00000000..f1a4b049 --- /dev/null +++ b/clientapi/model/osd_fleet_mgmt/v1/doc.go @@ -0,0 +1,2 @@ +// this file exists so that it is possible to vendor the model into another go module for generating the client. +package v1 diff --git a/model/osd_fleet_mgmt/v1/label_reference_type.model b/clientapi/model/osd_fleet_mgmt/v1/label_reference_type.model similarity index 100% rename from model/osd_fleet_mgmt/v1/label_reference_type.model rename to clientapi/model/osd_fleet_mgmt/v1/label_reference_type.model diff --git a/model/osd_fleet_mgmt/v1/label_request_payload.model b/clientapi/model/osd_fleet_mgmt/v1/label_request_payload.model similarity index 100% rename from model/osd_fleet_mgmt/v1/label_request_payload.model rename to clientapi/model/osd_fleet_mgmt/v1/label_request_payload.model diff --git a/model/osd_fleet_mgmt/v1/label_resource.model b/clientapi/model/osd_fleet_mgmt/v1/label_resource.model similarity index 100% rename from model/osd_fleet_mgmt/v1/label_resource.model rename to clientapi/model/osd_fleet_mgmt/v1/label_resource.model diff --git a/model/osd_fleet_mgmt/v1/label_type.model b/clientapi/model/osd_fleet_mgmt/v1/label_type.model similarity index 100% rename from model/osd_fleet_mgmt/v1/label_type.model rename to clientapi/model/osd_fleet_mgmt/v1/label_type.model diff --git a/model/osd_fleet_mgmt/v1/labels_resource.model b/clientapi/model/osd_fleet_mgmt/v1/labels_resource.model similarity index 100% rename from model/osd_fleet_mgmt/v1/labels_resource.model rename to clientapi/model/osd_fleet_mgmt/v1/labels_resource.model diff --git a/model/osd_fleet_mgmt/v1/management_cluster_parent_type.model b/clientapi/model/osd_fleet_mgmt/v1/management_cluster_parent_type.model similarity index 100% rename from model/osd_fleet_mgmt/v1/management_cluster_parent_type.model rename to clientapi/model/osd_fleet_mgmt/v1/management_cluster_parent_type.model diff --git a/model/osd_fleet_mgmt/v1/management_cluster_request_payload.model b/clientapi/model/osd_fleet_mgmt/v1/management_cluster_request_payload.model similarity index 100% rename from model/osd_fleet_mgmt/v1/management_cluster_request_payload.model rename to clientapi/model/osd_fleet_mgmt/v1/management_cluster_request_payload.model diff --git a/model/osd_fleet_mgmt/v1/management_cluster_resource.model b/clientapi/model/osd_fleet_mgmt/v1/management_cluster_resource.model similarity index 100% rename from model/osd_fleet_mgmt/v1/management_cluster_resource.model rename to clientapi/model/osd_fleet_mgmt/v1/management_cluster_resource.model diff --git a/model/osd_fleet_mgmt/v1/management_cluster_type.model b/clientapi/model/osd_fleet_mgmt/v1/management_cluster_type.model similarity index 100% rename from model/osd_fleet_mgmt/v1/management_cluster_type.model rename to clientapi/model/osd_fleet_mgmt/v1/management_cluster_type.model diff --git a/model/osd_fleet_mgmt/v1/management_clusters_resource.model b/clientapi/model/osd_fleet_mgmt/v1/management_clusters_resource.model similarity index 100% rename from model/osd_fleet_mgmt/v1/management_clusters_resource.model rename to clientapi/model/osd_fleet_mgmt/v1/management_clusters_resource.model diff --git a/model/osd_fleet_mgmt/v1/provision_shard_reference_type.model b/clientapi/model/osd_fleet_mgmt/v1/provision_shard_reference_type.model similarity index 100% rename from model/osd_fleet_mgmt/v1/provision_shard_reference_type.model rename to clientapi/model/osd_fleet_mgmt/v1/provision_shard_reference_type.model diff --git a/model/osd_fleet_mgmt/v1/root_resource.model b/clientapi/model/osd_fleet_mgmt/v1/root_resource.model similarity index 100% rename from model/osd_fleet_mgmt/v1/root_resource.model rename to clientapi/model/osd_fleet_mgmt/v1/root_resource.model diff --git a/model/osd_fleet_mgmt/v1/service_cluster_request_payload.model b/clientapi/model/osd_fleet_mgmt/v1/service_cluster_request_payload.model similarity index 100% rename from model/osd_fleet_mgmt/v1/service_cluster_request_payload.model rename to clientapi/model/osd_fleet_mgmt/v1/service_cluster_request_payload.model diff --git a/model/osd_fleet_mgmt/v1/service_cluster_resource.model b/clientapi/model/osd_fleet_mgmt/v1/service_cluster_resource.model similarity index 100% rename from model/osd_fleet_mgmt/v1/service_cluster_resource.model rename to clientapi/model/osd_fleet_mgmt/v1/service_cluster_resource.model diff --git a/model/osd_fleet_mgmt/v1/service_cluster_type.model b/clientapi/model/osd_fleet_mgmt/v1/service_cluster_type.model similarity index 100% rename from model/osd_fleet_mgmt/v1/service_cluster_type.model rename to clientapi/model/osd_fleet_mgmt/v1/service_cluster_type.model diff --git a/model/osd_fleet_mgmt/v1/service_clusters_resource.model b/clientapi/model/osd_fleet_mgmt/v1/service_clusters_resource.model similarity index 100% rename from model/osd_fleet_mgmt/v1/service_clusters_resource.model rename to clientapi/model/osd_fleet_mgmt/v1/service_clusters_resource.model diff --git a/model/service_logs/v1/cluster_log_resource.model b/clientapi/model/service_logs/v1/cluster_log_resource.model similarity index 100% rename from model/service_logs/v1/cluster_log_resource.model rename to clientapi/model/service_logs/v1/cluster_log_resource.model diff --git a/model/service_logs/v1/cluster_log_type.model b/clientapi/model/service_logs/v1/cluster_log_type.model similarity index 100% rename from model/service_logs/v1/cluster_log_type.model rename to clientapi/model/service_logs/v1/cluster_log_type.model diff --git a/model/service_logs/v1/cluster_logs_resource.model b/clientapi/model/service_logs/v1/cluster_logs_resource.model similarity index 100% rename from model/service_logs/v1/cluster_logs_resource.model rename to clientapi/model/service_logs/v1/cluster_logs_resource.model diff --git a/model/service_logs/v1/cluster_logs_uuid_resource.model b/clientapi/model/service_logs/v1/cluster_logs_uuid_resource.model similarity index 100% rename from model/service_logs/v1/cluster_logs_uuid_resource.model rename to clientapi/model/service_logs/v1/cluster_logs_uuid_resource.model diff --git a/model/service_logs/v1/cluster_resource.model b/clientapi/model/service_logs/v1/cluster_resource.model similarity index 100% rename from model/service_logs/v1/cluster_resource.model rename to clientapi/model/service_logs/v1/cluster_resource.model diff --git a/model/service_logs/v1/clusters_cluster_logs_resource.model b/clientapi/model/service_logs/v1/clusters_cluster_logs_resource.model similarity index 100% rename from model/service_logs/v1/clusters_cluster_logs_resource.model rename to clientapi/model/service_logs/v1/clusters_cluster_logs_resource.model diff --git a/model/service_logs/v1/clusters_resource.model b/clientapi/model/service_logs/v1/clusters_resource.model similarity index 100% rename from model/service_logs/v1/clusters_resource.model rename to clientapi/model/service_logs/v1/clusters_resource.model diff --git a/clientapi/model/service_logs/v1/doc.go b/clientapi/model/service_logs/v1/doc.go new file mode 100644 index 00000000..f1a4b049 --- /dev/null +++ b/clientapi/model/service_logs/v1/doc.go @@ -0,0 +1,2 @@ +// this file exists so that it is possible to vendor the model into another go module for generating the client. +package v1 diff --git a/model/service_logs/v1/log_type_type.model b/clientapi/model/service_logs/v1/log_type_type.model similarity index 100% rename from model/service_logs/v1/log_type_type.model rename to clientapi/model/service_logs/v1/log_type_type.model diff --git a/model/service_logs/v1/root_resource.model b/clientapi/model/service_logs/v1/root_resource.model similarity index 100% rename from model/service_logs/v1/root_resource.model rename to clientapi/model/service_logs/v1/root_resource.model diff --git a/model/service_mgmt/v1/aws_type.model b/clientapi/model/service_mgmt/v1/aws_type.model similarity index 100% rename from model/service_mgmt/v1/aws_type.model rename to clientapi/model/service_mgmt/v1/aws_type.model diff --git a/model/service_mgmt/v1/cloud_region_type.model b/clientapi/model/service_mgmt/v1/cloud_region_type.model similarity index 100% rename from model/service_mgmt/v1/cloud_region_type.model rename to clientapi/model/service_mgmt/v1/cloud_region_type.model diff --git a/model/service_mgmt/v1/cluster_api_type.model b/clientapi/model/service_mgmt/v1/cluster_api_type.model similarity index 100% rename from model/service_mgmt/v1/cluster_api_type.model rename to clientapi/model/service_mgmt/v1/cluster_api_type.model diff --git a/model/service_mgmt/v1/cluster_nodes_type.model b/clientapi/model/service_mgmt/v1/cluster_nodes_type.model similarity index 100% rename from model/service_mgmt/v1/cluster_nodes_type.model rename to clientapi/model/service_mgmt/v1/cluster_nodes_type.model diff --git a/model/service_mgmt/v1/cluster_type.model b/clientapi/model/service_mgmt/v1/cluster_type.model similarity index 100% rename from model/service_mgmt/v1/cluster_type.model rename to clientapi/model/service_mgmt/v1/cluster_type.model diff --git a/clientapi/model/service_mgmt/v1/doc.go b/clientapi/model/service_mgmt/v1/doc.go new file mode 100644 index 00000000..f1a4b049 --- /dev/null +++ b/clientapi/model/service_mgmt/v1/doc.go @@ -0,0 +1,2 @@ +// this file exists so that it is possible to vendor the model into another go module for generating the client. +package v1 diff --git a/model/service_mgmt/v1/instance_iam_roles_type.model b/clientapi/model/service_mgmt/v1/instance_iam_roles_type.model similarity index 100% rename from model/service_mgmt/v1/instance_iam_roles_type.model rename to clientapi/model/service_mgmt/v1/instance_iam_roles_type.model diff --git a/model/service_mgmt/v1/listening_method_type.model b/clientapi/model/service_mgmt/v1/listening_method_type.model similarity index 100% rename from model/service_mgmt/v1/listening_method_type.model rename to clientapi/model/service_mgmt/v1/listening_method_type.model diff --git a/model/service_mgmt/v1/managed_service_type.model b/clientapi/model/service_mgmt/v1/managed_service_type.model similarity index 100% rename from model/service_mgmt/v1/managed_service_type.model rename to clientapi/model/service_mgmt/v1/managed_service_type.model diff --git a/model/service_mgmt/v1/network_type.model b/clientapi/model/service_mgmt/v1/network_type.model similarity index 100% rename from model/service_mgmt/v1/network_type.model rename to clientapi/model/service_mgmt/v1/network_type.model diff --git a/model/service_mgmt/v1/operator_iam_role_type.model b/clientapi/model/service_mgmt/v1/operator_iam_role_type.model similarity index 100% rename from model/service_mgmt/v1/operator_iam_role_type.model rename to clientapi/model/service_mgmt/v1/operator_iam_role_type.model diff --git a/model/service_mgmt/v1/root_resource.model b/clientapi/model/service_mgmt/v1/root_resource.model similarity index 100% rename from model/service_mgmt/v1/root_resource.model rename to clientapi/model/service_mgmt/v1/root_resource.model diff --git a/model/service_mgmt/v1/service_parameter_type.model b/clientapi/model/service_mgmt/v1/service_parameter_type.model similarity index 100% rename from model/service_mgmt/v1/service_parameter_type.model rename to clientapi/model/service_mgmt/v1/service_parameter_type.model diff --git a/model/service_mgmt/v1/service_resource.model b/clientapi/model/service_mgmt/v1/service_resource.model similarity index 100% rename from model/service_mgmt/v1/service_resource.model rename to clientapi/model/service_mgmt/v1/service_resource.model diff --git a/model/service_mgmt/v1/services_resource.model b/clientapi/model/service_mgmt/v1/services_resource.model similarity index 100% rename from model/service_mgmt/v1/services_resource.model rename to clientapi/model/service_mgmt/v1/services_resource.model diff --git a/model/service_mgmt/v1/stateful_object_type.model b/clientapi/model/service_mgmt/v1/stateful_object_type.model similarity index 100% rename from model/service_mgmt/v1/stateful_object_type.model rename to clientapi/model/service_mgmt/v1/stateful_object_type.model diff --git a/model/service_mgmt/v1/sts_type.model b/clientapi/model/service_mgmt/v1/sts_type.model similarity index 100% rename from model/service_mgmt/v1/sts_type.model rename to clientapi/model/service_mgmt/v1/sts_type.model diff --git a/model/service_mgmt/v1/version_inquiry_request_type.model b/clientapi/model/service_mgmt/v1/version_inquiry_request_type.model similarity index 100% rename from model/service_mgmt/v1/version_inquiry_request_type.model rename to clientapi/model/service_mgmt/v1/version_inquiry_request_type.model diff --git a/model/service_mgmt/v1/version_inquiry_resource.model b/clientapi/model/service_mgmt/v1/version_inquiry_resource.model similarity index 100% rename from model/service_mgmt/v1/version_inquiry_resource.model rename to clientapi/model/service_mgmt/v1/version_inquiry_resource.model diff --git a/model/service_mgmt/v1/version_inquiry_response_type.model b/clientapi/model/service_mgmt/v1/version_inquiry_response_type.model similarity index 100% rename from model/service_mgmt/v1/version_inquiry_response_type.model rename to clientapi/model/service_mgmt/v1/version_inquiry_response_type.model diff --git a/model/status_board/v1/application_dependencies_resource.model b/clientapi/model/status_board/v1/application_dependencies_resource.model similarity index 100% rename from model/status_board/v1/application_dependencies_resource.model rename to clientapi/model/status_board/v1/application_dependencies_resource.model diff --git a/model/status_board/v1/application_dependency_resource.model b/clientapi/model/status_board/v1/application_dependency_resource.model similarity index 100% rename from model/status_board/v1/application_dependency_resource.model rename to clientapi/model/status_board/v1/application_dependency_resource.model diff --git a/model/status_board/v1/application_dependency_type.model b/clientapi/model/status_board/v1/application_dependency_type.model similarity index 100% rename from model/status_board/v1/application_dependency_type.model rename to clientapi/model/status_board/v1/application_dependency_type.model diff --git a/model/status_board/v1/application_resource.model b/clientapi/model/status_board/v1/application_resource.model similarity index 100% rename from model/status_board/v1/application_resource.model rename to clientapi/model/status_board/v1/application_resource.model diff --git a/model/status_board/v1/application_type.model b/clientapi/model/status_board/v1/application_type.model similarity index 100% rename from model/status_board/v1/application_type.model rename to clientapi/model/status_board/v1/application_type.model diff --git a/model/status_board/v1/applications_resource.model b/clientapi/model/status_board/v1/applications_resource.model similarity index 100% rename from model/status_board/v1/applications_resource.model rename to clientapi/model/status_board/v1/applications_resource.model diff --git a/clientapi/model/status_board/v1/doc.go b/clientapi/model/status_board/v1/doc.go new file mode 100644 index 00000000..f1a4b049 --- /dev/null +++ b/clientapi/model/status_board/v1/doc.go @@ -0,0 +1,2 @@ +// this file exists so that it is possible to vendor the model into another go module for generating the client. +package v1 diff --git a/model/status_board/v1/error_resource.model b/clientapi/model/status_board/v1/error_resource.model similarity index 100% rename from model/status_board/v1/error_resource.model rename to clientapi/model/status_board/v1/error_resource.model diff --git a/model/status_board/v1/error_type.model b/clientapi/model/status_board/v1/error_type.model similarity index 100% rename from model/status_board/v1/error_type.model rename to clientapi/model/status_board/v1/error_type.model diff --git a/model/status_board/v1/errors_resource.model b/clientapi/model/status_board/v1/errors_resource.model similarity index 100% rename from model/status_board/v1/errors_resource.model rename to clientapi/model/status_board/v1/errors_resource.model diff --git a/model/status_board/v1/owner_type.model b/clientapi/model/status_board/v1/owner_type.model similarity index 100% rename from model/status_board/v1/owner_type.model rename to clientapi/model/status_board/v1/owner_type.model diff --git a/model/status_board/v1/peer_dependencies_resource.model b/clientapi/model/status_board/v1/peer_dependencies_resource.model similarity index 100% rename from model/status_board/v1/peer_dependencies_resource.model rename to clientapi/model/status_board/v1/peer_dependencies_resource.model diff --git a/model/status_board/v1/peer_dependency_resource.model b/clientapi/model/status_board/v1/peer_dependency_resource.model similarity index 100% rename from model/status_board/v1/peer_dependency_resource.model rename to clientapi/model/status_board/v1/peer_dependency_resource.model diff --git a/model/status_board/v1/peer_dependency_type.model b/clientapi/model/status_board/v1/peer_dependency_type.model similarity index 100% rename from model/status_board/v1/peer_dependency_type.model rename to clientapi/model/status_board/v1/peer_dependency_type.model diff --git a/model/status_board/v1/product_resource.model b/clientapi/model/status_board/v1/product_resource.model similarity index 100% rename from model/status_board/v1/product_resource.model rename to clientapi/model/status_board/v1/product_resource.model diff --git a/model/status_board/v1/product_type.model b/clientapi/model/status_board/v1/product_type.model similarity index 100% rename from model/status_board/v1/product_type.model rename to clientapi/model/status_board/v1/product_type.model diff --git a/model/status_board/v1/products_resource.model b/clientapi/model/status_board/v1/products_resource.model similarity index 100% rename from model/status_board/v1/products_resource.model rename to clientapi/model/status_board/v1/products_resource.model diff --git a/model/status_board/v1/root_resource.model b/clientapi/model/status_board/v1/root_resource.model similarity index 100% rename from model/status_board/v1/root_resource.model rename to clientapi/model/status_board/v1/root_resource.model diff --git a/model/status_board/v1/service_dependencies_resource.model b/clientapi/model/status_board/v1/service_dependencies_resource.model similarity index 100% rename from model/status_board/v1/service_dependencies_resource.model rename to clientapi/model/status_board/v1/service_dependencies_resource.model diff --git a/model/status_board/v1/service_dependency_resource.model b/clientapi/model/status_board/v1/service_dependency_resource.model similarity index 100% rename from model/status_board/v1/service_dependency_resource.model rename to clientapi/model/status_board/v1/service_dependency_resource.model diff --git a/model/status_board/v1/service_dependency_type.model b/clientapi/model/status_board/v1/service_dependency_type.model similarity index 100% rename from model/status_board/v1/service_dependency_type.model rename to clientapi/model/status_board/v1/service_dependency_type.model diff --git a/model/status_board/v1/service_info_type.model b/clientapi/model/status_board/v1/service_info_type.model similarity index 100% rename from model/status_board/v1/service_info_type.model rename to clientapi/model/status_board/v1/service_info_type.model diff --git a/model/status_board/v1/service_resource.model b/clientapi/model/status_board/v1/service_resource.model similarity index 100% rename from model/status_board/v1/service_resource.model rename to clientapi/model/status_board/v1/service_resource.model diff --git a/model/status_board/v1/service_type.model b/clientapi/model/status_board/v1/service_type.model similarity index 100% rename from model/status_board/v1/service_type.model rename to clientapi/model/status_board/v1/service_type.model diff --git a/model/status_board/v1/services_resource.model b/clientapi/model/status_board/v1/services_resource.model similarity index 100% rename from model/status_board/v1/services_resource.model rename to clientapi/model/status_board/v1/services_resource.model diff --git a/model/status_board/v1/status_resource.model b/clientapi/model/status_board/v1/status_resource.model similarity index 100% rename from model/status_board/v1/status_resource.model rename to clientapi/model/status_board/v1/status_resource.model diff --git a/model/status_board/v1/status_type.model b/clientapi/model/status_board/v1/status_type.model similarity index 100% rename from model/status_board/v1/status_type.model rename to clientapi/model/status_board/v1/status_type.model diff --git a/model/status_board/v1/status_update_resource.model b/clientapi/model/status_board/v1/status_update_resource.model similarity index 100% rename from model/status_board/v1/status_update_resource.model rename to clientapi/model/status_board/v1/status_update_resource.model diff --git a/model/status_board/v1/status_update_type.model b/clientapi/model/status_board/v1/status_update_type.model similarity index 100% rename from model/status_board/v1/status_update_type.model rename to clientapi/model/status_board/v1/status_update_type.model diff --git a/model/status_board/v1/status_updates_resource.model b/clientapi/model/status_board/v1/status_updates_resource.model similarity index 100% rename from model/status_board/v1/status_updates_resource.model rename to clientapi/model/status_board/v1/status_updates_resource.model diff --git a/model/status_board/v1/statuses_resource.model b/clientapi/model/status_board/v1/statuses_resource.model similarity index 100% rename from model/status_board/v1/statuses_resource.model rename to clientapi/model/status_board/v1/statuses_resource.model diff --git a/model/web_rca/v1/attachment_resource.model b/clientapi/model/web_rca/v1/attachment_resource.model similarity index 100% rename from model/web_rca/v1/attachment_resource.model rename to clientapi/model/web_rca/v1/attachment_resource.model diff --git a/model/web_rca/v1/attachment_type.model b/clientapi/model/web_rca/v1/attachment_type.model similarity index 100% rename from model/web_rca/v1/attachment_type.model rename to clientapi/model/web_rca/v1/attachment_type.model diff --git a/model/web_rca/v1/attachments_resource.model b/clientapi/model/web_rca/v1/attachments_resource.model similarity index 100% rename from model/web_rca/v1/attachments_resource.model rename to clientapi/model/web_rca/v1/attachments_resource.model diff --git a/clientapi/model/web_rca/v1/doc.go b/clientapi/model/web_rca/v1/doc.go new file mode 100644 index 00000000..f1a4b049 --- /dev/null +++ b/clientapi/model/web_rca/v1/doc.go @@ -0,0 +1,2 @@ +// this file exists so that it is possible to vendor the model into another go module for generating the client. +package v1 diff --git a/model/web_rca/v1/error_resource.model b/clientapi/model/web_rca/v1/error_resource.model similarity index 100% rename from model/web_rca/v1/error_resource.model rename to clientapi/model/web_rca/v1/error_resource.model diff --git a/model/web_rca/v1/error_type.model b/clientapi/model/web_rca/v1/error_type.model similarity index 100% rename from model/web_rca/v1/error_type.model rename to clientapi/model/web_rca/v1/error_type.model diff --git a/model/web_rca/v1/errors_resource.model b/clientapi/model/web_rca/v1/errors_resource.model similarity index 100% rename from model/web_rca/v1/errors_resource.model rename to clientapi/model/web_rca/v1/errors_resource.model diff --git a/model/web_rca/v1/escalation_type.model b/clientapi/model/web_rca/v1/escalation_type.model similarity index 100% rename from model/web_rca/v1/escalation_type.model rename to clientapi/model/web_rca/v1/escalation_type.model diff --git a/model/web_rca/v1/event_resource.model b/clientapi/model/web_rca/v1/event_resource.model similarity index 100% rename from model/web_rca/v1/event_resource.model rename to clientapi/model/web_rca/v1/event_resource.model diff --git a/model/web_rca/v1/event_type.model b/clientapi/model/web_rca/v1/event_type.model similarity index 100% rename from model/web_rca/v1/event_type.model rename to clientapi/model/web_rca/v1/event_type.model diff --git a/model/web_rca/v1/events_resource.model b/clientapi/model/web_rca/v1/events_resource.model similarity index 100% rename from model/web_rca/v1/events_resource.model rename to clientapi/model/web_rca/v1/events_resource.model diff --git a/model/web_rca/v1/follow_up_change_type.model b/clientapi/model/web_rca/v1/follow_up_change_type.model similarity index 100% rename from model/web_rca/v1/follow_up_change_type.model rename to clientapi/model/web_rca/v1/follow_up_change_type.model diff --git a/model/web_rca/v1/follow_up_resource.model b/clientapi/model/web_rca/v1/follow_up_resource.model similarity index 100% rename from model/web_rca/v1/follow_up_resource.model rename to clientapi/model/web_rca/v1/follow_up_resource.model diff --git a/model/web_rca/v1/follow_up_type.model b/clientapi/model/web_rca/v1/follow_up_type.model similarity index 100% rename from model/web_rca/v1/follow_up_type.model rename to clientapi/model/web_rca/v1/follow_up_type.model diff --git a/model/web_rca/v1/follow_ups_resource.model b/clientapi/model/web_rca/v1/follow_ups_resource.model similarity index 100% rename from model/web_rca/v1/follow_ups_resource.model rename to clientapi/model/web_rca/v1/follow_ups_resource.model diff --git a/model/web_rca/v1/handoff_type.model b/clientapi/model/web_rca/v1/handoff_type.model similarity index 100% rename from model/web_rca/v1/handoff_type.model rename to clientapi/model/web_rca/v1/handoff_type.model diff --git a/model/web_rca/v1/incident_resource.model b/clientapi/model/web_rca/v1/incident_resource.model similarity index 100% rename from model/web_rca/v1/incident_resource.model rename to clientapi/model/web_rca/v1/incident_resource.model diff --git a/model/web_rca/v1/incident_type.model b/clientapi/model/web_rca/v1/incident_type.model similarity index 100% rename from model/web_rca/v1/incident_type.model rename to clientapi/model/web_rca/v1/incident_type.model diff --git a/model/web_rca/v1/incidents_resource.model b/clientapi/model/web_rca/v1/incidents_resource.model similarity index 100% rename from model/web_rca/v1/incidents_resource.model rename to clientapi/model/web_rca/v1/incidents_resource.model diff --git a/model/web_rca/v1/notification_resource.model b/clientapi/model/web_rca/v1/notification_resource.model similarity index 100% rename from model/web_rca/v1/notification_resource.model rename to clientapi/model/web_rca/v1/notification_resource.model diff --git a/model/web_rca/v1/notification_type.model b/clientapi/model/web_rca/v1/notification_type.model similarity index 100% rename from model/web_rca/v1/notification_type.model rename to clientapi/model/web_rca/v1/notification_type.model diff --git a/model/web_rca/v1/notifications_resource.model b/clientapi/model/web_rca/v1/notifications_resource.model similarity index 100% rename from model/web_rca/v1/notifications_resource.model rename to clientapi/model/web_rca/v1/notifications_resource.model diff --git a/model/web_rca/v1/product_type.model b/clientapi/model/web_rca/v1/product_type.model similarity index 100% rename from model/web_rca/v1/product_type.model rename to clientapi/model/web_rca/v1/product_type.model diff --git a/model/web_rca/v1/root_resource.model b/clientapi/model/web_rca/v1/root_resource.model similarity index 100% rename from model/web_rca/v1/root_resource.model rename to clientapi/model/web_rca/v1/root_resource.model diff --git a/model/web_rca/v1/status_change_type.model b/clientapi/model/web_rca/v1/status_change_type.model similarity index 100% rename from model/web_rca/v1/status_change_type.model rename to clientapi/model/web_rca/v1/status_change_type.model diff --git a/model/web_rca/v1/user_resource.model b/clientapi/model/web_rca/v1/user_resource.model similarity index 100% rename from model/web_rca/v1/user_resource.model rename to clientapi/model/web_rca/v1/user_resource.model diff --git a/model/web_rca/v1/user_type.model b/clientapi/model/web_rca/v1/user_type.model similarity index 100% rename from model/web_rca/v1/user_type.model rename to clientapi/model/web_rca/v1/user_type.model diff --git a/model/web_rca/v1/users_resource.model b/clientapi/model/web_rca/v1/users_resource.model similarity index 100% rename from model/web_rca/v1/users_resource.model rename to clientapi/model/web_rca/v1/users_resource.model diff --git a/clientapi/osdfleetmgmt/v1/boolean_list_type_json.go b/clientapi/osdfleetmgmt/v1/boolean_list_type_json.go new file mode 100644 index 00000000..62103e86 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/boolean_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBooleanList writes a list of values of the 'boolean' type to +// the given writer. +func MarshalBooleanList(list []bool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBooleanList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBooleanList writes a list of value of the 'boolean' type to +// the given stream. +func WriteBooleanList(list []bool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteBool(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalBooleanList reads a list of values of the 'boolean' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBooleanList(source interface{}) (items []bool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBooleanList(iterator) + err = iterator.Error + return +} + +// ReadBooleanList reads list of values of the ”boolean' type from +// the given iterator. +func ReadBooleanList(iterator *jsoniter.Iterator) []bool { + list := []bool{} + for iterator.ReadArray() { + item := iterator.ReadBool() + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/cluster_management_reference_builder.go b/clientapi/osdfleetmgmt/v1/cluster_management_reference_builder.go new file mode 100644 index 00000000..e0b5408d --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/cluster_management_reference_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ClusterManagementReferenceBuilder contains the data and logic needed to build 'cluster_management_reference' objects. +// +// Cluster Mgmt reference settings of the cluster. +type ClusterManagementReferenceBuilder struct { + bitmap_ uint32 + clusterId string + href string +} + +// NewClusterManagementReference creates a new builder of 'cluster_management_reference' objects. +func NewClusterManagementReference() *ClusterManagementReferenceBuilder { + return &ClusterManagementReferenceBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterManagementReferenceBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ClusterId sets the value of the 'cluster_id' attribute to the given value. +func (b *ClusterManagementReferenceBuilder) ClusterId(value string) *ClusterManagementReferenceBuilder { + b.clusterId = value + b.bitmap_ |= 1 + return b +} + +// Href sets the value of the 'href' attribute to the given value. +func (b *ClusterManagementReferenceBuilder) Href(value string) *ClusterManagementReferenceBuilder { + b.href = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterManagementReferenceBuilder) Copy(object *ClusterManagementReference) *ClusterManagementReferenceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.clusterId = object.clusterId + b.href = object.href + return b +} + +// Build creates a 'cluster_management_reference' object using the configuration stored in the builder. +func (b *ClusterManagementReferenceBuilder) Build() (object *ClusterManagementReference, err error) { + object = new(ClusterManagementReference) + object.bitmap_ = b.bitmap_ + object.clusterId = b.clusterId + object.href = b.href + return +} diff --git a/clientapi/osdfleetmgmt/v1/cluster_management_reference_list_builder.go b/clientapi/osdfleetmgmt/v1/cluster_management_reference_list_builder.go new file mode 100644 index 00000000..2340d293 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/cluster_management_reference_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ClusterManagementReferenceListBuilder contains the data and logic needed to build +// 'cluster_management_reference' objects. +type ClusterManagementReferenceListBuilder struct { + items []*ClusterManagementReferenceBuilder +} + +// NewClusterManagementReferenceList creates a new builder of 'cluster_management_reference' objects. +func NewClusterManagementReferenceList() *ClusterManagementReferenceListBuilder { + return new(ClusterManagementReferenceListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterManagementReferenceListBuilder) Items(values ...*ClusterManagementReferenceBuilder) *ClusterManagementReferenceListBuilder { + b.items = make([]*ClusterManagementReferenceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterManagementReferenceListBuilder) 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 *ClusterManagementReferenceListBuilder) Copy(list *ClusterManagementReferenceList) *ClusterManagementReferenceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterManagementReferenceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterManagementReference().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_management_reference' objects using the +// configuration stored in the builder. +func (b *ClusterManagementReferenceListBuilder) Build() (list *ClusterManagementReferenceList, err error) { + items := make([]*ClusterManagementReference, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterManagementReferenceList) + list.items = items + return +} diff --git a/clientapi/osdfleetmgmt/v1/cluster_management_reference_list_type_json.go b/clientapi/osdfleetmgmt/v1/cluster_management_reference_list_type_json.go new file mode 100644 index 00000000..0a4fab94 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/cluster_management_reference_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterManagementReferenceList writes a list of values of the 'cluster_management_reference' type to +// the given writer. +func MarshalClusterManagementReferenceList(list []*ClusterManagementReference, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterManagementReferenceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterManagementReferenceList writes a list of value of the 'cluster_management_reference' type to +// the given stream. +func WriteClusterManagementReferenceList(list []*ClusterManagementReference, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterManagementReference(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterManagementReferenceList reads a list of values of the 'cluster_management_reference' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterManagementReferenceList(source interface{}) (items []*ClusterManagementReference, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterManagementReferenceList(iterator) + err = iterator.Error + return +} + +// ReadClusterManagementReferenceList reads list of values of the ”cluster_management_reference' type from +// the given iterator. +func ReadClusterManagementReferenceList(iterator *jsoniter.Iterator) []*ClusterManagementReference { + list := []*ClusterManagementReference{} + for iterator.ReadArray() { + item := ReadClusterManagementReference(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/cluster_management_reference_type.go b/clientapi/osdfleetmgmt/v1/cluster_management_reference_type.go new file mode 100644 index 00000000..02f3be1e --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/cluster_management_reference_type.go @@ -0,0 +1,191 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ClusterManagementReference represents the values of the 'cluster_management_reference' type. +// +// Cluster Mgmt reference settings of the cluster. +type ClusterManagementReference struct { + bitmap_ uint32 + clusterId string + href string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterManagementReference) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ClusterId returns the value of the 'cluster_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster Mgmt ID +func (o *ClusterManagementReference) ClusterId() string { + if o != nil && o.bitmap_&1 != 0 { + return o.clusterId + } + return "" +} + +// GetClusterId returns the value of the 'cluster_id' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster Mgmt ID +func (o *ClusterManagementReference) GetClusterId() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.clusterId + } + return +} + +// Href returns the value of the 'href' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Reference link to external cluster_mgmt service based on ClusterId field +// ClusterId is not the name of the field used by the external cluster_mgmt service +func (o *ClusterManagementReference) Href() string { + if o != nil && o.bitmap_&2 != 0 { + return o.href + } + return "" +} + +// GetHref returns the value of the 'href' attribute and +// a flag indicating if the attribute has a value. +// +// Reference link to external cluster_mgmt service based on ClusterId field +// ClusterId is not the name of the field used by the external cluster_mgmt service +func (o *ClusterManagementReference) GetHref() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.href + } + return +} + +// ClusterManagementReferenceListKind is the name of the type used to represent list of objects of +// type 'cluster_management_reference'. +const ClusterManagementReferenceListKind = "ClusterManagementReferenceList" + +// ClusterManagementReferenceListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_management_reference'. +const ClusterManagementReferenceListLinkKind = "ClusterManagementReferenceListLink" + +// ClusterManagementReferenceNilKind is the name of the type used to nil lists of objects of +// type 'cluster_management_reference'. +const ClusterManagementReferenceListNilKind = "ClusterManagementReferenceListNil" + +// ClusterManagementReferenceList is a list of values of the 'cluster_management_reference' type. +type ClusterManagementReferenceList struct { + href string + link bool + items []*ClusterManagementReference +} + +// Len returns the length of the list. +func (l *ClusterManagementReferenceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterManagementReferenceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterManagementReferenceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterManagementReferenceList) SetItems(items []*ClusterManagementReference) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterManagementReferenceList) Items() []*ClusterManagementReference { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterManagementReferenceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterManagementReferenceList) Get(i int) *ClusterManagementReference { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterManagementReferenceList) Slice() []*ClusterManagementReference { + var slice []*ClusterManagementReference + if l == nil { + slice = make([]*ClusterManagementReference, 0) + } else { + slice = make([]*ClusterManagementReference, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterManagementReferenceList) Each(f func(item *ClusterManagementReference) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterManagementReferenceList) Range(f func(index int, item *ClusterManagementReference) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/osdfleetmgmt/v1/cluster_management_reference_type_json.go b/clientapi/osdfleetmgmt/v1/cluster_management_reference_type_json.go new file mode 100644 index 00000000..03341ae0 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/cluster_management_reference_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterManagementReference writes a value of the 'cluster_management_reference' type to the given writer. +func MarshalClusterManagementReference(object *ClusterManagementReference, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterManagementReference(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterManagementReference writes a value of the 'cluster_management_reference' type to the given stream. +func WriteClusterManagementReference(object *ClusterManagementReference, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterId) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterManagementReference reads a value of the 'cluster_management_reference' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterManagementReference(source interface{}) (object *ClusterManagementReference, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterManagementReference(iterator) + err = iterator.Error + return +} + +// ReadClusterManagementReference reads a value of the 'cluster_management_reference' type from the given iterator. +func ReadClusterManagementReference(iterator *jsoniter.Iterator) *ClusterManagementReference { + object := &ClusterManagementReference{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "cluster_id": + value := iterator.ReadString() + object.clusterId = value + object.bitmap_ |= 1 + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/osdfleetmgmt/v1/date_list_type_json.go b/clientapi/osdfleetmgmt/v1/date_list_type_json.go new file mode 100644 index 00000000..9e0fbd19 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/date_list_type_json.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDateList writes a list of values of the 'date' type to +// the given writer. +func MarshalDateList(list []time.Time, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDateList writes a list of value of the 'date' type to +// the given stream. +func WriteDateList(list []time.Time, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString((value).Format(time.RFC3339)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDateList reads a list of values of the 'date' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDateList(source interface{}) (items []time.Time, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDateList(iterator) + err = iterator.Error + return +} + +// ReadDateList reads list of values of the ”date' type from +// the given iterator. +func ReadDateList(iterator *jsoniter.Iterator) []time.Time { + list := []time.Time{} + for iterator.ReadArray() { + text := iterator.ReadString() + item, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/dns_builder.go b/clientapi/osdfleetmgmt/v1/dns_builder.go new file mode 100644 index 00000000..0ae07804 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/dns_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// DNSBuilder contains the data and logic needed to build 'DNS' objects. +// +// DNS settings of the cluster. +type DNSBuilder struct { + bitmap_ uint32 + baseDomain string +} + +// NewDNS creates a new builder of 'DNS' objects. +func NewDNS() *DNSBuilder { + return &DNSBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *DNSBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// BaseDomain sets the value of the 'base_domain' attribute to the given value. +func (b *DNSBuilder) BaseDomain(value string) *DNSBuilder { + b.baseDomain = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *DNSBuilder) Copy(object *DNS) *DNSBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.baseDomain = object.baseDomain + return b +} + +// Build creates a 'DNS' object using the configuration stored in the builder. +func (b *DNSBuilder) Build() (object *DNS, err error) { + object = new(DNS) + object.bitmap_ = b.bitmap_ + object.baseDomain = b.baseDomain + return +} diff --git a/clientapi/osdfleetmgmt/v1/dns_list_builder.go b/clientapi/osdfleetmgmt/v1/dns_list_builder.go new file mode 100644 index 00000000..7a88cf5c --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/dns_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// DNSListBuilder contains the data and logic needed to build +// 'DNS' objects. +type DNSListBuilder struct { + items []*DNSBuilder +} + +// NewDNSList creates a new builder of 'DNS' objects. +func NewDNSList() *DNSListBuilder { + return new(DNSListBuilder) +} + +// Items sets the items of the list. +func (b *DNSListBuilder) Items(values ...*DNSBuilder) *DNSListBuilder { + b.items = make([]*DNSBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *DNSListBuilder) 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 *DNSListBuilder) Copy(list *DNSList) *DNSListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*DNSBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewDNS().Copy(v) + } + } + return b +} + +// Build creates a list of 'DNS' objects using the +// configuration stored in the builder. +func (b *DNSListBuilder) Build() (list *DNSList, err error) { + items := make([]*DNS, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(DNSList) + list.items = items + return +} diff --git a/clientapi/osdfleetmgmt/v1/dns_list_type_json.go b/clientapi/osdfleetmgmt/v1/dns_list_type_json.go new file mode 100644 index 00000000..34ddcf5c --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/dns_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDNSList writes a list of values of the 'DNS' type to +// the given writer. +func MarshalDNSList(list []*DNS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDNSList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDNSList writes a list of value of the 'DNS' type to +// the given stream. +func WriteDNSList(list []*DNS, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteDNS(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalDNSList reads a list of values of the 'DNS' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDNSList(source interface{}) (items []*DNS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDNSList(iterator) + err = iterator.Error + return +} + +// ReadDNSList reads list of values of the ”DNS' type from +// the given iterator. +func ReadDNSList(iterator *jsoniter.Iterator) []*DNS { + list := []*DNS{} + for iterator.ReadArray() { + item := ReadDNS(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/dns_type.go b/clientapi/osdfleetmgmt/v1/dns_type.go new file mode 100644 index 00000000..22a5e127 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/dns_type.go @@ -0,0 +1,251 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// DNS represents the values of the 'DNS' type. +// +// DNS settings of the cluster. +type DNS struct { + bitmap_ uint32 + baseDomain string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *DNS) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// BaseDomain returns the value of the 'base_domain' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Base DNS domain of the cluster. +// +// During the installation of the cluster it is necessary to create multiple DNS records. +// They will be created as sub-domains of this domain. For example, if the name of the +// cluster is `mycluster` and the base domain is `example.com` then the following DNS +// records will be created: +// +// ``` +// mycluster-api.example.com +// mycluster-etcd-0.example.com +// mycluster-etcd-1.example.com +// mycluster-etcd-3.example.com +// ``` +// +// The exact number, type and names of the created DNS record depends on the characteristics +// of the cluster, and may be different for different versions of _OpenShift_. Please don't +// rely on them. For example, to find what is the URL of the Kubernetes API server of the +// cluster don't assume that it will be `mycluster-api.example.com`. Instead of that use +// this API to retrieve the description of the cluster, and get it from the `api.url` +// attribute. For example, if the identifier of the cluster is `123` send a request like +// this: +// +// ```http +// GET /api/clusters_mgmt/v1/clusters/123 HTTP/1.1 +// ``` +// +// That will return a response like this, including the `api.url` attribute: +// +// ```json +// +// { +// "kind": "Cluster", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/clusters/123", +// "api": { +// "url": "https://mycluster-api.example.com:6443" +// }, +// ... +// } +// +// ``` +// +// When the cluster is created in Amazon Web Services it is necessary to create this base +// DNS domain in advance, using AWS Route53 (https://console.aws.amazon.com/route53). +func (o *DNS) BaseDomain() string { + if o != nil && o.bitmap_&1 != 0 { + return o.baseDomain + } + return "" +} + +// GetBaseDomain returns the value of the 'base_domain' attribute and +// a flag indicating if the attribute has a value. +// +// Base DNS domain of the cluster. +// +// During the installation of the cluster it is necessary to create multiple DNS records. +// They will be created as sub-domains of this domain. For example, if the name of the +// cluster is `mycluster` and the base domain is `example.com` then the following DNS +// records will be created: +// +// ``` +// mycluster-api.example.com +// mycluster-etcd-0.example.com +// mycluster-etcd-1.example.com +// mycluster-etcd-3.example.com +// ``` +// +// The exact number, type and names of the created DNS record depends on the characteristics +// of the cluster, and may be different for different versions of _OpenShift_. Please don't +// rely on them. For example, to find what is the URL of the Kubernetes API server of the +// cluster don't assume that it will be `mycluster-api.example.com`. Instead of that use +// this API to retrieve the description of the cluster, and get it from the `api.url` +// attribute. For example, if the identifier of the cluster is `123` send a request like +// this: +// +// ```http +// GET /api/clusters_mgmt/v1/clusters/123 HTTP/1.1 +// ``` +// +// That will return a response like this, including the `api.url` attribute: +// +// ```json +// +// { +// "kind": "Cluster", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/clusters/123", +// "api": { +// "url": "https://mycluster-api.example.com:6443" +// }, +// ... +// } +// +// ``` +// +// When the cluster is created in Amazon Web Services it is necessary to create this base +// DNS domain in advance, using AWS Route53 (https://console.aws.amazon.com/route53). +func (o *DNS) GetBaseDomain() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.baseDomain + } + return +} + +// DNSListKind is the name of the type used to represent list of objects of +// type 'DNS'. +const DNSListKind = "DNSList" + +// DNSListLinkKind is the name of the type used to represent links to list +// of objects of type 'DNS'. +const DNSListLinkKind = "DNSListLink" + +// DNSNilKind is the name of the type used to nil lists of objects of +// type 'DNS'. +const DNSListNilKind = "DNSListNil" + +// DNSList is a list of values of the 'DNS' type. +type DNSList struct { + href string + link bool + items []*DNS +} + +// Len returns the length of the list. +func (l *DNSList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *DNSList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *DNSList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *DNSList) SetItems(items []*DNS) { + l.items = items +} + +// Items returns the items of the list. +func (l *DNSList) Items() []*DNS { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *DNSList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *DNSList) Get(i int) *DNS { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *DNSList) Slice() []*DNS { + var slice []*DNS + if l == nil { + slice = make([]*DNS, 0) + } else { + slice = make([]*DNS, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *DNSList) Each(f func(item *DNS) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *DNSList) Range(f func(index int, item *DNS) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/osdfleetmgmt/v1/dns_type_json.go b/clientapi/osdfleetmgmt/v1/dns_type_json.go new file mode 100644 index 00000000..83df0bd9 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/dns_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDNS writes a value of the 'DNS' type to the given writer. +func MarshalDNS(object *DNS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDNS(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDNS writes a value of the 'DNS' type to the given stream. +func WriteDNS(object *DNS, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("base_domain") + stream.WriteString(object.baseDomain) + } + stream.WriteObjectEnd() +} + +// UnmarshalDNS reads a value of the 'DNS' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalDNS(source interface{}) (object *DNS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadDNS(iterator) + err = iterator.Error + return +} + +// ReadDNS reads a value of the 'DNS' type from the given iterator. +func ReadDNS(iterator *jsoniter.Iterator) *DNS { + object := &DNS{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "base_domain": + value := iterator.ReadString() + object.baseDomain = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/osdfleetmgmt/v1/float_list_type_json.go b/clientapi/osdfleetmgmt/v1/float_list_type_json.go new file mode 100644 index 00000000..aca25ca3 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/float_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFloatList writes a list of values of the 'float' type to +// the given writer. +func MarshalFloatList(list []float64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFloatList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFloatList writes a list of value of the 'float' type to +// the given stream. +func WriteFloatList(list []float64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteFloat64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalFloatList reads a list of values of the 'float' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFloatList(source interface{}) (items []float64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFloatList(iterator) + err = iterator.Error + return +} + +// ReadFloatList reads list of values of the ”float' type from +// the given iterator. +func ReadFloatList(iterator *jsoniter.Iterator) []float64 { + list := []float64{} + for iterator.ReadArray() { + item := iterator.ReadFloat64() + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/integer_list_type_json.go b/clientapi/osdfleetmgmt/v1/integer_list_type_json.go new file mode 100644 index 00000000..3c8e7f1e --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/integer_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIntegerList writes a list of values of the 'integer' type to +// the given writer. +func MarshalIntegerList(list []int, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIntegerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIntegerList writes a list of value of the 'integer' type to +// the given stream. +func WriteIntegerList(list []int, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalIntegerList reads a list of values of the 'integer' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIntegerList(source interface{}) (items []int, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIntegerList(iterator) + err = iterator.Error + return +} + +// ReadIntegerList reads list of values of the ”integer' type from +// the given iterator. +func ReadIntegerList(iterator *jsoniter.Iterator) []int { + list := []int{} + for iterator.ReadArray() { + item := iterator.ReadInt() + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/interface_list_type_json.go b/clientapi/osdfleetmgmt/v1/interface_list_type_json.go new file mode 100644 index 00000000..edb19ae7 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/interface_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInterfaceList writes a list of values of the 'interface' type to +// the given writer. +func MarshalInterfaceList(list []interface{}, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInterfaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInterfaceList writes a list of value of the 'interface' type to +// the given stream. +func WriteInterfaceList(list []interface{}, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteVal(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalInterfaceList reads a list of values of the 'interface' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInterfaceList(source interface{}) (items []interface{}, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInterfaceList(iterator) + err = iterator.Error + return +} + +// ReadInterfaceList reads list of values of the ”interface' type from +// the given iterator. +func ReadInterfaceList(iterator *jsoniter.Iterator) []interface{} { + list := []interface{}{} + for iterator.ReadArray() { + var item interface{} + iterator.ReadVal(&item) + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/label_builder.go b/clientapi/osdfleetmgmt/v1/label_builder.go new file mode 100644 index 00000000..60e9adbe --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_builder.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// LabelBuilder contains the data and logic needed to build 'label' objects. +// +// label settings of the cluster. +type LabelBuilder struct { + bitmap_ uint32 + id string + href string + key string + value string +} + +// NewLabel creates a new builder of 'label' objects. +func NewLabel() *LabelBuilder { + return &LabelBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *LabelBuilder) Link(value bool) *LabelBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *LabelBuilder) ID(value string) *LabelBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *LabelBuilder) HREF(value string) *LabelBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *LabelBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Key sets the value of the 'key' attribute to the given value. +func (b *LabelBuilder) Key(value string) *LabelBuilder { + b.key = value + b.bitmap_ |= 8 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *LabelBuilder) Value(value string) *LabelBuilder { + b.value = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *LabelBuilder) Copy(object *Label) *LabelBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.key = object.key + b.value = object.value + return b +} + +// Build creates a 'label' object using the configuration stored in the builder. +func (b *LabelBuilder) Build() (object *Label, err error) { + object = new(Label) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.key = b.key + object.value = b.value + return +} diff --git a/clientapi/osdfleetmgmt/v1/label_list_builder.go b/clientapi/osdfleetmgmt/v1/label_list_builder.go new file mode 100644 index 00000000..00b26c39 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// LabelListBuilder contains the data and logic needed to build +// 'label' objects. +type LabelListBuilder struct { + items []*LabelBuilder +} + +// NewLabelList creates a new builder of 'label' objects. +func NewLabelList() *LabelListBuilder { + return new(LabelListBuilder) +} + +// Items sets the items of the list. +func (b *LabelListBuilder) Items(values ...*LabelBuilder) *LabelListBuilder { + b.items = make([]*LabelBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *LabelListBuilder) 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 *LabelListBuilder) Copy(list *LabelList) *LabelListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*LabelBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewLabel().Copy(v) + } + } + return b +} + +// Build creates a list of 'label' objects using the +// configuration stored in the builder. +func (b *LabelListBuilder) Build() (list *LabelList, err error) { + items := make([]*Label, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(LabelList) + list.items = items + return +} diff --git a/clientapi/osdfleetmgmt/v1/label_list_type_json.go b/clientapi/osdfleetmgmt/v1/label_list_type_json.go new file mode 100644 index 00000000..f77d776b --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLabelList writes a list of values of the 'label' type to +// the given writer. +func MarshalLabelList(list []*Label, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLabelList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLabelList writes a list of value of the 'label' type to +// the given stream. +func WriteLabelList(list []*Label, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteLabel(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalLabelList reads a list of values of the 'label' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLabelList(source interface{}) (items []*Label, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLabelList(iterator) + err = iterator.Error + return +} + +// ReadLabelList reads list of values of the ”label' type from +// the given iterator. +func ReadLabelList(iterator *jsoniter.Iterator) []*Label { + list := []*Label{} + for iterator.ReadArray() { + item := ReadLabel(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/label_reference_builder.go b/clientapi/osdfleetmgmt/v1/label_reference_builder.go new file mode 100644 index 00000000..be86a946 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_reference_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// LabelReferenceBuilder contains the data and logic needed to build 'label_reference' objects. +// +// label reference settings of the cluster. +type LabelReferenceBuilder struct { + bitmap_ uint32 + href string + id string +} + +// NewLabelReference creates a new builder of 'label_reference' objects. +func NewLabelReference() *LabelReferenceBuilder { + return &LabelReferenceBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *LabelReferenceBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Href sets the value of the 'href' attribute to the given value. +func (b *LabelReferenceBuilder) Href(value string) *LabelReferenceBuilder { + b.href = value + b.bitmap_ |= 1 + return b +} + +// Id sets the value of the 'id' attribute to the given value. +func (b *LabelReferenceBuilder) Id(value string) *LabelReferenceBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *LabelReferenceBuilder) Copy(object *LabelReference) *LabelReferenceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.href = object.href + b.id = object.id + return b +} + +// Build creates a 'label_reference' object using the configuration stored in the builder. +func (b *LabelReferenceBuilder) Build() (object *LabelReference, err error) { + object = new(LabelReference) + object.bitmap_ = b.bitmap_ + object.href = b.href + object.id = b.id + return +} diff --git a/clientapi/osdfleetmgmt/v1/label_reference_list_builder.go b/clientapi/osdfleetmgmt/v1/label_reference_list_builder.go new file mode 100644 index 00000000..c27973ce --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_reference_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// LabelReferenceListBuilder contains the data and logic needed to build +// 'label_reference' objects. +type LabelReferenceListBuilder struct { + items []*LabelReferenceBuilder +} + +// NewLabelReferenceList creates a new builder of 'label_reference' objects. +func NewLabelReferenceList() *LabelReferenceListBuilder { + return new(LabelReferenceListBuilder) +} + +// Items sets the items of the list. +func (b *LabelReferenceListBuilder) Items(values ...*LabelReferenceBuilder) *LabelReferenceListBuilder { + b.items = make([]*LabelReferenceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *LabelReferenceListBuilder) 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 *LabelReferenceListBuilder) Copy(list *LabelReferenceList) *LabelReferenceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*LabelReferenceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewLabelReference().Copy(v) + } + } + return b +} + +// Build creates a list of 'label_reference' objects using the +// configuration stored in the builder. +func (b *LabelReferenceListBuilder) Build() (list *LabelReferenceList, err error) { + items := make([]*LabelReference, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(LabelReferenceList) + list.items = items + return +} diff --git a/clientapi/osdfleetmgmt/v1/label_reference_list_type_json.go b/clientapi/osdfleetmgmt/v1/label_reference_list_type_json.go new file mode 100644 index 00000000..9e1d3996 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_reference_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLabelReferenceList writes a list of values of the 'label_reference' type to +// the given writer. +func MarshalLabelReferenceList(list []*LabelReference, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLabelReferenceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLabelReferenceList writes a list of value of the 'label_reference' type to +// the given stream. +func WriteLabelReferenceList(list []*LabelReference, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteLabelReference(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalLabelReferenceList reads a list of values of the 'label_reference' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLabelReferenceList(source interface{}) (items []*LabelReference, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLabelReferenceList(iterator) + err = iterator.Error + return +} + +// ReadLabelReferenceList reads list of values of the ”label_reference' type from +// the given iterator. +func ReadLabelReferenceList(iterator *jsoniter.Iterator) []*LabelReference { + list := []*LabelReference{} + for iterator.ReadArray() { + item := ReadLabelReference(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/label_reference_type.go b/clientapi/osdfleetmgmt/v1/label_reference_type.go new file mode 100644 index 00000000..6be55d23 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_reference_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// LabelReference represents the values of the 'label_reference' type. +// +// label reference settings of the cluster. +type LabelReference struct { + bitmap_ uint32 + href string + id string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *LabelReference) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Href returns the value of the 'href' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// link to the Label associated to the OSD FM managed cluster +func (o *LabelReference) Href() string { + if o != nil && o.bitmap_&1 != 0 { + return o.href + } + return "" +} + +// GetHref returns the value of the 'href' attribute and +// a flag indicating if the attribute has a value. +// +// link to the Label associated to the OSD FM managed cluster +func (o *LabelReference) GetHref() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.href + } + return +} + +// Id returns the value of the 'id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Id of the Label associated to the OSD FM managed cluster +func (o *LabelReference) Id() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetId returns the value of the 'id' attribute and +// a flag indicating if the attribute has a value. +// +// Id of the Label associated to the OSD FM managed cluster +func (o *LabelReference) GetId() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// LabelReferenceListKind is the name of the type used to represent list of objects of +// type 'label_reference'. +const LabelReferenceListKind = "LabelReferenceList" + +// LabelReferenceListLinkKind is the name of the type used to represent links to list +// of objects of type 'label_reference'. +const LabelReferenceListLinkKind = "LabelReferenceListLink" + +// LabelReferenceNilKind is the name of the type used to nil lists of objects of +// type 'label_reference'. +const LabelReferenceListNilKind = "LabelReferenceListNil" + +// LabelReferenceList is a list of values of the 'label_reference' type. +type LabelReferenceList struct { + href string + link bool + items []*LabelReference +} + +// Len returns the length of the list. +func (l *LabelReferenceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *LabelReferenceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *LabelReferenceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *LabelReferenceList) SetItems(items []*LabelReference) { + l.items = items +} + +// Items returns the items of the list. +func (l *LabelReferenceList) Items() []*LabelReference { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *LabelReferenceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *LabelReferenceList) Get(i int) *LabelReference { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *LabelReferenceList) Slice() []*LabelReference { + var slice []*LabelReference + if l == nil { + slice = make([]*LabelReference, 0) + } else { + slice = make([]*LabelReference, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *LabelReferenceList) Each(f func(item *LabelReference) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *LabelReferenceList) Range(f func(index int, item *LabelReference) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/osdfleetmgmt/v1/label_reference_type_json.go b/clientapi/osdfleetmgmt/v1/label_reference_type_json.go new file mode 100644 index 00000000..48383b37 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_reference_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLabelReference writes a value of the 'label_reference' type to the given writer. +func MarshalLabelReference(object *LabelReference, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLabelReference(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLabelReference writes a value of the 'label_reference' type to the given stream. +func WriteLabelReference(object *LabelReference, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + } + stream.WriteObjectEnd() +} + +// UnmarshalLabelReference reads a value of the 'label_reference' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalLabelReference(source interface{}) (object *LabelReference, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadLabelReference(iterator) + err = iterator.Error + return +} + +// ReadLabelReference reads a value of the 'label_reference' type from the given iterator. +func ReadLabelReference(iterator *jsoniter.Iterator) *LabelReference { + object := &LabelReference{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 1 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/osdfleetmgmt/v1/label_request_payload_builder.go b/clientapi/osdfleetmgmt/v1/label_request_payload_builder.go new file mode 100644 index 00000000..106161b0 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_request_payload_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// LabelRequestPayloadBuilder contains the data and logic needed to build 'label_request_payload' objects. +type LabelRequestPayloadBuilder struct { + bitmap_ uint32 + key string + value string +} + +// NewLabelRequestPayload creates a new builder of 'label_request_payload' objects. +func NewLabelRequestPayload() *LabelRequestPayloadBuilder { + return &LabelRequestPayloadBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *LabelRequestPayloadBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Key sets the value of the 'key' attribute to the given value. +func (b *LabelRequestPayloadBuilder) Key(value string) *LabelRequestPayloadBuilder { + b.key = value + b.bitmap_ |= 1 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *LabelRequestPayloadBuilder) Value(value string) *LabelRequestPayloadBuilder { + b.value = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *LabelRequestPayloadBuilder) Copy(object *LabelRequestPayload) *LabelRequestPayloadBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.key = object.key + b.value = object.value + return b +} + +// Build creates a 'label_request_payload' object using the configuration stored in the builder. +func (b *LabelRequestPayloadBuilder) Build() (object *LabelRequestPayload, err error) { + object = new(LabelRequestPayload) + object.bitmap_ = b.bitmap_ + object.key = b.key + object.value = b.value + return +} diff --git a/clientapi/osdfleetmgmt/v1/label_request_payload_list_builder.go b/clientapi/osdfleetmgmt/v1/label_request_payload_list_builder.go new file mode 100644 index 00000000..9f268fe4 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_request_payload_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// LabelRequestPayloadListBuilder contains the data and logic needed to build +// 'label_request_payload' objects. +type LabelRequestPayloadListBuilder struct { + items []*LabelRequestPayloadBuilder +} + +// NewLabelRequestPayloadList creates a new builder of 'label_request_payload' objects. +func NewLabelRequestPayloadList() *LabelRequestPayloadListBuilder { + return new(LabelRequestPayloadListBuilder) +} + +// Items sets the items of the list. +func (b *LabelRequestPayloadListBuilder) Items(values ...*LabelRequestPayloadBuilder) *LabelRequestPayloadListBuilder { + b.items = make([]*LabelRequestPayloadBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *LabelRequestPayloadListBuilder) 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 *LabelRequestPayloadListBuilder) Copy(list *LabelRequestPayloadList) *LabelRequestPayloadListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*LabelRequestPayloadBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewLabelRequestPayload().Copy(v) + } + } + return b +} + +// Build creates a list of 'label_request_payload' objects using the +// configuration stored in the builder. +func (b *LabelRequestPayloadListBuilder) Build() (list *LabelRequestPayloadList, err error) { + items := make([]*LabelRequestPayload, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(LabelRequestPayloadList) + list.items = items + return +} diff --git a/clientapi/osdfleetmgmt/v1/label_request_payload_list_type_json.go b/clientapi/osdfleetmgmt/v1/label_request_payload_list_type_json.go new file mode 100644 index 00000000..4f3197a8 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_request_payload_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLabelRequestPayloadList writes a list of values of the 'label_request_payload' type to +// the given writer. +func MarshalLabelRequestPayloadList(list []*LabelRequestPayload, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLabelRequestPayloadList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLabelRequestPayloadList writes a list of value of the 'label_request_payload' type to +// the given stream. +func WriteLabelRequestPayloadList(list []*LabelRequestPayload, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteLabelRequestPayload(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalLabelRequestPayloadList reads a list of values of the 'label_request_payload' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLabelRequestPayloadList(source interface{}) (items []*LabelRequestPayload, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLabelRequestPayloadList(iterator) + err = iterator.Error + return +} + +// ReadLabelRequestPayloadList reads list of values of the ”label_request_payload' type from +// the given iterator. +func ReadLabelRequestPayloadList(iterator *jsoniter.Iterator) []*LabelRequestPayload { + list := []*LabelRequestPayload{} + for iterator.ReadArray() { + item := ReadLabelRequestPayload(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/label_request_payload_type.go b/clientapi/osdfleetmgmt/v1/label_request_payload_type.go new file mode 100644 index 00000000..99bf3b00 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_request_payload_type.go @@ -0,0 +1,179 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// LabelRequestPayload represents the values of the 'label_request_payload' type. +type LabelRequestPayload struct { + bitmap_ uint32 + key string + value string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *LabelRequestPayload) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Key returns the value of the 'key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *LabelRequestPayload) Key() string { + if o != nil && o.bitmap_&1 != 0 { + return o.key + } + return "" +} + +// GetKey returns the value of the 'key' attribute and +// a flag indicating if the attribute has a value. +func (o *LabelRequestPayload) GetKey() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.key + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *LabelRequestPayload) Value() string { + if o != nil && o.bitmap_&2 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +func (o *LabelRequestPayload) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.value + } + return +} + +// LabelRequestPayloadListKind is the name of the type used to represent list of objects of +// type 'label_request_payload'. +const LabelRequestPayloadListKind = "LabelRequestPayloadList" + +// LabelRequestPayloadListLinkKind is the name of the type used to represent links to list +// of objects of type 'label_request_payload'. +const LabelRequestPayloadListLinkKind = "LabelRequestPayloadListLink" + +// LabelRequestPayloadNilKind is the name of the type used to nil lists of objects of +// type 'label_request_payload'. +const LabelRequestPayloadListNilKind = "LabelRequestPayloadListNil" + +// LabelRequestPayloadList is a list of values of the 'label_request_payload' type. +type LabelRequestPayloadList struct { + href string + link bool + items []*LabelRequestPayload +} + +// Len returns the length of the list. +func (l *LabelRequestPayloadList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *LabelRequestPayloadList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *LabelRequestPayloadList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *LabelRequestPayloadList) SetItems(items []*LabelRequestPayload) { + l.items = items +} + +// Items returns the items of the list. +func (l *LabelRequestPayloadList) Items() []*LabelRequestPayload { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *LabelRequestPayloadList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *LabelRequestPayloadList) Get(i int) *LabelRequestPayload { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *LabelRequestPayloadList) Slice() []*LabelRequestPayload { + var slice []*LabelRequestPayload + if l == nil { + slice = make([]*LabelRequestPayload, 0) + } else { + slice = make([]*LabelRequestPayload, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *LabelRequestPayloadList) Each(f func(item *LabelRequestPayload) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *LabelRequestPayloadList) Range(f func(index int, item *LabelRequestPayload) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/osdfleetmgmt/v1/label_request_payload_type_json.go b/clientapi/osdfleetmgmt/v1/label_request_payload_type_json.go new file mode 100644 index 00000000..d9930212 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_request_payload_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLabelRequestPayload writes a value of the 'label_request_payload' type to the given writer. +func MarshalLabelRequestPayload(object *LabelRequestPayload, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLabelRequestPayload(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLabelRequestPayload writes a value of the 'label_request_payload' type to the given stream. +func WriteLabelRequestPayload(object *LabelRequestPayload, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key") + stream.WriteString(object.key) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalLabelRequestPayload reads a value of the 'label_request_payload' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalLabelRequestPayload(source interface{}) (object *LabelRequestPayload, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadLabelRequestPayload(iterator) + err = iterator.Error + return +} + +// ReadLabelRequestPayload reads a value of the 'label_request_payload' type from the given iterator. +func ReadLabelRequestPayload(iterator *jsoniter.Iterator) *LabelRequestPayload { + object := &LabelRequestPayload{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "key": + value := iterator.ReadString() + object.key = value + object.bitmap_ |= 1 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/osdfleetmgmt/v1/label_type.go b/clientapi/osdfleetmgmt/v1/label_type.go new file mode 100644 index 00000000..3a413fbe --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// LabelKind is the name of the type used to represent objects +// of type 'label'. +const LabelKind = "Label" + +// LabelLinkKind is the name of the type used to represent links +// to objects of type 'label'. +const LabelLinkKind = "LabelLink" + +// LabelNilKind is the name of the type used to nil references +// to objects of type 'label'. +const LabelNilKind = "LabelNil" + +// Label represents the values of the 'label' type. +// +// label settings of the cluster. +type Label struct { + bitmap_ uint32 + id string + href string + key string + value string +} + +// Kind returns the name of the type of the object. +func (o *Label) Kind() string { + if o == nil { + return LabelNilKind + } + if o.bitmap_&1 != 0 { + return LabelLinkKind + } + return LabelKind +} + +// Link returns true if this is a link. +func (o *Label) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Label) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Label) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Label) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Label) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Label) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Key returns the value of the 'key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Label key associated to the OSD FM managed cluster +func (o *Label) Key() string { + if o != nil && o.bitmap_&8 != 0 { + return o.key + } + return "" +} + +// GetKey returns the value of the 'key' attribute and +// a flag indicating if the attribute has a value. +// +// Label key associated to the OSD FM managed cluster +func (o *Label) GetKey() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.key + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Label value associated to the OSD FM managed cluster +func (o *Label) Value() string { + if o != nil && o.bitmap_&16 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Label value associated to the OSD FM managed cluster +func (o *Label) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.value + } + return +} + +// LabelListKind is the name of the type used to represent list of objects of +// type 'label'. +const LabelListKind = "LabelList" + +// LabelListLinkKind is the name of the type used to represent links to list +// of objects of type 'label'. +const LabelListLinkKind = "LabelListLink" + +// LabelNilKind is the name of the type used to nil lists of objects of +// type 'label'. +const LabelListNilKind = "LabelListNil" + +// LabelList is a list of values of the 'label' type. +type LabelList struct { + href string + link bool + items []*Label +} + +// Kind returns the name of the type of the object. +func (l *LabelList) Kind() string { + if l == nil { + return LabelListNilKind + } + if l.link { + return LabelListLinkKind + } + return LabelListKind +} + +// Link returns true iif this is a link. +func (l *LabelList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *LabelList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *LabelList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *LabelList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *LabelList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *LabelList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *LabelList) SetItems(items []*Label) { + l.items = items +} + +// Items returns the items of the list. +func (l *LabelList) Items() []*Label { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *LabelList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *LabelList) Get(i int) *Label { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *LabelList) Slice() []*Label { + var slice []*Label + if l == nil { + slice = make([]*Label, 0) + } else { + slice = make([]*Label, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *LabelList) Each(f func(item *Label) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *LabelList) Range(f func(index int, item *Label) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/osdfleetmgmt/v1/label_type_json.go b/clientapi/osdfleetmgmt/v1/label_type_json.go new file mode 100644 index 00000000..479f0d16 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/label_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLabel writes a value of the 'label' type to the given writer. +func MarshalLabel(object *Label, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLabel(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLabel writes a value of the 'label' type to the given stream. +func WriteLabel(object *Label, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(LabelLinkKind) + } else { + stream.WriteString(LabelKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("key") + stream.WriteString(object.key) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalLabel reads a value of the 'label' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalLabel(source interface{}) (object *Label, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadLabel(iterator) + err = iterator.Error + return +} + +// ReadLabel reads a value of the 'label' type from the given iterator. +func ReadLabel(iterator *jsoniter.Iterator) *Label { + object := &Label{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == LabelLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "key": + value := iterator.ReadString() + object.key = value + object.bitmap_ |= 8 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/osdfleetmgmt/v1/long_list_type_json.go b/clientapi/osdfleetmgmt/v1/long_list_type_json.go new file mode 100644 index 00000000..17721f13 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/long_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLongList writes a list of values of the 'long' type to +// the given writer. +func MarshalLongList(list []int64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLongList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLongList writes a list of value of the 'long' type to +// the given stream. +func WriteLongList(list []int64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalLongList reads a list of values of the 'long' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLongList(source interface{}) (items []int64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLongList(iterator) + err = iterator.Error + return +} + +// ReadLongList reads list of values of the ”long' type from +// the given iterator. +func ReadLongList(iterator *jsoniter.Iterator) []int64 { + list := []int64{} + for iterator.ReadArray() { + item := iterator.ReadInt64() + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_builder.go b/clientapi/osdfleetmgmt/v1/management_cluster_builder.go new file mode 100644 index 00000000..ffb63e6f --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_builder.go @@ -0,0 +1,292 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + time "time" +) + +// ManagementClusterBuilder contains the data and logic needed to build 'management_cluster' objects. +// +// Definition of an _OpenShift_ cluster. +// +// The `cloud_provider` attribute is a reference to the cloud provider. When a +// cluster is retrieved it will be a link to the cloud provider, containing only +// the kind, id and href attributes: +// +// ```json +// +// { +// "cloud_provider": { +// "kind": "CloudProviderLink", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/cloud_providers/123" +// } +// } +// +// ``` +// +// When a cluster is created this is optional, and if used it should contain the +// identifier of the cloud provider to use: +// +// ```json +// +// { +// "cloud_provider": { +// "id": "123", +// } +// } +// +// ``` +// +// If not included, then the cluster will be created using the default cloud +// provider, which is currently Amazon Web Services. +// +// The region attribute is mandatory when a cluster is created. +// +// The `aws.access_key_id`, `aws.secret_access_key` and `dns.base_domain` +// attributes are mandatory when creation a cluster with your own Amazon Web +// Services account. +type ManagementClusterBuilder struct { + bitmap_ uint32 + id string + href string + dns *DNSBuilder + cloudProvider string + clusterManagementReference *ClusterManagementReferenceBuilder + creationTimestamp time.Time + labels []*LabelBuilder + name string + parent *ManagementClusterParentBuilder + region string + sector string + status string + updateTimestamp time.Time +} + +// NewManagementCluster creates a new builder of 'management_cluster' objects. +func NewManagementCluster() *ManagementClusterBuilder { + return &ManagementClusterBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ManagementClusterBuilder) Link(value bool) *ManagementClusterBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ManagementClusterBuilder) ID(value string) *ManagementClusterBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ManagementClusterBuilder) HREF(value string) *ManagementClusterBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ManagementClusterBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// DNS sets the value of the 'DNS' attribute to the given value. +// +// DNS settings of the cluster. +func (b *ManagementClusterBuilder) DNS(value *DNSBuilder) *ManagementClusterBuilder { + b.dns = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +func (b *ManagementClusterBuilder) CloudProvider(value string) *ManagementClusterBuilder { + b.cloudProvider = value + b.bitmap_ |= 16 + return b +} + +// ClusterManagementReference sets the value of the 'cluster_management_reference' attribute to the given value. +// +// Cluster Mgmt reference settings of the cluster. +func (b *ManagementClusterBuilder) ClusterManagementReference(value *ClusterManagementReferenceBuilder) *ManagementClusterBuilder { + b.clusterManagementReference = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value. +func (b *ManagementClusterBuilder) CreationTimestamp(value time.Time) *ManagementClusterBuilder { + b.creationTimestamp = value + b.bitmap_ |= 64 + return b +} + +// Labels sets the value of the 'labels' attribute to the given values. +func (b *ManagementClusterBuilder) Labels(values ...*LabelBuilder) *ManagementClusterBuilder { + b.labels = make([]*LabelBuilder, len(values)) + copy(b.labels, values) + b.bitmap_ |= 128 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ManagementClusterBuilder) Name(value string) *ManagementClusterBuilder { + b.name = value + b.bitmap_ |= 256 + return b +} + +// Parent sets the value of the 'parent' attribute to the given value. +// +// ManagementClusterParent reference settings of the cluster. +func (b *ManagementClusterBuilder) Parent(value *ManagementClusterParentBuilder) *ManagementClusterBuilder { + b.parent = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// Region sets the value of the 'region' attribute to the given value. +func (b *ManagementClusterBuilder) Region(value string) *ManagementClusterBuilder { + b.region = value + b.bitmap_ |= 1024 + return b +} + +// Sector sets the value of the 'sector' attribute to the given value. +func (b *ManagementClusterBuilder) Sector(value string) *ManagementClusterBuilder { + b.sector = value + b.bitmap_ |= 2048 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *ManagementClusterBuilder) Status(value string) *ManagementClusterBuilder { + b.status = value + b.bitmap_ |= 4096 + return b +} + +// UpdateTimestamp sets the value of the 'update_timestamp' attribute to the given value. +func (b *ManagementClusterBuilder) UpdateTimestamp(value time.Time) *ManagementClusterBuilder { + b.updateTimestamp = value + b.bitmap_ |= 8192 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ManagementClusterBuilder) Copy(object *ManagementCluster) *ManagementClusterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.dns != nil { + b.dns = NewDNS().Copy(object.dns) + } else { + b.dns = nil + } + b.cloudProvider = object.cloudProvider + if object.clusterManagementReference != nil { + b.clusterManagementReference = NewClusterManagementReference().Copy(object.clusterManagementReference) + } else { + b.clusterManagementReference = nil + } + b.creationTimestamp = object.creationTimestamp + if object.labels != nil { + b.labels = make([]*LabelBuilder, len(object.labels)) + for i, v := range object.labels { + b.labels[i] = NewLabel().Copy(v) + } + } else { + b.labels = nil + } + b.name = object.name + if object.parent != nil { + b.parent = NewManagementClusterParent().Copy(object.parent) + } else { + b.parent = nil + } + b.region = object.region + b.sector = object.sector + b.status = object.status + b.updateTimestamp = object.updateTimestamp + return b +} + +// Build creates a 'management_cluster' object using the configuration stored in the builder. +func (b *ManagementClusterBuilder) Build() (object *ManagementCluster, err error) { + object = new(ManagementCluster) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.dns != nil { + object.dns, err = b.dns.Build() + if err != nil { + return + } + } + object.cloudProvider = b.cloudProvider + if b.clusterManagementReference != nil { + object.clusterManagementReference, err = b.clusterManagementReference.Build() + if err != nil { + return + } + } + object.creationTimestamp = b.creationTimestamp + if b.labels != nil { + object.labels = make([]*Label, len(b.labels)) + for i, v := range b.labels { + object.labels[i], err = v.Build() + if err != nil { + return + } + } + } + object.name = b.name + if b.parent != nil { + object.parent, err = b.parent.Build() + if err != nil { + return + } + } + object.region = b.region + object.sector = b.sector + object.status = b.status + object.updateTimestamp = b.updateTimestamp + return +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_list_builder.go b/clientapi/osdfleetmgmt/v1/management_cluster_list_builder.go new file mode 100644 index 00000000..fa599d29 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ManagementClusterListBuilder contains the data and logic needed to build +// 'management_cluster' objects. +type ManagementClusterListBuilder struct { + items []*ManagementClusterBuilder +} + +// NewManagementClusterList creates a new builder of 'management_cluster' objects. +func NewManagementClusterList() *ManagementClusterListBuilder { + return new(ManagementClusterListBuilder) +} + +// Items sets the items of the list. +func (b *ManagementClusterListBuilder) Items(values ...*ManagementClusterBuilder) *ManagementClusterListBuilder { + b.items = make([]*ManagementClusterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ManagementClusterListBuilder) 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 *ManagementClusterListBuilder) Copy(list *ManagementClusterList) *ManagementClusterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ManagementClusterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewManagementCluster().Copy(v) + } + } + return b +} + +// Build creates a list of 'management_cluster' objects using the +// configuration stored in the builder. +func (b *ManagementClusterListBuilder) Build() (list *ManagementClusterList, err error) { + items := make([]*ManagementCluster, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ManagementClusterList) + list.items = items + return +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_list_type_json.go b/clientapi/osdfleetmgmt/v1/management_cluster_list_type_json.go new file mode 100644 index 00000000..397db0d0 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalManagementClusterList writes a list of values of the 'management_cluster' type to +// the given writer. +func MarshalManagementClusterList(list []*ManagementCluster, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManagementClusterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManagementClusterList writes a list of value of the 'management_cluster' type to +// the given stream. +func WriteManagementClusterList(list []*ManagementCluster, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteManagementCluster(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalManagementClusterList reads a list of values of the 'management_cluster' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalManagementClusterList(source interface{}) (items []*ManagementCluster, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadManagementClusterList(iterator) + err = iterator.Error + return +} + +// ReadManagementClusterList reads list of values of the ”management_cluster' type from +// the given iterator. +func ReadManagementClusterList(iterator *jsoniter.Iterator) []*ManagementCluster { + list := []*ManagementCluster{} + for iterator.ReadArray() { + item := ReadManagementCluster(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_parent_builder.go b/clientapi/osdfleetmgmt/v1/management_cluster_parent_builder.go new file mode 100644 index 00000000..8a2253dc --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_parent_builder.go @@ -0,0 +1,93 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ManagementClusterParentBuilder contains the data and logic needed to build 'management_cluster_parent' objects. +// +// ManagementClusterParent reference settings of the cluster. +type ManagementClusterParentBuilder struct { + bitmap_ uint32 + clusterId string + href string + kind string + name string +} + +// NewManagementClusterParent creates a new builder of 'management_cluster_parent' objects. +func NewManagementClusterParent() *ManagementClusterParentBuilder { + return &ManagementClusterParentBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ManagementClusterParentBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ClusterId sets the value of the 'cluster_id' attribute to the given value. +func (b *ManagementClusterParentBuilder) ClusterId(value string) *ManagementClusterParentBuilder { + b.clusterId = value + b.bitmap_ |= 1 + return b +} + +// Href sets the value of the 'href' attribute to the given value. +func (b *ManagementClusterParentBuilder) Href(value string) *ManagementClusterParentBuilder { + b.href = value + b.bitmap_ |= 2 + return b +} + +// Kind sets the value of the 'kind' attribute to the given value. +func (b *ManagementClusterParentBuilder) Kind(value string) *ManagementClusterParentBuilder { + b.kind = value + b.bitmap_ |= 4 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ManagementClusterParentBuilder) Name(value string) *ManagementClusterParentBuilder { + b.name = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ManagementClusterParentBuilder) Copy(object *ManagementClusterParent) *ManagementClusterParentBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.clusterId = object.clusterId + b.href = object.href + b.kind = object.kind + b.name = object.name + return b +} + +// Build creates a 'management_cluster_parent' object using the configuration stored in the builder. +func (b *ManagementClusterParentBuilder) Build() (object *ManagementClusterParent, err error) { + object = new(ManagementClusterParent) + object.bitmap_ = b.bitmap_ + object.clusterId = b.clusterId + object.href = b.href + object.kind = b.kind + object.name = b.name + return +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_parent_list_builder.go b/clientapi/osdfleetmgmt/v1/management_cluster_parent_list_builder.go new file mode 100644 index 00000000..73e58dd9 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_parent_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ManagementClusterParentListBuilder contains the data and logic needed to build +// 'management_cluster_parent' objects. +type ManagementClusterParentListBuilder struct { + items []*ManagementClusterParentBuilder +} + +// NewManagementClusterParentList creates a new builder of 'management_cluster_parent' objects. +func NewManagementClusterParentList() *ManagementClusterParentListBuilder { + return new(ManagementClusterParentListBuilder) +} + +// Items sets the items of the list. +func (b *ManagementClusterParentListBuilder) Items(values ...*ManagementClusterParentBuilder) *ManagementClusterParentListBuilder { + b.items = make([]*ManagementClusterParentBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ManagementClusterParentListBuilder) 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 *ManagementClusterParentListBuilder) Copy(list *ManagementClusterParentList) *ManagementClusterParentListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ManagementClusterParentBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewManagementClusterParent().Copy(v) + } + } + return b +} + +// Build creates a list of 'management_cluster_parent' objects using the +// configuration stored in the builder. +func (b *ManagementClusterParentListBuilder) Build() (list *ManagementClusterParentList, err error) { + items := make([]*ManagementClusterParent, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ManagementClusterParentList) + list.items = items + return +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_parent_list_type_json.go b/clientapi/osdfleetmgmt/v1/management_cluster_parent_list_type_json.go new file mode 100644 index 00000000..832dd106 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_parent_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalManagementClusterParentList writes a list of values of the 'management_cluster_parent' type to +// the given writer. +func MarshalManagementClusterParentList(list []*ManagementClusterParent, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManagementClusterParentList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManagementClusterParentList writes a list of value of the 'management_cluster_parent' type to +// the given stream. +func WriteManagementClusterParentList(list []*ManagementClusterParent, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteManagementClusterParent(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalManagementClusterParentList reads a list of values of the 'management_cluster_parent' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalManagementClusterParentList(source interface{}) (items []*ManagementClusterParent, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadManagementClusterParentList(iterator) + err = iterator.Error + return +} + +// ReadManagementClusterParentList reads list of values of the ”management_cluster_parent' type from +// the given iterator. +func ReadManagementClusterParentList(iterator *jsoniter.Iterator) []*ManagementClusterParent { + list := []*ManagementClusterParent{} + for iterator.ReadArray() { + item := ReadManagementClusterParent(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_parent_type.go b/clientapi/osdfleetmgmt/v1/management_cluster_parent_type.go new file mode 100644 index 00000000..518fbf50 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_parent_type.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ManagementClusterParent represents the values of the 'management_cluster_parent' type. +// +// ManagementClusterParent reference settings of the cluster. +type ManagementClusterParent struct { + bitmap_ uint32 + clusterId string + href string + kind string + name string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ManagementClusterParent) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ClusterId returns the value of the 'cluster_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Parent Cluster ID +func (o *ManagementClusterParent) ClusterId() string { + if o != nil && o.bitmap_&1 != 0 { + return o.clusterId + } + return "" +} + +// GetClusterId returns the value of the 'cluster_id' attribute and +// a flag indicating if the attribute has a value. +// +// Parent Cluster ID +func (o *ManagementClusterParent) GetClusterId() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.clusterId + } + return +} + +// Href returns the value of the 'href' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Reference link to internal parent cluster +func (o *ManagementClusterParent) Href() string { + if o != nil && o.bitmap_&2 != 0 { + return o.href + } + return "" +} + +// GetHref returns the value of the 'href' attribute and +// a flag indicating if the attribute has a value. +// +// Reference link to internal parent cluster +func (o *ManagementClusterParent) GetHref() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.href + } + return +} + +// Kind returns the value of the 'kind' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Kind of internal parent cluster +func (o *ManagementClusterParent) Kind() string { + if o != nil && o.bitmap_&4 != 0 { + return o.kind + } + return "" +} + +// GetKind returns the value of the 'kind' attribute and +// a flag indicating if the attribute has a value. +// +// Kind of internal parent cluster +func (o *ManagementClusterParent) GetKind() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.kind + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Parent Cluster Name +func (o *ManagementClusterParent) Name() string { + if o != nil && o.bitmap_&8 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Parent Cluster Name +func (o *ManagementClusterParent) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.name + } + return +} + +// ManagementClusterParentListKind is the name of the type used to represent list of objects of +// type 'management_cluster_parent'. +const ManagementClusterParentListKind = "ManagementClusterParentList" + +// ManagementClusterParentListLinkKind is the name of the type used to represent links to list +// of objects of type 'management_cluster_parent'. +const ManagementClusterParentListLinkKind = "ManagementClusterParentListLink" + +// ManagementClusterParentNilKind is the name of the type used to nil lists of objects of +// type 'management_cluster_parent'. +const ManagementClusterParentListNilKind = "ManagementClusterParentListNil" + +// ManagementClusterParentList is a list of values of the 'management_cluster_parent' type. +type ManagementClusterParentList struct { + href string + link bool + items []*ManagementClusterParent +} + +// Len returns the length of the list. +func (l *ManagementClusterParentList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ManagementClusterParentList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ManagementClusterParentList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ManagementClusterParentList) SetItems(items []*ManagementClusterParent) { + l.items = items +} + +// Items returns the items of the list. +func (l *ManagementClusterParentList) Items() []*ManagementClusterParent { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ManagementClusterParentList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ManagementClusterParentList) Get(i int) *ManagementClusterParent { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ManagementClusterParentList) Slice() []*ManagementClusterParent { + var slice []*ManagementClusterParent + if l == nil { + slice = make([]*ManagementClusterParent, 0) + } else { + slice = make([]*ManagementClusterParent, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ManagementClusterParentList) Each(f func(item *ManagementClusterParent) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ManagementClusterParentList) Range(f func(index int, item *ManagementClusterParent) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_parent_type_json.go b/clientapi/osdfleetmgmt/v1/management_cluster_parent_type_json.go new file mode 100644 index 00000000..a9864913 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_parent_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalManagementClusterParent writes a value of the 'management_cluster_parent' type to the given writer. +func MarshalManagementClusterParent(object *ManagementClusterParent, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManagementClusterParent(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManagementClusterParent writes a value of the 'management_cluster_parent' type to the given stream. +func WriteManagementClusterParent(object *ManagementClusterParent, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterId) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kind") + stream.WriteString(object.kind) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + } + stream.WriteObjectEnd() +} + +// UnmarshalManagementClusterParent reads a value of the 'management_cluster_parent' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalManagementClusterParent(source interface{}) (object *ManagementClusterParent, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadManagementClusterParent(iterator) + err = iterator.Error + return +} + +// ReadManagementClusterParent reads a value of the 'management_cluster_parent' type from the given iterator. +func ReadManagementClusterParent(iterator *jsoniter.Iterator) *ManagementClusterParent { + object := &ManagementClusterParent{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "cluster_id": + value := iterator.ReadString() + object.clusterId = value + object.bitmap_ |= 1 + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 2 + case "kind": + value := iterator.ReadString() + object.kind = value + object.bitmap_ |= 4 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_builder.go b/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_builder.go new file mode 100644 index 00000000..ccde8f17 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_builder.go @@ -0,0 +1,61 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ManagementClusterRequestPayloadBuilder contains the data and logic needed to build 'management_cluster_request_payload' objects. +type ManagementClusterRequestPayloadBuilder struct { + bitmap_ uint32 + service_cluster_idService_cluster_idService_cluster_idService_cluster_idId string +} + +// NewManagementClusterRequestPayload creates a new builder of 'management_cluster_request_payload' objects. +func NewManagementClusterRequestPayload() *ManagementClusterRequestPayloadBuilder { + return &ManagementClusterRequestPayloadBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ManagementClusterRequestPayloadBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Service_cluster_idService_cluster_idService_cluster_idService_cluster_idId sets the value of the 'service_cluster_id_service_cluster_id_service_cluster_id_service_cluster_id_id' attribute to the given value. +func (b *ManagementClusterRequestPayloadBuilder) Service_cluster_idService_cluster_idService_cluster_idService_cluster_idId(value string) *ManagementClusterRequestPayloadBuilder { + b.service_cluster_idService_cluster_idService_cluster_idService_cluster_idId = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ManagementClusterRequestPayloadBuilder) Copy(object *ManagementClusterRequestPayload) *ManagementClusterRequestPayloadBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.service_cluster_idService_cluster_idService_cluster_idService_cluster_idId = object.service_cluster_idService_cluster_idService_cluster_idService_cluster_idId + return b +} + +// Build creates a 'management_cluster_request_payload' object using the configuration stored in the builder. +func (b *ManagementClusterRequestPayloadBuilder) Build() (object *ManagementClusterRequestPayload, err error) { + object = new(ManagementClusterRequestPayload) + object.bitmap_ = b.bitmap_ + object.service_cluster_idService_cluster_idService_cluster_idService_cluster_idId = b.service_cluster_idService_cluster_idService_cluster_idService_cluster_idId + return +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_list_builder.go b/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_list_builder.go new file mode 100644 index 00000000..7626bb1e --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ManagementClusterRequestPayloadListBuilder contains the data and logic needed to build +// 'management_cluster_request_payload' objects. +type ManagementClusterRequestPayloadListBuilder struct { + items []*ManagementClusterRequestPayloadBuilder +} + +// NewManagementClusterRequestPayloadList creates a new builder of 'management_cluster_request_payload' objects. +func NewManagementClusterRequestPayloadList() *ManagementClusterRequestPayloadListBuilder { + return new(ManagementClusterRequestPayloadListBuilder) +} + +// Items sets the items of the list. +func (b *ManagementClusterRequestPayloadListBuilder) Items(values ...*ManagementClusterRequestPayloadBuilder) *ManagementClusterRequestPayloadListBuilder { + b.items = make([]*ManagementClusterRequestPayloadBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ManagementClusterRequestPayloadListBuilder) 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 *ManagementClusterRequestPayloadListBuilder) Copy(list *ManagementClusterRequestPayloadList) *ManagementClusterRequestPayloadListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ManagementClusterRequestPayloadBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewManagementClusterRequestPayload().Copy(v) + } + } + return b +} + +// Build creates a list of 'management_cluster_request_payload' objects using the +// configuration stored in the builder. +func (b *ManagementClusterRequestPayloadListBuilder) Build() (list *ManagementClusterRequestPayloadList, err error) { + items := make([]*ManagementClusterRequestPayload, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ManagementClusterRequestPayloadList) + list.items = items + return +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_list_type_json.go b/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_list_type_json.go new file mode 100644 index 00000000..c37b9c4e --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalManagementClusterRequestPayloadList writes a list of values of the 'management_cluster_request_payload' type to +// the given writer. +func MarshalManagementClusterRequestPayloadList(list []*ManagementClusterRequestPayload, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManagementClusterRequestPayloadList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManagementClusterRequestPayloadList writes a list of value of the 'management_cluster_request_payload' type to +// the given stream. +func WriteManagementClusterRequestPayloadList(list []*ManagementClusterRequestPayload, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteManagementClusterRequestPayload(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalManagementClusterRequestPayloadList reads a list of values of the 'management_cluster_request_payload' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalManagementClusterRequestPayloadList(source interface{}) (items []*ManagementClusterRequestPayload, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadManagementClusterRequestPayloadList(iterator) + err = iterator.Error + return +} + +// ReadManagementClusterRequestPayloadList reads list of values of the ”management_cluster_request_payload' type from +// the given iterator. +func ReadManagementClusterRequestPayloadList(iterator *jsoniter.Iterator) []*ManagementClusterRequestPayload { + list := []*ManagementClusterRequestPayload{} + for iterator.ReadArray() { + item := ReadManagementClusterRequestPayload(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_type.go b/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_type.go new file mode 100644 index 00000000..bb412b36 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_type.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ManagementClusterRequestPayload represents the values of the 'management_cluster_request_payload' type. +type ManagementClusterRequestPayload struct { + bitmap_ uint32 + service_cluster_idService_cluster_idService_cluster_idService_cluster_idId string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ManagementClusterRequestPayload) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Service_cluster_idService_cluster_idService_cluster_idService_cluster_idId returns the value of the 'service_cluster_id_service_cluster_id_service_cluster_id_service_cluster_id_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ManagementClusterRequestPayload) Service_cluster_idService_cluster_idService_cluster_idService_cluster_idId() string { + if o != nil && o.bitmap_&1 != 0 { + return o.service_cluster_idService_cluster_idService_cluster_idService_cluster_idId + } + return "" +} + +// GetService_cluster_idService_cluster_idService_cluster_idService_cluster_idId returns the value of the 'service_cluster_id_service_cluster_id_service_cluster_id_service_cluster_id_id' attribute and +// a flag indicating if the attribute has a value. +func (o *ManagementClusterRequestPayload) GetService_cluster_idService_cluster_idService_cluster_idService_cluster_idId() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.service_cluster_idService_cluster_idService_cluster_idService_cluster_idId + } + return +} + +// ManagementClusterRequestPayloadListKind is the name of the type used to represent list of objects of +// type 'management_cluster_request_payload'. +const ManagementClusterRequestPayloadListKind = "ManagementClusterRequestPayloadList" + +// ManagementClusterRequestPayloadListLinkKind is the name of the type used to represent links to list +// of objects of type 'management_cluster_request_payload'. +const ManagementClusterRequestPayloadListLinkKind = "ManagementClusterRequestPayloadListLink" + +// ManagementClusterRequestPayloadNilKind is the name of the type used to nil lists of objects of +// type 'management_cluster_request_payload'. +const ManagementClusterRequestPayloadListNilKind = "ManagementClusterRequestPayloadListNil" + +// ManagementClusterRequestPayloadList is a list of values of the 'management_cluster_request_payload' type. +type ManagementClusterRequestPayloadList struct { + href string + link bool + items []*ManagementClusterRequestPayload +} + +// Len returns the length of the list. +func (l *ManagementClusterRequestPayloadList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ManagementClusterRequestPayloadList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ManagementClusterRequestPayloadList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ManagementClusterRequestPayloadList) SetItems(items []*ManagementClusterRequestPayload) { + l.items = items +} + +// Items returns the items of the list. +func (l *ManagementClusterRequestPayloadList) Items() []*ManagementClusterRequestPayload { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ManagementClusterRequestPayloadList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ManagementClusterRequestPayloadList) Get(i int) *ManagementClusterRequestPayload { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ManagementClusterRequestPayloadList) Slice() []*ManagementClusterRequestPayload { + var slice []*ManagementClusterRequestPayload + if l == nil { + slice = make([]*ManagementClusterRequestPayload, 0) + } else { + slice = make([]*ManagementClusterRequestPayload, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ManagementClusterRequestPayloadList) Each(f func(item *ManagementClusterRequestPayload) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ManagementClusterRequestPayloadList) Range(f func(index int, item *ManagementClusterRequestPayload) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_type_json.go b/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_type_json.go new file mode 100644 index 00000000..1549ed3a --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_request_payload_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalManagementClusterRequestPayload writes a value of the 'management_cluster_request_payload' type to the given writer. +func MarshalManagementClusterRequestPayload(object *ManagementClusterRequestPayload, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManagementClusterRequestPayload(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManagementClusterRequestPayload writes a value of the 'management_cluster_request_payload' type to the given stream. +func WriteManagementClusterRequestPayload(object *ManagementClusterRequestPayload, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_cluster_id_service_cluster_id_service_cluster_id_service_cluster_id_id") + stream.WriteString(object.service_cluster_idService_cluster_idService_cluster_idService_cluster_idId) + } + stream.WriteObjectEnd() +} + +// UnmarshalManagementClusterRequestPayload reads a value of the 'management_cluster_request_payload' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalManagementClusterRequestPayload(source interface{}) (object *ManagementClusterRequestPayload, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadManagementClusterRequestPayload(iterator) + err = iterator.Error + return +} + +// ReadManagementClusterRequestPayload reads a value of the 'management_cluster_request_payload' type from the given iterator. +func ReadManagementClusterRequestPayload(iterator *jsoniter.Iterator) *ManagementClusterRequestPayload { + object := &ManagementClusterRequestPayload{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "service_cluster_id_service_cluster_id_service_cluster_id_service_cluster_id_id": + value := iterator.ReadString() + object.service_cluster_idService_cluster_idService_cluster_idService_cluster_idId = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_type.go b/clientapi/osdfleetmgmt/v1/management_cluster_type.go new file mode 100644 index 00000000..b00c74ab --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_type.go @@ -0,0 +1,547 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + time "time" +) + +// ManagementClusterKind is the name of the type used to represent objects +// of type 'management_cluster'. +const ManagementClusterKind = "ManagementCluster" + +// ManagementClusterLinkKind is the name of the type used to represent links +// to objects of type 'management_cluster'. +const ManagementClusterLinkKind = "ManagementClusterLink" + +// ManagementClusterNilKind is the name of the type used to nil references +// to objects of type 'management_cluster'. +const ManagementClusterNilKind = "ManagementClusterNil" + +// ManagementCluster represents the values of the 'management_cluster' type. +// +// Definition of an _OpenShift_ cluster. +// +// The `cloud_provider` attribute is a reference to the cloud provider. When a +// cluster is retrieved it will be a link to the cloud provider, containing only +// the kind, id and href attributes: +// +// ```json +// +// { +// "cloud_provider": { +// "kind": "CloudProviderLink", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/cloud_providers/123" +// } +// } +// +// ``` +// +// When a cluster is created this is optional, and if used it should contain the +// identifier of the cloud provider to use: +// +// ```json +// +// { +// "cloud_provider": { +// "id": "123", +// } +// } +// +// ``` +// +// If not included, then the cluster will be created using the default cloud +// provider, which is currently Amazon Web Services. +// +// The region attribute is mandatory when a cluster is created. +// +// The `aws.access_key_id`, `aws.secret_access_key` and `dns.base_domain` +// attributes are mandatory when creation a cluster with your own Amazon Web +// Services account. +type ManagementCluster struct { + bitmap_ uint32 + id string + href string + dns *DNS + cloudProvider string + clusterManagementReference *ClusterManagementReference + creationTimestamp time.Time + labels []*Label + name string + parent *ManagementClusterParent + region string + sector string + status string + updateTimestamp time.Time +} + +// Kind returns the name of the type of the object. +func (o *ManagementCluster) Kind() string { + if o == nil { + return ManagementClusterNilKind + } + if o.bitmap_&1 != 0 { + return ManagementClusterLinkKind + } + return ManagementClusterKind +} + +// Link returns true if this is a link. +func (o *ManagementCluster) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ManagementCluster) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ManagementCluster) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ManagementCluster) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ManagementCluster) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ManagementCluster) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// DNS returns the value of the 'DNS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DNS settings of the cluster. +func (o *ManagementCluster) DNS() *DNS { + if o != nil && o.bitmap_&8 != 0 { + return o.dns + } + return nil +} + +// GetDNS returns the value of the 'DNS' attribute and +// a flag indicating if the attribute has a value. +// +// DNS settings of the cluster. +func (o *ManagementCluster) GetDNS() (value *DNS, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.dns + } + return +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cloud provider where the cluster is installed. +func (o *ManagementCluster) CloudProvider() string { + if o != nil && o.bitmap_&16 != 0 { + return o.cloudProvider + } + return "" +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +// +// Cloud provider where the cluster is installed. +func (o *ManagementCluster) GetCloudProvider() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// ClusterManagementReference returns the value of the 'cluster_management_reference' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster mgmt reference +func (o *ManagementCluster) ClusterManagementReference() *ClusterManagementReference { + if o != nil && o.bitmap_&32 != 0 { + return o.clusterManagementReference + } + return nil +} + +// GetClusterManagementReference returns the value of the 'cluster_management_reference' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster mgmt reference +func (o *ManagementCluster) GetClusterManagementReference() (value *ClusterManagementReference, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.clusterManagementReference + } + return +} + +// CreationTimestamp returns the value of the 'creation_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Creation timestamp of the cluster +func (o *ManagementCluster) CreationTimestamp() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.creationTimestamp + } + return time.Time{} +} + +// GetCreationTimestamp returns the value of the 'creation_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Creation timestamp of the cluster +func (o *ManagementCluster) GetCreationTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.creationTimestamp + } + return +} + +// Labels returns the value of the 'labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Labels on management cluster +func (o *ManagementCluster) Labels() []*Label { + if o != nil && o.bitmap_&128 != 0 { + return o.labels + } + return nil +} + +// GetLabels returns the value of the 'labels' attribute and +// a flag indicating if the attribute has a value. +// +// Labels on management cluster +func (o *ManagementCluster) GetLabels() (value []*Label, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.labels + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster name +func (o *ManagementCluster) Name() string { + if o != nil && o.bitmap_&256 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster name +func (o *ManagementCluster) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.name + } + return +} + +// Parent returns the value of the 'parent' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Service cluster handling the management cluster +func (o *ManagementCluster) Parent() *ManagementClusterParent { + if o != nil && o.bitmap_&512 != 0 { + return o.parent + } + return nil +} + +// GetParent returns the value of the 'parent' attribute and +// a flag indicating if the attribute has a value. +// +// Service cluster handling the management cluster +func (o *ManagementCluster) GetParent() (value *ManagementClusterParent, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.parent + } + return +} + +// Region returns the value of the 'region' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cloud provider region where the cluster is installed. +func (o *ManagementCluster) Region() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.region + } + return "" +} + +// GetRegion returns the value of the 'region' attribute and +// a flag indicating if the attribute has a value. +// +// Cloud provider region where the cluster is installed. +func (o *ManagementCluster) GetRegion() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.region + } + return +} + +// Sector returns the value of the 'sector' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Sector of cluster +func (o *ManagementCluster) Sector() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.sector + } + return "" +} + +// GetSector returns the value of the 'sector' attribute and +// a flag indicating if the attribute has a value. +// +// Sector of cluster +func (o *ManagementCluster) GetSector() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.sector + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Status of cluster +func (o *ManagementCluster) Status() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.status + } + return "" +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// Status of cluster +func (o *ManagementCluster) GetStatus() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.status + } + return +} + +// UpdateTimestamp returns the value of the 'update_timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Update timestamp of the cluster +func (o *ManagementCluster) UpdateTimestamp() time.Time { + if o != nil && o.bitmap_&8192 != 0 { + return o.updateTimestamp + } + return time.Time{} +} + +// GetUpdateTimestamp returns the value of the 'update_timestamp' attribute and +// a flag indicating if the attribute has a value. +// +// Update timestamp of the cluster +func (o *ManagementCluster) GetUpdateTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.updateTimestamp + } + return +} + +// ManagementClusterListKind is the name of the type used to represent list of objects of +// type 'management_cluster'. +const ManagementClusterListKind = "ManagementClusterList" + +// ManagementClusterListLinkKind is the name of the type used to represent links to list +// of objects of type 'management_cluster'. +const ManagementClusterListLinkKind = "ManagementClusterListLink" + +// ManagementClusterNilKind is the name of the type used to nil lists of objects of +// type 'management_cluster'. +const ManagementClusterListNilKind = "ManagementClusterListNil" + +// ManagementClusterList is a list of values of the 'management_cluster' type. +type ManagementClusterList struct { + href string + link bool + items []*ManagementCluster +} + +// Kind returns the name of the type of the object. +func (l *ManagementClusterList) Kind() string { + if l == nil { + return ManagementClusterListNilKind + } + if l.link { + return ManagementClusterListLinkKind + } + return ManagementClusterListKind +} + +// Link returns true iif this is a link. +func (l *ManagementClusterList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ManagementClusterList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ManagementClusterList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ManagementClusterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ManagementClusterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ManagementClusterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ManagementClusterList) SetItems(items []*ManagementCluster) { + l.items = items +} + +// Items returns the items of the list. +func (l *ManagementClusterList) Items() []*ManagementCluster { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ManagementClusterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ManagementClusterList) Get(i int) *ManagementCluster { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ManagementClusterList) Slice() []*ManagementCluster { + var slice []*ManagementCluster + if l == nil { + slice = make([]*ManagementCluster, 0) + } else { + slice = make([]*ManagementCluster, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ManagementClusterList) Each(f func(item *ManagementCluster) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ManagementClusterList) Range(f func(index int, item *ManagementCluster) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/osdfleetmgmt/v1/management_cluster_type_json.go b/clientapi/osdfleetmgmt/v1/management_cluster_type_json.go new file mode 100644 index 00000000..a1fe69bb --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/management_cluster_type_json.go @@ -0,0 +1,259 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalManagementCluster writes a value of the 'management_cluster' type to the given writer. +func MarshalManagementCluster(object *ManagementCluster, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManagementCluster(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManagementCluster writes a value of the 'management_cluster' type to the given stream. +func WriteManagementCluster(object *ManagementCluster, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ManagementClusterLinkKind) + } else { + stream.WriteString(ManagementClusterKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.dns != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("dns") + WriteDNS(object.dns, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + stream.WriteString(object.cloudProvider) + count++ + } + present_ = object.bitmap_&32 != 0 && object.clusterManagementReference != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_management_reference") + WriteClusterManagementReference(object.clusterManagementReference, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creation_timestamp") + stream.WriteString((object.creationTimestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 && object.labels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("labels") + WriteLabelList(object.labels, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&512 != 0 && object.parent != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("parent") + WriteManagementClusterParent(object.parent, stream) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region") + stream.WriteString(object.region) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sector") + stream.WriteString(object.sector) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteString(object.status) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("update_timestamp") + stream.WriteString((object.updateTimestamp).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalManagementCluster reads a value of the 'management_cluster' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalManagementCluster(source interface{}) (object *ManagementCluster, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadManagementCluster(iterator) + err = iterator.Error + return +} + +// ReadManagementCluster reads a value of the 'management_cluster' type from the given iterator. +func ReadManagementCluster(iterator *jsoniter.Iterator) *ManagementCluster { + object := &ManagementCluster{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ManagementClusterLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "dns": + value := ReadDNS(iterator) + object.dns = value + object.bitmap_ |= 8 + case "cloud_provider": + value := iterator.ReadString() + object.cloudProvider = value + object.bitmap_ |= 16 + case "cluster_management_reference": + value := ReadClusterManagementReference(iterator) + object.clusterManagementReference = value + object.bitmap_ |= 32 + case "creation_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.creationTimestamp = value + object.bitmap_ |= 64 + case "labels": + value := ReadLabelList(iterator) + object.labels = value + object.bitmap_ |= 128 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 256 + case "parent": + value := ReadManagementClusterParent(iterator) + object.parent = value + object.bitmap_ |= 512 + case "region": + value := iterator.ReadString() + object.region = value + object.bitmap_ |= 1024 + case "sector": + value := iterator.ReadString() + object.sector = value + object.bitmap_ |= 2048 + case "status": + value := iterator.ReadString() + object.status = value + object.bitmap_ |= 4096 + case "update_timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.updateTimestamp = value + object.bitmap_ |= 8192 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/osdfleetmgmt/v1/metadata_reader.go b/clientapi/osdfleetmgmt/v1/metadata_reader.go new file mode 100644 index 00000000..0041d274 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/metadata_reader.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMetadata writes a value of the metadata type to the given target, which +// can be a writer or a JSON encoder. +func MarshalMetadata(object *Metadata, writer io.Writer) error { + stream := helpers.NewStream(writer) + writeMetadata(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} +func writeMetadata(object *Metadata, stream *jsoniter.Stream) { + stream.WriteObjectStart() + if object.bitmap_&1 != 0 { + stream.WriteObjectField("server_version") + stream.WriteString(object.serverVersion) + } + stream.WriteObjectEnd() +} + +// UnmarshalMetadata reads a value of the metadata type from the given source, which +// which can be a reader, a slice of byte or a string. +func UnmarshalMetadata(source interface{}) (object *Metadata, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = readMetadata(iterator) + err = iterator.Error + return +} +func readMetadata(iterator *jsoniter.Iterator) *Metadata { + object := &Metadata{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "server_version": + object.serverVersion = iterator.ReadString() + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/osdfleetmgmt/v1/metadata_type.go b/clientapi/osdfleetmgmt/v1/metadata_type.go new file mode 100644 index 00000000..349fb360 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/metadata_type.go @@ -0,0 +1,44 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// Metadata contains the version metadata. +type Metadata struct { + bitmap_ uint32 + serverVersion string +} + +// ServerVersion returns the version of the server. +func (m *Metadata) ServerVersion() string { + if m != nil && m.bitmap_&1 != 0 { + return m.serverVersion + } + return "" +} + +// GetServerVersion returns the value of the server version and a flag indicating if +// the attribute has a value. +func (m *Metadata) GetServerVersion() (value string, ok bool) { + ok = m != nil && m.bitmap_&1 != 0 + if ok { + value = m.serverVersion + } + return +} diff --git a/clientapi/osdfleetmgmt/v1/provision_shard_reference_builder.go b/clientapi/osdfleetmgmt/v1/provision_shard_reference_builder.go new file mode 100644 index 00000000..36eaf478 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/provision_shard_reference_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ProvisionShardReferenceBuilder contains the data and logic needed to build 'provision_shard_reference' objects. +// +// Provision Shard Reference of the cluster. +type ProvisionShardReferenceBuilder struct { + bitmap_ uint32 + href string + id string +} + +// NewProvisionShardReference creates a new builder of 'provision_shard_reference' objects. +func NewProvisionShardReference() *ProvisionShardReferenceBuilder { + return &ProvisionShardReferenceBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ProvisionShardReferenceBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Href sets the value of the 'href' attribute to the given value. +func (b *ProvisionShardReferenceBuilder) Href(value string) *ProvisionShardReferenceBuilder { + b.href = value + b.bitmap_ |= 1 + return b +} + +// Id sets the value of the 'id' attribute to the given value. +func (b *ProvisionShardReferenceBuilder) Id(value string) *ProvisionShardReferenceBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ProvisionShardReferenceBuilder) Copy(object *ProvisionShardReference) *ProvisionShardReferenceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.href = object.href + b.id = object.id + return b +} + +// Build creates a 'provision_shard_reference' object using the configuration stored in the builder. +func (b *ProvisionShardReferenceBuilder) Build() (object *ProvisionShardReference, err error) { + object = new(ProvisionShardReference) + object.bitmap_ = b.bitmap_ + object.href = b.href + object.id = b.id + return +} diff --git a/clientapi/osdfleetmgmt/v1/provision_shard_reference_list_builder.go b/clientapi/osdfleetmgmt/v1/provision_shard_reference_list_builder.go new file mode 100644 index 00000000..83377a7f --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/provision_shard_reference_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ProvisionShardReferenceListBuilder contains the data and logic needed to build +// 'provision_shard_reference' objects. +type ProvisionShardReferenceListBuilder struct { + items []*ProvisionShardReferenceBuilder +} + +// NewProvisionShardReferenceList creates a new builder of 'provision_shard_reference' objects. +func NewProvisionShardReferenceList() *ProvisionShardReferenceListBuilder { + return new(ProvisionShardReferenceListBuilder) +} + +// Items sets the items of the list. +func (b *ProvisionShardReferenceListBuilder) Items(values ...*ProvisionShardReferenceBuilder) *ProvisionShardReferenceListBuilder { + b.items = make([]*ProvisionShardReferenceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ProvisionShardReferenceListBuilder) 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 *ProvisionShardReferenceListBuilder) Copy(list *ProvisionShardReferenceList) *ProvisionShardReferenceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ProvisionShardReferenceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewProvisionShardReference().Copy(v) + } + } + return b +} + +// Build creates a list of 'provision_shard_reference' objects using the +// configuration stored in the builder. +func (b *ProvisionShardReferenceListBuilder) Build() (list *ProvisionShardReferenceList, err error) { + items := make([]*ProvisionShardReference, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ProvisionShardReferenceList) + list.items = items + return +} diff --git a/clientapi/osdfleetmgmt/v1/provision_shard_reference_list_type_json.go b/clientapi/osdfleetmgmt/v1/provision_shard_reference_list_type_json.go new file mode 100644 index 00000000..321acf10 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/provision_shard_reference_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProvisionShardReferenceList writes a list of values of the 'provision_shard_reference' type to +// the given writer. +func MarshalProvisionShardReferenceList(list []*ProvisionShardReference, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProvisionShardReferenceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProvisionShardReferenceList writes a list of value of the 'provision_shard_reference' type to +// the given stream. +func WriteProvisionShardReferenceList(list []*ProvisionShardReference, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteProvisionShardReference(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalProvisionShardReferenceList reads a list of values of the 'provision_shard_reference' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProvisionShardReferenceList(source interface{}) (items []*ProvisionShardReference, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProvisionShardReferenceList(iterator) + err = iterator.Error + return +} + +// ReadProvisionShardReferenceList reads list of values of the ”provision_shard_reference' type from +// the given iterator. +func ReadProvisionShardReferenceList(iterator *jsoniter.Iterator) []*ProvisionShardReference { + list := []*ProvisionShardReference{} + for iterator.ReadArray() { + item := ReadProvisionShardReference(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/provision_shard_reference_type.go b/clientapi/osdfleetmgmt/v1/provision_shard_reference_type.go new file mode 100644 index 00000000..a73b7679 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/provision_shard_reference_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ProvisionShardReference represents the values of the 'provision_shard_reference' type. +// +// Provision Shard Reference of the cluster. +type ProvisionShardReference struct { + bitmap_ uint32 + href string + id string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ProvisionShardReference) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Href returns the value of the 'href' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// link to the Provision Shards associated to the cluster +func (o *ProvisionShardReference) Href() string { + if o != nil && o.bitmap_&1 != 0 { + return o.href + } + return "" +} + +// GetHref returns the value of the 'href' attribute and +// a flag indicating if the attribute has a value. +// +// link to the Provision Shards associated to the cluster +func (o *ProvisionShardReference) GetHref() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.href + } + return +} + +// Id returns the value of the 'id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Id of the Provision Shards associated to the Ocluster +func (o *ProvisionShardReference) Id() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetId returns the value of the 'id' attribute and +// a flag indicating if the attribute has a value. +// +// Id of the Provision Shards associated to the Ocluster +func (o *ProvisionShardReference) GetId() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// ProvisionShardReferenceListKind is the name of the type used to represent list of objects of +// type 'provision_shard_reference'. +const ProvisionShardReferenceListKind = "ProvisionShardReferenceList" + +// ProvisionShardReferenceListLinkKind is the name of the type used to represent links to list +// of objects of type 'provision_shard_reference'. +const ProvisionShardReferenceListLinkKind = "ProvisionShardReferenceListLink" + +// ProvisionShardReferenceNilKind is the name of the type used to nil lists of objects of +// type 'provision_shard_reference'. +const ProvisionShardReferenceListNilKind = "ProvisionShardReferenceListNil" + +// ProvisionShardReferenceList is a list of values of the 'provision_shard_reference' type. +type ProvisionShardReferenceList struct { + href string + link bool + items []*ProvisionShardReference +} + +// Len returns the length of the list. +func (l *ProvisionShardReferenceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ProvisionShardReferenceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ProvisionShardReferenceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ProvisionShardReferenceList) SetItems(items []*ProvisionShardReference) { + l.items = items +} + +// Items returns the items of the list. +func (l *ProvisionShardReferenceList) Items() []*ProvisionShardReference { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ProvisionShardReferenceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ProvisionShardReferenceList) Get(i int) *ProvisionShardReference { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ProvisionShardReferenceList) Slice() []*ProvisionShardReference { + var slice []*ProvisionShardReference + if l == nil { + slice = make([]*ProvisionShardReference, 0) + } else { + slice = make([]*ProvisionShardReference, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ProvisionShardReferenceList) Each(f func(item *ProvisionShardReference) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ProvisionShardReferenceList) Range(f func(index int, item *ProvisionShardReference) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/osdfleetmgmt/v1/provision_shard_reference_type_json.go b/clientapi/osdfleetmgmt/v1/provision_shard_reference_type_json.go new file mode 100644 index 00000000..59ea8697 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/provision_shard_reference_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProvisionShardReference writes a value of the 'provision_shard_reference' type to the given writer. +func MarshalProvisionShardReference(object *ProvisionShardReference, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProvisionShardReference(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProvisionShardReference writes a value of the 'provision_shard_reference' type to the given stream. +func WriteProvisionShardReference(object *ProvisionShardReference, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + } + stream.WriteObjectEnd() +} + +// UnmarshalProvisionShardReference reads a value of the 'provision_shard_reference' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalProvisionShardReference(source interface{}) (object *ProvisionShardReference, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadProvisionShardReference(iterator) + err = iterator.Error + return +} + +// ReadProvisionShardReference reads a value of the 'provision_shard_reference' type from the given iterator. +func ReadProvisionShardReference(iterator *jsoniter.Iterator) *ProvisionShardReference { + object := &ProvisionShardReference{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 1 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/osdfleetmgmt/v1/service_cluster_builder.go b/clientapi/osdfleetmgmt/v1/service_cluster_builder.go new file mode 100644 index 00000000..1cc94588 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/service_cluster_builder.go @@ -0,0 +1,268 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ServiceClusterBuilder contains the data and logic needed to build 'service_cluster' objects. +// +// Definition of an _OpenShift_ cluster. +// +// The `cloud_provider` attribute is a reference to the cloud provider. When a +// cluster is retrieved it will be a link to the cloud provider, containing only +// the kind, id and href attributes: +// +// ```json +// +// { +// "cloud_provider": { +// "kind": "CloudProviderLink", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/cloud_providers/123" +// } +// } +// +// ``` +// +// When a cluster is created this is optional, and if used it should contain the +// identifier of the cloud provider to use: +// +// ```json +// +// { +// "cloud_provider": { +// "id": "123", +// } +// } +// +// ``` +// +// If not included, then the cluster will be created using the default cloud +// provider, which is currently Amazon Web Services. +// +// The region attribute is mandatory when a cluster is created. +// +// The `aws.access_key_id`, `aws.secret_access_key` and `dns.base_domain` +// attributes are mandatory when creation a cluster with your own Amazon Web +// Services account. +type ServiceClusterBuilder struct { + bitmap_ uint32 + id string + href string + dns *DNSBuilder + cloudProvider string + clusterManagementReference *ClusterManagementReferenceBuilder + labels []*LabelBuilder + name string + provisionShardReference *ProvisionShardReferenceBuilder + region string + sector string + status string +} + +// NewServiceCluster creates a new builder of 'service_cluster' objects. +func NewServiceCluster() *ServiceClusterBuilder { + return &ServiceClusterBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ServiceClusterBuilder) Link(value bool) *ServiceClusterBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ServiceClusterBuilder) ID(value string) *ServiceClusterBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ServiceClusterBuilder) HREF(value string) *ServiceClusterBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ServiceClusterBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// DNS sets the value of the 'DNS' attribute to the given value. +// +// DNS settings of the cluster. +func (b *ServiceClusterBuilder) DNS(value *DNSBuilder) *ServiceClusterBuilder { + b.dns = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +func (b *ServiceClusterBuilder) CloudProvider(value string) *ServiceClusterBuilder { + b.cloudProvider = value + b.bitmap_ |= 16 + return b +} + +// ClusterManagementReference sets the value of the 'cluster_management_reference' attribute to the given value. +// +// Cluster Mgmt reference settings of the cluster. +func (b *ServiceClusterBuilder) ClusterManagementReference(value *ClusterManagementReferenceBuilder) *ServiceClusterBuilder { + b.clusterManagementReference = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Labels sets the value of the 'labels' attribute to the given values. +func (b *ServiceClusterBuilder) Labels(values ...*LabelBuilder) *ServiceClusterBuilder { + b.labels = make([]*LabelBuilder, len(values)) + copy(b.labels, values) + b.bitmap_ |= 64 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ServiceClusterBuilder) Name(value string) *ServiceClusterBuilder { + b.name = value + b.bitmap_ |= 128 + return b +} + +// ProvisionShardReference sets the value of the 'provision_shard_reference' attribute to the given value. +// +// Provision Shard Reference of the cluster. +func (b *ServiceClusterBuilder) ProvisionShardReference(value *ProvisionShardReferenceBuilder) *ServiceClusterBuilder { + b.provisionShardReference = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// Region sets the value of the 'region' attribute to the given value. +func (b *ServiceClusterBuilder) Region(value string) *ServiceClusterBuilder { + b.region = value + b.bitmap_ |= 512 + return b +} + +// Sector sets the value of the 'sector' attribute to the given value. +func (b *ServiceClusterBuilder) Sector(value string) *ServiceClusterBuilder { + b.sector = value + b.bitmap_ |= 1024 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *ServiceClusterBuilder) Status(value string) *ServiceClusterBuilder { + b.status = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ServiceClusterBuilder) Copy(object *ServiceCluster) *ServiceClusterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.dns != nil { + b.dns = NewDNS().Copy(object.dns) + } else { + b.dns = nil + } + b.cloudProvider = object.cloudProvider + if object.clusterManagementReference != nil { + b.clusterManagementReference = NewClusterManagementReference().Copy(object.clusterManagementReference) + } else { + b.clusterManagementReference = nil + } + if object.labels != nil { + b.labels = make([]*LabelBuilder, len(object.labels)) + for i, v := range object.labels { + b.labels[i] = NewLabel().Copy(v) + } + } else { + b.labels = nil + } + b.name = object.name + if object.provisionShardReference != nil { + b.provisionShardReference = NewProvisionShardReference().Copy(object.provisionShardReference) + } else { + b.provisionShardReference = nil + } + b.region = object.region + b.sector = object.sector + b.status = object.status + return b +} + +// Build creates a 'service_cluster' object using the configuration stored in the builder. +func (b *ServiceClusterBuilder) Build() (object *ServiceCluster, err error) { + object = new(ServiceCluster) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.dns != nil { + object.dns, err = b.dns.Build() + if err != nil { + return + } + } + object.cloudProvider = b.cloudProvider + if b.clusterManagementReference != nil { + object.clusterManagementReference, err = b.clusterManagementReference.Build() + if err != nil { + return + } + } + if b.labels != nil { + object.labels = make([]*Label, len(b.labels)) + for i, v := range b.labels { + object.labels[i], err = v.Build() + if err != nil { + return + } + } + } + object.name = b.name + if b.provisionShardReference != nil { + object.provisionShardReference, err = b.provisionShardReference.Build() + if err != nil { + return + } + } + object.region = b.region + object.sector = b.sector + object.status = b.status + return +} diff --git a/clientapi/osdfleetmgmt/v1/service_cluster_list_builder.go b/clientapi/osdfleetmgmt/v1/service_cluster_list_builder.go new file mode 100644 index 00000000..3cdb71c9 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/service_cluster_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ServiceClusterListBuilder contains the data and logic needed to build +// 'service_cluster' objects. +type ServiceClusterListBuilder struct { + items []*ServiceClusterBuilder +} + +// NewServiceClusterList creates a new builder of 'service_cluster' objects. +func NewServiceClusterList() *ServiceClusterListBuilder { + return new(ServiceClusterListBuilder) +} + +// Items sets the items of the list. +func (b *ServiceClusterListBuilder) Items(values ...*ServiceClusterBuilder) *ServiceClusterListBuilder { + b.items = make([]*ServiceClusterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ServiceClusterListBuilder) 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 *ServiceClusterListBuilder) Copy(list *ServiceClusterList) *ServiceClusterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ServiceClusterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewServiceCluster().Copy(v) + } + } + return b +} + +// Build creates a list of 'service_cluster' objects using the +// configuration stored in the builder. +func (b *ServiceClusterListBuilder) Build() (list *ServiceClusterList, err error) { + items := make([]*ServiceCluster, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ServiceClusterList) + list.items = items + return +} diff --git a/clientapi/osdfleetmgmt/v1/service_cluster_list_type_json.go b/clientapi/osdfleetmgmt/v1/service_cluster_list_type_json.go new file mode 100644 index 00000000..01b0c6c7 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/service_cluster_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalServiceClusterList writes a list of values of the 'service_cluster' type to +// the given writer. +func MarshalServiceClusterList(list []*ServiceCluster, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServiceClusterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServiceClusterList writes a list of value of the 'service_cluster' type to +// the given stream. +func WriteServiceClusterList(list []*ServiceCluster, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteServiceCluster(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalServiceClusterList reads a list of values of the 'service_cluster' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalServiceClusterList(source interface{}) (items []*ServiceCluster, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadServiceClusterList(iterator) + err = iterator.Error + return +} + +// ReadServiceClusterList reads list of values of the ”service_cluster' type from +// the given iterator. +func ReadServiceClusterList(iterator *jsoniter.Iterator) []*ServiceCluster { + list := []*ServiceCluster{} + for iterator.ReadArray() { + item := ReadServiceCluster(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_builder.go b/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_builder.go new file mode 100644 index 00000000..4a2b9147 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_builder.go @@ -0,0 +1,97 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ServiceClusterRequestPayloadBuilder contains the data and logic needed to build 'service_cluster_request_payload' objects. +type ServiceClusterRequestPayloadBuilder struct { + bitmap_ uint32 + cloudProvider string + labels []*LabelRequestPayloadBuilder + region string +} + +// NewServiceClusterRequestPayload creates a new builder of 'service_cluster_request_payload' objects. +func NewServiceClusterRequestPayload() *ServiceClusterRequestPayloadBuilder { + return &ServiceClusterRequestPayloadBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ServiceClusterRequestPayloadBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// CloudProvider sets the value of the 'cloud_provider' attribute to the given value. +func (b *ServiceClusterRequestPayloadBuilder) CloudProvider(value string) *ServiceClusterRequestPayloadBuilder { + b.cloudProvider = value + b.bitmap_ |= 1 + return b +} + +// Labels sets the value of the 'labels' attribute to the given values. +func (b *ServiceClusterRequestPayloadBuilder) Labels(values ...*LabelRequestPayloadBuilder) *ServiceClusterRequestPayloadBuilder { + b.labels = make([]*LabelRequestPayloadBuilder, len(values)) + copy(b.labels, values) + b.bitmap_ |= 2 + return b +} + +// Region sets the value of the 'region' attribute to the given value. +func (b *ServiceClusterRequestPayloadBuilder) Region(value string) *ServiceClusterRequestPayloadBuilder { + b.region = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ServiceClusterRequestPayloadBuilder) Copy(object *ServiceClusterRequestPayload) *ServiceClusterRequestPayloadBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.cloudProvider = object.cloudProvider + if object.labels != nil { + b.labels = make([]*LabelRequestPayloadBuilder, len(object.labels)) + for i, v := range object.labels { + b.labels[i] = NewLabelRequestPayload().Copy(v) + } + } else { + b.labels = nil + } + b.region = object.region + return b +} + +// Build creates a 'service_cluster_request_payload' object using the configuration stored in the builder. +func (b *ServiceClusterRequestPayloadBuilder) Build() (object *ServiceClusterRequestPayload, err error) { + object = new(ServiceClusterRequestPayload) + object.bitmap_ = b.bitmap_ + object.cloudProvider = b.cloudProvider + if b.labels != nil { + object.labels = make([]*LabelRequestPayload, len(b.labels)) + for i, v := range b.labels { + object.labels[i], err = v.Build() + if err != nil { + return + } + } + } + object.region = b.region + return +} diff --git a/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_list_builder.go b/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_list_builder.go new file mode 100644 index 00000000..7fec85fd --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ServiceClusterRequestPayloadListBuilder contains the data and logic needed to build +// 'service_cluster_request_payload' objects. +type ServiceClusterRequestPayloadListBuilder struct { + items []*ServiceClusterRequestPayloadBuilder +} + +// NewServiceClusterRequestPayloadList creates a new builder of 'service_cluster_request_payload' objects. +func NewServiceClusterRequestPayloadList() *ServiceClusterRequestPayloadListBuilder { + return new(ServiceClusterRequestPayloadListBuilder) +} + +// Items sets the items of the list. +func (b *ServiceClusterRequestPayloadListBuilder) Items(values ...*ServiceClusterRequestPayloadBuilder) *ServiceClusterRequestPayloadListBuilder { + b.items = make([]*ServiceClusterRequestPayloadBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ServiceClusterRequestPayloadListBuilder) 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 *ServiceClusterRequestPayloadListBuilder) Copy(list *ServiceClusterRequestPayloadList) *ServiceClusterRequestPayloadListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ServiceClusterRequestPayloadBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewServiceClusterRequestPayload().Copy(v) + } + } + return b +} + +// Build creates a list of 'service_cluster_request_payload' objects using the +// configuration stored in the builder. +func (b *ServiceClusterRequestPayloadListBuilder) Build() (list *ServiceClusterRequestPayloadList, err error) { + items := make([]*ServiceClusterRequestPayload, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ServiceClusterRequestPayloadList) + list.items = items + return +} diff --git a/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_list_type_json.go b/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_list_type_json.go new file mode 100644 index 00000000..7cb217bc --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalServiceClusterRequestPayloadList writes a list of values of the 'service_cluster_request_payload' type to +// the given writer. +func MarshalServiceClusterRequestPayloadList(list []*ServiceClusterRequestPayload, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServiceClusterRequestPayloadList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServiceClusterRequestPayloadList writes a list of value of the 'service_cluster_request_payload' type to +// the given stream. +func WriteServiceClusterRequestPayloadList(list []*ServiceClusterRequestPayload, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteServiceClusterRequestPayload(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalServiceClusterRequestPayloadList reads a list of values of the 'service_cluster_request_payload' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalServiceClusterRequestPayloadList(source interface{}) (items []*ServiceClusterRequestPayload, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadServiceClusterRequestPayloadList(iterator) + err = iterator.Error + return +} + +// ReadServiceClusterRequestPayloadList reads list of values of the ”service_cluster_request_payload' type from +// the given iterator. +func ReadServiceClusterRequestPayloadList(iterator *jsoniter.Iterator) []*ServiceClusterRequestPayload { + list := []*ServiceClusterRequestPayload{} + for iterator.ReadArray() { + item := ReadServiceClusterRequestPayload(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_type.go b/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_type.go new file mode 100644 index 00000000..ad94caee --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_type.go @@ -0,0 +1,199 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ServiceClusterRequestPayload represents the values of the 'service_cluster_request_payload' type. +type ServiceClusterRequestPayload struct { + bitmap_ uint32 + cloudProvider string + labels []*LabelRequestPayload + region string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ServiceClusterRequestPayload) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ServiceClusterRequestPayload) CloudProvider() string { + if o != nil && o.bitmap_&1 != 0 { + return o.cloudProvider + } + return "" +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +func (o *ServiceClusterRequestPayload) GetCloudProvider() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// Labels returns the value of the 'labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ServiceClusterRequestPayload) Labels() []*LabelRequestPayload { + if o != nil && o.bitmap_&2 != 0 { + return o.labels + } + return nil +} + +// GetLabels returns the value of the 'labels' attribute and +// a flag indicating if the attribute has a value. +func (o *ServiceClusterRequestPayload) GetLabels() (value []*LabelRequestPayload, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.labels + } + return +} + +// Region returns the value of the 'region' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ServiceClusterRequestPayload) Region() string { + if o != nil && o.bitmap_&4 != 0 { + return o.region + } + return "" +} + +// GetRegion returns the value of the 'region' attribute and +// a flag indicating if the attribute has a value. +func (o *ServiceClusterRequestPayload) GetRegion() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.region + } + return +} + +// ServiceClusterRequestPayloadListKind is the name of the type used to represent list of objects of +// type 'service_cluster_request_payload'. +const ServiceClusterRequestPayloadListKind = "ServiceClusterRequestPayloadList" + +// ServiceClusterRequestPayloadListLinkKind is the name of the type used to represent links to list +// of objects of type 'service_cluster_request_payload'. +const ServiceClusterRequestPayloadListLinkKind = "ServiceClusterRequestPayloadListLink" + +// ServiceClusterRequestPayloadNilKind is the name of the type used to nil lists of objects of +// type 'service_cluster_request_payload'. +const ServiceClusterRequestPayloadListNilKind = "ServiceClusterRequestPayloadListNil" + +// ServiceClusterRequestPayloadList is a list of values of the 'service_cluster_request_payload' type. +type ServiceClusterRequestPayloadList struct { + href string + link bool + items []*ServiceClusterRequestPayload +} + +// Len returns the length of the list. +func (l *ServiceClusterRequestPayloadList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ServiceClusterRequestPayloadList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ServiceClusterRequestPayloadList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ServiceClusterRequestPayloadList) SetItems(items []*ServiceClusterRequestPayload) { + l.items = items +} + +// Items returns the items of the list. +func (l *ServiceClusterRequestPayloadList) Items() []*ServiceClusterRequestPayload { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ServiceClusterRequestPayloadList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ServiceClusterRequestPayloadList) Get(i int) *ServiceClusterRequestPayload { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ServiceClusterRequestPayloadList) Slice() []*ServiceClusterRequestPayload { + var slice []*ServiceClusterRequestPayload + if l == nil { + slice = make([]*ServiceClusterRequestPayload, 0) + } else { + slice = make([]*ServiceClusterRequestPayload, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ServiceClusterRequestPayloadList) Each(f func(item *ServiceClusterRequestPayload) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ServiceClusterRequestPayloadList) Range(f func(index int, item *ServiceClusterRequestPayload) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_type_json.go b/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_type_json.go new file mode 100644 index 00000000..2ef89a8c --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/service_cluster_request_payload_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalServiceClusterRequestPayload writes a value of the 'service_cluster_request_payload' type to the given writer. +func MarshalServiceClusterRequestPayload(object *ServiceClusterRequestPayload, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServiceClusterRequestPayload(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServiceClusterRequestPayload writes a value of the 'service_cluster_request_payload' type to the given stream. +func WriteServiceClusterRequestPayload(object *ServiceClusterRequestPayload, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + stream.WriteString(object.cloudProvider) + count++ + } + present_ = object.bitmap_&2 != 0 && object.labels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("labels") + WriteLabelRequestPayloadList(object.labels, stream) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region") + stream.WriteString(object.region) + } + stream.WriteObjectEnd() +} + +// UnmarshalServiceClusterRequestPayload reads a value of the 'service_cluster_request_payload' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalServiceClusterRequestPayload(source interface{}) (object *ServiceClusterRequestPayload, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadServiceClusterRequestPayload(iterator) + err = iterator.Error + return +} + +// ReadServiceClusterRequestPayload reads a value of the 'service_cluster_request_payload' type from the given iterator. +func ReadServiceClusterRequestPayload(iterator *jsoniter.Iterator) *ServiceClusterRequestPayload { + object := &ServiceClusterRequestPayload{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "cloud_provider": + value := iterator.ReadString() + object.cloudProvider = value + object.bitmap_ |= 1 + case "labels": + value := ReadLabelRequestPayloadList(iterator) + object.labels = value + object.bitmap_ |= 2 + case "region": + value := iterator.ReadString() + object.region = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/osdfleetmgmt/v1/service_cluster_type.go b/clientapi/osdfleetmgmt/v1/service_cluster_type.go new file mode 100644 index 00000000..81874228 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/service_cluster_type.go @@ -0,0 +1,495 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +// ServiceClusterKind is the name of the type used to represent objects +// of type 'service_cluster'. +const ServiceClusterKind = "ServiceCluster" + +// ServiceClusterLinkKind is the name of the type used to represent links +// to objects of type 'service_cluster'. +const ServiceClusterLinkKind = "ServiceClusterLink" + +// ServiceClusterNilKind is the name of the type used to nil references +// to objects of type 'service_cluster'. +const ServiceClusterNilKind = "ServiceClusterNil" + +// ServiceCluster represents the values of the 'service_cluster' type. +// +// Definition of an _OpenShift_ cluster. +// +// The `cloud_provider` attribute is a reference to the cloud provider. When a +// cluster is retrieved it will be a link to the cloud provider, containing only +// the kind, id and href attributes: +// +// ```json +// +// { +// "cloud_provider": { +// "kind": "CloudProviderLink", +// "id": "123", +// "href": "/api/clusters_mgmt/v1/cloud_providers/123" +// } +// } +// +// ``` +// +// When a cluster is created this is optional, and if used it should contain the +// identifier of the cloud provider to use: +// +// ```json +// +// { +// "cloud_provider": { +// "id": "123", +// } +// } +// +// ``` +// +// If not included, then the cluster will be created using the default cloud +// provider, which is currently Amazon Web Services. +// +// The region attribute is mandatory when a cluster is created. +// +// The `aws.access_key_id`, `aws.secret_access_key` and `dns.base_domain` +// attributes are mandatory when creation a cluster with your own Amazon Web +// Services account. +type ServiceCluster struct { + bitmap_ uint32 + id string + href string + dns *DNS + cloudProvider string + clusterManagementReference *ClusterManagementReference + labels []*Label + name string + provisionShardReference *ProvisionShardReference + region string + sector string + status string +} + +// Kind returns the name of the type of the object. +func (o *ServiceCluster) Kind() string { + if o == nil { + return ServiceClusterNilKind + } + if o.bitmap_&1 != 0 { + return ServiceClusterLinkKind + } + return ServiceClusterKind +} + +// Link returns true if this is a link. +func (o *ServiceCluster) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ServiceCluster) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ServiceCluster) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ServiceCluster) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ServiceCluster) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ServiceCluster) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// DNS returns the value of the 'DNS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DNS settings of the cluster. +func (o *ServiceCluster) DNS() *DNS { + if o != nil && o.bitmap_&8 != 0 { + return o.dns + } + return nil +} + +// GetDNS returns the value of the 'DNS' attribute and +// a flag indicating if the attribute has a value. +// +// DNS settings of the cluster. +func (o *ServiceCluster) GetDNS() (value *DNS, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.dns + } + return +} + +// CloudProvider returns the value of the 'cloud_provider' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cloud provider where the cluster is installed. +func (o *ServiceCluster) CloudProvider() string { + if o != nil && o.bitmap_&16 != 0 { + return o.cloudProvider + } + return "" +} + +// GetCloudProvider returns the value of the 'cloud_provider' attribute and +// a flag indicating if the attribute has a value. +// +// Cloud provider where the cluster is installed. +func (o *ServiceCluster) GetCloudProvider() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.cloudProvider + } + return +} + +// ClusterManagementReference returns the value of the 'cluster_management_reference' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster mgmt reference +func (o *ServiceCluster) ClusterManagementReference() *ClusterManagementReference { + if o != nil && o.bitmap_&32 != 0 { + return o.clusterManagementReference + } + return nil +} + +// GetClusterManagementReference returns the value of the 'cluster_management_reference' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster mgmt reference +func (o *ServiceCluster) GetClusterManagementReference() (value *ClusterManagementReference, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.clusterManagementReference + } + return +} + +// Labels returns the value of the 'labels' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Labels on service cluster +func (o *ServiceCluster) Labels() []*Label { + if o != nil && o.bitmap_&64 != 0 { + return o.labels + } + return nil +} + +// GetLabels returns the value of the 'labels' attribute and +// a flag indicating if the attribute has a value. +// +// Labels on service cluster +func (o *ServiceCluster) GetLabels() (value []*Label, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.labels + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cluster name +func (o *ServiceCluster) Name() string { + if o != nil && o.bitmap_&128 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Cluster name +func (o *ServiceCluster) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.name + } + return +} + +// ProvisionShardReference returns the value of the 'provision_shard_reference' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Provision shard reference for the service cluster +func (o *ServiceCluster) ProvisionShardReference() *ProvisionShardReference { + if o != nil && o.bitmap_&256 != 0 { + return o.provisionShardReference + } + return nil +} + +// GetProvisionShardReference returns the value of the 'provision_shard_reference' attribute and +// a flag indicating if the attribute has a value. +// +// Provision shard reference for the service cluster +func (o *ServiceCluster) GetProvisionShardReference() (value *ProvisionShardReference, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.provisionShardReference + } + return +} + +// Region returns the value of the 'region' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Cloud provider region where the cluster is installed. +func (o *ServiceCluster) Region() string { + if o != nil && o.bitmap_&512 != 0 { + return o.region + } + return "" +} + +// GetRegion returns the value of the 'region' attribute and +// a flag indicating if the attribute has a value. +// +// Cloud provider region where the cluster is installed. +func (o *ServiceCluster) GetRegion() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.region + } + return +} + +// Sector returns the value of the 'sector' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Sector of cluster +func (o *ServiceCluster) Sector() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.sector + } + return "" +} + +// GetSector returns the value of the 'sector' attribute and +// a flag indicating if the attribute has a value. +// +// Sector of cluster +func (o *ServiceCluster) GetSector() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.sector + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Status of cluster +func (o *ServiceCluster) Status() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.status + } + return "" +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// Status of cluster +func (o *ServiceCluster) GetStatus() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.status + } + return +} + +// ServiceClusterListKind is the name of the type used to represent list of objects of +// type 'service_cluster'. +const ServiceClusterListKind = "ServiceClusterList" + +// ServiceClusterListLinkKind is the name of the type used to represent links to list +// of objects of type 'service_cluster'. +const ServiceClusterListLinkKind = "ServiceClusterListLink" + +// ServiceClusterNilKind is the name of the type used to nil lists of objects of +// type 'service_cluster'. +const ServiceClusterListNilKind = "ServiceClusterListNil" + +// ServiceClusterList is a list of values of the 'service_cluster' type. +type ServiceClusterList struct { + href string + link bool + items []*ServiceCluster +} + +// Kind returns the name of the type of the object. +func (l *ServiceClusterList) Kind() string { + if l == nil { + return ServiceClusterListNilKind + } + if l.link { + return ServiceClusterListLinkKind + } + return ServiceClusterListKind +} + +// Link returns true iif this is a link. +func (l *ServiceClusterList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ServiceClusterList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ServiceClusterList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ServiceClusterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ServiceClusterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ServiceClusterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ServiceClusterList) SetItems(items []*ServiceCluster) { + l.items = items +} + +// Items returns the items of the list. +func (l *ServiceClusterList) Items() []*ServiceCluster { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ServiceClusterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ServiceClusterList) Get(i int) *ServiceCluster { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ServiceClusterList) Slice() []*ServiceCluster { + var slice []*ServiceCluster + if l == nil { + slice = make([]*ServiceCluster, 0) + } else { + slice = make([]*ServiceCluster, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ServiceClusterList) Each(f func(item *ServiceCluster) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ServiceClusterList) Range(f func(index int, item *ServiceCluster) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/osdfleetmgmt/v1/service_cluster_type_json.go b/clientapi/osdfleetmgmt/v1/service_cluster_type_json.go new file mode 100644 index 00000000..0b20e4a6 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/service_cluster_type_json.go @@ -0,0 +1,224 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalServiceCluster writes a value of the 'service_cluster' type to the given writer. +func MarshalServiceCluster(object *ServiceCluster, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServiceCluster(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServiceCluster writes a value of the 'service_cluster' type to the given stream. +func WriteServiceCluster(object *ServiceCluster, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ServiceClusterLinkKind) + } else { + stream.WriteString(ServiceClusterKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.dns != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("dns") + WriteDNS(object.dns, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cloud_provider") + stream.WriteString(object.cloudProvider) + count++ + } + present_ = object.bitmap_&32 != 0 && object.clusterManagementReference != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_management_reference") + WriteClusterManagementReference(object.clusterManagementReference, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.labels != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("labels") + WriteLabelList(object.labels, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&256 != 0 && object.provisionShardReference != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("provision_shard_reference") + WriteProvisionShardReference(object.provisionShardReference, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region") + stream.WriteString(object.region) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sector") + stream.WriteString(object.sector) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteString(object.status) + } + stream.WriteObjectEnd() +} + +// UnmarshalServiceCluster reads a value of the 'service_cluster' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalServiceCluster(source interface{}) (object *ServiceCluster, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadServiceCluster(iterator) + err = iterator.Error + return +} + +// ReadServiceCluster reads a value of the 'service_cluster' type from the given iterator. +func ReadServiceCluster(iterator *jsoniter.Iterator) *ServiceCluster { + object := &ServiceCluster{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ServiceClusterLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "dns": + value := ReadDNS(iterator) + object.dns = value + object.bitmap_ |= 8 + case "cloud_provider": + value := iterator.ReadString() + object.cloudProvider = value + object.bitmap_ |= 16 + case "cluster_management_reference": + value := ReadClusterManagementReference(iterator) + object.clusterManagementReference = value + object.bitmap_ |= 32 + case "labels": + value := ReadLabelList(iterator) + object.labels = value + object.bitmap_ |= 64 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 128 + case "provision_shard_reference": + value := ReadProvisionShardReference(iterator) + object.provisionShardReference = value + object.bitmap_ |= 256 + case "region": + value := iterator.ReadString() + object.region = value + object.bitmap_ |= 512 + case "sector": + value := iterator.ReadString() + object.sector = value + object.bitmap_ |= 1024 + case "status": + value := iterator.ReadString() + object.status = value + object.bitmap_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/osdfleetmgmt/v1/string_list_type_json.go b/clientapi/osdfleetmgmt/v1/string_list_type_json.go new file mode 100644 index 00000000..dab8e046 --- /dev/null +++ b/clientapi/osdfleetmgmt/v1/string_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/osdfleetmgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStringList writes a list of values of the 'string' type to +// the given writer. +func MarshalStringList(list []string, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStringList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStringList writes a list of value of the 'string' type to +// the given stream. +func WriteStringList(list []string, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalStringList reads a list of values of the 'string' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStringList(source interface{}) (items []string, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStringList(iterator) + err = iterator.Error + return +} + +// ReadStringList reads list of values of the ”string' type from +// the given iterator. +func ReadStringList(iterator *jsoniter.Iterator) []string { + list := []string{} + for iterator.ReadArray() { + item := iterator.ReadString() + list = append(list, item) + } + return list +} diff --git a/clientapi/servicelogs/v1/boolean_list_type_json.go b/clientapi/servicelogs/v1/boolean_list_type_json.go new file mode 100644 index 00000000..b771f1d1 --- /dev/null +++ b/clientapi/servicelogs/v1/boolean_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBooleanList writes a list of values of the 'boolean' type to +// the given writer. +func MarshalBooleanList(list []bool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBooleanList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBooleanList writes a list of value of the 'boolean' type to +// the given stream. +func WriteBooleanList(list []bool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteBool(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalBooleanList reads a list of values of the 'boolean' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBooleanList(source interface{}) (items []bool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBooleanList(iterator) + err = iterator.Error + return +} + +// ReadBooleanList reads list of values of the ”boolean' type from +// the given iterator. +func ReadBooleanList(iterator *jsoniter.Iterator) []bool { + list := []bool{} + for iterator.ReadArray() { + item := iterator.ReadBool() + list = append(list, item) + } + return list +} diff --git a/clientapi/servicelogs/v1/date_list_type_json.go b/clientapi/servicelogs/v1/date_list_type_json.go new file mode 100644 index 00000000..8b17a246 --- /dev/null +++ b/clientapi/servicelogs/v1/date_list_type_json.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDateList writes a list of values of the 'date' type to +// the given writer. +func MarshalDateList(list []time.Time, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDateList writes a list of value of the 'date' type to +// the given stream. +func WriteDateList(list []time.Time, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString((value).Format(time.RFC3339)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDateList reads a list of values of the 'date' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDateList(source interface{}) (items []time.Time, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDateList(iterator) + err = iterator.Error + return +} + +// ReadDateList reads list of values of the ”date' type from +// the given iterator. +func ReadDateList(iterator *jsoniter.Iterator) []time.Time { + list := []time.Time{} + for iterator.ReadArray() { + text := iterator.ReadString() + item, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + list = append(list, item) + } + return list +} diff --git a/clientapi/servicelogs/v1/float_list_type_json.go b/clientapi/servicelogs/v1/float_list_type_json.go new file mode 100644 index 00000000..2f6561ed --- /dev/null +++ b/clientapi/servicelogs/v1/float_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFloatList writes a list of values of the 'float' type to +// the given writer. +func MarshalFloatList(list []float64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFloatList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFloatList writes a list of value of the 'float' type to +// the given stream. +func WriteFloatList(list []float64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteFloat64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalFloatList reads a list of values of the 'float' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFloatList(source interface{}) (items []float64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFloatList(iterator) + err = iterator.Error + return +} + +// ReadFloatList reads list of values of the ”float' type from +// the given iterator. +func ReadFloatList(iterator *jsoniter.Iterator) []float64 { + list := []float64{} + for iterator.ReadArray() { + item := iterator.ReadFloat64() + list = append(list, item) + } + return list +} diff --git a/clientapi/servicelogs/v1/integer_list_type_json.go b/clientapi/servicelogs/v1/integer_list_type_json.go new file mode 100644 index 00000000..8ae986da --- /dev/null +++ b/clientapi/servicelogs/v1/integer_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIntegerList writes a list of values of the 'integer' type to +// the given writer. +func MarshalIntegerList(list []int, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIntegerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIntegerList writes a list of value of the 'integer' type to +// the given stream. +func WriteIntegerList(list []int, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalIntegerList reads a list of values of the 'integer' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIntegerList(source interface{}) (items []int, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIntegerList(iterator) + err = iterator.Error + return +} + +// ReadIntegerList reads list of values of the ”integer' type from +// the given iterator. +func ReadIntegerList(iterator *jsoniter.Iterator) []int { + list := []int{} + for iterator.ReadArray() { + item := iterator.ReadInt() + list = append(list, item) + } + return list +} diff --git a/clientapi/servicelogs/v1/interface_list_type_json.go b/clientapi/servicelogs/v1/interface_list_type_json.go new file mode 100644 index 00000000..512d628c --- /dev/null +++ b/clientapi/servicelogs/v1/interface_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInterfaceList writes a list of values of the 'interface' type to +// the given writer. +func MarshalInterfaceList(list []interface{}, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInterfaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInterfaceList writes a list of value of the 'interface' type to +// the given stream. +func WriteInterfaceList(list []interface{}, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteVal(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalInterfaceList reads a list of values of the 'interface' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInterfaceList(source interface{}) (items []interface{}, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInterfaceList(iterator) + err = iterator.Error + return +} + +// ReadInterfaceList reads list of values of the ”interface' type from +// the given iterator. +func ReadInterfaceList(iterator *jsoniter.Iterator) []interface{} { + list := []interface{}{} + for iterator.ReadArray() { + var item interface{} + iterator.ReadVal(&item) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicelogs/v1/log_entry_builder.go b/clientapi/servicelogs/v1/log_entry_builder.go new file mode 100644 index 00000000..ba274074 --- /dev/null +++ b/clientapi/servicelogs/v1/log_entry_builder.go @@ -0,0 +1,242 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + time "time" +) + +// LogEntryBuilder contains the data and logic needed to build 'log_entry' objects. +type LogEntryBuilder struct { + bitmap_ uint32 + id string + href string + clusterID string + clusterUUID string + createdAt time.Time + createdBy string + description string + docReferences []string + eventStreamID string + logType LogType + serviceName string + severity Severity + subscriptionID string + summary string + timestamp time.Time + username string + internalOnly bool +} + +// NewLogEntry creates a new builder of 'log_entry' objects. +func NewLogEntry() *LogEntryBuilder { + return &LogEntryBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *LogEntryBuilder) Link(value bool) *LogEntryBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *LogEntryBuilder) ID(value string) *LogEntryBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *LogEntryBuilder) HREF(value string) *LogEntryBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *LogEntryBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// ClusterID sets the value of the 'cluster_ID' attribute to the given value. +func (b *LogEntryBuilder) ClusterID(value string) *LogEntryBuilder { + b.clusterID = value + b.bitmap_ |= 8 + return b +} + +// ClusterUUID sets the value of the 'cluster_UUID' attribute to the given value. +func (b *LogEntryBuilder) ClusterUUID(value string) *LogEntryBuilder { + b.clusterUUID = value + b.bitmap_ |= 16 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *LogEntryBuilder) CreatedAt(value time.Time) *LogEntryBuilder { + b.createdAt = value + b.bitmap_ |= 32 + return b +} + +// CreatedBy sets the value of the 'created_by' attribute to the given value. +func (b *LogEntryBuilder) CreatedBy(value string) *LogEntryBuilder { + b.createdBy = value + b.bitmap_ |= 64 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *LogEntryBuilder) Description(value string) *LogEntryBuilder { + b.description = value + b.bitmap_ |= 128 + return b +} + +// DocReferences sets the value of the 'doc_references' attribute to the given values. +func (b *LogEntryBuilder) DocReferences(values ...string) *LogEntryBuilder { + b.docReferences = make([]string, len(values)) + copy(b.docReferences, values) + b.bitmap_ |= 256 + return b +} + +// EventStreamID sets the value of the 'event_stream_ID' attribute to the given value. +func (b *LogEntryBuilder) EventStreamID(value string) *LogEntryBuilder { + b.eventStreamID = value + b.bitmap_ |= 512 + return b +} + +// InternalOnly sets the value of the 'internal_only' attribute to the given value. +func (b *LogEntryBuilder) InternalOnly(value bool) *LogEntryBuilder { + b.internalOnly = value + b.bitmap_ |= 1024 + return b +} + +// LogType sets the value of the 'log_type' attribute to the given value. +// +// Representation of the log type field used in cluster log type model. +func (b *LogEntryBuilder) LogType(value LogType) *LogEntryBuilder { + b.logType = value + b.bitmap_ |= 2048 + return b +} + +// ServiceName sets the value of the 'service_name' attribute to the given value. +func (b *LogEntryBuilder) ServiceName(value string) *LogEntryBuilder { + b.serviceName = value + b.bitmap_ |= 4096 + return b +} + +// Severity sets the value of the 'severity' attribute to the given value. +func (b *LogEntryBuilder) Severity(value Severity) *LogEntryBuilder { + b.severity = value + b.bitmap_ |= 8192 + return b +} + +// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value. +func (b *LogEntryBuilder) SubscriptionID(value string) *LogEntryBuilder { + b.subscriptionID = value + b.bitmap_ |= 16384 + return b +} + +// Summary sets the value of the 'summary' attribute to the given value. +func (b *LogEntryBuilder) Summary(value string) *LogEntryBuilder { + b.summary = value + b.bitmap_ |= 32768 + return b +} + +// Timestamp sets the value of the 'timestamp' attribute to the given value. +func (b *LogEntryBuilder) Timestamp(value time.Time) *LogEntryBuilder { + b.timestamp = value + b.bitmap_ |= 65536 + return b +} + +// Username sets the value of the 'username' attribute to the given value. +func (b *LogEntryBuilder) Username(value string) *LogEntryBuilder { + b.username = value + b.bitmap_ |= 131072 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *LogEntryBuilder) Copy(object *LogEntry) *LogEntryBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.clusterID = object.clusterID + b.clusterUUID = object.clusterUUID + b.createdAt = object.createdAt + b.createdBy = object.createdBy + b.description = object.description + if object.docReferences != nil { + b.docReferences = make([]string, len(object.docReferences)) + copy(b.docReferences, object.docReferences) + } else { + b.docReferences = nil + } + b.eventStreamID = object.eventStreamID + b.internalOnly = object.internalOnly + b.logType = object.logType + b.serviceName = object.serviceName + b.severity = object.severity + b.subscriptionID = object.subscriptionID + b.summary = object.summary + b.timestamp = object.timestamp + b.username = object.username + return b +} + +// Build creates a 'log_entry' object using the configuration stored in the builder. +func (b *LogEntryBuilder) Build() (object *LogEntry, err error) { + object = new(LogEntry) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.clusterID = b.clusterID + object.clusterUUID = b.clusterUUID + object.createdAt = b.createdAt + object.createdBy = b.createdBy + object.description = b.description + if b.docReferences != nil { + object.docReferences = make([]string, len(b.docReferences)) + copy(object.docReferences, b.docReferences) + } + object.eventStreamID = b.eventStreamID + object.internalOnly = b.internalOnly + object.logType = b.logType + object.serviceName = b.serviceName + object.severity = b.severity + object.subscriptionID = b.subscriptionID + object.summary = b.summary + object.timestamp = b.timestamp + object.username = b.username + return +} diff --git a/clientapi/servicelogs/v1/log_entry_list_builder.go b/clientapi/servicelogs/v1/log_entry_list_builder.go new file mode 100644 index 00000000..9e48fb24 --- /dev/null +++ b/clientapi/servicelogs/v1/log_entry_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +// LogEntryListBuilder contains the data and logic needed to build +// 'log_entry' objects. +type LogEntryListBuilder struct { + items []*LogEntryBuilder +} + +// NewLogEntryList creates a new builder of 'log_entry' objects. +func NewLogEntryList() *LogEntryListBuilder { + return new(LogEntryListBuilder) +} + +// Items sets the items of the list. +func (b *LogEntryListBuilder) Items(values ...*LogEntryBuilder) *LogEntryListBuilder { + b.items = make([]*LogEntryBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *LogEntryListBuilder) 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 *LogEntryListBuilder) Copy(list *LogEntryList) *LogEntryListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*LogEntryBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewLogEntry().Copy(v) + } + } + return b +} + +// Build creates a list of 'log_entry' objects using the +// configuration stored in the builder. +func (b *LogEntryListBuilder) Build() (list *LogEntryList, err error) { + items := make([]*LogEntry, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(LogEntryList) + list.items = items + return +} diff --git a/clientapi/servicelogs/v1/log_entry_list_type_json.go b/clientapi/servicelogs/v1/log_entry_list_type_json.go new file mode 100644 index 00000000..b3dc7995 --- /dev/null +++ b/clientapi/servicelogs/v1/log_entry_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLogEntryList writes a list of values of the 'log_entry' type to +// the given writer. +func MarshalLogEntryList(list []*LogEntry, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLogEntryList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLogEntryList writes a list of value of the 'log_entry' type to +// the given stream. +func WriteLogEntryList(list []*LogEntry, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteLogEntry(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalLogEntryList reads a list of values of the 'log_entry' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLogEntryList(source interface{}) (items []*LogEntry, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLogEntryList(iterator) + err = iterator.Error + return +} + +// ReadLogEntryList reads list of values of the ”log_entry' type from +// the given iterator. +func ReadLogEntryList(iterator *jsoniter.Iterator) []*LogEntry { + list := []*LogEntry{} + for iterator.ReadArray() { + item := ReadLogEntry(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicelogs/v1/log_entry_type.go b/clientapi/servicelogs/v1/log_entry_type.go new file mode 100644 index 00000000..b3d026e7 --- /dev/null +++ b/clientapi/servicelogs/v1/log_entry_type.go @@ -0,0 +1,599 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + time "time" +) + +// LogEntryKind is the name of the type used to represent objects +// of type 'log_entry'. +const LogEntryKind = "LogEntry" + +// LogEntryLinkKind is the name of the type used to represent links +// to objects of type 'log_entry'. +const LogEntryLinkKind = "LogEntryLink" + +// LogEntryNilKind is the name of the type used to nil references +// to objects of type 'log_entry'. +const LogEntryNilKind = "LogEntryNil" + +// LogEntry represents the values of the 'log_entry' type. +type LogEntry struct { + bitmap_ uint32 + id string + href string + clusterID string + clusterUUID string + createdAt time.Time + createdBy string + description string + docReferences []string + eventStreamID string + logType LogType + serviceName string + severity Severity + subscriptionID string + summary string + timestamp time.Time + username string + internalOnly bool +} + +// Kind returns the name of the type of the object. +func (o *LogEntry) Kind() string { + if o == nil { + return LogEntryNilKind + } + if o.bitmap_&1 != 0 { + return LogEntryLinkKind + } + return LogEntryKind +} + +// Link returns true if this is a link. +func (o *LogEntry) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *LogEntry) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *LogEntry) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *LogEntry) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *LogEntry) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *LogEntry) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// ClusterID returns the value of the 'cluster_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Internal cluster ID. +func (o *LogEntry) ClusterID() string { + if o != nil && o.bitmap_&8 != 0 { + return o.clusterID + } + return "" +} + +// GetClusterID returns the value of the 'cluster_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Internal cluster ID. +func (o *LogEntry) GetClusterID() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.clusterID + } + return +} + +// ClusterUUID returns the value of the 'cluster_UUID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// External cluster ID. +func (o *LogEntry) ClusterUUID() string { + if o != nil && o.bitmap_&16 != 0 { + return o.clusterUUID + } + return "" +} + +// GetClusterUUID returns the value of the 'cluster_UUID' attribute and +// a flag indicating if the attribute has a value. +// +// External cluster ID. +func (o *LogEntry) GetClusterUUID() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.clusterUUID + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The time at which the cluster log was created. +func (o *LogEntry) CreatedAt() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// The time at which the cluster log was created. +func (o *LogEntry) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.createdAt + } + return +} + +// CreatedBy returns the value of the 'created_by' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the user who created the cluster log. +func (o *LogEntry) CreatedBy() string { + if o != nil && o.bitmap_&64 != 0 { + return o.createdBy + } + return "" +} + +// GetCreatedBy returns the value of the 'created_by' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the user who created the cluster log. +func (o *LogEntry) GetCreatedBy() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.createdBy + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Full description of the log entry content (supports Markdown format as well). +func (o *LogEntry) Description() string { + if o != nil && o.bitmap_&128 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +// +// Full description of the log entry content (supports Markdown format as well). +func (o *LogEntry) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.description + } + return +} + +// DocReferences returns the value of the 'doc_references' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The list of documentation references (i.e links) contained in the event. +func (o *LogEntry) DocReferences() []string { + if o != nil && o.bitmap_&256 != 0 { + return o.docReferences + } + return nil +} + +// GetDocReferences returns the value of the 'doc_references' attribute and +// a flag indicating if the attribute has a value. +// +// The list of documentation references (i.e links) contained in the event. +func (o *LogEntry) GetDocReferences() (value []string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.docReferences + } + return +} + +// EventStreamID returns the value of the 'event_stream_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Log custom event id for a simple search of related cluster logs. +func (o *LogEntry) EventStreamID() string { + if o != nil && o.bitmap_&512 != 0 { + return o.eventStreamID + } + return "" +} + +// GetEventStreamID returns the value of the 'event_stream_ID' attribute and +// a flag indicating if the attribute has a value. +// +// Log custom event id for a simple search of related cluster logs. +func (o *LogEntry) GetEventStreamID() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.eventStreamID + } + return +} + +// InternalOnly returns the value of the 'internal_only' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// A flag that indicates whether the log entry should be internal/private only. +func (o *LogEntry) InternalOnly() bool { + if o != nil && o.bitmap_&1024 != 0 { + return o.internalOnly + } + return false +} + +// GetInternalOnly returns the value of the 'internal_only' attribute and +// a flag indicating if the attribute has a value. +// +// A flag that indicates whether the log entry should be internal/private only. +func (o *LogEntry) GetInternalOnly() (value bool, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.internalOnly + } + return +} + +// LogType returns the value of the 'log_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of the service log entry. +func (o *LogEntry) LogType() LogType { + if o != nil && o.bitmap_&2048 != 0 { + return o.logType + } + return LogType("") +} + +// GetLogType returns the value of the 'log_type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of the service log entry. +func (o *LogEntry) GetLogType() (value LogType, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.logType + } + return +} + +// ServiceName returns the value of the 'service_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the service who created the log. +func (o *LogEntry) ServiceName() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.serviceName + } + return "" +} + +// GetServiceName returns the value of the 'service_name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the service who created the log. +func (o *LogEntry) GetServiceName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.serviceName + } + return +} + +// Severity returns the value of the 'severity' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Log severity for the specific log entry. +func (o *LogEntry) Severity() Severity { + if o != nil && o.bitmap_&8192 != 0 { + return o.severity + } + return Severity("") +} + +// GetSeverity returns the value of the 'severity' attribute and +// a flag indicating if the attribute has a value. +// +// Log severity for the specific log entry. +func (o *LogEntry) GetSeverity() (value Severity, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.severity + } + return +} + +// SubscriptionID returns the value of the 'subscription_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The related subscription id of the cluster. +func (o *LogEntry) SubscriptionID() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.subscriptionID + } + return "" +} + +// GetSubscriptionID returns the value of the 'subscription_ID' attribute and +// a flag indicating if the attribute has a value. +// +// The related subscription id of the cluster. +func (o *LogEntry) GetSubscriptionID() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.subscriptionID + } + return +} + +// Summary returns the value of the 'summary' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Title of the log entry. +func (o *LogEntry) Summary() string { + if o != nil && o.bitmap_&32768 != 0 { + return o.summary + } + return "" +} + +// GetSummary returns the value of the 'summary' attribute and +// a flag indicating if the attribute has a value. +// +// Title of the log entry. +func (o *LogEntry) GetSummary() (value string, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.summary + } + return +} + +// Timestamp returns the value of the 'timestamp' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *LogEntry) Timestamp() time.Time { + if o != nil && o.bitmap_&65536 != 0 { + return o.timestamp + } + return time.Time{} +} + +// GetTimestamp returns the value of the 'timestamp' attribute and +// a flag indicating if the attribute has a value. +func (o *LogEntry) GetTimestamp() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.timestamp + } + return +} + +// Username returns the value of the 'username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The username that triggered the event (if available). +func (o *LogEntry) Username() string { + if o != nil && o.bitmap_&131072 != 0 { + return o.username + } + return "" +} + +// GetUsername returns the value of the 'username' attribute and +// a flag indicating if the attribute has a value. +// +// The username that triggered the event (if available). +func (o *LogEntry) GetUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&131072 != 0 + if ok { + value = o.username + } + return +} + +// LogEntryListKind is the name of the type used to represent list of objects of +// type 'log_entry'. +const LogEntryListKind = "LogEntryList" + +// LogEntryListLinkKind is the name of the type used to represent links to list +// of objects of type 'log_entry'. +const LogEntryListLinkKind = "LogEntryListLink" + +// LogEntryNilKind is the name of the type used to nil lists of objects of +// type 'log_entry'. +const LogEntryListNilKind = "LogEntryListNil" + +// LogEntryList is a list of values of the 'log_entry' type. +type LogEntryList struct { + href string + link bool + items []*LogEntry +} + +// Kind returns the name of the type of the object. +func (l *LogEntryList) Kind() string { + if l == nil { + return LogEntryListNilKind + } + if l.link { + return LogEntryListLinkKind + } + return LogEntryListKind +} + +// Link returns true iif this is a link. +func (l *LogEntryList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *LogEntryList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *LogEntryList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *LogEntryList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *LogEntryList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *LogEntryList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *LogEntryList) SetItems(items []*LogEntry) { + l.items = items +} + +// Items returns the items of the list. +func (l *LogEntryList) Items() []*LogEntry { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *LogEntryList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *LogEntryList) Get(i int) *LogEntry { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *LogEntryList) Slice() []*LogEntry { + var slice []*LogEntry + if l == nil { + slice = make([]*LogEntry, 0) + } else { + slice = make([]*LogEntry, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *LogEntryList) Each(f func(item *LogEntry) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *LogEntryList) Range(f func(index int, item *LogEntry) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicelogs/v1/log_entry_type_json.go b/clientapi/servicelogs/v1/log_entry_type_json.go new file mode 100644 index 00000000..ffc44ebc --- /dev/null +++ b/clientapi/servicelogs/v1/log_entry_type_json.go @@ -0,0 +1,313 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLogEntry writes a value of the 'log_entry' type to the given writer. +func MarshalLogEntry(object *LogEntry, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLogEntry(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLogEntry writes a value of the 'log_entry' type to the given stream. +func WriteLogEntry(object *LogEntry, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(LogEntryLinkKind) + } else { + stream.WriteString(LogEntryKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_id") + stream.WriteString(object.clusterID) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster_uuid") + stream.WriteString(object.clusterUUID) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_by") + stream.WriteString(object.createdBy) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&256 != 0 && object.docReferences != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("doc_references") + WriteStringList(object.docReferences, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("event_stream_id") + stream.WriteString(object.eventStreamID) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("internal_only") + stream.WriteBool(object.internalOnly) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("log_type") + stream.WriteString(string(object.logType)) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_name") + stream.WriteString(object.serviceName) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("severity") + stream.WriteString(string(object.severity)) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subscription_id") + stream.WriteString(object.subscriptionID) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("summary") + stream.WriteString(object.summary) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("timestamp") + stream.WriteString((object.timestamp).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&131072 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("username") + stream.WriteString(object.username) + } + stream.WriteObjectEnd() +} + +// UnmarshalLogEntry reads a value of the 'log_entry' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalLogEntry(source interface{}) (object *LogEntry, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadLogEntry(iterator) + err = iterator.Error + return +} + +// ReadLogEntry reads a value of the 'log_entry' type from the given iterator. +func ReadLogEntry(iterator *jsoniter.Iterator) *LogEntry { + object := &LogEntry{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == LogEntryLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "cluster_id": + value := iterator.ReadString() + object.clusterID = value + object.bitmap_ |= 8 + case "cluster_uuid": + value := iterator.ReadString() + object.clusterUUID = value + object.bitmap_ |= 16 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 32 + case "created_by": + value := iterator.ReadString() + object.createdBy = value + object.bitmap_ |= 64 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 128 + case "doc_references": + value := ReadStringList(iterator) + object.docReferences = value + object.bitmap_ |= 256 + case "event_stream_id": + value := iterator.ReadString() + object.eventStreamID = value + object.bitmap_ |= 512 + case "internal_only": + value := iterator.ReadBool() + object.internalOnly = value + object.bitmap_ |= 1024 + case "log_type": + text := iterator.ReadString() + value := LogType(text) + object.logType = value + object.bitmap_ |= 2048 + case "service_name": + value := iterator.ReadString() + object.serviceName = value + object.bitmap_ |= 4096 + case "severity": + text := iterator.ReadString() + value := Severity(text) + object.severity = value + object.bitmap_ |= 8192 + case "subscription_id": + value := iterator.ReadString() + object.subscriptionID = value + object.bitmap_ |= 16384 + case "summary": + value := iterator.ReadString() + object.summary = value + object.bitmap_ |= 32768 + case "timestamp": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.timestamp = value + object.bitmap_ |= 65536 + case "username": + value := iterator.ReadString() + object.username = value + object.bitmap_ |= 131072 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicelogs/v1/log_type_list_type_json.go b/clientapi/servicelogs/v1/log_type_list_type_json.go new file mode 100644 index 00000000..e9d0b0c7 --- /dev/null +++ b/clientapi/servicelogs/v1/log_type_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLogTypeList writes a list of values of the 'log_type' type to +// the given writer. +func MarshalLogTypeList(list []LogType, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLogTypeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLogTypeList writes a list of value of the 'log_type' type to +// the given stream. +func WriteLogTypeList(list []LogType, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalLogTypeList reads a list of values of the 'log_type' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLogTypeList(source interface{}) (items []LogType, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLogTypeList(iterator) + err = iterator.Error + return +} + +// ReadLogTypeList reads list of values of the ”log_type' type from +// the given iterator. +func ReadLogTypeList(iterator *jsoniter.Iterator) []LogType { + list := []LogType{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := LogType(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicelogs/v1/log_type_type.go b/clientapi/servicelogs/v1/log_type_type.go new file mode 100644 index 00000000..07da2e8b --- /dev/null +++ b/clientapi/servicelogs/v1/log_type_type.go @@ -0,0 +1,36 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +// LogType represents the values of the 'log_type' enumerated type. +type LogType string + +const ( + // + LogTypeClusterCreateDetails LogType = "clustercreate-details" + // + LogTypeClusterCreateHighLevel LogType = "clustercreate-high-level" + // + LogTypeClusterRemoveDetails LogType = "clusterremove-details" + // + LogTypeClusterRemoveHighLevel LogType = "clusterremove-high-level" + // + LogTypeClusterStateUpdates LogType = "cluster-state-updates" +) diff --git a/clientapi/servicelogs/v1/long_list_type_json.go b/clientapi/servicelogs/v1/long_list_type_json.go new file mode 100644 index 00000000..c552ef2a --- /dev/null +++ b/clientapi/servicelogs/v1/long_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLongList writes a list of values of the 'long' type to +// the given writer. +func MarshalLongList(list []int64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLongList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLongList writes a list of value of the 'long' type to +// the given stream. +func WriteLongList(list []int64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalLongList reads a list of values of the 'long' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLongList(source interface{}) (items []int64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLongList(iterator) + err = iterator.Error + return +} + +// ReadLongList reads list of values of the ”long' type from +// the given iterator. +func ReadLongList(iterator *jsoniter.Iterator) []int64 { + list := []int64{} + for iterator.ReadArray() { + item := iterator.ReadInt64() + list = append(list, item) + } + return list +} diff --git a/clientapi/servicelogs/v1/metadata_reader.go b/clientapi/servicelogs/v1/metadata_reader.go new file mode 100644 index 00000000..93eb07de --- /dev/null +++ b/clientapi/servicelogs/v1/metadata_reader.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMetadata writes a value of the metadata type to the given target, which +// can be a writer or a JSON encoder. +func MarshalMetadata(object *Metadata, writer io.Writer) error { + stream := helpers.NewStream(writer) + writeMetadata(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} +func writeMetadata(object *Metadata, stream *jsoniter.Stream) { + stream.WriteObjectStart() + if object.bitmap_&1 != 0 { + stream.WriteObjectField("server_version") + stream.WriteString(object.serverVersion) + } + stream.WriteObjectEnd() +} + +// UnmarshalMetadata reads a value of the metadata type from the given source, which +// which can be a reader, a slice of byte or a string. +func UnmarshalMetadata(source interface{}) (object *Metadata, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = readMetadata(iterator) + err = iterator.Error + return +} +func readMetadata(iterator *jsoniter.Iterator) *Metadata { + object := &Metadata{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "server_version": + object.serverVersion = iterator.ReadString() + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicelogs/v1/metadata_type.go b/clientapi/servicelogs/v1/metadata_type.go new file mode 100644 index 00000000..795907d3 --- /dev/null +++ b/clientapi/servicelogs/v1/metadata_type.go @@ -0,0 +1,44 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +// Metadata contains the version metadata. +type Metadata struct { + bitmap_ uint32 + serverVersion string +} + +// ServerVersion returns the version of the server. +func (m *Metadata) ServerVersion() string { + if m != nil && m.bitmap_&1 != 0 { + return m.serverVersion + } + return "" +} + +// GetServerVersion returns the value of the server version and a flag indicating if +// the attribute has a value. +func (m *Metadata) GetServerVersion() (value string, ok bool) { + ok = m != nil && m.bitmap_&1 != 0 + if ok { + value = m.serverVersion + } + return +} diff --git a/clientapi/servicelogs/v1/severity_list_type_json.go b/clientapi/servicelogs/v1/severity_list_type_json.go new file mode 100644 index 00000000..26df3030 --- /dev/null +++ b/clientapi/servicelogs/v1/severity_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSeverityList writes a list of values of the 'severity' type to +// the given writer. +func MarshalSeverityList(list []Severity, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSeverityList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSeverityList writes a list of value of the 'severity' type to +// the given stream. +func WriteSeverityList(list []Severity, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalSeverityList reads a list of values of the 'severity' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSeverityList(source interface{}) (items []Severity, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSeverityList(iterator) + err = iterator.Error + return +} + +// ReadSeverityList reads list of values of the ”severity' type from +// the given iterator. +func ReadSeverityList(iterator *jsoniter.Iterator) []Severity { + list := []Severity{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := Severity(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicelogs/v1/severity_type.go b/clientapi/servicelogs/v1/severity_type.go new file mode 100644 index 00000000..39e3176f --- /dev/null +++ b/clientapi/servicelogs/v1/severity_type.go @@ -0,0 +1,36 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +// Severity represents the values of the 'severity' enumerated type. +type Severity string + +const ( + // + SeverityDebug Severity = "Debug" + // + SeverityError Severity = "Error" + // + SeverityFatal Severity = "Fatal" + // + SeverityInfo Severity = "Info" + // + SeverityWarning Severity = "Warning" +) diff --git a/clientapi/servicelogs/v1/string_list_type_json.go b/clientapi/servicelogs/v1/string_list_type_json.go new file mode 100644 index 00000000..20524d67 --- /dev/null +++ b/clientapi/servicelogs/v1/string_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicelogs/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStringList writes a list of values of the 'string' type to +// the given writer. +func MarshalStringList(list []string, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStringList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStringList writes a list of value of the 'string' type to +// the given stream. +func WriteStringList(list []string, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalStringList reads a list of values of the 'string' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStringList(source interface{}) (items []string, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStringList(iterator) + err = iterator.Error + return +} + +// ReadStringList reads list of values of the ”string' type from +// the given iterator. +func ReadStringList(iterator *jsoniter.Iterator) []string { + list := []string{} + for iterator.ReadArray() { + item := iterator.ReadString() + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/aws_builder.go b/clientapi/servicemgmt/v1/aws_builder.go new file mode 100644 index 00000000..eb0a1e0a --- /dev/null +++ b/clientapi/servicemgmt/v1/aws_builder.go @@ -0,0 +1,163 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// AWSBuilder contains the data and logic needed to build 'AWS' objects. +// +// _Amazon Web Services_ specific settings of a cluster. +type AWSBuilder struct { + bitmap_ uint32 + sts *STSBuilder + accessKeyID string + accountID string + secretAccessKey string + subnetIDs []string + tags map[string]string + privateLink bool +} + +// NewAWS creates a new builder of 'AWS' objects. +func NewAWS() *AWSBuilder { + return &AWSBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AWSBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// STS sets the value of the 'STS' attribute to the given value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (b *AWSBuilder) STS(value *STSBuilder) *AWSBuilder { + b.sts = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// AccessKeyID sets the value of the 'access_key_ID' attribute to the given value. +func (b *AWSBuilder) AccessKeyID(value string) *AWSBuilder { + b.accessKeyID = value + b.bitmap_ |= 2 + return b +} + +// AccountID sets the value of the 'account_ID' attribute to the given value. +func (b *AWSBuilder) AccountID(value string) *AWSBuilder { + b.accountID = value + b.bitmap_ |= 4 + return b +} + +// PrivateLink sets the value of the 'private_link' attribute to the given value. +func (b *AWSBuilder) PrivateLink(value bool) *AWSBuilder { + b.privateLink = value + b.bitmap_ |= 8 + return b +} + +// SecretAccessKey sets the value of the 'secret_access_key' attribute to the given value. +func (b *AWSBuilder) SecretAccessKey(value string) *AWSBuilder { + b.secretAccessKey = value + b.bitmap_ |= 16 + return b +} + +// SubnetIDs sets the value of the 'subnet_IDs' attribute to the given values. +func (b *AWSBuilder) SubnetIDs(values ...string) *AWSBuilder { + b.subnetIDs = make([]string, len(values)) + copy(b.subnetIDs, values) + b.bitmap_ |= 32 + return b +} + +// Tags sets the value of the 'tags' attribute to the given value. +func (b *AWSBuilder) Tags(value map[string]string) *AWSBuilder { + b.tags = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AWSBuilder) Copy(object *AWS) *AWSBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.sts != nil { + b.sts = NewSTS().Copy(object.sts) + } else { + b.sts = nil + } + b.accessKeyID = object.accessKeyID + b.accountID = object.accountID + b.privateLink = object.privateLink + b.secretAccessKey = object.secretAccessKey + if object.subnetIDs != nil { + b.subnetIDs = make([]string, len(object.subnetIDs)) + copy(b.subnetIDs, object.subnetIDs) + } else { + b.subnetIDs = nil + } + if len(object.tags) > 0 { + b.tags = map[string]string{} + for k, v := range object.tags { + b.tags[k] = v + } + } else { + b.tags = nil + } + return b +} + +// Build creates a 'AWS' object using the configuration stored in the builder. +func (b *AWSBuilder) Build() (object *AWS, err error) { + object = new(AWS) + object.bitmap_ = b.bitmap_ + if b.sts != nil { + object.sts, err = b.sts.Build() + if err != nil { + return + } + } + object.accessKeyID = b.accessKeyID + object.accountID = b.accountID + object.privateLink = b.privateLink + object.secretAccessKey = b.secretAccessKey + if b.subnetIDs != nil { + object.subnetIDs = make([]string, len(b.subnetIDs)) + copy(object.subnetIDs, b.subnetIDs) + } + if b.tags != nil { + object.tags = make(map[string]string) + for k, v := range b.tags { + object.tags[k] = v + } + } + return +} diff --git a/clientapi/servicemgmt/v1/aws_list_builder.go b/clientapi/servicemgmt/v1/aws_list_builder.go new file mode 100644 index 00000000..36bd56bf --- /dev/null +++ b/clientapi/servicemgmt/v1/aws_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// AWSListBuilder contains the data and logic needed to build +// 'AWS' objects. +type AWSListBuilder struct { + items []*AWSBuilder +} + +// NewAWSList creates a new builder of 'AWS' objects. +func NewAWSList() *AWSListBuilder { + return new(AWSListBuilder) +} + +// Items sets the items of the list. +func (b *AWSListBuilder) Items(values ...*AWSBuilder) *AWSListBuilder { + b.items = make([]*AWSBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AWSListBuilder) 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 *AWSListBuilder) Copy(list *AWSList) *AWSListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AWSBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAWS().Copy(v) + } + } + return b +} + +// Build creates a list of 'AWS' objects using the +// configuration stored in the builder. +func (b *AWSListBuilder) Build() (list *AWSList, err error) { + items := make([]*AWS, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AWSList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/aws_list_type_json.go b/clientapi/servicemgmt/v1/aws_list_type_json.go new file mode 100644 index 00000000..5f0c610a --- /dev/null +++ b/clientapi/servicemgmt/v1/aws_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWSList writes a list of values of the 'AWS' type to +// the given writer. +func MarshalAWSList(list []*AWS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWSList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWSList writes a list of value of the 'AWS' type to +// the given stream. +func WriteAWSList(list []*AWS, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAWS(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAWSList reads a list of values of the 'AWS' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAWSList(source interface{}) (items []*AWS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAWSList(iterator) + err = iterator.Error + return +} + +// ReadAWSList reads list of values of the ”AWS' type from +// the given iterator. +func ReadAWSList(iterator *jsoniter.Iterator) []*AWS { + list := []*AWS{} + for iterator.ReadArray() { + item := ReadAWS(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/aws_type.go b/clientapi/servicemgmt/v1/aws_type.go new file mode 100644 index 00000000..cd669de3 --- /dev/null +++ b/clientapi/servicemgmt/v1/aws_type.go @@ -0,0 +1,309 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// AWS represents the values of the 'AWS' type. +// +// _Amazon Web Services_ specific settings of a cluster. +type AWS struct { + bitmap_ uint32 + sts *STS + accessKeyID string + accountID string + secretAccessKey string + subnetIDs []string + tags map[string]string + privateLink bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *AWS) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// STS returns the value of the 'STS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (o *AWS) STS() *STS { + if o != nil && o.bitmap_&1 != 0 { + return o.sts + } + return nil +} + +// GetSTS returns the value of the 'STS' attribute and +// a flag indicating if the attribute has a value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (o *AWS) GetSTS() (value *STS, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.sts + } + return +} + +// AccessKeyID returns the value of the 'access_key_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS access key identifier. +func (o *AWS) AccessKeyID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.accessKeyID + } + return "" +} + +// GetAccessKeyID returns the value of the 'access_key_ID' attribute and +// a flag indicating if the attribute has a value. +// +// AWS access key identifier. +func (o *AWS) GetAccessKeyID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.accessKeyID + } + return +} + +// AccountID returns the value of the 'account_ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS account identifier. +func (o *AWS) AccountID() string { + if o != nil && o.bitmap_&4 != 0 { + return o.accountID + } + return "" +} + +// GetAccountID returns the value of the 'account_ID' attribute and +// a flag indicating if the attribute has a value. +// +// AWS account identifier. +func (o *AWS) GetAccountID() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.accountID + } + return +} + +// PrivateLink returns the value of the 'private_link' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// For PrivateLink-enabled clusters +func (o *AWS) PrivateLink() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.privateLink + } + return false +} + +// GetPrivateLink returns the value of the 'private_link' attribute and +// a flag indicating if the attribute has a value. +// +// For PrivateLink-enabled clusters +func (o *AWS) GetPrivateLink() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.privateLink + } + return +} + +// SecretAccessKey returns the value of the 'secret_access_key' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// AWS secret access key. +func (o *AWS) SecretAccessKey() string { + if o != nil && o.bitmap_&16 != 0 { + return o.secretAccessKey + } + return "" +} + +// GetSecretAccessKey returns the value of the 'secret_access_key' attribute and +// a flag indicating if the attribute has a value. +// +// AWS secret access key. +func (o *AWS) GetSecretAccessKey() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.secretAccessKey + } + return +} + +// SubnetIDs returns the value of the 'subnet_IDs' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The subnet ids to be used when installing the cluster. +func (o *AWS) SubnetIDs() []string { + if o != nil && o.bitmap_&32 != 0 { + return o.subnetIDs + } + return nil +} + +// GetSubnetIDs returns the value of the 'subnet_IDs' attribute and +// a flag indicating if the attribute has a value. +// +// The subnet ids to be used when installing the cluster. +func (o *AWS) GetSubnetIDs() (value []string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.subnetIDs + } + return +} + +// Tags returns the value of the 'tags' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Optional keys and values that the installer will add as tags to all AWS resources it creates +func (o *AWS) Tags() map[string]string { + if o != nil && o.bitmap_&64 != 0 { + return o.tags + } + return nil +} + +// GetTags returns the value of the 'tags' attribute and +// a flag indicating if the attribute has a value. +// +// Optional keys and values that the installer will add as tags to all AWS resources it creates +func (o *AWS) GetTags() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.tags + } + return +} + +// AWSListKind is the name of the type used to represent list of objects of +// type 'AWS'. +const AWSListKind = "AWSList" + +// AWSListLinkKind is the name of the type used to represent links to list +// of objects of type 'AWS'. +const AWSListLinkKind = "AWSListLink" + +// AWSNilKind is the name of the type used to nil lists of objects of +// type 'AWS'. +const AWSListNilKind = "AWSListNil" + +// AWSList is a list of values of the 'AWS' type. +type AWSList struct { + href string + link bool + items []*AWS +} + +// Len returns the length of the list. +func (l *AWSList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AWSList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AWSList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AWSList) SetItems(items []*AWS) { + l.items = items +} + +// Items returns the items of the list. +func (l *AWSList) Items() []*AWS { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AWSList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AWSList) Get(i int) *AWS { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AWSList) Slice() []*AWS { + var slice []*AWS + if l == nil { + slice = make([]*AWS, 0) + } else { + slice = make([]*AWS, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AWSList) Each(f func(item *AWS) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AWSList) Range(f func(index int, item *AWS) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/aws_type_json.go b/clientapi/servicemgmt/v1/aws_type_json.go new file mode 100644 index 00000000..01f5c720 --- /dev/null +++ b/clientapi/servicemgmt/v1/aws_type_json.go @@ -0,0 +1,193 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAWS writes a value of the 'AWS' type to the given writer. +func MarshalAWS(object *AWS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAWS(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAWS writes a value of the 'AWS' type to the given stream. +func WriteAWS(object *AWS, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.sts != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("sts") + WriteSTS(object.sts, stream) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("access_key_id") + stream.WriteString(object.accessKeyID) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("account_id") + stream.WriteString(object.accountID) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private_link") + stream.WriteBool(object.privateLink) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("secret_access_key") + stream.WriteString(object.secretAccessKey) + count++ + } + present_ = object.bitmap_&32 != 0 && object.subnetIDs != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("subnet_ids") + WriteStringList(object.subnetIDs, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.tags != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("tags") + if object.tags != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.tags)) + i := 0 + for key := range object.tags { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.tags[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + } + stream.WriteObjectEnd() +} + +// UnmarshalAWS reads a value of the 'AWS' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAWS(source interface{}) (object *AWS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAWS(iterator) + err = iterator.Error + return +} + +// ReadAWS reads a value of the 'AWS' type from the given iterator. +func ReadAWS(iterator *jsoniter.Iterator) *AWS { + object := &AWS{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "sts": + value := ReadSTS(iterator) + object.sts = value + object.bitmap_ |= 1 + case "access_key_id": + value := iterator.ReadString() + object.accessKeyID = value + object.bitmap_ |= 2 + case "account_id": + value := iterator.ReadString() + object.accountID = value + object.bitmap_ |= 4 + case "private_link": + value := iterator.ReadBool() + object.privateLink = value + object.bitmap_ |= 8 + case "secret_access_key": + value := iterator.ReadString() + object.secretAccessKey = value + object.bitmap_ |= 16 + case "subnet_ids": + value := ReadStringList(iterator) + object.subnetIDs = value + object.bitmap_ |= 32 + case "tags": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.tags = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/boolean_list_type_json.go b/clientapi/servicemgmt/v1/boolean_list_type_json.go new file mode 100644 index 00000000..5d5f4284 --- /dev/null +++ b/clientapi/servicemgmt/v1/boolean_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBooleanList writes a list of values of the 'boolean' type to +// the given writer. +func MarshalBooleanList(list []bool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBooleanList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBooleanList writes a list of value of the 'boolean' type to +// the given stream. +func WriteBooleanList(list []bool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteBool(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalBooleanList reads a list of values of the 'boolean' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBooleanList(source interface{}) (items []bool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBooleanList(iterator) + err = iterator.Error + return +} + +// ReadBooleanList reads list of values of the ”boolean' type from +// the given iterator. +func ReadBooleanList(iterator *jsoniter.Iterator) []bool { + list := []bool{} + for iterator.ReadArray() { + item := iterator.ReadBool() + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/cloud_region_builder.go b/clientapi/servicemgmt/v1/cloud_region_builder.go new file mode 100644 index 00000000..3a95282f --- /dev/null +++ b/clientapi/servicemgmt/v1/cloud_region_builder.go @@ -0,0 +1,63 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// CloudRegionBuilder contains the data and logic needed to build 'cloud_region' objects. +// +// Description of a region of a cloud provider. +type CloudRegionBuilder struct { + bitmap_ uint32 + id string +} + +// NewCloudRegion creates a new builder of 'cloud_region' objects. +func NewCloudRegion() *CloudRegionBuilder { + return &CloudRegionBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *CloudRegionBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *CloudRegionBuilder) ID(value string) *CloudRegionBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *CloudRegionBuilder) Copy(object *CloudRegion) *CloudRegionBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + return b +} + +// Build creates a 'cloud_region' object using the configuration stored in the builder. +func (b *CloudRegionBuilder) Build() (object *CloudRegion, err error) { + object = new(CloudRegion) + object.bitmap_ = b.bitmap_ + object.id = b.id + return +} diff --git a/clientapi/servicemgmt/v1/cloud_region_list_builder.go b/clientapi/servicemgmt/v1/cloud_region_list_builder.go new file mode 100644 index 00000000..9e475163 --- /dev/null +++ b/clientapi/servicemgmt/v1/cloud_region_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// CloudRegionListBuilder contains the data and logic needed to build +// 'cloud_region' objects. +type CloudRegionListBuilder struct { + items []*CloudRegionBuilder +} + +// NewCloudRegionList creates a new builder of 'cloud_region' objects. +func NewCloudRegionList() *CloudRegionListBuilder { + return new(CloudRegionListBuilder) +} + +// Items sets the items of the list. +func (b *CloudRegionListBuilder) Items(values ...*CloudRegionBuilder) *CloudRegionListBuilder { + b.items = make([]*CloudRegionBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *CloudRegionListBuilder) 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 *CloudRegionListBuilder) Copy(list *CloudRegionList) *CloudRegionListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*CloudRegionBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCloudRegion().Copy(v) + } + } + return b +} + +// Build creates a list of 'cloud_region' objects using the +// configuration stored in the builder. +func (b *CloudRegionListBuilder) Build() (list *CloudRegionList, err error) { + items := make([]*CloudRegion, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(CloudRegionList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/cloud_region_list_type_json.go b/clientapi/servicemgmt/v1/cloud_region_list_type_json.go new file mode 100644 index 00000000..b432f707 --- /dev/null +++ b/clientapi/servicemgmt/v1/cloud_region_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudRegionList writes a list of values of the 'cloud_region' type to +// the given writer. +func MarshalCloudRegionList(list []*CloudRegion, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudRegionList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudRegionList writes a list of value of the 'cloud_region' type to +// the given stream. +func WriteCloudRegionList(list []*CloudRegion, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCloudRegion(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalCloudRegionList reads a list of values of the 'cloud_region' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalCloudRegionList(source interface{}) (items []*CloudRegion, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadCloudRegionList(iterator) + err = iterator.Error + return +} + +// ReadCloudRegionList reads list of values of the ”cloud_region' type from +// the given iterator. +func ReadCloudRegionList(iterator *jsoniter.Iterator) []*CloudRegion { + list := []*CloudRegion{} + for iterator.ReadArray() { + item := ReadCloudRegion(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/cloud_region_type.go b/clientapi/servicemgmt/v1/cloud_region_type.go new file mode 100644 index 00000000..7171c838 --- /dev/null +++ b/clientapi/servicemgmt/v1/cloud_region_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// CloudRegion represents the values of the 'cloud_region' type. +// +// Description of a region of a cloud provider. +type CloudRegion struct { + bitmap_ uint32 + id string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *CloudRegion) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Human-friendly identifier of the region, for example `us-east-1`. +func (o *CloudRegion) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// Human-friendly identifier of the region, for example `us-east-1`. +func (o *CloudRegion) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// CloudRegionListKind is the name of the type used to represent list of objects of +// type 'cloud_region'. +const CloudRegionListKind = "CloudRegionList" + +// CloudRegionListLinkKind is the name of the type used to represent links to list +// of objects of type 'cloud_region'. +const CloudRegionListLinkKind = "CloudRegionListLink" + +// CloudRegionNilKind is the name of the type used to nil lists of objects of +// type 'cloud_region'. +const CloudRegionListNilKind = "CloudRegionListNil" + +// CloudRegionList is a list of values of the 'cloud_region' type. +type CloudRegionList struct { + href string + link bool + items []*CloudRegion +} + +// Len returns the length of the list. +func (l *CloudRegionList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *CloudRegionList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *CloudRegionList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *CloudRegionList) SetItems(items []*CloudRegion) { + l.items = items +} + +// Items returns the items of the list. +func (l *CloudRegionList) Items() []*CloudRegion { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *CloudRegionList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *CloudRegionList) Get(i int) *CloudRegion { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *CloudRegionList) Slice() []*CloudRegion { + var slice []*CloudRegion + if l == nil { + slice = make([]*CloudRegion, 0) + } else { + slice = make([]*CloudRegion, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *CloudRegionList) Each(f func(item *CloudRegion) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *CloudRegionList) Range(f func(index int, item *CloudRegion) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/cloud_region_type_json.go b/clientapi/servicemgmt/v1/cloud_region_type_json.go new file mode 100644 index 00000000..b67265fa --- /dev/null +++ b/clientapi/servicemgmt/v1/cloud_region_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCloudRegion writes a value of the 'cloud_region' type to the given writer. +func MarshalCloudRegion(object *CloudRegion, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCloudRegion(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCloudRegion writes a value of the 'cloud_region' type to the given stream. +func WriteCloudRegion(object *CloudRegion, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + } + stream.WriteObjectEnd() +} + +// UnmarshalCloudRegion reads a value of the 'cloud_region' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCloudRegion(source interface{}) (object *CloudRegion, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCloudRegion(iterator) + err = iterator.Error + return +} + +// ReadCloudRegion reads a value of the 'cloud_region' type from the given iterator. +func ReadCloudRegion(iterator *jsoniter.Iterator) *CloudRegion { + object := &CloudRegion{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/cluster_api_builder.go b/clientapi/servicemgmt/v1/cluster_api_builder.go new file mode 100644 index 00000000..8a2cf34f --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_api_builder.go @@ -0,0 +1,65 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// ClusterAPIBuilder contains the data and logic needed to build 'cluster_API' objects. +// +// Information about the API of a cluster. +type ClusterAPIBuilder struct { + bitmap_ uint32 + listening ListeningMethod +} + +// NewClusterAPI creates a new builder of 'cluster_API' objects. +func NewClusterAPI() *ClusterAPIBuilder { + return &ClusterAPIBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterAPIBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Listening sets the value of the 'listening' attribute to the given value. +// +// Cluster components listening method. +func (b *ClusterAPIBuilder) Listening(value ListeningMethod) *ClusterAPIBuilder { + b.listening = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterAPIBuilder) Copy(object *ClusterAPI) *ClusterAPIBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.listening = object.listening + return b +} + +// Build creates a 'cluster_API' object using the configuration stored in the builder. +func (b *ClusterAPIBuilder) Build() (object *ClusterAPI, err error) { + object = new(ClusterAPI) + object.bitmap_ = b.bitmap_ + object.listening = b.listening + return +} diff --git a/clientapi/servicemgmt/v1/cluster_api_list_builder.go b/clientapi/servicemgmt/v1/cluster_api_list_builder.go new file mode 100644 index 00000000..a2b79a32 --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_api_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// ClusterAPIListBuilder contains the data and logic needed to build +// 'cluster_API' objects. +type ClusterAPIListBuilder struct { + items []*ClusterAPIBuilder +} + +// NewClusterAPIList creates a new builder of 'cluster_API' objects. +func NewClusterAPIList() *ClusterAPIListBuilder { + return new(ClusterAPIListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterAPIListBuilder) Items(values ...*ClusterAPIBuilder) *ClusterAPIListBuilder { + b.items = make([]*ClusterAPIBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterAPIListBuilder) 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 *ClusterAPIListBuilder) Copy(list *ClusterAPIList) *ClusterAPIListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterAPIBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterAPI().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_API' objects using the +// configuration stored in the builder. +func (b *ClusterAPIListBuilder) Build() (list *ClusterAPIList, err error) { + items := make([]*ClusterAPI, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterAPIList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/cluster_api_list_type_json.go b/clientapi/servicemgmt/v1/cluster_api_list_type_json.go new file mode 100644 index 00000000..734f352c --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_api_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterAPIList writes a list of values of the 'cluster_API' type to +// the given writer. +func MarshalClusterAPIList(list []*ClusterAPI, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterAPIList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterAPIList writes a list of value of the 'cluster_API' type to +// the given stream. +func WriteClusterAPIList(list []*ClusterAPI, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterAPI(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterAPIList reads a list of values of the 'cluster_API' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterAPIList(source interface{}) (items []*ClusterAPI, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterAPIList(iterator) + err = iterator.Error + return +} + +// ReadClusterAPIList reads list of values of the ”cluster_API' type from +// the given iterator. +func ReadClusterAPIList(iterator *jsoniter.Iterator) []*ClusterAPI { + list := []*ClusterAPI{} + for iterator.ReadArray() { + item := ReadClusterAPI(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/cluster_api_type.go b/clientapi/servicemgmt/v1/cluster_api_type.go new file mode 100644 index 00000000..dbdc5b36 --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_api_type.go @@ -0,0 +1,165 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// ClusterAPI represents the values of the 'cluster_API' type. +// +// Information about the API of a cluster. +type ClusterAPI struct { + bitmap_ uint32 + listening ListeningMethod +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterAPI) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Listening returns the value of the 'listening' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The listening method of the API server. +func (o *ClusterAPI) Listening() ListeningMethod { + if o != nil && o.bitmap_&1 != 0 { + return o.listening + } + return ListeningMethod("") +} + +// GetListening returns the value of the 'listening' attribute and +// a flag indicating if the attribute has a value. +// +// The listening method of the API server. +func (o *ClusterAPI) GetListening() (value ListeningMethod, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.listening + } + return +} + +// ClusterAPIListKind is the name of the type used to represent list of objects of +// type 'cluster_API'. +const ClusterAPIListKind = "ClusterAPIList" + +// ClusterAPIListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_API'. +const ClusterAPIListLinkKind = "ClusterAPIListLink" + +// ClusterAPINilKind is the name of the type used to nil lists of objects of +// type 'cluster_API'. +const ClusterAPIListNilKind = "ClusterAPIListNil" + +// ClusterAPIList is a list of values of the 'cluster_API' type. +type ClusterAPIList struct { + href string + link bool + items []*ClusterAPI +} + +// Len returns the length of the list. +func (l *ClusterAPIList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterAPIList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterAPIList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterAPIList) SetItems(items []*ClusterAPI) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterAPIList) Items() []*ClusterAPI { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterAPIList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterAPIList) Get(i int) *ClusterAPI { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterAPIList) Slice() []*ClusterAPI { + var slice []*ClusterAPI + if l == nil { + slice = make([]*ClusterAPI, 0) + } else { + slice = make([]*ClusterAPI, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterAPIList) Each(f func(item *ClusterAPI) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterAPIList) Range(f func(index int, item *ClusterAPI) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/cluster_api_type_json.go b/clientapi/servicemgmt/v1/cluster_api_type_json.go new file mode 100644 index 00000000..d52487f6 --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_api_type_json.go @@ -0,0 +1,87 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterAPI writes a value of the 'cluster_API' type to the given writer. +func MarshalClusterAPI(object *ClusterAPI, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterAPI(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterAPI writes a value of the 'cluster_API' type to the given stream. +func WriteClusterAPI(object *ClusterAPI, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("listening") + stream.WriteString(string(object.listening)) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterAPI reads a value of the 'cluster_API' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterAPI(source interface{}) (object *ClusterAPI, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterAPI(iterator) + err = iterator.Error + return +} + +// ReadClusterAPI reads a value of the 'cluster_API' type from the given iterator. +func ReadClusterAPI(iterator *jsoniter.Iterator) *ClusterAPI { + object := &ClusterAPI{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "listening": + text := iterator.ReadString() + value := ListeningMethod(text) + object.listening = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/cluster_builder.go b/clientapi/servicemgmt/v1/cluster_builder.go new file mode 100644 index 00000000..27f092d1 --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_builder.go @@ -0,0 +1,262 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// ClusterBuilder contains the data and logic needed to build 'cluster' objects. +// +// This represents the parameters needed by Managed Service to create a cluster. +type ClusterBuilder struct { + bitmap_ uint32 + api *ClusterAPIBuilder + aws *AWSBuilder + displayName string + href string + id string + name string + network *NetworkBuilder + nodes *ClusterNodesBuilder + properties map[string]string + region *CloudRegionBuilder + state string + multiAZ bool +} + +// NewCluster creates a new builder of 'cluster' objects. +func NewCluster() *ClusterBuilder { + return &ClusterBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// API sets the value of the 'API' attribute to the given value. +// +// Information about the API of a cluster. +func (b *ClusterBuilder) API(value *ClusterAPIBuilder) *ClusterBuilder { + b.api = value + if value != nil { + b.bitmap_ |= 1 + } else { + b.bitmap_ &^= 1 + } + return b +} + +// AWS sets the value of the 'AWS' attribute to the given value. +// +// _Amazon Web Services_ specific settings of a cluster. +func (b *ClusterBuilder) AWS(value *AWSBuilder) *ClusterBuilder { + b.aws = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// DisplayName sets the value of the 'display_name' attribute to the given value. +func (b *ClusterBuilder) DisplayName(value string) *ClusterBuilder { + b.displayName = value + b.bitmap_ |= 4 + return b +} + +// Href sets the value of the 'href' attribute to the given value. +func (b *ClusterBuilder) Href(value string) *ClusterBuilder { + b.href = value + b.bitmap_ |= 8 + return b +} + +// Id sets the value of the 'id' attribute to the given value. +func (b *ClusterBuilder) Id(value string) *ClusterBuilder { + b.id = value + b.bitmap_ |= 16 + return b +} + +// MultiAZ sets the value of the 'multi_AZ' attribute to the given value. +func (b *ClusterBuilder) MultiAZ(value bool) *ClusterBuilder { + b.multiAZ = value + b.bitmap_ |= 32 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ClusterBuilder) Name(value string) *ClusterBuilder { + b.name = value + b.bitmap_ |= 64 + return b +} + +// Network sets the value of the 'network' attribute to the given value. +// +// Network configuration of a cluster. +func (b *ClusterBuilder) Network(value *NetworkBuilder) *ClusterBuilder { + b.network = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// Nodes sets the value of the 'nodes' attribute to the given value. +func (b *ClusterBuilder) Nodes(value *ClusterNodesBuilder) *ClusterBuilder { + b.nodes = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// Properties sets the value of the 'properties' attribute to the given value. +func (b *ClusterBuilder) Properties(value map[string]string) *ClusterBuilder { + b.properties = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// Region sets the value of the 'region' attribute to the given value. +// +// Description of a region of a cloud provider. +func (b *ClusterBuilder) Region(value *CloudRegionBuilder) *ClusterBuilder { + b.region = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// State sets the value of the 'state' attribute to the given value. +func (b *ClusterBuilder) State(value string) *ClusterBuilder { + b.state = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterBuilder) Copy(object *Cluster) *ClusterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.api != nil { + b.api = NewClusterAPI().Copy(object.api) + } else { + b.api = nil + } + if object.aws != nil { + b.aws = NewAWS().Copy(object.aws) + } else { + b.aws = nil + } + b.displayName = object.displayName + b.href = object.href + b.id = object.id + b.multiAZ = object.multiAZ + b.name = object.name + if object.network != nil { + b.network = NewNetwork().Copy(object.network) + } else { + b.network = nil + } + if object.nodes != nil { + b.nodes = NewClusterNodes().Copy(object.nodes) + } else { + b.nodes = nil + } + if len(object.properties) > 0 { + b.properties = map[string]string{} + for k, v := range object.properties { + b.properties[k] = v + } + } else { + b.properties = nil + } + if object.region != nil { + b.region = NewCloudRegion().Copy(object.region) + } else { + b.region = nil + } + b.state = object.state + return b +} + +// Build creates a 'cluster' object using the configuration stored in the builder. +func (b *ClusterBuilder) Build() (object *Cluster, err error) { + object = new(Cluster) + object.bitmap_ = b.bitmap_ + if b.api != nil { + object.api, err = b.api.Build() + if err != nil { + return + } + } + if b.aws != nil { + object.aws, err = b.aws.Build() + if err != nil { + return + } + } + object.displayName = b.displayName + object.href = b.href + object.id = b.id + object.multiAZ = b.multiAZ + object.name = b.name + if b.network != nil { + object.network, err = b.network.Build() + if err != nil { + return + } + } + if b.nodes != nil { + object.nodes, err = b.nodes.Build() + if err != nil { + return + } + } + if b.properties != nil { + object.properties = make(map[string]string) + for k, v := range b.properties { + object.properties[k] = v + } + } + if b.region != nil { + object.region, err = b.region.Build() + if err != nil { + return + } + } + object.state = b.state + return +} diff --git a/clientapi/servicemgmt/v1/cluster_list_builder.go b/clientapi/servicemgmt/v1/cluster_list_builder.go new file mode 100644 index 00000000..73eced7c --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// ClusterListBuilder contains the data and logic needed to build +// 'cluster' objects. +type ClusterListBuilder struct { + items []*ClusterBuilder +} + +// NewClusterList creates a new builder of 'cluster' objects. +func NewClusterList() *ClusterListBuilder { + return new(ClusterListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterListBuilder) Items(values ...*ClusterBuilder) *ClusterListBuilder { + b.items = make([]*ClusterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterListBuilder) 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 *ClusterListBuilder) Copy(list *ClusterList) *ClusterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewCluster().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster' objects using the +// configuration stored in the builder. +func (b *ClusterListBuilder) Build() (list *ClusterList, err error) { + items := make([]*Cluster, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/cluster_list_type_json.go b/clientapi/servicemgmt/v1/cluster_list_type_json.go new file mode 100644 index 00000000..e6196845 --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterList writes a list of values of the 'cluster' type to +// the given writer. +func MarshalClusterList(list []*Cluster, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterList writes a list of value of the 'cluster' type to +// the given stream. +func WriteClusterList(list []*Cluster, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteCluster(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterList reads a list of values of the 'cluster' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterList(source interface{}) (items []*Cluster, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterList(iterator) + err = iterator.Error + return +} + +// ReadClusterList reads list of values of the ”cluster' type from +// the given iterator. +func ReadClusterList(iterator *jsoniter.Iterator) []*Cluster { + list := []*Cluster{} + for iterator.ReadArray() { + item := ReadCluster(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/cluster_nodes_builder.go b/clientapi/servicemgmt/v1/cluster_nodes_builder.go new file mode 100644 index 00000000..0ab648fc --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_nodes_builder.go @@ -0,0 +1,70 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// ClusterNodesBuilder contains the data and logic needed to build 'cluster_nodes' objects. +type ClusterNodesBuilder struct { + bitmap_ uint32 + availabilityZones []string +} + +// NewClusterNodes creates a new builder of 'cluster_nodes' objects. +func NewClusterNodes() *ClusterNodesBuilder { + return &ClusterNodesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ClusterNodesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// AvailabilityZones sets the value of the 'availability_zones' attribute to the given values. +func (b *ClusterNodesBuilder) AvailabilityZones(values ...string) *ClusterNodesBuilder { + b.availabilityZones = make([]string, len(values)) + copy(b.availabilityZones, values) + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ClusterNodesBuilder) Copy(object *ClusterNodes) *ClusterNodesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + if object.availabilityZones != nil { + b.availabilityZones = make([]string, len(object.availabilityZones)) + copy(b.availabilityZones, object.availabilityZones) + } else { + b.availabilityZones = nil + } + return b +} + +// Build creates a 'cluster_nodes' object using the configuration stored in the builder. +func (b *ClusterNodesBuilder) Build() (object *ClusterNodes, err error) { + object = new(ClusterNodes) + object.bitmap_ = b.bitmap_ + if b.availabilityZones != nil { + object.availabilityZones = make([]string, len(b.availabilityZones)) + copy(object.availabilityZones, b.availabilityZones) + } + return +} diff --git a/clientapi/servicemgmt/v1/cluster_nodes_list_builder.go b/clientapi/servicemgmt/v1/cluster_nodes_list_builder.go new file mode 100644 index 00000000..13b17d5e --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_nodes_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// ClusterNodesListBuilder contains the data and logic needed to build +// 'cluster_nodes' objects. +type ClusterNodesListBuilder struct { + items []*ClusterNodesBuilder +} + +// NewClusterNodesList creates a new builder of 'cluster_nodes' objects. +func NewClusterNodesList() *ClusterNodesListBuilder { + return new(ClusterNodesListBuilder) +} + +// Items sets the items of the list. +func (b *ClusterNodesListBuilder) Items(values ...*ClusterNodesBuilder) *ClusterNodesListBuilder { + b.items = make([]*ClusterNodesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ClusterNodesListBuilder) 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 *ClusterNodesListBuilder) Copy(list *ClusterNodesList) *ClusterNodesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ClusterNodesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewClusterNodes().Copy(v) + } + } + return b +} + +// Build creates a list of 'cluster_nodes' objects using the +// configuration stored in the builder. +func (b *ClusterNodesListBuilder) Build() (list *ClusterNodesList, err error) { + items := make([]*ClusterNodes, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ClusterNodesList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/cluster_nodes_list_type_json.go b/clientapi/servicemgmt/v1/cluster_nodes_list_type_json.go new file mode 100644 index 00000000..704ad030 --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_nodes_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterNodesList writes a list of values of the 'cluster_nodes' type to +// the given writer. +func MarshalClusterNodesList(list []*ClusterNodes, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterNodesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterNodesList writes a list of value of the 'cluster_nodes' type to +// the given stream. +func WriteClusterNodesList(list []*ClusterNodes, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteClusterNodes(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalClusterNodesList reads a list of values of the 'cluster_nodes' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalClusterNodesList(source interface{}) (items []*ClusterNodes, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadClusterNodesList(iterator) + err = iterator.Error + return +} + +// ReadClusterNodesList reads list of values of the ”cluster_nodes' type from +// the given iterator. +func ReadClusterNodesList(iterator *jsoniter.Iterator) []*ClusterNodes { + list := []*ClusterNodes{} + for iterator.ReadArray() { + item := ReadClusterNodes(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/cluster_nodes_type.go b/clientapi/servicemgmt/v1/cluster_nodes_type.go new file mode 100644 index 00000000..27e09428 --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_nodes_type.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// ClusterNodes represents the values of the 'cluster_nodes' type. +type ClusterNodes struct { + bitmap_ uint32 + availabilityZones []string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ClusterNodes) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// AvailabilityZones returns the value of the 'availability_zones' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ClusterNodes) AvailabilityZones() []string { + if o != nil && o.bitmap_&1 != 0 { + return o.availabilityZones + } + return nil +} + +// GetAvailabilityZones returns the value of the 'availability_zones' attribute and +// a flag indicating if the attribute has a value. +func (o *ClusterNodes) GetAvailabilityZones() (value []string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.availabilityZones + } + return +} + +// ClusterNodesListKind is the name of the type used to represent list of objects of +// type 'cluster_nodes'. +const ClusterNodesListKind = "ClusterNodesList" + +// ClusterNodesListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster_nodes'. +const ClusterNodesListLinkKind = "ClusterNodesListLink" + +// ClusterNodesNilKind is the name of the type used to nil lists of objects of +// type 'cluster_nodes'. +const ClusterNodesListNilKind = "ClusterNodesListNil" + +// ClusterNodesList is a list of values of the 'cluster_nodes' type. +type ClusterNodesList struct { + href string + link bool + items []*ClusterNodes +} + +// Len returns the length of the list. +func (l *ClusterNodesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterNodesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterNodesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterNodesList) SetItems(items []*ClusterNodes) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterNodesList) Items() []*ClusterNodes { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterNodesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterNodesList) Get(i int) *ClusterNodes { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterNodesList) Slice() []*ClusterNodes { + var slice []*ClusterNodes + if l == nil { + slice = make([]*ClusterNodes, 0) + } else { + slice = make([]*ClusterNodes, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterNodesList) Each(f func(item *ClusterNodes) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterNodesList) Range(f func(index int, item *ClusterNodes) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/cluster_nodes_type_json.go b/clientapi/servicemgmt/v1/cluster_nodes_type_json.go new file mode 100644 index 00000000..a7964c6f --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_nodes_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalClusterNodes writes a value of the 'cluster_nodes' type to the given writer. +func MarshalClusterNodes(object *ClusterNodes, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteClusterNodes(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteClusterNodes writes a value of the 'cluster_nodes' type to the given stream. +func WriteClusterNodes(object *ClusterNodes, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.availabilityZones != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("availability_zones") + WriteStringList(object.availabilityZones, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalClusterNodes reads a value of the 'cluster_nodes' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalClusterNodes(source interface{}) (object *ClusterNodes, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadClusterNodes(iterator) + err = iterator.Error + return +} + +// ReadClusterNodes reads a value of the 'cluster_nodes' type from the given iterator. +func ReadClusterNodes(iterator *jsoniter.Iterator) *ClusterNodes { + object := &ClusterNodes{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "availability_zones": + value := ReadStringList(iterator) + object.availabilityZones = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/cluster_type.go b/clientapi/servicemgmt/v1/cluster_type.go new file mode 100644 index 00000000..6ff86620 --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_type.go @@ -0,0 +1,395 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// Cluster represents the values of the 'cluster' type. +// +// This represents the parameters needed by Managed Service to create a cluster. +type Cluster struct { + bitmap_ uint32 + api *ClusterAPI + aws *AWS + displayName string + href string + id string + name string + network *Network + nodes *ClusterNodes + properties map[string]string + region *CloudRegion + state string + multiAZ bool +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Cluster) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// API returns the value of the 'API' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Cluster) API() *ClusterAPI { + if o != nil && o.bitmap_&1 != 0 { + return o.api + } + return nil +} + +// GetAPI returns the value of the 'API' attribute and +// a flag indicating if the attribute has a value. +func (o *Cluster) GetAPI() (value *ClusterAPI, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.api + } + return +} + +// AWS returns the value of the 'AWS' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Cluster) AWS() *AWS { + if o != nil && o.bitmap_&2 != 0 { + return o.aws + } + return nil +} + +// GetAWS returns the value of the 'AWS' attribute and +// a flag indicating if the attribute has a value. +func (o *Cluster) GetAWS() (value *AWS, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.aws + } + return +} + +// DisplayName returns the value of the 'display_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// DisplayName is the name of the cluster for display purposes. +// It can contain spaces. +func (o *Cluster) DisplayName() string { + if o != nil && o.bitmap_&4 != 0 { + return o.displayName + } + return "" +} + +// GetDisplayName returns the value of the 'display_name' attribute and +// a flag indicating if the attribute has a value. +// +// DisplayName is the name of the cluster for display purposes. +// It can contain spaces. +func (o *Cluster) GetDisplayName() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.displayName + } + return +} + +// Href returns the value of the 'href' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Cluster) Href() string { + if o != nil && o.bitmap_&8 != 0 { + return o.href + } + return "" +} + +// GetHref returns the value of the 'href' attribute and +// a flag indicating if the attribute has a value. +func (o *Cluster) GetHref() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.href + } + return +} + +// Id returns the value of the 'id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Cluster) Id() string { + if o != nil && o.bitmap_&16 != 0 { + return o.id + } + return "" +} + +// GetId returns the value of the 'id' attribute and +// a flag indicating if the attribute has a value. +func (o *Cluster) GetId() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.id + } + return +} + +// MultiAZ returns the value of the 'multi_AZ' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Flag indicating if the cluster should be created with nodes in +// different availability zones or all the nodes in a single one +// randomly selected. +func (o *Cluster) MultiAZ() bool { + if o != nil && o.bitmap_&32 != 0 { + return o.multiAZ + } + return false +} + +// GetMultiAZ returns the value of the 'multi_AZ' attribute and +// a flag indicating if the attribute has a value. +// +// Flag indicating if the cluster should be created with nodes in +// different availability zones or all the nodes in a single one +// randomly selected. +func (o *Cluster) GetMultiAZ() (value bool, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.multiAZ + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Cluster) Name() string { + if o != nil && o.bitmap_&64 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *Cluster) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.name + } + return +} + +// Network returns the value of the 'network' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Cluster) Network() *Network { + if o != nil && o.bitmap_&128 != 0 { + return o.network + } + return nil +} + +// GetNetwork returns the value of the 'network' attribute and +// a flag indicating if the attribute has a value. +func (o *Cluster) GetNetwork() (value *Network, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.network + } + return +} + +// Nodes returns the value of the 'nodes' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Cluster) Nodes() *ClusterNodes { + if o != nil && o.bitmap_&256 != 0 { + return o.nodes + } + return nil +} + +// GetNodes returns the value of the 'nodes' attribute and +// a flag indicating if the attribute has a value. +func (o *Cluster) GetNodes() (value *ClusterNodes, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.nodes + } + return +} + +// Properties returns the value of the 'properties' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Cluster) Properties() map[string]string { + if o != nil && o.bitmap_&512 != 0 { + return o.properties + } + return nil +} + +// GetProperties returns the value of the 'properties' attribute and +// a flag indicating if the attribute has a value. +func (o *Cluster) GetProperties() (value map[string]string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.properties + } + return +} + +// Region returns the value of the 'region' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Cluster) Region() *CloudRegion { + if o != nil && o.bitmap_&1024 != 0 { + return o.region + } + return nil +} + +// GetRegion returns the value of the 'region' attribute and +// a flag indicating if the attribute has a value. +func (o *Cluster) GetRegion() (value *CloudRegion, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.region + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Cluster) State() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.state + } + return "" +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +func (o *Cluster) GetState() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.state + } + return +} + +// ClusterListKind is the name of the type used to represent list of objects of +// type 'cluster'. +const ClusterListKind = "ClusterList" + +// ClusterListLinkKind is the name of the type used to represent links to list +// of objects of type 'cluster'. +const ClusterListLinkKind = "ClusterListLink" + +// ClusterNilKind is the name of the type used to nil lists of objects of +// type 'cluster'. +const ClusterListNilKind = "ClusterListNil" + +// ClusterList is a list of values of the 'cluster' type. +type ClusterList struct { + href string + link bool + items []*Cluster +} + +// Len returns the length of the list. +func (l *ClusterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ClusterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ClusterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ClusterList) SetItems(items []*Cluster) { + l.items = items +} + +// Items returns the items of the list. +func (l *ClusterList) Items() []*Cluster { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ClusterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ClusterList) Get(i int) *Cluster { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ClusterList) Slice() []*Cluster { + var slice []*Cluster + if l == nil { + slice = make([]*Cluster, 0) + } else { + slice = make([]*Cluster, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ClusterList) Each(f func(item *Cluster) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ClusterList) Range(f func(index int, item *Cluster) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/cluster_type_json.go b/clientapi/servicemgmt/v1/cluster_type_json.go new file mode 100644 index 00000000..d42880b4 --- /dev/null +++ b/clientapi/servicemgmt/v1/cluster_type_json.go @@ -0,0 +1,258 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + "sort" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalCluster writes a value of the 'cluster' type to the given writer. +func MarshalCluster(object *Cluster, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteCluster(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteCluster writes a value of the 'cluster' type to the given stream. +func WriteCluster(object *Cluster, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 && object.api != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("api") + WriteClusterAPI(object.api, stream) + count++ + } + present_ = object.bitmap_&2 != 0 && object.aws != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("aws") + WriteAWS(object.aws, stream) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("display_name") + stream.WriteString(object.displayName) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("multi_az") + stream.WriteBool(object.multiAZ) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&128 != 0 && object.network != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("network") + WriteNetwork(object.network, stream) + count++ + } + present_ = object.bitmap_&256 != 0 && object.nodes != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("nodes") + WriteClusterNodes(object.nodes, stream) + count++ + } + present_ = object.bitmap_&512 != 0 && object.properties != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("properties") + if object.properties != nil { + stream.WriteObjectStart() + keys := make([]string, len(object.properties)) + i := 0 + for key := range object.properties { + keys[i] = key + i++ + } + sort.Strings(keys) + for i, key := range keys { + if i > 0 { + stream.WriteMore() + } + item := object.properties[key] + stream.WriteObjectField(key) + stream.WriteString(item) + } + stream.WriteObjectEnd() + } else { + stream.WriteNil() + } + count++ + } + present_ = object.bitmap_&1024 != 0 && object.region != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("region") + WriteCloudRegion(object.region, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(object.state) + } + stream.WriteObjectEnd() +} + +// UnmarshalCluster reads a value of the 'cluster' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalCluster(source interface{}) (object *Cluster, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadCluster(iterator) + err = iterator.Error + return +} + +// ReadCluster reads a value of the 'cluster' type from the given iterator. +func ReadCluster(iterator *jsoniter.Iterator) *Cluster { + object := &Cluster{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "api": + value := ReadClusterAPI(iterator) + object.api = value + object.bitmap_ |= 1 + case "aws": + value := ReadAWS(iterator) + object.aws = value + object.bitmap_ |= 2 + case "display_name": + value := iterator.ReadString() + object.displayName = value + object.bitmap_ |= 4 + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 8 + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 16 + case "multi_az": + value := iterator.ReadBool() + object.multiAZ = value + object.bitmap_ |= 32 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 64 + case "network": + value := ReadNetwork(iterator) + object.network = value + object.bitmap_ |= 128 + case "nodes": + value := ReadClusterNodes(iterator) + object.nodes = value + object.bitmap_ |= 256 + case "properties": + value := map[string]string{} + for { + key := iterator.ReadObject() + if key == "" { + break + } + item := iterator.ReadString() + value[key] = item + } + object.properties = value + object.bitmap_ |= 512 + case "region": + value := ReadCloudRegion(iterator) + object.region = value + object.bitmap_ |= 1024 + case "state": + value := iterator.ReadString() + object.state = value + object.bitmap_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/date_list_type_json.go b/clientapi/servicemgmt/v1/date_list_type_json.go new file mode 100644 index 00000000..1bc10c83 --- /dev/null +++ b/clientapi/servicemgmt/v1/date_list_type_json.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDateList writes a list of values of the 'date' type to +// the given writer. +func MarshalDateList(list []time.Time, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDateList writes a list of value of the 'date' type to +// the given stream. +func WriteDateList(list []time.Time, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString((value).Format(time.RFC3339)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDateList reads a list of values of the 'date' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDateList(source interface{}) (items []time.Time, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDateList(iterator) + err = iterator.Error + return +} + +// ReadDateList reads list of values of the ”date' type from +// the given iterator. +func ReadDateList(iterator *jsoniter.Iterator) []time.Time { + list := []time.Time{} + for iterator.ReadArray() { + text := iterator.ReadString() + item, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/float_list_type_json.go b/clientapi/servicemgmt/v1/float_list_type_json.go new file mode 100644 index 00000000..a2d57b0e --- /dev/null +++ b/clientapi/servicemgmt/v1/float_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFloatList writes a list of values of the 'float' type to +// the given writer. +func MarshalFloatList(list []float64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFloatList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFloatList writes a list of value of the 'float' type to +// the given stream. +func WriteFloatList(list []float64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteFloat64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalFloatList reads a list of values of the 'float' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFloatList(source interface{}) (items []float64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFloatList(iterator) + err = iterator.Error + return +} + +// ReadFloatList reads list of values of the ”float' type from +// the given iterator. +func ReadFloatList(iterator *jsoniter.Iterator) []float64 { + list := []float64{} + for iterator.ReadArray() { + item := iterator.ReadFloat64() + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/instance_iam_roles_builder.go b/clientapi/servicemgmt/v1/instance_iam_roles_builder.go new file mode 100644 index 00000000..636be31e --- /dev/null +++ b/clientapi/servicemgmt/v1/instance_iam_roles_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// InstanceIAMRolesBuilder contains the data and logic needed to build 'instance_IAM_roles' objects. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type InstanceIAMRolesBuilder struct { + bitmap_ uint32 + masterRoleARN string + workerRoleARN string +} + +// NewInstanceIAMRoles creates a new builder of 'instance_IAM_roles' objects. +func NewInstanceIAMRoles() *InstanceIAMRolesBuilder { + return &InstanceIAMRolesBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *InstanceIAMRolesBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// MasterRoleARN sets the value of the 'master_role_ARN' attribute to the given value. +func (b *InstanceIAMRolesBuilder) MasterRoleARN(value string) *InstanceIAMRolesBuilder { + b.masterRoleARN = value + b.bitmap_ |= 1 + return b +} + +// WorkerRoleARN sets the value of the 'worker_role_ARN' attribute to the given value. +func (b *InstanceIAMRolesBuilder) WorkerRoleARN(value string) *InstanceIAMRolesBuilder { + b.workerRoleARN = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *InstanceIAMRolesBuilder) Copy(object *InstanceIAMRoles) *InstanceIAMRolesBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.masterRoleARN = object.masterRoleARN + b.workerRoleARN = object.workerRoleARN + return b +} + +// Build creates a 'instance_IAM_roles' object using the configuration stored in the builder. +func (b *InstanceIAMRolesBuilder) Build() (object *InstanceIAMRoles, err error) { + object = new(InstanceIAMRoles) + object.bitmap_ = b.bitmap_ + object.masterRoleARN = b.masterRoleARN + object.workerRoleARN = b.workerRoleARN + return +} diff --git a/clientapi/servicemgmt/v1/instance_iam_roles_list_builder.go b/clientapi/servicemgmt/v1/instance_iam_roles_list_builder.go new file mode 100644 index 00000000..050820d4 --- /dev/null +++ b/clientapi/servicemgmt/v1/instance_iam_roles_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// InstanceIAMRolesListBuilder contains the data and logic needed to build +// 'instance_IAM_roles' objects. +type InstanceIAMRolesListBuilder struct { + items []*InstanceIAMRolesBuilder +} + +// NewInstanceIAMRolesList creates a new builder of 'instance_IAM_roles' objects. +func NewInstanceIAMRolesList() *InstanceIAMRolesListBuilder { + return new(InstanceIAMRolesListBuilder) +} + +// Items sets the items of the list. +func (b *InstanceIAMRolesListBuilder) Items(values ...*InstanceIAMRolesBuilder) *InstanceIAMRolesListBuilder { + b.items = make([]*InstanceIAMRolesBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *InstanceIAMRolesListBuilder) 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 *InstanceIAMRolesListBuilder) Copy(list *InstanceIAMRolesList) *InstanceIAMRolesListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*InstanceIAMRolesBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewInstanceIAMRoles().Copy(v) + } + } + return b +} + +// Build creates a list of 'instance_IAM_roles' objects using the +// configuration stored in the builder. +func (b *InstanceIAMRolesListBuilder) Build() (list *InstanceIAMRolesList, err error) { + items := make([]*InstanceIAMRoles, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(InstanceIAMRolesList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/instance_iam_roles_list_type_json.go b/clientapi/servicemgmt/v1/instance_iam_roles_list_type_json.go new file mode 100644 index 00000000..cfc67983 --- /dev/null +++ b/clientapi/servicemgmt/v1/instance_iam_roles_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInstanceIAMRolesList writes a list of values of the 'instance_IAM_roles' type to +// the given writer. +func MarshalInstanceIAMRolesList(list []*InstanceIAMRoles, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInstanceIAMRolesList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInstanceIAMRolesList writes a list of value of the 'instance_IAM_roles' type to +// the given stream. +func WriteInstanceIAMRolesList(list []*InstanceIAMRoles, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteInstanceIAMRoles(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalInstanceIAMRolesList reads a list of values of the 'instance_IAM_roles' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInstanceIAMRolesList(source interface{}) (items []*InstanceIAMRoles, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInstanceIAMRolesList(iterator) + err = iterator.Error + return +} + +// ReadInstanceIAMRolesList reads list of values of the ”instance_IAM_roles' type from +// the given iterator. +func ReadInstanceIAMRolesList(iterator *jsoniter.Iterator) []*InstanceIAMRoles { + list := []*InstanceIAMRoles{} + for iterator.ReadArray() { + item := ReadInstanceIAMRoles(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/instance_iam_roles_type.go b/clientapi/servicemgmt/v1/instance_iam_roles_type.go new file mode 100644 index 00000000..7aa88486 --- /dev/null +++ b/clientapi/servicemgmt/v1/instance_iam_roles_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// InstanceIAMRoles represents the values of the 'instance_IAM_roles' type. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type InstanceIAMRoles struct { + bitmap_ uint32 + masterRoleARN string + workerRoleARN string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *InstanceIAMRoles) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// MasterRoleARN returns the value of the 'master_role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The IAM role ARN that will be attached to master instances +func (o *InstanceIAMRoles) MasterRoleARN() string { + if o != nil && o.bitmap_&1 != 0 { + return o.masterRoleARN + } + return "" +} + +// GetMasterRoleARN returns the value of the 'master_role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// The IAM role ARN that will be attached to master instances +func (o *InstanceIAMRoles) GetMasterRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.masterRoleARN + } + return +} + +// WorkerRoleARN returns the value of the 'worker_role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The IAM role ARN that will be attached to worker instances +func (o *InstanceIAMRoles) WorkerRoleARN() string { + if o != nil && o.bitmap_&2 != 0 { + return o.workerRoleARN + } + return "" +} + +// GetWorkerRoleARN returns the value of the 'worker_role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// The IAM role ARN that will be attached to worker instances +func (o *InstanceIAMRoles) GetWorkerRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.workerRoleARN + } + return +} + +// InstanceIAMRolesListKind is the name of the type used to represent list of objects of +// type 'instance_IAM_roles'. +const InstanceIAMRolesListKind = "InstanceIAMRolesList" + +// InstanceIAMRolesListLinkKind is the name of the type used to represent links to list +// of objects of type 'instance_IAM_roles'. +const InstanceIAMRolesListLinkKind = "InstanceIAMRolesListLink" + +// InstanceIAMRolesNilKind is the name of the type used to nil lists of objects of +// type 'instance_IAM_roles'. +const InstanceIAMRolesListNilKind = "InstanceIAMRolesListNil" + +// InstanceIAMRolesList is a list of values of the 'instance_IAM_roles' type. +type InstanceIAMRolesList struct { + href string + link bool + items []*InstanceIAMRoles +} + +// Len returns the length of the list. +func (l *InstanceIAMRolesList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *InstanceIAMRolesList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *InstanceIAMRolesList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *InstanceIAMRolesList) SetItems(items []*InstanceIAMRoles) { + l.items = items +} + +// Items returns the items of the list. +func (l *InstanceIAMRolesList) Items() []*InstanceIAMRoles { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *InstanceIAMRolesList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *InstanceIAMRolesList) Get(i int) *InstanceIAMRoles { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *InstanceIAMRolesList) Slice() []*InstanceIAMRoles { + var slice []*InstanceIAMRoles + if l == nil { + slice = make([]*InstanceIAMRoles, 0) + } else { + slice = make([]*InstanceIAMRoles, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *InstanceIAMRolesList) Each(f func(item *InstanceIAMRoles) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *InstanceIAMRolesList) Range(f func(index int, item *InstanceIAMRoles) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/instance_iam_roles_type_json.go b/clientapi/servicemgmt/v1/instance_iam_roles_type_json.go new file mode 100644 index 00000000..6c652ece --- /dev/null +++ b/clientapi/servicemgmt/v1/instance_iam_roles_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInstanceIAMRoles writes a value of the 'instance_IAM_roles' type to the given writer. +func MarshalInstanceIAMRoles(object *InstanceIAMRoles, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInstanceIAMRoles(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInstanceIAMRoles writes a value of the 'instance_IAM_roles' type to the given stream. +func WriteInstanceIAMRoles(object *InstanceIAMRoles, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("master_role_arn") + stream.WriteString(object.masterRoleARN) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("worker_role_arn") + stream.WriteString(object.workerRoleARN) + } + stream.WriteObjectEnd() +} + +// UnmarshalInstanceIAMRoles reads a value of the 'instance_IAM_roles' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalInstanceIAMRoles(source interface{}) (object *InstanceIAMRoles, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadInstanceIAMRoles(iterator) + err = iterator.Error + return +} + +// ReadInstanceIAMRoles reads a value of the 'instance_IAM_roles' type from the given iterator. +func ReadInstanceIAMRoles(iterator *jsoniter.Iterator) *InstanceIAMRoles { + object := &InstanceIAMRoles{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "master_role_arn": + value := iterator.ReadString() + object.masterRoleARN = value + object.bitmap_ |= 1 + case "worker_role_arn": + value := iterator.ReadString() + object.workerRoleARN = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/integer_list_type_json.go b/clientapi/servicemgmt/v1/integer_list_type_json.go new file mode 100644 index 00000000..966824df --- /dev/null +++ b/clientapi/servicemgmt/v1/integer_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIntegerList writes a list of values of the 'integer' type to +// the given writer. +func MarshalIntegerList(list []int, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIntegerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIntegerList writes a list of value of the 'integer' type to +// the given stream. +func WriteIntegerList(list []int, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalIntegerList reads a list of values of the 'integer' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIntegerList(source interface{}) (items []int, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIntegerList(iterator) + err = iterator.Error + return +} + +// ReadIntegerList reads list of values of the ”integer' type from +// the given iterator. +func ReadIntegerList(iterator *jsoniter.Iterator) []int { + list := []int{} + for iterator.ReadArray() { + item := iterator.ReadInt() + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/interface_list_type_json.go b/clientapi/servicemgmt/v1/interface_list_type_json.go new file mode 100644 index 00000000..1ddcaa68 --- /dev/null +++ b/clientapi/servicemgmt/v1/interface_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInterfaceList writes a list of values of the 'interface' type to +// the given writer. +func MarshalInterfaceList(list []interface{}, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInterfaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInterfaceList writes a list of value of the 'interface' type to +// the given stream. +func WriteInterfaceList(list []interface{}, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteVal(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalInterfaceList reads a list of values of the 'interface' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInterfaceList(source interface{}) (items []interface{}, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInterfaceList(iterator) + err = iterator.Error + return +} + +// ReadInterfaceList reads list of values of the ”interface' type from +// the given iterator. +func ReadInterfaceList(iterator *jsoniter.Iterator) []interface{} { + list := []interface{}{} + for iterator.ReadArray() { + var item interface{} + iterator.ReadVal(&item) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/listening_method_list_type_json.go b/clientapi/servicemgmt/v1/listening_method_list_type_json.go new file mode 100644 index 00000000..8571daa6 --- /dev/null +++ b/clientapi/servicemgmt/v1/listening_method_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalListeningMethodList writes a list of values of the 'listening_method' type to +// the given writer. +func MarshalListeningMethodList(list []ListeningMethod, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteListeningMethodList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteListeningMethodList writes a list of value of the 'listening_method' type to +// the given stream. +func WriteListeningMethodList(list []ListeningMethod, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(string(value)) + } + stream.WriteArrayEnd() +} + +// UnmarshalListeningMethodList reads a list of values of the 'listening_method' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalListeningMethodList(source interface{}) (items []ListeningMethod, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadListeningMethodList(iterator) + err = iterator.Error + return +} + +// ReadListeningMethodList reads list of values of the ”listening_method' type from +// the given iterator. +func ReadListeningMethodList(iterator *jsoniter.Iterator) []ListeningMethod { + list := []ListeningMethod{} + for iterator.ReadArray() { + text := iterator.ReadString() + item := ListeningMethod(text) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/listening_method_type.go b/clientapi/servicemgmt/v1/listening_method_type.go new file mode 100644 index 00000000..5e21e08a --- /dev/null +++ b/clientapi/servicemgmt/v1/listening_method_type.go @@ -0,0 +1,30 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// ListeningMethod represents the values of the 'listening_method' enumerated type. +type ListeningMethod string + +const ( + // Uses both external and internal traffic. + ListeningMethodExternal ListeningMethod = "external" + // Uses only internal traffic. + ListeningMethodInternal ListeningMethod = "internal" +) diff --git a/clientapi/servicemgmt/v1/long_list_type_json.go b/clientapi/servicemgmt/v1/long_list_type_json.go new file mode 100644 index 00000000..b114cbe9 --- /dev/null +++ b/clientapi/servicemgmt/v1/long_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLongList writes a list of values of the 'long' type to +// the given writer. +func MarshalLongList(list []int64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLongList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLongList writes a list of value of the 'long' type to +// the given stream. +func WriteLongList(list []int64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalLongList reads a list of values of the 'long' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLongList(source interface{}) (items []int64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLongList(iterator) + err = iterator.Error + return +} + +// ReadLongList reads list of values of the ”long' type from +// the given iterator. +func ReadLongList(iterator *jsoniter.Iterator) []int64 { + list := []int64{} + for iterator.ReadArray() { + item := iterator.ReadInt64() + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/managed_service_builder.go b/clientapi/servicemgmt/v1/managed_service_builder.go new file mode 100644 index 00000000..19cb02fa --- /dev/null +++ b/clientapi/servicemgmt/v1/managed_service_builder.go @@ -0,0 +1,233 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + time "time" +) + +// ManagedServiceBuilder contains the data and logic needed to build 'managed_service' objects. +// +// Represents data about a running Managed Service. +type ManagedServiceBuilder struct { + bitmap_ uint32 + id string + href string + addon *StatefulObjectBuilder + cluster *ClusterBuilder + createdAt time.Time + expiredAt time.Time + parameters []*ServiceParameterBuilder + resources []*StatefulObjectBuilder + service string + serviceState string + updatedAt time.Time +} + +// NewManagedService creates a new builder of 'managed_service' objects. +func NewManagedService() *ManagedServiceBuilder { + return &ManagedServiceBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ManagedServiceBuilder) Link(value bool) *ManagedServiceBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ManagedServiceBuilder) ID(value string) *ManagedServiceBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ManagedServiceBuilder) HREF(value string) *ManagedServiceBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ManagedServiceBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Addon sets the value of the 'addon' attribute to the given value. +func (b *ManagedServiceBuilder) Addon(value *StatefulObjectBuilder) *ManagedServiceBuilder { + b.addon = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// Cluster sets the value of the 'cluster' attribute to the given value. +// +// This represents the parameters needed by Managed Service to create a cluster. +func (b *ManagedServiceBuilder) Cluster(value *ClusterBuilder) *ManagedServiceBuilder { + b.cluster = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *ManagedServiceBuilder) CreatedAt(value time.Time) *ManagedServiceBuilder { + b.createdAt = value + b.bitmap_ |= 32 + return b +} + +// ExpiredAt sets the value of the 'expired_at' attribute to the given value. +func (b *ManagedServiceBuilder) ExpiredAt(value time.Time) *ManagedServiceBuilder { + b.expiredAt = value + b.bitmap_ |= 64 + 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_ |= 128 + 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_ |= 256 + return b +} + +// Service sets the value of the 'service' attribute to the given value. +func (b *ManagedServiceBuilder) Service(value string) *ManagedServiceBuilder { + b.service = value + b.bitmap_ |= 512 + return b +} + +// ServiceState sets the value of the 'service_state' attribute to the given value. +func (b *ManagedServiceBuilder) ServiceState(value string) *ManagedServiceBuilder { + b.serviceState = value + b.bitmap_ |= 1024 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *ManagedServiceBuilder) UpdatedAt(value time.Time) *ManagedServiceBuilder { + b.updatedAt = value + b.bitmap_ |= 2048 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ManagedServiceBuilder) Copy(object *ManagedService) *ManagedServiceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.addon != nil { + b.addon = NewStatefulObject().Copy(object.addon) + } else { + b.addon = nil + } + if object.cluster != nil { + b.cluster = NewCluster().Copy(object.cluster) + } else { + b.cluster = nil + } + b.createdAt = object.createdAt + b.expiredAt = object.expiredAt + 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 { + b.resources[i] = NewStatefulObject().Copy(v) + } + } else { + b.resources = nil + } + b.service = object.service + b.serviceState = object.serviceState + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'managed_service' object using the configuration stored in the builder. +func (b *ManagedServiceBuilder) Build() (object *ManagedService, err error) { + object = new(ManagedService) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.addon != nil { + object.addon, err = b.addon.Build() + if err != nil { + return + } + } + if b.cluster != nil { + object.cluster, err = b.cluster.Build() + if err != nil { + return + } + } + object.createdAt = b.createdAt + object.expiredAt = b.expiredAt + 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 { + object.resources[i], err = v.Build() + if err != nil { + return + } + } + } + object.service = b.service + object.serviceState = b.serviceState + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/servicemgmt/v1/managed_service_list_builder.go b/clientapi/servicemgmt/v1/managed_service_list_builder.go new file mode 100644 index 00000000..749365be --- /dev/null +++ b/clientapi/servicemgmt/v1/managed_service_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// ManagedServiceListBuilder contains the data and logic needed to build +// 'managed_service' objects. +type ManagedServiceListBuilder struct { + items []*ManagedServiceBuilder +} + +// NewManagedServiceList creates a new builder of 'managed_service' objects. +func NewManagedServiceList() *ManagedServiceListBuilder { + return new(ManagedServiceListBuilder) +} + +// Items sets the items of the list. +func (b *ManagedServiceListBuilder) Items(values ...*ManagedServiceBuilder) *ManagedServiceListBuilder { + b.items = make([]*ManagedServiceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ManagedServiceListBuilder) 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 *ManagedServiceListBuilder) Copy(list *ManagedServiceList) *ManagedServiceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ManagedServiceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewManagedService().Copy(v) + } + } + return b +} + +// Build creates a list of 'managed_service' objects using the +// configuration stored in the builder. +func (b *ManagedServiceListBuilder) Build() (list *ManagedServiceList, err error) { + items := make([]*ManagedService, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ManagedServiceList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/managed_service_list_type_json.go b/clientapi/servicemgmt/v1/managed_service_list_type_json.go new file mode 100644 index 00000000..4786b00d --- /dev/null +++ b/clientapi/servicemgmt/v1/managed_service_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalManagedServiceList writes a list of values of the 'managed_service' type to +// the given writer. +func MarshalManagedServiceList(list []*ManagedService, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManagedServiceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManagedServiceList writes a list of value of the 'managed_service' type to +// the given stream. +func WriteManagedServiceList(list []*ManagedService, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteManagedService(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalManagedServiceList reads a list of values of the 'managed_service' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalManagedServiceList(source interface{}) (items []*ManagedService, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadManagedServiceList(iterator) + err = iterator.Error + return +} + +// ReadManagedServiceList reads list of values of the ”managed_service' type from +// the given iterator. +func ReadManagedServiceList(iterator *jsoniter.Iterator) []*ManagedService { + list := []*ManagedService{} + for iterator.ReadArray() { + item := ReadManagedService(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/managed_service_type.go b/clientapi/servicemgmt/v1/managed_service_type.go new file mode 100644 index 00000000..05ee48e7 --- /dev/null +++ b/clientapi/servicemgmt/v1/managed_service_type.go @@ -0,0 +1,425 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + time "time" +) + +// ManagedServiceKind is the name of the type used to represent objects +// of type 'managed_service'. +const ManagedServiceKind = "ManagedService" + +// ManagedServiceLinkKind is the name of the type used to represent links +// to objects of type 'managed_service'. +const ManagedServiceLinkKind = "ManagedServiceLink" + +// ManagedServiceNilKind is the name of the type used to nil references +// to objects of type 'managed_service'. +const ManagedServiceNilKind = "ManagedServiceNil" + +// ManagedService represents the values of the 'managed_service' type. +// +// Represents data about a running Managed Service. +type ManagedService struct { + bitmap_ uint32 + id string + href string + addon *StatefulObject + cluster *Cluster + createdAt time.Time + expiredAt time.Time + parameters []*ServiceParameter + resources []*StatefulObject + service string + serviceState string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *ManagedService) Kind() string { + if o == nil { + return ManagedServiceNilKind + } + if o.bitmap_&1 != 0 { + return ManagedServiceLinkKind + } + return ManagedServiceKind +} + +// Link returns true if this is a link. +func (o *ManagedService) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ManagedService) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ManagedService) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ManagedService) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ManagedService) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ManagedService) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Addon returns the value of the 'addon' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ManagedService) Addon() *StatefulObject { + if o != nil && o.bitmap_&8 != 0 { + return o.addon + } + return nil +} + +// GetAddon returns the value of the 'addon' attribute and +// a flag indicating if the attribute has a value. +func (o *ManagedService) GetAddon() (value *StatefulObject, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.addon + } + return +} + +// Cluster returns the value of the 'cluster' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ManagedService) Cluster() *Cluster { + if o != nil && o.bitmap_&16 != 0 { + return o.cluster + } + return nil +} + +// GetCluster returns the value of the 'cluster' attribute and +// a flag indicating if the attribute has a value. +func (o *ManagedService) GetCluster() (value *Cluster, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.cluster + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ManagedService) CreatedAt() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +func (o *ManagedService) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.createdAt + } + return +} + +// ExpiredAt returns the value of the 'expired_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ManagedService) ExpiredAt() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.expiredAt + } + return time.Time{} +} + +// GetExpiredAt returns the value of the 'expired_at' attribute and +// a flag indicating if the attribute has a value. +func (o *ManagedService) GetExpiredAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.expiredAt + } + 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_&128 != 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_&128 != 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_&256 != 0 { + return o.resources + } + return nil +} + +// GetResources returns the value of the 'resources' attribute and +// a flag indicating if the attribute has a value. +func (o *ManagedService) GetResources() (value []*StatefulObject, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.resources + } + return +} + +// Service returns the value of the 'service' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ManagedService) Service() string { + if o != nil && o.bitmap_&512 != 0 { + return o.service + } + return "" +} + +// GetService returns the value of the 'service' attribute and +// a flag indicating if the attribute has a value. +func (o *ManagedService) GetService() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.service + } + return +} + +// ServiceState returns the value of the 'service_state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ManagedService) ServiceState() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.serviceState + } + return "" +} + +// GetServiceState returns the value of the 'service_state' attribute and +// a flag indicating if the attribute has a value. +func (o *ManagedService) GetServiceState() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.serviceState + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *ManagedService) UpdatedAt() time.Time { + if o != nil && o.bitmap_&2048 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *ManagedService) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.updatedAt + } + return +} + +// ManagedServiceListKind is the name of the type used to represent list of objects of +// type 'managed_service'. +const ManagedServiceListKind = "ManagedServiceList" + +// ManagedServiceListLinkKind is the name of the type used to represent links to list +// of objects of type 'managed_service'. +const ManagedServiceListLinkKind = "ManagedServiceListLink" + +// ManagedServiceNilKind is the name of the type used to nil lists of objects of +// type 'managed_service'. +const ManagedServiceListNilKind = "ManagedServiceListNil" + +// ManagedServiceList is a list of values of the 'managed_service' type. +type ManagedServiceList struct { + href string + link bool + items []*ManagedService +} + +// Kind returns the name of the type of the object. +func (l *ManagedServiceList) Kind() string { + if l == nil { + return ManagedServiceListNilKind + } + if l.link { + return ManagedServiceListLinkKind + } + return ManagedServiceListKind +} + +// Link returns true iif this is a link. +func (l *ManagedServiceList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ManagedServiceList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ManagedServiceList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ManagedServiceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ManagedServiceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ManagedServiceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ManagedServiceList) SetItems(items []*ManagedService) { + l.items = items +} + +// Items returns the items of the list. +func (l *ManagedServiceList) Items() []*ManagedService { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ManagedServiceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ManagedServiceList) Get(i int) *ManagedService { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ManagedServiceList) Slice() []*ManagedService { + var slice []*ManagedService + if l == nil { + slice = make([]*ManagedService, 0) + } else { + slice = make([]*ManagedService, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ManagedServiceList) Each(f func(item *ManagedService) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ManagedServiceList) Range(f func(index int, item *ManagedService) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/managed_service_type_json.go b/clientapi/servicemgmt/v1/managed_service_type_json.go new file mode 100644 index 00000000..a31a270b --- /dev/null +++ b/clientapi/servicemgmt/v1/managed_service_type_json.go @@ -0,0 +1,237 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalManagedService writes a value of the 'managed_service' type to the given writer. +func MarshalManagedService(object *ManagedService, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteManagedService(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteManagedService writes a value of the 'managed_service' type to the given stream. +func WriteManagedService(object *ManagedService, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ManagedServiceLinkKind) + } else { + stream.WriteString(ManagedServiceKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.addon != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("addon") + WriteStatefulObject(object.addon, stream) + count++ + } + present_ = object.bitmap_&16 != 0 && object.cluster != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("cluster") + WriteCluster(object.cluster, stream) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("expired_at") + stream.WriteString((object.expiredAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 && object.parameters != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("parameters") + WriteServiceParameterList(object.parameters, stream) + count++ + } + present_ = object.bitmap_&256 != 0 && object.resources != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("resources") + WriteStatefulObjectList(object.resources, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service") + stream.WriteString(object.service) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_state") + stream.WriteString(object.serviceState) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalManagedService reads a value of the 'managed_service' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalManagedService(source interface{}) (object *ManagedService, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadManagedService(iterator) + err = iterator.Error + return +} + +// ReadManagedService reads a value of the 'managed_service' type from the given iterator. +func ReadManagedService(iterator *jsoniter.Iterator) *ManagedService { + object := &ManagedService{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ManagedServiceLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "addon": + value := ReadStatefulObject(iterator) + object.addon = value + object.bitmap_ |= 8 + case "cluster": + value := ReadCluster(iterator) + object.cluster = value + object.bitmap_ |= 16 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 32 + case "expired_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.expiredAt = value + object.bitmap_ |= 64 + case "parameters": + value := ReadServiceParameterList(iterator) + object.parameters = value + object.bitmap_ |= 128 + case "resources": + value := ReadStatefulObjectList(iterator) + object.resources = value + object.bitmap_ |= 256 + case "service": + value := iterator.ReadString() + object.service = value + object.bitmap_ |= 512 + case "service_state": + value := iterator.ReadString() + object.serviceState = value + object.bitmap_ |= 1024 + 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_ |= 2048 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/metadata_reader.go b/clientapi/servicemgmt/v1/metadata_reader.go new file mode 100644 index 00000000..54c93a73 --- /dev/null +++ b/clientapi/servicemgmt/v1/metadata_reader.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMetadata writes a value of the metadata type to the given target, which +// can be a writer or a JSON encoder. +func MarshalMetadata(object *Metadata, writer io.Writer) error { + stream := helpers.NewStream(writer) + writeMetadata(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} +func writeMetadata(object *Metadata, stream *jsoniter.Stream) { + stream.WriteObjectStart() + if object.bitmap_&1 != 0 { + stream.WriteObjectField("server_version") + stream.WriteString(object.serverVersion) + } + stream.WriteObjectEnd() +} + +// UnmarshalMetadata reads a value of the metadata type from the given source, which +// which can be a reader, a slice of byte or a string. +func UnmarshalMetadata(source interface{}) (object *Metadata, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = readMetadata(iterator) + err = iterator.Error + return +} +func readMetadata(iterator *jsoniter.Iterator) *Metadata { + object := &Metadata{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "server_version": + object.serverVersion = iterator.ReadString() + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/metadata_type.go b/clientapi/servicemgmt/v1/metadata_type.go new file mode 100644 index 00000000..12b99ea9 --- /dev/null +++ b/clientapi/servicemgmt/v1/metadata_type.go @@ -0,0 +1,44 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// Metadata contains the version metadata. +type Metadata struct { + bitmap_ uint32 + serverVersion string +} + +// ServerVersion returns the version of the server. +func (m *Metadata) ServerVersion() string { + if m != nil && m.bitmap_&1 != 0 { + return m.serverVersion + } + return "" +} + +// GetServerVersion returns the value of the server version and a flag indicating if +// the attribute has a value. +func (m *Metadata) GetServerVersion() (value string, ok bool) { + ok = m != nil && m.bitmap_&1 != 0 + if ok { + value = m.serverVersion + } + return +} diff --git a/clientapi/servicemgmt/v1/network_builder.go b/clientapi/servicemgmt/v1/network_builder.go new file mode 100644 index 00000000..3e9fbdab --- /dev/null +++ b/clientapi/servicemgmt/v1/network_builder.go @@ -0,0 +1,103 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// NetworkBuilder contains the data and logic needed to build 'network' objects. +// +// Network configuration of a cluster. +type NetworkBuilder struct { + bitmap_ uint32 + hostPrefix int + machineCIDR string + podCIDR string + serviceCIDR string + type_ string +} + +// NewNetwork creates a new builder of 'network' objects. +func NewNetwork() *NetworkBuilder { + return &NetworkBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NetworkBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// HostPrefix sets the value of the 'host_prefix' attribute to the given value. +func (b *NetworkBuilder) HostPrefix(value int) *NetworkBuilder { + b.hostPrefix = value + b.bitmap_ |= 1 + return b +} + +// MachineCIDR sets the value of the 'machine_CIDR' attribute to the given value. +func (b *NetworkBuilder) MachineCIDR(value string) *NetworkBuilder { + b.machineCIDR = value + b.bitmap_ |= 2 + return b +} + +// PodCIDR sets the value of the 'pod_CIDR' attribute to the given value. +func (b *NetworkBuilder) PodCIDR(value string) *NetworkBuilder { + b.podCIDR = value + b.bitmap_ |= 4 + return b +} + +// ServiceCIDR sets the value of the 'service_CIDR' attribute to the given value. +func (b *NetworkBuilder) ServiceCIDR(value string) *NetworkBuilder { + b.serviceCIDR = value + b.bitmap_ |= 8 + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *NetworkBuilder) Type(value string) *NetworkBuilder { + b.type_ = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NetworkBuilder) Copy(object *Network) *NetworkBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.hostPrefix = object.hostPrefix + b.machineCIDR = object.machineCIDR + b.podCIDR = object.podCIDR + b.serviceCIDR = object.serviceCIDR + b.type_ = object.type_ + return b +} + +// Build creates a 'network' object using the configuration stored in the builder. +func (b *NetworkBuilder) Build() (object *Network, err error) { + object = new(Network) + object.bitmap_ = b.bitmap_ + object.hostPrefix = b.hostPrefix + object.machineCIDR = b.machineCIDR + object.podCIDR = b.podCIDR + object.serviceCIDR = b.serviceCIDR + object.type_ = b.type_ + return +} diff --git a/clientapi/servicemgmt/v1/network_list_builder.go b/clientapi/servicemgmt/v1/network_list_builder.go new file mode 100644 index 00000000..26e440ec --- /dev/null +++ b/clientapi/servicemgmt/v1/network_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// NetworkListBuilder contains the data and logic needed to build +// 'network' objects. +type NetworkListBuilder struct { + items []*NetworkBuilder +} + +// NewNetworkList creates a new builder of 'network' objects. +func NewNetworkList() *NetworkListBuilder { + return new(NetworkListBuilder) +} + +// Items sets the items of the list. +func (b *NetworkListBuilder) Items(values ...*NetworkBuilder) *NetworkListBuilder { + b.items = make([]*NetworkBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NetworkListBuilder) 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 *NetworkListBuilder) Copy(list *NetworkList) *NetworkListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NetworkBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNetwork().Copy(v) + } + } + return b +} + +// Build creates a list of 'network' objects using the +// configuration stored in the builder. +func (b *NetworkListBuilder) Build() (list *NetworkList, err error) { + items := make([]*Network, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NetworkList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/network_list_type_json.go b/clientapi/servicemgmt/v1/network_list_type_json.go new file mode 100644 index 00000000..035aab7b --- /dev/null +++ b/clientapi/servicemgmt/v1/network_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNetworkList writes a list of values of the 'network' type to +// the given writer. +func MarshalNetworkList(list []*Network, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNetworkList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNetworkList writes a list of value of the 'network' type to +// the given stream. +func WriteNetworkList(list []*Network, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNetwork(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNetworkList reads a list of values of the 'network' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNetworkList(source interface{}) (items []*Network, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNetworkList(iterator) + err = iterator.Error + return +} + +// ReadNetworkList reads list of values of the ”network' type from +// the given iterator. +func ReadNetworkList(iterator *jsoniter.Iterator) []*Network { + list := []*Network{} + for iterator.ReadArray() { + item := ReadNetwork(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/network_type.go b/clientapi/servicemgmt/v1/network_type.go new file mode 100644 index 00000000..d7be3657 --- /dev/null +++ b/clientapi/servicemgmt/v1/network_type.go @@ -0,0 +1,261 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// Network represents the values of the 'network' type. +// +// Network configuration of a cluster. +type Network struct { + bitmap_ uint32 + hostPrefix int + machineCIDR string + podCIDR string + serviceCIDR string + type_ string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Network) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// HostPrefix returns the value of the 'host_prefix' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Network host prefix which is defaulted to `23` if not specified. +func (o *Network) HostPrefix() int { + if o != nil && o.bitmap_&1 != 0 { + return o.hostPrefix + } + return 0 +} + +// GetHostPrefix returns the value of the 'host_prefix' attribute and +// a flag indicating if the attribute has a value. +// +// Network host prefix which is defaulted to `23` if not specified. +func (o *Network) GetHostPrefix() (value int, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.hostPrefix + } + return +} + +// MachineCIDR returns the value of the 'machine_CIDR' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// IP address block from which to assign machine IP addresses, for example `10.0.0.0/16`. +func (o *Network) MachineCIDR() string { + if o != nil && o.bitmap_&2 != 0 { + return o.machineCIDR + } + return "" +} + +// GetMachineCIDR returns the value of the 'machine_CIDR' attribute and +// a flag indicating if the attribute has a value. +// +// IP address block from which to assign machine IP addresses, for example `10.0.0.0/16`. +func (o *Network) GetMachineCIDR() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.machineCIDR + } + return +} + +// PodCIDR returns the value of the 'pod_CIDR' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// IP address block from which to assign pod IP addresses, for example `10.128.0.0/14`. +func (o *Network) PodCIDR() string { + if o != nil && o.bitmap_&4 != 0 { + return o.podCIDR + } + return "" +} + +// GetPodCIDR returns the value of the 'pod_CIDR' attribute and +// a flag indicating if the attribute has a value. +// +// IP address block from which to assign pod IP addresses, for example `10.128.0.0/14`. +func (o *Network) GetPodCIDR() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.podCIDR + } + return +} + +// ServiceCIDR returns the value of the 'service_CIDR' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// IP address block from which to assign service IP addresses, for example `172.30.0.0/16`. +func (o *Network) ServiceCIDR() string { + if o != nil && o.bitmap_&8 != 0 { + return o.serviceCIDR + } + return "" +} + +// GetServiceCIDR returns the value of the 'service_CIDR' attribute and +// a flag indicating if the attribute has a value. +// +// IP address block from which to assign service IP addresses, for example `172.30.0.0/16`. +func (o *Network) GetServiceCIDR() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.serviceCIDR + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The main controller responsible for rendering the core networking components. +func (o *Network) Type() string { + if o != nil && o.bitmap_&16 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// The main controller responsible for rendering the core networking components. +func (o *Network) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.type_ + } + return +} + +// NetworkListKind is the name of the type used to represent list of objects of +// type 'network'. +const NetworkListKind = "NetworkList" + +// NetworkListLinkKind is the name of the type used to represent links to list +// of objects of type 'network'. +const NetworkListLinkKind = "NetworkListLink" + +// NetworkNilKind is the name of the type used to nil lists of objects of +// type 'network'. +const NetworkListNilKind = "NetworkListNil" + +// NetworkList is a list of values of the 'network' type. +type NetworkList struct { + href string + link bool + items []*Network +} + +// Len returns the length of the list. +func (l *NetworkList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NetworkList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NetworkList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NetworkList) SetItems(items []*Network) { + l.items = items +} + +// Items returns the items of the list. +func (l *NetworkList) Items() []*Network { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NetworkList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NetworkList) Get(i int) *Network { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NetworkList) Slice() []*Network { + var slice []*Network + if l == nil { + slice = make([]*Network, 0) + } else { + slice = make([]*Network, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NetworkList) Each(f func(item *Network) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NetworkList) Range(f func(index int, item *Network) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/network_type_json.go b/clientapi/servicemgmt/v1/network_type_json.go new file mode 100644 index 00000000..af10d056 --- /dev/null +++ b/clientapi/servicemgmt/v1/network_type_json.go @@ -0,0 +1,138 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNetwork writes a value of the 'network' type to the given writer. +func MarshalNetwork(object *Network, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNetwork(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNetwork writes a value of the 'network' type to the given stream. +func WriteNetwork(object *Network, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("host_prefix") + stream.WriteInt(object.hostPrefix) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("machine_cidr") + stream.WriteString(object.machineCIDR) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("pod_cidr") + stream.WriteString(object.podCIDR) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_cidr") + stream.WriteString(object.serviceCIDR) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + } + stream.WriteObjectEnd() +} + +// UnmarshalNetwork reads a value of the 'network' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNetwork(source interface{}) (object *Network, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNetwork(iterator) + err = iterator.Error + return +} + +// ReadNetwork reads a value of the 'network' type from the given iterator. +func ReadNetwork(iterator *jsoniter.Iterator) *Network { + object := &Network{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "host_prefix": + value := iterator.ReadInt() + object.hostPrefix = value + object.bitmap_ |= 1 + case "machine_cidr": + value := iterator.ReadString() + object.machineCIDR = value + object.bitmap_ |= 2 + case "pod_cidr": + value := iterator.ReadString() + object.podCIDR = value + object.bitmap_ |= 4 + case "service_cidr": + value := iterator.ReadString() + object.serviceCIDR = value + object.bitmap_ |= 8 + case "type": + value := iterator.ReadString() + object.type_ = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/operator_iam_role_builder.go b/clientapi/servicemgmt/v1/operator_iam_role_builder.go new file mode 100644 index 00000000..1b4d95f3 --- /dev/null +++ b/clientapi/servicemgmt/v1/operator_iam_role_builder.go @@ -0,0 +1,83 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// OperatorIAMRoleBuilder contains the data and logic needed to build 'operator_IAM_role' objects. +// +// Contains the necessary attributes to allow each operator to access the necessary AWS resources +type OperatorIAMRoleBuilder struct { + bitmap_ uint32 + name string + namespace string + roleARN string +} + +// NewOperatorIAMRole creates a new builder of 'operator_IAM_role' objects. +func NewOperatorIAMRole() *OperatorIAMRoleBuilder { + return &OperatorIAMRoleBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *OperatorIAMRoleBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *OperatorIAMRoleBuilder) Name(value string) *OperatorIAMRoleBuilder { + b.name = value + b.bitmap_ |= 1 + return b +} + +// Namespace sets the value of the 'namespace' attribute to the given value. +func (b *OperatorIAMRoleBuilder) Namespace(value string) *OperatorIAMRoleBuilder { + b.namespace = value + b.bitmap_ |= 2 + return b +} + +// RoleARN sets the value of the 'role_ARN' attribute to the given value. +func (b *OperatorIAMRoleBuilder) RoleARN(value string) *OperatorIAMRoleBuilder { + b.roleARN = value + b.bitmap_ |= 4 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *OperatorIAMRoleBuilder) Copy(object *OperatorIAMRole) *OperatorIAMRoleBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.name = object.name + b.namespace = object.namespace + b.roleARN = object.roleARN + return b +} + +// Build creates a 'operator_IAM_role' object using the configuration stored in the builder. +func (b *OperatorIAMRoleBuilder) Build() (object *OperatorIAMRole, err error) { + object = new(OperatorIAMRole) + object.bitmap_ = b.bitmap_ + object.name = b.name + object.namespace = b.namespace + object.roleARN = b.roleARN + return +} diff --git a/clientapi/servicemgmt/v1/operator_iam_role_list_builder.go b/clientapi/servicemgmt/v1/operator_iam_role_list_builder.go new file mode 100644 index 00000000..66128def --- /dev/null +++ b/clientapi/servicemgmt/v1/operator_iam_role_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// OperatorIAMRoleListBuilder contains the data and logic needed to build +// 'operator_IAM_role' objects. +type OperatorIAMRoleListBuilder struct { + items []*OperatorIAMRoleBuilder +} + +// NewOperatorIAMRoleList creates a new builder of 'operator_IAM_role' objects. +func NewOperatorIAMRoleList() *OperatorIAMRoleListBuilder { + return new(OperatorIAMRoleListBuilder) +} + +// Items sets the items of the list. +func (b *OperatorIAMRoleListBuilder) Items(values ...*OperatorIAMRoleBuilder) *OperatorIAMRoleListBuilder { + b.items = make([]*OperatorIAMRoleBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *OperatorIAMRoleListBuilder) 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 *OperatorIAMRoleListBuilder) Copy(list *OperatorIAMRoleList) *OperatorIAMRoleListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*OperatorIAMRoleBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewOperatorIAMRole().Copy(v) + } + } + return b +} + +// Build creates a list of 'operator_IAM_role' objects using the +// configuration stored in the builder. +func (b *OperatorIAMRoleListBuilder) Build() (list *OperatorIAMRoleList, err error) { + items := make([]*OperatorIAMRole, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(OperatorIAMRoleList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/operator_iam_role_list_type_json.go b/clientapi/servicemgmt/v1/operator_iam_role_list_type_json.go new file mode 100644 index 00000000..e34547ba --- /dev/null +++ b/clientapi/servicemgmt/v1/operator_iam_role_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOperatorIAMRoleList writes a list of values of the 'operator_IAM_role' type to +// the given writer. +func MarshalOperatorIAMRoleList(list []*OperatorIAMRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOperatorIAMRoleList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOperatorIAMRoleList writes a list of value of the 'operator_IAM_role' type to +// the given stream. +func WriteOperatorIAMRoleList(list []*OperatorIAMRole, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteOperatorIAMRole(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalOperatorIAMRoleList reads a list of values of the 'operator_IAM_role' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalOperatorIAMRoleList(source interface{}) (items []*OperatorIAMRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadOperatorIAMRoleList(iterator) + err = iterator.Error + return +} + +// ReadOperatorIAMRoleList reads list of values of the ”operator_IAM_role' type from +// the given iterator. +func ReadOperatorIAMRoleList(iterator *jsoniter.Iterator) []*OperatorIAMRole { + list := []*OperatorIAMRole{} + for iterator.ReadArray() { + item := ReadOperatorIAMRole(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/operator_iam_role_type.go b/clientapi/servicemgmt/v1/operator_iam_role_type.go new file mode 100644 index 00000000..61a83b16 --- /dev/null +++ b/clientapi/servicemgmt/v1/operator_iam_role_type.go @@ -0,0 +1,213 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// OperatorIAMRole represents the values of the 'operator_IAM_role' type. +// +// Contains the necessary attributes to allow each operator to access the necessary AWS resources +type OperatorIAMRole struct { + bitmap_ uint32 + name string + namespace string + roleARN string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *OperatorIAMRole) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the operator +func (o *OperatorIAMRole) Name() string { + if o != nil && o.bitmap_&1 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the operator +func (o *OperatorIAMRole) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.name + } + return +} + +// Namespace returns the value of the 'namespace' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Namespace where the operator lives in the cluster +func (o *OperatorIAMRole) Namespace() string { + if o != nil && o.bitmap_&2 != 0 { + return o.namespace + } + return "" +} + +// GetNamespace returns the value of the 'namespace' attribute and +// a flag indicating if the attribute has a value. +// +// Namespace where the operator lives in the cluster +func (o *OperatorIAMRole) GetNamespace() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.namespace + } + return +} + +// RoleARN returns the value of the 'role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Role to assume when accessing AWS resources +func (o *OperatorIAMRole) RoleARN() string { + if o != nil && o.bitmap_&4 != 0 { + return o.roleARN + } + return "" +} + +// GetRoleARN returns the value of the 'role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// Role to assume when accessing AWS resources +func (o *OperatorIAMRole) GetRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.roleARN + } + return +} + +// OperatorIAMRoleListKind is the name of the type used to represent list of objects of +// type 'operator_IAM_role'. +const OperatorIAMRoleListKind = "OperatorIAMRoleList" + +// OperatorIAMRoleListLinkKind is the name of the type used to represent links to list +// of objects of type 'operator_IAM_role'. +const OperatorIAMRoleListLinkKind = "OperatorIAMRoleListLink" + +// OperatorIAMRoleNilKind is the name of the type used to nil lists of objects of +// type 'operator_IAM_role'. +const OperatorIAMRoleListNilKind = "OperatorIAMRoleListNil" + +// OperatorIAMRoleList is a list of values of the 'operator_IAM_role' type. +type OperatorIAMRoleList struct { + href string + link bool + items []*OperatorIAMRole +} + +// Len returns the length of the list. +func (l *OperatorIAMRoleList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *OperatorIAMRoleList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *OperatorIAMRoleList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *OperatorIAMRoleList) SetItems(items []*OperatorIAMRole) { + l.items = items +} + +// Items returns the items of the list. +func (l *OperatorIAMRoleList) Items() []*OperatorIAMRole { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *OperatorIAMRoleList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *OperatorIAMRoleList) Get(i int) *OperatorIAMRole { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *OperatorIAMRoleList) Slice() []*OperatorIAMRole { + var slice []*OperatorIAMRole + if l == nil { + slice = make([]*OperatorIAMRole, 0) + } else { + slice = make([]*OperatorIAMRole, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *OperatorIAMRoleList) Each(f func(item *OperatorIAMRole) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *OperatorIAMRoleList) Range(f func(index int, item *OperatorIAMRole) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/operator_iam_role_type_json.go b/clientapi/servicemgmt/v1/operator_iam_role_type_json.go new file mode 100644 index 00000000..c4ca78a3 --- /dev/null +++ b/clientapi/servicemgmt/v1/operator_iam_role_type_json.go @@ -0,0 +1,112 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOperatorIAMRole writes a value of the 'operator_IAM_role' type to the given writer. +func MarshalOperatorIAMRole(object *OperatorIAMRole, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOperatorIAMRole(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOperatorIAMRole writes a value of the 'operator_IAM_role' type to the given stream. +func WriteOperatorIAMRole(object *OperatorIAMRole, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("namespace") + stream.WriteString(object.namespace) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role_arn") + stream.WriteString(object.roleARN) + } + stream.WriteObjectEnd() +} + +// UnmarshalOperatorIAMRole reads a value of the 'operator_IAM_role' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalOperatorIAMRole(source interface{}) (object *OperatorIAMRole, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadOperatorIAMRole(iterator) + err = iterator.Error + return +} + +// ReadOperatorIAMRole reads a value of the 'operator_IAM_role' type from the given iterator. +func ReadOperatorIAMRole(iterator *jsoniter.Iterator) *OperatorIAMRole { + object := &OperatorIAMRole{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 1 + case "namespace": + value := iterator.ReadString() + object.namespace = value + object.bitmap_ |= 2 + case "role_arn": + value := iterator.ReadString() + object.roleARN = value + object.bitmap_ |= 4 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/service_parameter_builder.go b/clientapi/servicemgmt/v1/service_parameter_builder.go new file mode 100644 index 00000000..ed8f6503 --- /dev/null +++ b/clientapi/servicemgmt/v1/service_parameter_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// ServiceParameterBuilder contains the data and logic needed to build 'service_parameter' objects. +type ServiceParameterBuilder struct { + bitmap_ uint32 + id string + value string +} + +// NewServiceParameter creates a new builder of 'service_parameter' objects. +func NewServiceParameter() *ServiceParameterBuilder { + return &ServiceParameterBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ServiceParameterBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *ServiceParameterBuilder) ID(value string) *ServiceParameterBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// Value sets the value of the 'value' attribute to the given value. +func (b *ServiceParameterBuilder) Value(value string) *ServiceParameterBuilder { + b.value = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ServiceParameterBuilder) Copy(object *ServiceParameter) *ServiceParameterBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.value = object.value + return b +} + +// Build creates a 'service_parameter' object using the configuration stored in the builder. +func (b *ServiceParameterBuilder) Build() (object *ServiceParameter, err error) { + object = new(ServiceParameter) + object.bitmap_ = b.bitmap_ + object.id = b.id + object.value = b.value + return +} diff --git a/clientapi/servicemgmt/v1/service_parameter_list_builder.go b/clientapi/servicemgmt/v1/service_parameter_list_builder.go new file mode 100644 index 00000000..5d18e568 --- /dev/null +++ b/clientapi/servicemgmt/v1/service_parameter_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// ServiceParameterListBuilder contains the data and logic needed to build +// 'service_parameter' objects. +type ServiceParameterListBuilder struct { + items []*ServiceParameterBuilder +} + +// NewServiceParameterList creates a new builder of 'service_parameter' objects. +func NewServiceParameterList() *ServiceParameterListBuilder { + return new(ServiceParameterListBuilder) +} + +// Items sets the items of the list. +func (b *ServiceParameterListBuilder) Items(values ...*ServiceParameterBuilder) *ServiceParameterListBuilder { + b.items = make([]*ServiceParameterBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ServiceParameterListBuilder) 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 *ServiceParameterListBuilder) Copy(list *ServiceParameterList) *ServiceParameterListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ServiceParameterBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewServiceParameter().Copy(v) + } + } + return b +} + +// Build creates a list of 'service_parameter' objects using the +// configuration stored in the builder. +func (b *ServiceParameterListBuilder) Build() (list *ServiceParameterList, err error) { + items := make([]*ServiceParameter, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ServiceParameterList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/service_parameter_list_type_json.go b/clientapi/servicemgmt/v1/service_parameter_list_type_json.go new file mode 100644 index 00000000..413f5d5e --- /dev/null +++ b/clientapi/servicemgmt/v1/service_parameter_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalServiceParameterList writes a list of values of the 'service_parameter' type to +// the given writer. +func MarshalServiceParameterList(list []*ServiceParameter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServiceParameterList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServiceParameterList writes a list of value of the 'service_parameter' type to +// the given stream. +func WriteServiceParameterList(list []*ServiceParameter, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteServiceParameter(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalServiceParameterList reads a list of values of the 'service_parameter' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalServiceParameterList(source interface{}) (items []*ServiceParameter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadServiceParameterList(iterator) + err = iterator.Error + return +} + +// ReadServiceParameterList reads list of values of the ”service_parameter' type from +// the given iterator. +func ReadServiceParameterList(iterator *jsoniter.Iterator) []*ServiceParameter { + list := []*ServiceParameter{} + for iterator.ReadArray() { + item := ReadServiceParameter(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/service_parameter_type.go b/clientapi/servicemgmt/v1/service_parameter_type.go new file mode 100644 index 00000000..4aebe991 --- /dev/null +++ b/clientapi/servicemgmt/v1/service_parameter_type.go @@ -0,0 +1,187 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// ServiceParameter represents the values of the 'service_parameter' type. +type ServiceParameter struct { + bitmap_ uint32 + id string + value string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ServiceParameter) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Name of the parameter +func (o *ServiceParameter) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +// +// Name of the parameter +func (o *ServiceParameter) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// Value returns the value of the 'value' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Value of the parameter +func (o *ServiceParameter) Value() string { + if o != nil && o.bitmap_&2 != 0 { + return o.value + } + return "" +} + +// GetValue returns the value of the 'value' attribute and +// a flag indicating if the attribute has a value. +// +// Value of the parameter +func (o *ServiceParameter) GetValue() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.value + } + return +} + +// ServiceParameterListKind is the name of the type used to represent list of objects of +// type 'service_parameter'. +const ServiceParameterListKind = "ServiceParameterList" + +// ServiceParameterListLinkKind is the name of the type used to represent links to list +// of objects of type 'service_parameter'. +const ServiceParameterListLinkKind = "ServiceParameterListLink" + +// ServiceParameterNilKind is the name of the type used to nil lists of objects of +// type 'service_parameter'. +const ServiceParameterListNilKind = "ServiceParameterListNil" + +// ServiceParameterList is a list of values of the 'service_parameter' type. +type ServiceParameterList struct { + href string + link bool + items []*ServiceParameter +} + +// Len returns the length of the list. +func (l *ServiceParameterList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ServiceParameterList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ServiceParameterList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ServiceParameterList) SetItems(items []*ServiceParameter) { + l.items = items +} + +// Items returns the items of the list. +func (l *ServiceParameterList) Items() []*ServiceParameter { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ServiceParameterList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ServiceParameterList) Get(i int) *ServiceParameter { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ServiceParameterList) Slice() []*ServiceParameter { + var slice []*ServiceParameter + if l == nil { + slice = make([]*ServiceParameter, 0) + } else { + slice = make([]*ServiceParameter, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ServiceParameterList) Each(f func(item *ServiceParameter) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ServiceParameterList) Range(f func(index int, item *ServiceParameter) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/service_parameter_type_json.go b/clientapi/servicemgmt/v1/service_parameter_type_json.go new file mode 100644 index 00000000..30530a43 --- /dev/null +++ b/clientapi/servicemgmt/v1/service_parameter_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalServiceParameter writes a value of the 'service_parameter' type to the given writer. +func MarshalServiceParameter(object *ServiceParameter, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServiceParameter(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServiceParameter writes a value of the 'service_parameter' type to the given stream. +func WriteServiceParameter(object *ServiceParameter, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("value") + stream.WriteString(object.value) + } + stream.WriteObjectEnd() +} + +// UnmarshalServiceParameter reads a value of the 'service_parameter' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalServiceParameter(source interface{}) (object *ServiceParameter, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadServiceParameter(iterator) + err = iterator.Error + return +} + +// ReadServiceParameter reads a value of the 'service_parameter' type from the given iterator. +func ReadServiceParameter(iterator *jsoniter.Iterator) *ServiceParameter { + object := &ServiceParameter{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "value": + value := iterator.ReadString() + object.value = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/stateful_object_builder.go b/clientapi/servicemgmt/v1/stateful_object_builder.go new file mode 100644 index 00000000..e84b1bd0 --- /dev/null +++ b/clientapi/servicemgmt/v1/stateful_object_builder.go @@ -0,0 +1,91 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// StatefulObjectBuilder contains the data and logic needed to build 'stateful_object' objects. +type StatefulObjectBuilder struct { + bitmap_ uint32 + id string + href string + kind string + state string +} + +// NewStatefulObject creates a new builder of 'stateful_object' objects. +func NewStatefulObject() *StatefulObjectBuilder { + return &StatefulObjectBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *StatefulObjectBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ID sets the value of the 'ID' attribute to the given value. +func (b *StatefulObjectBuilder) ID(value string) *StatefulObjectBuilder { + b.id = value + b.bitmap_ |= 1 + return b +} + +// Href sets the value of the 'href' attribute to the given value. +func (b *StatefulObjectBuilder) Href(value string) *StatefulObjectBuilder { + b.href = value + b.bitmap_ |= 2 + return b +} + +// Kind sets the value of the 'kind' attribute to the given value. +func (b *StatefulObjectBuilder) Kind(value string) *StatefulObjectBuilder { + b.kind = value + b.bitmap_ |= 4 + return b +} + +// State sets the value of the 'state' attribute to the given value. +func (b *StatefulObjectBuilder) State(value string) *StatefulObjectBuilder { + b.state = value + b.bitmap_ |= 8 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *StatefulObjectBuilder) Copy(object *StatefulObject) *StatefulObjectBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.kind = object.kind + b.state = object.state + return b +} + +// Build creates a 'stateful_object' object using the configuration stored in the builder. +func (b *StatefulObjectBuilder) Build() (object *StatefulObject, err error) { + object = new(StatefulObject) + object.bitmap_ = b.bitmap_ + object.id = b.id + object.href = b.href + object.kind = b.kind + object.state = b.state + return +} diff --git a/clientapi/servicemgmt/v1/stateful_object_list_builder.go b/clientapi/servicemgmt/v1/stateful_object_list_builder.go new file mode 100644 index 00000000..59cf5caa --- /dev/null +++ b/clientapi/servicemgmt/v1/stateful_object_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// StatefulObjectListBuilder contains the data and logic needed to build +// 'stateful_object' objects. +type StatefulObjectListBuilder struct { + items []*StatefulObjectBuilder +} + +// NewStatefulObjectList creates a new builder of 'stateful_object' objects. +func NewStatefulObjectList() *StatefulObjectListBuilder { + return new(StatefulObjectListBuilder) +} + +// Items sets the items of the list. +func (b *StatefulObjectListBuilder) Items(values ...*StatefulObjectBuilder) *StatefulObjectListBuilder { + b.items = make([]*StatefulObjectBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *StatefulObjectListBuilder) 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 *StatefulObjectListBuilder) Copy(list *StatefulObjectList) *StatefulObjectListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*StatefulObjectBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewStatefulObject().Copy(v) + } + } + return b +} + +// Build creates a list of 'stateful_object' objects using the +// configuration stored in the builder. +func (b *StatefulObjectListBuilder) Build() (list *StatefulObjectList, err error) { + items := make([]*StatefulObject, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(StatefulObjectList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/stateful_object_list_type_json.go b/clientapi/servicemgmt/v1/stateful_object_list_type_json.go new file mode 100644 index 00000000..d541d15c --- /dev/null +++ b/clientapi/servicemgmt/v1/stateful_object_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStatefulObjectList writes a list of values of the 'stateful_object' type to +// the given writer. +func MarshalStatefulObjectList(list []*StatefulObject, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStatefulObjectList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStatefulObjectList writes a list of value of the 'stateful_object' type to +// the given stream. +func WriteStatefulObjectList(list []*StatefulObject, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteStatefulObject(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalStatefulObjectList reads a list of values of the 'stateful_object' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStatefulObjectList(source interface{}) (items []*StatefulObject, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStatefulObjectList(iterator) + err = iterator.Error + return +} + +// ReadStatefulObjectList reads list of values of the ”stateful_object' type from +// the given iterator. +func ReadStatefulObjectList(iterator *jsoniter.Iterator) []*StatefulObject { + list := []*StatefulObject{} + for iterator.ReadArray() { + item := ReadStatefulObject(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/stateful_object_type.go b/clientapi/servicemgmt/v1/stateful_object_type.go new file mode 100644 index 00000000..1c25d330 --- /dev/null +++ b/clientapi/servicemgmt/v1/stateful_object_type.go @@ -0,0 +1,219 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// StatefulObject represents the values of the 'stateful_object' type. +type StatefulObject struct { + bitmap_ uint32 + id string + href string + kind string + state string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *StatefulObject) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ID returns the value of the 'ID' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *StatefulObject) ID() string { + if o != nil && o.bitmap_&1 != 0 { + return o.id + } + return "" +} + +// GetID returns the value of the 'ID' attribute and +// a flag indicating if the attribute has a value. +func (o *StatefulObject) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.id + } + return +} + +// Href returns the value of the 'href' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *StatefulObject) Href() string { + if o != nil && o.bitmap_&2 != 0 { + return o.href + } + return "" +} + +// GetHref returns the value of the 'href' attribute and +// a flag indicating if the attribute has a value. +func (o *StatefulObject) GetHref() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.href + } + return +} + +// Kind returns the value of the 'kind' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *StatefulObject) Kind() string { + if o != nil && o.bitmap_&4 != 0 { + return o.kind + } + return "" +} + +// GetKind returns the value of the 'kind' attribute and +// a flag indicating if the attribute has a value. +func (o *StatefulObject) GetKind() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.kind + } + return +} + +// State returns the value of the 'state' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *StatefulObject) State() string { + if o != nil && o.bitmap_&8 != 0 { + return o.state + } + return "" +} + +// GetState returns the value of the 'state' attribute and +// a flag indicating if the attribute has a value. +func (o *StatefulObject) GetState() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.state + } + return +} + +// StatefulObjectListKind is the name of the type used to represent list of objects of +// type 'stateful_object'. +const StatefulObjectListKind = "StatefulObjectList" + +// StatefulObjectListLinkKind is the name of the type used to represent links to list +// of objects of type 'stateful_object'. +const StatefulObjectListLinkKind = "StatefulObjectListLink" + +// StatefulObjectNilKind is the name of the type used to nil lists of objects of +// type 'stateful_object'. +const StatefulObjectListNilKind = "StatefulObjectListNil" + +// StatefulObjectList is a list of values of the 'stateful_object' type. +type StatefulObjectList struct { + href string + link bool + items []*StatefulObject +} + +// Len returns the length of the list. +func (l *StatefulObjectList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *StatefulObjectList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *StatefulObjectList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *StatefulObjectList) SetItems(items []*StatefulObject) { + l.items = items +} + +// Items returns the items of the list. +func (l *StatefulObjectList) Items() []*StatefulObject { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *StatefulObjectList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *StatefulObjectList) Get(i int) *StatefulObject { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *StatefulObjectList) Slice() []*StatefulObject { + var slice []*StatefulObject + if l == nil { + slice = make([]*StatefulObject, 0) + } else { + slice = make([]*StatefulObject, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *StatefulObjectList) Each(f func(item *StatefulObject) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *StatefulObjectList) Range(f func(index int, item *StatefulObject) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/stateful_object_type_json.go b/clientapi/servicemgmt/v1/stateful_object_type_json.go new file mode 100644 index 00000000..d377cea6 --- /dev/null +++ b/clientapi/servicemgmt/v1/stateful_object_type_json.go @@ -0,0 +1,125 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStatefulObject writes a value of the 'stateful_object' type to the given writer. +func MarshalStatefulObject(object *StatefulObject, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStatefulObject(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStatefulObject writes a value of the 'stateful_object' type to the given stream. +func WriteStatefulObject(object *StatefulObject, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + present_ = object.bitmap_&4 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("kind") + stream.WriteString(object.kind) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("state") + stream.WriteString(object.state) + } + stream.WriteObjectEnd() +} + +// UnmarshalStatefulObject reads a value of the 'stateful_object' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalStatefulObject(source interface{}) (object *StatefulObject, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadStatefulObject(iterator) + err = iterator.Error + return +} + +// ReadStatefulObject reads a value of the 'stateful_object' type from the given iterator. +func ReadStatefulObject(iterator *jsoniter.Iterator) *StatefulObject { + object := &StatefulObject{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "id": + value := iterator.ReadString() + object.id = value + object.bitmap_ |= 1 + case "href": + value := iterator.ReadString() + object.href = value + object.bitmap_ |= 2 + case "kind": + value := iterator.ReadString() + object.kind = value + object.bitmap_ |= 4 + case "state": + value := iterator.ReadString() + object.state = value + object.bitmap_ |= 8 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/string_list_type_json.go b/clientapi/servicemgmt/v1/string_list_type_json.go new file mode 100644 index 00000000..a0f15a8a --- /dev/null +++ b/clientapi/servicemgmt/v1/string_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStringList writes a list of values of the 'string' type to +// the given writer. +func MarshalStringList(list []string, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStringList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStringList writes a list of value of the 'string' type to +// the given stream. +func WriteStringList(list []string, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalStringList reads a list of values of the 'string' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStringList(source interface{}) (items []string, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStringList(iterator) + err = iterator.Error + return +} + +// ReadStringList reads list of values of the ”string' type from +// the given iterator. +func ReadStringList(iterator *jsoniter.Iterator) []string { + list := []string{} + for iterator.ReadArray() { + item := iterator.ReadString() + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/sts_builder.go b/clientapi/servicemgmt/v1/sts_builder.go new file mode 100644 index 00000000..186fdcf4 --- /dev/null +++ b/clientapi/servicemgmt/v1/sts_builder.go @@ -0,0 +1,144 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// STSBuilder contains the data and logic needed to build 'STS' objects. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type STSBuilder struct { + bitmap_ uint32 + oidcEndpointURL string + instanceIAMRoles *InstanceIAMRolesBuilder + operatorIAMRoles []*OperatorIAMRoleBuilder + operatorRolePrefix string + roleARN string + supportRoleARN string +} + +// NewSTS creates a new builder of 'STS' objects. +func NewSTS() *STSBuilder { + return &STSBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *STSBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// OIDCEndpointURL sets the value of the 'OIDC_endpoint_URL' attribute to the given value. +func (b *STSBuilder) OIDCEndpointURL(value string) *STSBuilder { + b.oidcEndpointURL = value + b.bitmap_ |= 1 + return b +} + +// InstanceIAMRoles sets the value of the 'instance_IAM_roles' attribute to the given value. +// +// Contains the necessary attributes to support role-based authentication on AWS. +func (b *STSBuilder) InstanceIAMRoles(value *InstanceIAMRolesBuilder) *STSBuilder { + b.instanceIAMRoles = value + if value != nil { + b.bitmap_ |= 2 + } else { + b.bitmap_ &^= 2 + } + return b +} + +// OperatorIAMRoles sets the value of the 'operator_IAM_roles' attribute to the given values. +func (b *STSBuilder) OperatorIAMRoles(values ...*OperatorIAMRoleBuilder) *STSBuilder { + b.operatorIAMRoles = make([]*OperatorIAMRoleBuilder, len(values)) + copy(b.operatorIAMRoles, values) + b.bitmap_ |= 4 + return b +} + +// OperatorRolePrefix sets the value of the 'operator_role_prefix' attribute to the given value. +func (b *STSBuilder) OperatorRolePrefix(value string) *STSBuilder { + b.operatorRolePrefix = value + b.bitmap_ |= 8 + return b +} + +// RoleARN sets the value of the 'role_ARN' attribute to the given value. +func (b *STSBuilder) RoleARN(value string) *STSBuilder { + b.roleARN = value + b.bitmap_ |= 16 + return b +} + +// SupportRoleARN sets the value of the 'support_role_ARN' attribute to the given value. +func (b *STSBuilder) SupportRoleARN(value string) *STSBuilder { + b.supportRoleARN = value + b.bitmap_ |= 32 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *STSBuilder) Copy(object *STS) *STSBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.oidcEndpointURL = object.oidcEndpointURL + if object.instanceIAMRoles != nil { + b.instanceIAMRoles = NewInstanceIAMRoles().Copy(object.instanceIAMRoles) + } else { + b.instanceIAMRoles = nil + } + if object.operatorIAMRoles != nil { + b.operatorIAMRoles = make([]*OperatorIAMRoleBuilder, len(object.operatorIAMRoles)) + for i, v := range object.operatorIAMRoles { + b.operatorIAMRoles[i] = NewOperatorIAMRole().Copy(v) + } + } else { + b.operatorIAMRoles = nil + } + b.operatorRolePrefix = object.operatorRolePrefix + b.roleARN = object.roleARN + b.supportRoleARN = object.supportRoleARN + return b +} + +// Build creates a 'STS' object using the configuration stored in the builder. +func (b *STSBuilder) Build() (object *STS, err error) { + object = new(STS) + object.bitmap_ = b.bitmap_ + object.oidcEndpointURL = b.oidcEndpointURL + if b.instanceIAMRoles != nil { + object.instanceIAMRoles, err = b.instanceIAMRoles.Build() + if err != nil { + return + } + } + if b.operatorIAMRoles != nil { + object.operatorIAMRoles = make([]*OperatorIAMRole, len(b.operatorIAMRoles)) + for i, v := range b.operatorIAMRoles { + object.operatorIAMRoles[i], err = v.Build() + if err != nil { + return + } + } + } + object.operatorRolePrefix = b.operatorRolePrefix + object.roleARN = b.roleARN + object.supportRoleARN = b.supportRoleARN + return +} diff --git a/clientapi/servicemgmt/v1/sts_list_builder.go b/clientapi/servicemgmt/v1/sts_list_builder.go new file mode 100644 index 00000000..e813b954 --- /dev/null +++ b/clientapi/servicemgmt/v1/sts_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// STSListBuilder contains the data and logic needed to build +// 'STS' objects. +type STSListBuilder struct { + items []*STSBuilder +} + +// NewSTSList creates a new builder of 'STS' objects. +func NewSTSList() *STSListBuilder { + return new(STSListBuilder) +} + +// Items sets the items of the list. +func (b *STSListBuilder) Items(values ...*STSBuilder) *STSListBuilder { + b.items = make([]*STSBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *STSListBuilder) 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 *STSListBuilder) Copy(list *STSList) *STSListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*STSBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewSTS().Copy(v) + } + } + return b +} + +// Build creates a list of 'STS' objects using the +// configuration stored in the builder. +func (b *STSListBuilder) Build() (list *STSList, err error) { + items := make([]*STS, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(STSList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/sts_list_type_json.go b/clientapi/servicemgmt/v1/sts_list_type_json.go new file mode 100644 index 00000000..0c1fc8fd --- /dev/null +++ b/clientapi/servicemgmt/v1/sts_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSTSList writes a list of values of the 'STS' type to +// the given writer. +func MarshalSTSList(list []*STS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSTSList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSTSList writes a list of value of the 'STS' type to +// the given stream. +func WriteSTSList(list []*STS, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteSTS(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalSTSList reads a list of values of the 'STS' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalSTSList(source interface{}) (items []*STS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadSTSList(iterator) + err = iterator.Error + return +} + +// ReadSTSList reads list of values of the ”STS' type from +// the given iterator. +func ReadSTSList(iterator *jsoniter.Iterator) []*STS { + list := []*STS{} + for iterator.ReadArray() { + item := ReadSTS(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/sts_type.go b/clientapi/servicemgmt/v1/sts_type.go new file mode 100644 index 00000000..2ae3a81d --- /dev/null +++ b/clientapi/servicemgmt/v1/sts_type.go @@ -0,0 +1,281 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// STS represents the values of the 'STS' type. +// +// Contains the necessary attributes to support role-based authentication on AWS. +type STS struct { + bitmap_ uint32 + oidcEndpointURL string + instanceIAMRoles *InstanceIAMRoles + operatorIAMRoles []*OperatorIAMRole + operatorRolePrefix string + roleARN string + supportRoleARN string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *STS) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// OIDCEndpointURL returns the value of the 'OIDC_endpoint_URL' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// URL of the location where OIDC configuration and keys are available +func (o *STS) OIDCEndpointURL() string { + if o != nil && o.bitmap_&1 != 0 { + return o.oidcEndpointURL + } + return "" +} + +// GetOIDCEndpointURL returns the value of the 'OIDC_endpoint_URL' attribute and +// a flag indicating if the attribute has a value. +// +// URL of the location where OIDC configuration and keys are available +func (o *STS) GetOIDCEndpointURL() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.oidcEndpointURL + } + return +} + +// InstanceIAMRoles returns the value of the 'instance_IAM_roles' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Instance IAM roles to use for the instance profiles of the master and worker instances +func (o *STS) InstanceIAMRoles() *InstanceIAMRoles { + if o != nil && o.bitmap_&2 != 0 { + return o.instanceIAMRoles + } + return nil +} + +// GetInstanceIAMRoles returns the value of the 'instance_IAM_roles' attribute and +// a flag indicating if the attribute has a value. +// +// Instance IAM roles to use for the instance profiles of the master and worker instances +func (o *STS) GetInstanceIAMRoles() (value *InstanceIAMRoles, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.instanceIAMRoles + } + return +} + +// OperatorIAMRoles returns the value of the 'operator_IAM_roles' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// List of roles necessary to access the AWS resources of the various operators used during installation +func (o *STS) OperatorIAMRoles() []*OperatorIAMRole { + if o != nil && o.bitmap_&4 != 0 { + return o.operatorIAMRoles + } + return nil +} + +// GetOperatorIAMRoles returns the value of the 'operator_IAM_roles' attribute and +// a flag indicating if the attribute has a value. +// +// List of roles necessary to access the AWS resources of the various operators used during installation +func (o *STS) GetOperatorIAMRoles() (value []*OperatorIAMRole, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.operatorIAMRoles + } + return +} + +// OperatorRolePrefix returns the value of the 'operator_role_prefix' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *STS) OperatorRolePrefix() string { + if o != nil && o.bitmap_&8 != 0 { + return o.operatorRolePrefix + } + return "" +} + +// GetOperatorRolePrefix returns the value of the 'operator_role_prefix' attribute and +// a flag indicating if the attribute has a value. +func (o *STS) GetOperatorRolePrefix() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.operatorRolePrefix + } + return +} + +// RoleARN returns the value of the 'role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN of the AWS role to assume when installing the cluster +func (o *STS) RoleARN() string { + if o != nil && o.bitmap_&16 != 0 { + return o.roleARN + } + return "" +} + +// GetRoleARN returns the value of the 'role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// ARN of the AWS role to assume when installing the cluster +func (o *STS) GetRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.roleARN + } + return +} + +// SupportRoleARN returns the value of the 'support_role_ARN' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// ARN of the AWS role used by SREs to access the cluster AWS account in order to provide support +func (o *STS) SupportRoleARN() string { + if o != nil && o.bitmap_&32 != 0 { + return o.supportRoleARN + } + return "" +} + +// GetSupportRoleARN returns the value of the 'support_role_ARN' attribute and +// a flag indicating if the attribute has a value. +// +// ARN of the AWS role used by SREs to access the cluster AWS account in order to provide support +func (o *STS) GetSupportRoleARN() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.supportRoleARN + } + return +} + +// STSListKind is the name of the type used to represent list of objects of +// type 'STS'. +const STSListKind = "STSList" + +// STSListLinkKind is the name of the type used to represent links to list +// of objects of type 'STS'. +const STSListLinkKind = "STSListLink" + +// STSNilKind is the name of the type used to nil lists of objects of +// type 'STS'. +const STSListNilKind = "STSListNil" + +// STSList is a list of values of the 'STS' type. +type STSList struct { + href string + link bool + items []*STS +} + +// Len returns the length of the list. +func (l *STSList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *STSList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *STSList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *STSList) SetItems(items []*STS) { + l.items = items +} + +// Items returns the items of the list. +func (l *STSList) Items() []*STS { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *STSList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *STSList) Get(i int) *STS { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *STSList) Slice() []*STS { + var slice []*STS + if l == nil { + slice = make([]*STS, 0) + } else { + slice = make([]*STS, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *STSList) Each(f func(item *STS) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *STSList) Range(f func(index int, item *STS) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/sts_type_json.go b/clientapi/servicemgmt/v1/sts_type_json.go new file mode 100644 index 00000000..72e6f07d --- /dev/null +++ b/clientapi/servicemgmt/v1/sts_type_json.go @@ -0,0 +1,151 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalSTS writes a value of the 'STS' type to the given writer. +func MarshalSTS(object *STS, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteSTS(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteSTS writes a value of the 'STS' type to the given stream. +func WriteSTS(object *STS, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("oidc_endpoint_url") + stream.WriteString(object.oidcEndpointURL) + count++ + } + present_ = object.bitmap_&2 != 0 && object.instanceIAMRoles != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("instance_iam_roles") + WriteInstanceIAMRoles(object.instanceIAMRoles, stream) + count++ + } + present_ = object.bitmap_&4 != 0 && object.operatorIAMRoles != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_iam_roles") + WriteOperatorIAMRoleList(object.operatorIAMRoles, stream) + count++ + } + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("operator_role_prefix") + stream.WriteString(object.operatorRolePrefix) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("role_arn") + stream.WriteString(object.roleARN) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("support_role_arn") + stream.WriteString(object.supportRoleARN) + } + stream.WriteObjectEnd() +} + +// UnmarshalSTS reads a value of the 'STS' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalSTS(source interface{}) (object *STS, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadSTS(iterator) + err = iterator.Error + return +} + +// ReadSTS reads a value of the 'STS' type from the given iterator. +func ReadSTS(iterator *jsoniter.Iterator) *STS { + object := &STS{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "oidc_endpoint_url": + value := iterator.ReadString() + object.oidcEndpointURL = value + object.bitmap_ |= 1 + case "instance_iam_roles": + value := ReadInstanceIAMRoles(iterator) + object.instanceIAMRoles = value + object.bitmap_ |= 2 + case "operator_iam_roles": + value := ReadOperatorIAMRoleList(iterator) + object.operatorIAMRoles = value + object.bitmap_ |= 4 + case "operator_role_prefix": + value := iterator.ReadString() + object.operatorRolePrefix = value + object.bitmap_ |= 8 + case "role_arn": + value := iterator.ReadString() + object.roleARN = value + object.bitmap_ |= 16 + case "support_role_arn": + value := iterator.ReadString() + object.supportRoleARN = value + object.bitmap_ |= 32 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/version_inquiry_request_builder.go b/clientapi/servicemgmt/v1/version_inquiry_request_builder.go new file mode 100644 index 00000000..b5f37554 --- /dev/null +++ b/clientapi/servicemgmt/v1/version_inquiry_request_builder.go @@ -0,0 +1,61 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// VersionInquiryRequestBuilder contains the data and logic needed to build 'version_inquiry_request' objects. +type VersionInquiryRequestBuilder struct { + bitmap_ uint32 + serviceType string +} + +// NewVersionInquiryRequest creates a new builder of 'version_inquiry_request' objects. +func NewVersionInquiryRequest() *VersionInquiryRequestBuilder { + return &VersionInquiryRequestBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *VersionInquiryRequestBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// ServiceType sets the value of the 'service_type' attribute to the given value. +func (b *VersionInquiryRequestBuilder) ServiceType(value string) *VersionInquiryRequestBuilder { + b.serviceType = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *VersionInquiryRequestBuilder) Copy(object *VersionInquiryRequest) *VersionInquiryRequestBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.serviceType = object.serviceType + return b +} + +// Build creates a 'version_inquiry_request' object using the configuration stored in the builder. +func (b *VersionInquiryRequestBuilder) Build() (object *VersionInquiryRequest, err error) { + object = new(VersionInquiryRequest) + object.bitmap_ = b.bitmap_ + object.serviceType = b.serviceType + return +} diff --git a/clientapi/servicemgmt/v1/version_inquiry_request_list_builder.go b/clientapi/servicemgmt/v1/version_inquiry_request_list_builder.go new file mode 100644 index 00000000..43adb902 --- /dev/null +++ b/clientapi/servicemgmt/v1/version_inquiry_request_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// VersionInquiryRequestListBuilder contains the data and logic needed to build +// 'version_inquiry_request' objects. +type VersionInquiryRequestListBuilder struct { + items []*VersionInquiryRequestBuilder +} + +// NewVersionInquiryRequestList creates a new builder of 'version_inquiry_request' objects. +func NewVersionInquiryRequestList() *VersionInquiryRequestListBuilder { + return new(VersionInquiryRequestListBuilder) +} + +// Items sets the items of the list. +func (b *VersionInquiryRequestListBuilder) Items(values ...*VersionInquiryRequestBuilder) *VersionInquiryRequestListBuilder { + b.items = make([]*VersionInquiryRequestBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *VersionInquiryRequestListBuilder) 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 *VersionInquiryRequestListBuilder) Copy(list *VersionInquiryRequestList) *VersionInquiryRequestListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*VersionInquiryRequestBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewVersionInquiryRequest().Copy(v) + } + } + return b +} + +// Build creates a list of 'version_inquiry_request' objects using the +// configuration stored in the builder. +func (b *VersionInquiryRequestListBuilder) Build() (list *VersionInquiryRequestList, err error) { + items := make([]*VersionInquiryRequest, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(VersionInquiryRequestList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/version_inquiry_request_list_type_json.go b/clientapi/servicemgmt/v1/version_inquiry_request_list_type_json.go new file mode 100644 index 00000000..9971e9c1 --- /dev/null +++ b/clientapi/servicemgmt/v1/version_inquiry_request_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalVersionInquiryRequestList writes a list of values of the 'version_inquiry_request' type to +// the given writer. +func MarshalVersionInquiryRequestList(list []*VersionInquiryRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteVersionInquiryRequestList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteVersionInquiryRequestList writes a list of value of the 'version_inquiry_request' type to +// the given stream. +func WriteVersionInquiryRequestList(list []*VersionInquiryRequest, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteVersionInquiryRequest(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalVersionInquiryRequestList reads a list of values of the 'version_inquiry_request' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalVersionInquiryRequestList(source interface{}) (items []*VersionInquiryRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadVersionInquiryRequestList(iterator) + err = iterator.Error + return +} + +// ReadVersionInquiryRequestList reads list of values of the ”version_inquiry_request' type from +// the given iterator. +func ReadVersionInquiryRequestList(iterator *jsoniter.Iterator) []*VersionInquiryRequest { + list := []*VersionInquiryRequest{} + for iterator.ReadArray() { + item := ReadVersionInquiryRequest(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/version_inquiry_request_type.go b/clientapi/servicemgmt/v1/version_inquiry_request_type.go new file mode 100644 index 00000000..99ce82c9 --- /dev/null +++ b/clientapi/servicemgmt/v1/version_inquiry_request_type.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// VersionInquiryRequest represents the values of the 'version_inquiry_request' type. +type VersionInquiryRequest struct { + bitmap_ uint32 + serviceType string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *VersionInquiryRequest) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// ServiceType returns the value of the 'service_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *VersionInquiryRequest) ServiceType() string { + if o != nil && o.bitmap_&1 != 0 { + return o.serviceType + } + return "" +} + +// GetServiceType returns the value of the 'service_type' attribute and +// a flag indicating if the attribute has a value. +func (o *VersionInquiryRequest) GetServiceType() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.serviceType + } + return +} + +// VersionInquiryRequestListKind is the name of the type used to represent list of objects of +// type 'version_inquiry_request'. +const VersionInquiryRequestListKind = "VersionInquiryRequestList" + +// VersionInquiryRequestListLinkKind is the name of the type used to represent links to list +// of objects of type 'version_inquiry_request'. +const VersionInquiryRequestListLinkKind = "VersionInquiryRequestListLink" + +// VersionInquiryRequestNilKind is the name of the type used to nil lists of objects of +// type 'version_inquiry_request'. +const VersionInquiryRequestListNilKind = "VersionInquiryRequestListNil" + +// VersionInquiryRequestList is a list of values of the 'version_inquiry_request' type. +type VersionInquiryRequestList struct { + href string + link bool + items []*VersionInquiryRequest +} + +// Len returns the length of the list. +func (l *VersionInquiryRequestList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *VersionInquiryRequestList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *VersionInquiryRequestList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *VersionInquiryRequestList) SetItems(items []*VersionInquiryRequest) { + l.items = items +} + +// Items returns the items of the list. +func (l *VersionInquiryRequestList) Items() []*VersionInquiryRequest { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *VersionInquiryRequestList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *VersionInquiryRequestList) Get(i int) *VersionInquiryRequest { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *VersionInquiryRequestList) Slice() []*VersionInquiryRequest { + var slice []*VersionInquiryRequest + if l == nil { + slice = make([]*VersionInquiryRequest, 0) + } else { + slice = make([]*VersionInquiryRequest, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *VersionInquiryRequestList) Each(f func(item *VersionInquiryRequest) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *VersionInquiryRequestList) Range(f func(index int, item *VersionInquiryRequest) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/version_inquiry_request_type_json.go b/clientapi/servicemgmt/v1/version_inquiry_request_type_json.go new file mode 100644 index 00000000..a9b3cfe7 --- /dev/null +++ b/clientapi/servicemgmt/v1/version_inquiry_request_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalVersionInquiryRequest writes a value of the 'version_inquiry_request' type to the given writer. +func MarshalVersionInquiryRequest(object *VersionInquiryRequest, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteVersionInquiryRequest(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteVersionInquiryRequest writes a value of the 'version_inquiry_request' type to the given stream. +func WriteVersionInquiryRequest(object *VersionInquiryRequest, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_type") + stream.WriteString(object.serviceType) + } + stream.WriteObjectEnd() +} + +// UnmarshalVersionInquiryRequest reads a value of the 'version_inquiry_request' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalVersionInquiryRequest(source interface{}) (object *VersionInquiryRequest, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadVersionInquiryRequest(iterator) + err = iterator.Error + return +} + +// ReadVersionInquiryRequest reads a value of the 'version_inquiry_request' type from the given iterator. +func ReadVersionInquiryRequest(iterator *jsoniter.Iterator) *VersionInquiryRequest { + object := &VersionInquiryRequest{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "service_type": + value := iterator.ReadString() + object.serviceType = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/servicemgmt/v1/version_inquiry_response_builder.go b/clientapi/servicemgmt/v1/version_inquiry_response_builder.go new file mode 100644 index 00000000..e9d54892 --- /dev/null +++ b/clientapi/servicemgmt/v1/version_inquiry_response_builder.go @@ -0,0 +1,61 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// VersionInquiryResponseBuilder contains the data and logic needed to build 'version_inquiry_response' objects. +type VersionInquiryResponseBuilder struct { + bitmap_ uint32 + version string +} + +// NewVersionInquiryResponse creates a new builder of 'version_inquiry_response' objects. +func NewVersionInquiryResponse() *VersionInquiryResponseBuilder { + return &VersionInquiryResponseBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *VersionInquiryResponseBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Version sets the value of the 'version' attribute to the given value. +func (b *VersionInquiryResponseBuilder) Version(value string) *VersionInquiryResponseBuilder { + b.version = value + b.bitmap_ |= 1 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *VersionInquiryResponseBuilder) Copy(object *VersionInquiryResponse) *VersionInquiryResponseBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.version = object.version + return b +} + +// Build creates a 'version_inquiry_response' object using the configuration stored in the builder. +func (b *VersionInquiryResponseBuilder) Build() (object *VersionInquiryResponse, err error) { + object = new(VersionInquiryResponse) + object.bitmap_ = b.bitmap_ + object.version = b.version + return +} diff --git a/clientapi/servicemgmt/v1/version_inquiry_response_list_builder.go b/clientapi/servicemgmt/v1/version_inquiry_response_list_builder.go new file mode 100644 index 00000000..668d7f9a --- /dev/null +++ b/clientapi/servicemgmt/v1/version_inquiry_response_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// VersionInquiryResponseListBuilder contains the data and logic needed to build +// 'version_inquiry_response' objects. +type VersionInquiryResponseListBuilder struct { + items []*VersionInquiryResponseBuilder +} + +// NewVersionInquiryResponseList creates a new builder of 'version_inquiry_response' objects. +func NewVersionInquiryResponseList() *VersionInquiryResponseListBuilder { + return new(VersionInquiryResponseListBuilder) +} + +// Items sets the items of the list. +func (b *VersionInquiryResponseListBuilder) Items(values ...*VersionInquiryResponseBuilder) *VersionInquiryResponseListBuilder { + b.items = make([]*VersionInquiryResponseBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *VersionInquiryResponseListBuilder) 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 *VersionInquiryResponseListBuilder) Copy(list *VersionInquiryResponseList) *VersionInquiryResponseListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*VersionInquiryResponseBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewVersionInquiryResponse().Copy(v) + } + } + return b +} + +// Build creates a list of 'version_inquiry_response' objects using the +// configuration stored in the builder. +func (b *VersionInquiryResponseListBuilder) Build() (list *VersionInquiryResponseList, err error) { + items := make([]*VersionInquiryResponse, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(VersionInquiryResponseList) + list.items = items + return +} diff --git a/clientapi/servicemgmt/v1/version_inquiry_response_list_type_json.go b/clientapi/servicemgmt/v1/version_inquiry_response_list_type_json.go new file mode 100644 index 00000000..a8eb1276 --- /dev/null +++ b/clientapi/servicemgmt/v1/version_inquiry_response_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalVersionInquiryResponseList writes a list of values of the 'version_inquiry_response' type to +// the given writer. +func MarshalVersionInquiryResponseList(list []*VersionInquiryResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteVersionInquiryResponseList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteVersionInquiryResponseList writes a list of value of the 'version_inquiry_response' type to +// the given stream. +func WriteVersionInquiryResponseList(list []*VersionInquiryResponse, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteVersionInquiryResponse(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalVersionInquiryResponseList reads a list of values of the 'version_inquiry_response' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalVersionInquiryResponseList(source interface{}) (items []*VersionInquiryResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadVersionInquiryResponseList(iterator) + err = iterator.Error + return +} + +// ReadVersionInquiryResponseList reads list of values of the ”version_inquiry_response' type from +// the given iterator. +func ReadVersionInquiryResponseList(iterator *jsoniter.Iterator) []*VersionInquiryResponse { + list := []*VersionInquiryResponse{} + for iterator.ReadArray() { + item := ReadVersionInquiryResponse(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/servicemgmt/v1/version_inquiry_response_type.go b/clientapi/servicemgmt/v1/version_inquiry_response_type.go new file mode 100644 index 00000000..6ae7043e --- /dev/null +++ b/clientapi/servicemgmt/v1/version_inquiry_response_type.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +// VersionInquiryResponse represents the values of the 'version_inquiry_response' type. +type VersionInquiryResponse struct { + bitmap_ uint32 + version string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *VersionInquiryResponse) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Version returns the value of the 'version' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *VersionInquiryResponse) Version() string { + if o != nil && o.bitmap_&1 != 0 { + return o.version + } + return "" +} + +// GetVersion returns the value of the 'version' attribute and +// a flag indicating if the attribute has a value. +func (o *VersionInquiryResponse) GetVersion() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.version + } + return +} + +// VersionInquiryResponseListKind is the name of the type used to represent list of objects of +// type 'version_inquiry_response'. +const VersionInquiryResponseListKind = "VersionInquiryResponseList" + +// VersionInquiryResponseListLinkKind is the name of the type used to represent links to list +// of objects of type 'version_inquiry_response'. +const VersionInquiryResponseListLinkKind = "VersionInquiryResponseListLink" + +// VersionInquiryResponseNilKind is the name of the type used to nil lists of objects of +// type 'version_inquiry_response'. +const VersionInquiryResponseListNilKind = "VersionInquiryResponseListNil" + +// VersionInquiryResponseList is a list of values of the 'version_inquiry_response' type. +type VersionInquiryResponseList struct { + href string + link bool + items []*VersionInquiryResponse +} + +// Len returns the length of the list. +func (l *VersionInquiryResponseList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *VersionInquiryResponseList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *VersionInquiryResponseList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *VersionInquiryResponseList) SetItems(items []*VersionInquiryResponse) { + l.items = items +} + +// Items returns the items of the list. +func (l *VersionInquiryResponseList) Items() []*VersionInquiryResponse { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *VersionInquiryResponseList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *VersionInquiryResponseList) Get(i int) *VersionInquiryResponse { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *VersionInquiryResponseList) Slice() []*VersionInquiryResponse { + var slice []*VersionInquiryResponse + if l == nil { + slice = make([]*VersionInquiryResponse, 0) + } else { + slice = make([]*VersionInquiryResponse, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *VersionInquiryResponseList) Each(f func(item *VersionInquiryResponse) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *VersionInquiryResponseList) Range(f func(index int, item *VersionInquiryResponse) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/servicemgmt/v1/version_inquiry_response_type_json.go b/clientapi/servicemgmt/v1/version_inquiry_response_type_json.go new file mode 100644 index 00000000..d636413c --- /dev/null +++ b/clientapi/servicemgmt/v1/version_inquiry_response_type_json.go @@ -0,0 +1,86 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/servicemgmt/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalVersionInquiryResponse writes a value of the 'version_inquiry_response' type to the given writer. +func MarshalVersionInquiryResponse(object *VersionInquiryResponse, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteVersionInquiryResponse(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteVersionInquiryResponse writes a value of the 'version_inquiry_response' type to the given stream. +func WriteVersionInquiryResponse(object *VersionInquiryResponse, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("version") + stream.WriteString(object.version) + } + stream.WriteObjectEnd() +} + +// UnmarshalVersionInquiryResponse reads a value of the 'version_inquiry_response' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalVersionInquiryResponse(source interface{}) (object *VersionInquiryResponse, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadVersionInquiryResponse(iterator) + err = iterator.Error + return +} + +// ReadVersionInquiryResponse reads a value of the 'version_inquiry_response' type from the given iterator. +func ReadVersionInquiryResponse(iterator *jsoniter.Iterator) *VersionInquiryResponse { + object := &VersionInquiryResponse{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "version": + value := iterator.ReadString() + object.version = value + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/statusboard/v1/application_builder.go b/clientapi/statusboard/v1/application_builder.go new file mode 100644 index 00000000..4dda4a5e --- /dev/null +++ b/clientapi/statusboard/v1/application_builder.go @@ -0,0 +1,184 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// ApplicationBuilder contains the data and logic needed to build 'application' objects. +// +// Definition of a Status Board application. +type ApplicationBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + fullname string + metadata interface{} + name string + owners []*OwnerBuilder + product *ProductBuilder + updatedAt time.Time +} + +// NewApplication creates a new builder of 'application' objects. +func NewApplication() *ApplicationBuilder { + return &ApplicationBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ApplicationBuilder) Link(value bool) *ApplicationBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ApplicationBuilder) ID(value string) *ApplicationBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ApplicationBuilder) HREF(value string) *ApplicationBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ApplicationBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *ApplicationBuilder) CreatedAt(value time.Time) *ApplicationBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// Fullname sets the value of the 'fullname' attribute to the given value. +func (b *ApplicationBuilder) Fullname(value string) *ApplicationBuilder { + b.fullname = value + b.bitmap_ |= 16 + return b +} + +// Metadata sets the value of the 'metadata' attribute to the given value. +func (b *ApplicationBuilder) Metadata(value interface{}) *ApplicationBuilder { + b.metadata = value + b.bitmap_ |= 32 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ApplicationBuilder) Name(value string) *ApplicationBuilder { + b.name = value + b.bitmap_ |= 64 + return b +} + +// Owners sets the value of the 'owners' attribute to the given values. +func (b *ApplicationBuilder) Owners(values ...*OwnerBuilder) *ApplicationBuilder { + b.owners = make([]*OwnerBuilder, len(values)) + copy(b.owners, values) + b.bitmap_ |= 128 + return b +} + +// Product sets the value of the 'product' attribute to the given value. +// +// Definition of a Status Board product. +func (b *ApplicationBuilder) Product(value *ProductBuilder) *ApplicationBuilder { + b.product = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *ApplicationBuilder) UpdatedAt(value time.Time) *ApplicationBuilder { + b.updatedAt = value + b.bitmap_ |= 512 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ApplicationBuilder) Copy(object *Application) *ApplicationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.fullname = object.fullname + b.metadata = object.metadata + b.name = object.name + if object.owners != nil { + b.owners = make([]*OwnerBuilder, len(object.owners)) + for i, v := range object.owners { + b.owners[i] = NewOwner().Copy(v) + } + } else { + b.owners = nil + } + if object.product != nil { + b.product = NewProduct().Copy(object.product) + } else { + b.product = nil + } + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'application' object using the configuration stored in the builder. +func (b *ApplicationBuilder) Build() (object *Application, err error) { + object = new(Application) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.fullname = b.fullname + object.metadata = b.metadata + object.name = b.name + if b.owners != nil { + object.owners = make([]*Owner, len(b.owners)) + for i, v := range b.owners { + object.owners[i], err = v.Build() + if err != nil { + return + } + } + } + if b.product != nil { + object.product, err = b.product.Build() + if err != nil { + return + } + } + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/statusboard/v1/application_dependency_builder.go b/clientapi/statusboard/v1/application_dependency_builder.go new file mode 100644 index 00000000..0f4d36dd --- /dev/null +++ b/clientapi/statusboard/v1/application_dependency_builder.go @@ -0,0 +1,209 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// ApplicationDependencyBuilder contains the data and logic needed to build 'application_dependency' objects. +// +// Definition of a Status Board application dependency. +type ApplicationDependencyBuilder struct { + bitmap_ uint32 + id string + href string + application *ApplicationBuilder + createdAt time.Time + metadata interface{} + name string + owners []*OwnerBuilder + service *ServiceBuilder + type_ string + updatedAt time.Time +} + +// NewApplicationDependency creates a new builder of 'application_dependency' objects. +func NewApplicationDependency() *ApplicationDependencyBuilder { + return &ApplicationDependencyBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ApplicationDependencyBuilder) Link(value bool) *ApplicationDependencyBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ApplicationDependencyBuilder) ID(value string) *ApplicationDependencyBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ApplicationDependencyBuilder) HREF(value string) *ApplicationDependencyBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ApplicationDependencyBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Application sets the value of the 'application' attribute to the given value. +// +// Definition of a Status Board application. +func (b *ApplicationDependencyBuilder) Application(value *ApplicationBuilder) *ApplicationDependencyBuilder { + b.application = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *ApplicationDependencyBuilder) CreatedAt(value time.Time) *ApplicationDependencyBuilder { + b.createdAt = value + b.bitmap_ |= 16 + return b +} + +// Metadata sets the value of the 'metadata' attribute to the given value. +func (b *ApplicationDependencyBuilder) Metadata(value interface{}) *ApplicationDependencyBuilder { + b.metadata = value + b.bitmap_ |= 32 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ApplicationDependencyBuilder) Name(value string) *ApplicationDependencyBuilder { + b.name = value + b.bitmap_ |= 64 + return b +} + +// Owners sets the value of the 'owners' attribute to the given values. +func (b *ApplicationDependencyBuilder) Owners(values ...*OwnerBuilder) *ApplicationDependencyBuilder { + b.owners = make([]*OwnerBuilder, len(values)) + copy(b.owners, values) + b.bitmap_ |= 128 + return b +} + +// Service sets the value of the 'service' attribute to the given value. +// +// Definition of a Status Board Service. +func (b *ApplicationDependencyBuilder) Service(value *ServiceBuilder) *ApplicationDependencyBuilder { + b.service = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *ApplicationDependencyBuilder) Type(value string) *ApplicationDependencyBuilder { + b.type_ = value + b.bitmap_ |= 512 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *ApplicationDependencyBuilder) UpdatedAt(value time.Time) *ApplicationDependencyBuilder { + b.updatedAt = value + b.bitmap_ |= 1024 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ApplicationDependencyBuilder) Copy(object *ApplicationDependency) *ApplicationDependencyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.application != nil { + b.application = NewApplication().Copy(object.application) + } else { + b.application = nil + } + b.createdAt = object.createdAt + b.metadata = object.metadata + b.name = object.name + if object.owners != nil { + b.owners = make([]*OwnerBuilder, len(object.owners)) + for i, v := range object.owners { + b.owners[i] = NewOwner().Copy(v) + } + } else { + b.owners = nil + } + if object.service != nil { + b.service = NewService().Copy(object.service) + } else { + b.service = nil + } + b.type_ = object.type_ + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'application_dependency' object using the configuration stored in the builder. +func (b *ApplicationDependencyBuilder) Build() (object *ApplicationDependency, err error) { + object = new(ApplicationDependency) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.application != nil { + object.application, err = b.application.Build() + if err != nil { + return + } + } + object.createdAt = b.createdAt + object.metadata = b.metadata + object.name = b.name + if b.owners != nil { + object.owners = make([]*Owner, len(b.owners)) + for i, v := range b.owners { + object.owners[i], err = v.Build() + if err != nil { + return + } + } + } + if b.service != nil { + object.service, err = b.service.Build() + if err != nil { + return + } + } + object.type_ = b.type_ + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/statusboard/v1/application_dependency_list_builder.go b/clientapi/statusboard/v1/application_dependency_list_builder.go new file mode 100644 index 00000000..b11765d3 --- /dev/null +++ b/clientapi/statusboard/v1/application_dependency_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// ApplicationDependencyListBuilder contains the data and logic needed to build +// 'application_dependency' objects. +type ApplicationDependencyListBuilder struct { + items []*ApplicationDependencyBuilder +} + +// NewApplicationDependencyList creates a new builder of 'application_dependency' objects. +func NewApplicationDependencyList() *ApplicationDependencyListBuilder { + return new(ApplicationDependencyListBuilder) +} + +// Items sets the items of the list. +func (b *ApplicationDependencyListBuilder) Items(values ...*ApplicationDependencyBuilder) *ApplicationDependencyListBuilder { + b.items = make([]*ApplicationDependencyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ApplicationDependencyListBuilder) 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 *ApplicationDependencyListBuilder) Copy(list *ApplicationDependencyList) *ApplicationDependencyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ApplicationDependencyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewApplicationDependency().Copy(v) + } + } + return b +} + +// Build creates a list of 'application_dependency' objects using the +// configuration stored in the builder. +func (b *ApplicationDependencyListBuilder) Build() (list *ApplicationDependencyList, err error) { + items := make([]*ApplicationDependency, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ApplicationDependencyList) + list.items = items + return +} diff --git a/clientapi/statusboard/v1/application_dependency_list_type_json.go b/clientapi/statusboard/v1/application_dependency_list_type_json.go new file mode 100644 index 00000000..52fb9b70 --- /dev/null +++ b/clientapi/statusboard/v1/application_dependency_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalApplicationDependencyList writes a list of values of the 'application_dependency' type to +// the given writer. +func MarshalApplicationDependencyList(list []*ApplicationDependency, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteApplicationDependencyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteApplicationDependencyList writes a list of value of the 'application_dependency' type to +// the given stream. +func WriteApplicationDependencyList(list []*ApplicationDependency, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteApplicationDependency(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalApplicationDependencyList reads a list of values of the 'application_dependency' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalApplicationDependencyList(source interface{}) (items []*ApplicationDependency, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadApplicationDependencyList(iterator) + err = iterator.Error + return +} + +// ReadApplicationDependencyList reads list of values of the ”application_dependency' type from +// the given iterator. +func ReadApplicationDependencyList(iterator *jsoniter.Iterator) []*ApplicationDependency { + list := []*ApplicationDependency{} + for iterator.ReadArray() { + item := ReadApplicationDependency(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/application_dependency_type.go b/clientapi/statusboard/v1/application_dependency_type.go new file mode 100644 index 00000000..60c78570 --- /dev/null +++ b/clientapi/statusboard/v1/application_dependency_type.go @@ -0,0 +1,437 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// ApplicationDependencyKind is the name of the type used to represent objects +// of type 'application_dependency'. +const ApplicationDependencyKind = "ApplicationDependency" + +// ApplicationDependencyLinkKind is the name of the type used to represent links +// to objects of type 'application_dependency'. +const ApplicationDependencyLinkKind = "ApplicationDependencyLink" + +// ApplicationDependencyNilKind is the name of the type used to nil references +// to objects of type 'application_dependency'. +const ApplicationDependencyNilKind = "ApplicationDependencyNil" + +// ApplicationDependency represents the values of the 'application_dependency' type. +// +// Definition of a Status Board application dependency. +type ApplicationDependency struct { + bitmap_ uint32 + id string + href string + application *Application + createdAt time.Time + metadata interface{} + name string + owners []*Owner + service *Service + type_ string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *ApplicationDependency) Kind() string { + if o == nil { + return ApplicationDependencyNilKind + } + if o.bitmap_&1 != 0 { + return ApplicationDependencyLinkKind + } + return ApplicationDependencyKind +} + +// Link returns true if this is a link. +func (o *ApplicationDependency) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ApplicationDependency) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ApplicationDependency) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ApplicationDependency) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ApplicationDependency) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ApplicationDependency) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Application returns the value of the 'application' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The parent Application of the dependency. +func (o *ApplicationDependency) Application() *Application { + if o != nil && o.bitmap_&8 != 0 { + return o.application + } + return nil +} + +// GetApplication returns the value of the 'application' attribute and +// a flag indicating if the attribute has a value. +// +// The parent Application of the dependency. +func (o *ApplicationDependency) GetApplication() (value *Application, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.application + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *ApplicationDependency) CreatedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *ApplicationDependency) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.createdAt + } + return +} + +// Metadata returns the value of the 'metadata' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Miscellaneous metadata about the application. +func (o *ApplicationDependency) Metadata() interface{} { + if o != nil && o.bitmap_&32 != 0 { + return o.metadata + } + return nil +} + +// GetMetadata returns the value of the 'metadata' attribute and +// a flag indicating if the attribute has a value. +// +// Miscellaneous metadata about the application. +func (o *ApplicationDependency) GetMetadata() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.metadata + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the application. +func (o *ApplicationDependency) Name() string { + if o != nil && o.bitmap_&64 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the application. +func (o *ApplicationDependency) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.name + } + return +} + +// Owners returns the value of the 'owners' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The application dependency owners (name and email) +func (o *ApplicationDependency) Owners() []*Owner { + if o != nil && o.bitmap_&128 != 0 { + return o.owners + } + return nil +} + +// GetOwners returns the value of the 'owners' attribute and +// a flag indicating if the attribute has a value. +// +// The application dependency owners (name and email) +func (o *ApplicationDependency) GetOwners() (value []*Owner, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.owners + } + return +} + +// Service returns the value of the 'service' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Service associated with the dependency. +func (o *ApplicationDependency) Service() *Service { + if o != nil && o.bitmap_&256 != 0 { + return o.service + } + return nil +} + +// GetService returns the value of the 'service' attribute and +// a flag indicating if the attribute has a value. +// +// The Service associated with the dependency. +func (o *ApplicationDependency) GetService() (value *Service, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.service + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The type of application dependency, e.g. soft or hard. +func (o *ApplicationDependency) Type() string { + if o != nil && o.bitmap_&512 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// The type of application dependency, e.g. soft or hard. +func (o *ApplicationDependency) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.type_ + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *ApplicationDependency) UpdatedAt() time.Time { + if o != nil && o.bitmap_&1024 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *ApplicationDependency) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.updatedAt + } + return +} + +// ApplicationDependencyListKind is the name of the type used to represent list of objects of +// type 'application_dependency'. +const ApplicationDependencyListKind = "ApplicationDependencyList" + +// ApplicationDependencyListLinkKind is the name of the type used to represent links to list +// of objects of type 'application_dependency'. +const ApplicationDependencyListLinkKind = "ApplicationDependencyListLink" + +// ApplicationDependencyNilKind is the name of the type used to nil lists of objects of +// type 'application_dependency'. +const ApplicationDependencyListNilKind = "ApplicationDependencyListNil" + +// ApplicationDependencyList is a list of values of the 'application_dependency' type. +type ApplicationDependencyList struct { + href string + link bool + items []*ApplicationDependency +} + +// Kind returns the name of the type of the object. +func (l *ApplicationDependencyList) Kind() string { + if l == nil { + return ApplicationDependencyListNilKind + } + if l.link { + return ApplicationDependencyListLinkKind + } + return ApplicationDependencyListKind +} + +// Link returns true iif this is a link. +func (l *ApplicationDependencyList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ApplicationDependencyList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ApplicationDependencyList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ApplicationDependencyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ApplicationDependencyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ApplicationDependencyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ApplicationDependencyList) SetItems(items []*ApplicationDependency) { + l.items = items +} + +// Items returns the items of the list. +func (l *ApplicationDependencyList) Items() []*ApplicationDependency { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ApplicationDependencyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ApplicationDependencyList) Get(i int) *ApplicationDependency { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ApplicationDependencyList) Slice() []*ApplicationDependency { + var slice []*ApplicationDependency + if l == nil { + slice = make([]*ApplicationDependency, 0) + } else { + slice = make([]*ApplicationDependency, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ApplicationDependencyList) Each(f func(item *ApplicationDependency) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ApplicationDependencyList) Range(f func(index int, item *ApplicationDependency) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/statusboard/v1/application_dependency_type_json.go b/clientapi/statusboard/v1/application_dependency_type_json.go new file mode 100644 index 00000000..1d743686 --- /dev/null +++ b/clientapi/statusboard/v1/application_dependency_type_json.go @@ -0,0 +1,221 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalApplicationDependency writes a value of the 'application_dependency' type to the given writer. +func MarshalApplicationDependency(object *ApplicationDependency, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteApplicationDependency(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteApplicationDependency writes a value of the 'application_dependency' type to the given stream. +func WriteApplicationDependency(object *ApplicationDependency, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ApplicationDependencyLinkKind) + } else { + stream.WriteString(ApplicationDependencyKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.application != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("application") + WriteApplication(object.application, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("metadata") + stream.WriteVal(object.metadata) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&128 != 0 && object.owners != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("owners") + WriteOwnerList(object.owners, stream) + count++ + } + present_ = object.bitmap_&256 != 0 && object.service != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service") + WriteService(object.service, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalApplicationDependency reads a value of the 'application_dependency' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalApplicationDependency(source interface{}) (object *ApplicationDependency, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadApplicationDependency(iterator) + err = iterator.Error + return +} + +// ReadApplicationDependency reads a value of the 'application_dependency' type from the given iterator. +func ReadApplicationDependency(iterator *jsoniter.Iterator) *ApplicationDependency { + object := &ApplicationDependency{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ApplicationDependencyLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "application": + value := ReadApplication(iterator) + object.application = value + object.bitmap_ |= 8 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 16 + case "metadata": + var value interface{} + iterator.ReadVal(&value) + object.metadata = value + object.bitmap_ |= 32 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 64 + case "owners": + value := ReadOwnerList(iterator) + object.owners = value + object.bitmap_ |= 128 + case "service": + value := ReadService(iterator) + object.service = value + object.bitmap_ |= 256 + case "type": + value := iterator.ReadString() + object.type_ = value + 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_ |= 1024 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/statusboard/v1/application_list_builder.go b/clientapi/statusboard/v1/application_list_builder.go new file mode 100644 index 00000000..a679e38b --- /dev/null +++ b/clientapi/statusboard/v1/application_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// ApplicationListBuilder contains the data and logic needed to build +// 'application' objects. +type ApplicationListBuilder struct { + items []*ApplicationBuilder +} + +// NewApplicationList creates a new builder of 'application' objects. +func NewApplicationList() *ApplicationListBuilder { + return new(ApplicationListBuilder) +} + +// Items sets the items of the list. +func (b *ApplicationListBuilder) Items(values ...*ApplicationBuilder) *ApplicationListBuilder { + b.items = make([]*ApplicationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ApplicationListBuilder) 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 *ApplicationListBuilder) Copy(list *ApplicationList) *ApplicationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ApplicationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewApplication().Copy(v) + } + } + return b +} + +// Build creates a list of 'application' objects using the +// configuration stored in the builder. +func (b *ApplicationListBuilder) Build() (list *ApplicationList, err error) { + items := make([]*Application, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ApplicationList) + list.items = items + return +} diff --git a/clientapi/statusboard/v1/application_list_type_json.go b/clientapi/statusboard/v1/application_list_type_json.go new file mode 100644 index 00000000..fc26593b --- /dev/null +++ b/clientapi/statusboard/v1/application_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalApplicationList writes a list of values of the 'application' type to +// the given writer. +func MarshalApplicationList(list []*Application, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteApplicationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteApplicationList writes a list of value of the 'application' type to +// the given stream. +func WriteApplicationList(list []*Application, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteApplication(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalApplicationList reads a list of values of the 'application' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalApplicationList(source interface{}) (items []*Application, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadApplicationList(iterator) + err = iterator.Error + return +} + +// ReadApplicationList reads list of values of the ”application' type from +// the given iterator. +func ReadApplicationList(iterator *jsoniter.Iterator) []*Application { + list := []*Application{} + for iterator.ReadArray() { + item := ReadApplication(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/application_type.go b/clientapi/statusboard/v1/application_type.go new file mode 100644 index 00000000..c203bfdf --- /dev/null +++ b/clientapi/statusboard/v1/application_type.go @@ -0,0 +1,413 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// ApplicationKind is the name of the type used to represent objects +// of type 'application'. +const ApplicationKind = "Application" + +// ApplicationLinkKind is the name of the type used to represent links +// to objects of type 'application'. +const ApplicationLinkKind = "ApplicationLink" + +// ApplicationNilKind is the name of the type used to nil references +// to objects of type 'application'. +const ApplicationNilKind = "ApplicationNil" + +// Application represents the values of the 'application' type. +// +// Definition of a Status Board application. +type Application struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + fullname string + metadata interface{} + name string + owners []*Owner + product *Product + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *Application) Kind() string { + if o == nil { + return ApplicationNilKind + } + if o.bitmap_&1 != 0 { + return ApplicationLinkKind + } + return ApplicationKind +} + +// Link returns true if this is a link. +func (o *Application) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Application) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Application) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Application) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Application) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Application) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *Application) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *Application) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// Fullname returns the value of the 'fullname' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The full name of the application. +func (o *Application) Fullname() string { + if o != nil && o.bitmap_&16 != 0 { + return o.fullname + } + return "" +} + +// GetFullname returns the value of the 'fullname' attribute and +// a flag indicating if the attribute has a value. +// +// The full name of the application. +func (o *Application) GetFullname() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.fullname + } + return +} + +// Metadata returns the value of the 'metadata' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Miscellaneous metadata about the application. +func (o *Application) Metadata() interface{} { + if o != nil && o.bitmap_&32 != 0 { + return o.metadata + } + return nil +} + +// GetMetadata returns the value of the 'metadata' attribute and +// a flag indicating if the attribute has a value. +// +// Miscellaneous metadata about the application. +func (o *Application) GetMetadata() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.metadata + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the application. +func (o *Application) Name() string { + if o != nil && o.bitmap_&64 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the application. +func (o *Application) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.name + } + return +} + +// Owners returns the value of the 'owners' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The application owners (name and email) +func (o *Application) Owners() []*Owner { + if o != nil && o.bitmap_&128 != 0 { + return o.owners + } + return nil +} + +// GetOwners returns the value of the 'owners' attribute and +// a flag indicating if the attribute has a value. +// +// The application owners (name and email) +func (o *Application) GetOwners() (value []*Owner, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.owners + } + return +} + +// Product returns the value of the 'product' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The group ID that the application belongs to. +func (o *Application) Product() *Product { + if o != nil && o.bitmap_&256 != 0 { + return o.product + } + return nil +} + +// GetProduct returns the value of the 'product' attribute and +// a flag indicating if the attribute has a value. +// +// The group ID that the application belongs to. +func (o *Application) GetProduct() (value *Product, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.product + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *Application) UpdatedAt() time.Time { + if o != nil && o.bitmap_&512 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *Application) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.updatedAt + } + return +} + +// ApplicationListKind is the name of the type used to represent list of objects of +// type 'application'. +const ApplicationListKind = "ApplicationList" + +// ApplicationListLinkKind is the name of the type used to represent links to list +// of objects of type 'application'. +const ApplicationListLinkKind = "ApplicationListLink" + +// ApplicationNilKind is the name of the type used to nil lists of objects of +// type 'application'. +const ApplicationListNilKind = "ApplicationListNil" + +// ApplicationList is a list of values of the 'application' type. +type ApplicationList struct { + href string + link bool + items []*Application +} + +// Kind returns the name of the type of the object. +func (l *ApplicationList) Kind() string { + if l == nil { + return ApplicationListNilKind + } + if l.link { + return ApplicationListLinkKind + } + return ApplicationListKind +} + +// Link returns true iif this is a link. +func (l *ApplicationList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ApplicationList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ApplicationList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ApplicationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ApplicationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ApplicationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ApplicationList) SetItems(items []*Application) { + l.items = items +} + +// Items returns the items of the list. +func (l *ApplicationList) Items() []*Application { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ApplicationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ApplicationList) Get(i int) *Application { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ApplicationList) Slice() []*Application { + var slice []*Application + if l == nil { + slice = make([]*Application, 0) + } else { + slice = make([]*Application, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ApplicationList) Each(f func(item *Application) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ApplicationList) Range(f func(index int, item *Application) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/statusboard/v1/application_type_json.go b/clientapi/statusboard/v1/application_type_json.go new file mode 100644 index 00000000..ee885eea --- /dev/null +++ b/clientapi/statusboard/v1/application_type_json.go @@ -0,0 +1,208 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalApplication writes a value of the 'application' type to the given writer. +func MarshalApplication(object *Application, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteApplication(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteApplication writes a value of the 'application' type to the given stream. +func WriteApplication(object *Application, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ApplicationLinkKind) + } else { + stream.WriteString(ApplicationKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("fullname") + stream.WriteString(object.fullname) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("metadata") + stream.WriteVal(object.metadata) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&128 != 0 && object.owners != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("owners") + WriteOwnerList(object.owners, stream) + count++ + } + present_ = object.bitmap_&256 != 0 && object.product != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product") + WriteProduct(object.product, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalApplication reads a value of the 'application' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalApplication(source interface{}) (object *Application, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadApplication(iterator) + err = iterator.Error + return +} + +// ReadApplication reads a value of the 'application' type from the given iterator. +func ReadApplication(iterator *jsoniter.Iterator) *Application { + object := &Application{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ApplicationLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "fullname": + value := iterator.ReadString() + object.fullname = value + object.bitmap_ |= 16 + case "metadata": + var value interface{} + iterator.ReadVal(&value) + object.metadata = value + object.bitmap_ |= 32 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 64 + case "owners": + value := ReadOwnerList(iterator) + object.owners = value + object.bitmap_ |= 128 + case "product": + value := ReadProduct(iterator) + object.product = value + object.bitmap_ |= 256 + 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 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/statusboard/v1/boolean_list_type_json.go b/clientapi/statusboard/v1/boolean_list_type_json.go new file mode 100644 index 00000000..ff678142 --- /dev/null +++ b/clientapi/statusboard/v1/boolean_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBooleanList writes a list of values of the 'boolean' type to +// the given writer. +func MarshalBooleanList(list []bool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBooleanList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBooleanList writes a list of value of the 'boolean' type to +// the given stream. +func WriteBooleanList(list []bool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteBool(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalBooleanList reads a list of values of the 'boolean' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBooleanList(source interface{}) (items []bool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBooleanList(iterator) + err = iterator.Error + return +} + +// ReadBooleanList reads list of values of the ”boolean' type from +// the given iterator. +func ReadBooleanList(iterator *jsoniter.Iterator) []bool { + list := []bool{} + for iterator.ReadArray() { + item := iterator.ReadBool() + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/date_list_type_json.go b/clientapi/statusboard/v1/date_list_type_json.go new file mode 100644 index 00000000..a3e0e900 --- /dev/null +++ b/clientapi/statusboard/v1/date_list_type_json.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDateList writes a list of values of the 'date' type to +// the given writer. +func MarshalDateList(list []time.Time, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDateList writes a list of value of the 'date' type to +// the given stream. +func WriteDateList(list []time.Time, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString((value).Format(time.RFC3339)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDateList reads a list of values of the 'date' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDateList(source interface{}) (items []time.Time, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDateList(iterator) + err = iterator.Error + return +} + +// ReadDateList reads list of values of the ”date' type from +// the given iterator. +func ReadDateList(iterator *jsoniter.Iterator) []time.Time { + list := []time.Time{} + for iterator.ReadArray() { + text := iterator.ReadString() + item, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/error_builder.go b/clientapi/statusboard/v1/error_builder.go new file mode 100644 index 00000000..a61fd54a --- /dev/null +++ b/clientapi/statusboard/v1/error_builder.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// ErrorBuilder contains the data and logic needed to build 'error' objects. +// +// Definition of a Status Board error. +type ErrorBuilder struct { + bitmap_ uint32 + id string + href string + code string + reason string +} + +// NewError creates a new builder of 'error' objects. +func NewError() *ErrorBuilder { + return &ErrorBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ErrorBuilder) Link(value bool) *ErrorBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ErrorBuilder) ID(value string) *ErrorBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ErrorBuilder) HREF(value string) *ErrorBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ErrorBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Code sets the value of the 'code' attribute to the given value. +func (b *ErrorBuilder) Code(value string) *ErrorBuilder { + b.code = value + b.bitmap_ |= 8 + return b +} + +// Reason sets the value of the 'reason' attribute to the given value. +func (b *ErrorBuilder) Reason(value string) *ErrorBuilder { + b.reason = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ErrorBuilder) Copy(object *Error) *ErrorBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.code = object.code + b.reason = object.reason + return b +} + +// Build creates a 'error' object using the configuration stored in the builder. +func (b *ErrorBuilder) Build() (object *Error, err error) { + object = new(Error) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.code = b.code + object.reason = b.reason + return +} diff --git a/clientapi/statusboard/v1/error_list_builder.go b/clientapi/statusboard/v1/error_list_builder.go new file mode 100644 index 00000000..556ee6df --- /dev/null +++ b/clientapi/statusboard/v1/error_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// ErrorListBuilder contains the data and logic needed to build +// 'error' objects. +type ErrorListBuilder struct { + items []*ErrorBuilder +} + +// NewErrorList creates a new builder of 'error' objects. +func NewErrorList() *ErrorListBuilder { + return new(ErrorListBuilder) +} + +// Items sets the items of the list. +func (b *ErrorListBuilder) Items(values ...*ErrorBuilder) *ErrorListBuilder { + b.items = make([]*ErrorBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ErrorListBuilder) 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 *ErrorListBuilder) Copy(list *ErrorList) *ErrorListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ErrorBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewError().Copy(v) + } + } + return b +} + +// Build creates a list of 'error' objects using the +// configuration stored in the builder. +func (b *ErrorListBuilder) Build() (list *ErrorList, err error) { + items := make([]*Error, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ErrorList) + list.items = items + return +} diff --git a/clientapi/statusboard/v1/error_list_type_json.go b/clientapi/statusboard/v1/error_list_type_json.go new file mode 100644 index 00000000..cb2f20f2 --- /dev/null +++ b/clientapi/statusboard/v1/error_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalErrorList writes a list of values of the 'error' type to +// the given writer. +func MarshalErrorList(list []*Error, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteErrorList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteErrorList writes a list of value of the 'error' type to +// the given stream. +func WriteErrorList(list []*Error, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteError(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalErrorList reads a list of values of the 'error' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalErrorList(source interface{}) (items []*Error, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadErrorList(iterator) + err = iterator.Error + return +} + +// ReadErrorList reads list of values of the ”error' type from +// the given iterator. +func ReadErrorList(iterator *jsoniter.Iterator) []*Error { + list := []*Error{} + for iterator.ReadArray() { + item := ReadError(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/error_type.go b/clientapi/statusboard/v1/error_type.go new file mode 100644 index 00000000..c18b0c8e --- /dev/null +++ b/clientapi/statusboard/v1/error_type.go @@ -0,0 +1,281 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// ErrorKind is the name of the type used to represent objects +// of type 'error'. +const ErrorKind = "Error" + +// ErrorLinkKind is the name of the type used to represent links +// to objects of type 'error'. +const ErrorLinkKind = "ErrorLink" + +// ErrorNilKind is the name of the type used to nil references +// to objects of type 'error'. +const ErrorNilKind = "ErrorNil" + +// Error represents the values of the 'error' type. +// +// Definition of a Status Board error. +type Error struct { + bitmap_ uint32 + id string + href string + code string + reason string +} + +// Kind returns the name of the type of the object. +func (o *Error) Kind() string { + if o == nil { + return ErrorNilKind + } + if o.bitmap_&1 != 0 { + return ErrorLinkKind + } + return ErrorKind +} + +// Link returns true if this is a link. +func (o *Error) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Error) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Error) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Error) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Error) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Error) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Code returns the value of the 'code' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Error) Code() string { + if o != nil && o.bitmap_&8 != 0 { + return o.code + } + return "" +} + +// GetCode returns the value of the 'code' attribute and +// a flag indicating if the attribute has a value. +func (o *Error) GetCode() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.code + } + return +} + +// Reason returns the value of the 'reason' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Error) Reason() string { + if o != nil && o.bitmap_&16 != 0 { + return o.reason + } + return "" +} + +// GetReason returns the value of the 'reason' attribute and +// a flag indicating if the attribute has a value. +func (o *Error) GetReason() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.reason + } + return +} + +// ErrorListKind is the name of the type used to represent list of objects of +// type 'error'. +const ErrorListKind = "ErrorList" + +// ErrorListLinkKind is the name of the type used to represent links to list +// of objects of type 'error'. +const ErrorListLinkKind = "ErrorListLink" + +// ErrorNilKind is the name of the type used to nil lists of objects of +// type 'error'. +const ErrorListNilKind = "ErrorListNil" + +// ErrorList is a list of values of the 'error' type. +type ErrorList struct { + href string + link bool + items []*Error +} + +// Kind returns the name of the type of the object. +func (l *ErrorList) Kind() string { + if l == nil { + return ErrorListNilKind + } + if l.link { + return ErrorListLinkKind + } + return ErrorListKind +} + +// Link returns true iif this is a link. +func (l *ErrorList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ErrorList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ErrorList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ErrorList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ErrorList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ErrorList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ErrorList) SetItems(items []*Error) { + l.items = items +} + +// Items returns the items of the list. +func (l *ErrorList) Items() []*Error { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ErrorList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ErrorList) Get(i int) *Error { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ErrorList) Slice() []*Error { + var slice []*Error + if l == nil { + slice = make([]*Error, 0) + } else { + slice = make([]*Error, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ErrorList) Each(f func(item *Error) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ErrorList) Range(f func(index int, item *Error) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/statusboard/v1/error_type_json.go b/clientapi/statusboard/v1/error_type_json.go new file mode 100644 index 00000000..dae28b16 --- /dev/null +++ b/clientapi/statusboard/v1/error_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalError writes a value of the 'error' type to the given writer. +func MarshalError(object *Error, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteError(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteError writes a value of the 'error' type to the given stream. +func WriteError(object *Error, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ErrorLinkKind) + } else { + stream.WriteString(ErrorKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("code") + stream.WriteString(object.code) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("reason") + stream.WriteString(object.reason) + } + stream.WriteObjectEnd() +} + +// UnmarshalError reads a value of the 'error' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalError(source interface{}) (object *Error, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadError(iterator) + err = iterator.Error + return +} + +// ReadError reads a value of the 'error' type from the given iterator. +func ReadError(iterator *jsoniter.Iterator) *Error { + object := &Error{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ErrorLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "code": + value := iterator.ReadString() + object.code = value + object.bitmap_ |= 8 + case "reason": + value := iterator.ReadString() + object.reason = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/statusboard/v1/float_list_type_json.go b/clientapi/statusboard/v1/float_list_type_json.go new file mode 100644 index 00000000..4aaa1c7b --- /dev/null +++ b/clientapi/statusboard/v1/float_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFloatList writes a list of values of the 'float' type to +// the given writer. +func MarshalFloatList(list []float64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFloatList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFloatList writes a list of value of the 'float' type to +// the given stream. +func WriteFloatList(list []float64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteFloat64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalFloatList reads a list of values of the 'float' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFloatList(source interface{}) (items []float64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFloatList(iterator) + err = iterator.Error + return +} + +// ReadFloatList reads list of values of the ”float' type from +// the given iterator. +func ReadFloatList(iterator *jsoniter.Iterator) []float64 { + list := []float64{} + for iterator.ReadArray() { + item := iterator.ReadFloat64() + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/integer_list_type_json.go b/clientapi/statusboard/v1/integer_list_type_json.go new file mode 100644 index 00000000..a11724ff --- /dev/null +++ b/clientapi/statusboard/v1/integer_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIntegerList writes a list of values of the 'integer' type to +// the given writer. +func MarshalIntegerList(list []int, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIntegerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIntegerList writes a list of value of the 'integer' type to +// the given stream. +func WriteIntegerList(list []int, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalIntegerList reads a list of values of the 'integer' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIntegerList(source interface{}) (items []int, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIntegerList(iterator) + err = iterator.Error + return +} + +// ReadIntegerList reads list of values of the ”integer' type from +// the given iterator. +func ReadIntegerList(iterator *jsoniter.Iterator) []int { + list := []int{} + for iterator.ReadArray() { + item := iterator.ReadInt() + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/interface_list_type_json.go b/clientapi/statusboard/v1/interface_list_type_json.go new file mode 100644 index 00000000..5b3cd982 --- /dev/null +++ b/clientapi/statusboard/v1/interface_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInterfaceList writes a list of values of the 'interface' type to +// the given writer. +func MarshalInterfaceList(list []interface{}, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInterfaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInterfaceList writes a list of value of the 'interface' type to +// the given stream. +func WriteInterfaceList(list []interface{}, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteVal(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalInterfaceList reads a list of values of the 'interface' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInterfaceList(source interface{}) (items []interface{}, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInterfaceList(iterator) + err = iterator.Error + return +} + +// ReadInterfaceList reads list of values of the ”interface' type from +// the given iterator. +func ReadInterfaceList(iterator *jsoniter.Iterator) []interface{} { + list := []interface{}{} + for iterator.ReadArray() { + var item interface{} + iterator.ReadVal(&item) + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/long_list_type_json.go b/clientapi/statusboard/v1/long_list_type_json.go new file mode 100644 index 00000000..a496a105 --- /dev/null +++ b/clientapi/statusboard/v1/long_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLongList writes a list of values of the 'long' type to +// the given writer. +func MarshalLongList(list []int64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLongList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLongList writes a list of value of the 'long' type to +// the given stream. +func WriteLongList(list []int64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalLongList reads a list of values of the 'long' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLongList(source interface{}) (items []int64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLongList(iterator) + err = iterator.Error + return +} + +// ReadLongList reads list of values of the ”long' type from +// the given iterator. +func ReadLongList(iterator *jsoniter.Iterator) []int64 { + list := []int64{} + for iterator.ReadArray() { + item := iterator.ReadInt64() + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/metadata_reader.go b/clientapi/statusboard/v1/metadata_reader.go new file mode 100644 index 00000000..0af46139 --- /dev/null +++ b/clientapi/statusboard/v1/metadata_reader.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMetadata writes a value of the metadata type to the given target, which +// can be a writer or a JSON encoder. +func MarshalMetadata(object *Metadata, writer io.Writer) error { + stream := helpers.NewStream(writer) + writeMetadata(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} +func writeMetadata(object *Metadata, stream *jsoniter.Stream) { + stream.WriteObjectStart() + if object.bitmap_&1 != 0 { + stream.WriteObjectField("server_version") + stream.WriteString(object.serverVersion) + } + stream.WriteObjectEnd() +} + +// UnmarshalMetadata reads a value of the metadata type from the given source, which +// which can be a reader, a slice of byte or a string. +func UnmarshalMetadata(source interface{}) (object *Metadata, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = readMetadata(iterator) + err = iterator.Error + return +} +func readMetadata(iterator *jsoniter.Iterator) *Metadata { + object := &Metadata{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "server_version": + object.serverVersion = iterator.ReadString() + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/statusboard/v1/metadata_type.go b/clientapi/statusboard/v1/metadata_type.go new file mode 100644 index 00000000..a445b706 --- /dev/null +++ b/clientapi/statusboard/v1/metadata_type.go @@ -0,0 +1,44 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// Metadata contains the version metadata. +type Metadata struct { + bitmap_ uint32 + serverVersion string +} + +// ServerVersion returns the version of the server. +func (m *Metadata) ServerVersion() string { + if m != nil && m.bitmap_&1 != 0 { + return m.serverVersion + } + return "" +} + +// GetServerVersion returns the value of the server version and a flag indicating if +// the attribute has a value. +func (m *Metadata) GetServerVersion() (value string, ok bool) { + ok = m != nil && m.bitmap_&1 != 0 + if ok { + value = m.serverVersion + } + return +} diff --git a/clientapi/statusboard/v1/owner_builder.go b/clientapi/statusboard/v1/owner_builder.go new file mode 100644 index 00000000..775ee6e3 --- /dev/null +++ b/clientapi/statusboard/v1/owner_builder.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// OwnerBuilder contains the data and logic needed to build 'owner' objects. +// +// Definition of a Status Board owner. +type OwnerBuilder struct { + bitmap_ uint32 + id string + href string + email string + username string +} + +// NewOwner creates a new builder of 'owner' objects. +func NewOwner() *OwnerBuilder { + return &OwnerBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *OwnerBuilder) Link(value bool) *OwnerBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *OwnerBuilder) ID(value string) *OwnerBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *OwnerBuilder) HREF(value string) *OwnerBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *OwnerBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Email sets the value of the 'email' attribute to the given value. +func (b *OwnerBuilder) Email(value string) *OwnerBuilder { + b.email = value + b.bitmap_ |= 8 + return b +} + +// Username sets the value of the 'username' attribute to the given value. +func (b *OwnerBuilder) Username(value string) *OwnerBuilder { + b.username = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *OwnerBuilder) Copy(object *Owner) *OwnerBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.email = object.email + b.username = object.username + return b +} + +// Build creates a 'owner' object using the configuration stored in the builder. +func (b *OwnerBuilder) Build() (object *Owner, err error) { + object = new(Owner) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.email = b.email + object.username = b.username + return +} diff --git a/clientapi/statusboard/v1/owner_list_builder.go b/clientapi/statusboard/v1/owner_list_builder.go new file mode 100644 index 00000000..46bbfcdb --- /dev/null +++ b/clientapi/statusboard/v1/owner_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// OwnerListBuilder contains the data and logic needed to build +// 'owner' objects. +type OwnerListBuilder struct { + items []*OwnerBuilder +} + +// NewOwnerList creates a new builder of 'owner' objects. +func NewOwnerList() *OwnerListBuilder { + return new(OwnerListBuilder) +} + +// Items sets the items of the list. +func (b *OwnerListBuilder) Items(values ...*OwnerBuilder) *OwnerListBuilder { + b.items = make([]*OwnerBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *OwnerListBuilder) 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 *OwnerListBuilder) Copy(list *OwnerList) *OwnerListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*OwnerBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewOwner().Copy(v) + } + } + return b +} + +// Build creates a list of 'owner' objects using the +// configuration stored in the builder. +func (b *OwnerListBuilder) Build() (list *OwnerList, err error) { + items := make([]*Owner, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(OwnerList) + list.items = items + return +} diff --git a/clientapi/statusboard/v1/owner_list_type_json.go b/clientapi/statusboard/v1/owner_list_type_json.go new file mode 100644 index 00000000..b0bbd8bd --- /dev/null +++ b/clientapi/statusboard/v1/owner_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOwnerList writes a list of values of the 'owner' type to +// the given writer. +func MarshalOwnerList(list []*Owner, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOwnerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOwnerList writes a list of value of the 'owner' type to +// the given stream. +func WriteOwnerList(list []*Owner, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteOwner(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalOwnerList reads a list of values of the 'owner' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalOwnerList(source interface{}) (items []*Owner, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadOwnerList(iterator) + err = iterator.Error + return +} + +// ReadOwnerList reads list of values of the ”owner' type from +// the given iterator. +func ReadOwnerList(iterator *jsoniter.Iterator) []*Owner { + list := []*Owner{} + for iterator.ReadArray() { + item := ReadOwner(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/owner_type.go b/clientapi/statusboard/v1/owner_type.go new file mode 100644 index 00000000..d966c9be --- /dev/null +++ b/clientapi/statusboard/v1/owner_type.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// OwnerKind is the name of the type used to represent objects +// of type 'owner'. +const OwnerKind = "Owner" + +// OwnerLinkKind is the name of the type used to represent links +// to objects of type 'owner'. +const OwnerLinkKind = "OwnerLink" + +// OwnerNilKind is the name of the type used to nil references +// to objects of type 'owner'. +const OwnerNilKind = "OwnerNil" + +// Owner represents the values of the 'owner' type. +// +// Definition of a Status Board owner. +type Owner struct { + bitmap_ uint32 + id string + href string + email string + username string +} + +// Kind returns the name of the type of the object. +func (o *Owner) Kind() string { + if o == nil { + return OwnerNilKind + } + if o.bitmap_&1 != 0 { + return OwnerLinkKind + } + return OwnerKind +} + +// Link returns true if this is a link. +func (o *Owner) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Owner) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Owner) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Owner) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Owner) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Owner) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Email returns the value of the 'email' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The owner's email address. +func (o *Owner) Email() string { + if o != nil && o.bitmap_&8 != 0 { + return o.email + } + return "" +} + +// GetEmail returns the value of the 'email' attribute and +// a flag indicating if the attribute has a value. +// +// The owner's email address. +func (o *Owner) GetEmail() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.email + } + return +} + +// Username returns the value of the 'username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The owner's username. +func (o *Owner) Username() string { + if o != nil && o.bitmap_&16 != 0 { + return o.username + } + return "" +} + +// GetUsername returns the value of the 'username' attribute and +// a flag indicating if the attribute has a value. +// +// The owner's username. +func (o *Owner) GetUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.username + } + return +} + +// OwnerListKind is the name of the type used to represent list of objects of +// type 'owner'. +const OwnerListKind = "OwnerList" + +// OwnerListLinkKind is the name of the type used to represent links to list +// of objects of type 'owner'. +const OwnerListLinkKind = "OwnerListLink" + +// OwnerNilKind is the name of the type used to nil lists of objects of +// type 'owner'. +const OwnerListNilKind = "OwnerListNil" + +// OwnerList is a list of values of the 'owner' type. +type OwnerList struct { + href string + link bool + items []*Owner +} + +// Kind returns the name of the type of the object. +func (l *OwnerList) Kind() string { + if l == nil { + return OwnerListNilKind + } + if l.link { + return OwnerListLinkKind + } + return OwnerListKind +} + +// Link returns true iif this is a link. +func (l *OwnerList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *OwnerList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *OwnerList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *OwnerList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *OwnerList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *OwnerList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *OwnerList) SetItems(items []*Owner) { + l.items = items +} + +// Items returns the items of the list. +func (l *OwnerList) Items() []*Owner { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *OwnerList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *OwnerList) Get(i int) *Owner { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *OwnerList) Slice() []*Owner { + var slice []*Owner + if l == nil { + slice = make([]*Owner, 0) + } else { + slice = make([]*Owner, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *OwnerList) Each(f func(item *Owner) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *OwnerList) Range(f func(index int, item *Owner) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/statusboard/v1/owner_type_json.go b/clientapi/statusboard/v1/owner_type_json.go new file mode 100644 index 00000000..a4401ef3 --- /dev/null +++ b/clientapi/statusboard/v1/owner_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalOwner writes a value of the 'owner' type to the given writer. +func MarshalOwner(object *Owner, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteOwner(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteOwner writes a value of the 'owner' type to the given stream. +func WriteOwner(object *Owner, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(OwnerLinkKind) + } else { + stream.WriteString(OwnerKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("email") + stream.WriteString(object.email) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("username") + stream.WriteString(object.username) + } + stream.WriteObjectEnd() +} + +// UnmarshalOwner reads a value of the 'owner' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalOwner(source interface{}) (object *Owner, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadOwner(iterator) + err = iterator.Error + return +} + +// ReadOwner reads a value of the 'owner' type from the given iterator. +func ReadOwner(iterator *jsoniter.Iterator) *Owner { + object := &Owner{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == OwnerLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "email": + value := iterator.ReadString() + object.email = value + object.bitmap_ |= 8 + case "username": + value := iterator.ReadString() + object.username = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/statusboard/v1/peer_dependency_builder.go b/clientapi/statusboard/v1/peer_dependency_builder.go new file mode 100644 index 00000000..05b1e58c --- /dev/null +++ b/clientapi/statusboard/v1/peer_dependency_builder.go @@ -0,0 +1,175 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// PeerDependencyBuilder contains the data and logic needed to build 'peer_dependency' objects. +// +// Definition of a Status Board peer dependency. +type PeerDependencyBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + metadata interface{} + name string + owners []*OwnerBuilder + services []*ServiceBuilder + updatedAt time.Time +} + +// NewPeerDependency creates a new builder of 'peer_dependency' objects. +func NewPeerDependency() *PeerDependencyBuilder { + return &PeerDependencyBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *PeerDependencyBuilder) Link(value bool) *PeerDependencyBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *PeerDependencyBuilder) ID(value string) *PeerDependencyBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *PeerDependencyBuilder) HREF(value string) *PeerDependencyBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *PeerDependencyBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *PeerDependencyBuilder) CreatedAt(value time.Time) *PeerDependencyBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// Metadata sets the value of the 'metadata' attribute to the given value. +func (b *PeerDependencyBuilder) Metadata(value interface{}) *PeerDependencyBuilder { + b.metadata = value + b.bitmap_ |= 16 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *PeerDependencyBuilder) Name(value string) *PeerDependencyBuilder { + b.name = value + b.bitmap_ |= 32 + return b +} + +// Owners sets the value of the 'owners' attribute to the given values. +func (b *PeerDependencyBuilder) Owners(values ...*OwnerBuilder) *PeerDependencyBuilder { + b.owners = make([]*OwnerBuilder, len(values)) + copy(b.owners, values) + b.bitmap_ |= 64 + return b +} + +// Services sets the value of the 'services' attribute to the given values. +func (b *PeerDependencyBuilder) Services(values ...*ServiceBuilder) *PeerDependencyBuilder { + b.services = make([]*ServiceBuilder, len(values)) + copy(b.services, values) + b.bitmap_ |= 128 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *PeerDependencyBuilder) UpdatedAt(value time.Time) *PeerDependencyBuilder { + b.updatedAt = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *PeerDependencyBuilder) Copy(object *PeerDependency) *PeerDependencyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.metadata = object.metadata + b.name = object.name + if object.owners != nil { + b.owners = make([]*OwnerBuilder, len(object.owners)) + for i, v := range object.owners { + b.owners[i] = NewOwner().Copy(v) + } + } else { + b.owners = nil + } + if object.services != nil { + b.services = make([]*ServiceBuilder, len(object.services)) + for i, v := range object.services { + b.services[i] = NewService().Copy(v) + } + } else { + b.services = nil + } + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'peer_dependency' object using the configuration stored in the builder. +func (b *PeerDependencyBuilder) Build() (object *PeerDependency, err error) { + object = new(PeerDependency) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.metadata = b.metadata + object.name = b.name + if b.owners != nil { + object.owners = make([]*Owner, len(b.owners)) + for i, v := range b.owners { + object.owners[i], err = v.Build() + if err != nil { + return + } + } + } + if b.services != nil { + object.services = make([]*Service, len(b.services)) + for i, v := range b.services { + object.services[i], err = v.Build() + if err != nil { + return + } + } + } + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/statusboard/v1/peer_dependency_list_builder.go b/clientapi/statusboard/v1/peer_dependency_list_builder.go new file mode 100644 index 00000000..4fd10a07 --- /dev/null +++ b/clientapi/statusboard/v1/peer_dependency_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// PeerDependencyListBuilder contains the data and logic needed to build +// 'peer_dependency' objects. +type PeerDependencyListBuilder struct { + items []*PeerDependencyBuilder +} + +// NewPeerDependencyList creates a new builder of 'peer_dependency' objects. +func NewPeerDependencyList() *PeerDependencyListBuilder { + return new(PeerDependencyListBuilder) +} + +// Items sets the items of the list. +func (b *PeerDependencyListBuilder) Items(values ...*PeerDependencyBuilder) *PeerDependencyListBuilder { + b.items = make([]*PeerDependencyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *PeerDependencyListBuilder) 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 *PeerDependencyListBuilder) Copy(list *PeerDependencyList) *PeerDependencyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*PeerDependencyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewPeerDependency().Copy(v) + } + } + return b +} + +// Build creates a list of 'peer_dependency' objects using the +// configuration stored in the builder. +func (b *PeerDependencyListBuilder) Build() (list *PeerDependencyList, err error) { + items := make([]*PeerDependency, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(PeerDependencyList) + list.items = items + return +} diff --git a/clientapi/statusboard/v1/peer_dependency_list_type_json.go b/clientapi/statusboard/v1/peer_dependency_list_type_json.go new file mode 100644 index 00000000..fe17273a --- /dev/null +++ b/clientapi/statusboard/v1/peer_dependency_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPeerDependencyList writes a list of values of the 'peer_dependency' type to +// the given writer. +func MarshalPeerDependencyList(list []*PeerDependency, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePeerDependencyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePeerDependencyList writes a list of value of the 'peer_dependency' type to +// the given stream. +func WritePeerDependencyList(list []*PeerDependency, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WritePeerDependency(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalPeerDependencyList reads a list of values of the 'peer_dependency' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalPeerDependencyList(source interface{}) (items []*PeerDependency, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadPeerDependencyList(iterator) + err = iterator.Error + return +} + +// ReadPeerDependencyList reads list of values of the ”peer_dependency' type from +// the given iterator. +func ReadPeerDependencyList(iterator *jsoniter.Iterator) []*PeerDependency { + list := []*PeerDependency{} + for iterator.ReadArray() { + item := ReadPeerDependency(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/peer_dependency_type.go b/clientapi/statusboard/v1/peer_dependency_type.go new file mode 100644 index 00000000..ecf5f1ec --- /dev/null +++ b/clientapi/statusboard/v1/peer_dependency_type.go @@ -0,0 +1,389 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// PeerDependencyKind is the name of the type used to represent objects +// of type 'peer_dependency'. +const PeerDependencyKind = "PeerDependency" + +// PeerDependencyLinkKind is the name of the type used to represent links +// to objects of type 'peer_dependency'. +const PeerDependencyLinkKind = "PeerDependencyLink" + +// PeerDependencyNilKind is the name of the type used to nil references +// to objects of type 'peer_dependency'. +const PeerDependencyNilKind = "PeerDependencyNil" + +// PeerDependency represents the values of the 'peer_dependency' type. +// +// Definition of a Status Board peer dependency. +type PeerDependency struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + metadata interface{} + name string + owners []*Owner + services []*Service + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *PeerDependency) Kind() string { + if o == nil { + return PeerDependencyNilKind + } + if o.bitmap_&1 != 0 { + return PeerDependencyLinkKind + } + return PeerDependencyKind +} + +// Link returns true if this is a link. +func (o *PeerDependency) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *PeerDependency) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *PeerDependency) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *PeerDependency) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *PeerDependency) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *PeerDependency) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *PeerDependency) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *PeerDependency) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// Metadata returns the value of the 'metadata' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Miscellaneous metadata about the peer dependency. +func (o *PeerDependency) Metadata() interface{} { + if o != nil && o.bitmap_&16 != 0 { + return o.metadata + } + return nil +} + +// GetMetadata returns the value of the 'metadata' attribute and +// a flag indicating if the attribute has a value. +// +// Miscellaneous metadata about the peer dependency. +func (o *PeerDependency) GetMetadata() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.metadata + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the peer dependency. +func (o *PeerDependency) Name() string { + if o != nil && o.bitmap_&32 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the peer dependency. +func (o *PeerDependency) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.name + } + return +} + +// Owners returns the value of the 'owners' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The peer dependency owners (name and email) +func (o *PeerDependency) Owners() []*Owner { + if o != nil && o.bitmap_&64 != 0 { + return o.owners + } + return nil +} + +// GetOwners returns the value of the 'owners' attribute and +// a flag indicating if the attribute has a value. +// +// The peer dependency owners (name and email) +func (o *PeerDependency) GetOwners() (value []*Owner, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.owners + } + return +} + +// Services returns the value of the 'services' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Services associated with the peer dependency. +func (o *PeerDependency) Services() []*Service { + if o != nil && o.bitmap_&128 != 0 { + return o.services + } + return nil +} + +// GetServices returns the value of the 'services' attribute and +// a flag indicating if the attribute has a value. +// +// Services associated with the peer dependency. +func (o *PeerDependency) GetServices() (value []*Service, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.services + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *PeerDependency) UpdatedAt() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *PeerDependency) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.updatedAt + } + return +} + +// PeerDependencyListKind is the name of the type used to represent list of objects of +// type 'peer_dependency'. +const PeerDependencyListKind = "PeerDependencyList" + +// PeerDependencyListLinkKind is the name of the type used to represent links to list +// of objects of type 'peer_dependency'. +const PeerDependencyListLinkKind = "PeerDependencyListLink" + +// PeerDependencyNilKind is the name of the type used to nil lists of objects of +// type 'peer_dependency'. +const PeerDependencyListNilKind = "PeerDependencyListNil" + +// PeerDependencyList is a list of values of the 'peer_dependency' type. +type PeerDependencyList struct { + href string + link bool + items []*PeerDependency +} + +// Kind returns the name of the type of the object. +func (l *PeerDependencyList) Kind() string { + if l == nil { + return PeerDependencyListNilKind + } + if l.link { + return PeerDependencyListLinkKind + } + return PeerDependencyListKind +} + +// Link returns true iif this is a link. +func (l *PeerDependencyList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *PeerDependencyList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *PeerDependencyList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *PeerDependencyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *PeerDependencyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *PeerDependencyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *PeerDependencyList) SetItems(items []*PeerDependency) { + l.items = items +} + +// Items returns the items of the list. +func (l *PeerDependencyList) Items() []*PeerDependency { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *PeerDependencyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *PeerDependencyList) Get(i int) *PeerDependency { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *PeerDependencyList) Slice() []*PeerDependency { + var slice []*PeerDependency + if l == nil { + slice = make([]*PeerDependency, 0) + } else { + slice = make([]*PeerDependency, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *PeerDependencyList) Each(f func(item *PeerDependency) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *PeerDependencyList) Range(f func(index int, item *PeerDependency) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/statusboard/v1/peer_dependency_type_json.go b/clientapi/statusboard/v1/peer_dependency_type_json.go new file mode 100644 index 00000000..077c8fb2 --- /dev/null +++ b/clientapi/statusboard/v1/peer_dependency_type_json.go @@ -0,0 +1,195 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalPeerDependency writes a value of the 'peer_dependency' type to the given writer. +func MarshalPeerDependency(object *PeerDependency, writer io.Writer) error { + stream := helpers.NewStream(writer) + WritePeerDependency(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WritePeerDependency writes a value of the 'peer_dependency' type to the given stream. +func WritePeerDependency(object *PeerDependency, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(PeerDependencyLinkKind) + } else { + stream.WriteString(PeerDependencyKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("metadata") + stream.WriteVal(object.metadata) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&64 != 0 && object.owners != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("owners") + WriteOwnerList(object.owners, stream) + count++ + } + present_ = object.bitmap_&128 != 0 && object.services != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("services") + WriteServiceList(object.services, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalPeerDependency reads a value of the 'peer_dependency' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalPeerDependency(source interface{}) (object *PeerDependency, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadPeerDependency(iterator) + err = iterator.Error + return +} + +// ReadPeerDependency reads a value of the 'peer_dependency' type from the given iterator. +func ReadPeerDependency(iterator *jsoniter.Iterator) *PeerDependency { + object := &PeerDependency{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == PeerDependencyLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "metadata": + var value interface{} + iterator.ReadVal(&value) + object.metadata = value + object.bitmap_ |= 16 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 32 + case "owners": + value := ReadOwnerList(iterator) + object.owners = value + object.bitmap_ |= 64 + case "services": + value := ReadServiceList(iterator) + object.services = value + object.bitmap_ |= 128 + 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_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/statusboard/v1/product_builder.go b/clientapi/statusboard/v1/product_builder.go new file mode 100644 index 00000000..529b4ef4 --- /dev/null +++ b/clientapi/statusboard/v1/product_builder.go @@ -0,0 +1,159 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// ProductBuilder contains the data and logic needed to build 'product' objects. +// +// Definition of a Status Board product. +type ProductBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + fullname string + metadata interface{} + name string + owners []*OwnerBuilder + updatedAt time.Time +} + +// NewProduct creates a new builder of 'product' objects. +func NewProduct() *ProductBuilder { + return &ProductBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ProductBuilder) Link(value bool) *ProductBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ProductBuilder) ID(value string) *ProductBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ProductBuilder) HREF(value string) *ProductBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ProductBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *ProductBuilder) CreatedAt(value time.Time) *ProductBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// Fullname sets the value of the 'fullname' attribute to the given value. +func (b *ProductBuilder) Fullname(value string) *ProductBuilder { + b.fullname = value + b.bitmap_ |= 16 + return b +} + +// Metadata sets the value of the 'metadata' attribute to the given value. +func (b *ProductBuilder) Metadata(value interface{}) *ProductBuilder { + b.metadata = value + b.bitmap_ |= 32 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ProductBuilder) Name(value string) *ProductBuilder { + b.name = value + b.bitmap_ |= 64 + return b +} + +// Owners sets the value of the 'owners' attribute to the given values. +func (b *ProductBuilder) Owners(values ...*OwnerBuilder) *ProductBuilder { + b.owners = make([]*OwnerBuilder, len(values)) + copy(b.owners, values) + b.bitmap_ |= 128 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *ProductBuilder) UpdatedAt(value time.Time) *ProductBuilder { + b.updatedAt = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ProductBuilder) Copy(object *Product) *ProductBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.fullname = object.fullname + b.metadata = object.metadata + b.name = object.name + if object.owners != nil { + b.owners = make([]*OwnerBuilder, len(object.owners)) + for i, v := range object.owners { + b.owners[i] = NewOwner().Copy(v) + } + } else { + b.owners = nil + } + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'product' object using the configuration stored in the builder. +func (b *ProductBuilder) Build() (object *Product, err error) { + object = new(Product) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.fullname = b.fullname + object.metadata = b.metadata + object.name = b.name + if b.owners != nil { + object.owners = make([]*Owner, len(b.owners)) + for i, v := range b.owners { + object.owners[i], err = v.Build() + if err != nil { + return + } + } + } + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/statusboard/v1/product_list_builder.go b/clientapi/statusboard/v1/product_list_builder.go new file mode 100644 index 00000000..066c8c49 --- /dev/null +++ b/clientapi/statusboard/v1/product_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// ProductListBuilder contains the data and logic needed to build +// 'product' objects. +type ProductListBuilder struct { + items []*ProductBuilder +} + +// NewProductList creates a new builder of 'product' objects. +func NewProductList() *ProductListBuilder { + return new(ProductListBuilder) +} + +// Items sets the items of the list. +func (b *ProductListBuilder) Items(values ...*ProductBuilder) *ProductListBuilder { + b.items = make([]*ProductBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ProductListBuilder) 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 *ProductListBuilder) Copy(list *ProductList) *ProductListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ProductBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewProduct().Copy(v) + } + } + return b +} + +// Build creates a list of 'product' objects using the +// configuration stored in the builder. +func (b *ProductListBuilder) Build() (list *ProductList, err error) { + items := make([]*Product, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ProductList) + list.items = items + return +} diff --git a/clientapi/statusboard/v1/product_list_type_json.go b/clientapi/statusboard/v1/product_list_type_json.go new file mode 100644 index 00000000..fb3f1688 --- /dev/null +++ b/clientapi/statusboard/v1/product_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProductList writes a list of values of the 'product' type to +// the given writer. +func MarshalProductList(list []*Product, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProductList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProductList writes a list of value of the 'product' type to +// the given stream. +func WriteProductList(list []*Product, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteProduct(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalProductList reads a list of values of the 'product' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProductList(source interface{}) (items []*Product, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProductList(iterator) + err = iterator.Error + return +} + +// ReadProductList reads list of values of the ”product' type from +// the given iterator. +func ReadProductList(iterator *jsoniter.Iterator) []*Product { + list := []*Product{} + for iterator.ReadArray() { + item := ReadProduct(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/product_type.go b/clientapi/statusboard/v1/product_type.go new file mode 100644 index 00000000..9a83e97a --- /dev/null +++ b/clientapi/statusboard/v1/product_type.go @@ -0,0 +1,389 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// ProductKind is the name of the type used to represent objects +// of type 'product'. +const ProductKind = "Product" + +// ProductLinkKind is the name of the type used to represent links +// to objects of type 'product'. +const ProductLinkKind = "ProductLink" + +// ProductNilKind is the name of the type used to nil references +// to objects of type 'product'. +const ProductNilKind = "ProductNil" + +// Product represents the values of the 'product' type. +// +// Definition of a Status Board product. +type Product struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + fullname string + metadata interface{} + name string + owners []*Owner + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *Product) Kind() string { + if o == nil { + return ProductNilKind + } + if o.bitmap_&1 != 0 { + return ProductLinkKind + } + return ProductKind +} + +// Link returns true if this is a link. +func (o *Product) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Product) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Product) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Product) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Product) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Product) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *Product) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *Product) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// Fullname returns the value of the 'fullname' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The fullname of the product. +func (o *Product) Fullname() string { + if o != nil && o.bitmap_&16 != 0 { + return o.fullname + } + return "" +} + +// GetFullname returns the value of the 'fullname' attribute and +// a flag indicating if the attribute has a value. +// +// The fullname of the product. +func (o *Product) GetFullname() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.fullname + } + return +} + +// Metadata returns the value of the 'metadata' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Miscellaneous data about the product. +func (o *Product) Metadata() interface{} { + if o != nil && o.bitmap_&32 != 0 { + return o.metadata + } + return nil +} + +// GetMetadata returns the value of the 'metadata' attribute and +// a flag indicating if the attribute has a value. +// +// Miscellaneous data about the product. +func (o *Product) GetMetadata() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.metadata + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the product. +func (o *Product) Name() string { + if o != nil && o.bitmap_&64 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the product. +func (o *Product) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.name + } + return +} + +// Owners returns the value of the 'owners' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The product owners (name and email). +func (o *Product) Owners() []*Owner { + if o != nil && o.bitmap_&128 != 0 { + return o.owners + } + return nil +} + +// GetOwners returns the value of the 'owners' attribute and +// a flag indicating if the attribute has a value. +// +// The product owners (name and email). +func (o *Product) GetOwners() (value []*Owner, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.owners + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *Product) UpdatedAt() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *Product) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.updatedAt + } + return +} + +// ProductListKind is the name of the type used to represent list of objects of +// type 'product'. +const ProductListKind = "ProductList" + +// ProductListLinkKind is the name of the type used to represent links to list +// of objects of type 'product'. +const ProductListLinkKind = "ProductListLink" + +// ProductNilKind is the name of the type used to nil lists of objects of +// type 'product'. +const ProductListNilKind = "ProductListNil" + +// ProductList is a list of values of the 'product' type. +type ProductList struct { + href string + link bool + items []*Product +} + +// Kind returns the name of the type of the object. +func (l *ProductList) Kind() string { + if l == nil { + return ProductListNilKind + } + if l.link { + return ProductListLinkKind + } + return ProductListKind +} + +// Link returns true iif this is a link. +func (l *ProductList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ProductList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ProductList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ProductList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ProductList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ProductList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ProductList) SetItems(items []*Product) { + l.items = items +} + +// Items returns the items of the list. +func (l *ProductList) Items() []*Product { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ProductList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ProductList) Get(i int) *Product { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ProductList) Slice() []*Product { + var slice []*Product + if l == nil { + slice = make([]*Product, 0) + } else { + slice = make([]*Product, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ProductList) Each(f func(item *Product) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ProductList) Range(f func(index int, item *Product) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/statusboard/v1/product_type_json.go b/clientapi/statusboard/v1/product_type_json.go new file mode 100644 index 00000000..d120023c --- /dev/null +++ b/clientapi/statusboard/v1/product_type_json.go @@ -0,0 +1,195 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProduct writes a value of the 'product' type to the given writer. +func MarshalProduct(object *Product, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProduct(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProduct writes a value of the 'product' type to the given stream. +func WriteProduct(object *Product, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ProductLinkKind) + } else { + stream.WriteString(ProductKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("fullname") + stream.WriteString(object.fullname) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("metadata") + stream.WriteVal(object.metadata) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&128 != 0 && object.owners != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("owners") + WriteOwnerList(object.owners, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalProduct reads a value of the 'product' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalProduct(source interface{}) (object *Product, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadProduct(iterator) + err = iterator.Error + return +} + +// ReadProduct reads a value of the 'product' type from the given iterator. +func ReadProduct(iterator *jsoniter.Iterator) *Product { + object := &Product{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ProductLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "fullname": + value := iterator.ReadString() + object.fullname = value + object.bitmap_ |= 16 + case "metadata": + var value interface{} + iterator.ReadVal(&value) + object.metadata = value + object.bitmap_ |= 32 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 64 + case "owners": + value := ReadOwnerList(iterator) + object.owners = value + object.bitmap_ |= 128 + 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_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/statusboard/v1/service_builder.go b/clientapi/statusboard/v1/service_builder.go new file mode 100644 index 00000000..f406c7a3 --- /dev/null +++ b/clientapi/statusboard/v1/service_builder.go @@ -0,0 +1,254 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// ServiceBuilder contains the data and logic needed to build 'service' objects. +// +// Definition of a Status Board Service. +type ServiceBuilder struct { + bitmap_ uint32 + id string + href string + application *ApplicationBuilder + createdAt time.Time + currentStatus string + fullname string + lastPingAt time.Time + metadata interface{} + name string + owners []*OwnerBuilder + serviceEndpoint string + statusType string + statusUpdatedAt time.Time + token string + updatedAt time.Time + private bool +} + +// NewService creates a new builder of 'service' objects. +func NewService() *ServiceBuilder { + return &ServiceBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ServiceBuilder) Link(value bool) *ServiceBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ServiceBuilder) ID(value string) *ServiceBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ServiceBuilder) HREF(value string) *ServiceBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ServiceBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Application sets the value of the 'application' attribute to the given value. +// +// Definition of a Status Board application. +func (b *ServiceBuilder) Application(value *ApplicationBuilder) *ServiceBuilder { + b.application = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *ServiceBuilder) CreatedAt(value time.Time) *ServiceBuilder { + b.createdAt = value + b.bitmap_ |= 16 + return b +} + +// CurrentStatus sets the value of the 'current_status' attribute to the given value. +func (b *ServiceBuilder) CurrentStatus(value string) *ServiceBuilder { + b.currentStatus = value + b.bitmap_ |= 32 + return b +} + +// Fullname sets the value of the 'fullname' attribute to the given value. +func (b *ServiceBuilder) Fullname(value string) *ServiceBuilder { + b.fullname = value + b.bitmap_ |= 64 + return b +} + +// LastPingAt sets the value of the 'last_ping_at' attribute to the given value. +func (b *ServiceBuilder) LastPingAt(value time.Time) *ServiceBuilder { + b.lastPingAt = value + b.bitmap_ |= 128 + return b +} + +// Metadata sets the value of the 'metadata' attribute to the given value. +func (b *ServiceBuilder) Metadata(value interface{}) *ServiceBuilder { + b.metadata = value + b.bitmap_ |= 256 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ServiceBuilder) Name(value string) *ServiceBuilder { + b.name = value + b.bitmap_ |= 512 + return b +} + +// Owners sets the value of the 'owners' attribute to the given values. +func (b *ServiceBuilder) Owners(values ...*OwnerBuilder) *ServiceBuilder { + b.owners = make([]*OwnerBuilder, len(values)) + copy(b.owners, values) + b.bitmap_ |= 1024 + return b +} + +// Private sets the value of the 'private' attribute to the given value. +func (b *ServiceBuilder) Private(value bool) *ServiceBuilder { + b.private = value + b.bitmap_ |= 2048 + return b +} + +// ServiceEndpoint sets the value of the 'service_endpoint' attribute to the given value. +func (b *ServiceBuilder) ServiceEndpoint(value string) *ServiceBuilder { + b.serviceEndpoint = value + b.bitmap_ |= 4096 + return b +} + +// StatusType sets the value of the 'status_type' attribute to the given value. +func (b *ServiceBuilder) StatusType(value string) *ServiceBuilder { + b.statusType = value + b.bitmap_ |= 8192 + return b +} + +// StatusUpdatedAt sets the value of the 'status_updated_at' attribute to the given value. +func (b *ServiceBuilder) StatusUpdatedAt(value time.Time) *ServiceBuilder { + b.statusUpdatedAt = value + b.bitmap_ |= 16384 + return b +} + +// Token sets the value of the 'token' attribute to the given value. +func (b *ServiceBuilder) Token(value string) *ServiceBuilder { + b.token = value + b.bitmap_ |= 32768 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *ServiceBuilder) UpdatedAt(value time.Time) *ServiceBuilder { + b.updatedAt = value + b.bitmap_ |= 65536 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ServiceBuilder) Copy(object *Service) *ServiceBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.application != nil { + b.application = NewApplication().Copy(object.application) + } else { + b.application = nil + } + b.createdAt = object.createdAt + b.currentStatus = object.currentStatus + b.fullname = object.fullname + b.lastPingAt = object.lastPingAt + b.metadata = object.metadata + b.name = object.name + if object.owners != nil { + b.owners = make([]*OwnerBuilder, len(object.owners)) + for i, v := range object.owners { + b.owners[i] = NewOwner().Copy(v) + } + } else { + b.owners = nil + } + b.private = object.private + b.serviceEndpoint = object.serviceEndpoint + b.statusType = object.statusType + b.statusUpdatedAt = object.statusUpdatedAt + b.token = object.token + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'service' object using the configuration stored in the builder. +func (b *ServiceBuilder) Build() (object *Service, err error) { + object = new(Service) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.application != nil { + object.application, err = b.application.Build() + if err != nil { + return + } + } + object.createdAt = b.createdAt + object.currentStatus = b.currentStatus + object.fullname = b.fullname + object.lastPingAt = b.lastPingAt + object.metadata = b.metadata + object.name = b.name + if b.owners != nil { + object.owners = make([]*Owner, len(b.owners)) + for i, v := range b.owners { + object.owners[i], err = v.Build() + if err != nil { + return + } + } + } + object.private = b.private + object.serviceEndpoint = b.serviceEndpoint + object.statusType = b.statusType + object.statusUpdatedAt = b.statusUpdatedAt + object.token = b.token + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/statusboard/v1/service_dependency_builder.go b/clientapi/statusboard/v1/service_dependency_builder.go new file mode 100644 index 00000000..9d7fa88f --- /dev/null +++ b/clientapi/statusboard/v1/service_dependency_builder.go @@ -0,0 +1,209 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// ServiceDependencyBuilder contains the data and logic needed to build 'service_dependency' objects. +// +// Definition of a Status Board service dependency. +type ServiceDependencyBuilder struct { + bitmap_ uint32 + id string + href string + childService *ServiceBuilder + createdAt time.Time + metadata interface{} + name string + owners []*OwnerBuilder + parentService *ServiceBuilder + type_ string + updatedAt time.Time +} + +// NewServiceDependency creates a new builder of 'service_dependency' objects. +func NewServiceDependency() *ServiceDependencyBuilder { + return &ServiceDependencyBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ServiceDependencyBuilder) Link(value bool) *ServiceDependencyBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ServiceDependencyBuilder) ID(value string) *ServiceDependencyBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ServiceDependencyBuilder) HREF(value string) *ServiceDependencyBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ServiceDependencyBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// ChildService sets the value of the 'child_service' attribute to the given value. +// +// Definition of a Status Board Service. +func (b *ServiceDependencyBuilder) ChildService(value *ServiceBuilder) *ServiceDependencyBuilder { + b.childService = value + if value != nil { + b.bitmap_ |= 8 + } else { + b.bitmap_ &^= 8 + } + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *ServiceDependencyBuilder) CreatedAt(value time.Time) *ServiceDependencyBuilder { + b.createdAt = value + b.bitmap_ |= 16 + return b +} + +// Metadata sets the value of the 'metadata' attribute to the given value. +func (b *ServiceDependencyBuilder) Metadata(value interface{}) *ServiceDependencyBuilder { + b.metadata = value + b.bitmap_ |= 32 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *ServiceDependencyBuilder) Name(value string) *ServiceDependencyBuilder { + b.name = value + b.bitmap_ |= 64 + return b +} + +// Owners sets the value of the 'owners' attribute to the given values. +func (b *ServiceDependencyBuilder) Owners(values ...*OwnerBuilder) *ServiceDependencyBuilder { + b.owners = make([]*OwnerBuilder, len(values)) + copy(b.owners, values) + b.bitmap_ |= 128 + return b +} + +// ParentService sets the value of the 'parent_service' attribute to the given value. +// +// Definition of a Status Board Service. +func (b *ServiceDependencyBuilder) ParentService(value *ServiceBuilder) *ServiceDependencyBuilder { + b.parentService = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// Type sets the value of the 'type' attribute to the given value. +func (b *ServiceDependencyBuilder) Type(value string) *ServiceDependencyBuilder { + b.type_ = value + b.bitmap_ |= 512 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *ServiceDependencyBuilder) UpdatedAt(value time.Time) *ServiceDependencyBuilder { + b.updatedAt = value + b.bitmap_ |= 1024 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ServiceDependencyBuilder) Copy(object *ServiceDependency) *ServiceDependencyBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + if object.childService != nil { + b.childService = NewService().Copy(object.childService) + } else { + b.childService = nil + } + b.createdAt = object.createdAt + b.metadata = object.metadata + b.name = object.name + if object.owners != nil { + b.owners = make([]*OwnerBuilder, len(object.owners)) + for i, v := range object.owners { + b.owners[i] = NewOwner().Copy(v) + } + } else { + b.owners = nil + } + if object.parentService != nil { + b.parentService = NewService().Copy(object.parentService) + } else { + b.parentService = nil + } + b.type_ = object.type_ + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'service_dependency' object using the configuration stored in the builder. +func (b *ServiceDependencyBuilder) Build() (object *ServiceDependency, err error) { + object = new(ServiceDependency) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + if b.childService != nil { + object.childService, err = b.childService.Build() + if err != nil { + return + } + } + object.createdAt = b.createdAt + object.metadata = b.metadata + object.name = b.name + if b.owners != nil { + object.owners = make([]*Owner, len(b.owners)) + for i, v := range b.owners { + object.owners[i], err = v.Build() + if err != nil { + return + } + } + } + if b.parentService != nil { + object.parentService, err = b.parentService.Build() + if err != nil { + return + } + } + object.type_ = b.type_ + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/statusboard/v1/service_dependency_list_builder.go b/clientapi/statusboard/v1/service_dependency_list_builder.go new file mode 100644 index 00000000..cc27bf1f --- /dev/null +++ b/clientapi/statusboard/v1/service_dependency_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// ServiceDependencyListBuilder contains the data and logic needed to build +// 'service_dependency' objects. +type ServiceDependencyListBuilder struct { + items []*ServiceDependencyBuilder +} + +// NewServiceDependencyList creates a new builder of 'service_dependency' objects. +func NewServiceDependencyList() *ServiceDependencyListBuilder { + return new(ServiceDependencyListBuilder) +} + +// Items sets the items of the list. +func (b *ServiceDependencyListBuilder) Items(values ...*ServiceDependencyBuilder) *ServiceDependencyListBuilder { + b.items = make([]*ServiceDependencyBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ServiceDependencyListBuilder) 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 *ServiceDependencyListBuilder) Copy(list *ServiceDependencyList) *ServiceDependencyListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ServiceDependencyBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewServiceDependency().Copy(v) + } + } + return b +} + +// Build creates a list of 'service_dependency' objects using the +// configuration stored in the builder. +func (b *ServiceDependencyListBuilder) Build() (list *ServiceDependencyList, err error) { + items := make([]*ServiceDependency, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ServiceDependencyList) + list.items = items + return +} diff --git a/clientapi/statusboard/v1/service_dependency_list_type_json.go b/clientapi/statusboard/v1/service_dependency_list_type_json.go new file mode 100644 index 00000000..20eba608 --- /dev/null +++ b/clientapi/statusboard/v1/service_dependency_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalServiceDependencyList writes a list of values of the 'service_dependency' type to +// the given writer. +func MarshalServiceDependencyList(list []*ServiceDependency, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServiceDependencyList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServiceDependencyList writes a list of value of the 'service_dependency' type to +// the given stream. +func WriteServiceDependencyList(list []*ServiceDependency, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteServiceDependency(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalServiceDependencyList reads a list of values of the 'service_dependency' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalServiceDependencyList(source interface{}) (items []*ServiceDependency, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadServiceDependencyList(iterator) + err = iterator.Error + return +} + +// ReadServiceDependencyList reads list of values of the ”service_dependency' type from +// the given iterator. +func ReadServiceDependencyList(iterator *jsoniter.Iterator) []*ServiceDependency { + list := []*ServiceDependency{} + for iterator.ReadArray() { + item := ReadServiceDependency(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/service_dependency_type.go b/clientapi/statusboard/v1/service_dependency_type.go new file mode 100644 index 00000000..0026f99c --- /dev/null +++ b/clientapi/statusboard/v1/service_dependency_type.go @@ -0,0 +1,437 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// ServiceDependencyKind is the name of the type used to represent objects +// of type 'service_dependency'. +const ServiceDependencyKind = "ServiceDependency" + +// ServiceDependencyLinkKind is the name of the type used to represent links +// to objects of type 'service_dependency'. +const ServiceDependencyLinkKind = "ServiceDependencyLink" + +// ServiceDependencyNilKind is the name of the type used to nil references +// to objects of type 'service_dependency'. +const ServiceDependencyNilKind = "ServiceDependencyNil" + +// ServiceDependency represents the values of the 'service_dependency' type. +// +// Definition of a Status Board service dependency. +type ServiceDependency struct { + bitmap_ uint32 + id string + href string + childService *Service + createdAt time.Time + metadata interface{} + name string + owners []*Owner + parentService *Service + type_ string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *ServiceDependency) Kind() string { + if o == nil { + return ServiceDependencyNilKind + } + if o.bitmap_&1 != 0 { + return ServiceDependencyLinkKind + } + return ServiceDependencyKind +} + +// Link returns true if this is a link. +func (o *ServiceDependency) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *ServiceDependency) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *ServiceDependency) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *ServiceDependency) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *ServiceDependency) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ServiceDependency) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// ChildService returns the value of the 'child_service' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The service dependency's child service +func (o *ServiceDependency) ChildService() *Service { + if o != nil && o.bitmap_&8 != 0 { + return o.childService + } + return nil +} + +// GetChildService returns the value of the 'child_service' attribute and +// a flag indicating if the attribute has a value. +// +// The service dependency's child service +func (o *ServiceDependency) GetChildService() (value *Service, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.childService + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *ServiceDependency) CreatedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *ServiceDependency) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.createdAt + } + return +} + +// Metadata returns the value of the 'metadata' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Miscellaneous metadata about the service dependency. +func (o *ServiceDependency) Metadata() interface{} { + if o != nil && o.bitmap_&32 != 0 { + return o.metadata + } + return nil +} + +// GetMetadata returns the value of the 'metadata' attribute and +// a flag indicating if the attribute has a value. +// +// Miscellaneous metadata about the service dependency. +func (o *ServiceDependency) GetMetadata() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.metadata + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the service dependency. +func (o *ServiceDependency) Name() string { + if o != nil && o.bitmap_&64 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the service dependency. +func (o *ServiceDependency) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.name + } + return +} + +// Owners returns the value of the 'owners' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The service dependency owners (name and email) +func (o *ServiceDependency) Owners() []*Owner { + if o != nil && o.bitmap_&128 != 0 { + return o.owners + } + return nil +} + +// GetOwners returns the value of the 'owners' attribute and +// a flag indicating if the attribute has a value. +// +// The service dependency owners (name and email) +func (o *ServiceDependency) GetOwners() (value []*Owner, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.owners + } + return +} + +// ParentService returns the value of the 'parent_service' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The service dependency's parent service +func (o *ServiceDependency) ParentService() *Service { + if o != nil && o.bitmap_&256 != 0 { + return o.parentService + } + return nil +} + +// GetParentService returns the value of the 'parent_service' attribute and +// a flag indicating if the attribute has a value. +// +// The service dependency's parent service +func (o *ServiceDependency) GetParentService() (value *Service, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.parentService + } + return +} + +// Type returns the value of the 'type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The type of service dependency, e.g. soft or hard. +func (o *ServiceDependency) Type() string { + if o != nil && o.bitmap_&512 != 0 { + return o.type_ + } + return "" +} + +// GetType returns the value of the 'type' attribute and +// a flag indicating if the attribute has a value. +// +// The type of service dependency, e.g. soft or hard. +func (o *ServiceDependency) GetType() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.type_ + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *ServiceDependency) UpdatedAt() time.Time { + if o != nil && o.bitmap_&1024 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *ServiceDependency) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.updatedAt + } + return +} + +// ServiceDependencyListKind is the name of the type used to represent list of objects of +// type 'service_dependency'. +const ServiceDependencyListKind = "ServiceDependencyList" + +// ServiceDependencyListLinkKind is the name of the type used to represent links to list +// of objects of type 'service_dependency'. +const ServiceDependencyListLinkKind = "ServiceDependencyListLink" + +// ServiceDependencyNilKind is the name of the type used to nil lists of objects of +// type 'service_dependency'. +const ServiceDependencyListNilKind = "ServiceDependencyListNil" + +// ServiceDependencyList is a list of values of the 'service_dependency' type. +type ServiceDependencyList struct { + href string + link bool + items []*ServiceDependency +} + +// Kind returns the name of the type of the object. +func (l *ServiceDependencyList) Kind() string { + if l == nil { + return ServiceDependencyListNilKind + } + if l.link { + return ServiceDependencyListLinkKind + } + return ServiceDependencyListKind +} + +// Link returns true iif this is a link. +func (l *ServiceDependencyList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ServiceDependencyList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ServiceDependencyList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ServiceDependencyList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ServiceDependencyList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ServiceDependencyList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ServiceDependencyList) SetItems(items []*ServiceDependency) { + l.items = items +} + +// Items returns the items of the list. +func (l *ServiceDependencyList) Items() []*ServiceDependency { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ServiceDependencyList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ServiceDependencyList) Get(i int) *ServiceDependency { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ServiceDependencyList) Slice() []*ServiceDependency { + var slice []*ServiceDependency + if l == nil { + slice = make([]*ServiceDependency, 0) + } else { + slice = make([]*ServiceDependency, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ServiceDependencyList) Each(f func(item *ServiceDependency) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ServiceDependencyList) Range(f func(index int, item *ServiceDependency) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/statusboard/v1/service_dependency_type_json.go b/clientapi/statusboard/v1/service_dependency_type_json.go new file mode 100644 index 00000000..76e8dd46 --- /dev/null +++ b/clientapi/statusboard/v1/service_dependency_type_json.go @@ -0,0 +1,221 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalServiceDependency writes a value of the 'service_dependency' type to the given writer. +func MarshalServiceDependency(object *ServiceDependency, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServiceDependency(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServiceDependency writes a value of the 'service_dependency' type to the given stream. +func WriteServiceDependency(object *ServiceDependency, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ServiceDependencyLinkKind) + } else { + stream.WriteString(ServiceDependencyKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.childService != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("child_service") + WriteService(object.childService, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("metadata") + stream.WriteVal(object.metadata) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&128 != 0 && object.owners != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("owners") + WriteOwnerList(object.owners, stream) + count++ + } + present_ = object.bitmap_&256 != 0 && object.parentService != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("parent_service") + WriteService(object.parentService, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("type") + stream.WriteString(object.type_) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalServiceDependency reads a value of the 'service_dependency' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalServiceDependency(source interface{}) (object *ServiceDependency, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadServiceDependency(iterator) + err = iterator.Error + return +} + +// ReadServiceDependency reads a value of the 'service_dependency' type from the given iterator. +func ReadServiceDependency(iterator *jsoniter.Iterator) *ServiceDependency { + object := &ServiceDependency{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ServiceDependencyLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "child_service": + value := ReadService(iterator) + object.childService = value + object.bitmap_ |= 8 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 16 + case "metadata": + var value interface{} + iterator.ReadVal(&value) + object.metadata = value + object.bitmap_ |= 32 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 64 + case "owners": + value := ReadOwnerList(iterator) + object.owners = value + object.bitmap_ |= 128 + case "parent_service": + value := ReadService(iterator) + object.parentService = value + object.bitmap_ |= 256 + case "type": + value := iterator.ReadString() + object.type_ = value + 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_ |= 1024 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/statusboard/v1/service_info_builder.go b/clientapi/statusboard/v1/service_info_builder.go new file mode 100644 index 00000000..130b576f --- /dev/null +++ b/clientapi/statusboard/v1/service_info_builder.go @@ -0,0 +1,73 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// ServiceInfoBuilder contains the data and logic needed to build 'service_info' objects. +// +// Definition of a Status Board service info. +type ServiceInfoBuilder struct { + bitmap_ uint32 + fullname string + statusType string +} + +// NewServiceInfo creates a new builder of 'service_info' objects. +func NewServiceInfo() *ServiceInfoBuilder { + return &ServiceInfoBuilder{} +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ServiceInfoBuilder) Empty() bool { + return b == nil || b.bitmap_ == 0 +} + +// Fullname sets the value of the 'fullname' attribute to the given value. +func (b *ServiceInfoBuilder) Fullname(value string) *ServiceInfoBuilder { + b.fullname = value + b.bitmap_ |= 1 + return b +} + +// StatusType sets the value of the 'status_type' attribute to the given value. +func (b *ServiceInfoBuilder) StatusType(value string) *ServiceInfoBuilder { + b.statusType = value + b.bitmap_ |= 2 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ServiceInfoBuilder) Copy(object *ServiceInfo) *ServiceInfoBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.fullname = object.fullname + b.statusType = object.statusType + return b +} + +// Build creates a 'service_info' object using the configuration stored in the builder. +func (b *ServiceInfoBuilder) Build() (object *ServiceInfo, err error) { + object = new(ServiceInfo) + object.bitmap_ = b.bitmap_ + object.fullname = b.fullname + object.statusType = b.statusType + return +} diff --git a/clientapi/statusboard/v1/service_info_list_builder.go b/clientapi/statusboard/v1/service_info_list_builder.go new file mode 100644 index 00000000..c3f98841 --- /dev/null +++ b/clientapi/statusboard/v1/service_info_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// ServiceInfoListBuilder contains the data and logic needed to build +// 'service_info' objects. +type ServiceInfoListBuilder struct { + items []*ServiceInfoBuilder +} + +// NewServiceInfoList creates a new builder of 'service_info' objects. +func NewServiceInfoList() *ServiceInfoListBuilder { + return new(ServiceInfoListBuilder) +} + +// Items sets the items of the list. +func (b *ServiceInfoListBuilder) Items(values ...*ServiceInfoBuilder) *ServiceInfoListBuilder { + b.items = make([]*ServiceInfoBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ServiceInfoListBuilder) 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 *ServiceInfoListBuilder) Copy(list *ServiceInfoList) *ServiceInfoListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ServiceInfoBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewServiceInfo().Copy(v) + } + } + return b +} + +// Build creates a list of 'service_info' objects using the +// configuration stored in the builder. +func (b *ServiceInfoListBuilder) Build() (list *ServiceInfoList, err error) { + items := make([]*ServiceInfo, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ServiceInfoList) + list.items = items + return +} diff --git a/clientapi/statusboard/v1/service_info_list_type_json.go b/clientapi/statusboard/v1/service_info_list_type_json.go new file mode 100644 index 00000000..9f6520ef --- /dev/null +++ b/clientapi/statusboard/v1/service_info_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalServiceInfoList writes a list of values of the 'service_info' type to +// the given writer. +func MarshalServiceInfoList(list []*ServiceInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServiceInfoList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServiceInfoList writes a list of value of the 'service_info' type to +// the given stream. +func WriteServiceInfoList(list []*ServiceInfo, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteServiceInfo(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalServiceInfoList reads a list of values of the 'service_info' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalServiceInfoList(source interface{}) (items []*ServiceInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadServiceInfoList(iterator) + err = iterator.Error + return +} + +// ReadServiceInfoList reads list of values of the ”service_info' type from +// the given iterator. +func ReadServiceInfoList(iterator *jsoniter.Iterator) []*ServiceInfo { + list := []*ServiceInfo{} + for iterator.ReadArray() { + item := ReadServiceInfo(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/service_info_type.go b/clientapi/statusboard/v1/service_info_type.go new file mode 100644 index 00000000..a96efb7d --- /dev/null +++ b/clientapi/statusboard/v1/service_info_type.go @@ -0,0 +1,189 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// ServiceInfo represents the values of the 'service_info' type. +// +// Definition of a Status Board service info. +type ServiceInfo struct { + bitmap_ uint32 + fullname string + statusType string +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *ServiceInfo) Empty() bool { + return o == nil || o.bitmap_ == 0 +} + +// Fullname returns the value of the 'fullname' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Full name of the service +func (o *ServiceInfo) Fullname() string { + if o != nil && o.bitmap_&1 != 0 { + return o.fullname + } + return "" +} + +// GetFullname returns the value of the 'fullname' attribute and +// a flag indicating if the attribute has a value. +// +// Full name of the service +func (o *ServiceInfo) GetFullname() (value string, ok bool) { + ok = o != nil && o.bitmap_&1 != 0 + if ok { + value = o.fullname + } + return +} + +// StatusType returns the value of the 'status_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Type of the service status +func (o *ServiceInfo) StatusType() string { + if o != nil && o.bitmap_&2 != 0 { + return o.statusType + } + return "" +} + +// GetStatusType returns the value of the 'status_type' attribute and +// a flag indicating if the attribute has a value. +// +// Type of the service status +func (o *ServiceInfo) GetStatusType() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.statusType + } + return +} + +// ServiceInfoListKind is the name of the type used to represent list of objects of +// type 'service_info'. +const ServiceInfoListKind = "ServiceInfoList" + +// ServiceInfoListLinkKind is the name of the type used to represent links to list +// of objects of type 'service_info'. +const ServiceInfoListLinkKind = "ServiceInfoListLink" + +// ServiceInfoNilKind is the name of the type used to nil lists of objects of +// type 'service_info'. +const ServiceInfoListNilKind = "ServiceInfoListNil" + +// ServiceInfoList is a list of values of the 'service_info' type. +type ServiceInfoList struct { + href string + link bool + items []*ServiceInfo +} + +// Len returns the length of the list. +func (l *ServiceInfoList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ServiceInfoList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ServiceInfoList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ServiceInfoList) SetItems(items []*ServiceInfo) { + l.items = items +} + +// Items returns the items of the list. +func (l *ServiceInfoList) Items() []*ServiceInfo { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ServiceInfoList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ServiceInfoList) Get(i int) *ServiceInfo { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ServiceInfoList) Slice() []*ServiceInfo { + var slice []*ServiceInfo + if l == nil { + slice = make([]*ServiceInfo, 0) + } else { + slice = make([]*ServiceInfo, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ServiceInfoList) Each(f func(item *ServiceInfo) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ServiceInfoList) Range(f func(index int, item *ServiceInfo) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/statusboard/v1/service_info_type_json.go b/clientapi/statusboard/v1/service_info_type_json.go new file mode 100644 index 00000000..4d9cd092 --- /dev/null +++ b/clientapi/statusboard/v1/service_info_type_json.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalServiceInfo writes a value of the 'service_info' type to the given writer. +func MarshalServiceInfo(object *ServiceInfo, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServiceInfo(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServiceInfo writes a value of the 'service_info' type to the given stream. +func WriteServiceInfo(object *ServiceInfo, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + var present_ bool + present_ = object.bitmap_&1 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("fullname") + stream.WriteString(object.fullname) + count++ + } + present_ = object.bitmap_&2 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status_type") + stream.WriteString(object.statusType) + } + stream.WriteObjectEnd() +} + +// UnmarshalServiceInfo reads a value of the 'service_info' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalServiceInfo(source interface{}) (object *ServiceInfo, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadServiceInfo(iterator) + err = iterator.Error + return +} + +// ReadServiceInfo reads a value of the 'service_info' type from the given iterator. +func ReadServiceInfo(iterator *jsoniter.Iterator) *ServiceInfo { + object := &ServiceInfo{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "fullname": + value := iterator.ReadString() + object.fullname = value + object.bitmap_ |= 1 + case "status_type": + value := iterator.ReadString() + object.statusType = value + object.bitmap_ |= 2 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/statusboard/v1/service_list_builder.go b/clientapi/statusboard/v1/service_list_builder.go new file mode 100644 index 00000000..90b6b043 --- /dev/null +++ b/clientapi/statusboard/v1/service_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// ServiceListBuilder contains the data and logic needed to build +// 'service' objects. +type ServiceListBuilder struct { + items []*ServiceBuilder +} + +// NewServiceList creates a new builder of 'service' objects. +func NewServiceList() *ServiceListBuilder { + return new(ServiceListBuilder) +} + +// Items sets the items of the list. +func (b *ServiceListBuilder) Items(values ...*ServiceBuilder) *ServiceListBuilder { + b.items = make([]*ServiceBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ServiceListBuilder) 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 *ServiceListBuilder) Copy(list *ServiceList) *ServiceListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ServiceBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewService().Copy(v) + } + } + return b +} + +// Build creates a list of 'service' objects using the +// configuration stored in the builder. +func (b *ServiceListBuilder) Build() (list *ServiceList, err error) { + items := make([]*Service, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ServiceList) + list.items = items + return +} diff --git a/clientapi/statusboard/v1/service_list_type_json.go b/clientapi/statusboard/v1/service_list_type_json.go new file mode 100644 index 00000000..86e5437b --- /dev/null +++ b/clientapi/statusboard/v1/service_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalServiceList writes a list of values of the 'service' type to +// the given writer. +func MarshalServiceList(list []*Service, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteServiceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteServiceList writes a list of value of the 'service' type to +// the given stream. +func WriteServiceList(list []*Service, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteService(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalServiceList reads a list of values of the 'service' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalServiceList(source interface{}) (items []*Service, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadServiceList(iterator) + err = iterator.Error + return +} + +// ReadServiceList reads list of values of the ”service' type from +// the given iterator. +func ReadServiceList(iterator *jsoniter.Iterator) []*Service { + list := []*Service{} + for iterator.ReadArray() { + item := ReadService(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/service_type.go b/clientapi/statusboard/v1/service_type.go new file mode 100644 index 00000000..3ae0c534 --- /dev/null +++ b/clientapi/statusboard/v1/service_type.go @@ -0,0 +1,541 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// ServiceKind is the name of the type used to represent objects +// of type 'service'. +const ServiceKind = "Service" + +// ServiceLinkKind is the name of the type used to represent links +// to objects of type 'service'. +const ServiceLinkKind = "ServiceLink" + +// ServiceNilKind is the name of the type used to nil references +// to objects of type 'service'. +const ServiceNilKind = "ServiceNil" + +// Service represents the values of the 'service' type. +// +// Definition of a Status Board Service. +type Service struct { + bitmap_ uint32 + id string + href string + application *Application + createdAt time.Time + currentStatus string + fullname string + lastPingAt time.Time + metadata interface{} + name string + owners []*Owner + serviceEndpoint string + statusType string + statusUpdatedAt time.Time + token string + updatedAt time.Time + private bool +} + +// Kind returns the name of the type of the object. +func (o *Service) Kind() string { + if o == nil { + return ServiceNilKind + } + if o.bitmap_&1 != 0 { + return ServiceLinkKind + } + return ServiceKind +} + +// Link returns true if this is a link. +func (o *Service) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Service) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Service) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Service) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Service) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Service) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Application returns the value of the 'application' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The Application associated with the Service +func (o *Service) Application() *Application { + if o != nil && o.bitmap_&8 != 0 { + return o.application + } + return nil +} + +// GetApplication returns the value of the 'application' attribute and +// a flag indicating if the attribute has a value. +// +// The Application associated with the Service +func (o *Service) GetApplication() (value *Application, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.application + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *Service) CreatedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *Service) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.createdAt + } + return +} + +// CurrentStatus returns the value of the 'current_status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Service) CurrentStatus() string { + if o != nil && o.bitmap_&32 != 0 { + return o.currentStatus + } + return "" +} + +// GetCurrentStatus returns the value of the 'current_status' attribute and +// a flag indicating if the attribute has a value. +func (o *Service) GetCurrentStatus() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.currentStatus + } + return +} + +// Fullname returns the value of the 'fullname' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Service) Fullname() string { + if o != nil && o.bitmap_&64 != 0 { + return o.fullname + } + return "" +} + +// GetFullname returns the value of the 'fullname' attribute and +// a flag indicating if the attribute has a value. +func (o *Service) GetFullname() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.fullname + } + return +} + +// LastPingAt returns the value of the 'last_ping_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Service) LastPingAt() time.Time { + if o != nil && o.bitmap_&128 != 0 { + return o.lastPingAt + } + return time.Time{} +} + +// GetLastPingAt returns the value of the 'last_ping_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Service) GetLastPingAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.lastPingAt + } + return +} + +// Metadata returns the value of the 'metadata' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Service) Metadata() interface{} { + if o != nil && o.bitmap_&256 != 0 { + return o.metadata + } + return nil +} + +// GetMetadata returns the value of the 'metadata' attribute and +// a flag indicating if the attribute has a value. +func (o *Service) GetMetadata() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.metadata + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the Service +func (o *Service) Name() string { + if o != nil && o.bitmap_&512 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the Service +func (o *Service) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.name + } + return +} + +// Owners returns the value of the 'owners' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Service) Owners() []*Owner { + if o != nil && o.bitmap_&1024 != 0 { + return o.owners + } + return nil +} + +// GetOwners returns the value of the 'owners' attribute and +// a flag indicating if the attribute has a value. +func (o *Service) GetOwners() (value []*Owner, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.owners + } + return +} + +// Private returns the value of the 'private' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Service) Private() bool { + if o != nil && o.bitmap_&2048 != 0 { + return o.private + } + return false +} + +// GetPrivate returns the value of the 'private' attribute and +// a flag indicating if the attribute has a value. +func (o *Service) GetPrivate() (value bool, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.private + } + return +} + +// ServiceEndpoint returns the value of the 'service_endpoint' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Service) ServiceEndpoint() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.serviceEndpoint + } + return "" +} + +// GetServiceEndpoint returns the value of the 'service_endpoint' attribute and +// a flag indicating if the attribute has a value. +func (o *Service) GetServiceEndpoint() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.serviceEndpoint + } + return +} + +// StatusType returns the value of the 'status_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Service) StatusType() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.statusType + } + return "" +} + +// GetStatusType returns the value of the 'status_type' attribute and +// a flag indicating if the attribute has a value. +func (o *Service) GetStatusType() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.statusType + } + return +} + +// StatusUpdatedAt returns the value of the 'status_updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Service) StatusUpdatedAt() time.Time { + if o != nil && o.bitmap_&16384 != 0 { + return o.statusUpdatedAt + } + return time.Time{} +} + +// GetStatusUpdatedAt returns the value of the 'status_updated_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Service) GetStatusUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.statusUpdatedAt + } + return +} + +// Token returns the value of the 'token' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Service) Token() string { + if o != nil && o.bitmap_&32768 != 0 { + return o.token + } + return "" +} + +// GetToken returns the value of the 'token' attribute and +// a flag indicating if the attribute has a value. +func (o *Service) GetToken() (value string, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.token + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *Service) UpdatedAt() time.Time { + if o != nil && o.bitmap_&65536 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *Service) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.updatedAt + } + return +} + +// ServiceListKind is the name of the type used to represent list of objects of +// type 'service'. +const ServiceListKind = "ServiceList" + +// ServiceListLinkKind is the name of the type used to represent links to list +// of objects of type 'service'. +const ServiceListLinkKind = "ServiceListLink" + +// ServiceNilKind is the name of the type used to nil lists of objects of +// type 'service'. +const ServiceListNilKind = "ServiceListNil" + +// ServiceList is a list of values of the 'service' type. +type ServiceList struct { + href string + link bool + items []*Service +} + +// Kind returns the name of the type of the object. +func (l *ServiceList) Kind() string { + if l == nil { + return ServiceListNilKind + } + if l.link { + return ServiceListLinkKind + } + return ServiceListKind +} + +// Link returns true iif this is a link. +func (l *ServiceList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ServiceList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ServiceList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ServiceList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ServiceList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ServiceList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ServiceList) SetItems(items []*Service) { + l.items = items +} + +// Items returns the items of the list. +func (l *ServiceList) Items() []*Service { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ServiceList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ServiceList) Get(i int) *Service { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ServiceList) Slice() []*Service { + var slice []*Service + if l == nil { + slice = make([]*Service, 0) + } else { + slice = make([]*Service, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ServiceList) Each(f func(item *Service) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ServiceList) Range(f func(index int, item *Service) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/statusboard/v1/service_type_json.go b/clientapi/statusboard/v1/service_type_json.go new file mode 100644 index 00000000..a4b10b54 --- /dev/null +++ b/clientapi/statusboard/v1/service_type_json.go @@ -0,0 +1,307 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalService writes a value of the 'service' type to the given writer. +func MarshalService(object *Service, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteService(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteService writes a value of the 'service' type to the given stream. +func WriteService(object *Service, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ServiceLinkKind) + } else { + stream.WriteString(ServiceKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 && object.application != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("application") + WriteApplication(object.application, stream) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("current_status") + stream.WriteString(object.currentStatus) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("fullname") + stream.WriteString(object.fullname) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_ping_at") + stream.WriteString((object.lastPingAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("metadata") + stream.WriteVal(object.metadata) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.owners != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("owners") + WriteOwnerList(object.owners, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("private") + stream.WriteBool(object.private) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_endpoint") + stream.WriteString(object.serviceEndpoint) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status_type") + stream.WriteString(object.statusType) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status_updated_at") + stream.WriteString((object.statusUpdatedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("token") + stream.WriteString(object.token) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalService reads a value of the 'service' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalService(source interface{}) (object *Service, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadService(iterator) + err = iterator.Error + return +} + +// ReadService reads a value of the 'service' type from the given iterator. +func ReadService(iterator *jsoniter.Iterator) *Service { + object := &Service{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ServiceLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "application": + value := ReadApplication(iterator) + object.application = value + object.bitmap_ |= 8 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 16 + case "current_status": + value := iterator.ReadString() + object.currentStatus = value + object.bitmap_ |= 32 + case "fullname": + value := iterator.ReadString() + object.fullname = value + object.bitmap_ |= 64 + case "last_ping_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastPingAt = value + object.bitmap_ |= 128 + case "metadata": + var value interface{} + iterator.ReadVal(&value) + object.metadata = value + object.bitmap_ |= 256 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 512 + case "owners": + value := ReadOwnerList(iterator) + object.owners = value + object.bitmap_ |= 1024 + case "private": + value := iterator.ReadBool() + object.private = value + object.bitmap_ |= 2048 + case "service_endpoint": + value := iterator.ReadString() + object.serviceEndpoint = value + object.bitmap_ |= 4096 + case "status_type": + value := iterator.ReadString() + object.statusType = value + object.bitmap_ |= 8192 + case "status_updated_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.statusUpdatedAt = value + object.bitmap_ |= 16384 + case "token": + value := iterator.ReadString() + object.token = value + object.bitmap_ |= 32768 + 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_ |= 65536 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/statusboard/v1/status_builder.go b/clientapi/statusboard/v1/status_builder.go new file mode 100644 index 00000000..744297bd --- /dev/null +++ b/clientapi/statusboard/v1/status_builder.go @@ -0,0 +1,173 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// StatusBuilder contains the data and logic needed to build 'status' objects. +// +// Definition of a Status Board status. +type StatusBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + metadata interface{} + service *ServiceBuilder + serviceInfo *ServiceInfoBuilder + status string + updatedAt time.Time +} + +// NewStatus creates a new builder of 'status' objects. +func NewStatus() *StatusBuilder { + return &StatusBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *StatusBuilder) Link(value bool) *StatusBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *StatusBuilder) ID(value string) *StatusBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *StatusBuilder) HREF(value string) *StatusBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *StatusBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *StatusBuilder) CreatedAt(value time.Time) *StatusBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// Metadata sets the value of the 'metadata' attribute to the given value. +func (b *StatusBuilder) Metadata(value interface{}) *StatusBuilder { + b.metadata = value + b.bitmap_ |= 16 + return b +} + +// Service sets the value of the 'service' attribute to the given value. +// +// Definition of a Status Board Service. +func (b *StatusBuilder) Service(value *ServiceBuilder) *StatusBuilder { + b.service = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// ServiceInfo sets the value of the 'service_info' attribute to the given value. +// +// Definition of a Status Board service info. +func (b *StatusBuilder) ServiceInfo(value *ServiceInfoBuilder) *StatusBuilder { + b.serviceInfo = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *StatusBuilder) Status(value string) *StatusBuilder { + b.status = value + b.bitmap_ |= 128 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *StatusBuilder) UpdatedAt(value time.Time) *StatusBuilder { + b.updatedAt = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *StatusBuilder) Copy(object *Status) *StatusBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.metadata = object.metadata + if object.service != nil { + b.service = NewService().Copy(object.service) + } else { + b.service = nil + } + if object.serviceInfo != nil { + b.serviceInfo = NewServiceInfo().Copy(object.serviceInfo) + } else { + b.serviceInfo = nil + } + b.status = object.status + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'status' object using the configuration stored in the builder. +func (b *StatusBuilder) Build() (object *Status, err error) { + object = new(Status) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.metadata = b.metadata + if b.service != nil { + object.service, err = b.service.Build() + if err != nil { + return + } + } + if b.serviceInfo != nil { + object.serviceInfo, err = b.serviceInfo.Build() + if err != nil { + return + } + } + object.status = b.status + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/statusboard/v1/status_list_builder.go b/clientapi/statusboard/v1/status_list_builder.go new file mode 100644 index 00000000..e9e74ef4 --- /dev/null +++ b/clientapi/statusboard/v1/status_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// StatusListBuilder contains the data and logic needed to build +// 'status' objects. +type StatusListBuilder struct { + items []*StatusBuilder +} + +// NewStatusList creates a new builder of 'status' objects. +func NewStatusList() *StatusListBuilder { + return new(StatusListBuilder) +} + +// Items sets the items of the list. +func (b *StatusListBuilder) Items(values ...*StatusBuilder) *StatusListBuilder { + b.items = make([]*StatusBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *StatusListBuilder) 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 *StatusListBuilder) Copy(list *StatusList) *StatusListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*StatusBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewStatus().Copy(v) + } + } + return b +} + +// Build creates a list of 'status' objects using the +// configuration stored in the builder. +func (b *StatusListBuilder) Build() (list *StatusList, err error) { + items := make([]*Status, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(StatusList) + list.items = items + return +} diff --git a/clientapi/statusboard/v1/status_list_type_json.go b/clientapi/statusboard/v1/status_list_type_json.go new file mode 100644 index 00000000..33464a4c --- /dev/null +++ b/clientapi/statusboard/v1/status_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStatusList writes a list of values of the 'status' type to +// the given writer. +func MarshalStatusList(list []*Status, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStatusList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStatusList writes a list of value of the 'status' type to +// the given stream. +func WriteStatusList(list []*Status, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteStatus(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalStatusList reads a list of values of the 'status' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStatusList(source interface{}) (items []*Status, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStatusList(iterator) + err = iterator.Error + return +} + +// ReadStatusList reads list of values of the ”status' type from +// the given iterator. +func ReadStatusList(iterator *jsoniter.Iterator) []*Status { + list := []*Status{} + for iterator.ReadArray() { + item := ReadStatus(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/status_type.go b/clientapi/statusboard/v1/status_type.go new file mode 100644 index 00000000..a7c7ff19 --- /dev/null +++ b/clientapi/statusboard/v1/status_type.go @@ -0,0 +1,389 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// StatusKind is the name of the type used to represent objects +// of type 'status'. +const StatusKind = "Status" + +// StatusLinkKind is the name of the type used to represent links +// to objects of type 'status'. +const StatusLinkKind = "StatusLink" + +// StatusNilKind is the name of the type used to nil references +// to objects of type 'status'. +const StatusNilKind = "StatusNil" + +// Status represents the values of the 'status' type. +// +// Definition of a Status Board status. +type Status struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + metadata interface{} + service *Service + serviceInfo *ServiceInfo + status string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *Status) Kind() string { + if o == nil { + return StatusNilKind + } + if o.bitmap_&1 != 0 { + return StatusLinkKind + } + return StatusKind +} + +// Link returns true if this is a link. +func (o *Status) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Status) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Status) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Status) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Status) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Status) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *Status) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *Status) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// Metadata returns the value of the 'metadata' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Miscellaneous metadata about the application. +func (o *Status) Metadata() interface{} { + if o != nil && o.bitmap_&16 != 0 { + return o.metadata + } + return nil +} + +// GetMetadata returns the value of the 'metadata' attribute and +// a flag indicating if the attribute has a value. +// +// Miscellaneous metadata about the application. +func (o *Status) GetMetadata() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.metadata + } + return +} + +// Service returns the value of the 'service' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The associated service ID. +func (o *Status) Service() *Service { + if o != nil && o.bitmap_&32 != 0 { + return o.service + } + return nil +} + +// GetService returns the value of the 'service' attribute and +// a flag indicating if the attribute has a value. +// +// The associated service ID. +func (o *Status) GetService() (value *Service, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.service + } + return +} + +// ServiceInfo returns the value of the 'service_info' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional Service related data. +func (o *Status) ServiceInfo() *ServiceInfo { + if o != nil && o.bitmap_&64 != 0 { + return o.serviceInfo + } + return nil +} + +// GetServiceInfo returns the value of the 'service_info' attribute and +// a flag indicating if the attribute has a value. +// +// Additional Service related data. +func (o *Status) GetServiceInfo() (value *ServiceInfo, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.serviceInfo + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// A status message for the given service. +func (o *Status) Status() string { + if o != nil && o.bitmap_&128 != 0 { + return o.status + } + return "" +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// A status message for the given service. +func (o *Status) GetStatus() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.status + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *Status) UpdatedAt() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *Status) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.updatedAt + } + return +} + +// StatusListKind is the name of the type used to represent list of objects of +// type 'status'. +const StatusListKind = "StatusList" + +// StatusListLinkKind is the name of the type used to represent links to list +// of objects of type 'status'. +const StatusListLinkKind = "StatusListLink" + +// StatusNilKind is the name of the type used to nil lists of objects of +// type 'status'. +const StatusListNilKind = "StatusListNil" + +// StatusList is a list of values of the 'status' type. +type StatusList struct { + href string + link bool + items []*Status +} + +// Kind returns the name of the type of the object. +func (l *StatusList) Kind() string { + if l == nil { + return StatusListNilKind + } + if l.link { + return StatusListLinkKind + } + return StatusListKind +} + +// Link returns true iif this is a link. +func (l *StatusList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *StatusList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *StatusList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *StatusList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *StatusList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *StatusList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *StatusList) SetItems(items []*Status) { + l.items = items +} + +// Items returns the items of the list. +func (l *StatusList) Items() []*Status { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *StatusList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *StatusList) Get(i int) *Status { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *StatusList) Slice() []*Status { + var slice []*Status + if l == nil { + slice = make([]*Status, 0) + } else { + slice = make([]*Status, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *StatusList) Each(f func(item *Status) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *StatusList) Range(f func(index int, item *Status) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/statusboard/v1/status_type_json.go b/clientapi/statusboard/v1/status_type_json.go new file mode 100644 index 00000000..fd169448 --- /dev/null +++ b/clientapi/statusboard/v1/status_type_json.go @@ -0,0 +1,195 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStatus writes a value of the 'status' type to the given writer. +func MarshalStatus(object *Status, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStatus(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStatus writes a value of the 'status' type to the given stream. +func WriteStatus(object *Status, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(StatusLinkKind) + } else { + stream.WriteString(StatusKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("metadata") + stream.WriteVal(object.metadata) + count++ + } + present_ = object.bitmap_&32 != 0 && object.service != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service") + WriteService(object.service, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.serviceInfo != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_info") + WriteServiceInfo(object.serviceInfo, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteString(object.status) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalStatus reads a value of the 'status' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalStatus(source interface{}) (object *Status, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadStatus(iterator) + err = iterator.Error + return +} + +// ReadStatus reads a value of the 'status' type from the given iterator. +func ReadStatus(iterator *jsoniter.Iterator) *Status { + object := &Status{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == StatusLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "metadata": + var value interface{} + iterator.ReadVal(&value) + object.metadata = value + object.bitmap_ |= 16 + case "service": + value := ReadService(iterator) + object.service = value + object.bitmap_ |= 32 + case "service_info": + value := ReadServiceInfo(iterator) + object.serviceInfo = value + object.bitmap_ |= 64 + case "status": + value := iterator.ReadString() + object.status = value + object.bitmap_ |= 128 + 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_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/statusboard/v1/status_update_builder.go b/clientapi/statusboard/v1/status_update_builder.go new file mode 100644 index 00000000..24670f69 --- /dev/null +++ b/clientapi/statusboard/v1/status_update_builder.go @@ -0,0 +1,171 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// StatusUpdateBuilder contains the data and logic needed to build 'status_update' objects. +type StatusUpdateBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + metadata interface{} + service *ServiceBuilder + serviceInfo *ServiceInfoBuilder + status string + updatedAt time.Time +} + +// NewStatusUpdate creates a new builder of 'status_update' objects. +func NewStatusUpdate() *StatusUpdateBuilder { + return &StatusUpdateBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *StatusUpdateBuilder) Link(value bool) *StatusUpdateBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *StatusUpdateBuilder) ID(value string) *StatusUpdateBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *StatusUpdateBuilder) HREF(value string) *StatusUpdateBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *StatusUpdateBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *StatusUpdateBuilder) CreatedAt(value time.Time) *StatusUpdateBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// Metadata sets the value of the 'metadata' attribute to the given value. +func (b *StatusUpdateBuilder) Metadata(value interface{}) *StatusUpdateBuilder { + b.metadata = value + b.bitmap_ |= 16 + return b +} + +// Service sets the value of the 'service' attribute to the given value. +// +// Definition of a Status Board Service. +func (b *StatusUpdateBuilder) Service(value *ServiceBuilder) *StatusUpdateBuilder { + b.service = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// ServiceInfo sets the value of the 'service_info' attribute to the given value. +// +// Definition of a Status Board service info. +func (b *StatusUpdateBuilder) ServiceInfo(value *ServiceInfoBuilder) *StatusUpdateBuilder { + b.serviceInfo = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *StatusUpdateBuilder) Status(value string) *StatusUpdateBuilder { + b.status = value + b.bitmap_ |= 128 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *StatusUpdateBuilder) UpdatedAt(value time.Time) *StatusUpdateBuilder { + b.updatedAt = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *StatusUpdateBuilder) Copy(object *StatusUpdate) *StatusUpdateBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.metadata = object.metadata + if object.service != nil { + b.service = NewService().Copy(object.service) + } else { + b.service = nil + } + if object.serviceInfo != nil { + b.serviceInfo = NewServiceInfo().Copy(object.serviceInfo) + } else { + b.serviceInfo = nil + } + b.status = object.status + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'status_update' object using the configuration stored in the builder. +func (b *StatusUpdateBuilder) Build() (object *StatusUpdate, err error) { + object = new(StatusUpdate) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.metadata = b.metadata + if b.service != nil { + object.service, err = b.service.Build() + if err != nil { + return + } + } + if b.serviceInfo != nil { + object.serviceInfo, err = b.serviceInfo.Build() + if err != nil { + return + } + } + object.status = b.status + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/statusboard/v1/status_update_list_builder.go b/clientapi/statusboard/v1/status_update_list_builder.go new file mode 100644 index 00000000..45a502f2 --- /dev/null +++ b/clientapi/statusboard/v1/status_update_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +// StatusUpdateListBuilder contains the data and logic needed to build +// 'status_update' objects. +type StatusUpdateListBuilder struct { + items []*StatusUpdateBuilder +} + +// NewStatusUpdateList creates a new builder of 'status_update' objects. +func NewStatusUpdateList() *StatusUpdateListBuilder { + return new(StatusUpdateListBuilder) +} + +// Items sets the items of the list. +func (b *StatusUpdateListBuilder) Items(values ...*StatusUpdateBuilder) *StatusUpdateListBuilder { + b.items = make([]*StatusUpdateBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *StatusUpdateListBuilder) 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 *StatusUpdateListBuilder) Copy(list *StatusUpdateList) *StatusUpdateListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*StatusUpdateBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewStatusUpdate().Copy(v) + } + } + return b +} + +// Build creates a list of 'status_update' objects using the +// configuration stored in the builder. +func (b *StatusUpdateListBuilder) Build() (list *StatusUpdateList, err error) { + items := make([]*StatusUpdate, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(StatusUpdateList) + list.items = items + return +} diff --git a/clientapi/statusboard/v1/status_update_list_type_json.go b/clientapi/statusboard/v1/status_update_list_type_json.go new file mode 100644 index 00000000..1ab7f8e8 --- /dev/null +++ b/clientapi/statusboard/v1/status_update_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStatusUpdateList writes a list of values of the 'status_update' type to +// the given writer. +func MarshalStatusUpdateList(list []*StatusUpdate, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStatusUpdateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStatusUpdateList writes a list of value of the 'status_update' type to +// the given stream. +func WriteStatusUpdateList(list []*StatusUpdate, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteStatusUpdate(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalStatusUpdateList reads a list of values of the 'status_update' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStatusUpdateList(source interface{}) (items []*StatusUpdate, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStatusUpdateList(iterator) + err = iterator.Error + return +} + +// ReadStatusUpdateList reads list of values of the ”status_update' type from +// the given iterator. +func ReadStatusUpdateList(iterator *jsoniter.Iterator) []*StatusUpdate { + list := []*StatusUpdate{} + for iterator.ReadArray() { + item := ReadStatusUpdate(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/statusboard/v1/status_update_type.go b/clientapi/statusboard/v1/status_update_type.go new file mode 100644 index 00000000..eec05123 --- /dev/null +++ b/clientapi/statusboard/v1/status_update_type.go @@ -0,0 +1,387 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + time "time" +) + +// StatusUpdateKind is the name of the type used to represent objects +// of type 'status_update'. +const StatusUpdateKind = "StatusUpdate" + +// StatusUpdateLinkKind is the name of the type used to represent links +// to objects of type 'status_update'. +const StatusUpdateLinkKind = "StatusUpdateLink" + +// StatusUpdateNilKind is the name of the type used to nil references +// to objects of type 'status_update'. +const StatusUpdateNilKind = "StatusUpdateNil" + +// StatusUpdate represents the values of the 'status_update' type. +type StatusUpdate struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + metadata interface{} + service *Service + serviceInfo *ServiceInfo + status string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *StatusUpdate) Kind() string { + if o == nil { + return StatusUpdateNilKind + } + if o.bitmap_&1 != 0 { + return StatusUpdateLinkKind + } + return StatusUpdateKind +} + +// Link returns true if this is a link. +func (o *StatusUpdate) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *StatusUpdate) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *StatusUpdate) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *StatusUpdate) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *StatusUpdate) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *StatusUpdate) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *StatusUpdate) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *StatusUpdate) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// Metadata returns the value of the 'metadata' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Miscellaneous metadata about the application. +func (o *StatusUpdate) Metadata() interface{} { + if o != nil && o.bitmap_&16 != 0 { + return o.metadata + } + return nil +} + +// GetMetadata returns the value of the 'metadata' attribute and +// a flag indicating if the attribute has a value. +// +// Miscellaneous metadata about the application. +func (o *StatusUpdate) GetMetadata() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.metadata + } + return +} + +// Service returns the value of the 'service' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The associated service ID. +func (o *StatusUpdate) Service() *Service { + if o != nil && o.bitmap_&32 != 0 { + return o.service + } + return nil +} + +// GetService returns the value of the 'service' attribute and +// a flag indicating if the attribute has a value. +// +// The associated service ID. +func (o *StatusUpdate) GetService() (value *Service, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.service + } + return +} + +// ServiceInfo returns the value of the 'service_info' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Additional Service related data. +func (o *StatusUpdate) ServiceInfo() *ServiceInfo { + if o != nil && o.bitmap_&64 != 0 { + return o.serviceInfo + } + return nil +} + +// GetServiceInfo returns the value of the 'service_info' attribute and +// a flag indicating if the attribute has a value. +// +// Additional Service related data. +func (o *StatusUpdate) GetServiceInfo() (value *ServiceInfo, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.serviceInfo + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// A status message for the given service. +func (o *StatusUpdate) Status() string { + if o != nil && o.bitmap_&128 != 0 { + return o.status + } + return "" +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +// +// A status message for the given service. +func (o *StatusUpdate) GetStatus() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.status + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *StatusUpdate) UpdatedAt() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *StatusUpdate) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.updatedAt + } + return +} + +// StatusUpdateListKind is the name of the type used to represent list of objects of +// type 'status_update'. +const StatusUpdateListKind = "StatusUpdateList" + +// StatusUpdateListLinkKind is the name of the type used to represent links to list +// of objects of type 'status_update'. +const StatusUpdateListLinkKind = "StatusUpdateListLink" + +// StatusUpdateNilKind is the name of the type used to nil lists of objects of +// type 'status_update'. +const StatusUpdateListNilKind = "StatusUpdateListNil" + +// StatusUpdateList is a list of values of the 'status_update' type. +type StatusUpdateList struct { + href string + link bool + items []*StatusUpdate +} + +// Kind returns the name of the type of the object. +func (l *StatusUpdateList) Kind() string { + if l == nil { + return StatusUpdateListNilKind + } + if l.link { + return StatusUpdateListLinkKind + } + return StatusUpdateListKind +} + +// Link returns true iif this is a link. +func (l *StatusUpdateList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *StatusUpdateList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *StatusUpdateList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *StatusUpdateList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *StatusUpdateList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *StatusUpdateList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *StatusUpdateList) SetItems(items []*StatusUpdate) { + l.items = items +} + +// Items returns the items of the list. +func (l *StatusUpdateList) Items() []*StatusUpdate { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *StatusUpdateList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *StatusUpdateList) Get(i int) *StatusUpdate { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *StatusUpdateList) Slice() []*StatusUpdate { + var slice []*StatusUpdate + if l == nil { + slice = make([]*StatusUpdate, 0) + } else { + slice = make([]*StatusUpdate, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *StatusUpdateList) Each(f func(item *StatusUpdate) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *StatusUpdateList) Range(f func(index int, item *StatusUpdate) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/statusboard/v1/status_update_type_json.go b/clientapi/statusboard/v1/status_update_type_json.go new file mode 100644 index 00000000..e125aa53 --- /dev/null +++ b/clientapi/statusboard/v1/status_update_type_json.go @@ -0,0 +1,195 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStatusUpdate writes a value of the 'status_update' type to the given writer. +func MarshalStatusUpdate(object *StatusUpdate, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStatusUpdate(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStatusUpdate writes a value of the 'status_update' type to the given stream. +func WriteStatusUpdate(object *StatusUpdate, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(StatusUpdateLinkKind) + } else { + stream.WriteString(StatusUpdateKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("metadata") + stream.WriteVal(object.metadata) + count++ + } + present_ = object.bitmap_&32 != 0 && object.service != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service") + WriteService(object.service, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.serviceInfo != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("service_info") + WriteServiceInfo(object.serviceInfo, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteString(object.status) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalStatusUpdate reads a value of the 'status_update' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalStatusUpdate(source interface{}) (object *StatusUpdate, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadStatusUpdate(iterator) + err = iterator.Error + return +} + +// ReadStatusUpdate reads a value of the 'status_update' type from the given iterator. +func ReadStatusUpdate(iterator *jsoniter.Iterator) *StatusUpdate { + object := &StatusUpdate{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == StatusUpdateLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "metadata": + var value interface{} + iterator.ReadVal(&value) + object.metadata = value + object.bitmap_ |= 16 + case "service": + value := ReadService(iterator) + object.service = value + object.bitmap_ |= 32 + case "service_info": + value := ReadServiceInfo(iterator) + object.serviceInfo = value + object.bitmap_ |= 64 + case "status": + value := iterator.ReadString() + object.status = value + object.bitmap_ |= 128 + 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_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/statusboard/v1/string_list_type_json.go b/clientapi/statusboard/v1/string_list_type_json.go new file mode 100644 index 00000000..3901a40a --- /dev/null +++ b/clientapi/statusboard/v1/string_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/statusboard/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStringList writes a list of values of the 'string' type to +// the given writer. +func MarshalStringList(list []string, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStringList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStringList writes a list of value of the 'string' type to +// the given stream. +func WriteStringList(list []string, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalStringList reads a list of values of the 'string' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStringList(source interface{}) (items []string, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStringList(iterator) + err = iterator.Error + return +} + +// ReadStringList reads list of values of the ”string' type from +// the given iterator. +func ReadStringList(iterator *jsoniter.Iterator) []string { + list := []string{} + for iterator.ReadArray() { + item := iterator.ReadString() + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/attachment_builder.go b/clientapi/webrca/v1/attachment_builder.go new file mode 100644 index 00000000..6119d6a5 --- /dev/null +++ b/clientapi/webrca/v1/attachment_builder.go @@ -0,0 +1,193 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// AttachmentBuilder contains the data and logic needed to build 'attachment' objects. +// +// Definition of a Web RCA attachment. +type AttachmentBuilder struct { + bitmap_ uint32 + id string + href string + contentType string + createdAt time.Time + creator *UserBuilder + deletedAt time.Time + event *EventBuilder + fileSize int + name string + updatedAt time.Time +} + +// NewAttachment creates a new builder of 'attachment' objects. +func NewAttachment() *AttachmentBuilder { + return &AttachmentBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *AttachmentBuilder) Link(value bool) *AttachmentBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *AttachmentBuilder) ID(value string) *AttachmentBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *AttachmentBuilder) HREF(value string) *AttachmentBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *AttachmentBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// ContentType sets the value of the 'content_type' attribute to the given value. +func (b *AttachmentBuilder) ContentType(value string) *AttachmentBuilder { + b.contentType = value + b.bitmap_ |= 8 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *AttachmentBuilder) CreatedAt(value time.Time) *AttachmentBuilder { + b.createdAt = value + b.bitmap_ |= 16 + return b +} + +// Creator sets the value of the 'creator' attribute to the given value. +// +// Definition of a Web RCA user. +func (b *AttachmentBuilder) Creator(value *UserBuilder) *AttachmentBuilder { + b.creator = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// DeletedAt sets the value of the 'deleted_at' attribute to the given value. +func (b *AttachmentBuilder) DeletedAt(value time.Time) *AttachmentBuilder { + b.deletedAt = value + b.bitmap_ |= 64 + return b +} + +// Event sets the value of the 'event' attribute to the given value. +// +// Definition of a Web RCA event. +func (b *AttachmentBuilder) Event(value *EventBuilder) *AttachmentBuilder { + b.event = value + if value != nil { + b.bitmap_ |= 128 + } else { + b.bitmap_ &^= 128 + } + return b +} + +// FileSize sets the value of the 'file_size' attribute to the given value. +func (b *AttachmentBuilder) FileSize(value int) *AttachmentBuilder { + b.fileSize = value + b.bitmap_ |= 256 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *AttachmentBuilder) Name(value string) *AttachmentBuilder { + b.name = value + b.bitmap_ |= 512 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *AttachmentBuilder) UpdatedAt(value time.Time) *AttachmentBuilder { + b.updatedAt = value + b.bitmap_ |= 1024 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *AttachmentBuilder) Copy(object *Attachment) *AttachmentBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.contentType = object.contentType + b.createdAt = object.createdAt + if object.creator != nil { + b.creator = NewUser().Copy(object.creator) + } else { + b.creator = nil + } + b.deletedAt = object.deletedAt + if object.event != nil { + b.event = NewEvent().Copy(object.event) + } else { + b.event = nil + } + b.fileSize = object.fileSize + b.name = object.name + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'attachment' object using the configuration stored in the builder. +func (b *AttachmentBuilder) Build() (object *Attachment, err error) { + object = new(Attachment) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.contentType = b.contentType + object.createdAt = b.createdAt + if b.creator != nil { + object.creator, err = b.creator.Build() + if err != nil { + return + } + } + object.deletedAt = b.deletedAt + if b.event != nil { + object.event, err = b.event.Build() + if err != nil { + return + } + } + object.fileSize = b.fileSize + object.name = b.name + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/webrca/v1/attachment_list_builder.go b/clientapi/webrca/v1/attachment_list_builder.go new file mode 100644 index 00000000..88051979 --- /dev/null +++ b/clientapi/webrca/v1/attachment_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// AttachmentListBuilder contains the data and logic needed to build +// 'attachment' objects. +type AttachmentListBuilder struct { + items []*AttachmentBuilder +} + +// NewAttachmentList creates a new builder of 'attachment' objects. +func NewAttachmentList() *AttachmentListBuilder { + return new(AttachmentListBuilder) +} + +// Items sets the items of the list. +func (b *AttachmentListBuilder) Items(values ...*AttachmentBuilder) *AttachmentListBuilder { + b.items = make([]*AttachmentBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *AttachmentListBuilder) 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 *AttachmentListBuilder) Copy(list *AttachmentList) *AttachmentListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*AttachmentBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewAttachment().Copy(v) + } + } + return b +} + +// Build creates a list of 'attachment' objects using the +// configuration stored in the builder. +func (b *AttachmentListBuilder) Build() (list *AttachmentList, err error) { + items := make([]*Attachment, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(AttachmentList) + list.items = items + return +} diff --git a/clientapi/webrca/v1/attachment_list_type_json.go b/clientapi/webrca/v1/attachment_list_type_json.go new file mode 100644 index 00000000..11e5dde7 --- /dev/null +++ b/clientapi/webrca/v1/attachment_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAttachmentList writes a list of values of the 'attachment' type to +// the given writer. +func MarshalAttachmentList(list []*Attachment, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAttachmentList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAttachmentList writes a list of value of the 'attachment' type to +// the given stream. +func WriteAttachmentList(list []*Attachment, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteAttachment(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalAttachmentList reads a list of values of the 'attachment' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalAttachmentList(source interface{}) (items []*Attachment, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadAttachmentList(iterator) + err = iterator.Error + return +} + +// ReadAttachmentList reads list of values of the ”attachment' type from +// the given iterator. +func ReadAttachmentList(iterator *jsoniter.Iterator) []*Attachment { + list := []*Attachment{} + for iterator.ReadArray() { + item := ReadAttachment(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/attachment_type.go b/clientapi/webrca/v1/attachment_type.go new file mode 100644 index 00000000..c79cf0ce --- /dev/null +++ b/clientapi/webrca/v1/attachment_type.go @@ -0,0 +1,417 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// AttachmentKind is the name of the type used to represent objects +// of type 'attachment'. +const AttachmentKind = "Attachment" + +// AttachmentLinkKind is the name of the type used to represent links +// to objects of type 'attachment'. +const AttachmentLinkKind = "AttachmentLink" + +// AttachmentNilKind is the name of the type used to nil references +// to objects of type 'attachment'. +const AttachmentNilKind = "AttachmentNil" + +// Attachment represents the values of the 'attachment' type. +// +// Definition of a Web RCA attachment. +type Attachment struct { + bitmap_ uint32 + id string + href string + contentType string + createdAt time.Time + creator *User + deletedAt time.Time + event *Event + fileSize int + name string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *Attachment) Kind() string { + if o == nil { + return AttachmentNilKind + } + if o.bitmap_&1 != 0 { + return AttachmentLinkKind + } + return AttachmentKind +} + +// Link returns true if this is a link. +func (o *Attachment) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Attachment) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Attachment) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Attachment) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Attachment) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Attachment) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// ContentType returns the value of the 'content_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Attachment) ContentType() string { + if o != nil && o.bitmap_&8 != 0 { + return o.contentType + } + return "" +} + +// GetContentType returns the value of the 'content_type' attribute and +// a flag indicating if the attribute has a value. +func (o *Attachment) GetContentType() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.contentType + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *Attachment) CreatedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *Attachment) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.createdAt + } + return +} + +// Creator returns the value of the 'creator' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Attachment) Creator() *User { + if o != nil && o.bitmap_&32 != 0 { + return o.creator + } + return nil +} + +// GetCreator returns the value of the 'creator' attribute and +// a flag indicating if the attribute has a value. +func (o *Attachment) GetCreator() (value *User, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.creator + } + return +} + +// DeletedAt returns the value of the 'deleted_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object deletion timestamp. +func (o *Attachment) DeletedAt() time.Time { + if o != nil && o.bitmap_&64 != 0 { + return o.deletedAt + } + return time.Time{} +} + +// GetDeletedAt returns the value of the 'deleted_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object deletion timestamp. +func (o *Attachment) GetDeletedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.deletedAt + } + return +} + +// Event returns the value of the 'event' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Attachment) Event() *Event { + if o != nil && o.bitmap_&128 != 0 { + return o.event + } + return nil +} + +// GetEvent returns the value of the 'event' attribute and +// a flag indicating if the attribute has a value. +func (o *Attachment) GetEvent() (value *Event, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.event + } + return +} + +// FileSize returns the value of the 'file_size' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Attachment) FileSize() int { + if o != nil && o.bitmap_&256 != 0 { + return o.fileSize + } + return 0 +} + +// GetFileSize returns the value of the 'file_size' attribute and +// a flag indicating if the attribute has a value. +func (o *Attachment) GetFileSize() (value int, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.fileSize + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Attachment) Name() string { + if o != nil && o.bitmap_&512 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *Attachment) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.name + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *Attachment) UpdatedAt() time.Time { + if o != nil && o.bitmap_&1024 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *Attachment) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.updatedAt + } + return +} + +// AttachmentListKind is the name of the type used to represent list of objects of +// type 'attachment'. +const AttachmentListKind = "AttachmentList" + +// AttachmentListLinkKind is the name of the type used to represent links to list +// of objects of type 'attachment'. +const AttachmentListLinkKind = "AttachmentListLink" + +// AttachmentNilKind is the name of the type used to nil lists of objects of +// type 'attachment'. +const AttachmentListNilKind = "AttachmentListNil" + +// AttachmentList is a list of values of the 'attachment' type. +type AttachmentList struct { + href string + link bool + items []*Attachment +} + +// Kind returns the name of the type of the object. +func (l *AttachmentList) Kind() string { + if l == nil { + return AttachmentListNilKind + } + if l.link { + return AttachmentListLinkKind + } + return AttachmentListKind +} + +// Link returns true iif this is a link. +func (l *AttachmentList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *AttachmentList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *AttachmentList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *AttachmentList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *AttachmentList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *AttachmentList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *AttachmentList) SetItems(items []*Attachment) { + l.items = items +} + +// Items returns the items of the list. +func (l *AttachmentList) Items() []*Attachment { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *AttachmentList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *AttachmentList) Get(i int) *Attachment { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *AttachmentList) Slice() []*Attachment { + var slice []*Attachment + if l == nil { + slice = make([]*Attachment, 0) + } else { + slice = make([]*Attachment, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *AttachmentList) Each(f func(item *Attachment) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *AttachmentList) Range(f func(index int, item *Attachment) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/webrca/v1/attachment_type_json.go b/clientapi/webrca/v1/attachment_type_json.go new file mode 100644 index 00000000..26c07728 --- /dev/null +++ b/clientapi/webrca/v1/attachment_type_json.go @@ -0,0 +1,224 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalAttachment writes a value of the 'attachment' type to the given writer. +func MarshalAttachment(object *Attachment, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteAttachment(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteAttachment writes a value of the 'attachment' type to the given stream. +func WriteAttachment(object *Attachment, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(AttachmentLinkKind) + } else { + stream.WriteString(AttachmentKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("content_type") + stream.WriteString(object.contentType) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 && object.creator != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creator") + WriteUser(object.creator, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deleted_at") + stream.WriteString((object.deletedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&128 != 0 && object.event != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("event") + WriteEvent(object.event, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("file_size") + stream.WriteInt(object.fileSize) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalAttachment reads a value of the 'attachment' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalAttachment(source interface{}) (object *Attachment, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadAttachment(iterator) + err = iterator.Error + return +} + +// ReadAttachment reads a value of the 'attachment' type from the given iterator. +func ReadAttachment(iterator *jsoniter.Iterator) *Attachment { + object := &Attachment{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == AttachmentLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "content_type": + value := iterator.ReadString() + object.contentType = value + object.bitmap_ |= 8 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 16 + case "creator": + value := ReadUser(iterator) + object.creator = value + object.bitmap_ |= 32 + case "deleted_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.deletedAt = value + object.bitmap_ |= 64 + case "event": + value := ReadEvent(iterator) + object.event = value + object.bitmap_ |= 128 + case "file_size": + value := iterator.ReadInt() + object.fileSize = value + object.bitmap_ |= 256 + case "name": + value := iterator.ReadString() + object.name = value + 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_ |= 1024 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/webrca/v1/boolean_list_type_json.go b/clientapi/webrca/v1/boolean_list_type_json.go new file mode 100644 index 00000000..c5cf324b --- /dev/null +++ b/clientapi/webrca/v1/boolean_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalBooleanList writes a list of values of the 'boolean' type to +// the given writer. +func MarshalBooleanList(list []bool, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteBooleanList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteBooleanList writes a list of value of the 'boolean' type to +// the given stream. +func WriteBooleanList(list []bool, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteBool(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalBooleanList reads a list of values of the 'boolean' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalBooleanList(source interface{}) (items []bool, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadBooleanList(iterator) + err = iterator.Error + return +} + +// ReadBooleanList reads list of values of the ”boolean' type from +// the given iterator. +func ReadBooleanList(iterator *jsoniter.Iterator) []bool { + list := []bool{} + for iterator.ReadArray() { + item := iterator.ReadBool() + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/date_list_type_json.go b/clientapi/webrca/v1/date_list_type_json.go new file mode 100644 index 00000000..85146b3a --- /dev/null +++ b/clientapi/webrca/v1/date_list_type_json.go @@ -0,0 +1,80 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalDateList writes a list of values of the 'date' type to +// the given writer. +func MarshalDateList(list []time.Time, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteDateList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteDateList writes a list of value of the 'date' type to +// the given stream. +func WriteDateList(list []time.Time, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString((value).Format(time.RFC3339)) + } + stream.WriteArrayEnd() +} + +// UnmarshalDateList reads a list of values of the 'date' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalDateList(source interface{}) (items []time.Time, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadDateList(iterator) + err = iterator.Error + return +} + +// ReadDateList reads list of values of the ”date' type from +// the given iterator. +func ReadDateList(iterator *jsoniter.Iterator) []time.Time { + list := []time.Time{} + for iterator.ReadArray() { + text := iterator.ReadString() + item, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/error_builder.go b/clientapi/webrca/v1/error_builder.go new file mode 100644 index 00000000..881ba5e2 --- /dev/null +++ b/clientapi/webrca/v1/error_builder.go @@ -0,0 +1,99 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// ErrorBuilder contains the data and logic needed to build 'error' objects. +// +// Definition of a Web RCA error. +type ErrorBuilder struct { + bitmap_ uint32 + id string + href string + code string + reason string +} + +// NewError creates a new builder of 'error' objects. +func NewError() *ErrorBuilder { + return &ErrorBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ErrorBuilder) Link(value bool) *ErrorBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ErrorBuilder) ID(value string) *ErrorBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ErrorBuilder) HREF(value string) *ErrorBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ErrorBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Code sets the value of the 'code' attribute to the given value. +func (b *ErrorBuilder) Code(value string) *ErrorBuilder { + b.code = value + b.bitmap_ |= 8 + return b +} + +// Reason sets the value of the 'reason' attribute to the given value. +func (b *ErrorBuilder) Reason(value string) *ErrorBuilder { + b.reason = value + b.bitmap_ |= 16 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ErrorBuilder) Copy(object *Error) *ErrorBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.code = object.code + b.reason = object.reason + return b +} + +// Build creates a 'error' object using the configuration stored in the builder. +func (b *ErrorBuilder) Build() (object *Error, err error) { + object = new(Error) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.code = b.code + object.reason = b.reason + return +} diff --git a/clientapi/webrca/v1/error_list_builder.go b/clientapi/webrca/v1/error_list_builder.go new file mode 100644 index 00000000..81d57204 --- /dev/null +++ b/clientapi/webrca/v1/error_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// ErrorListBuilder contains the data and logic needed to build +// 'error' objects. +type ErrorListBuilder struct { + items []*ErrorBuilder +} + +// NewErrorList creates a new builder of 'error' objects. +func NewErrorList() *ErrorListBuilder { + return new(ErrorListBuilder) +} + +// Items sets the items of the list. +func (b *ErrorListBuilder) Items(values ...*ErrorBuilder) *ErrorListBuilder { + b.items = make([]*ErrorBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ErrorListBuilder) 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 *ErrorListBuilder) Copy(list *ErrorList) *ErrorListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ErrorBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewError().Copy(v) + } + } + return b +} + +// Build creates a list of 'error' objects using the +// configuration stored in the builder. +func (b *ErrorListBuilder) Build() (list *ErrorList, err error) { + items := make([]*Error, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ErrorList) + list.items = items + return +} diff --git a/clientapi/webrca/v1/error_list_type_json.go b/clientapi/webrca/v1/error_list_type_json.go new file mode 100644 index 00000000..f78bd3e7 --- /dev/null +++ b/clientapi/webrca/v1/error_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalErrorList writes a list of values of the 'error' type to +// the given writer. +func MarshalErrorList(list []*Error, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteErrorList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteErrorList writes a list of value of the 'error' type to +// the given stream. +func WriteErrorList(list []*Error, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteError(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalErrorList reads a list of values of the 'error' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalErrorList(source interface{}) (items []*Error, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadErrorList(iterator) + err = iterator.Error + return +} + +// ReadErrorList reads list of values of the ”error' type from +// the given iterator. +func ReadErrorList(iterator *jsoniter.Iterator) []*Error { + list := []*Error{} + for iterator.ReadArray() { + item := ReadError(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/error_type.go b/clientapi/webrca/v1/error_type.go new file mode 100644 index 00000000..0fe6bf32 --- /dev/null +++ b/clientapi/webrca/v1/error_type.go @@ -0,0 +1,281 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// ErrorKind is the name of the type used to represent objects +// of type 'error'. +const ErrorKind = "Error" + +// ErrorLinkKind is the name of the type used to represent links +// to objects of type 'error'. +const ErrorLinkKind = "ErrorLink" + +// ErrorNilKind is the name of the type used to nil references +// to objects of type 'error'. +const ErrorNilKind = "ErrorNil" + +// Error represents the values of the 'error' type. +// +// Definition of a Web RCA error. +type Error struct { + bitmap_ uint32 + id string + href string + code string + reason string +} + +// Kind returns the name of the type of the object. +func (o *Error) Kind() string { + if o == nil { + return ErrorNilKind + } + if o.bitmap_&1 != 0 { + return ErrorLinkKind + } + return ErrorKind +} + +// Link returns true if this is a link. +func (o *Error) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Error) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Error) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Error) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Error) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Error) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Code returns the value of the 'code' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Error) Code() string { + if o != nil && o.bitmap_&8 != 0 { + return o.code + } + return "" +} + +// GetCode returns the value of the 'code' attribute and +// a flag indicating if the attribute has a value. +func (o *Error) GetCode() (value string, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.code + } + return +} + +// Reason returns the value of the 'reason' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Error) Reason() string { + if o != nil && o.bitmap_&16 != 0 { + return o.reason + } + return "" +} + +// GetReason returns the value of the 'reason' attribute and +// a flag indicating if the attribute has a value. +func (o *Error) GetReason() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.reason + } + return +} + +// ErrorListKind is the name of the type used to represent list of objects of +// type 'error'. +const ErrorListKind = "ErrorList" + +// ErrorListLinkKind is the name of the type used to represent links to list +// of objects of type 'error'. +const ErrorListLinkKind = "ErrorListLink" + +// ErrorNilKind is the name of the type used to nil lists of objects of +// type 'error'. +const ErrorListNilKind = "ErrorListNil" + +// ErrorList is a list of values of the 'error' type. +type ErrorList struct { + href string + link bool + items []*Error +} + +// Kind returns the name of the type of the object. +func (l *ErrorList) Kind() string { + if l == nil { + return ErrorListNilKind + } + if l.link { + return ErrorListLinkKind + } + return ErrorListKind +} + +// Link returns true iif this is a link. +func (l *ErrorList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ErrorList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ErrorList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ErrorList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ErrorList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ErrorList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ErrorList) SetItems(items []*Error) { + l.items = items +} + +// Items returns the items of the list. +func (l *ErrorList) Items() []*Error { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ErrorList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ErrorList) Get(i int) *Error { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ErrorList) Slice() []*Error { + var slice []*Error + if l == nil { + slice = make([]*Error, 0) + } else { + slice = make([]*Error, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ErrorList) Each(f func(item *Error) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ErrorList) Range(f func(index int, item *Error) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/webrca/v1/error_type_json.go b/clientapi/webrca/v1/error_type_json.go new file mode 100644 index 00000000..cde9d377 --- /dev/null +++ b/clientapi/webrca/v1/error_type_json.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalError writes a value of the 'error' type to the given writer. +func MarshalError(object *Error, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteError(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteError writes a value of the 'error' type to the given stream. +func WriteError(object *Error, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ErrorLinkKind) + } else { + stream.WriteString(ErrorKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("code") + stream.WriteString(object.code) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("reason") + stream.WriteString(object.reason) + } + stream.WriteObjectEnd() +} + +// UnmarshalError reads a value of the 'error' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalError(source interface{}) (object *Error, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadError(iterator) + err = iterator.Error + return +} + +// ReadError reads a value of the 'error' type from the given iterator. +func ReadError(iterator *jsoniter.Iterator) *Error { + object := &Error{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ErrorLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "code": + value := iterator.ReadString() + object.code = value + object.bitmap_ |= 8 + case "reason": + value := iterator.ReadString() + object.reason = value + object.bitmap_ |= 16 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/webrca/v1/escalation_builder.go b/clientapi/webrca/v1/escalation_builder.go new file mode 100644 index 00000000..a973a6da --- /dev/null +++ b/clientapi/webrca/v1/escalation_builder.go @@ -0,0 +1,138 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// EscalationBuilder contains the data and logic needed to build 'escalation' objects. +// +// Definition of a Web RCA escalation. +type EscalationBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + updatedAt time.Time + user *UserBuilder +} + +// NewEscalation creates a new builder of 'escalation' objects. +func NewEscalation() *EscalationBuilder { + return &EscalationBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *EscalationBuilder) Link(value bool) *EscalationBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *EscalationBuilder) ID(value string) *EscalationBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *EscalationBuilder) HREF(value string) *EscalationBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *EscalationBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *EscalationBuilder) CreatedAt(value time.Time) *EscalationBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// DeletedAt sets the value of the 'deleted_at' attribute to the given value. +func (b *EscalationBuilder) DeletedAt(value time.Time) *EscalationBuilder { + b.deletedAt = value + b.bitmap_ |= 16 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *EscalationBuilder) UpdatedAt(value time.Time) *EscalationBuilder { + b.updatedAt = value + b.bitmap_ |= 32 + return b +} + +// User sets the value of the 'user' attribute to the given value. +// +// Definition of a Web RCA user. +func (b *EscalationBuilder) User(value *UserBuilder) *EscalationBuilder { + b.user = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *EscalationBuilder) Copy(object *Escalation) *EscalationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.deletedAt = object.deletedAt + b.updatedAt = object.updatedAt + if object.user != nil { + b.user = NewUser().Copy(object.user) + } else { + b.user = nil + } + return b +} + +// Build creates a 'escalation' object using the configuration stored in the builder. +func (b *EscalationBuilder) Build() (object *Escalation, err error) { + object = new(Escalation) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.deletedAt = b.deletedAt + object.updatedAt = b.updatedAt + if b.user != nil { + object.user, err = b.user.Build() + if err != nil { + return + } + } + return +} diff --git a/clientapi/webrca/v1/escalation_list_builder.go b/clientapi/webrca/v1/escalation_list_builder.go new file mode 100644 index 00000000..d2a23e0a --- /dev/null +++ b/clientapi/webrca/v1/escalation_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// EscalationListBuilder contains the data and logic needed to build +// 'escalation' objects. +type EscalationListBuilder struct { + items []*EscalationBuilder +} + +// NewEscalationList creates a new builder of 'escalation' objects. +func NewEscalationList() *EscalationListBuilder { + return new(EscalationListBuilder) +} + +// Items sets the items of the list. +func (b *EscalationListBuilder) Items(values ...*EscalationBuilder) *EscalationListBuilder { + b.items = make([]*EscalationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *EscalationListBuilder) 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 *EscalationListBuilder) Copy(list *EscalationList) *EscalationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*EscalationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewEscalation().Copy(v) + } + } + return b +} + +// Build creates a list of 'escalation' objects using the +// configuration stored in the builder. +func (b *EscalationListBuilder) Build() (list *EscalationList, err error) { + items := make([]*Escalation, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(EscalationList) + list.items = items + return +} diff --git a/clientapi/webrca/v1/escalation_list_type_json.go b/clientapi/webrca/v1/escalation_list_type_json.go new file mode 100644 index 00000000..45abe555 --- /dev/null +++ b/clientapi/webrca/v1/escalation_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalEscalationList writes a list of values of the 'escalation' type to +// the given writer. +func MarshalEscalationList(list []*Escalation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteEscalationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteEscalationList writes a list of value of the 'escalation' type to +// the given stream. +func WriteEscalationList(list []*Escalation, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteEscalation(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalEscalationList reads a list of values of the 'escalation' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalEscalationList(source interface{}) (items []*Escalation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadEscalationList(iterator) + err = iterator.Error + return +} + +// ReadEscalationList reads list of values of the ”escalation' type from +// the given iterator. +func ReadEscalationList(iterator *jsoniter.Iterator) []*Escalation { + list := []*Escalation{} + for iterator.ReadArray() { + item := ReadEscalation(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/escalation_type.go b/clientapi/webrca/v1/escalation_type.go new file mode 100644 index 00000000..c77ee2ce --- /dev/null +++ b/clientapi/webrca/v1/escalation_type.go @@ -0,0 +1,337 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// EscalationKind is the name of the type used to represent objects +// of type 'escalation'. +const EscalationKind = "Escalation" + +// EscalationLinkKind is the name of the type used to represent links +// to objects of type 'escalation'. +const EscalationLinkKind = "EscalationLink" + +// EscalationNilKind is the name of the type used to nil references +// to objects of type 'escalation'. +const EscalationNilKind = "EscalationNil" + +// Escalation represents the values of the 'escalation' type. +// +// Definition of a Web RCA escalation. +type Escalation struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + updatedAt time.Time + user *User +} + +// Kind returns the name of the type of the object. +func (o *Escalation) Kind() string { + if o == nil { + return EscalationNilKind + } + if o.bitmap_&1 != 0 { + return EscalationLinkKind + } + return EscalationKind +} + +// Link returns true if this is a link. +func (o *Escalation) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Escalation) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Escalation) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Escalation) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Escalation) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Escalation) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *Escalation) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *Escalation) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// DeletedAt returns the value of the 'deleted_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object deletion timestamp. +func (o *Escalation) DeletedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.deletedAt + } + return time.Time{} +} + +// GetDeletedAt returns the value of the 'deleted_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object deletion timestamp. +func (o *Escalation) GetDeletedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.deletedAt + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *Escalation) UpdatedAt() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *Escalation) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.updatedAt + } + return +} + +// User returns the value of the 'user' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Escalation) User() *User { + if o != nil && o.bitmap_&64 != 0 { + return o.user + } + return nil +} + +// GetUser returns the value of the 'user' attribute and +// a flag indicating if the attribute has a value. +func (o *Escalation) GetUser() (value *User, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.user + } + return +} + +// EscalationListKind is the name of the type used to represent list of objects of +// type 'escalation'. +const EscalationListKind = "EscalationList" + +// EscalationListLinkKind is the name of the type used to represent links to list +// of objects of type 'escalation'. +const EscalationListLinkKind = "EscalationListLink" + +// EscalationNilKind is the name of the type used to nil lists of objects of +// type 'escalation'. +const EscalationListNilKind = "EscalationListNil" + +// EscalationList is a list of values of the 'escalation' type. +type EscalationList struct { + href string + link bool + items []*Escalation +} + +// Kind returns the name of the type of the object. +func (l *EscalationList) Kind() string { + if l == nil { + return EscalationListNilKind + } + if l.link { + return EscalationListLinkKind + } + return EscalationListKind +} + +// Link returns true iif this is a link. +func (l *EscalationList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *EscalationList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *EscalationList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *EscalationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *EscalationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *EscalationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *EscalationList) SetItems(items []*Escalation) { + l.items = items +} + +// Items returns the items of the list. +func (l *EscalationList) Items() []*Escalation { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *EscalationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *EscalationList) Get(i int) *Escalation { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *EscalationList) Slice() []*Escalation { + var slice []*Escalation + if l == nil { + slice = make([]*Escalation, 0) + } else { + slice = make([]*Escalation, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *EscalationList) Each(f func(item *Escalation) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *EscalationList) Range(f func(index int, item *Escalation) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/webrca/v1/escalation_type_json.go b/clientapi/webrca/v1/escalation_type_json.go new file mode 100644 index 00000000..101b1a63 --- /dev/null +++ b/clientapi/webrca/v1/escalation_type_json.go @@ -0,0 +1,172 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalEscalation writes a value of the 'escalation' type to the given writer. +func MarshalEscalation(object *Escalation, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteEscalation(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteEscalation writes a value of the 'escalation' type to the given stream. +func WriteEscalation(object *Escalation, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(EscalationLinkKind) + } else { + stream.WriteString(EscalationKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deleted_at") + stream.WriteString((object.deletedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 && object.user != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("user") + WriteUser(object.user, stream) + } + stream.WriteObjectEnd() +} + +// UnmarshalEscalation reads a value of the 'escalation' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalEscalation(source interface{}) (object *Escalation, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadEscalation(iterator) + err = iterator.Error + return +} + +// ReadEscalation reads a value of the 'escalation' type from the given iterator. +func ReadEscalation(iterator *jsoniter.Iterator) *Escalation { + object := &Escalation{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == EscalationLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "deleted_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.deletedAt = value + object.bitmap_ |= 16 + 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_ |= 32 + case "user": + value := ReadUser(iterator) + object.user = value + object.bitmap_ |= 64 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/webrca/v1/event_builder.go b/clientapi/webrca/v1/event_builder.go new file mode 100644 index 00000000..af1c4a94 --- /dev/null +++ b/clientapi/webrca/v1/event_builder.go @@ -0,0 +1,318 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// EventBuilder contains the data and logic needed to build 'event' objects. +// +// Definition of a Web RCA event. +type EventBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + creator *UserBuilder + deletedAt time.Time + escalation *EscalationBuilder + eventType string + externalReferenceUrl string + followUp *FollowUpBuilder + followUpChange *FollowUpChangeBuilder + handoff *HandoffBuilder + incident *IncidentBuilder + note string + statusChange *StatusChangeBuilder + updatedAt time.Time +} + +// NewEvent creates a new builder of 'event' objects. +func NewEvent() *EventBuilder { + return &EventBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *EventBuilder) Link(value bool) *EventBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *EventBuilder) ID(value string) *EventBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *EventBuilder) HREF(value string) *EventBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *EventBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *EventBuilder) CreatedAt(value time.Time) *EventBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// Creator sets the value of the 'creator' attribute to the given value. +// +// Definition of a Web RCA user. +func (b *EventBuilder) Creator(value *UserBuilder) *EventBuilder { + b.creator = value + if value != nil { + b.bitmap_ |= 16 + } else { + b.bitmap_ &^= 16 + } + return b +} + +// DeletedAt sets the value of the 'deleted_at' attribute to the given value. +func (b *EventBuilder) DeletedAt(value time.Time) *EventBuilder { + b.deletedAt = value + b.bitmap_ |= 32 + return b +} + +// Escalation sets the value of the 'escalation' attribute to the given value. +// +// Definition of a Web RCA escalation. +func (b *EventBuilder) Escalation(value *EscalationBuilder) *EventBuilder { + b.escalation = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// EventType sets the value of the 'event_type' attribute to the given value. +func (b *EventBuilder) EventType(value string) *EventBuilder { + b.eventType = value + b.bitmap_ |= 128 + return b +} + +// ExternalReferenceUrl sets the value of the 'external_reference_url' attribute to the given value. +func (b *EventBuilder) ExternalReferenceUrl(value string) *EventBuilder { + b.externalReferenceUrl = value + b.bitmap_ |= 256 + return b +} + +// FollowUp sets the value of the 'follow_up' attribute to the given value. +// +// Definition of a Web RCA event. +func (b *EventBuilder) FollowUp(value *FollowUpBuilder) *EventBuilder { + b.followUp = value + if value != nil { + b.bitmap_ |= 512 + } else { + b.bitmap_ &^= 512 + } + return b +} + +// FollowUpChange sets the value of the 'follow_up_change' attribute to the given value. +// +// Definition of a Web RCA event. +func (b *EventBuilder) FollowUpChange(value *FollowUpChangeBuilder) *EventBuilder { + b.followUpChange = value + if value != nil { + b.bitmap_ |= 1024 + } else { + b.bitmap_ &^= 1024 + } + return b +} + +// Handoff sets the value of the 'handoff' attribute to the given value. +// +// Definition of a Web RCA handoff. +func (b *EventBuilder) Handoff(value *HandoffBuilder) *EventBuilder { + b.handoff = value + if value != nil { + b.bitmap_ |= 2048 + } else { + b.bitmap_ &^= 2048 + } + return b +} + +// Incident sets the value of the 'incident' attribute to the given value. +// +// Definition of a Web RCA incident. +func (b *EventBuilder) Incident(value *IncidentBuilder) *EventBuilder { + b.incident = value + if value != nil { + b.bitmap_ |= 4096 + } else { + b.bitmap_ &^= 4096 + } + return b +} + +// Note sets the value of the 'note' attribute to the given value. +func (b *EventBuilder) Note(value string) *EventBuilder { + b.note = value + b.bitmap_ |= 8192 + return b +} + +// StatusChange sets the value of the 'status_change' attribute to the given value. +// +// Definition of a Web RCA event. +func (b *EventBuilder) StatusChange(value *StatusChangeBuilder) *EventBuilder { + b.statusChange = value + if value != nil { + b.bitmap_ |= 16384 + } else { + b.bitmap_ &^= 16384 + } + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *EventBuilder) UpdatedAt(value time.Time) *EventBuilder { + b.updatedAt = value + b.bitmap_ |= 32768 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *EventBuilder) Copy(object *Event) *EventBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + if object.creator != nil { + b.creator = NewUser().Copy(object.creator) + } else { + b.creator = nil + } + b.deletedAt = object.deletedAt + if object.escalation != nil { + b.escalation = NewEscalation().Copy(object.escalation) + } else { + b.escalation = nil + } + b.eventType = object.eventType + b.externalReferenceUrl = object.externalReferenceUrl + if object.followUp != nil { + b.followUp = NewFollowUp().Copy(object.followUp) + } else { + b.followUp = nil + } + if object.followUpChange != nil { + b.followUpChange = NewFollowUpChange().Copy(object.followUpChange) + } else { + b.followUpChange = nil + } + if object.handoff != nil { + b.handoff = NewHandoff().Copy(object.handoff) + } else { + b.handoff = nil + } + if object.incident != nil { + b.incident = NewIncident().Copy(object.incident) + } else { + b.incident = nil + } + b.note = object.note + if object.statusChange != nil { + b.statusChange = NewStatusChange().Copy(object.statusChange) + } else { + b.statusChange = nil + } + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'event' object using the configuration stored in the builder. +func (b *EventBuilder) Build() (object *Event, err error) { + object = new(Event) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + if b.creator != nil { + object.creator, err = b.creator.Build() + if err != nil { + return + } + } + object.deletedAt = b.deletedAt + if b.escalation != nil { + object.escalation, err = b.escalation.Build() + if err != nil { + return + } + } + object.eventType = b.eventType + object.externalReferenceUrl = b.externalReferenceUrl + if b.followUp != nil { + object.followUp, err = b.followUp.Build() + if err != nil { + return + } + } + if b.followUpChange != nil { + object.followUpChange, err = b.followUpChange.Build() + if err != nil { + return + } + } + if b.handoff != nil { + object.handoff, err = b.handoff.Build() + if err != nil { + return + } + } + if b.incident != nil { + object.incident, err = b.incident.Build() + if err != nil { + return + } + } + object.note = b.note + if b.statusChange != nil { + object.statusChange, err = b.statusChange.Build() + if err != nil { + return + } + } + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/webrca/v1/event_list_builder.go b/clientapi/webrca/v1/event_list_builder.go new file mode 100644 index 00000000..d121983f --- /dev/null +++ b/clientapi/webrca/v1/event_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// EventListBuilder contains the data and logic needed to build +// 'event' objects. +type EventListBuilder struct { + items []*EventBuilder +} + +// NewEventList creates a new builder of 'event' objects. +func NewEventList() *EventListBuilder { + return new(EventListBuilder) +} + +// Items sets the items of the list. +func (b *EventListBuilder) Items(values ...*EventBuilder) *EventListBuilder { + b.items = make([]*EventBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *EventListBuilder) 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 *EventListBuilder) Copy(list *EventList) *EventListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*EventBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewEvent().Copy(v) + } + } + return b +} + +// Build creates a list of 'event' objects using the +// configuration stored in the builder. +func (b *EventListBuilder) Build() (list *EventList, err error) { + items := make([]*Event, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(EventList) + list.items = items + return +} diff --git a/clientapi/webrca/v1/event_list_type_json.go b/clientapi/webrca/v1/event_list_type_json.go new file mode 100644 index 00000000..2a9d64d9 --- /dev/null +++ b/clientapi/webrca/v1/event_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalEventList writes a list of values of the 'event' type to +// the given writer. +func MarshalEventList(list []*Event, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteEventList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteEventList writes a list of value of the 'event' type to +// the given stream. +func WriteEventList(list []*Event, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteEvent(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalEventList reads a list of values of the 'event' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalEventList(source interface{}) (items []*Event, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadEventList(iterator) + err = iterator.Error + return +} + +// ReadEventList reads list of values of the ”event' type from +// the given iterator. +func ReadEventList(iterator *jsoniter.Iterator) []*Event { + list := []*Event{} + for iterator.ReadArray() { + item := ReadEvent(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/event_type.go b/clientapi/webrca/v1/event_type.go new file mode 100644 index 00000000..55c219ab --- /dev/null +++ b/clientapi/webrca/v1/event_type.go @@ -0,0 +1,517 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// EventKind is the name of the type used to represent objects +// of type 'event'. +const EventKind = "Event" + +// EventLinkKind is the name of the type used to represent links +// to objects of type 'event'. +const EventLinkKind = "EventLink" + +// EventNilKind is the name of the type used to nil references +// to objects of type 'event'. +const EventNilKind = "EventNil" + +// Event represents the values of the 'event' type. +// +// Definition of a Web RCA event. +type Event struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + creator *User + deletedAt time.Time + escalation *Escalation + eventType string + externalReferenceUrl string + followUp *FollowUp + followUpChange *FollowUpChange + handoff *Handoff + incident *Incident + note string + statusChange *StatusChange + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *Event) Kind() string { + if o == nil { + return EventNilKind + } + if o.bitmap_&1 != 0 { + return EventLinkKind + } + return EventKind +} + +// Link returns true if this is a link. +func (o *Event) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Event) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Event) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Event) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Event) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Event) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *Event) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *Event) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// Creator returns the value of the 'creator' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Event) Creator() *User { + if o != nil && o.bitmap_&16 != 0 { + return o.creator + } + return nil +} + +// GetCreator returns the value of the 'creator' attribute and +// a flag indicating if the attribute has a value. +func (o *Event) GetCreator() (value *User, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.creator + } + return +} + +// DeletedAt returns the value of the 'deleted_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object deletion timestamp. +func (o *Event) DeletedAt() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.deletedAt + } + return time.Time{} +} + +// GetDeletedAt returns the value of the 'deleted_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object deletion timestamp. +func (o *Event) GetDeletedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.deletedAt + } + return +} + +// Escalation returns the value of the 'escalation' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Event) Escalation() *Escalation { + if o != nil && o.bitmap_&64 != 0 { + return o.escalation + } + return nil +} + +// GetEscalation returns the value of the 'escalation' attribute and +// a flag indicating if the attribute has a value. +func (o *Event) GetEscalation() (value *Escalation, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.escalation + } + return +} + +// EventType returns the value of the 'event_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Event) EventType() string { + if o != nil && o.bitmap_&128 != 0 { + return o.eventType + } + return "" +} + +// GetEventType returns the value of the 'event_type' attribute and +// a flag indicating if the attribute has a value. +func (o *Event) GetEventType() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.eventType + } + return +} + +// ExternalReferenceUrl returns the value of the 'external_reference_url' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Event) ExternalReferenceUrl() string { + if o != nil && o.bitmap_&256 != 0 { + return o.externalReferenceUrl + } + return "" +} + +// GetExternalReferenceUrl returns the value of the 'external_reference_url' attribute and +// a flag indicating if the attribute has a value. +func (o *Event) GetExternalReferenceUrl() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.externalReferenceUrl + } + return +} + +// FollowUp returns the value of the 'follow_up' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Event) FollowUp() *FollowUp { + if o != nil && o.bitmap_&512 != 0 { + return o.followUp + } + return nil +} + +// GetFollowUp returns the value of the 'follow_up' attribute and +// a flag indicating if the attribute has a value. +func (o *Event) GetFollowUp() (value *FollowUp, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.followUp + } + return +} + +// FollowUpChange returns the value of the 'follow_up_change' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Event) FollowUpChange() *FollowUpChange { + if o != nil && o.bitmap_&1024 != 0 { + return o.followUpChange + } + return nil +} + +// GetFollowUpChange returns the value of the 'follow_up_change' attribute and +// a flag indicating if the attribute has a value. +func (o *Event) GetFollowUpChange() (value *FollowUpChange, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.followUpChange + } + return +} + +// Handoff returns the value of the 'handoff' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Event) Handoff() *Handoff { + if o != nil && o.bitmap_&2048 != 0 { + return o.handoff + } + return nil +} + +// GetHandoff returns the value of the 'handoff' attribute and +// a flag indicating if the attribute has a value. +func (o *Event) GetHandoff() (value *Handoff, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.handoff + } + return +} + +// Incident returns the value of the 'incident' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Event) Incident() *Incident { + if o != nil && o.bitmap_&4096 != 0 { + return o.incident + } + return nil +} + +// GetIncident returns the value of the 'incident' attribute and +// a flag indicating if the attribute has a value. +func (o *Event) GetIncident() (value *Incident, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.incident + } + return +} + +// Note returns the value of the 'note' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Event) Note() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.note + } + return "" +} + +// GetNote returns the value of the 'note' attribute and +// a flag indicating if the attribute has a value. +func (o *Event) GetNote() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.note + } + return +} + +// StatusChange returns the value of the 'status_change' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Event) StatusChange() *StatusChange { + if o != nil && o.bitmap_&16384 != 0 { + return o.statusChange + } + return nil +} + +// GetStatusChange returns the value of the 'status_change' attribute and +// a flag indicating if the attribute has a value. +func (o *Event) GetStatusChange() (value *StatusChange, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.statusChange + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *Event) UpdatedAt() time.Time { + if o != nil && o.bitmap_&32768 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *Event) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.updatedAt + } + return +} + +// EventListKind is the name of the type used to represent list of objects of +// type 'event'. +const EventListKind = "EventList" + +// EventListLinkKind is the name of the type used to represent links to list +// of objects of type 'event'. +const EventListLinkKind = "EventListLink" + +// EventNilKind is the name of the type used to nil lists of objects of +// type 'event'. +const EventListNilKind = "EventListNil" + +// EventList is a list of values of the 'event' type. +type EventList struct { + href string + link bool + items []*Event +} + +// Kind returns the name of the type of the object. +func (l *EventList) Kind() string { + if l == nil { + return EventListNilKind + } + if l.link { + return EventListLinkKind + } + return EventListKind +} + +// Link returns true iif this is a link. +func (l *EventList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *EventList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *EventList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *EventList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *EventList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *EventList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *EventList) SetItems(items []*Event) { + l.items = items +} + +// Items returns the items of the list. +func (l *EventList) Items() []*Event { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *EventList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *EventList) Get(i int) *Event { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *EventList) Slice() []*Event { + var slice []*Event + if l == nil { + slice = make([]*Event, 0) + } else { + slice = make([]*Event, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *EventList) Each(f func(item *Event) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *EventList) Range(f func(index int, item *Event) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/webrca/v1/event_type_json.go b/clientapi/webrca/v1/event_type_json.go new file mode 100644 index 00000000..436e1a31 --- /dev/null +++ b/clientapi/webrca/v1/event_type_json.go @@ -0,0 +1,289 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalEvent writes a value of the 'event' type to the given writer. +func MarshalEvent(object *Event, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteEvent(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteEvent writes a value of the 'event' type to the given stream. +func WriteEvent(object *Event, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(EventLinkKind) + } else { + stream.WriteString(EventKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 && object.creator != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creator") + WriteUser(object.creator, stream) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deleted_at") + stream.WriteString((object.deletedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 && object.escalation != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("escalation") + WriteEscalation(object.escalation, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("event_type") + stream.WriteString(object.eventType) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_reference_url") + stream.WriteString(object.externalReferenceUrl) + count++ + } + present_ = object.bitmap_&512 != 0 && object.followUp != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("follow_up") + WriteFollowUp(object.followUp, stream) + count++ + } + present_ = object.bitmap_&1024 != 0 && object.followUpChange != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("follow_up_change") + WriteFollowUpChange(object.followUpChange, stream) + count++ + } + present_ = object.bitmap_&2048 != 0 && object.handoff != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("handoff") + WriteHandoff(object.handoff, stream) + count++ + } + present_ = object.bitmap_&4096 != 0 && object.incident != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("incident") + WriteIncident(object.incident, stream) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("note") + stream.WriteString(object.note) + count++ + } + present_ = object.bitmap_&16384 != 0 && object.statusChange != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status_change") + WriteStatusChange(object.statusChange, stream) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalEvent reads a value of the 'event' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalEvent(source interface{}) (object *Event, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadEvent(iterator) + err = iterator.Error + return +} + +// ReadEvent reads a value of the 'event' type from the given iterator. +func ReadEvent(iterator *jsoniter.Iterator) *Event { + object := &Event{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == EventLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "creator": + value := ReadUser(iterator) + object.creator = value + object.bitmap_ |= 16 + case "deleted_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.deletedAt = value + object.bitmap_ |= 32 + case "escalation": + value := ReadEscalation(iterator) + object.escalation = value + object.bitmap_ |= 64 + case "event_type": + value := iterator.ReadString() + object.eventType = value + object.bitmap_ |= 128 + case "external_reference_url": + value := iterator.ReadString() + object.externalReferenceUrl = value + object.bitmap_ |= 256 + case "follow_up": + value := ReadFollowUp(iterator) + object.followUp = value + object.bitmap_ |= 512 + case "follow_up_change": + value := ReadFollowUpChange(iterator) + object.followUpChange = value + object.bitmap_ |= 1024 + case "handoff": + value := ReadHandoff(iterator) + object.handoff = value + object.bitmap_ |= 2048 + case "incident": + value := ReadIncident(iterator) + object.incident = value + object.bitmap_ |= 4096 + case "note": + value := iterator.ReadString() + object.note = value + object.bitmap_ |= 8192 + case "status_change": + value := ReadStatusChange(iterator) + object.statusChange = value + object.bitmap_ |= 16384 + 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_ |= 32768 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/webrca/v1/float_list_type_json.go b/clientapi/webrca/v1/float_list_type_json.go new file mode 100644 index 00000000..e83580d4 --- /dev/null +++ b/clientapi/webrca/v1/float_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFloatList writes a list of values of the 'float' type to +// the given writer. +func MarshalFloatList(list []float64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFloatList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFloatList writes a list of value of the 'float' type to +// the given stream. +func WriteFloatList(list []float64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteFloat64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalFloatList reads a list of values of the 'float' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFloatList(source interface{}) (items []float64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFloatList(iterator) + err = iterator.Error + return +} + +// ReadFloatList reads list of values of the ”float' type from +// the given iterator. +func ReadFloatList(iterator *jsoniter.Iterator) []float64 { + list := []float64{} + for iterator.ReadArray() { + item := iterator.ReadFloat64() + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/follow_up_builder.go b/clientapi/webrca/v1/follow_up_builder.go new file mode 100644 index 00000000..4c676986 --- /dev/null +++ b/clientapi/webrca/v1/follow_up_builder.go @@ -0,0 +1,228 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// FollowUpBuilder contains the data and logic needed to build 'follow_up' objects. +// +// Definition of a Web RCA event. +type FollowUpBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + followUpType string + incident *IncidentBuilder + owner string + priority string + status string + title string + updatedAt time.Time + url string + workedAt time.Time + archived bool + done bool +} + +// NewFollowUp creates a new builder of 'follow_up' objects. +func NewFollowUp() *FollowUpBuilder { + return &FollowUpBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *FollowUpBuilder) Link(value bool) *FollowUpBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *FollowUpBuilder) ID(value string) *FollowUpBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *FollowUpBuilder) HREF(value string) *FollowUpBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *FollowUpBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Archived sets the value of the 'archived' attribute to the given value. +func (b *FollowUpBuilder) Archived(value bool) *FollowUpBuilder { + b.archived = value + b.bitmap_ |= 8 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *FollowUpBuilder) CreatedAt(value time.Time) *FollowUpBuilder { + b.createdAt = value + b.bitmap_ |= 16 + return b +} + +// DeletedAt sets the value of the 'deleted_at' attribute to the given value. +func (b *FollowUpBuilder) DeletedAt(value time.Time) *FollowUpBuilder { + b.deletedAt = value + b.bitmap_ |= 32 + return b +} + +// Done sets the value of the 'done' attribute to the given value. +func (b *FollowUpBuilder) Done(value bool) *FollowUpBuilder { + b.done = value + b.bitmap_ |= 64 + return b +} + +// FollowUpType sets the value of the 'follow_up_type' attribute to the given value. +func (b *FollowUpBuilder) FollowUpType(value string) *FollowUpBuilder { + b.followUpType = value + b.bitmap_ |= 128 + return b +} + +// Incident sets the value of the 'incident' attribute to the given value. +// +// Definition of a Web RCA incident. +func (b *FollowUpBuilder) Incident(value *IncidentBuilder) *FollowUpBuilder { + b.incident = value + if value != nil { + b.bitmap_ |= 256 + } else { + b.bitmap_ &^= 256 + } + return b +} + +// Owner sets the value of the 'owner' attribute to the given value. +func (b *FollowUpBuilder) Owner(value string) *FollowUpBuilder { + b.owner = value + b.bitmap_ |= 512 + return b +} + +// Priority sets the value of the 'priority' attribute to the given value. +func (b *FollowUpBuilder) Priority(value string) *FollowUpBuilder { + b.priority = value + b.bitmap_ |= 1024 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *FollowUpBuilder) Status(value string) *FollowUpBuilder { + b.status = value + b.bitmap_ |= 2048 + return b +} + +// Title sets the value of the 'title' attribute to the given value. +func (b *FollowUpBuilder) Title(value string) *FollowUpBuilder { + b.title = value + b.bitmap_ |= 4096 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *FollowUpBuilder) UpdatedAt(value time.Time) *FollowUpBuilder { + b.updatedAt = value + b.bitmap_ |= 8192 + return b +} + +// Url sets the value of the 'url' attribute to the given value. +func (b *FollowUpBuilder) Url(value string) *FollowUpBuilder { + b.url = value + b.bitmap_ |= 16384 + return b +} + +// WorkedAt sets the value of the 'worked_at' attribute to the given value. +func (b *FollowUpBuilder) WorkedAt(value time.Time) *FollowUpBuilder { + b.workedAt = value + b.bitmap_ |= 32768 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *FollowUpBuilder) Copy(object *FollowUp) *FollowUpBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.archived = object.archived + b.createdAt = object.createdAt + b.deletedAt = object.deletedAt + b.done = object.done + b.followUpType = object.followUpType + if object.incident != nil { + b.incident = NewIncident().Copy(object.incident) + } else { + b.incident = nil + } + b.owner = object.owner + b.priority = object.priority + b.status = object.status + b.title = object.title + b.updatedAt = object.updatedAt + b.url = object.url + b.workedAt = object.workedAt + return b +} + +// Build creates a 'follow_up' object using the configuration stored in the builder. +func (b *FollowUpBuilder) Build() (object *FollowUp, err error) { + object = new(FollowUp) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.archived = b.archived + object.createdAt = b.createdAt + object.deletedAt = b.deletedAt + object.done = b.done + object.followUpType = b.followUpType + if b.incident != nil { + object.incident, err = b.incident.Build() + if err != nil { + return + } + } + object.owner = b.owner + object.priority = b.priority + object.status = b.status + object.title = b.title + object.updatedAt = b.updatedAt + object.url = b.url + object.workedAt = b.workedAt + return +} diff --git a/clientapi/webrca/v1/follow_up_change_builder.go b/clientapi/webrca/v1/follow_up_change_builder.go new file mode 100644 index 00000000..6f94300c --- /dev/null +++ b/clientapi/webrca/v1/follow_up_change_builder.go @@ -0,0 +1,148 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// FollowUpChangeBuilder contains the data and logic needed to build 'follow_up_change' objects. +// +// Definition of a Web RCA event. +type FollowUpChangeBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + followUp *FollowUpBuilder + status interface{} + updatedAt time.Time +} + +// NewFollowUpChange creates a new builder of 'follow_up_change' objects. +func NewFollowUpChange() *FollowUpChangeBuilder { + return &FollowUpChangeBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *FollowUpChangeBuilder) Link(value bool) *FollowUpChangeBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *FollowUpChangeBuilder) ID(value string) *FollowUpChangeBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *FollowUpChangeBuilder) HREF(value string) *FollowUpChangeBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *FollowUpChangeBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *FollowUpChangeBuilder) CreatedAt(value time.Time) *FollowUpChangeBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// DeletedAt sets the value of the 'deleted_at' attribute to the given value. +func (b *FollowUpChangeBuilder) DeletedAt(value time.Time) *FollowUpChangeBuilder { + b.deletedAt = value + b.bitmap_ |= 16 + return b +} + +// FollowUp sets the value of the 'follow_up' attribute to the given value. +// +// Definition of a Web RCA event. +func (b *FollowUpChangeBuilder) FollowUp(value *FollowUpBuilder) *FollowUpChangeBuilder { + b.followUp = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *FollowUpChangeBuilder) Status(value interface{}) *FollowUpChangeBuilder { + b.status = value + b.bitmap_ |= 64 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *FollowUpChangeBuilder) UpdatedAt(value time.Time) *FollowUpChangeBuilder { + b.updatedAt = value + b.bitmap_ |= 128 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *FollowUpChangeBuilder) Copy(object *FollowUpChange) *FollowUpChangeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.deletedAt = object.deletedAt + if object.followUp != nil { + b.followUp = NewFollowUp().Copy(object.followUp) + } else { + b.followUp = nil + } + b.status = object.status + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'follow_up_change' object using the configuration stored in the builder. +func (b *FollowUpChangeBuilder) Build() (object *FollowUpChange, err error) { + object = new(FollowUpChange) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.deletedAt = b.deletedAt + if b.followUp != nil { + object.followUp, err = b.followUp.Build() + if err != nil { + return + } + } + object.status = b.status + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/webrca/v1/follow_up_change_list_builder.go b/clientapi/webrca/v1/follow_up_change_list_builder.go new file mode 100644 index 00000000..a20fa6b6 --- /dev/null +++ b/clientapi/webrca/v1/follow_up_change_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// FollowUpChangeListBuilder contains the data and logic needed to build +// 'follow_up_change' objects. +type FollowUpChangeListBuilder struct { + items []*FollowUpChangeBuilder +} + +// NewFollowUpChangeList creates a new builder of 'follow_up_change' objects. +func NewFollowUpChangeList() *FollowUpChangeListBuilder { + return new(FollowUpChangeListBuilder) +} + +// Items sets the items of the list. +func (b *FollowUpChangeListBuilder) Items(values ...*FollowUpChangeBuilder) *FollowUpChangeListBuilder { + b.items = make([]*FollowUpChangeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *FollowUpChangeListBuilder) 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 *FollowUpChangeListBuilder) Copy(list *FollowUpChangeList) *FollowUpChangeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*FollowUpChangeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewFollowUpChange().Copy(v) + } + } + return b +} + +// Build creates a list of 'follow_up_change' objects using the +// configuration stored in the builder. +func (b *FollowUpChangeListBuilder) Build() (list *FollowUpChangeList, err error) { + items := make([]*FollowUpChange, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(FollowUpChangeList) + list.items = items + return +} diff --git a/clientapi/webrca/v1/follow_up_change_list_type_json.go b/clientapi/webrca/v1/follow_up_change_list_type_json.go new file mode 100644 index 00000000..82c8d903 --- /dev/null +++ b/clientapi/webrca/v1/follow_up_change_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFollowUpChangeList writes a list of values of the 'follow_up_change' type to +// the given writer. +func MarshalFollowUpChangeList(list []*FollowUpChange, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFollowUpChangeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFollowUpChangeList writes a list of value of the 'follow_up_change' type to +// the given stream. +func WriteFollowUpChangeList(list []*FollowUpChange, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteFollowUpChange(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalFollowUpChangeList reads a list of values of the 'follow_up_change' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFollowUpChangeList(source interface{}) (items []*FollowUpChange, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFollowUpChangeList(iterator) + err = iterator.Error + return +} + +// ReadFollowUpChangeList reads list of values of the ”follow_up_change' type from +// the given iterator. +func ReadFollowUpChangeList(iterator *jsoniter.Iterator) []*FollowUpChange { + list := []*FollowUpChange{} + for iterator.ReadArray() { + item := ReadFollowUpChange(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/follow_up_change_type.go b/clientapi/webrca/v1/follow_up_change_type.go new file mode 100644 index 00000000..995c0e49 --- /dev/null +++ b/clientapi/webrca/v1/follow_up_change_type.go @@ -0,0 +1,357 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// FollowUpChangeKind is the name of the type used to represent objects +// of type 'follow_up_change'. +const FollowUpChangeKind = "FollowUpChange" + +// FollowUpChangeLinkKind is the name of the type used to represent links +// to objects of type 'follow_up_change'. +const FollowUpChangeLinkKind = "FollowUpChangeLink" + +// FollowUpChangeNilKind is the name of the type used to nil references +// to objects of type 'follow_up_change'. +const FollowUpChangeNilKind = "FollowUpChangeNil" + +// FollowUpChange represents the values of the 'follow_up_change' type. +// +// Definition of a Web RCA event. +type FollowUpChange struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + followUp *FollowUp + status interface{} + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *FollowUpChange) Kind() string { + if o == nil { + return FollowUpChangeNilKind + } + if o.bitmap_&1 != 0 { + return FollowUpChangeLinkKind + } + return FollowUpChangeKind +} + +// Link returns true if this is a link. +func (o *FollowUpChange) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *FollowUpChange) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *FollowUpChange) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *FollowUpChange) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *FollowUpChange) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *FollowUpChange) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *FollowUpChange) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *FollowUpChange) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// DeletedAt returns the value of the 'deleted_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object deletion timestamp. +func (o *FollowUpChange) DeletedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.deletedAt + } + return time.Time{} +} + +// GetDeletedAt returns the value of the 'deleted_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object deletion timestamp. +func (o *FollowUpChange) GetDeletedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.deletedAt + } + return +} + +// FollowUp returns the value of the 'follow_up' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FollowUpChange) FollowUp() *FollowUp { + if o != nil && o.bitmap_&32 != 0 { + return o.followUp + } + return nil +} + +// GetFollowUp returns the value of the 'follow_up' attribute and +// a flag indicating if the attribute has a value. +func (o *FollowUpChange) GetFollowUp() (value *FollowUp, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.followUp + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FollowUpChange) Status() interface{} { + if o != nil && o.bitmap_&64 != 0 { + return o.status + } + return nil +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +func (o *FollowUpChange) GetStatus() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.status + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *FollowUpChange) UpdatedAt() time.Time { + if o != nil && o.bitmap_&128 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *FollowUpChange) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.updatedAt + } + return +} + +// FollowUpChangeListKind is the name of the type used to represent list of objects of +// type 'follow_up_change'. +const FollowUpChangeListKind = "FollowUpChangeList" + +// FollowUpChangeListLinkKind is the name of the type used to represent links to list +// of objects of type 'follow_up_change'. +const FollowUpChangeListLinkKind = "FollowUpChangeListLink" + +// FollowUpChangeNilKind is the name of the type used to nil lists of objects of +// type 'follow_up_change'. +const FollowUpChangeListNilKind = "FollowUpChangeListNil" + +// FollowUpChangeList is a list of values of the 'follow_up_change' type. +type FollowUpChangeList struct { + href string + link bool + items []*FollowUpChange +} + +// Kind returns the name of the type of the object. +func (l *FollowUpChangeList) Kind() string { + if l == nil { + return FollowUpChangeListNilKind + } + if l.link { + return FollowUpChangeListLinkKind + } + return FollowUpChangeListKind +} + +// Link returns true iif this is a link. +func (l *FollowUpChangeList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *FollowUpChangeList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *FollowUpChangeList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *FollowUpChangeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *FollowUpChangeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *FollowUpChangeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *FollowUpChangeList) SetItems(items []*FollowUpChange) { + l.items = items +} + +// Items returns the items of the list. +func (l *FollowUpChangeList) Items() []*FollowUpChange { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *FollowUpChangeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *FollowUpChangeList) Get(i int) *FollowUpChange { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *FollowUpChangeList) Slice() []*FollowUpChange { + var slice []*FollowUpChange + if l == nil { + slice = make([]*FollowUpChange, 0) + } else { + slice = make([]*FollowUpChange, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *FollowUpChangeList) Each(f func(item *FollowUpChange) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *FollowUpChangeList) Range(f func(index int, item *FollowUpChange) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/webrca/v1/follow_up_change_type_json.go b/clientapi/webrca/v1/follow_up_change_type_json.go new file mode 100644 index 00000000..b752befa --- /dev/null +++ b/clientapi/webrca/v1/follow_up_change_type_json.go @@ -0,0 +1,186 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFollowUpChange writes a value of the 'follow_up_change' type to the given writer. +func MarshalFollowUpChange(object *FollowUpChange, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFollowUpChange(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFollowUpChange writes a value of the 'follow_up_change' type to the given stream. +func WriteFollowUpChange(object *FollowUpChange, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(FollowUpChangeLinkKind) + } else { + stream.WriteString(FollowUpChangeKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deleted_at") + stream.WriteString((object.deletedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 && object.followUp != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("follow_up") + WriteFollowUp(object.followUp, stream) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteVal(object.status) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalFollowUpChange reads a value of the 'follow_up_change' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalFollowUpChange(source interface{}) (object *FollowUpChange, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadFollowUpChange(iterator) + err = iterator.Error + return +} + +// ReadFollowUpChange reads a value of the 'follow_up_change' type from the given iterator. +func ReadFollowUpChange(iterator *jsoniter.Iterator) *FollowUpChange { + object := &FollowUpChange{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == FollowUpChangeLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "deleted_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.deletedAt = value + object.bitmap_ |= 16 + case "follow_up": + value := ReadFollowUp(iterator) + object.followUp = value + object.bitmap_ |= 32 + case "status": + var value interface{} + iterator.ReadVal(&value) + object.status = value + object.bitmap_ |= 64 + 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_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/webrca/v1/follow_up_list_builder.go b/clientapi/webrca/v1/follow_up_list_builder.go new file mode 100644 index 00000000..9869111d --- /dev/null +++ b/clientapi/webrca/v1/follow_up_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// FollowUpListBuilder contains the data and logic needed to build +// 'follow_up' objects. +type FollowUpListBuilder struct { + items []*FollowUpBuilder +} + +// NewFollowUpList creates a new builder of 'follow_up' objects. +func NewFollowUpList() *FollowUpListBuilder { + return new(FollowUpListBuilder) +} + +// Items sets the items of the list. +func (b *FollowUpListBuilder) Items(values ...*FollowUpBuilder) *FollowUpListBuilder { + b.items = make([]*FollowUpBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *FollowUpListBuilder) 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 *FollowUpListBuilder) Copy(list *FollowUpList) *FollowUpListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*FollowUpBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewFollowUp().Copy(v) + } + } + return b +} + +// Build creates a list of 'follow_up' objects using the +// configuration stored in the builder. +func (b *FollowUpListBuilder) Build() (list *FollowUpList, err error) { + items := make([]*FollowUp, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(FollowUpList) + list.items = items + return +} diff --git a/clientapi/webrca/v1/follow_up_list_type_json.go b/clientapi/webrca/v1/follow_up_list_type_json.go new file mode 100644 index 00000000..293ad636 --- /dev/null +++ b/clientapi/webrca/v1/follow_up_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFollowUpList writes a list of values of the 'follow_up' type to +// the given writer. +func MarshalFollowUpList(list []*FollowUp, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFollowUpList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFollowUpList writes a list of value of the 'follow_up' type to +// the given stream. +func WriteFollowUpList(list []*FollowUp, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteFollowUp(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalFollowUpList reads a list of values of the 'follow_up' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalFollowUpList(source interface{}) (items []*FollowUp, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadFollowUpList(iterator) + err = iterator.Error + return +} + +// ReadFollowUpList reads list of values of the ”follow_up' type from +// the given iterator. +func ReadFollowUpList(iterator *jsoniter.Iterator) []*FollowUp { + list := []*FollowUp{} + for iterator.ReadArray() { + item := ReadFollowUp(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/follow_up_type.go b/clientapi/webrca/v1/follow_up_type.go new file mode 100644 index 00000000..16af1148 --- /dev/null +++ b/clientapi/webrca/v1/follow_up_type.go @@ -0,0 +1,517 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// FollowUpKind is the name of the type used to represent objects +// of type 'follow_up'. +const FollowUpKind = "FollowUp" + +// FollowUpLinkKind is the name of the type used to represent links +// to objects of type 'follow_up'. +const FollowUpLinkKind = "FollowUpLink" + +// FollowUpNilKind is the name of the type used to nil references +// to objects of type 'follow_up'. +const FollowUpNilKind = "FollowUpNil" + +// FollowUp represents the values of the 'follow_up' type. +// +// Definition of a Web RCA event. +type FollowUp struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + followUpType string + incident *Incident + owner string + priority string + status string + title string + updatedAt time.Time + url string + workedAt time.Time + archived bool + done bool +} + +// Kind returns the name of the type of the object. +func (o *FollowUp) Kind() string { + if o == nil { + return FollowUpNilKind + } + if o.bitmap_&1 != 0 { + return FollowUpLinkKind + } + return FollowUpKind +} + +// Link returns true if this is a link. +func (o *FollowUp) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *FollowUp) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *FollowUp) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *FollowUp) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *FollowUp) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *FollowUp) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Archived returns the value of the 'archived' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FollowUp) Archived() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.archived + } + return false +} + +// GetArchived returns the value of the 'archived' attribute and +// a flag indicating if the attribute has a value. +func (o *FollowUp) GetArchived() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.archived + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *FollowUp) CreatedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *FollowUp) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.createdAt + } + return +} + +// DeletedAt returns the value of the 'deleted_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object deletion timestamp. +func (o *FollowUp) DeletedAt() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.deletedAt + } + return time.Time{} +} + +// GetDeletedAt returns the value of the 'deleted_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object deletion timestamp. +func (o *FollowUp) GetDeletedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.deletedAt + } + return +} + +// Done returns the value of the 'done' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FollowUp) Done() bool { + if o != nil && o.bitmap_&64 != 0 { + return o.done + } + return false +} + +// GetDone returns the value of the 'done' attribute and +// a flag indicating if the attribute has a value. +func (o *FollowUp) GetDone() (value bool, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.done + } + return +} + +// FollowUpType returns the value of the 'follow_up_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FollowUp) FollowUpType() string { + if o != nil && o.bitmap_&128 != 0 { + return o.followUpType + } + return "" +} + +// GetFollowUpType returns the value of the 'follow_up_type' attribute and +// a flag indicating if the attribute has a value. +func (o *FollowUp) GetFollowUpType() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.followUpType + } + return +} + +// Incident returns the value of the 'incident' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FollowUp) Incident() *Incident { + if o != nil && o.bitmap_&256 != 0 { + return o.incident + } + return nil +} + +// GetIncident returns the value of the 'incident' attribute and +// a flag indicating if the attribute has a value. +func (o *FollowUp) GetIncident() (value *Incident, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.incident + } + return +} + +// Owner returns the value of the 'owner' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FollowUp) Owner() string { + if o != nil && o.bitmap_&512 != 0 { + return o.owner + } + return "" +} + +// GetOwner returns the value of the 'owner' attribute and +// a flag indicating if the attribute has a value. +func (o *FollowUp) GetOwner() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.owner + } + return +} + +// Priority returns the value of the 'priority' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FollowUp) Priority() string { + if o != nil && o.bitmap_&1024 != 0 { + return o.priority + } + return "" +} + +// GetPriority returns the value of the 'priority' attribute and +// a flag indicating if the attribute has a value. +func (o *FollowUp) GetPriority() (value string, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.priority + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FollowUp) Status() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.status + } + return "" +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +func (o *FollowUp) GetStatus() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.status + } + return +} + +// Title returns the value of the 'title' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FollowUp) Title() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.title + } + return "" +} + +// GetTitle returns the value of the 'title' attribute and +// a flag indicating if the attribute has a value. +func (o *FollowUp) GetTitle() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.title + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *FollowUp) UpdatedAt() time.Time { + if o != nil && o.bitmap_&8192 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *FollowUp) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.updatedAt + } + return +} + +// Url returns the value of the 'url' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FollowUp) Url() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.url + } + return "" +} + +// GetUrl returns the value of the 'url' attribute and +// a flag indicating if the attribute has a value. +func (o *FollowUp) GetUrl() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.url + } + return +} + +// WorkedAt returns the value of the 'worked_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *FollowUp) WorkedAt() time.Time { + if o != nil && o.bitmap_&32768 != 0 { + return o.workedAt + } + return time.Time{} +} + +// GetWorkedAt returns the value of the 'worked_at' attribute and +// a flag indicating if the attribute has a value. +func (o *FollowUp) GetWorkedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.workedAt + } + return +} + +// FollowUpListKind is the name of the type used to represent list of objects of +// type 'follow_up'. +const FollowUpListKind = "FollowUpList" + +// FollowUpListLinkKind is the name of the type used to represent links to list +// of objects of type 'follow_up'. +const FollowUpListLinkKind = "FollowUpListLink" + +// FollowUpNilKind is the name of the type used to nil lists of objects of +// type 'follow_up'. +const FollowUpListNilKind = "FollowUpListNil" + +// FollowUpList is a list of values of the 'follow_up' type. +type FollowUpList struct { + href string + link bool + items []*FollowUp +} + +// Kind returns the name of the type of the object. +func (l *FollowUpList) Kind() string { + if l == nil { + return FollowUpListNilKind + } + if l.link { + return FollowUpListLinkKind + } + return FollowUpListKind +} + +// Link returns true iif this is a link. +func (l *FollowUpList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *FollowUpList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *FollowUpList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *FollowUpList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *FollowUpList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *FollowUpList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *FollowUpList) SetItems(items []*FollowUp) { + l.items = items +} + +// Items returns the items of the list. +func (l *FollowUpList) Items() []*FollowUp { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *FollowUpList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *FollowUpList) Get(i int) *FollowUp { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *FollowUpList) Slice() []*FollowUp { + var slice []*FollowUp + if l == nil { + slice = make([]*FollowUp, 0) + } else { + slice = make([]*FollowUp, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *FollowUpList) Each(f func(item *FollowUp) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *FollowUpList) Range(f func(index int, item *FollowUp) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/webrca/v1/follow_up_type_json.go b/clientapi/webrca/v1/follow_up_type_json.go new file mode 100644 index 00000000..27213218 --- /dev/null +++ b/clientapi/webrca/v1/follow_up_type_json.go @@ -0,0 +1,293 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalFollowUp writes a value of the 'follow_up' type to the given writer. +func MarshalFollowUp(object *FollowUp, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteFollowUp(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteFollowUp writes a value of the 'follow_up' type to the given stream. +func WriteFollowUp(object *FollowUp, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(FollowUpLinkKind) + } else { + stream.WriteString(FollowUpKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("archived") + stream.WriteBool(object.archived) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deleted_at") + stream.WriteString((object.deletedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("done") + stream.WriteBool(object.done) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("follow_up_type") + stream.WriteString(object.followUpType) + count++ + } + present_ = object.bitmap_&256 != 0 && object.incident != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("incident") + WriteIncident(object.incident, stream) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("owner") + stream.WriteString(object.owner) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("priority") + stream.WriteString(object.priority) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteString(object.status) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("title") + stream.WriteString(object.title) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("url") + stream.WriteString(object.url) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("worked_at") + stream.WriteString((object.workedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalFollowUp reads a value of the 'follow_up' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalFollowUp(source interface{}) (object *FollowUp, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadFollowUp(iterator) + err = iterator.Error + return +} + +// ReadFollowUp reads a value of the 'follow_up' type from the given iterator. +func ReadFollowUp(iterator *jsoniter.Iterator) *FollowUp { + object := &FollowUp{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == FollowUpLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "archived": + value := iterator.ReadBool() + object.archived = value + object.bitmap_ |= 8 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 16 + case "deleted_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.deletedAt = value + object.bitmap_ |= 32 + case "done": + value := iterator.ReadBool() + object.done = value + object.bitmap_ |= 64 + case "follow_up_type": + value := iterator.ReadString() + object.followUpType = value + object.bitmap_ |= 128 + case "incident": + value := ReadIncident(iterator) + object.incident = value + object.bitmap_ |= 256 + case "owner": + value := iterator.ReadString() + object.owner = value + object.bitmap_ |= 512 + case "priority": + value := iterator.ReadString() + object.priority = value + object.bitmap_ |= 1024 + case "status": + value := iterator.ReadString() + object.status = value + object.bitmap_ |= 2048 + case "title": + value := iterator.ReadString() + object.title = value + object.bitmap_ |= 4096 + 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_ |= 8192 + case "url": + value := iterator.ReadString() + object.url = value + object.bitmap_ |= 16384 + case "worked_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.workedAt = value + object.bitmap_ |= 32768 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/webrca/v1/handoff_builder.go b/clientapi/webrca/v1/handoff_builder.go new file mode 100644 index 00000000..5164d3cd --- /dev/null +++ b/clientapi/webrca/v1/handoff_builder.go @@ -0,0 +1,173 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// HandoffBuilder contains the data and logic needed to build 'handoff' objects. +// +// Definition of a Web RCA handoff. +type HandoffBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + handoffFrom *UserBuilder + handoffTo *UserBuilder + handoffType string + updatedAt time.Time +} + +// NewHandoff creates a new builder of 'handoff' objects. +func NewHandoff() *HandoffBuilder { + return &HandoffBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *HandoffBuilder) Link(value bool) *HandoffBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *HandoffBuilder) ID(value string) *HandoffBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *HandoffBuilder) HREF(value string) *HandoffBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *HandoffBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *HandoffBuilder) CreatedAt(value time.Time) *HandoffBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// DeletedAt sets the value of the 'deleted_at' attribute to the given value. +func (b *HandoffBuilder) DeletedAt(value time.Time) *HandoffBuilder { + b.deletedAt = value + b.bitmap_ |= 16 + return b +} + +// HandoffFrom sets the value of the 'handoff_from' attribute to the given value. +// +// Definition of a Web RCA user. +func (b *HandoffBuilder) HandoffFrom(value *UserBuilder) *HandoffBuilder { + b.handoffFrom = value + if value != nil { + b.bitmap_ |= 32 + } else { + b.bitmap_ &^= 32 + } + return b +} + +// HandoffTo sets the value of the 'handoff_to' attribute to the given value. +// +// Definition of a Web RCA user. +func (b *HandoffBuilder) HandoffTo(value *UserBuilder) *HandoffBuilder { + b.handoffTo = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// HandoffType sets the value of the 'handoff_type' attribute to the given value. +func (b *HandoffBuilder) HandoffType(value string) *HandoffBuilder { + b.handoffType = value + b.bitmap_ |= 128 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *HandoffBuilder) UpdatedAt(value time.Time) *HandoffBuilder { + b.updatedAt = value + b.bitmap_ |= 256 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *HandoffBuilder) Copy(object *Handoff) *HandoffBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.deletedAt = object.deletedAt + if object.handoffFrom != nil { + b.handoffFrom = NewUser().Copy(object.handoffFrom) + } else { + b.handoffFrom = nil + } + if object.handoffTo != nil { + b.handoffTo = NewUser().Copy(object.handoffTo) + } else { + b.handoffTo = nil + } + b.handoffType = object.handoffType + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'handoff' object using the configuration stored in the builder. +func (b *HandoffBuilder) Build() (object *Handoff, err error) { + object = new(Handoff) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.deletedAt = b.deletedAt + if b.handoffFrom != nil { + object.handoffFrom, err = b.handoffFrom.Build() + if err != nil { + return + } + } + if b.handoffTo != nil { + object.handoffTo, err = b.handoffTo.Build() + if err != nil { + return + } + } + object.handoffType = b.handoffType + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/webrca/v1/handoff_list_builder.go b/clientapi/webrca/v1/handoff_list_builder.go new file mode 100644 index 00000000..e909b0c0 --- /dev/null +++ b/clientapi/webrca/v1/handoff_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// HandoffListBuilder contains the data and logic needed to build +// 'handoff' objects. +type HandoffListBuilder struct { + items []*HandoffBuilder +} + +// NewHandoffList creates a new builder of 'handoff' objects. +func NewHandoffList() *HandoffListBuilder { + return new(HandoffListBuilder) +} + +// Items sets the items of the list. +func (b *HandoffListBuilder) Items(values ...*HandoffBuilder) *HandoffListBuilder { + b.items = make([]*HandoffBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *HandoffListBuilder) 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 *HandoffListBuilder) Copy(list *HandoffList) *HandoffListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*HandoffBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewHandoff().Copy(v) + } + } + return b +} + +// Build creates a list of 'handoff' objects using the +// configuration stored in the builder. +func (b *HandoffListBuilder) Build() (list *HandoffList, err error) { + items := make([]*Handoff, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(HandoffList) + list.items = items + return +} diff --git a/clientapi/webrca/v1/handoff_list_type_json.go b/clientapi/webrca/v1/handoff_list_type_json.go new file mode 100644 index 00000000..1e3c0135 --- /dev/null +++ b/clientapi/webrca/v1/handoff_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalHandoffList writes a list of values of the 'handoff' type to +// the given writer. +func MarshalHandoffList(list []*Handoff, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHandoffList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHandoffList writes a list of value of the 'handoff' type to +// the given stream. +func WriteHandoffList(list []*Handoff, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteHandoff(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalHandoffList reads a list of values of the 'handoff' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalHandoffList(source interface{}) (items []*Handoff, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadHandoffList(iterator) + err = iterator.Error + return +} + +// ReadHandoffList reads list of values of the ”handoff' type from +// the given iterator. +func ReadHandoffList(iterator *jsoniter.Iterator) []*Handoff { + list := []*Handoff{} + for iterator.ReadArray() { + item := ReadHandoff(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/handoff_type.go b/clientapi/webrca/v1/handoff_type.go new file mode 100644 index 00000000..afa4ff1e --- /dev/null +++ b/clientapi/webrca/v1/handoff_type.go @@ -0,0 +1,377 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// HandoffKind is the name of the type used to represent objects +// of type 'handoff'. +const HandoffKind = "Handoff" + +// HandoffLinkKind is the name of the type used to represent links +// to objects of type 'handoff'. +const HandoffLinkKind = "HandoffLink" + +// HandoffNilKind is the name of the type used to nil references +// to objects of type 'handoff'. +const HandoffNilKind = "HandoffNil" + +// Handoff represents the values of the 'handoff' type. +// +// Definition of a Web RCA handoff. +type Handoff struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + handoffFrom *User + handoffTo *User + handoffType string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *Handoff) Kind() string { + if o == nil { + return HandoffNilKind + } + if o.bitmap_&1 != 0 { + return HandoffLinkKind + } + return HandoffKind +} + +// Link returns true if this is a link. +func (o *Handoff) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Handoff) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Handoff) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Handoff) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Handoff) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Handoff) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *Handoff) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *Handoff) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// DeletedAt returns the value of the 'deleted_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object deletion timestamp. +func (o *Handoff) DeletedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.deletedAt + } + return time.Time{} +} + +// GetDeletedAt returns the value of the 'deleted_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object deletion timestamp. +func (o *Handoff) GetDeletedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.deletedAt + } + return +} + +// HandoffFrom returns the value of the 'handoff_from' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Handoff) HandoffFrom() *User { + if o != nil && o.bitmap_&32 != 0 { + return o.handoffFrom + } + return nil +} + +// GetHandoffFrom returns the value of the 'handoff_from' attribute and +// a flag indicating if the attribute has a value. +func (o *Handoff) GetHandoffFrom() (value *User, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.handoffFrom + } + return +} + +// HandoffTo returns the value of the 'handoff_to' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Handoff) HandoffTo() *User { + if o != nil && o.bitmap_&64 != 0 { + return o.handoffTo + } + return nil +} + +// GetHandoffTo returns the value of the 'handoff_to' attribute and +// a flag indicating if the attribute has a value. +func (o *Handoff) GetHandoffTo() (value *User, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.handoffTo + } + return +} + +// HandoffType returns the value of the 'handoff_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Handoff) HandoffType() string { + if o != nil && o.bitmap_&128 != 0 { + return o.handoffType + } + return "" +} + +// GetHandoffType returns the value of the 'handoff_type' attribute and +// a flag indicating if the attribute has a value. +func (o *Handoff) GetHandoffType() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.handoffType + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *Handoff) UpdatedAt() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *Handoff) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.updatedAt + } + return +} + +// HandoffListKind is the name of the type used to represent list of objects of +// type 'handoff'. +const HandoffListKind = "HandoffList" + +// HandoffListLinkKind is the name of the type used to represent links to list +// of objects of type 'handoff'. +const HandoffListLinkKind = "HandoffListLink" + +// HandoffNilKind is the name of the type used to nil lists of objects of +// type 'handoff'. +const HandoffListNilKind = "HandoffListNil" + +// HandoffList is a list of values of the 'handoff' type. +type HandoffList struct { + href string + link bool + items []*Handoff +} + +// Kind returns the name of the type of the object. +func (l *HandoffList) Kind() string { + if l == nil { + return HandoffListNilKind + } + if l.link { + return HandoffListLinkKind + } + return HandoffListKind +} + +// Link returns true iif this is a link. +func (l *HandoffList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *HandoffList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *HandoffList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *HandoffList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *HandoffList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *HandoffList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *HandoffList) SetItems(items []*Handoff) { + l.items = items +} + +// Items returns the items of the list. +func (l *HandoffList) Items() []*Handoff { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *HandoffList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *HandoffList) Get(i int) *Handoff { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *HandoffList) Slice() []*Handoff { + var slice []*Handoff + if l == nil { + slice = make([]*Handoff, 0) + } else { + slice = make([]*Handoff, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *HandoffList) Each(f func(item *Handoff) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *HandoffList) Range(f func(index int, item *Handoff) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/webrca/v1/handoff_type_json.go b/clientapi/webrca/v1/handoff_type_json.go new file mode 100644 index 00000000..f6d7e621 --- /dev/null +++ b/clientapi/webrca/v1/handoff_type_json.go @@ -0,0 +1,198 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalHandoff writes a value of the 'handoff' type to the given writer. +func MarshalHandoff(object *Handoff, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteHandoff(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteHandoff writes a value of the 'handoff' type to the given stream. +func WriteHandoff(object *Handoff, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(HandoffLinkKind) + } else { + stream.WriteString(HandoffKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deleted_at") + stream.WriteString((object.deletedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 && object.handoffFrom != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("handoff_from") + WriteUser(object.handoffFrom, stream) + count++ + } + present_ = object.bitmap_&64 != 0 && object.handoffTo != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("handoff_to") + WriteUser(object.handoffTo, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("handoff_type") + stream.WriteString(object.handoffType) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalHandoff reads a value of the 'handoff' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalHandoff(source interface{}) (object *Handoff, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadHandoff(iterator) + err = iterator.Error + return +} + +// ReadHandoff reads a value of the 'handoff' type from the given iterator. +func ReadHandoff(iterator *jsoniter.Iterator) *Handoff { + object := &Handoff{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == HandoffLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "deleted_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.deletedAt = value + object.bitmap_ |= 16 + case "handoff_from": + value := ReadUser(iterator) + object.handoffFrom = value + object.bitmap_ |= 32 + case "handoff_to": + value := ReadUser(iterator) + object.handoffTo = value + object.bitmap_ |= 64 + case "handoff_type": + value := iterator.ReadString() + object.handoffType = value + object.bitmap_ |= 128 + 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_ |= 256 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/webrca/v1/incident_builder.go b/clientapi/webrca/v1/incident_builder.go new file mode 100644 index 00000000..2dff9b8f --- /dev/null +++ b/clientapi/webrca/v1/incident_builder.go @@ -0,0 +1,232 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// IncidentBuilder contains the data and logic needed to build 'incident' objects. +// +// Definition of a Web RCA incident. +type IncidentBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + creatorId string + deletedAt time.Time + description string + externalCoordination []string + incidentId string + incidentType string + lastUpdated time.Time + primaryTeam string + severity string + status string + summary string + updatedAt time.Time + workedAt time.Time +} + +// NewIncident creates a new builder of 'incident' objects. +func NewIncident() *IncidentBuilder { + return &IncidentBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *IncidentBuilder) Link(value bool) *IncidentBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *IncidentBuilder) ID(value string) *IncidentBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *IncidentBuilder) HREF(value string) *IncidentBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *IncidentBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *IncidentBuilder) CreatedAt(value time.Time) *IncidentBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// CreatorId sets the value of the 'creator_id' attribute to the given value. +func (b *IncidentBuilder) CreatorId(value string) *IncidentBuilder { + b.creatorId = value + b.bitmap_ |= 16 + return b +} + +// DeletedAt sets the value of the 'deleted_at' attribute to the given value. +func (b *IncidentBuilder) DeletedAt(value time.Time) *IncidentBuilder { + b.deletedAt = value + b.bitmap_ |= 32 + return b +} + +// Description sets the value of the 'description' attribute to the given value. +func (b *IncidentBuilder) Description(value string) *IncidentBuilder { + b.description = value + b.bitmap_ |= 64 + return b +} + +// ExternalCoordination sets the value of the 'external_coordination' attribute to the given values. +func (b *IncidentBuilder) ExternalCoordination(values ...string) *IncidentBuilder { + b.externalCoordination = make([]string, len(values)) + copy(b.externalCoordination, values) + b.bitmap_ |= 128 + return b +} + +// IncidentId sets the value of the 'incident_id' attribute to the given value. +func (b *IncidentBuilder) IncidentId(value string) *IncidentBuilder { + b.incidentId = value + b.bitmap_ |= 256 + return b +} + +// IncidentType sets the value of the 'incident_type' attribute to the given value. +func (b *IncidentBuilder) IncidentType(value string) *IncidentBuilder { + b.incidentType = value + b.bitmap_ |= 512 + return b +} + +// LastUpdated sets the value of the 'last_updated' attribute to the given value. +func (b *IncidentBuilder) LastUpdated(value time.Time) *IncidentBuilder { + b.lastUpdated = value + b.bitmap_ |= 1024 + return b +} + +// PrimaryTeam sets the value of the 'primary_team' attribute to the given value. +func (b *IncidentBuilder) PrimaryTeam(value string) *IncidentBuilder { + b.primaryTeam = value + b.bitmap_ |= 2048 + return b +} + +// Severity sets the value of the 'severity' attribute to the given value. +func (b *IncidentBuilder) Severity(value string) *IncidentBuilder { + b.severity = value + b.bitmap_ |= 4096 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *IncidentBuilder) Status(value string) *IncidentBuilder { + b.status = value + b.bitmap_ |= 8192 + return b +} + +// Summary sets the value of the 'summary' attribute to the given value. +func (b *IncidentBuilder) Summary(value string) *IncidentBuilder { + b.summary = value + b.bitmap_ |= 16384 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *IncidentBuilder) UpdatedAt(value time.Time) *IncidentBuilder { + b.updatedAt = value + b.bitmap_ |= 32768 + return b +} + +// WorkedAt sets the value of the 'worked_at' attribute to the given value. +func (b *IncidentBuilder) WorkedAt(value time.Time) *IncidentBuilder { + b.workedAt = value + b.bitmap_ |= 65536 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *IncidentBuilder) Copy(object *Incident) *IncidentBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.creatorId = object.creatorId + b.deletedAt = object.deletedAt + b.description = object.description + if object.externalCoordination != nil { + b.externalCoordination = make([]string, len(object.externalCoordination)) + copy(b.externalCoordination, object.externalCoordination) + } else { + b.externalCoordination = nil + } + b.incidentId = object.incidentId + b.incidentType = object.incidentType + b.lastUpdated = object.lastUpdated + b.primaryTeam = object.primaryTeam + b.severity = object.severity + b.status = object.status + b.summary = object.summary + b.updatedAt = object.updatedAt + b.workedAt = object.workedAt + return b +} + +// Build creates a 'incident' object using the configuration stored in the builder. +func (b *IncidentBuilder) Build() (object *Incident, err error) { + object = new(Incident) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.creatorId = b.creatorId + object.deletedAt = b.deletedAt + object.description = b.description + if b.externalCoordination != nil { + object.externalCoordination = make([]string, len(b.externalCoordination)) + copy(object.externalCoordination, b.externalCoordination) + } + object.incidentId = b.incidentId + object.incidentType = b.incidentType + object.lastUpdated = b.lastUpdated + object.primaryTeam = b.primaryTeam + object.severity = b.severity + object.status = b.status + object.summary = b.summary + object.updatedAt = b.updatedAt + object.workedAt = b.workedAt + return +} diff --git a/clientapi/webrca/v1/incident_list_builder.go b/clientapi/webrca/v1/incident_list_builder.go new file mode 100644 index 00000000..52eb92fd --- /dev/null +++ b/clientapi/webrca/v1/incident_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// IncidentListBuilder contains the data and logic needed to build +// 'incident' objects. +type IncidentListBuilder struct { + items []*IncidentBuilder +} + +// NewIncidentList creates a new builder of 'incident' objects. +func NewIncidentList() *IncidentListBuilder { + return new(IncidentListBuilder) +} + +// Items sets the items of the list. +func (b *IncidentListBuilder) Items(values ...*IncidentBuilder) *IncidentListBuilder { + b.items = make([]*IncidentBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *IncidentListBuilder) 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 *IncidentListBuilder) Copy(list *IncidentList) *IncidentListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*IncidentBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewIncident().Copy(v) + } + } + return b +} + +// Build creates a list of 'incident' objects using the +// configuration stored in the builder. +func (b *IncidentListBuilder) Build() (list *IncidentList, err error) { + items := make([]*Incident, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(IncidentList) + list.items = items + return +} diff --git a/clientapi/webrca/v1/incident_list_type_json.go b/clientapi/webrca/v1/incident_list_type_json.go new file mode 100644 index 00000000..bd401e41 --- /dev/null +++ b/clientapi/webrca/v1/incident_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIncidentList writes a list of values of the 'incident' type to +// the given writer. +func MarshalIncidentList(list []*Incident, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIncidentList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIncidentList writes a list of value of the 'incident' type to +// the given stream. +func WriteIncidentList(list []*Incident, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteIncident(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalIncidentList reads a list of values of the 'incident' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIncidentList(source interface{}) (items []*Incident, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIncidentList(iterator) + err = iterator.Error + return +} + +// ReadIncidentList reads list of values of the ”incident' type from +// the given iterator. +func ReadIncidentList(iterator *jsoniter.Iterator) []*Incident { + list := []*Incident{} + for iterator.ReadArray() { + item := ReadIncident(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/incident_type.go b/clientapi/webrca/v1/incident_type.go new file mode 100644 index 00000000..a854e7d0 --- /dev/null +++ b/clientapi/webrca/v1/incident_type.go @@ -0,0 +1,537 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// IncidentKind is the name of the type used to represent objects +// of type 'incident'. +const IncidentKind = "Incident" + +// IncidentLinkKind is the name of the type used to represent links +// to objects of type 'incident'. +const IncidentLinkKind = "IncidentLink" + +// IncidentNilKind is the name of the type used to nil references +// to objects of type 'incident'. +const IncidentNilKind = "IncidentNil" + +// Incident represents the values of the 'incident' type. +// +// Definition of a Web RCA incident. +type Incident struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + creatorId string + deletedAt time.Time + description string + externalCoordination []string + incidentId string + incidentType string + lastUpdated time.Time + primaryTeam string + severity string + status string + summary string + updatedAt time.Time + workedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *Incident) Kind() string { + if o == nil { + return IncidentNilKind + } + if o.bitmap_&1 != 0 { + return IncidentLinkKind + } + return IncidentKind +} + +// Link returns true if this is a link. +func (o *Incident) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Incident) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Incident) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Incident) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Incident) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Incident) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *Incident) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *Incident) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// CreatorId returns the value of the 'creator_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Incident) CreatorId() string { + if o != nil && o.bitmap_&16 != 0 { + return o.creatorId + } + return "" +} + +// GetCreatorId returns the value of the 'creator_id' attribute and +// a flag indicating if the attribute has a value. +func (o *Incident) GetCreatorId() (value string, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.creatorId + } + return +} + +// DeletedAt returns the value of the 'deleted_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object deletion timestamp. +func (o *Incident) DeletedAt() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.deletedAt + } + return time.Time{} +} + +// GetDeletedAt returns the value of the 'deleted_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object deletion timestamp. +func (o *Incident) GetDeletedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.deletedAt + } + return +} + +// Description returns the value of the 'description' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Incident) Description() string { + if o != nil && o.bitmap_&64 != 0 { + return o.description + } + return "" +} + +// GetDescription returns the value of the 'description' attribute and +// a flag indicating if the attribute has a value. +func (o *Incident) GetDescription() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.description + } + return +} + +// ExternalCoordination returns the value of the 'external_coordination' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Incident) ExternalCoordination() []string { + if o != nil && o.bitmap_&128 != 0 { + return o.externalCoordination + } + return nil +} + +// GetExternalCoordination returns the value of the 'external_coordination' attribute and +// a flag indicating if the attribute has a value. +func (o *Incident) GetExternalCoordination() (value []string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.externalCoordination + } + return +} + +// IncidentId returns the value of the 'incident_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Incident) IncidentId() string { + if o != nil && o.bitmap_&256 != 0 { + return o.incidentId + } + return "" +} + +// GetIncidentId returns the value of the 'incident_id' attribute and +// a flag indicating if the attribute has a value. +func (o *Incident) GetIncidentId() (value string, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.incidentId + } + return +} + +// IncidentType returns the value of the 'incident_type' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Incident) IncidentType() string { + if o != nil && o.bitmap_&512 != 0 { + return o.incidentType + } + return "" +} + +// GetIncidentType returns the value of the 'incident_type' attribute and +// a flag indicating if the attribute has a value. +func (o *Incident) GetIncidentType() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.incidentType + } + return +} + +// LastUpdated returns the value of the 'last_updated' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Incident) LastUpdated() time.Time { + if o != nil && o.bitmap_&1024 != 0 { + return o.lastUpdated + } + return time.Time{} +} + +// GetLastUpdated returns the value of the 'last_updated' attribute and +// a flag indicating if the attribute has a value. +func (o *Incident) GetLastUpdated() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&1024 != 0 + if ok { + value = o.lastUpdated + } + return +} + +// PrimaryTeam returns the value of the 'primary_team' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Incident) PrimaryTeam() string { + if o != nil && o.bitmap_&2048 != 0 { + return o.primaryTeam + } + return "" +} + +// GetPrimaryTeam returns the value of the 'primary_team' attribute and +// a flag indicating if the attribute has a value. +func (o *Incident) GetPrimaryTeam() (value string, ok bool) { + ok = o != nil && o.bitmap_&2048 != 0 + if ok { + value = o.primaryTeam + } + return +} + +// Severity returns the value of the 'severity' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Incident) Severity() string { + if o != nil && o.bitmap_&4096 != 0 { + return o.severity + } + return "" +} + +// GetSeverity returns the value of the 'severity' attribute and +// a flag indicating if the attribute has a value. +func (o *Incident) GetSeverity() (value string, ok bool) { + ok = o != nil && o.bitmap_&4096 != 0 + if ok { + value = o.severity + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Incident) Status() string { + if o != nil && o.bitmap_&8192 != 0 { + return o.status + } + return "" +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +func (o *Incident) GetStatus() (value string, ok bool) { + ok = o != nil && o.bitmap_&8192 != 0 + if ok { + value = o.status + } + return +} + +// Summary returns the value of the 'summary' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Incident) Summary() string { + if o != nil && o.bitmap_&16384 != 0 { + return o.summary + } + return "" +} + +// GetSummary returns the value of the 'summary' attribute and +// a flag indicating if the attribute has a value. +func (o *Incident) GetSummary() (value string, ok bool) { + ok = o != nil && o.bitmap_&16384 != 0 + if ok { + value = o.summary + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *Incident) UpdatedAt() time.Time { + if o != nil && o.bitmap_&32768 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *Incident) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32768 != 0 + if ok { + value = o.updatedAt + } + return +} + +// WorkedAt returns the value of the 'worked_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Incident) WorkedAt() time.Time { + if o != nil && o.bitmap_&65536 != 0 { + return o.workedAt + } + return time.Time{} +} + +// GetWorkedAt returns the value of the 'worked_at' attribute and +// a flag indicating if the attribute has a value. +func (o *Incident) GetWorkedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&65536 != 0 + if ok { + value = o.workedAt + } + return +} + +// IncidentListKind is the name of the type used to represent list of objects of +// type 'incident'. +const IncidentListKind = "IncidentList" + +// IncidentListLinkKind is the name of the type used to represent links to list +// of objects of type 'incident'. +const IncidentListLinkKind = "IncidentListLink" + +// IncidentNilKind is the name of the type used to nil lists of objects of +// type 'incident'. +const IncidentListNilKind = "IncidentListNil" + +// IncidentList is a list of values of the 'incident' type. +type IncidentList struct { + href string + link bool + items []*Incident +} + +// Kind returns the name of the type of the object. +func (l *IncidentList) Kind() string { + if l == nil { + return IncidentListNilKind + } + if l.link { + return IncidentListLinkKind + } + return IncidentListKind +} + +// Link returns true iif this is a link. +func (l *IncidentList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *IncidentList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *IncidentList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *IncidentList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *IncidentList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *IncidentList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *IncidentList) SetItems(items []*Incident) { + l.items = items +} + +// Items returns the items of the list. +func (l *IncidentList) Items() []*Incident { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *IncidentList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *IncidentList) Get(i int) *Incident { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *IncidentList) Slice() []*Incident { + var slice []*Incident + if l == nil { + slice = make([]*Incident, 0) + } else { + slice = make([]*Incident, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *IncidentList) Each(f func(item *Incident) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *IncidentList) Range(f func(index int, item *Incident) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/webrca/v1/incident_type_json.go b/clientapi/webrca/v1/incident_type_json.go new file mode 100644 index 00000000..6d946463 --- /dev/null +++ b/clientapi/webrca/v1/incident_type_json.go @@ -0,0 +1,310 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIncident writes a value of the 'incident' type to the given writer. +func MarshalIncident(object *Incident, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIncident(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIncident writes a value of the 'incident' type to the given stream. +func WriteIncident(object *Incident, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(IncidentLinkKind) + } else { + stream.WriteString(IncidentKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("creator_id") + stream.WriteString(object.creatorId) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deleted_at") + stream.WriteString((object.deletedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("description") + stream.WriteString(object.description) + count++ + } + present_ = object.bitmap_&128 != 0 && object.externalCoordination != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("external_coordination") + WriteStringList(object.externalCoordination, stream) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("incident_id") + stream.WriteString(object.incidentId) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("incident_type") + stream.WriteString(object.incidentType) + count++ + } + present_ = object.bitmap_&1024 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("last_updated") + stream.WriteString((object.lastUpdated).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&2048 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("primary_team") + stream.WriteString(object.primaryTeam) + count++ + } + present_ = object.bitmap_&4096 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("severity") + stream.WriteString(object.severity) + count++ + } + present_ = object.bitmap_&8192 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteString(object.status) + count++ + } + present_ = object.bitmap_&16384 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("summary") + stream.WriteString(object.summary) + count++ + } + present_ = object.bitmap_&32768 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&65536 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("worked_at") + stream.WriteString((object.workedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalIncident reads a value of the 'incident' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalIncident(source interface{}) (object *Incident, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadIncident(iterator) + err = iterator.Error + return +} + +// ReadIncident reads a value of the 'incident' type from the given iterator. +func ReadIncident(iterator *jsoniter.Iterator) *Incident { + object := &Incident{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == IncidentLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "creator_id": + value := iterator.ReadString() + object.creatorId = value + object.bitmap_ |= 16 + case "deleted_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.deletedAt = value + object.bitmap_ |= 32 + case "description": + value := iterator.ReadString() + object.description = value + object.bitmap_ |= 64 + case "external_coordination": + value := ReadStringList(iterator) + object.externalCoordination = value + object.bitmap_ |= 128 + case "incident_id": + value := iterator.ReadString() + object.incidentId = value + object.bitmap_ |= 256 + case "incident_type": + value := iterator.ReadString() + object.incidentType = value + object.bitmap_ |= 512 + case "last_updated": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.lastUpdated = value + object.bitmap_ |= 1024 + case "primary_team": + value := iterator.ReadString() + object.primaryTeam = value + object.bitmap_ |= 2048 + case "severity": + value := iterator.ReadString() + object.severity = value + object.bitmap_ |= 4096 + case "status": + value := iterator.ReadString() + object.status = value + object.bitmap_ |= 8192 + case "summary": + value := iterator.ReadString() + object.summary = value + object.bitmap_ |= 16384 + 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_ |= 32768 + case "worked_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.workedAt = value + object.bitmap_ |= 65536 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/webrca/v1/integer_list_type_json.go b/clientapi/webrca/v1/integer_list_type_json.go new file mode 100644 index 00000000..2500467f --- /dev/null +++ b/clientapi/webrca/v1/integer_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalIntegerList writes a list of values of the 'integer' type to +// the given writer. +func MarshalIntegerList(list []int, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteIntegerList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteIntegerList writes a list of value of the 'integer' type to +// the given stream. +func WriteIntegerList(list []int, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalIntegerList reads a list of values of the 'integer' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalIntegerList(source interface{}) (items []int, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadIntegerList(iterator) + err = iterator.Error + return +} + +// ReadIntegerList reads list of values of the ”integer' type from +// the given iterator. +func ReadIntegerList(iterator *jsoniter.Iterator) []int { + list := []int{} + for iterator.ReadArray() { + item := iterator.ReadInt() + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/interface_list_type_json.go b/clientapi/webrca/v1/interface_list_type_json.go new file mode 100644 index 00000000..ef95ead4 --- /dev/null +++ b/clientapi/webrca/v1/interface_list_type_json.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalInterfaceList writes a list of values of the 'interface' type to +// the given writer. +func MarshalInterfaceList(list []interface{}, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteInterfaceList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteInterfaceList writes a list of value of the 'interface' type to +// the given stream. +func WriteInterfaceList(list []interface{}, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteVal(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalInterfaceList reads a list of values of the 'interface' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalInterfaceList(source interface{}) (items []interface{}, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadInterfaceList(iterator) + err = iterator.Error + return +} + +// ReadInterfaceList reads list of values of the ”interface' type from +// the given iterator. +func ReadInterfaceList(iterator *jsoniter.Iterator) []interface{} { + list := []interface{}{} + for iterator.ReadArray() { + var item interface{} + iterator.ReadVal(&item) + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/long_list_type_json.go b/clientapi/webrca/v1/long_list_type_json.go new file mode 100644 index 00000000..e42793b8 --- /dev/null +++ b/clientapi/webrca/v1/long_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalLongList writes a list of values of the 'long' type to +// the given writer. +func MarshalLongList(list []int64, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteLongList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteLongList writes a list of value of the 'long' type to +// the given stream. +func WriteLongList(list []int64, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteInt64(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalLongList reads a list of values of the 'long' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalLongList(source interface{}) (items []int64, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadLongList(iterator) + err = iterator.Error + return +} + +// ReadLongList reads list of values of the ”long' type from +// the given iterator. +func ReadLongList(iterator *jsoniter.Iterator) []int64 { + list := []int64{} + for iterator.ReadArray() { + item := iterator.ReadInt64() + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/metadata_reader.go b/clientapi/webrca/v1/metadata_reader.go new file mode 100644 index 00000000..f02540d5 --- /dev/null +++ b/clientapi/webrca/v1/metadata_reader.go @@ -0,0 +1,76 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalMetadata writes a value of the metadata type to the given target, which +// can be a writer or a JSON encoder. +func MarshalMetadata(object *Metadata, writer io.Writer) error { + stream := helpers.NewStream(writer) + writeMetadata(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} +func writeMetadata(object *Metadata, stream *jsoniter.Stream) { + stream.WriteObjectStart() + if object.bitmap_&1 != 0 { + stream.WriteObjectField("server_version") + stream.WriteString(object.serverVersion) + } + stream.WriteObjectEnd() +} + +// UnmarshalMetadata reads a value of the metadata type from the given source, which +// which can be a reader, a slice of byte or a string. +func UnmarshalMetadata(source interface{}) (object *Metadata, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = readMetadata(iterator) + err = iterator.Error + return +} +func readMetadata(iterator *jsoniter.Iterator) *Metadata { + object := &Metadata{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "server_version": + object.serverVersion = iterator.ReadString() + object.bitmap_ |= 1 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/webrca/v1/metadata_type.go b/clientapi/webrca/v1/metadata_type.go new file mode 100644 index 00000000..9816b5b6 --- /dev/null +++ b/clientapi/webrca/v1/metadata_type.go @@ -0,0 +1,44 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// Metadata contains the version metadata. +type Metadata struct { + bitmap_ uint32 + serverVersion string +} + +// ServerVersion returns the version of the server. +func (m *Metadata) ServerVersion() string { + if m != nil && m.bitmap_&1 != 0 { + return m.serverVersion + } + return "" +} + +// GetServerVersion returns the value of the server version and a flag indicating if +// the attribute has a value. +func (m *Metadata) GetServerVersion() (value string, ok bool) { + ok = m != nil && m.bitmap_&1 != 0 + if ok { + value = m.serverVersion + } + return +} diff --git a/clientapi/webrca/v1/notification_builder.go b/clientapi/webrca/v1/notification_builder.go new file mode 100644 index 00000000..172be653 --- /dev/null +++ b/clientapi/webrca/v1/notification_builder.go @@ -0,0 +1,168 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// NotificationBuilder contains the data and logic needed to build 'notification' objects. +// +// Definition of a Web RCA notification. +type NotificationBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + incident *IncidentBuilder + name string + rank int + updatedAt time.Time + checked bool +} + +// NewNotification creates a new builder of 'notification' objects. +func NewNotification() *NotificationBuilder { + return &NotificationBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *NotificationBuilder) Link(value bool) *NotificationBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *NotificationBuilder) ID(value string) *NotificationBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *NotificationBuilder) HREF(value string) *NotificationBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *NotificationBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// Checked sets the value of the 'checked' attribute to the given value. +func (b *NotificationBuilder) Checked(value bool) *NotificationBuilder { + b.checked = value + b.bitmap_ |= 8 + return b +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *NotificationBuilder) CreatedAt(value time.Time) *NotificationBuilder { + b.createdAt = value + b.bitmap_ |= 16 + return b +} + +// DeletedAt sets the value of the 'deleted_at' attribute to the given value. +func (b *NotificationBuilder) DeletedAt(value time.Time) *NotificationBuilder { + b.deletedAt = value + b.bitmap_ |= 32 + return b +} + +// Incident sets the value of the 'incident' attribute to the given value. +// +// Definition of a Web RCA incident. +func (b *NotificationBuilder) Incident(value *IncidentBuilder) *NotificationBuilder { + b.incident = value + if value != nil { + b.bitmap_ |= 64 + } else { + b.bitmap_ &^= 64 + } + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *NotificationBuilder) Name(value string) *NotificationBuilder { + b.name = value + b.bitmap_ |= 128 + return b +} + +// Rank sets the value of the 'rank' attribute to the given value. +func (b *NotificationBuilder) Rank(value int) *NotificationBuilder { + b.rank = value + b.bitmap_ |= 256 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *NotificationBuilder) UpdatedAt(value time.Time) *NotificationBuilder { + b.updatedAt = value + b.bitmap_ |= 512 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *NotificationBuilder) Copy(object *Notification) *NotificationBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.checked = object.checked + b.createdAt = object.createdAt + b.deletedAt = object.deletedAt + if object.incident != nil { + b.incident = NewIncident().Copy(object.incident) + } else { + b.incident = nil + } + b.name = object.name + b.rank = object.rank + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'notification' object using the configuration stored in the builder. +func (b *NotificationBuilder) Build() (object *Notification, err error) { + object = new(Notification) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.checked = b.checked + object.createdAt = b.createdAt + object.deletedAt = b.deletedAt + if b.incident != nil { + object.incident, err = b.incident.Build() + if err != nil { + return + } + } + object.name = b.name + object.rank = b.rank + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/webrca/v1/notification_list_builder.go b/clientapi/webrca/v1/notification_list_builder.go new file mode 100644 index 00000000..a94dc67e --- /dev/null +++ b/clientapi/webrca/v1/notification_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// NotificationListBuilder contains the data and logic needed to build +// 'notification' objects. +type NotificationListBuilder struct { + items []*NotificationBuilder +} + +// NewNotificationList creates a new builder of 'notification' objects. +func NewNotificationList() *NotificationListBuilder { + return new(NotificationListBuilder) +} + +// Items sets the items of the list. +func (b *NotificationListBuilder) Items(values ...*NotificationBuilder) *NotificationListBuilder { + b.items = make([]*NotificationBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *NotificationListBuilder) 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 *NotificationListBuilder) Copy(list *NotificationList) *NotificationListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*NotificationBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewNotification().Copy(v) + } + } + return b +} + +// Build creates a list of 'notification' objects using the +// configuration stored in the builder. +func (b *NotificationListBuilder) Build() (list *NotificationList, err error) { + items := make([]*Notification, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(NotificationList) + list.items = items + return +} diff --git a/clientapi/webrca/v1/notification_list_type_json.go b/clientapi/webrca/v1/notification_list_type_json.go new file mode 100644 index 00000000..dee82b1c --- /dev/null +++ b/clientapi/webrca/v1/notification_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNotificationList writes a list of values of the 'notification' type to +// the given writer. +func MarshalNotificationList(list []*Notification, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNotificationList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNotificationList writes a list of value of the 'notification' type to +// the given stream. +func WriteNotificationList(list []*Notification, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteNotification(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalNotificationList reads a list of values of the 'notification' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalNotificationList(source interface{}) (items []*Notification, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadNotificationList(iterator) + err = iterator.Error + return +} + +// ReadNotificationList reads list of values of the ”notification' type from +// the given iterator. +func ReadNotificationList(iterator *jsoniter.Iterator) []*Notification { + list := []*Notification{} + for iterator.ReadArray() { + item := ReadNotification(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/notification_type.go b/clientapi/webrca/v1/notification_type.go new file mode 100644 index 00000000..46ab4d46 --- /dev/null +++ b/clientapi/webrca/v1/notification_type.go @@ -0,0 +1,397 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// NotificationKind is the name of the type used to represent objects +// of type 'notification'. +const NotificationKind = "Notification" + +// NotificationLinkKind is the name of the type used to represent links +// to objects of type 'notification'. +const NotificationLinkKind = "NotificationLink" + +// NotificationNilKind is the name of the type used to nil references +// to objects of type 'notification'. +const NotificationNilKind = "NotificationNil" + +// Notification represents the values of the 'notification' type. +// +// Definition of a Web RCA notification. +type Notification struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + incident *Incident + name string + rank int + updatedAt time.Time + checked bool +} + +// Kind returns the name of the type of the object. +func (o *Notification) Kind() string { + if o == nil { + return NotificationNilKind + } + if o.bitmap_&1 != 0 { + return NotificationLinkKind + } + return NotificationKind +} + +// Link returns true if this is a link. +func (o *Notification) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Notification) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Notification) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Notification) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Notification) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Notification) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// Checked returns the value of the 'checked' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Notification) Checked() bool { + if o != nil && o.bitmap_&8 != 0 { + return o.checked + } + return false +} + +// GetChecked returns the value of the 'checked' attribute and +// a flag indicating if the attribute has a value. +func (o *Notification) GetChecked() (value bool, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.checked + } + return +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *Notification) CreatedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *Notification) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.createdAt + } + return +} + +// DeletedAt returns the value of the 'deleted_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object deletion timestamp. +func (o *Notification) DeletedAt() time.Time { + if o != nil && o.bitmap_&32 != 0 { + return o.deletedAt + } + return time.Time{} +} + +// GetDeletedAt returns the value of the 'deleted_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object deletion timestamp. +func (o *Notification) GetDeletedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.deletedAt + } + return +} + +// Incident returns the value of the 'incident' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Notification) Incident() *Incident { + if o != nil && o.bitmap_&64 != 0 { + return o.incident + } + return nil +} + +// GetIncident returns the value of the 'incident' attribute and +// a flag indicating if the attribute has a value. +func (o *Notification) GetIncident() (value *Incident, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.incident + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Notification) Name() string { + if o != nil && o.bitmap_&128 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *Notification) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.name + } + return +} + +// Rank returns the value of the 'rank' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *Notification) Rank() int { + if o != nil && o.bitmap_&256 != 0 { + return o.rank + } + return 0 +} + +// GetRank returns the value of the 'rank' attribute and +// a flag indicating if the attribute has a value. +func (o *Notification) GetRank() (value int, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.rank + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *Notification) UpdatedAt() time.Time { + if o != nil && o.bitmap_&512 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *Notification) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.updatedAt + } + return +} + +// NotificationListKind is the name of the type used to represent list of objects of +// type 'notification'. +const NotificationListKind = "NotificationList" + +// NotificationListLinkKind is the name of the type used to represent links to list +// of objects of type 'notification'. +const NotificationListLinkKind = "NotificationListLink" + +// NotificationNilKind is the name of the type used to nil lists of objects of +// type 'notification'. +const NotificationListNilKind = "NotificationListNil" + +// NotificationList is a list of values of the 'notification' type. +type NotificationList struct { + href string + link bool + items []*Notification +} + +// Kind returns the name of the type of the object. +func (l *NotificationList) Kind() string { + if l == nil { + return NotificationListNilKind + } + if l.link { + return NotificationListLinkKind + } + return NotificationListKind +} + +// Link returns true iif this is a link. +func (l *NotificationList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *NotificationList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *NotificationList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *NotificationList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *NotificationList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *NotificationList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *NotificationList) SetItems(items []*Notification) { + l.items = items +} + +// Items returns the items of the list. +func (l *NotificationList) Items() []*Notification { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *NotificationList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *NotificationList) Get(i int) *Notification { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *NotificationList) Slice() []*Notification { + var slice []*Notification + if l == nil { + slice = make([]*Notification, 0) + } else { + slice = make([]*Notification, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *NotificationList) Each(f func(item *Notification) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *NotificationList) Range(f func(index int, item *Notification) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/webrca/v1/notification_type_json.go b/clientapi/webrca/v1/notification_type_json.go new file mode 100644 index 00000000..09b1a5f1 --- /dev/null +++ b/clientapi/webrca/v1/notification_type_json.go @@ -0,0 +1,211 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalNotification writes a value of the 'notification' type to the given writer. +func MarshalNotification(object *Notification, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteNotification(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteNotification writes a value of the 'notification' type to the given stream. +func WriteNotification(object *Notification, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(NotificationLinkKind) + } else { + stream.WriteString(NotificationKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("checked") + stream.WriteBool(object.checked) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deleted_at") + stream.WriteString((object.deletedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&64 != 0 && object.incident != nil + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("incident") + WriteIncident(object.incident, stream) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("rank") + stream.WriteInt(object.rank) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalNotification reads a value of the 'notification' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalNotification(source interface{}) (object *Notification, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadNotification(iterator) + err = iterator.Error + return +} + +// ReadNotification reads a value of the 'notification' type from the given iterator. +func ReadNotification(iterator *jsoniter.Iterator) *Notification { + object := &Notification{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == NotificationLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "checked": + value := iterator.ReadBool() + object.checked = value + object.bitmap_ |= 8 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 16 + case "deleted_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.deletedAt = value + object.bitmap_ |= 32 + case "incident": + value := ReadIncident(iterator) + object.incident = value + object.bitmap_ |= 64 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 128 + case "rank": + value := iterator.ReadInt() + object.rank = value + object.bitmap_ |= 256 + 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 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/webrca/v1/product_builder.go b/clientapi/webrca/v1/product_builder.go new file mode 100644 index 00000000..78d9ed43 --- /dev/null +++ b/clientapi/webrca/v1/product_builder.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// ProductBuilder contains the data and logic needed to build 'product' objects. +// +// Definition of a Web RCA product. +type ProductBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + productId string + productName string + updatedAt time.Time +} + +// NewProduct creates a new builder of 'product' objects. +func NewProduct() *ProductBuilder { + return &ProductBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *ProductBuilder) Link(value bool) *ProductBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *ProductBuilder) ID(value string) *ProductBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *ProductBuilder) HREF(value string) *ProductBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *ProductBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *ProductBuilder) CreatedAt(value time.Time) *ProductBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// DeletedAt sets the value of the 'deleted_at' attribute to the given value. +func (b *ProductBuilder) DeletedAt(value time.Time) *ProductBuilder { + b.deletedAt = value + b.bitmap_ |= 16 + return b +} + +// ProductId sets the value of the 'product_id' attribute to the given value. +func (b *ProductBuilder) ProductId(value string) *ProductBuilder { + b.productId = value + b.bitmap_ |= 32 + return b +} + +// ProductName sets the value of the 'product_name' attribute to the given value. +func (b *ProductBuilder) ProductName(value string) *ProductBuilder { + b.productName = value + b.bitmap_ |= 64 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *ProductBuilder) UpdatedAt(value time.Time) *ProductBuilder { + b.updatedAt = value + b.bitmap_ |= 128 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *ProductBuilder) Copy(object *Product) *ProductBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.deletedAt = object.deletedAt + b.productId = object.productId + b.productName = object.productName + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'product' object using the configuration stored in the builder. +func (b *ProductBuilder) Build() (object *Product, err error) { + object = new(Product) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.deletedAt = b.deletedAt + object.productId = b.productId + object.productName = b.productName + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/webrca/v1/product_list_builder.go b/clientapi/webrca/v1/product_list_builder.go new file mode 100644 index 00000000..002f5a75 --- /dev/null +++ b/clientapi/webrca/v1/product_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// ProductListBuilder contains the data and logic needed to build +// 'product' objects. +type ProductListBuilder struct { + items []*ProductBuilder +} + +// NewProductList creates a new builder of 'product' objects. +func NewProductList() *ProductListBuilder { + return new(ProductListBuilder) +} + +// Items sets the items of the list. +func (b *ProductListBuilder) Items(values ...*ProductBuilder) *ProductListBuilder { + b.items = make([]*ProductBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *ProductListBuilder) 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 *ProductListBuilder) Copy(list *ProductList) *ProductListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*ProductBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewProduct().Copy(v) + } + } + return b +} + +// Build creates a list of 'product' objects using the +// configuration stored in the builder. +func (b *ProductListBuilder) Build() (list *ProductList, err error) { + items := make([]*Product, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(ProductList) + list.items = items + return +} diff --git a/clientapi/webrca/v1/product_list_type_json.go b/clientapi/webrca/v1/product_list_type_json.go new file mode 100644 index 00000000..1ac8e780 --- /dev/null +++ b/clientapi/webrca/v1/product_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProductList writes a list of values of the 'product' type to +// the given writer. +func MarshalProductList(list []*Product, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProductList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProductList writes a list of value of the 'product' type to +// the given stream. +func WriteProductList(list []*Product, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteProduct(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalProductList reads a list of values of the 'product' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalProductList(source interface{}) (items []*Product, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadProductList(iterator) + err = iterator.Error + return +} + +// ReadProductList reads list of values of the ”product' type from +// the given iterator. +func ReadProductList(iterator *jsoniter.Iterator) []*Product { + list := []*Product{} + for iterator.ReadArray() { + item := ReadProduct(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/product_type.go b/clientapi/webrca/v1/product_type.go new file mode 100644 index 00000000..a9002cce --- /dev/null +++ b/clientapi/webrca/v1/product_type.go @@ -0,0 +1,365 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// ProductKind is the name of the type used to represent objects +// of type 'product'. +const ProductKind = "Product" + +// ProductLinkKind is the name of the type used to represent links +// to objects of type 'product'. +const ProductLinkKind = "ProductLink" + +// ProductNilKind is the name of the type used to nil references +// to objects of type 'product'. +const ProductNilKind = "ProductNil" + +// Product represents the values of the 'product' type. +// +// Definition of a Web RCA product. +type Product struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + productId string + productName string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *Product) Kind() string { + if o == nil { + return ProductNilKind + } + if o.bitmap_&1 != 0 { + return ProductLinkKind + } + return ProductKind +} + +// Link returns true if this is a link. +func (o *Product) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *Product) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *Product) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *Product) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *Product) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *Product) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *Product) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *Product) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// DeletedAt returns the value of the 'deleted_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object deletion timestamp. +func (o *Product) DeletedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.deletedAt + } + return time.Time{} +} + +// GetDeletedAt returns the value of the 'deleted_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object deletion timestamp. +func (o *Product) GetDeletedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.deletedAt + } + return +} + +// ProductId returns the value of the 'product_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The product ID from status board +func (o *Product) ProductId() string { + if o != nil && o.bitmap_&32 != 0 { + return o.productId + } + return "" +} + +// GetProductId returns the value of the 'product_id' attribute and +// a flag indicating if the attribute has a value. +// +// The product ID from status board +func (o *Product) GetProductId() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.productId + } + return +} + +// ProductName returns the value of the 'product_name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// The name of the product from status-board. +func (o *Product) ProductName() string { + if o != nil && o.bitmap_&64 != 0 { + return o.productName + } + return "" +} + +// GetProductName returns the value of the 'product_name' attribute and +// a flag indicating if the attribute has a value. +// +// The name of the product from status-board. +func (o *Product) GetProductName() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.productName + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *Product) UpdatedAt() time.Time { + if o != nil && o.bitmap_&128 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *Product) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.updatedAt + } + return +} + +// ProductListKind is the name of the type used to represent list of objects of +// type 'product'. +const ProductListKind = "ProductList" + +// ProductListLinkKind is the name of the type used to represent links to list +// of objects of type 'product'. +const ProductListLinkKind = "ProductListLink" + +// ProductNilKind is the name of the type used to nil lists of objects of +// type 'product'. +const ProductListNilKind = "ProductListNil" + +// ProductList is a list of values of the 'product' type. +type ProductList struct { + href string + link bool + items []*Product +} + +// Kind returns the name of the type of the object. +func (l *ProductList) Kind() string { + if l == nil { + return ProductListNilKind + } + if l.link { + return ProductListLinkKind + } + return ProductListKind +} + +// Link returns true iif this is a link. +func (l *ProductList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *ProductList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *ProductList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *ProductList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *ProductList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *ProductList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *ProductList) SetItems(items []*Product) { + l.items = items +} + +// Items returns the items of the list. +func (l *ProductList) Items() []*Product { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *ProductList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *ProductList) Get(i int) *Product { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *ProductList) Slice() []*Product { + var slice []*Product + if l == nil { + slice = make([]*Product, 0) + } else { + slice = make([]*Product, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *ProductList) Each(f func(item *Product) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *ProductList) Range(f func(index int, item *Product) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/webrca/v1/product_type_json.go b/clientapi/webrca/v1/product_type_json.go new file mode 100644 index 00000000..2bcb8433 --- /dev/null +++ b/clientapi/webrca/v1/product_type_json.go @@ -0,0 +1,185 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalProduct writes a value of the 'product' type to the given writer. +func MarshalProduct(object *Product, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteProduct(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteProduct writes a value of the 'product' type to the given stream. +func WriteProduct(object *Product, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(ProductLinkKind) + } else { + stream.WriteString(ProductKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deleted_at") + stream.WriteString((object.deletedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product_id") + stream.WriteString(object.productId) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("product_name") + stream.WriteString(object.productName) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalProduct reads a value of the 'product' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalProduct(source interface{}) (object *Product, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadProduct(iterator) + err = iterator.Error + return +} + +// ReadProduct reads a value of the 'product' type from the given iterator. +func ReadProduct(iterator *jsoniter.Iterator) *Product { + object := &Product{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == ProductLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "deleted_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.deletedAt = value + object.bitmap_ |= 16 + case "product_id": + value := iterator.ReadString() + object.productId = value + object.bitmap_ |= 32 + case "product_name": + value := iterator.ReadString() + object.productName = value + object.bitmap_ |= 64 + 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_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/webrca/v1/status_change_builder.go b/clientapi/webrca/v1/status_change_builder.go new file mode 100644 index 00000000..dffcad92 --- /dev/null +++ b/clientapi/webrca/v1/status_change_builder.go @@ -0,0 +1,133 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// StatusChangeBuilder contains the data and logic needed to build 'status_change' objects. +// +// Definition of a Web RCA event. +type StatusChangeBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + status interface{} + statusId string + updatedAt time.Time +} + +// NewStatusChange creates a new builder of 'status_change' objects. +func NewStatusChange() *StatusChangeBuilder { + return &StatusChangeBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *StatusChangeBuilder) Link(value bool) *StatusChangeBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *StatusChangeBuilder) ID(value string) *StatusChangeBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *StatusChangeBuilder) HREF(value string) *StatusChangeBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *StatusChangeBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *StatusChangeBuilder) CreatedAt(value time.Time) *StatusChangeBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// DeletedAt sets the value of the 'deleted_at' attribute to the given value. +func (b *StatusChangeBuilder) DeletedAt(value time.Time) *StatusChangeBuilder { + b.deletedAt = value + b.bitmap_ |= 16 + return b +} + +// Status sets the value of the 'status' attribute to the given value. +func (b *StatusChangeBuilder) Status(value interface{}) *StatusChangeBuilder { + b.status = value + b.bitmap_ |= 32 + return b +} + +// StatusId sets the value of the 'status_id' attribute to the given value. +func (b *StatusChangeBuilder) StatusId(value string) *StatusChangeBuilder { + b.statusId = value + b.bitmap_ |= 64 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *StatusChangeBuilder) UpdatedAt(value time.Time) *StatusChangeBuilder { + b.updatedAt = value + b.bitmap_ |= 128 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *StatusChangeBuilder) Copy(object *StatusChange) *StatusChangeBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.deletedAt = object.deletedAt + b.status = object.status + b.statusId = object.statusId + b.updatedAt = object.updatedAt + return b +} + +// Build creates a 'status_change' object using the configuration stored in the builder. +func (b *StatusChangeBuilder) Build() (object *StatusChange, err error) { + object = new(StatusChange) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.deletedAt = b.deletedAt + object.status = b.status + object.statusId = b.statusId + object.updatedAt = b.updatedAt + return +} diff --git a/clientapi/webrca/v1/status_change_list_builder.go b/clientapi/webrca/v1/status_change_list_builder.go new file mode 100644 index 00000000..27940b9a --- /dev/null +++ b/clientapi/webrca/v1/status_change_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// StatusChangeListBuilder contains the data and logic needed to build +// 'status_change' objects. +type StatusChangeListBuilder struct { + items []*StatusChangeBuilder +} + +// NewStatusChangeList creates a new builder of 'status_change' objects. +func NewStatusChangeList() *StatusChangeListBuilder { + return new(StatusChangeListBuilder) +} + +// Items sets the items of the list. +func (b *StatusChangeListBuilder) Items(values ...*StatusChangeBuilder) *StatusChangeListBuilder { + b.items = make([]*StatusChangeBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *StatusChangeListBuilder) 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 *StatusChangeListBuilder) Copy(list *StatusChangeList) *StatusChangeListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*StatusChangeBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewStatusChange().Copy(v) + } + } + return b +} + +// Build creates a list of 'status_change' objects using the +// configuration stored in the builder. +func (b *StatusChangeListBuilder) Build() (list *StatusChangeList, err error) { + items := make([]*StatusChange, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(StatusChangeList) + list.items = items + return +} diff --git a/clientapi/webrca/v1/status_change_list_type_json.go b/clientapi/webrca/v1/status_change_list_type_json.go new file mode 100644 index 00000000..11b2cfd6 --- /dev/null +++ b/clientapi/webrca/v1/status_change_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStatusChangeList writes a list of values of the 'status_change' type to +// the given writer. +func MarshalStatusChangeList(list []*StatusChange, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStatusChangeList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStatusChangeList writes a list of value of the 'status_change' type to +// the given stream. +func WriteStatusChangeList(list []*StatusChange, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteStatusChange(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalStatusChangeList reads a list of values of the 'status_change' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStatusChangeList(source interface{}) (items []*StatusChange, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStatusChangeList(iterator) + err = iterator.Error + return +} + +// ReadStatusChangeList reads list of values of the ”status_change' type from +// the given iterator. +func ReadStatusChangeList(iterator *jsoniter.Iterator) []*StatusChange { + list := []*StatusChange{} + for iterator.ReadArray() { + item := ReadStatusChange(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/status_change_type.go b/clientapi/webrca/v1/status_change_type.go new file mode 100644 index 00000000..8e68b8c0 --- /dev/null +++ b/clientapi/webrca/v1/status_change_type.go @@ -0,0 +1,357 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// StatusChangeKind is the name of the type used to represent objects +// of type 'status_change'. +const StatusChangeKind = "StatusChange" + +// StatusChangeLinkKind is the name of the type used to represent links +// to objects of type 'status_change'. +const StatusChangeLinkKind = "StatusChangeLink" + +// StatusChangeNilKind is the name of the type used to nil references +// to objects of type 'status_change'. +const StatusChangeNilKind = "StatusChangeNil" + +// StatusChange represents the values of the 'status_change' type. +// +// Definition of a Web RCA event. +type StatusChange struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + status interface{} + statusId string + updatedAt time.Time +} + +// Kind returns the name of the type of the object. +func (o *StatusChange) Kind() string { + if o == nil { + return StatusChangeNilKind + } + if o.bitmap_&1 != 0 { + return StatusChangeLinkKind + } + return StatusChangeKind +} + +// Link returns true if this is a link. +func (o *StatusChange) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *StatusChange) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *StatusChange) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *StatusChange) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *StatusChange) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *StatusChange) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *StatusChange) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *StatusChange) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// DeletedAt returns the value of the 'deleted_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object deletion timestamp. +func (o *StatusChange) DeletedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.deletedAt + } + return time.Time{} +} + +// GetDeletedAt returns the value of the 'deleted_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object deletion timestamp. +func (o *StatusChange) GetDeletedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.deletedAt + } + return +} + +// Status returns the value of the 'status' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *StatusChange) Status() interface{} { + if o != nil && o.bitmap_&32 != 0 { + return o.status + } + return nil +} + +// GetStatus returns the value of the 'status' attribute and +// a flag indicating if the attribute has a value. +func (o *StatusChange) GetStatus() (value interface{}, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.status + } + return +} + +// StatusId returns the value of the 'status_id' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *StatusChange) StatusId() string { + if o != nil && o.bitmap_&64 != 0 { + return o.statusId + } + return "" +} + +// GetStatusId returns the value of the 'status_id' attribute and +// a flag indicating if the attribute has a value. +func (o *StatusChange) GetStatusId() (value string, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.statusId + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *StatusChange) UpdatedAt() time.Time { + if o != nil && o.bitmap_&128 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *StatusChange) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.updatedAt + } + return +} + +// StatusChangeListKind is the name of the type used to represent list of objects of +// type 'status_change'. +const StatusChangeListKind = "StatusChangeList" + +// StatusChangeListLinkKind is the name of the type used to represent links to list +// of objects of type 'status_change'. +const StatusChangeListLinkKind = "StatusChangeListLink" + +// StatusChangeNilKind is the name of the type used to nil lists of objects of +// type 'status_change'. +const StatusChangeListNilKind = "StatusChangeListNil" + +// StatusChangeList is a list of values of the 'status_change' type. +type StatusChangeList struct { + href string + link bool + items []*StatusChange +} + +// Kind returns the name of the type of the object. +func (l *StatusChangeList) Kind() string { + if l == nil { + return StatusChangeListNilKind + } + if l.link { + return StatusChangeListLinkKind + } + return StatusChangeListKind +} + +// Link returns true iif this is a link. +func (l *StatusChangeList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *StatusChangeList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *StatusChangeList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *StatusChangeList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *StatusChangeList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *StatusChangeList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *StatusChangeList) SetItems(items []*StatusChange) { + l.items = items +} + +// Items returns the items of the list. +func (l *StatusChangeList) Items() []*StatusChange { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *StatusChangeList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *StatusChangeList) Get(i int) *StatusChange { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *StatusChangeList) Slice() []*StatusChange { + var slice []*StatusChange + if l == nil { + slice = make([]*StatusChange, 0) + } else { + slice = make([]*StatusChange, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *StatusChangeList) Each(f func(item *StatusChange) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *StatusChangeList) Range(f func(index int, item *StatusChange) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/webrca/v1/status_change_type_json.go b/clientapi/webrca/v1/status_change_type_json.go new file mode 100644 index 00000000..8f8db510 --- /dev/null +++ b/clientapi/webrca/v1/status_change_type_json.go @@ -0,0 +1,186 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStatusChange writes a value of the 'status_change' type to the given writer. +func MarshalStatusChange(object *StatusChange, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStatusChange(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStatusChange writes a value of the 'status_change' type to the given stream. +func WriteStatusChange(object *StatusChange, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(StatusChangeLinkKind) + } else { + stream.WriteString(StatusChangeKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deleted_at") + stream.WriteString((object.deletedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status") + stream.WriteVal(object.status) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("status_id") + stream.WriteString(object.statusId) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + } + stream.WriteObjectEnd() +} + +// UnmarshalStatusChange reads a value of the 'status_change' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalStatusChange(source interface{}) (object *StatusChange, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadStatusChange(iterator) + err = iterator.Error + return +} + +// ReadStatusChange reads a value of the 'status_change' type from the given iterator. +func ReadStatusChange(iterator *jsoniter.Iterator) *StatusChange { + object := &StatusChange{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == StatusChangeLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "deleted_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.deletedAt = value + object.bitmap_ |= 16 + case "status": + var value interface{} + iterator.ReadVal(&value) + object.status = value + object.bitmap_ |= 32 + case "status_id": + value := iterator.ReadString() + object.statusId = value + object.bitmap_ |= 64 + 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_ |= 128 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/clientapi/webrca/v1/string_list_type_json.go b/clientapi/webrca/v1/string_list_type_json.go new file mode 100644 index 00000000..496af0e7 --- /dev/null +++ b/clientapi/webrca/v1/string_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalStringList writes a list of values of the 'string' type to +// the given writer. +func MarshalStringList(list []string, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteStringList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteStringList writes a list of value of the 'string' type to +// the given stream. +func WriteStringList(list []string, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + stream.WriteString(value) + } + stream.WriteArrayEnd() +} + +// UnmarshalStringList reads a list of values of the 'string' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalStringList(source interface{}) (items []string, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadStringList(iterator) + err = iterator.Error + return +} + +// ReadStringList reads list of values of the ”string' type from +// the given iterator. +func ReadStringList(iterator *jsoniter.Iterator) []string { + list := []string{} + for iterator.ReadArray() { + item := iterator.ReadString() + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/user_builder.go b/clientapi/webrca/v1/user_builder.go new file mode 100644 index 00000000..9d4e2b5d --- /dev/null +++ b/clientapi/webrca/v1/user_builder.go @@ -0,0 +1,153 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// UserBuilder contains the data and logic needed to build 'user' objects. +// +// Definition of a Web RCA user. +type UserBuilder struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + email string + name string + updatedAt time.Time + username string + fromAuth bool +} + +// NewUser creates a new builder of 'user' objects. +func NewUser() *UserBuilder { + return &UserBuilder{} +} + +// Link sets the flag that indicates if this is a link. +func (b *UserBuilder) Link(value bool) *UserBuilder { + b.bitmap_ |= 1 + return b +} + +// ID sets the identifier of the object. +func (b *UserBuilder) ID(value string) *UserBuilder { + b.id = value + b.bitmap_ |= 2 + return b +} + +// HREF sets the link to the object. +func (b *UserBuilder) HREF(value string) *UserBuilder { + b.href = value + b.bitmap_ |= 4 + return b +} + +// Empty returns true if the builder is empty, i.e. no attribute has a value. +func (b *UserBuilder) Empty() bool { + return b == nil || b.bitmap_&^1 == 0 +} + +// CreatedAt sets the value of the 'created_at' attribute to the given value. +func (b *UserBuilder) CreatedAt(value time.Time) *UserBuilder { + b.createdAt = value + b.bitmap_ |= 8 + return b +} + +// DeletedAt sets the value of the 'deleted_at' attribute to the given value. +func (b *UserBuilder) DeletedAt(value time.Time) *UserBuilder { + b.deletedAt = value + b.bitmap_ |= 16 + return b +} + +// Email sets the value of the 'email' attribute to the given value. +func (b *UserBuilder) Email(value string) *UserBuilder { + b.email = value + b.bitmap_ |= 32 + return b +} + +// FromAuth sets the value of the 'from_auth' attribute to the given value. +func (b *UserBuilder) FromAuth(value bool) *UserBuilder { + b.fromAuth = value + b.bitmap_ |= 64 + return b +} + +// Name sets the value of the 'name' attribute to the given value. +func (b *UserBuilder) Name(value string) *UserBuilder { + b.name = value + b.bitmap_ |= 128 + return b +} + +// UpdatedAt sets the value of the 'updated_at' attribute to the given value. +func (b *UserBuilder) UpdatedAt(value time.Time) *UserBuilder { + b.updatedAt = value + b.bitmap_ |= 256 + return b +} + +// Username sets the value of the 'username' attribute to the given value. +func (b *UserBuilder) Username(value string) *UserBuilder { + b.username = value + b.bitmap_ |= 512 + return b +} + +// Copy copies the attributes of the given object into this builder, discarding any previous values. +func (b *UserBuilder) Copy(object *User) *UserBuilder { + if object == nil { + return b + } + b.bitmap_ = object.bitmap_ + b.id = object.id + b.href = object.href + b.createdAt = object.createdAt + b.deletedAt = object.deletedAt + b.email = object.email + b.fromAuth = object.fromAuth + b.name = object.name + b.updatedAt = object.updatedAt + b.username = object.username + return b +} + +// Build creates a 'user' object using the configuration stored in the builder. +func (b *UserBuilder) Build() (object *User, err error) { + object = new(User) + object.id = b.id + object.href = b.href + object.bitmap_ = b.bitmap_ + object.createdAt = b.createdAt + object.deletedAt = b.deletedAt + object.email = b.email + object.fromAuth = b.fromAuth + object.name = b.name + object.updatedAt = b.updatedAt + object.username = b.username + return +} diff --git a/clientapi/webrca/v1/user_list_builder.go b/clientapi/webrca/v1/user_list_builder.go new file mode 100644 index 00000000..f36f9f66 --- /dev/null +++ b/clientapi/webrca/v1/user_list_builder.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +// UserListBuilder contains the data and logic needed to build +// 'user' objects. +type UserListBuilder struct { + items []*UserBuilder +} + +// NewUserList creates a new builder of 'user' objects. +func NewUserList() *UserListBuilder { + return new(UserListBuilder) +} + +// Items sets the items of the list. +func (b *UserListBuilder) Items(values ...*UserBuilder) *UserListBuilder { + b.items = make([]*UserBuilder, len(values)) + copy(b.items, values) + return b +} + +// Empty returns true if the list is empty. +func (b *UserListBuilder) 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 *UserListBuilder) Copy(list *UserList) *UserListBuilder { + if list == nil || list.items == nil { + b.items = nil + } else { + b.items = make([]*UserBuilder, len(list.items)) + for i, v := range list.items { + b.items[i] = NewUser().Copy(v) + } + } + return b +} + +// Build creates a list of 'user' objects using the +// configuration stored in the builder. +func (b *UserListBuilder) Build() (list *UserList, err error) { + items := make([]*User, len(b.items)) + for i, item := range b.items { + items[i], err = item.Build() + if err != nil { + return + } + } + list = new(UserList) + list.items = items + return +} diff --git a/clientapi/webrca/v1/user_list_type_json.go b/clientapi/webrca/v1/user_list_type_json.go new file mode 100644 index 00000000..b9b94327 --- /dev/null +++ b/clientapi/webrca/v1/user_list_type_json.go @@ -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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalUserList writes a list of values of the 'user' type to +// the given writer. +func MarshalUserList(list []*User, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteUserList(list, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteUserList writes a list of value of the 'user' type to +// the given stream. +func WriteUserList(list []*User, stream *jsoniter.Stream) { + stream.WriteArrayStart() + for i, value := range list { + if i > 0 { + stream.WriteMore() + } + WriteUser(value, stream) + } + stream.WriteArrayEnd() +} + +// UnmarshalUserList reads a list of values of the 'user' type +// from the given source, which can be a slice of bytes, a string or a reader. +func UnmarshalUserList(source interface{}) (items []*User, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + items = ReadUserList(iterator) + err = iterator.Error + return +} + +// ReadUserList reads list of values of the ”user' type from +// the given iterator. +func ReadUserList(iterator *jsoniter.Iterator) []*User { + list := []*User{} + for iterator.ReadArray() { + item := ReadUser(iterator) + list = append(list, item) + } + return list +} diff --git a/clientapi/webrca/v1/user_type.go b/clientapi/webrca/v1/user_type.go new file mode 100644 index 00000000..645de981 --- /dev/null +++ b/clientapi/webrca/v1/user_type.go @@ -0,0 +1,397 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + time "time" +) + +// UserKind is the name of the type used to represent objects +// of type 'user'. +const UserKind = "User" + +// UserLinkKind is the name of the type used to represent links +// to objects of type 'user'. +const UserLinkKind = "UserLink" + +// UserNilKind is the name of the type used to nil references +// to objects of type 'user'. +const UserNilKind = "UserNil" + +// User represents the values of the 'user' type. +// +// Definition of a Web RCA user. +type User struct { + bitmap_ uint32 + id string + href string + createdAt time.Time + deletedAt time.Time + email string + name string + updatedAt time.Time + username string + fromAuth bool +} + +// Kind returns the name of the type of the object. +func (o *User) Kind() string { + if o == nil { + return UserNilKind + } + if o.bitmap_&1 != 0 { + return UserLinkKind + } + return UserKind +} + +// Link returns true if this is a link. +func (o *User) Link() bool { + return o != nil && o.bitmap_&1 != 0 +} + +// ID returns the identifier of the object. +func (o *User) ID() string { + if o != nil && o.bitmap_&2 != 0 { + return o.id + } + return "" +} + +// GetID returns the identifier of the object and a flag indicating if the +// identifier has a value. +func (o *User) GetID() (value string, ok bool) { + ok = o != nil && o.bitmap_&2 != 0 + if ok { + value = o.id + } + return +} + +// HREF returns the link to the object. +func (o *User) HREF() string { + if o != nil && o.bitmap_&4 != 0 { + return o.href + } + return "" +} + +// GetHREF returns the link of the object and a flag indicating if the +// link has a value. +func (o *User) GetHREF() (value string, ok bool) { + ok = o != nil && o.bitmap_&4 != 0 + if ok { + value = o.href + } + return +} + +// Empty returns true if the object is empty, i.e. no attribute has a value. +func (o *User) Empty() bool { + return o == nil || o.bitmap_&^1 == 0 +} + +// CreatedAt returns the value of the 'created_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object creation timestamp. +func (o *User) CreatedAt() time.Time { + if o != nil && o.bitmap_&8 != 0 { + return o.createdAt + } + return time.Time{} +} + +// GetCreatedAt returns the value of the 'created_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object creation timestamp. +func (o *User) GetCreatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&8 != 0 + if ok { + value = o.createdAt + } + return +} + +// DeletedAt returns the value of the 'deleted_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object deletion timestamp. +func (o *User) DeletedAt() time.Time { + if o != nil && o.bitmap_&16 != 0 { + return o.deletedAt + } + return time.Time{} +} + +// GetDeletedAt returns the value of the 'deleted_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object deletion timestamp. +func (o *User) GetDeletedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&16 != 0 + if ok { + value = o.deletedAt + } + return +} + +// Email returns the value of the 'email' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *User) Email() string { + if o != nil && o.bitmap_&32 != 0 { + return o.email + } + return "" +} + +// GetEmail returns the value of the 'email' attribute and +// a flag indicating if the attribute has a value. +func (o *User) GetEmail() (value string, ok bool) { + ok = o != nil && o.bitmap_&32 != 0 + if ok { + value = o.email + } + return +} + +// FromAuth returns the value of the 'from_auth' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *User) FromAuth() bool { + if o != nil && o.bitmap_&64 != 0 { + return o.fromAuth + } + return false +} + +// GetFromAuth returns the value of the 'from_auth' attribute and +// a flag indicating if the attribute has a value. +func (o *User) GetFromAuth() (value bool, ok bool) { + ok = o != nil && o.bitmap_&64 != 0 + if ok { + value = o.fromAuth + } + return +} + +// Name returns the value of the 'name' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *User) Name() string { + if o != nil && o.bitmap_&128 != 0 { + return o.name + } + return "" +} + +// GetName returns the value of the 'name' attribute and +// a flag indicating if the attribute has a value. +func (o *User) GetName() (value string, ok bool) { + ok = o != nil && o.bitmap_&128 != 0 + if ok { + value = o.name + } + return +} + +// UpdatedAt returns the value of the 'updated_at' attribute, or +// the zero value of the type if the attribute doesn't have a value. +// +// Object modification timestamp. +func (o *User) UpdatedAt() time.Time { + if o != nil && o.bitmap_&256 != 0 { + return o.updatedAt + } + return time.Time{} +} + +// GetUpdatedAt returns the value of the 'updated_at' attribute and +// a flag indicating if the attribute has a value. +// +// Object modification timestamp. +func (o *User) GetUpdatedAt() (value time.Time, ok bool) { + ok = o != nil && o.bitmap_&256 != 0 + if ok { + value = o.updatedAt + } + return +} + +// Username returns the value of the 'username' attribute, or +// the zero value of the type if the attribute doesn't have a value. +func (o *User) Username() string { + if o != nil && o.bitmap_&512 != 0 { + return o.username + } + return "" +} + +// GetUsername returns the value of the 'username' attribute and +// a flag indicating if the attribute has a value. +func (o *User) GetUsername() (value string, ok bool) { + ok = o != nil && o.bitmap_&512 != 0 + if ok { + value = o.username + } + return +} + +// UserListKind is the name of the type used to represent list of objects of +// type 'user'. +const UserListKind = "UserList" + +// UserListLinkKind is the name of the type used to represent links to list +// of objects of type 'user'. +const UserListLinkKind = "UserListLink" + +// UserNilKind is the name of the type used to nil lists of objects of +// type 'user'. +const UserListNilKind = "UserListNil" + +// UserList is a list of values of the 'user' type. +type UserList struct { + href string + link bool + items []*User +} + +// Kind returns the name of the type of the object. +func (l *UserList) Kind() string { + if l == nil { + return UserListNilKind + } + if l.link { + return UserListLinkKind + } + return UserListKind +} + +// Link returns true iif this is a link. +func (l *UserList) Link() bool { + return l != nil && l.link +} + +// HREF returns the link to the list. +func (l *UserList) HREF() string { + if l != nil { + return l.href + } + return "" +} + +// GetHREF returns the link of the list and a flag indicating if the +// link has a value. +func (l *UserList) GetHREF() (value string, ok bool) { + ok = l != nil && l.href != "" + if ok { + value = l.href + } + return +} + +// Len returns the length of the list. +func (l *UserList) Len() int { + if l == nil { + return 0 + } + return len(l.items) +} + +// Items sets the items of the list. +func (l *UserList) SetLink(link bool) { + l.link = link +} + +// Items sets the items of the list. +func (l *UserList) SetHREF(href string) { + l.href = href +} + +// Items sets the items of the list. +func (l *UserList) SetItems(items []*User) { + l.items = items +} + +// Items returns the items of the list. +func (l *UserList) Items() []*User { + if l == nil { + return nil + } + return l.items +} + +// Empty returns true if the list is empty. +func (l *UserList) Empty() bool { + return l == nil || len(l.items) == 0 +} + +// Get returns the item of the list with the given index. If there is no item with +// that index it returns nil. +func (l *UserList) Get(i int) *User { + if l == nil || i < 0 || i >= len(l.items) { + return nil + } + return l.items[i] +} + +// Slice returns an slice containing the items of the list. The returned slice is a +// copy of the one used internally, so it can be modified without affecting the +// internal representation. +// +// If you don't need to modify the returned slice consider using the Each or Range +// functions, as they don't need to allocate a new slice. +func (l *UserList) Slice() []*User { + var slice []*User + if l == nil { + slice = make([]*User, 0) + } else { + slice = make([]*User, len(l.items)) + copy(slice, l.items) + } + return slice +} + +// Each runs the given function for each item of the list, in order. If the function +// returns false the iteration stops, otherwise it continues till all the elements +// of the list have been processed. +func (l *UserList) Each(f func(item *User) bool) { + if l == nil { + return + } + for _, item := range l.items { + if !f(item) { + break + } + } +} + +// Range runs the given function for each index and item of the list, in order. If +// the function returns false the iteration stops, otherwise it continues till all +// the elements of the list have been processed. +func (l *UserList) Range(f func(index int, item *User) bool) { + if l == nil { + return + } + for index, item := range l.items { + if !f(index, item) { + break + } + } +} diff --git a/clientapi/webrca/v1/user_type_json.go b/clientapi/webrca/v1/user_type_json.go new file mode 100644 index 00000000..3d582d80 --- /dev/null +++ b/clientapi/webrca/v1/user_type_json.go @@ -0,0 +1,211 @@ +/* +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 v1 // github.com/openshift-online/ocm-api-model/clientapi/webrca/v1 + +import ( + "io" + "time" + + jsoniter "github.com/json-iterator/go" + "github.com/openshift-online/ocm-api-model/clientapi/helpers" +) + +// MarshalUser writes a value of the 'user' type to the given writer. +func MarshalUser(object *User, writer io.Writer) error { + stream := helpers.NewStream(writer) + WriteUser(object, stream) + err := stream.Flush() + if err != nil { + return err + } + return stream.Error +} + +// WriteUser writes a value of the 'user' type to the given stream. +func WriteUser(object *User, stream *jsoniter.Stream) { + count := 0 + stream.WriteObjectStart() + stream.WriteObjectField("kind") + if object.bitmap_&1 != 0 { + stream.WriteString(UserLinkKind) + } else { + stream.WriteString(UserKind) + } + count++ + if object.bitmap_&2 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("id") + stream.WriteString(object.id) + count++ + } + if object.bitmap_&4 != 0 { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("href") + stream.WriteString(object.href) + count++ + } + var present_ bool + present_ = object.bitmap_&8 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("created_at") + stream.WriteString((object.createdAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&16 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("deleted_at") + stream.WriteString((object.deletedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&32 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("email") + stream.WriteString(object.email) + count++ + } + present_ = object.bitmap_&64 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("from_auth") + stream.WriteBool(object.fromAuth) + count++ + } + present_ = object.bitmap_&128 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("name") + stream.WriteString(object.name) + count++ + } + present_ = object.bitmap_&256 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("updated_at") + stream.WriteString((object.updatedAt).Format(time.RFC3339)) + count++ + } + present_ = object.bitmap_&512 != 0 + if present_ { + if count > 0 { + stream.WriteMore() + } + stream.WriteObjectField("username") + stream.WriteString(object.username) + } + stream.WriteObjectEnd() +} + +// UnmarshalUser reads a value of the 'user' type from the given +// source, which can be an slice of bytes, a string or a reader. +func UnmarshalUser(source interface{}) (object *User, err error) { + iterator, err := helpers.NewIterator(source) + if err != nil { + return + } + object = ReadUser(iterator) + err = iterator.Error + return +} + +// ReadUser reads a value of the 'user' type from the given iterator. +func ReadUser(iterator *jsoniter.Iterator) *User { + object := &User{} + for { + field := iterator.ReadObject() + if field == "" { + break + } + switch field { + case "kind": + value := iterator.ReadString() + if value == UserLinkKind { + object.bitmap_ |= 1 + } + case "id": + object.id = iterator.ReadString() + object.bitmap_ |= 2 + case "href": + object.href = iterator.ReadString() + object.bitmap_ |= 4 + case "created_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.createdAt = value + object.bitmap_ |= 8 + case "deleted_at": + text := iterator.ReadString() + value, err := time.Parse(time.RFC3339, text) + if err != nil { + iterator.ReportError("", err.Error()) + } + object.deletedAt = value + object.bitmap_ |= 16 + case "email": + value := iterator.ReadString() + object.email = value + object.bitmap_ |= 32 + case "from_auth": + value := iterator.ReadBool() + object.fromAuth = value + object.bitmap_ |= 64 + case "name": + value := iterator.ReadString() + object.name = value + object.bitmap_ |= 128 + 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_ |= 256 + case "username": + value := iterator.ReadString() + object.username = value + object.bitmap_ |= 512 + default: + iterator.ReadAny() + } + } + return object +} diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..9db4de5d --- /dev/null +++ b/go.sum @@ -0,0 +1,41 @@ +github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211106181442-e4c1a74c66bd h1:fjJY1LimH0wVCvOHLX35SCX/MbWomAglET1H2kvz7xc= +github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211106181442-e4c1a74c66bd/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deads2k/ocm-api-metamodel v0.0.0-20250303232453-01309d9a9692 h1:XBHr9lM+rY9kZgyZ5vLEEt0USnUcTMlRCuxwbqZMGDI= +github.com/deads2k/ocm-api-metamodel v0.0.0-20250303232453-01309d9a9692/go.mod h1:Q8qCHM/JoQ0sJC4jfZ/bzQB2Oiyr5BA9ODTAEpvU2co= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/onsi/ginkgo/v2 v2.1.3 h1:e/3Cwtogj0HA+25nMP1jCMDIf8RtRYbGwGGuBIFztkc= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= +github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/metamodel_generator/Makefile b/metamodel_generator/Makefile new file mode 100644 index 00000000..461db9f8 --- /dev/null +++ b/metamodel_generator/Makefile @@ -0,0 +1,19 @@ +# +# Copyright (c) 2019 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. +# + +metamodel: + go build github.com/openshift-online/ocm-api-metamodel/cmd/metamodel + diff --git a/metamodel_generator/dependencymagnet/doc.go b/metamodel_generator/dependencymagnet/doc.go new file mode 100644 index 00000000..3b49a8e5 --- /dev/null +++ b/metamodel_generator/dependencymagnet/doc.go @@ -0,0 +1,11 @@ +//go:build tools +// +build tools + +// go mod won't pull in code that isn't depended upon, but we have some code we don't depend on from code that must be included +// for our build to work. +package dependencymagnet + +import ( + // this gives us clear dependency control of our generator, easy replaces for development, ease of vendored inspection, and fully local builds. + _ "github.com/openshift-online/ocm-api-metamodel/cmd/metamodel" +) diff --git a/metamodel_generator/go.mod b/metamodel_generator/go.mod new file mode 100644 index 00000000..0f824cde --- /dev/null +++ b/metamodel_generator/go.mod @@ -0,0 +1,17 @@ +module github.com/openshift-online/ocm-api-model/metamodel_generator + +go 1.23.0 + +require github.com/openshift-online/ocm-api-metamodel v0.0.65 + +require ( + github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211106181442-e4c1a74c66bd // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/spf13/cobra v1.4.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect +) + +replace github.com/openshift-online/ocm-api-metamodel => github.com/deads2k/ocm-api-metamodel v0.0.0-20250326194516-ba2daee63724 diff --git a/metamodel_generator/go.sum b/metamodel_generator/go.sum new file mode 100644 index 00000000..b8ef866b --- /dev/null +++ b/metamodel_generator/go.sum @@ -0,0 +1,41 @@ +github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211106181442-e4c1a74c66bd h1:fjJY1LimH0wVCvOHLX35SCX/MbWomAglET1H2kvz7xc= +github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211106181442-e4c1a74c66bd/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deads2k/ocm-api-metamodel v0.0.0-20250326194516-ba2daee63724 h1:S2QndwDdHZNyqiGaZMTI4tqHIZdmlogR7LzglpEB8Ws= +github.com/deads2k/ocm-api-metamodel v0.0.0-20250326194516-ba2daee63724/go.mod h1:Q8qCHM/JoQ0sJC4jfZ/bzQB2Oiyr5BA9ODTAEpvU2co= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/onsi/ginkgo/v2 v2.1.3 h1:e/3Cwtogj0HA+25nMP1jCMDIf8RtRYbGwGGuBIFztkc= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= +github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/openapi/access_transparency/v1/openapi.json b/openapi/access_transparency/v1/openapi.json new file mode 100644 index 00000000..f8dd649c --- /dev/null +++ b/openapi/access_transparency/v1/openapi.json @@ -0,0 +1,699 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "v1", + "title": "access_transparency", + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + }, + "contact": { + "name": "OCM Feedback", + "email": "ocm-feedback@redhat.com" + } + }, + "servers": [ + { + "description": "Production", + "url": "https://api.openshift.com" + }, + { + "description": "Stage", + "url": "https://api.stage.openshift.com" + } + ], + "paths": { + "/api/access_transparency/v1": { + "get": { + "description": "Retrieves the version metadata.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Metadata" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/access_transparency/v1/access_protection": { + "get": { + "description": "Retrieves an Access Protection by organization/cluster/subscription query param.", + "parameters": [ + { + "name": "clusterId", + "description": "Check status by Cluter.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "organizationId", + "description": "Check status by Organization.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "subscriptionId", + "description": "Check status by Subscription.", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccessProtection" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/access_transparency/v1/access_requests": { + "get": { + "description": "Retrieves the list of access requests.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the access request instead of\nthe names of the columns of a table. For example, in order to sort the access requests\ndescending by created_at the value should be:\n\n```sql\ncreated_at desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the access request instead of\nthe names of the columns of a table. For example, in order to retrieve all the\naccess requests with a requested_by starting with `my` the value should be:\n\n```sql\nrequested_by like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the access requests\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of access requests.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AccessRequest" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "post": { + "description": "Create a new access request and add it to the collection of access requests.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccessRequestPostRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccessRequest" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/access_transparency/v1/access_requests/{access_request_id}": { + "get": { + "description": "Retrieves the details of the access request.", + "parameters": [ + { + "name": "access_request_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccessRequest" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/access_transparency/v1/access_requests/{access_request_id}/decisions": { + "post": { + "description": "Create a new decision and add it to the collection of decisions of an access request.", + "parameters": [ + { + "name": "access_request_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Decision" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Decision" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of decisions.", + "parameters": [ + { + "name": "access_request_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the decision instead of\nthe names of the columns of a table. For example, in order to sort the decisions\ndescending by created_at the value should be:\n\n```sql\ncreated_at desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the decision instead of\nthe names of the columns of a table. For example, in order to retrieve all the\ndecisions with a decided_by starting with `my` the value should be:\n\n```sql\ndecided_by like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the decisions\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of decisions.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Decision" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/access_transparency/v1/access_requests/{access_request_id}/decisions/{decision_id}": { + "get": { + "description": "Retrieves the details of the decision.", + "parameters": [ + { + "name": "access_request_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "decision_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Decision" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Metadata": { + "description": "Version metadata.", + "properties": { + "server_version": { + "description": "Version of the server.", + "type": "string" + } + } + }, + "AccessProtection": { + "description": "Representation of an access protection.", + "properties": { + "enabled": { + "type": "boolean" + } + } + }, + "AccessRequest": { + "description": "Representation of an access request.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AccessRequest' if this is a complete object or 'AccessRequestLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "cluster_id": { + "description": "Cluster from which the Access Request belongs to.", + "type": "string" + }, + "created_at": { + "description": "Date and time when the access request was initially created, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + }, + "deadline": { + "description": "How long the Access Request can be in pending state waiting for a customer decision.", + "type": "string" + }, + "deadline_at": { + "description": "Date and time for the deadline that the Access Request needs to be decided, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + }, + "decisions": { + "description": "Decisions attached to the Access Request.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Decision" + } + }, + "duration": { + "description": "How long the access will last after it's been approved.", + "type": "string" + }, + "internal_support_case_id": { + "description": "Internal support case id linking to jira ticket.", + "type": "string" + }, + "justification": { + "description": "Justification of the Access Request.", + "type": "string" + }, + "organization_id": { + "description": "Organization from which the Access Request belongs to.", + "type": "string" + }, + "requested_by": { + "description": "User that requested the Access.", + "type": "string" + }, + "status": { + "description": "Access Request status.", + "$ref": "#/components/schemas/AccessRequestStatus" + }, + "subscription_id": { + "description": "Subscription from which the Access Request belongs to.", + "type": "string" + }, + "support_case_id": { + "description": "Support case ID linking to JIRA ticket.", + "type": "string" + }, + "updated_at": { + "description": "Date and time when the access request was lastly updated, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + } + } + }, + "AccessRequestPostRequest": { + "description": "Representation of an access request post request.", + "properties": { + "cluster_id": { + "description": "Cluster from which the Access Request belongs to.", + "type": "string" + }, + "deadline": { + "description": "How long the Access Request can be in pending state waiting for a customer decision.", + "type": "string" + }, + "duration": { + "description": "How long the access will last after it's been approved.", + "type": "string" + }, + "internal_support_case_id": { + "description": "Internal support case id linking to jira ticket.", + "type": "string" + }, + "justification": { + "description": "Justification of the Access Request.", + "type": "string" + }, + "subscription_id": { + "description": "Subscription from which the Access Request belongs to.", + "type": "string" + }, + "support_case_id": { + "description": "Support case ID linking to JIRA ticket.", + "type": "string" + } + } + }, + "AccessRequestState": { + "description": "Possible states to an access request status.", + "type": "string", + "enum": [ + "Approved", + "Denied", + "Expired", + "Pending" + ] + }, + "AccessRequestStatus": { + "description": "Representation of an access request status.", + "properties": { + "expires_at": { + "description": "Date and time when the access request will expire, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + }, + "state": { + "description": "Current state of the Access Request.", + "$ref": "#/components/schemas/AccessRequestState" + } + } + }, + "Decision": { + "description": "Representation of an decision.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Decision' if this is a complete object or 'DecisionLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Date and time when the decision was initially created, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + }, + "decided_by": { + "description": "User that decided.", + "type": "string" + }, + "decision": { + "description": "State of the decision.", + "$ref": "#/components/schemas/DecisionDecision" + }, + "justification": { + "description": "Justification of the decision.", + "type": "string" + }, + "updated_at": { + "description": "Date and time when the decision was lastly updated, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + } + } + }, + "DecisionDecision": { + "description": "Possible decisions to a decision status.", + "type": "string", + "enum": [ + "Approved", + "Denied", + "Expired" + ] + }, + "Error": { + "type": "object", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will always be 'Error'", + "type": "string" + }, + "id": { + "description": "Numeric identifier of the error.", + "type": "integer", + "format": "int32" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "description": "Globally unique code of the error, composed of the unique identifier of the API and the numeric identifier of the error. For example, for if the numeric identifier of the error is `93` and the identifier of the API is `clusters_mgmt` then the code will be `CLUSTERS-MGMT-93`.", + "type": "string" + }, + "reason": { + "description": "Human readable description of the error.", + "type": "string" + }, + "details": { + "description": "Extra information about the error.", + "type": "object", + "additionalProperties": true + } + } + } + }, + "securitySchemes": { + "bearer": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "security": [ + { + "bearer": [ + + ] + } + ] +} \ No newline at end of file diff --git a/openapi/accounts_mgmt/v1/openapi.json b/openapi/accounts_mgmt/v1/openapi.json new file mode 100644 index 00000000..7493e270 --- /dev/null +++ b/openapi/accounts_mgmt/v1/openapi.json @@ -0,0 +1,7474 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "v1", + "title": "accounts_mgmt", + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + }, + "contact": { + "name": "OCM Feedback", + "email": "ocm-feedback@redhat.com" + } + }, + "servers": [ + { + "description": "Production", + "url": "https://api.openshift.com" + }, + { + "description": "Stage", + "url": "https://api.stage.openshift.com" + } + ], + "paths": { + "/api/accounts_mgmt/v1": { + "get": { + "description": "Retrieves the version metadata.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Metadata" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/access_token": { + "post": { + "description": "Returns access token generated from registries in docker format.", + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccessToken" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/accounts": { + "post": { + "description": "Creates a new account.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Account" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Account" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of accounts.", + "parameters": [ + { + "name": "fetchLabels", + "description": "If true, includes the labels on an account in the output. Could slow request response time.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "fields", + "description": "Projection\nThis field contains a comma-separated list of fields you'd like to get in\na result. No new fields can be added, only existing ones can be filtered.\nTo specify a field 'id' of a structure 'plan' use 'plan.id'.\nTo specify all fields of a structure 'labels' use 'labels.*'.\n", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement. For example, in order to sort the\naccounts descending by name identifier the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the account\ninstead of the names of the columns of a table. For example, in order to\nretrieve accounts with username starting with my:\n\n```sql\nusername like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of accounts.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Account" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/accounts/{account_id}": { + "delete": { + "parameters": [ + { + "name": "account_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "deleteAssociatedResources", + "in": "query", + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the account.", + "parameters": [ + { + "name": "account_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Account" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the account.", + "parameters": [ + { + "name": "account_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Account" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Account" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/accounts/{account_id}/labels": { + "post": { + "description": "Create a new account/organization/subscription label.", + "parameters": [ + { + "name": "account_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of labels of the account/organization/subscription.\n\nIMPORTANT: This collection doesn't currently support paging or searching, so the returned\n`page` will always be 1 and `size` and `total` will always be the total number of labels\nof the account/organization/subscription.", + "parameters": [ + { + "name": "account_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nlabels of the account/organization/subscription.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of cloud providers.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nlabels of the account/organization/subscription.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of labels of the account/organization/subscription.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/accounts/{account_id}/labels/{label_id}": { + "delete": { + "description": "Deletes the account label.", + "parameters": [ + { + "name": "account_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the label.", + "parameters": [ + { + "name": "account_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the account label.", + "parameters": [ + { + "name": "account_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/accounts/{account_id}/labels/{labels_id}": { + "delete": { + "description": "Deletes the account label.", + "parameters": [ + { + "name": "account_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "labels_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the label.", + "parameters": [ + { + "name": "account_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "labels_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the account label.", + "parameters": [ + { + "name": "account_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "labels_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/billing_models": { + "get": { + "description": "Retrieves a list of BillingModels.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieve list of Billing Models.", + "type": "array", + "items": { + "$ref": "#/components/schemas/BillingModelItem" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection, regardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/billing_models/{billing_model_id}": { + "get": { + "description": "Retrieves the details of the billing model", + "parameters": [ + { + "name": "billing_model_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingModelItem" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/capabilities": { + "get": { + "description": "Retrieves a list of Capabilities.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the organization\ninstead of the names of the columns of a table. For example, in order to\nretrieve organizations with name starting with my:\n\n```sql\nname like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of Capabilities.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Capability" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/cloud_resources": { + "post": { + "description": "Creates a new cloud resource", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudResource" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudResource" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of cloud resources.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the cloud resource\ninstead of the names of the columns of a table.\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of cloud resources.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudResource" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/cloud_resources/{cloud_resource_id}": { + "delete": { + "description": "Deletes the cloud resource.", + "parameters": [ + { + "name": "cloud_resource_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the cloud resource.", + "parameters": [ + { + "name": "cloud_resource_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudResource" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the cloud resource.", + "parameters": [ + { + "name": "cloud_resource_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudResource" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudResource" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/cluster_authorizations": { + "post": { + "description": "Authorizes new cluster creation against an existing subscription.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterAuthorizationRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterAuthorizationResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/cluster_registrations": { + "post": { + "description": "Finds or creates a cluster registration with a registry credential\ntoken and cluster identifier.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterRegistrationRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterRegistrationResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/current_access": { + "post": { + "description": "Creates a new role.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Role" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Role" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves a list of roles.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the role\ninstead of the names of the columns of a table. For example, in order to\nretrieve roles named starting with `Organization`:\n\n```sql\nname like 'Organization%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of roles.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Role" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/current_access/{role_id}": { + "delete": { + "description": "Deletes the role.", + "parameters": [ + { + "name": "role_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the role.", + "parameters": [ + { + "name": "role_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Role" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the role.", + "parameters": [ + { + "name": "role_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Role" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Role" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/current_account": { + "get": { + "description": "Retrieves the details of the account.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Account" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/default_capabilities": { + "post": { + "description": "Creates a new default capability.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DefaultCapability" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DefaultCapability" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves a list of Dedfault Capabilities.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the organization\ninstead of the names of the columns of a table. For example, in order to\nretrieve organizations with name starting with my:\n\n```sql\nname like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of Default Capabilities.", + "type": "array", + "items": { + "$ref": "#/components/schemas/DefaultCapability" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/default_capabilities/{default_capability_id}": { + "delete": { + "parameters": [ + { + "name": "default_capability_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the default capability.", + "parameters": [ + { + "name": "default_capability_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DefaultCapability" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the default capability.", + "parameters": [ + { + "name": "default_capability_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DefaultCapability" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DefaultCapability" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/deleted_subscriptions": { + "get": { + "description": "Retrieves a list of DeletedSubscriptions.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement. For example, in order to sort the\nDeletedSubscriptions descending by name identifier the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the DeletedSubscription instead\nof the names of the columns of a table. For example, in order to retrieve all the\nDeletedSubscriptions for managed clusters the value should be:\n\n```sql\nmanaged = 't'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nclusters that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of DeletedSubscriptions.", + "type": "array", + "items": { + "$ref": "#/components/schemas/DeletedSubscription" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/feature_toggles/{feature_toggle_id}/query": { + "post": { + "description": "Retrieves the details of the feature toggle by providing query context", + "parameters": [ + { + "name": "feature_toggle_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FeatureToggleQueryRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FeatureToggle" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/labels": { + "get": { + "description": "Retrieves a list of labels.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the organization\ninstead of the names of the columns of a table. For example, in order to\nretrieve labels with name starting with my:\n\n```sql\nname like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of labels.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/notify_details": { + "post": { + "description": "Post Notification details about user related to subscription/cluster via email and get the data associated with it.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotificationDetailsRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenericNotifyDetailsResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/organizations": { + "post": { + "description": "Creates a new organization.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Organization" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Organization" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves a list of organizations.", + "parameters": [ + { + "name": "fetchLabels", + "description": "If true, includes the labels on an organization in the output. Could slow request response time.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "fields", + "description": "Projection\nThis field contains a comma-separated list of fields you'd like to get in\na result. No new fields can be added, only existing ones can be filtered.\nTo specify a field 'id' of a structure 'plan' use 'plan.id'.\nTo specify all fields of a structure 'labels' use 'labels.*'.\n", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the organization\ninstead of the names of the columns of a table. For example, in order to\nretrieve organizations with name starting with my:\n\n```sql\nname like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of organizations.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Organization" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/organizations/{organization_id}": { + "get": { + "description": "Retrieves the details of the organization.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Organization" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the organization.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Organization" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Organization" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/organizations/{organization_id}/labels": { + "post": { + "description": "Create a new account/organization/subscription label.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of labels of the account/organization/subscription.\n\nIMPORTANT: This collection doesn't currently support paging or searching, so the returned\n`page` will always be 1 and `size` and `total` will always be the total number of labels\nof the account/organization/subscription.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nlabels of the account/organization/subscription.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of cloud providers.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nlabels of the account/organization/subscription.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of labels of the account/organization/subscription.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/organizations/{organization_id}/labels/{label_id}": { + "delete": { + "description": "Deletes the account label.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the label.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the account label.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/organizations/{organization_id}/labels/{labels_id}": { + "delete": { + "description": "Deletes the account label.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "labels_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the label.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "labels_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the account label.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "labels_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/organizations/{organization_id}/quota_cost": { + "get": { + "description": "Retrieves the quota cost.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the quota\ncost instead of the names of the columns of a table. For example, in order\nto retrieve the quota cost for all add-ons:\n\n```sql\nquota_id LIKE 'add-on%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved quota cost items.", + "type": "array", + "items": { + "$ref": "#/components/schemas/QuotaCost" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/organizations/{organization_id}/resource_quota": { + "post": { + "description": "Creates a new resource quota.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceQuota" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceQuota" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of resource quotas.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the account\ninstead of the names of the columns of a table. For example, in order to\nretrieve resource quota with resource_type cluster.aws:\n\n```sql\nresource_type = 'cluster.aws'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of resource quotas.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceQuota" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/organizations/{organization_id}/resource_quota/{resource_quota_id}": { + "delete": { + "description": "Deletes the resource quota.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "resource_quota_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the resource quota.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "resource_quota_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceQuota" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the resource quota.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "resource_quota_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceQuota" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceQuota" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/organizations/{organization_id}/summary_dashboard": { + "get": { + "description": "Retrieves the details of the organization's summary dashboard.", + "parameters": [ + { + "name": "organization_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SummaryDashboard" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/permissions": { + "post": { + "description": "Creates a new permission.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Permission" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Permission" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves a list of permissions.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of permissions.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Permission" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/permissions/{permission_id}": { + "delete": { + "description": "Deletes the permission.", + "parameters": [ + { + "name": "permission_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the permission.", + "parameters": [ + { + "name": "permission_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Permission" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/pull_secrets": { + "post": { + "description": "Returns access token generated from registries in docker format.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PullSecretsRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccessToken" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/pull_secrets/{pull_secret_id}": { + "delete": { + "description": "Deletes the pull secret.", + "parameters": [ + { + "name": "pull_secret_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/quota_authorizations": { + "post": { + "description": "Authorizes new quota creation against an existing subscription.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QuotaAuthorizationRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QuotaAuthorizationResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/registries": { + "get": { + "description": "Retrieves a list of registries.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of registries.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Registry" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/registries/{registry_id}": { + "get": { + "description": "Retrieves the details of the registry.", + "parameters": [ + { + "name": "registry_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Registry" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/registry_credentials": { + "post": { + "description": "Creates a new registry credential.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RegistryCredential" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RegistryCredential" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of accounts.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement. For example, in order to sort the\nRegistryCredentials descending by username the value should be:\n\n```sql\nusername desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the RegistryCredentials instead\nof the names of the columns of a table. For example, in order to retrieve all the\nRegistryCredentials for a user the value should be:\n\n```sql\nusername = 'abcxyz...'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nRegistryCredentials that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of registry credentials.", + "type": "array", + "items": { + "$ref": "#/components/schemas/RegistryCredential" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/registry_credentials/{registry_credential_id}": { + "delete": { + "description": "Delete the registry credential", + "parameters": [ + { + "name": "registry_credential_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the registry credential.", + "parameters": [ + { + "name": "registry_credential_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RegistryCredential" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/resource_quota": { + "post": { + "description": "Creates a new resource quota.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceQuota" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceQuota" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of resource quotas.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the account\ninstead of the names of the columns of a table. For example, in order to\nretrieve resource quota with resource_type cluster.aws:\n\n```sql\nresource_type = 'cluster.aws'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of resource quotas.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceQuota" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/resource_quota/{resource_quota_id}": { + "delete": { + "description": "Deletes the resource quota.", + "parameters": [ + { + "name": "resource_quota_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the resource quota.", + "parameters": [ + { + "name": "resource_quota_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceQuota" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the resource quota.", + "parameters": [ + { + "name": "resource_quota_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceQuota" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceQuota" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/role_bindings": { + "post": { + "description": "Creates a new role binding.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleBinding" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleBinding" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves a list of role bindings.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the role binding\ninstead of the names of the columns of a table. For example, in order to\nretrieve role bindings with role_id AuthenticatedUser:\n\n```sql\nrole_id = 'AuthenticatedUser'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of role bindings.", + "type": "array", + "items": { + "$ref": "#/components/schemas/RoleBinding" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/role_bindings/{role_binding_id}": { + "delete": { + "description": "Deletes the role binding.", + "parameters": [ + { + "name": "role_binding_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the role binding.", + "parameters": [ + { + "name": "role_binding_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleBinding" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the account.", + "parameters": [ + { + "name": "role_binding_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleBinding" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleBinding" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/roles": { + "post": { + "description": "Creates a new role.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Role" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Role" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves a list of roles.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the role\ninstead of the names of the columns of a table. For example, in order to\nretrieve roles named starting with `Organization`:\n\n```sql\nname like 'Organization%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of roles.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Role" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/roles/{role_id}": { + "delete": { + "description": "Deletes the role.", + "parameters": [ + { + "name": "role_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the role.", + "parameters": [ + { + "name": "role_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Role" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the role.", + "parameters": [ + { + "name": "role_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Role" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Role" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/sku_rules": { + "get": { + "description": "Retrieves a list of Sku Rules.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the SKU\ninstead of the names of the columns of a table. For example, in order to\nretrieve SKUS large sized resources:\n\n```sql\nresource_name like '%large'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of Sku Rules.", + "type": "array", + "items": { + "$ref": "#/components/schemas/SkuRule" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/sku_rules/{sku_rule_id}": { + "get": { + "description": "Retrieves the details of the Sku Rule.", + "parameters": [ + { + "name": "sku_rule_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SkuRule" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/subscriptions": { + "get": { + "description": "Retrieves a list of subscriptions.", + "parameters": [ + { + "name": "fetchAccounts", + "description": "If true, includes the account reference information in the output. Could slow request response time.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "fetchLabels", + "description": "If true, includes the labels on a subscription in the output. Could slow request response time.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "fields", + "description": "Projection\nThis field contains a comma-separated list of fields you'd like to get in\na result. No new fields can be added, only existing ones can be filtered.\nTo specify a field 'id' of a structure 'plan' use 'plan.id'.\nTo specify all fields of a structure 'labels' use 'labels.*'.\n", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "labels", + "description": "Filter subscriptions by a comma separated list of labels:\n\n[source]\n----\nenv=staging,department=sales\n----\n", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement. For example, in order to sort the\nsubscriptions descending by name identifier the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the subscription instead\nof the names of the columns of a table. For example, in order to retrieve all the\nsubscriptions for managed clusters the value should be:\n\n```sql\nmanaged = 't'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nclusters that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of subscriptions.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Subscription" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "post": { + "description": "Create a new subscription and register a cluster for it.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscriptionRegistration" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Subscription" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/subscriptions/labels": { + "post": { + "description": "Create a new account/organization/subscription label.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of labels of the account/organization/subscription.\n\nIMPORTANT: This collection doesn't currently support paging or searching, so the returned\n`page` will always be 1 and `size` and `total` will always be the total number of labels\nof the account/organization/subscription.", + "parameters": [ + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nlabels of the account/organization/subscription.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of cloud providers.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nlabels of the account/organization/subscription.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of labels of the account/organization/subscription.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/subscriptions/labels/{label_id}": { + "delete": { + "description": "Deletes the account label.", + "parameters": [ + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the label.", + "parameters": [ + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the account label.", + "parameters": [ + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/subscriptions/labels/{labels_id}": { + "delete": { + "description": "Deletes the account label.", + "parameters": [ + { + "name": "labels_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the label.", + "parameters": [ + { + "name": "labels_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the account label.", + "parameters": [ + { + "name": "labels_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/subscriptions/{subscription_id}": { + "delete": { + "description": "Deletes the subscription by ID.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the subscription by ID.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Subscription" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Update a subscription", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Subscription" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Subscription" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/subscriptions/{subscription_id}/labels": { + "post": { + "description": "Create a new account/organization/subscription label.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of labels of the account/organization/subscription.\n\nIMPORTANT: This collection doesn't currently support paging or searching, so the returned\n`page` will always be 1 and `size` and `total` will always be the total number of labels\nof the account/organization/subscription.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nlabels of the account/organization/subscription.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of cloud providers.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nlabels of the account/organization/subscription.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of labels of the account/organization/subscription.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/subscriptions/{subscription_id}/labels/{label_id}": { + "delete": { + "description": "Deletes the account label.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the label.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the account label.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/subscriptions/{subscription_id}/labels/{labels_id}": { + "delete": { + "description": "Deletes the account label.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "labels_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the label.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "labels_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the account label.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "labels_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/subscriptions/{subscription_id}/reserved_resources": { + "get": { + "description": "Retrieves items of the collection of reserved resources by the subscription.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of reserved resources.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ReservedResource" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/subscriptions/{subscription_id}/reserved_resources/{reserved_resource_id}": { + "get": { + "description": "Retrieves the reserved resource.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "reserved_resource_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReservedResource" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/subscriptions/{subscription_id}/role_bindings": { + "post": { + "description": "Creates a new role binding.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleBinding" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleBinding" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves a list of role bindings.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the role binding\ninstead of the names of the columns of a table. For example, in order to\nretrieve role bindings with role_id AuthenticatedUser:\n\n```sql\nrole_id = 'AuthenticatedUser'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of role bindings.", + "type": "array", + "items": { + "$ref": "#/components/schemas/RoleBinding" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/subscriptions/{subscription_id}/role_bindings/{role_binding_id}": { + "delete": { + "description": "Deletes the role binding.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "role_binding_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the role binding.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "role_binding_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleBinding" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the account.", + "parameters": [ + { + "name": "subscription_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "role_binding_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleBinding" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleBinding" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/support_cases": { + "post": { + "description": "Create a support case related to Hydra", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SupportCaseRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SupportCaseResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/support_cases/{support_case_id}": { + "delete": { + "description": "Deletes the support case by Case ID.", + "parameters": [ + { + "name": "support_case_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/accounts_mgmt/v1/token_authorization": { + "post": { + "description": "Returns a specific account based on the given pull secret", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TokenAuthorizationRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TokenAuthorizationResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Metadata": { + "description": "Version metadata.", + "properties": { + "server_version": { + "description": "Version of the server.", + "type": "string" + } + } + }, + "AccessToken": { + "properties": { + "auths": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/AccessTokenAuth" + } + } + } + }, + "AccessTokenAuth": { + "properties": { + "auth": { + "type": "string" + }, + "email": { + "type": "string" + } + } + }, + "Account": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Account' if this is a complete object or 'AccountLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "ban_code": { + "type": "string" + }, + "ban_description": { + "type": "string" + }, + "banned": { + "type": "boolean" + }, + "capabilities": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Capability" + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "email": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "labels": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "last_name": { + "type": "string" + }, + "organization": { + "$ref": "#/components/schemas/Organization" + }, + "rhit_account_id": { + "description": "RhitAccountID will be deprecated in favor of RhitWebUserId", + "type": "string" + }, + "rhit_web_user_id": { + "type": "string" + }, + "service_account": { + "type": "boolean" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "username": { + "type": "string" + } + } + }, + "Action": { + "description": "Possible actions for a permission.", + "type": "string", + "enum": [ + "create", + "delete", + "get", + "list", + "update" + ] + }, + "BillingModel": { + "description": "Billing model for subscripiton and reserved_resource resources.", + "type": "string", + "enum": [ + "marketplace", + "marketplace-aws", + "marketplace-gcp", + "marketplace-rhm", + "marketplace-azure", + "standard" + ] + }, + "BillingModelItem": { + "description": "BillingModelItem represents a billing model", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'BillingModelItem' if this is a complete object or 'BillingModelItemLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "billing_model_type": { + "description": "BillingModelType is the type of the BillingModel. e.g. standard, marketplace.", + "type": "string" + }, + "description": { + "description": "Single line description of the billing model.", + "type": "string" + }, + "display_name": { + "description": "User friendly display name of the billing model.", + "type": "string" + }, + "marketplace": { + "description": "Indicates the marketplace of the billing model. e.g. gcp, aws, etc.", + "type": "string" + } + } + }, + "Capability": { + "description": "Capability model that represents internal labels with a key that matches a set list defined in AMS (defined in pkg/api/capability_types.go).", + "properties": { + "inherited": { + "description": "Dynamic attribute of the capability that tells us that this capability was inherited from the subscription's organization. ", + "type": "boolean" + }, + "name": { + "description": "Name of the capability label.", + "type": "string" + }, + "value": { + "description": "Value that can be assigned to the capability (eg. \"true\", \"false\" etc).", + "type": "string" + } + } + }, + "CloudAccount": { + "properties": { + "cloud_account_id": { + "type": "string" + }, + "cloud_provider_id": { + "type": "string" + }, + "contracts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Contract" + } + } + } + }, + "CloudResource": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'CloudResource' if this is a complete object or 'CloudResourceLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "active": { + "type": "boolean" + }, + "category": { + "type": "string" + }, + "category_pretty": { + "type": "string" + }, + "cloud_provider": { + "type": "string" + }, + "cpu_cores": { + "type": "integer", + "format": "int32" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "generic_name": { + "type": "string" + }, + "memory": { + "type": "integer", + "format": "int32" + }, + "memory_pretty": { + "type": "string" + }, + "name_pretty": { + "type": "string" + }, + "resource_type": { + "type": "string" + }, + "size_pretty": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "ClusterAuthorizationRequest": { + "properties": { + "byoc": { + "type": "boolean" + }, + "account_username": { + "type": "string" + }, + "availability_zone": { + "type": "string" + }, + "cloud_account_id": { + "type": "string" + }, + "cloud_provider_id": { + "type": "string" + }, + "cluster_id": { + "type": "string" + }, + "disconnected": { + "type": "boolean" + }, + "display_name": { + "type": "string" + }, + "external_cluster_id": { + "type": "string" + }, + "managed": { + "type": "boolean" + }, + "product_id": { + "type": "string" + }, + "product_category": { + "type": "string" + }, + "quota_version": { + "type": "string" + }, + "reserve": { + "type": "boolean" + }, + "resources": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReservedResource" + } + }, + "scope": { + "type": "string" + } + } + }, + "ClusterAuthorizationResponse": { + "properties": { + "allowed": { + "type": "boolean" + }, + "excess_resources": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReservedResource" + } + }, + "subscription": { + "$ref": "#/components/schemas/Subscription" + } + } + }, + "ClusterMetricsNodes": { + "properties": { + "compute": { + "type": "number", + "format": "float" + }, + "infra": { + "type": "number", + "format": "float" + }, + "master": { + "type": "number", + "format": "float" + }, + "total": { + "type": "number", + "format": "float" + } + } + }, + "ClusterRegistrationRequest": { + "properties": { + "authorization_token": { + "type": "string" + }, + "cluster_id": { + "type": "string" + } + } + }, + "ClusterRegistrationResponse": { + "properties": { + "account_id": { + "type": "string" + }, + "authorization_token": { + "type": "string" + }, + "cluster_id": { + "type": "string" + }, + "expires_at": { + "description": "Cluster registration expiration.", + "type": "string" + } + } + }, + "ClusterResource": { + "properties": { + "total": { + "$ref": "#/components/schemas/ValueUnit" + }, + "updated_timestamp": { + "type": "string", + "format": "date-time" + }, + "used": { + "$ref": "#/components/schemas/ValueUnit" + } + } + }, + "ClusterUpgrade": { + "properties": { + "available": { + "type": "boolean" + }, + "state": { + "type": "string" + }, + "updated_timestamp": { + "type": "string", + "format": "date-time" + }, + "version": { + "type": "string" + } + } + }, + "Contract": { + "properties": { + "dimensions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ContractDimension" + } + }, + "end_date": { + "type": "string", + "format": "date-time" + }, + "start_date": { + "type": "string", + "format": "date-time" + } + } + }, + "ContractDimension": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "DefaultCapability": { + "properties": { + "name": { + "description": "Name of the default capability (the key).", + "type": "string" + }, + "value": { + "description": "Value of the default capability.", + "type": "string" + } + } + }, + "DeletedSubscription": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'DeletedSubscription' if this is a complete object or 'DeletedSubscriptionLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "billing_expiration_date": { + "type": "string", + "format": "date-time" + }, + "billing_marketplace_account": { + "type": "string" + }, + "cloud_account_id": { + "type": "string" + }, + "cloud_provider_id": { + "type": "string" + }, + "cluster_id": { + "type": "string" + }, + "cluster_billing_model": { + "$ref": "#/components/schemas/BillingModel" + }, + "console_url": { + "type": "string" + }, + "consumer_uuid": { + "type": "string" + }, + "cpu_total": { + "type": "integer", + "format": "int32" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "creator_id": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "external_cluster_id": { + "type": "string" + }, + "last_reconcile_date": { + "type": "string", + "format": "date-time" + }, + "last_released_at": { + "type": "string", + "format": "date-time" + }, + "last_telemetry_date": { + "type": "string", + "format": "date-time" + }, + "managed": { + "type": "boolean" + }, + "metrics": { + "type": "string" + }, + "organization_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "product_bundle": { + "type": "string" + }, + "provenance": { + "type": "string" + }, + "query_timestamp": { + "type": "string", + "format": "date-time" + }, + "region_id": { + "type": "string" + }, + "released": { + "type": "boolean" + }, + "service_level": { + "type": "string" + }, + "socket_total": { + "type": "integer", + "format": "int32" + }, + "status": { + "type": "string" + }, + "support_level": { + "type": "string" + }, + "system_units": { + "type": "string" + }, + "trial_end_date": { + "type": "string", + "format": "date-time" + }, + "usage": { + "type": "string" + } + } + }, + "FeatureToggle": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'FeatureToggle' if this is a complete object or 'FeatureToggleLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "enabled": { + "type": "boolean" + } + } + }, + "FeatureToggleQueryRequest": { + "properties": { + "organization_id": { + "type": "string" + } + } + }, + "GenericNotifyDetailsResponse": { + "description": "class that defines notify details response in general.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'GenericNotifyDetailsResponse' if this is a complete object or 'GenericNotifyDetailsResponseLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "associates": { + "description": "Retrieved List of associates email address.", + "type": "array", + "items": { + "type": "string" + } + }, + "items": { + "description": "Retrieved list of additional notify details parameters key-value.", + "type": "array", + "items": { + "$ref": "#/components/schemas/NotificationDetailsResponse" + } + }, + "recipients": { + "description": "Retrieved List of recipients username.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "Label": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Label' if this is a complete object or 'LabelLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "account_id": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "internal": { + "type": "boolean" + }, + "key": { + "type": "string" + }, + "managed_by": { + "type": "string" + }, + "organization_id": { + "type": "string" + }, + "subscription_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "value": { + "type": "string" + } + } + }, + "NotificationDetailsRequest": { + "description": "This struct is a request to get a templated email to a user related to this.\nsubscription/cluster.", + "properties": { + "bcc_address": { + "description": "The BCC address to be included on the email that is sent.", + "type": "string" + }, + "cluster_id": { + "description": "Indicates which Cluster (internal id) the resource type belongs to.", + "type": "string" + }, + "cluster_uuid": { + "description": "Indicates which Cluster (external id) the resource type belongs to.", + "type": "string" + }, + "include_red_hat_associates": { + "description": "Indicates whether to include red hat associates in the email notification.", + "type": "boolean" + }, + "internal_only": { + "description": "Indicates whether the service log is internal only to RH.", + "type": "boolean" + }, + "subject": { + "description": "The email subject.", + "type": "string" + }, + "subscription_id": { + "description": "Indicates which Subscription the resource type belongs to.", + "type": "string" + } + } + }, + "NotificationDetailsResponse": { + "description": "This class is a single response item for the notify details list.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'NotificationDetailsResponse' if this is a complete object or 'NotificationDetailsResponseLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "key": { + "description": "Indicates the key of the response parameter.", + "type": "string" + }, + "value": { + "description": "Indicates the value of the response parameter.", + "type": "string" + } + } + }, + "Organization": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Organization' if this is a complete object or 'OrganizationLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "capabilities": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Capability" + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "ebs_account_id": { + "type": "string" + }, + "external_id": { + "type": "string" + }, + "labels": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "name": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "Permission": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Permission' if this is a complete object or 'PermissionLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "action": { + "$ref": "#/components/schemas/Action" + }, + "resource": { + "type": "string" + } + } + }, + "Plan": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Plan' if this is a complete object or 'PlanLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "category": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "PlanID": { + "description": "Plan ID of subscription.", + "type": "string", + "enum": [ + "ocp" + ] + }, + "PullSecretsRequest": { + "properties": { + "external_resource_id": { + "type": "string" + } + } + }, + "QuotaAuthorizationRequest": { + "properties": { + "account_username": { + "type": "string" + }, + "availability_zone": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "product_id": { + "type": "string" + }, + "product_category": { + "type": "string" + }, + "quota_version": { + "type": "string" + }, + "reserve": { + "type": "boolean" + }, + "resources": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReservedResource" + } + } + } + }, + "QuotaAuthorizationResponse": { + "properties": { + "allowed": { + "type": "boolean" + }, + "excess_resources": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReservedResource" + } + }, + "subscription": { + "$ref": "#/components/schemas/Subscription" + } + } + }, + "QuotaCost": { + "properties": { + "allowed": { + "type": "integer", + "format": "int32" + }, + "cloud_accounts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudAccount" + } + }, + "consumed": { + "type": "integer", + "format": "int32" + }, + "organization_id": { + "type": "string" + }, + "quota_id": { + "type": "string" + }, + "related_resources": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelatedResource" + } + }, + "version": { + "type": "string" + } + } + }, + "QuotaRules": { + "properties": { + "availability_zone": { + "type": "string" + }, + "billing_model": { + "type": "string" + }, + "byoc": { + "type": "string" + }, + "cloud": { + "type": "string" + }, + "cost": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "product": { + "type": "string" + }, + "quota_id": { + "type": "string" + } + } + }, + "Registry": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Registry' if this is a complete object or 'RegistryLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "url": { + "type": "string" + }, + "cloud_alias": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "name": { + "type": "string" + }, + "org_name": { + "type": "string" + }, + "team_name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "RegistryCredential": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'RegistryCredential' if this is a complete object or 'RegistryCredentialLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "account": { + "$ref": "#/components/schemas/Account" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "external_resource_id": { + "type": "string" + }, + "registry": { + "$ref": "#/components/schemas/Registry" + }, + "token": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "username": { + "type": "string" + } + } + }, + "RelatedResource": { + "description": "Resource which can be provisioned using the allowed quota.", + "properties": { + "byoc": { + "type": "string" + }, + "availability_zone_type": { + "type": "string" + }, + "billing_model": { + "type": "string" + }, + "cloud_provider": { + "type": "string" + }, + "cost": { + "type": "integer", + "format": "int32" + }, + "product": { + "type": "string" + }, + "resource_name": { + "type": "string" + }, + "resource_type": { + "type": "string" + } + } + }, + "ReservedResource": { + "properties": { + "byoc": { + "type": "boolean" + }, + "availability_zone_type": { + "type": "string" + }, + "billing_marketplace_account": { + "type": "string" + }, + "billing_model": { + "$ref": "#/components/schemas/BillingModel" + }, + "count": { + "type": "integer", + "format": "int32" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "resource_name": { + "type": "string" + }, + "resource_type": { + "type": "string" + }, + "scope": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "Resource": { + "description": "Identifies computing resources", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Resource' if this is a complete object or 'ResourceLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "byoc": { + "type": "boolean" + }, + "sku": { + "type": "string" + }, + "allowed": { + "description": "Number of allowed nodes", + "type": "integer", + "format": "int32" + }, + "availability_zone_type": { + "type": "string" + }, + "resource_name": { + "description": "platform-specific name, such as \"M5.2Xlarge\" for a type of EC2 node", + "type": "string" + }, + "resource_type": { + "type": "string" + } + } + }, + "ResourceQuota": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ResourceQuota' if this is a complete object or 'ResourceQuotaLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "sku": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "organization_id": { + "type": "string" + }, + "sku_count": { + "type": "integer", + "format": "int32" + }, + "type": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "Role": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Role' if this is a complete object or 'RoleLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "name": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Permission" + } + } + } + }, + "RoleBinding": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'RoleBinding' if this is a complete object or 'RoleBindingLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "account": { + "$ref": "#/components/schemas/Account" + }, + "account_id": { + "type": "string" + }, + "config_managed": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "managed_by": { + "type": "string" + }, + "organization": { + "$ref": "#/components/schemas/Organization" + }, + "organization_id": { + "type": "string" + }, + "role": { + "$ref": "#/components/schemas/Role" + }, + "role_id": { + "type": "string" + }, + "subscription": { + "$ref": "#/components/schemas/Subscription" + }, + "subscription_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "SkuRule": { + "description": "Identifies sku rule", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'SkuRule' if this is a complete object or 'SkuRuleLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "allowed": { + "description": "Specifies the allowed parameter for calculation", + "type": "integer", + "format": "int32" + }, + "quota_id": { + "description": "Specifies the quota id", + "type": "string" + }, + "sku": { + "description": "Specifies the sku, such as \"\"MW00504\"\"", + "type": "string" + } + } + }, + "Subscription": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Subscription' if this is a complete object or 'SubscriptionLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "billing_marketplace_account": { + "type": "string" + }, + "capabilities": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Capability" + } + }, + "cloud_account_id": { + "type": "string" + }, + "cloud_provider_id": { + "type": "string" + }, + "cluster_id": { + "type": "string" + }, + "cluster_billing_model": { + "$ref": "#/components/schemas/BillingModel" + }, + "console_url": { + "type": "string" + }, + "consumer_uuid": { + "type": "string" + }, + "cpu_total": { + "type": "integer", + "format": "int32" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "creator": { + "description": "Link to the account that created the subscription.", + "$ref": "#/components/schemas/Account" + }, + "display_name": { + "type": "string" + }, + "external_cluster_id": { + "type": "string" + }, + "labels": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "last_reconcile_date": { + "description": "Last time this subscription were reconciled about cluster usage.", + "type": "string", + "format": "date-time" + }, + "last_released_at": { + "description": "Last time status was set to Released for this cluster/subscription.", + "type": "string", + "format": "date-time" + }, + "last_telemetry_date": { + "description": "Last telemetry authorization request for this cluster/subscription in Unix time", + "type": "string", + "format": "date-time" + }, + "managed": { + "type": "boolean" + }, + "metrics": { + "description": "Metrics array. One or zero elements will present.", + "type": "array", + "items": { + "$ref": "#/components/schemas/SubscriptionMetrics" + } + }, + "notification_contacts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Account" + } + }, + "organization_id": { + "type": "string" + }, + "plan": { + "$ref": "#/components/schemas/Plan" + }, + "product_bundle": { + "type": "string" + }, + "provenance": { + "description": "The origin of cluster registration (values are defined in AMS at pkg/api/subscription_types.go).", + "type": "string" + }, + "region_id": { + "type": "string" + }, + "released": { + "description": "Flag used to denote whether or not the owner of the cluster has released the ownership and ready to be transferred to a different user.", + "type": "boolean" + }, + "service_level": { + "type": "string" + }, + "socket_total": { + "type": "integer", + "format": "int32" + }, + "status": { + "type": "string" + }, + "support_level": { + "type": "string" + }, + "system_units": { + "type": "string" + }, + "trial_end_date": { + "description": "If the subscription is a trial, date the trial ends.", + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "usage": { + "type": "string" + } + } + }, + "SubscriptionMetrics": { + "description": "Each field is a metric fetched for a specific Subscription's cluster.", + "properties": { + "cloud_provider": { + "type": "string" + }, + "compute_nodes_cpu": { + "$ref": "#/components/schemas/ClusterResource" + }, + "compute_nodes_memory": { + "$ref": "#/components/schemas/ClusterResource" + }, + "compute_nodes_sockets": { + "$ref": "#/components/schemas/ClusterResource" + }, + "console_url": { + "type": "string" + }, + "cpu": { + "$ref": "#/components/schemas/ClusterResource" + }, + "critical_alerts_firing": { + "type": "number", + "format": "float" + }, + "health_state": { + "type": "string" + }, + "memory": { + "$ref": "#/components/schemas/ClusterResource" + }, + "nodes": { + "$ref": "#/components/schemas/ClusterMetricsNodes" + }, + "openshift_version": { + "type": "string" + }, + "operating_system": { + "type": "string" + }, + "operators_condition_failing": { + "type": "number", + "format": "float" + }, + "region": { + "type": "string" + }, + "sockets": { + "$ref": "#/components/schemas/ClusterResource" + }, + "state": { + "type": "string" + }, + "state_description": { + "type": "string" + }, + "storage": { + "$ref": "#/components/schemas/ClusterResource" + }, + "subscription_cpu_total": { + "type": "number", + "format": "float" + }, + "subscription_obligation_exists": { + "type": "number", + "format": "float" + }, + "subscription_socket_total": { + "type": "number", + "format": "float" + }, + "upgrade": { + "$ref": "#/components/schemas/ClusterUpgrade" + } + } + }, + "SubscriptionRegistration": { + "description": "Registration of a new subscription.", + "properties": { + "cluster_uuid": { + "description": "External cluster ID.", + "type": "string" + }, + "console_url": { + "description": "Console URL of subscription (optional).", + "type": "string" + }, + "display_name": { + "description": "Display name of subscription (optional).", + "type": "string" + }, + "plan_id": { + "description": "Plan ID of subscription.", + "$ref": "#/components/schemas/PlanID" + }, + "status": { + "description": "Status of subscription.", + "type": "string" + } + } + }, + "SummaryDashboard": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'SummaryDashboard' if this is a complete object or 'SummaryDashboardLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "metrics": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SummaryMetrics" + } + } + } + }, + "SummaryMetrics": { + "properties": { + "name": { + "type": "string" + }, + "vector": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SummarySample" + } + } + } + }, + "SummarySample": { + "properties": { + "time": { + "type": "string" + }, + "value": { + "type": "number", + "format": "float" + } + } + }, + "SupportCaseRequest": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'SupportCaseRequest' if this is a complete object or 'SupportCaseRequestLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "cluster_id": { + "description": "(optional) cluster id of the cluster on which we create the support case for.", + "type": "string" + }, + "cluster_uuid": { + "description": "(optional) cluster uuid of the cluster on which we create the support case for.", + "type": "string" + }, + "description": { + "description": "Support case desciption.", + "type": "string" + }, + "event_stream_id": { + "description": "(optional) event stream id for the support case so we could track it.", + "type": "string" + }, + "severity": { + "description": "Support case severity.", + "type": "string" + }, + "subscription_id": { + "description": "(optional) subscription id of the subscription on which we create the support case for.", + "type": "string" + }, + "summary": { + "description": "Support case title.", + "type": "string" + } + } + }, + "SupportCaseResponse": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'SupportCaseResponse' if this is a complete object or 'SupportCaseResponseLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "uri": { + "description": "Support case uri.", + "type": "string" + }, + "case_number": { + "description": "Support case number.", + "type": "string" + }, + "cluster_id": { + "description": "(optional) cluster id of the cluster on which we created the support case for.", + "type": "string" + }, + "cluster_uuid": { + "description": "(optional) cluster uuid of the cluster on which we created the support case for.", + "type": "string" + }, + "description": { + "description": "Support case desciption.", + "type": "string" + }, + "severity": { + "description": "Support case severity.", + "type": "string" + }, + "status": { + "description": "Support case status.", + "type": "string" + }, + "subscription_id": { + "description": "(optional) subscription id of the subscription on which we created the support case for.", + "type": "string" + }, + "summary": { + "description": "Support case title.", + "type": "string" + } + } + }, + "TemplateParameter": { + "description": "A template parameter is used in an email to replace placeholder content with\nvalues specific to the email recipient.", + "properties": { + "content": { + "description": "The content that will replace the template parameter in the email", + "type": "string" + }, + "name": { + "description": "Name of the value to be replaced", + "type": "string" + } + } + }, + "TokenAuthorizationRequest": { + "properties": { + "authorization_token": { + "description": "The pull secret of a given account", + "type": "string" + } + } + }, + "TokenAuthorizationResponse": { + "properties": { + "account": { + "$ref": "#/components/schemas/Account" + } + } + }, + "ValueUnit": { + "properties": { + "unit": { + "type": "string" + }, + "value": { + "type": "number", + "format": "float" + } + } + }, + "Error": { + "type": "object", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will always be 'Error'", + "type": "string" + }, + "id": { + "description": "Numeric identifier of the error.", + "type": "integer", + "format": "int32" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "description": "Globally unique code of the error, composed of the unique identifier of the API and the numeric identifier of the error. For example, for if the numeric identifier of the error is `93` and the identifier of the API is `clusters_mgmt` then the code will be `CLUSTERS-MGMT-93`.", + "type": "string" + }, + "reason": { + "description": "Human readable description of the error.", + "type": "string" + }, + "details": { + "description": "Extra information about the error.", + "type": "object", + "additionalProperties": true + } + } + } + }, + "securitySchemes": { + "bearer": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "security": [ + { + "bearer": [ + + ] + } + ] +} \ No newline at end of file diff --git a/openapi/addons_mgmt/v1/openapi.json b/openapi/addons_mgmt/v1/openapi.json new file mode 100644 index 00000000..520603ed --- /dev/null +++ b/openapi/addons_mgmt/v1/openapi.json @@ -0,0 +1,2223 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "v1", + "title": "addons_mgmt", + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + }, + "contact": { + "name": "OCM Feedback", + "email": "ocm-feedback@redhat.com" + } + }, + "servers": [ + { + "description": "Production", + "url": "https://api.openshift.com" + }, + { + "description": "Stage", + "url": "https://api.stage.openshift.com" + } + ], + "paths": { + "/api/addons_mgmt/v1": { + "get": { + "description": "Retrieves the version metadata.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Metadata" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/addons_mgmt/v1/addons": { + "post": { + "description": "Create a new addon and add it to the collection of addons.", + "parameters": [ + { + "name": "dryRun", + "description": "DryRun indicates the request body will not be persisted when dryRun=true. ", + "in": "query", + "schema": { + "type": "boolean" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Addon" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Addon" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of addons.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the addon instead of\nthe names of the columns of a table. For example, in order to sort the addons\ndescending by name the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the addon instead of\nthe names of the columns of a table. For example, in order to retrieve all the\naddons with a name starting with `my` the value should be:\n\n```sql\nname like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the addons\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of add-ons.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Addon" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/addons_mgmt/v1/addons/{addon_id}": { + "delete": { + "description": "Deletes the addon.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the addon.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Addon" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the addon.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "dryRun", + "description": "DryRun indicates the request body will not be persisted when dryRun=true. ", + "in": "query", + "schema": { + "type": "boolean" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Addon" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Addon" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/addons_mgmt/v1/addons/{addon_id}/versions": { + "post": { + "description": "Create a new addon version and add it to the collection of addons.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "dryRun", + "description": "DryRun indicates the request body will not be persisted when dryRun=true. ", + "in": "query", + "schema": { + "type": "boolean" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonVersion" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonVersion" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of addon versions.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the addon instead of\nthe names of the columns of a table. For example, in order to sort the addon\nversions descending by id the value should be:\n\n```sql\nid desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the addon version instead\nof the names of the columns of a table. For example, in order to retrieve all the\naddon versions with an id starting with `0.1` the value should be:\n\n```sql\nid like '0.1.%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the addon\nversions that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of addon versions.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonVersion" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/addons_mgmt/v1/addons/{addon_id}/versions/{version_id}": { + "delete": { + "description": "Deletes the addon version.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "version_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the addon version.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "version_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonVersion" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the addon version.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "version_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "dryRun", + "description": "DryRun indicates the request body will not be persisted when dryRun=true. ", + "in": "query", + "schema": { + "type": "boolean" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonVersion" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonVersion" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/addons_mgmt/v1/clusters/{cluster_id}/addon_inquiries": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the add-on instead of\nthe names of the columns of a table. For example, in order to sort the add-ons\ndescending by name the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the add-on instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nadd-ons with a name starting with `my` the value should be:\n\n```sql\nname like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the add-ons\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of add-ons.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Addon" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/addons_mgmt/v1/clusters/{cluster_id}/addon_inquiries/{addon_inquiry_id}": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addon_inquiry_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Addon" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/addons_mgmt/v1/clusters/{cluster_id}/addons": { + "post": { + "description": "Create a new addon status and add it to the collection of addons installation.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonInstallation" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonInstallation" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "delete": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of addon installations for a cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "If the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of addon installations", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonInstallation" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection regardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/addons_mgmt/v1/clusters/{cluster_id}/addons/{addon_id}": { + "delete": { + "description": "Deletes the addon installation.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the addon installation.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonInstallation" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the addon installation.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "dryRun", + "description": "DryRun indicates the request body will not be persisted when dryRun=true. ", + "in": "query", + "schema": { + "type": "boolean" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonInstallation" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonInstallation" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/addons_mgmt/v1/clusters/{cluster_id}/status": { + "post": { + "description": "Create a new addon status and add it to the collection of addons statuses.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonStatus" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonStatus" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of addon statuses for a cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "If the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of addon status conditions", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonStatus" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection regardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/addons_mgmt/v1/clusters/{cluster_id}/status/{addon_id}": { + "delete": { + "description": "Deletes the addon version.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the addon version.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonStatus" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the addon version.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonStatus" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonStatus" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Metadata": { + "description": "Version metadata.", + "properties": { + "server_version": { + "description": "Version of the server.", + "type": "string" + } + } + }, + "AdditionalCatalogSource": { + "description": "Representation of an addon catalog source object used by addon versions.", + "properties": { + "id": { + "description": "ID of the additional catalog source", + "type": "string" + }, + "enabled": { + "description": "Indicates is this additional catalog source is enabled for the addon", + "type": "boolean" + }, + "image": { + "description": "Image of the additional catalog source.", + "type": "string" + }, + "name": { + "description": "Name of the additional catalog source.", + "type": "string" + } + } + }, + "Addon": { + "description": "Representation of an addon that can be installed in a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Addon' if this is a complete object or 'AddonLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "common_annotations": { + "description": "Common Annotations for this addon.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "common_labels": { + "description": "Common Labels for this addon.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "config": { + "description": "Additional configs to be used by the addon once its installed in the cluster.", + "$ref": "#/components/schemas/AddonConfig" + }, + "credentials_requests": { + "description": "List of credentials requests to authenticate operators to access cloud resources.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CredentialRequest" + } + }, + "description": { + "description": "Description of the addon.", + "type": "string" + }, + "docs_link": { + "description": "Link to documentation about the addon.", + "type": "string" + }, + "enabled": { + "description": "Indicates if this addon can be added to clusters.", + "type": "boolean" + }, + "has_external_resources": { + "description": "Indicates if this addon has external resources associated with it", + "type": "boolean" + }, + "hidden": { + "description": "Indicates if this addon is hidden.", + "type": "boolean" + }, + "icon": { + "description": "Base64-encoded icon representing an addon. The icon should be in PNG format.", + "type": "string" + }, + "install_mode": { + "description": "The mode in which the addon is deployed.", + "$ref": "#/components/schemas/AddonInstallMode" + }, + "label": { + "description": "Label used to attach to a cluster deployment when addon is installed.", + "type": "string" + }, + "managed_service": { + "description": "Indicates if addon is part of a managed service", + "type": "boolean" + }, + "name": { + "description": "Name of the addon.", + "type": "string" + }, + "namespaces": { + "description": "List of namespaces associated with this addon.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonNamespace" + } + }, + "operator_name": { + "description": "The name of the operator installed by this addon.", + "type": "string" + }, + "parameters": { + "description": "List of parameters for this addon.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonParameter" + } + }, + "requirements": { + "description": "List of requirements for this addon.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonRequirement" + } + }, + "resource_cost": { + "description": "Used to determine how many units of quota an addon consumes per resource name.", + "type": "number", + "format": "float" + }, + "resource_name": { + "description": "Used to determine from where to reserve quota for this addon.", + "type": "string" + }, + "sub_operators": { + "description": "List of sub operators for this addon.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonSubOperator" + } + }, + "target_namespace": { + "description": "The namespace in which the addon CRD exists.", + "type": "string" + }, + "version": { + "description": "Link to the current default version of this addon.", + "$ref": "#/components/schemas/AddonVersion" + } + } + }, + "AddonConfig": { + "description": "Representation of an addon config.\nThe attributes under it are to be used by the addon once its installed in the cluster.", + "properties": { + "add_on_environment_variables": { + "description": "List of environment variables for the addon", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonEnvironmentVariable" + } + }, + "add_on_secret_propagations": { + "description": "List of secret propagations for the addon", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonSecretPropagation" + } + } + } + }, + "AddonEnvironmentVariable": { + "description": "Representation of an addon env object.", + "properties": { + "id": { + "description": "ID for the environment variable", + "type": "string" + }, + "enabled": { + "description": "Indicates is this environment variable is enabled for the addon", + "type": "boolean" + }, + "name": { + "description": "Name of the environment variable", + "type": "string" + }, + "value": { + "description": "Value of the environment variable", + "type": "string" + } + } + }, + "AddonInstallMode": { + "description": "Representation of an addon InstallMode field.", + "type": "string", + "enum": [ + "all_namespaces", + "own_namespace" + ] + }, + "AddonInstallation": { + "description": "Representation of addon installation", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddonInstallation' if this is a complete object or 'AddonInstallationLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "addon": { + "description": "Addon installed", + "$ref": "#/components/schemas/Addon" + }, + "addon_version": { + "description": "Addon version of the addon", + "$ref": "#/components/schemas/AddonVersion" + }, + "billing": { + "description": "Billing of addon installation.", + "$ref": "#/components/schemas/AddonInstallationBilling" + }, + "creation_timestamp": { + "description": "Date and time when the add-on was initially installed in the cluster.", + "type": "string", + "format": "date-time" + }, + "csv_name": { + "description": "Current CSV installed on cluster", + "type": "string" + }, + "deleted_timestamp": { + "description": "Date and time when the add-on installation deleted at.", + "type": "string", + "format": "date-time" + }, + "desired_version": { + "description": "Version of the next scheduled upgrade", + "type": "string" + }, + "operator_version": { + "description": "Version of the operator installed by the add-on.", + "type": "string" + }, + "parameters": { + "description": "Parameters in the installation", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonInstallationParameter" + } + }, + "state": { + "description": "Addon Installation State", + "$ref": "#/components/schemas/AddonInstallationState" + }, + "state_description": { + "description": "Reason for the current State.", + "type": "string" + }, + "subscription": { + "description": "Subscription for the addon installation", + "$ref": "#/components/schemas/ObjectReference" + }, + "updated_timestamp": { + "description": "Date and time when the add-on installation information was last updated.", + "type": "string", + "format": "date-time" + } + } + }, + "AddonInstallationBilling": { + "description": "Representation of an add-on installation billing.", + "properties": { + "billing_marketplace_account": { + "description": "Account ID for billing market place", + "type": "string" + }, + "billing_model": { + "description": "Billing Model for addon resources", + "$ref": "#/components/schemas/BillingModel" + }, + "href": { + "description": "Self link", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object", + "type": "string" + }, + "kind": { + "description": "Indicates the type of this object", + "type": "string" + } + } + }, + "AddonInstallationParameter": { + "description": "representation of addon installation parameter", + "properties": { + "href": { + "description": "Self link", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object", + "type": "string" + }, + "kind": { + "description": "Indicates the type of this object", + "type": "string" + }, + "value": { + "description": "Value of the parameter", + "type": "string" + } + } + }, + "AddonInstallationParameters": { + "description": "representation of addon installation parameter", + "properties": { + "items": { + "description": "list of addon installation parameters", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonInstallationParameter" + } + } + } + }, + "AddonInstallationState": { + "description": "representation of addon installation state", + "type": "string", + "enum": [ + "delete-failed", + "delete-pending", + "deleted", + "deleting", + "failed", + "installing", + "pending", + "ready", + "undefined", + "upgrading" + ] + }, + "AddonNamespace": { + "description": "Representation of an addon namespace object.", + "properties": { + "annotations": { + "description": "Annotations to be included in the addon namespace", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "enabled": { + "description": "Enabled shows if this namespace object is in use", + "type": "boolean" + }, + "labels": { + "description": "Labels to be included in the addon namespace", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "description": "Name of the namespace", + "type": "string" + } + } + }, + "AddonParameter": { + "description": "Representation of an addon parameter.", + "properties": { + "id": { + "description": "ID for this addon parameter", + "type": "string" + }, + "addon": { + "$ref": "#/components/schemas/Addon" + }, + "conditions": { + "description": "Conditions in which this parameter is valid for", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonRequirement" + } + }, + "default_value": { + "description": "Indicates the value default for the addon parameter.", + "type": "string" + }, + "description": { + "description": "Description of the addon parameter.", + "type": "string" + }, + "editable": { + "description": "Indicates if this parameter can be edited after creation.", + "type": "boolean" + }, + "editable_direction": { + "description": "Restricts if the parameter can be upscaled/downscaled\nExpected values are \"up\", \"down\", or \"\" (no restriction).", + "type": "string" + }, + "enabled": { + "description": "Indicates if this parameter is enabled for the addon.", + "type": "boolean" + }, + "name": { + "description": "Name of the addon parameter.", + "type": "string" + }, + "options": { + "description": "List of options for the addon parameter value.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonParameterOption" + } + }, + "order": { + "description": "Indicates the weight of the AddonParameter which would be used by sort order", + "type": "integer", + "format": "int32" + }, + "required": { + "description": "Indicates if this parameter is required by the addon.", + "type": "boolean" + }, + "validation": { + "description": "Validation rule for the addon parameter.", + "type": "string" + }, + "validation_err_msg": { + "description": "Error message to return should the parameter be invalid.", + "type": "string" + }, + "value_type": { + "description": "Type of value of the addon parameter.", + "$ref": "#/components/schemas/AddonParameterValueType" + } + } + }, + "AddonParameterOption": { + "description": "Representation of an addon parameter option.", + "properties": { + "name": { + "description": "Name of the addon parameter option.", + "type": "string" + }, + "rank": { + "description": "Rank of option to be used in cases where editable direction should be restricted.", + "type": "integer", + "format": "int32" + }, + "requirements": { + "description": "List of addon requirements for this parameter option.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonRequirement" + } + }, + "value": { + "description": "Value of the addon parameter option.", + "type": "string" + } + } + }, + "AddonParameterValueType": { + "description": "Representation of the value type for this specific addon parameter", + "type": "string", + "enum": [ + "cidr", + "boolean", + "number", + "resource", + "resource_requirement", + "string" + ] + }, + "AddonParameters": { + "description": "Representation of AddonParameters", + "properties": { + "items": { + "description": "List of addon parameters", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonParameter" + } + } + } + }, + "AddonRequirement": { + "description": "Representation of an addon requirement.", + "properties": { + "id": { + "description": "ID of the addon requirement.", + "type": "string" + }, + "data": { + "description": "Data for the addon requirement.", + "type": "object", + "additionalProperties": { + "type": "object" + } + }, + "enabled": { + "description": "Indicates if this requirement is enabled for the addon.", + "type": "boolean" + }, + "resource": { + "description": "Type of resource of the addon requirement.", + "$ref": "#/components/schemas/AddonRequirementResource" + }, + "status": { + "description": "Optional cluster specific status for the addon.", + "$ref": "#/components/schemas/AddonRequirementStatus" + } + } + }, + "AddonRequirementResource": { + "description": "Addon requirement resource type", + "type": "string", + "enum": [ + "addon", + "cluster", + "machine_pool" + ] + }, + "AddonRequirementStatus": { + "description": "Representation of an addon requirement status.", + "properties": { + "error_msgs": { + "description": "Error messages detailing reasons for unfulfilled requirements.", + "type": "array", + "items": { + "type": "string" + } + }, + "fulfilled": { + "description": "Indicates if this requirement is fulfilled.", + "type": "boolean" + } + } + }, + "AddonSecretPropagation": { + "description": "Representation of an addon secret propagation", + "properties": { + "id": { + "description": "ID of the secret propagation", + "type": "string" + }, + "destination_secret": { + "description": "DestinationSecret is location of the secret to be added", + "type": "string" + }, + "enabled": { + "description": "Indicates is this secret propagation is enabled for the addon", + "type": "boolean" + }, + "source_secret": { + "description": "SourceSecret is location of the source secret", + "type": "string" + } + } + }, + "AddonStatus": { + "description": "Representation of an addon status.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddonStatus' if this is a complete object or 'AddonStatusLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "addon_id": { + "description": "ID of the addon whose status belongs to.", + "type": "string" + }, + "correlation_id": { + "description": "Identifier for co-relating current AddonCR revision and reported status.", + "type": "string" + }, + "status_conditions": { + "description": "List of reported addon status conditions", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonStatusCondition" + } + }, + "version": { + "description": "Version of the addon reporting the status", + "type": "string" + } + } + }, + "AddonStatusCondition": { + "description": "Representation of an addon status condition type.", + "properties": { + "message": { + "description": "Message for the condition", + "type": "string" + }, + "reason": { + "description": "Reason for the condition", + "type": "string" + }, + "status_type": { + "description": "Type of the reported addon status condition", + "$ref": "#/components/schemas/AddonStatusConditionType" + }, + "status_value": { + "description": "Value of the reported addon status condition", + "$ref": "#/components/schemas/AddonStatusConditionValue" + } + } + }, + "AddonStatusConditionType": { + "description": "Representation of an addon status condition type field.", + "type": "string", + "enum": [ + "Available", + "Degraded", + "DeleteTimeout", + "Healthy", + "Installed", + "Paused", + "ReadyToBeDeleted", + "UpgradeStarted", + "UpgradeSucceeded" + ] + }, + "AddonStatusConditionValue": { + "description": "Representation of an addon status condition value field.", + "type": "string", + "enum": [ + "False", + "True", + "Unknown" + ] + }, + "AddonSubOperator": { + "description": "Representation of an addon sub operator. A sub operator is an operator\nwho's life cycle is controlled by the addon umbrella operator.", + "properties": { + "addon": { + "$ref": "#/components/schemas/Addon" + }, + "enabled": { + "description": "Indicates if the sub operator is enabled for the addon", + "type": "boolean" + }, + "operator_name": { + "description": "Name of the addon sub operator", + "type": "string" + }, + "operator_namespace": { + "description": "Namespace of the addon sub operator", + "type": "string" + } + } + }, + "AddonVersion": { + "description": "Representation of an addon version.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddonVersion' if this is a complete object or 'AddonVersionLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "additional_catalog_sources": { + "description": "Additional catalog sources associated with this addon version", + "type": "array", + "items": { + "$ref": "#/components/schemas/AdditionalCatalogSource" + } + }, + "available_upgrades": { + "description": "AvailableUpgrades is the list of versions this version can be upgraded to.", + "type": "array", + "items": { + "type": "string" + } + }, + "channel": { + "description": "The specific addon catalog source channel of packages", + "type": "string" + }, + "config": { + "description": "Additional configs to be used by the addon once its installed in the cluster.", + "$ref": "#/components/schemas/AddonConfig" + }, + "enabled": { + "description": "Indicates if this addon version can be added to clusters.", + "type": "boolean" + }, + "metrics_federation": { + "description": "Configuration parameters to be injected in the ServiceMonitor used for federation.", + "$ref": "#/components/schemas/MetricsFederation" + }, + "monitoring_stack": { + "description": "Configuration parameters which will determine the underlying configuration of the MonitoringStack CR. ", + "$ref": "#/components/schemas/MonitoringStack" + }, + "package_image": { + "description": "The url for the package image", + "type": "string" + }, + "parameters": { + "description": "List of parameters for this addon version.", + "$ref": "#/components/schemas/AddonParameters" + }, + "pull_secret_name": { + "description": "The pull secret name used for this addon version.", + "type": "string" + }, + "requirements": { + "description": "List of requirements for this addon version.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonRequirement" + } + }, + "source_image": { + "description": "The catalog source image for this addon version.", + "type": "string" + }, + "sub_operators": { + "description": "List of sub operators for this addon version.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonSubOperator" + } + }, + "upgrade_plans_created": { + "description": "Indicates if upgrade plans have been created for this addon version", + "type": "boolean" + } + } + }, + "BillingModel": { + "description": "Representation of an billing model field.", + "type": "string", + "enum": [ + "marketplace", + "marketplace-aws", + "marketplace-azure", + "marketplace-rhm", + "standard" + ] + }, + "CredentialRequest": { + "description": "Contains the necessary attributes to allow each operator to access the necessary AWS resources", + "properties": { + "name": { + "description": "Name of the credentials secret used to access cloud resources", + "type": "string" + }, + "namespace": { + "description": "Namespace where the credentials secret lives in the cluster", + "type": "string" + }, + "policy_permissions": { + "description": "List of policy permissions needed to access cloud resources", + "type": "array", + "items": { + "type": "string" + } + }, + "service_account": { + "description": "Service account name to use when authenticating", + "type": "string" + } + } + }, + "MetricsFederation": { + "description": "Representation of Metrics Federation", + "properties": { + "match_labels": { + "description": "List of labels used to discover the prometheus server(s) to be federated.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "match_names": { + "description": "List of series names to federate from the prometheus server.", + "type": "array", + "items": { + "type": "string" + } + }, + "namespace": { + "description": "Namespace where the prometheus server is running.", + "type": "string" + }, + "port_name": { + "description": "Indicates the name of the service port fronting the prometheus server.", + "type": "string" + } + } + }, + "MonitoringStack": { + "description": "Representation of Monitoring Stack", + "properties": { + "enabled": { + "description": "Indicates if the monitoring stack can be added to clusters for the addon.", + "type": "boolean" + }, + "resources": { + "description": "Indicates the resources for the monitoring stack", + "$ref": "#/components/schemas/MonitoringStackResources" + } + } + }, + "MonitoringStackResource": { + "description": "Representation of Monitoring Stack Resource", + "properties": { + "cpu": { + "description": "Indicates the CPU resource for monitoring stack.", + "type": "string" + }, + "memory": { + "description": "Indicates the memory resource for monitoring stack.", + "type": "string" + } + } + }, + "MonitoringStackResources": { + "description": "Representation of Monitoring Stack Resources", + "properties": { + "limits": { + "description": "Indicates the limit of resource for monitoring stack.", + "$ref": "#/components/schemas/MonitoringStackResource" + }, + "requests": { + "description": "Indicates the requested amount of resource for monitoring stack.", + "$ref": "#/components/schemas/MonitoringStackResource" + } + } + }, + "ObjectReference": { + "description": "representation of object reference/subscription", + "properties": { + "href": { + "description": "Self Link", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "kind": { + "description": "Indicates the type of this object.", + "type": "string" + } + } + }, + "Error": { + "type": "object", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will always be 'Error'", + "type": "string" + }, + "id": { + "description": "Numeric identifier of the error.", + "type": "integer", + "format": "int32" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "description": "Globally unique code of the error, composed of the unique identifier of the API and the numeric identifier of the error. For example, for if the numeric identifier of the error is `93` and the identifier of the API is `clusters_mgmt` then the code will be `CLUSTERS-MGMT-93`.", + "type": "string" + }, + "reason": { + "description": "Human readable description of the error.", + "type": "string" + }, + "details": { + "description": "Extra information about the error.", + "type": "object", + "additionalProperties": true + } + } + } + }, + "securitySchemes": { + "bearer": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "security": [ + { + "bearer": [ + + ] + } + ] +} \ No newline at end of file diff --git a/openapi/aro_hcp/v1alpha1/openapi.json b/openapi/aro_hcp/v1alpha1/openapi.json new file mode 100644 index 00000000..8a5aa00b --- /dev/null +++ b/openapi/aro_hcp/v1alpha1/openapi.json @@ -0,0 +1,3133 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "v1alpha1", + "title": "aro_hcp", + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + }, + "contact": { + "name": "OCM Feedback", + "email": "ocm-feedback@redhat.com" + } + }, + "servers": [ + { + "description": "Production", + "url": "https://api.openshift.com" + }, + { + "description": "Stage", + "url": "https://api.stage.openshift.com" + } + ], + "paths": { + "/api/aro_hcp/v1alpha1": { + "get": { + "description": "Retrieves the version metadata.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Metadata" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/aro_hcp/v1alpha1/clusters": { + "post": { + "description": "Provision a new cluster and add it to the collection of clusters.\n\nSee the `register_cluster` method for adding an existing cluster.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Cluster" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Cluster" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of clusters.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the cluster instead of\nthe names of the columns of a table. For example, in order to sort the clusters\ndescending by region identifier the value should be:\n\n```sql\nregion.id desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the cluster instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nclusters with a name starting with `my` in the `us-east-1` region the value\nshould be:\n\n```sql\nname like 'my%' and region.id = 'us-east-1'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nclusters that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of clusters.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Cluster" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/aro_hcp/v1alpha1/clusters/{cluster_id}": { + "delete": { + "description": "Deletes the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "best_effort", + "description": "BestEffort flag is used to check if the cluster deletion should be best-effort mode or not.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "dry_run", + "description": "Dry run flag is used to check if the operation can be completed, but won't delete.", + "in": "query", + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Cluster" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Cluster" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Cluster" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/aro_hcp/v1alpha1/clusters/{cluster_id}/inflight_checks": { + "get": { + "description": "Retrieves the list of inflight checks.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of inflight checks.", + "type": "array", + "items": { + "$ref": "#/components/schemas/InflightCheck" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/aro_hcp/v1alpha1/clusters/{cluster_id}/inflight_checks/{inflight_check_id}": { + "get": { + "description": "Retrieves the details of the inflight check.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "inflight_check_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InflightCheck" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/aro_hcp/v1alpha1/clusters/{cluster_id}/node_pools": { + "post": { + "description": "Adds a new node pool to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePool" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePool" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of node pools.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the node pools instead of\nthe names of the columns of a table. For example, in order to sort the node pools\ndescending by identifier the value should be:\n\n```sql\nid desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the node pools instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nnode pools with replicas of two the following is required:\n\n```sql\nreplicas = 2\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nnode pools that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of node pools.", + "type": "array", + "items": { + "$ref": "#/components/schemas/NodePool" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/aro_hcp/v1alpha1/clusters/{cluster_id}/node_pools/{node_pool_id}": { + "delete": { + "description": "Deletes the node pool.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "202": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the node pool.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePool" + } + } + } + }, + "responses": { + "202": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePool" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the node pool.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePool" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/aro_hcp/v1alpha1/clusters/{cluster_id}/node_pools/{node_pool_id}/status": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePoolStatus" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/aro_hcp/v1alpha1/clusters/{cluster_id}/status": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterStatus" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Metadata": { + "description": "Version metadata.", + "properties": { + "server_version": { + "description": "Version of the server.", + "type": "string" + } + } + }, + "AMIOverride": { + "description": "AMIOverride specifies what Amazon Machine Image should be used for a particular product and region.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AMIOverride' if this is a complete object or 'AMIOverrideLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "ami": { + "description": "AMI is the id of the Amazon Machine Image.", + "type": "string" + }, + "product": { + "description": "Link to the product type.", + "$ref": "#/components/schemas/Product" + }, + "region": { + "description": "Link to the cloud provider region.", + "$ref": "#/components/schemas/CloudRegion" + } + } + }, + "AWS": { + "description": "_Amazon Web Services_ specific settings of a cluster.", + "properties": { + "kms_key_arn": { + "description": "Customer Managed Key to encrypt EBS Volume", + "type": "string" + }, + "sts": { + "description": "Contains the necessary attributes to support role-based authentication on AWS.", + "$ref": "#/components/schemas/STS" + }, + "access_key_id": { + "description": "AWS access key identifier.", + "type": "string" + }, + "account_id": { + "description": "AWS account identifier.", + "type": "string" + }, + "additional_allowed_principals": { + "description": "Additional allowed principal ARNs to be added to the hosted control plane's VPC Endpoint Service.", + "type": "array", + "items": { + "type": "string" + } + }, + "additional_compute_security_group_ids": { + "description": "Additional AWS Security Groups to be added to default worker (compute) machine pool.", + "type": "array", + "items": { + "type": "string" + } + }, + "additional_control_plane_security_group_ids": { + "description": "Additional AWS Security Groups to be added to default control plane machine pool.", + "type": "array", + "items": { + "type": "string" + } + }, + "additional_infra_security_group_ids": { + "description": "Additional AWS Security Groups to be added to default infra machine pool.", + "type": "array", + "items": { + "type": "string" + } + }, + "audit_log": { + "description": "Audit log forwarding configuration", + "$ref": "#/components/schemas/AuditLog" + }, + "billing_account_id": { + "description": "BillingAccountID is the account used for billing subscriptions purchased via the marketplace", + "type": "string" + }, + "ec2_metadata_http_tokens": { + "description": "Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances", + "$ref": "#/components/schemas/Ec2MetadataHttpTokens" + }, + "etcd_encryption": { + "description": "Related etcd encryption configuration", + "$ref": "#/components/schemas/AwsEtcdEncryption" + }, + "hcp_internal_communication_hosted_zone_id": { + "description": "ID of local private hosted zone for hypershift internal communication.", + "type": "string" + }, + "private_hosted_zone_id": { + "description": "ID of private hosted zone.", + "type": "string" + }, + "private_hosted_zone_role_arn": { + "description": "Role ARN for private hosted zone.", + "type": "string" + }, + "private_link": { + "description": "Sets cluster to be inaccessible externally.", + "type": "boolean" + }, + "private_link_configuration": { + "description": "Manages additional configuration for Private Links.", + "$ref": "#/components/schemas/PrivateLinkClusterConfiguration" + }, + "secret_access_key": { + "description": "AWS secret access key.", + "type": "string" + }, + "subnet_ids": { + "description": "The subnet ids to be used when installing the cluster.", + "type": "array", + "items": { + "type": "string" + } + }, + "tags": { + "description": "Optional keys and values that the installer will add as tags to all AWS resources it creates", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "vpc_endpoint_role_arn": { + "description": "Role ARN for VPC Endpoint Service cross account role.", + "type": "string" + } + } + }, + "AWSNodePool": { + "description": "Representation of aws node pool specific parameters.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AWSNodePool' if this is a complete object or 'AWSNodePoolLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "additional_security_group_ids": { + "description": "Additional AWS Security Groups to be added node pool.", + "type": "array", + "items": { + "type": "string" + } + }, + "availability_zone_types": { + "description": "Associates nodepool availability zones with zone types (e.g. wavelength, local).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "ec2_metadata_http_tokens": { + "description": "Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances", + "$ref": "#/components/schemas/Ec2MetadataHttpTokens" + }, + "instance_profile": { + "description": "InstanceProfile is the AWS EC2 instance profile, which is a container for an IAM role that the EC2 instance uses.", + "type": "string" + }, + "instance_type": { + "description": "InstanceType is an ec2 instance type for node instances (e.g. m5.large).", + "type": "string" + }, + "root_volume": { + "description": "AWS Volume specification to be used to set custom worker disk size", + "$ref": "#/components/schemas/AWSVolume" + }, + "subnet_outposts": { + "description": "Associates nodepool subnets with AWS Outposts.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "tags": { + "description": "Optional keys and values that the installer will add as tags to all AWS resources it creates.\n\nAWS tags must conform to the following standards:\n- Each resource may have a maximum of 25 tags\n- Tags beginning with \"aws:\" are reserved for system use and may not be set\n- Tag keys may be between 1 and 128 characters in length\n- Tag values may be between 0 and 256 characters in length\n- Tags may only contain letters, numbers, spaces, and the following characters: [_ . : / = + - @]", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "AWSShard": { + "description": "Config for AWS provision shards", + "properties": { + "ecr_repository_urls": { + "description": "ECR repository URLs of the provision shard", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "AWSVolume": { + "description": "Holds settings for an AWS storage volume.", + "properties": { + "iops": { + "description": "Volume provisioned IOPS.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Volume size in Gib.", + "type": "integer", + "format": "int32" + } + } + }, + "CCS": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'CCS' if this is a complete object or 'CCSLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "disable_scp_checks": { + "description": "Indicates if cloud permissions checks are disabled,\nwhen attempting installation of the cluster.", + "type": "boolean" + }, + "enabled": { + "description": "Indicates if Customer Cloud Subscription is enabled on the cluster.", + "type": "boolean" + } + } + }, + "DNS": { + "description": "DNS settings of the cluster.", + "properties": { + "base_domain": { + "description": "Base DNS domain of the cluster.\n\nDuring the installation of the cluster it is necessary to create multiple DNS records.\nThey will be created as sub-domains of this domain. For example, if the domain_prefix of the\ncluster is `mycluster` and the base domain is `example.com` then the following DNS\nrecords will be created:\n\n```\nmycluster-api.example.com\nmycluster-etcd-0.example.com\nmycluster-etcd-1.example.com\nmycluster-etcd-3.example.com\n```\n\nThe exact number, type and names of the created DNS record depends on the characteristics\nof the cluster, and may be different for different versions of _OpenShift_. Please don't\nrely on them. For example, to find what is the URL of the Kubernetes API server of the\ncluster don't assume that it will be `mycluster-api.example.com`. Instead of that use\nthis API to retrieve the description of the cluster, and get it from the `api.url`\nattribute. For example, if the identifier of the cluster is `123` send a request like\nthis:\n\n```http\nGET /api/clusters_mgmt/v1/clusters/123 HTTP/1.1\n```\n\nThat will return a response like this, including the `api.url` attribute:\n\n```json\n{\n \"kind\": \"Cluster\",\n \"id\": \"123\",\n \"href\": \"/api/clusters_mgmt/v1/clusters/123\",\n \"api\": {\n \"url\": \"https://mycluster-api.example.com:6443\"\n },\n ...\n}\n```\n\nWhen the cluster is created in Amazon Web Services it is necessary to create this base\nDNS domain in advance, using AWS Route53 (https://console.aws.amazon.com/route53).", + "type": "string" + } + } + }, + "GCP": { + "description": "Google cloud platform settings of a cluster.", + "properties": { + "auth_uri": { + "description": "GCP authentication uri", + "type": "string" + }, + "auth_provider_x509_cert_url": { + "description": "GCP Authentication provider x509 certificate url", + "type": "string" + }, + "authentication": { + "description": "GCP Authentication Method", + "$ref": "#/components/schemas/GcpAuthentication" + }, + "client_id": { + "description": "GCP client identifier", + "type": "string" + }, + "client_x509_cert_url": { + "description": "GCP client x509 certificate url", + "type": "string" + }, + "client_email": { + "description": "GCP client email", + "type": "string" + }, + "private_key": { + "description": "GCP private key", + "type": "string" + }, + "private_key_id": { + "description": "GCP private key identifier", + "type": "string" + }, + "private_service_connect": { + "description": "GCP PrivateServiceConnect configuration", + "$ref": "#/components/schemas/GcpPrivateServiceConnect" + }, + "project_id": { + "description": "GCP project identifier.", + "type": "string" + }, + "security": { + "description": "GCP Security Settings", + "$ref": "#/components/schemas/GcpSecurity" + }, + "token_uri": { + "description": "GCP token uri", + "type": "string" + }, + "type": { + "description": "GCP the type of the service the key belongs to", + "type": "string" + } + } + }, + "GCPEncryptionKey": { + "description": "GCP Encryption Key for CCS clusters.", + "properties": { + "kms_key_service_account": { + "description": "Service account used to access the KMS key", + "type": "string" + }, + "key_location": { + "description": "Location of the encryption key ring", + "type": "string" + }, + "key_name": { + "description": "Name of the encryption key", + "type": "string" + }, + "key_ring": { + "description": "Name of the key ring the encryption key is located on", + "type": "string" + } + } + }, + "GCPImageOverride": { + "description": "GcpImageOverride specifies what a GCP VM Image should be used for a particular product and billing model", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'GCPImageOverride' if this is a complete object or 'GCPImageOverrideLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "billing_model": { + "description": "Link to the billing model.", + "$ref": "#/components/schemas/BillingModelItem" + }, + "image_id": { + "description": "ImageID is the id of the Google Cloud Platform image.", + "type": "string" + }, + "product": { + "description": "Link to the product type.", + "$ref": "#/components/schemas/Product" + }, + "project_id": { + "description": "ProjectID is the id of the Google Cloud Platform project that hosts the image.", + "type": "string" + } + } + }, + "GCPNetwork": { + "description": "GCP Network configuration of a cluster.", + "properties": { + "vpc_name": { + "description": "VPC mame used by the cluster.", + "type": "string" + }, + "vpc_project_id": { + "description": "The name of the host project where the shared VPC exists.", + "type": "string" + }, + "compute_subnet": { + "description": "Compute subnet used by the cluster.", + "type": "string" + }, + "control_plane_subnet": { + "description": "Control plane subnet used by the cluster.", + "type": "string" + } + } + }, + "GCPVolume": { + "description": "Holds settings for an GCP storage volume.", + "properties": { + "size": { + "description": "Volume size in Gib.", + "type": "integer", + "format": "int32" + } + } + }, + "HTPasswdIdentityProvider": { + "description": "Details for `htpasswd` identity providers.", + "properties": { + "password": { + "description": "Password to be used in the _HTPasswd_ data file.", + "type": "string" + }, + "username": { + "description": "Username to be used in the _HTPasswd_ data file.", + "type": "string" + }, + "users": { + "description": "Link to the collection of _HTPasswd_ users.", + "type": "array", + "items": { + "$ref": "#/components/schemas/HTPasswdUser" + } + } + } + }, + "STS": { + "description": "Contains the necessary attributes to support role-based authentication on AWS.", + "properties": { + "oidc_endpoint_url": { + "description": "URL of the location where OIDC configuration and keys are available", + "type": "string" + }, + "auto_mode": { + "description": "Auto creation mode for cluster - OCM will create the operator roles and OIDC provider. false by default.", + "type": "boolean" + }, + "enabled": { + "description": "If STS is enabled or disabled", + "type": "boolean" + }, + "external_id": { + "description": "Optional unique identifier when assuming role in another account", + "type": "string" + }, + "instance_iam_roles": { + "description": "Instance IAM roles to use for the instance profiles of the master and worker instances", + "$ref": "#/components/schemas/InstanceIAMRoles" + }, + "managed_policies": { + "description": "If true, cluster account and operator roles have managed policies attached.", + "type": "boolean" + }, + "oidc_config": { + "description": "Registered Oidc Config, if available holds information related to the oidc config.", + "$ref": "#/components/schemas/OidcConfig" + }, + "operator_iam_roles": { + "description": "List of roles necessary to access the AWS resources of the various operators used during installation", + "type": "array", + "items": { + "$ref": "#/components/schemas/OperatorIAMRole" + } + }, + "operator_role_prefix": { + "description": "Optional user provided prefix for operator roles.", + "type": "string" + }, + "permission_boundary": { + "description": "Optional user provided permission boundary.", + "type": "string" + }, + "role_arn": { + "description": "ARN of the AWS role to assume when installing the cluster", + "type": "string" + }, + "support_role_arn": { + "description": "ARN of the AWS role used by SREs to access the cluster AWS account in order to provide support", + "type": "string" + } + } + }, + "AuditLog": { + "description": "Contains the necessary attributes to support audit log forwarding", + "properties": { + "role_arn": { + "description": "ARN of the CloudWatch audit log forwarding role", + "type": "string" + } + } + }, + "AwsEtcdEncryption": { + "description": "Contains the necessary attributes to support etcd encryption for AWS based clusters.", + "properties": { + "kms_key_arn": { + "description": "ARN of the KMS to be used for the etcd encryption", + "type": "string" + } + } + }, + "Azure": { + "description": "Microsoft Azure settings of a cluster.", + "properties": { + "managed_resource_group_name": { + "description": "The desired name of the Azure Resource Group where the Azure Resources related\nto the cluster are created. It must not previously exist. The Azure Resource\nGroup is created with the given value, within the Azure Subscription\n`subscription_id` of the cluster.\n`managed_resource_group_name` cannot be equal to the value of `managed_resource_group`.\n`managed_resource_group_name` is located in the same Azure location as the\ncluster's region.\nNot to be confused with `resource_group_name`, which is the Azure Resource Group Name\nwhere the own Azure Resource associated to the cluster resides.\nRequired during creation.\nImmutable.", + "type": "string" + }, + "network_security_group_resource_id": { + "description": "The Azure Resource ID of a pre-existing Azure Network Security Group.\nThe Network Security Group specified in network_security_group_resource_id\nmust already be associated to the Azure Subnet `subnet_resource_id`.\nIt is the Azure Network Security Group associated to the cluster's subnet\nspecified in `subnet_resource_id`.\n`network_security_group_resource_id` must be located in the same Azure\nlocation as the cluster's region.\nThe Azure Subscription specified as part of\n`network_security_group_resource_id` must be located in the same Azure\nSubscription as `subscription_id`.\nThe Azure Resource Group Name specified as part of `network_security_group_resource_id`\nmust belong to the Azure Subscription `subscription_id`, and in the same\nAzure location as the cluster's region.\nThe Azure Resource Group Name specified as part of `network_security_group_resource_id`\nmust be a different Resource Group Name than the one specified in\n`managed_resource_group_name`.\nThe Azure Resource Group Name specified as part of `network_security_group_resource_id`\ncan be the same, or a different one than the one specified in\n`resource_group_name`.\nRequired during creation.\nImmutable.", + "type": "string" + }, + "nodes_outbound_connectivity": { + "description": "NodesOutboundConnectivity defines how the network outbound\nconfiguration of the Cluster's Node Pool's Nodes is performed.\nBy default this is configured as Azure Load Balancer. This value is immutable.", + "$ref": "#/components/schemas/AzureNodesOutboundConnectivity" + }, + "operators_authentication": { + "description": "Defines how the operators of the cluster authenticate to Azure.\nRequired during creation.\nImmutable.", + "$ref": "#/components/schemas/AzureOperatorsAuthentication" + }, + "resource_group_name": { + "description": "The Azure Resource Group Name of the cluster. It must be a pre-existing\nAzure Resource Group and it must exist within the Azure Subscription\n`subscription_id` of the cluster.\n`resource_group_name` is located in the same Azure location as the\ncluster's region.\nRequired during creation.\nImmutable.", + "type": "string" + }, + "resource_name": { + "description": "The Azure Resource Name of the cluster. It must be within the\nAzure Resource Group Name `resource_group_name`.\n`resource_name` is located in the same Azure location as the cluster's region.\nRequired during creation.\nImmutable.", + "type": "string" + }, + "subnet_resource_id": { + "description": "The Azure Resource ID of a pre-existing Azure Subnet. It is an Azure\nSubnet used for the Data Plane of the cluster. `subnet_resource_id`\nmust be located in the same Azure location as the cluster's region.\nThe Azure Subscription specified as part of the `subnet_resource_id`\nmust be located in the same Azure Subscription as `subscription_id`.\nThe Azure Resource Group Name specified as part of `subnet_resource_id`\nmust belong to the Azure Subscription `subscription_id`, and in the same\nAzure location as the cluster's region.\nThe Azure Resource Group Name specified as part of `subnet_resource_id`\nmust be a different Resource Group Name than the one specified in\n`managed_resource_group_name`.\nThe Azure Resource Group Name specified as part of the `subnet_resource_id`\ncan be the same, or a different one than the one specified in\n`resource_group_name`.\nRequired during creation.\nImmutable.", + "type": "string" + }, + "subscription_id": { + "description": "The Azure Subscription ID associated with the cluster. It must belong to\nthe Microsoft Entra Tenant ID `tenant_id`.\nRequired during creation.\nImmutable.", + "type": "string" + }, + "tenant_id": { + "description": "The Microsoft Entra Tenant ID where the cluster belongs.\nRequired during creation.\nImmutable.", + "type": "string" + } + } + }, + "AzureControlPlaneManagedIdentity": { + "description": "Represents the information associated to an Azure User-Assigned\nManaged Identity belonging to the Control Plane of the cluster.", + "properties": { + "client_id": { + "description": "The Client ID associated to the Azure User-Assigned Managed Identity.\nReadonly.", + "type": "string" + }, + "principal_id": { + "description": "The Principal ID associated to the Azure User-Assigned Identity.\nReadonly.", + "type": "string" + }, + "resource_id": { + "description": "The Azure Resource ID of the Azure User-Assigned Managed\nIdentity. The managed identity represented must exist before\ncreating the cluster.\nThe Azure Resource Group Name specified as part of the Resource ID\nmust belong to the Azure Subscription specified in `.azure.subscription_id`,\nand in the same Azure location as the cluster's region.\nThe Azure Resource Group Name specified as part of the Resource ID\nmust be a different Resource Group Name than the one specified in\n`.azure.managed_resource_group_name`.\nThe Azure Resource Group Name specified as part of the Resource ID\ncan be the same, or a different one than the one specified in\n`.azure.resource_group_name`.\nRequired during creation.\nImmutable.", + "type": "string" + } + } + }, + "AzureDataPlaneManagedIdentity": { + "description": "Represents the information associated to an Azure User-Assigned\nManaged Identity belonging to the Data Plane of the cluster.", + "properties": { + "resource_id": { + "description": "The Azure Resource ID of the Azure User-Assigned Managed\nIdentity. The managed identity represented must exist before\ncreating the cluster.\nThe Azure Resource Group Name specified as part of the Resource ID\nmust belong to the Azure Subscription specified in `.azure.subscription_id`,\nand in the same Azure location as the cluster's region.\nThe Azure Resource Group Name specified as part of the Resource ID\nmust be a different Resource Group Name than the one specified in\n`.azure.managed_resource_group_name`.\nThe Azure Resource Group Name specified as part of the Resource ID\ncan be the same, or a different one than the one specified in\n`.azure.resource_group_name`.\nRequired during creation.\nImmutable.", + "type": "string" + } + } + }, + "AzureNodePool": { + "description": "Representation of azure node pool specific parameters.", + "properties": { + "os_disk_size_gibibytes": { + "description": "The size in GiB to assign to the OS disks of the\nNodes in the Node Pool. The property\nis the number of bytes x 1024^3.\nIf not specified, OS disk size is 30 GiB.", + "type": "integer", + "format": "int32" + }, + "os_disk_storage_account_type": { + "description": "The disk storage account type to use for the OS disks of the Nodes in the\nNode Pool. Valid values are:\n* Standard_LRS: HDD\n* StandardSSD_LRS: Standard SSD\n* Premium_LRS: Premium SDD\n* UltraSSD_LRS: Ultra SDD\n\nIf not specified, `Premium_LRS` is used.", + "type": "string" + }, + "vm_size": { + "description": "The Azure Virtual Machine size identifier used for the\nNodes of the Node Pool.\nAvailability of VM sizes are dependent on the Azure Location\nof the parent Cluster.\nRequired during creation.", + "type": "string" + }, + "ephemeral_os_disk_enabled": { + "description": "Enables Ephemeral OS Disks for the Nodes in the Node Pool.\nIf not specified, no Ephemeral OS Disks are used.", + "type": "boolean" + }, + "resource_name": { + "description": "ResourceName is the Azure Resource Name of the NodePool.\nResourceName must be within the Azure Resource Group Name of the parent\nCluster it belongs to.\nResourceName must be located in the same Azure Location as the parent\nCluster it belongs to.\nResourceName must be located in the same Azure Subscription as the parent\nCluster it belongs to.\nResourceName must belong to the same Microsoft Entra Tenant ID as the parent\nCluster it belongs to.\nRequired during creation.\nImmutable.", + "type": "string" + } + } + }, + "AzureNodesOutboundConnectivity": { + "description": "The configuration of the node outbound connectivity", + "properties": { + "outbound_type": { + "description": "OutboundType is the type of network outbound configuration.\nThe default and only accepted value is 'load_balancer'.\nThis value is immutable.", + "type": "string" + } + } + }, + "AzureOperatorsAuthentication": { + "description": "The configuration that the operators of the\ncluster have to authenticate to Azure.", + "properties": { + "managed_identities": { + "description": "The authentication configuration to authenticate\nto Azure using Azure User-Assigned Managed Identities.\nRequired during creation.", + "$ref": "#/components/schemas/AzureOperatorsAuthenticationManagedIdentities" + } + } + }, + "AzureOperatorsAuthenticationManagedIdentities": { + "description": "Represents the information related to Azure User-Assigned managed identities\nneeded to perform Operators authentication based on Azure User-Assigned\nManaged Identities", + "properties": { + "control_plane_operators_managed_identities": { + "description": "The set of Azure User-Assigned Managed Identities leveraged for the\nControl Plane operators of the cluster. The set of required managed\nidentities is dependent on the Cluster's OpenShift version.\nImmutable", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/AzureControlPlaneManagedIdentity" + } + }, + "data_plane_operators_managed_identities": { + "description": "The set of Azure User-Assigned Managed Identities leveraged for the\nData Plane operators of the cluster. The set of required managed\nidentities is dependent on the Cluster's OpenShift version.\nImmutable.", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/AzureDataPlaneManagedIdentity" + } + }, + "managed_identities_data_plane_identity_url": { + "description": "The Managed Identities Data Plane Identity URL associated with the\ncluster. It is the URL that will be used to communicate with the\nManaged Identities Resource Provider (MI RP).\nRequired during creation.\nImmutable.", + "type": "string" + }, + "service_managed_identity": { + "description": "The Azure User-Assigned Managed Identity used to perform service\nlevel actions. Specifically:\n- Add Federated Identity Credentials to the identities in\n `data_plane_operators_managed_identities` that belong to Data\n Plane Cluster Operators\n- Perform permissions validation for the BYOVNet related resources\n associated to the Cluster\nRequired during creation.\nImmutable.", + "$ref": "#/components/schemas/AzureServiceManagedIdentity" + } + } + }, + "AzureServiceManagedIdentity": { + "description": "Represents the information associated to an Azure User-Assigned\nManaged Identity whose purpose is to perform service level actions.", + "properties": { + "client_id": { + "description": "The Client ID associated to the Azure User-Assigned Managed Identity.\nReadonly.", + "type": "string" + }, + "principal_id": { + "description": "The Principal ID associated to the Azure User-Assigned Managed Identity.\nReadonly.", + "type": "string" + }, + "resource_id": { + "description": "The Azure Resource ID of the Azure User-Assigned Managed\nIdentity. The managed identity represented must exist before\ncreating the cluster.\nThe Azure Resource Group Name specified as part of the Resource ID\nmust belong to the Azure Subscription specified in `.azure.subscription_id`,\nand in the same Azure location as the cluster's region.\nThe Azure Resource Group Name specified as part of the Resource ID\nmust be a different Resource Group Name than the one specified in\n`.azure.managed_resource_group_name`.\nThe Azure Resource Group Name specified as part of the Resource ID\ncan be the same, or a different one than the one specified in\n`.azure.resource_group_name`.\nRequired during creation.\nImmutable.", + "type": "string" + } + } + }, + "BillingModel": { + "description": "Billing model for cluster resources.", + "type": "string", + "enum": [ + "marketplace", + "marketplace-aws", + "marketplace-gcp", + "marketplace-rhm", + "marketplace-azure", + "standard" + ] + }, + "ByoOidc": { + "description": "ByoOidc configuration.", + "properties": { + "enabled": { + "description": "Boolean flag indicating if the cluster should be creating using _ByoOidc_.\n\nBy default this is `false`.\n\nTo enable it the cluster needs to be ROSA cluster and the organization of the user needs\nto have the `byo-oidc` feature toggle enabled.", + "type": "boolean" + } + } + }, + "CloudProvider": { + "description": "Cloud provider.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'CloudProvider' if this is a complete object or 'CloudProviderLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "display_name": { + "description": "Name of the cloud provider for display purposes. It can contain any characters,\nincluding spaces.", + "type": "string" + }, + "name": { + "description": "Human friendly identifier of the cloud provider, for example `aws`.", + "type": "string" + }, + "regions": { + "description": "(optional) Provider's regions - only included when listing providers with `fetchRegions=true`.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudRegion" + } + } + } + }, + "CloudRegion": { + "description": "Description of a region of a cloud provider.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'CloudRegion' if this is a complete object or 'CloudRegionLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "ccs_only": { + "description": "'true' if the region is supported only for CCS clusters, 'false' otherwise.", + "type": "boolean" + }, + "kms_location_id": { + "description": "(GCP only) Comma-separated list of KMS location IDs that can be used with this region.\nE.g. \"global,nam4,us\". Order is not guaranteed.", + "type": "string" + }, + "kms_location_name": { + "description": "(GCP only) Comma-separated list of display names corresponding to KMSLocationID.\nE.g. \"Global,nam4 (Iowa, South Carolina, and Oklahoma),US\". Order is not guaranteed but will match KMSLocationID.\nUnfortunately, this API doesn't allow robust splitting - Contact ocm-feedback@redhat.com if you want to rely on this.", + "type": "string" + }, + "cloud_provider": { + "description": "Link to the cloud provider that the region belongs to.", + "$ref": "#/components/schemas/CloudProvider" + }, + "display_name": { + "description": "Name of the region for display purposes, for example `N. Virginia`.", + "type": "string" + }, + "enabled": { + "description": "Whether the region is enabled for deploying a managed cluster.", + "type": "boolean" + }, + "govcloud": { + "description": "Whether the region is an AWS GovCloud region.", + "type": "boolean" + }, + "name": { + "description": "Human friendly identifier of the region, for example `us-east-1`.\n\nNOTE: Currently for all cloud providers and all regions `id` and `name` have exactly\nthe same values.", + "type": "string" + }, + "supports_hypershift": { + "description": "'true' if the region is supported for Hypershift deployments, 'false' otherwise.", + "type": "boolean" + }, + "supports_multi_az": { + "description": "Whether the region supports multiple availability zones.", + "type": "boolean" + } + } + }, + "Cluster": { + "description": "Definition of an _OpenShift_ cluster.\n\nThe `cloud_provider` attribute is a reference to the cloud provider. When a\ncluster is retrieved it will be a link to the cloud provider, containing only\nthe kind, id and href attributes:\n\n```json\n{\n \"cloud_provider\": {\n \"kind\": \"CloudProviderLink\",\n \"id\": \"123\",\n \"href\": \"/api/clusters_mgmt/v1/cloud_providers/123\"\n }\n}\n```\n\nWhen a cluster is created this is optional, and if used it should contain the\nidentifier of the cloud provider to use:\n\n```json\n{\n \"cloud_provider\": {\n \"id\": \"123\",\n }\n}\n```\n\nIf not included, then the cluster will be created using the default cloud\nprovider, which is currently Amazon Web Services.\n\nThe region attribute is mandatory when a cluster is created.\n\nThe `aws.access_key_id`, `aws.secret_access_key` and `dns.base_domain`\nattributes are mandatory when creation a cluster with your own Amazon Web\nServices account.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Cluster' if this is a complete object or 'ClusterLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "api": { + "description": "Information about the API of the cluster.", + "$ref": "#/components/schemas/ClusterAPI" + }, + "aws": { + "description": "Amazon Web Services settings of the cluster.", + "$ref": "#/components/schemas/AWS" + }, + "aws_infrastructure_access_role_grants": { + "description": "List of AWS infrastructure access role grants on this cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AWSInfrastructureAccessRoleGrant" + } + }, + "ccs": { + "description": "Contains configuration of a Customer Cloud Subscription cluster.", + "$ref": "#/components/schemas/CCS" + }, + "dns": { + "description": "DNS settings of the cluster.", + "$ref": "#/components/schemas/DNS" + }, + "fips": { + "description": "Create cluster that uses FIPS Validated / Modules in Process cryptographic libraries.", + "type": "boolean" + }, + "gcp": { + "description": "Google cloud platform settings of the cluster.", + "$ref": "#/components/schemas/GCP" + }, + "gcp_encryption_key": { + "description": "Key used for encryption of GCP cluster nodes.", + "$ref": "#/components/schemas/GCPEncryptionKey" + }, + "gcp_network": { + "description": "GCP Network.", + "$ref": "#/components/schemas/GCPNetwork" + }, + "additional_trust_bundle": { + "description": "Additional trust bundle.", + "type": "string" + }, + "addons": { + "description": "List of add-ons on this cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnInstallation" + } + }, + "autoscaler": { + "description": "Link to an optional _ClusterAutoscaler_ that is coupled with the cluster.", + "$ref": "#/components/schemas/ClusterAutoscaler" + }, + "azure": { + "description": "Microsoft Azure settings of the cluster.", + "$ref": "#/components/schemas/Azure" + }, + "billing_model": { + "description": "Billing model for cluster resources.", + "$ref": "#/components/schemas/BillingModel" + }, + "byo_oidc": { + "description": "Contains information about BYO OIDC.", + "$ref": "#/components/schemas/ByoOidc" + }, + "capabilities": { + "description": "OpenShift Cluster Capabilities configuration", + "$ref": "#/components/schemas/ClusterCapabilities" + }, + "cloud_provider": { + "description": "Link to the cloud provider where the cluster is installed.", + "$ref": "#/components/schemas/CloudProvider" + }, + "console": { + "description": "Information about the console of the cluster.", + "$ref": "#/components/schemas/ClusterConsole" + }, + "creation_timestamp": { + "description": "Date and time when the cluster was initially created, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + }, + "delete_protection": { + "description": "Delete protection", + "$ref": "#/components/schemas/DeleteProtection" + }, + "disable_user_workload_monitoring": { + "description": "Indicates whether the User workload monitoring is enabled or not\nIt is enabled by default", + "type": "boolean" + }, + "domain_prefix": { + "description": "DomainPrefix of the cluster. This prefix is optionally assigned by the user when the\ncluster is created. It will appear in the Cluster's domain when the cluster is provisioned.", + "type": "string" + }, + "etcd_encryption": { + "description": "Indicates whether that etcd is encrypted or not.\nThis is set only during cluster creation.", + "type": "boolean" + }, + "expiration_timestamp": { + "description": "Date and time when the cluster will be automatically deleted, using the format defined in\n[RFC3339](https://www.ietf.org/rfc/rfc3339.txt). If no timestamp is provided, the cluster\nwill never expire.\n\nThis option is unsupported.", + "type": "string", + "format": "date-time" + }, + "external_id": { + "description": "External identifier of the cluster, generated by the installer.", + "type": "string" + }, + "external_auth_config": { + "description": "External authentication configuration", + "$ref": "#/components/schemas/ExternalAuthConfig" + }, + "external_configuration": { + "description": "ExternalConfiguration shows external configuration on the cluster.", + "$ref": "#/components/schemas/ExternalConfiguration" + }, + "flavour": { + "description": "Link to the _flavour_ that was used to create the cluster.", + "$ref": "#/components/schemas/Flavour" + }, + "groups": { + "description": "Link to the collection of groups of user of the cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Group" + } + }, + "health_state": { + "description": "HealthState indicates the overall health state of the cluster.", + "$ref": "#/components/schemas/ClusterHealthState" + }, + "htpasswd": { + "description": "Details for `htpasswd` identity provider.", + "$ref": "#/components/schemas/HTPasswdIdentityProvider" + }, + "hypershift": { + "description": "Hypershift configuration.", + "$ref": "#/components/schemas/Hypershift" + }, + "identity_providers": { + "description": "Link to the collection of identity providers of the cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/IdentityProvider" + } + }, + "inflight_checks": { + "description": "List of inflight checks on this cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/InflightCheck" + } + }, + "infra_id": { + "description": "InfraID is used for example to name the VPCs.", + "type": "string" + }, + "ingresses": { + "description": "List of ingresses on this cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Ingress" + } + }, + "kubelet_config": { + "description": "Details of cluster-wide KubeletConfig", + "$ref": "#/components/schemas/KubeletConfig" + }, + "load_balancer_quota": { + "description": "Load Balancer quota to be assigned to the cluster.", + "type": "integer", + "format": "int32" + }, + "machine_pools": { + "description": "List of machine pools on this cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/MachinePool" + } + }, + "managed": { + "description": "Flag indicating if the cluster is managed (by Red Hat) or\nself-managed by the user.", + "type": "boolean" + }, + "managed_service": { + "description": "Contains information about Managed Service", + "$ref": "#/components/schemas/ManagedService" + }, + "multi_az": { + "description": "Flag indicating if the cluster should be created with nodes in\ndifferent availability zones or all the nodes in a single one\nrandomly selected.", + "type": "boolean" + }, + "multi_arch_enabled": { + "description": "Indicate whether the cluster is enabled for multi arch workers", + "type": "boolean" + }, + "name": { + "description": "Name of the cluster. This name is assigned by the user when the\ncluster is created. This is used to uniquely identify the cluster", + "type": "string" + }, + "network": { + "description": "Network settings of the cluster.", + "$ref": "#/components/schemas/Network" + }, + "node_drain_grace_period": { + "description": "Node drain grace period.", + "$ref": "#/components/schemas/Value" + }, + "node_pools": { + "description": "List of node pools on this cluster.\nNodePool is a scalable set of worker nodes attached to a hosted cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/NodePool" + } + }, + "nodes": { + "description": "Information about the nodes of the cluster.", + "$ref": "#/components/schemas/ClusterNodes" + }, + "openshift_version": { + "description": "Version of _OpenShift_ installed in the cluster, for example `4.0.0-0.2`.\n\nWhen retrieving a cluster this will always be reported.\n\nWhen provisioning a cluster this will be ignored, as the version to\ndeploy will be determined internally.", + "type": "string" + }, + "product": { + "description": "Link to the product type of this cluster.", + "$ref": "#/components/schemas/Product" + }, + "properties": { + "description": "User defined properties for tagging and querying.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "provision_shard": { + "description": "ProvisionShard contains the properties of the provision shard, including AWS and GCP related configurations", + "$ref": "#/components/schemas/ProvisionShard" + }, + "proxy": { + "description": "Proxy.", + "$ref": "#/components/schemas/Proxy" + }, + "region": { + "description": "Link to the cloud provider region where the cluster is installed.", + "$ref": "#/components/schemas/CloudRegion" + }, + "registry_config": { + "description": "Registry configuration for the cluster", + "$ref": "#/components/schemas/ClusterRegistryConfig" + }, + "state": { + "description": "Overall state of the cluster.", + "$ref": "#/components/schemas/ClusterState" + }, + "status": { + "description": "Status of cluster", + "$ref": "#/components/schemas/ClusterStatus" + }, + "storage_quota": { + "description": "Storage quota to be assigned to the cluster.", + "$ref": "#/components/schemas/Value" + }, + "subscription": { + "description": "Link to the subscription that comes from the account management service when the cluster\nis registered.", + "$ref": "#/components/schemas/Subscription" + }, + "version": { + "description": "Link to the version of _OpenShift_ that will be used to install the cluster.", + "$ref": "#/components/schemas/Version" + } + } + }, + "ClusterAPI": { + "description": "Information about the API of a cluster.", + "properties": { + "url": { + "description": "The URL of the API server of the cluster.", + "type": "string" + }, + "listening": { + "description": "The listening method of the API server.", + "$ref": "#/components/schemas/ListeningMethod" + } + } + }, + "ClusterCapabilities": { + "properties": { + "disabled": { + "description": "Immutable list of disabled capabilities. May only contain \"ImageRegistry\" at\nthis time. Additional capabilities may be available in the future. Clients\nshould expect to handle additional values.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "ClusterConfigurationMode": { + "description": "Configuration mode of a cluster.", + "type": "string", + "enum": [ + "full", + "read_only" + ] + }, + "ClusterConsole": { + "description": "Information about the console of a cluster.", + "properties": { + "url": { + "description": "The URL of the console of the cluster.", + "type": "string" + } + } + }, + "ClusterHealthState": { + "description": "ClusterHealthState indicates the health of a cluster.", + "type": "string", + "enum": [ + "healthy", + "unhealthy", + "unknown" + ] + }, + "ClusterNodes": { + "description": "Counts of different classes of nodes inside a cluster.", + "properties": { + "autoscale_compute": { + "description": "Details for auto-scaling the compute machine pool.\nCompute and AutoscaleCompute cannot be used together.", + "$ref": "#/components/schemas/MachinePoolAutoscaling" + }, + "availability_zones": { + "description": "The availability zones upon which the nodes are created.", + "type": "array", + "items": { + "type": "string" + } + }, + "compute": { + "description": "Number of compute nodes of the cluster.\nCompute and AutoscaleCompute cannot be used together.", + "type": "integer", + "format": "int32" + }, + "compute_labels": { + "description": "The labels set on the \"default\" compute machine pool.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "compute_machine_type": { + "description": "The compute machine type to use, for example `r5.xlarge`.", + "$ref": "#/components/schemas/MachineType" + }, + "compute_root_volume": { + "description": "The compute machine root volume capabilities.", + "$ref": "#/components/schemas/RootVolume" + }, + "infra": { + "description": "Number of infrastructure nodes of the cluster.", + "type": "integer", + "format": "int32" + }, + "infra_machine_type": { + "description": "The infra machine type to use, for example `r5.xlarge` (Optional).", + "$ref": "#/components/schemas/MachineType" + }, + "master": { + "description": "Number of master nodes of the cluster.", + "type": "integer", + "format": "int32" + }, + "master_machine_type": { + "description": "The master machine type to use, for example `r5.xlarge` (Optional).", + "$ref": "#/components/schemas/MachineType" + }, + "security_group_filters": { + "description": "List of security groups to be applied to nodes (Optional).", + "type": "array", + "items": { + "$ref": "#/components/schemas/MachinePoolSecurityGroupFilter" + } + }, + "total": { + "description": "Total number of nodes of the cluster.", + "type": "integer", + "format": "int32" + } + } + }, + "ClusterRegistryConfig": { + "description": "ClusterRegistryConfig describes the configuration of registries for the cluster.\nIts format reflects the OpenShift Image Configuration, for which docs are available on\n[docs.openshift.com](https://docs.openshift.com/container-platform/4.16/openshift_images/image-configuration.html)\n```json\n{\n \"registry_config\": {\n \"registry_sources\": {\n \"blocked_registries\": [\n \"badregistry.io\",\n \"badregistry8.io\"\n ]\n }\n }\n}\n```\n", + "properties": { + "additional_trusted_ca": { + "description": "A map containing the registry hostname as the key, and the PEM-encoded certificate as the value,\nfor each additional registry CA to trust.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "allowed_registries_for_import": { + "description": "AllowedRegistriesForImport limits the container image registries that normal users may import\nimages from. Set this list to the registries that you trust to contain valid Docker\nimages and that you want applications to be able to import from. Users with\npermission to create Images or ImageStreamMappings via the API are not affected by\nthis policy - typically only administrators or system integrations will have those\npermissions.", + "type": "array", + "items": { + "$ref": "#/components/schemas/RegistryLocation" + } + }, + "platform_allowlist": { + "description": "PlatformAllowlist contains a reference to a RegistryAllowlist which is a list of internal registries\nwhich needs to be whitelisted for the platform to work. It can be omitted at creation and \nupdating and its lifecycle can be managed separately if needed.", + "$ref": "#/components/schemas/RegistryAllowlist" + }, + "registry_sources": { + "description": "RegistrySources contains configuration that determines how the container runtime\nshould treat individual registries when accessing images for builds+pods. (e.g.\nwhether or not to allow insecure access). It does not contain configuration for the\ninternal cluster registry.", + "$ref": "#/components/schemas/RegistrySources" + } + } + }, + "ClusterState": { + "description": "Overall state of a cluster.", + "type": "string", + "enum": [ + "error", + "hibernating", + "installing", + "pending", + "powering_down", + "ready", + "resuming", + "uninstalling", + "unknown", + "validating", + "waiting" + ] + }, + "ClusterStatus": { + "description": "Detailed status of a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ClusterStatus' if this is a complete object or 'ClusterStatusLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "dns_ready": { + "description": "DNSReady from Provisioner", + "type": "boolean" + }, + "oidc_ready": { + "description": "OIDCReady from user configuration.", + "type": "boolean" + }, + "configuration_mode": { + "description": "Configuration mode", + "$ref": "#/components/schemas/ClusterConfigurationMode" + }, + "current_compute": { + "description": "Current Replicas available for a Hosted Cluster", + "type": "integer", + "format": "int32" + }, + "description": { + "description": "Detailed description of the cluster status.", + "type": "string" + }, + "limited_support_reason_count": { + "description": "Limited Support Reason Count", + "type": "integer", + "format": "int32" + }, + "provision_error_code": { + "description": "Provisioning Error Code", + "type": "string" + }, + "provision_error_message": { + "description": "Provisioning Error Message", + "type": "string" + }, + "state": { + "description": "The overall state of the cluster.", + "$ref": "#/components/schemas/ClusterState" + } + } + }, + "DeleteProtection": { + "description": "DeleteProtection configuration.", + "properties": { + "enabled": { + "description": "Boolean flag indicating if the cluster should be be using _DeleteProtection_.\n\nBy default this is `false`.\n\nTo enable it a SREP needs to patch the value through OCM API", + "type": "boolean" + } + } + }, + "Ec2MetadataHttpTokens": { + "description": "Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances", + "type": "string", + "enum": [ + "optional", + "required" + ] + }, + "ExternalAuthConfig": { + "description": "ExternalAuthConfig configuration", + "properties": { + "enabled": { + "description": "Boolean flag indicating if the cluster should use an external authentication configuration.\n\nBy default this is false.\n\nTo enable it the cluster needs to be ROSA HCP cluster and the organization of the user needs\nto have the `external-authentication` feature toggle enabled.", + "type": "boolean" + }, + "external_auths": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ExternalAuth" + } + } + } + }, + "ExternalConfiguration": { + "description": "Representation of cluster external configuration.", + "properties": { + "labels": { + "description": "list of labels externally configured on the clusterdeployment.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "manifests": { + "description": "list of manifest externally configured for a hosted cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Manifest" + } + }, + "syncsets": { + "description": "list of syncsets externally configured on the cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Syncset" + } + } + } + }, + "GcpAuthentication": { + "description": "Google cloud platform authentication method of a cluster.", + "properties": { + "href": { + "description": "Self link", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object", + "type": "string" + }, + "kind": { + "description": "Indicates the type of this object", + "type": "string" + } + } + }, + "GcpPrivateServiceConnect": { + "description": "Google cloud platform private service connect configuration of a cluster.", + "properties": { + "service_attachment_subnet": { + "description": "The name of the subnet where the PSC service attachment is created", + "type": "string" + } + } + }, + "GcpSecurity": { + "description": "Google cloud platform security settings of a cluster.", + "properties": { + "secure_boot": { + "description": "Determines if Shielded VM feature \"Secure Boot\" should be set for the nodes of the cluster.", + "type": "boolean" + } + } + }, + "Hypershift": { + "description": "Hypershift configuration.", + "properties": { + "enabled": { + "description": "Boolean flag indicating if the cluster should be creating using _Hypershift_.\n\nBy default this is `false`.\n\nTo enable it the cluster needs to be ROSA cluster and the organization of the user needs\nto have the `hypershift` capability enabled.", + "type": "boolean" + } + } + }, + "ImageOverrides": { + "description": "ImageOverrides holds the lists of available images per cloud provider.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ImageOverrides' if this is a complete object or 'ImageOverridesLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "aws": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AMIOverride" + } + }, + "gcp": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GCPImageOverride" + } + } + } + }, + "InflightCheck": { + "description": "Representation of check running before the cluster is provisioned.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'InflightCheck' if this is a complete object or 'InflightCheckLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "details": { + "description": "Details regarding the state of the inflight check.", + "type": "object" + }, + "ended_at": { + "description": "The time the check finished running.", + "type": "string", + "format": "date-time" + }, + "name": { + "description": "The name of the inflight check.", + "type": "string" + }, + "restarts": { + "description": "The number of times the inflight check restarted.", + "type": "integer", + "format": "int32" + }, + "started_at": { + "description": "The time the check started running.", + "type": "string", + "format": "date-time" + }, + "state": { + "description": "State of the inflight check.", + "$ref": "#/components/schemas/InflightCheckState" + } + } + }, + "InflightCheckState": { + "description": "State of an inflight check.", + "type": "string", + "enum": [ + "failed", + "passed", + "pending", + "running" + ] + }, + "InstanceIAMRoles": { + "description": "Contains the necessary attributes to support role-based authentication on AWS.", + "properties": { + "master_role_arn": { + "description": "The IAM role ARN that will be attached to master instances", + "type": "string" + }, + "worker_role_arn": { + "description": "The IAM role ARN that will be attached to worker instances", + "type": "string" + } + } + }, + "KubeletConfig": { + "description": "OCM representation of KubeletConfig, exposing the fields of Kubernetes\nKubeletConfig that can be managed by users", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'KubeletConfig' if this is a complete object or 'KubeletConfigLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "name": { + "description": "Allows the user to specify the name to be used to identify this KubeletConfig.\nOptional. A name will be generated if not provided.", + "type": "string" + }, + "pod_pids_limit": { + "description": "Allows the user to specify the podPidsLimit to be applied via KubeletConfig.\nUseful if workloads have greater PIDs limit requirements than the OCP default.", + "type": "integer", + "format": "int32" + } + } + }, + "ListeningMethod": { + "description": "Cluster components listening method.", + "type": "string", + "enum": [ + "external", + "internal" + ] + }, + "MachinePoolAutoscaling": { + "description": "Representation of a autoscaling in a machine pool.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'MachinePoolAutoscaling' if this is a complete object or 'MachinePoolAutoscalingLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "max_replicas": { + "description": "The maximum number of replicas for the machine pool.", + "type": "integer", + "format": "int32" + }, + "min_replicas": { + "description": "The minimum number of replicas for the machine pool.", + "type": "integer", + "format": "int32" + } + } + }, + "MachinePoolSecurityGroupFilter": { + "description": "Security Group Filter object, containing name of the filter tag and value of the filter tag", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "MachineType": { + "description": "Machine type.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'MachineType' if this is a complete object or 'MachineTypeLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "ccs_only": { + "description": "'true' if the instance type is supported only for CCS clusters, 'false' otherwise.", + "type": "boolean" + }, + "cpu": { + "description": "The amount of cpu's of the machine type.", + "$ref": "#/components/schemas/Value" + }, + "architecture": { + "description": "The architecture of the machine type.", + "$ref": "#/components/schemas/ProcessorType" + }, + "category": { + "description": "The category which the machine type is suitable for.", + "$ref": "#/components/schemas/MachineTypeCategory" + }, + "cloud_provider": { + "description": "Link to the cloud provider that the machine type belongs to.", + "$ref": "#/components/schemas/CloudProvider" + }, + "generic_name": { + "description": "Generic name for quota purposes, for example `highmem-4`.\nCloud provider agnostic - many values are shared between \"similar\"\nmachine types on different providers.\nCorresponds to `resource_name` values in \"compute.node\" quota cost data.", + "type": "string" + }, + "memory": { + "description": "The amount of memory of the machine type.", + "$ref": "#/components/schemas/Value" + }, + "name": { + "description": "Human friendly identifier of the machine type, for example `r5.xlarge - Memory Optimized`.", + "type": "string" + }, + "size": { + "description": "The size of the machine type.", + "$ref": "#/components/schemas/MachineTypeSize" + } + } + }, + "MachineTypeCategory": { + "description": "Machine type category.", + "type": "string", + "enum": [ + "accelerated_computing", + "compute_optimized", + "general_purpose", + "memory_optimized" + ] + }, + "MachineTypeSize": { + "description": "Machine type size.", + "type": "string", + "enum": [ + "large", + "medium", + "small" + ] + }, + "ManagedService": { + "description": "Contains the necessary attributes to support role-based authentication on AWS.", + "properties": { + "enabled": { + "description": "Indicates whether the cluster belongs to a managed service\nThis should only be set by the \"Managed Service\" service.\nclusters with this set can only be modified by the \"Managed Service\" service.", + "type": "boolean" + } + } + }, + "Network": { + "description": "Network configuration of a cluster.", + "properties": { + "host_prefix": { + "description": "Network host prefix which is defaulted to `23` if not specified.", + "type": "integer", + "format": "int32" + }, + "machine_cidr": { + "description": "IP address block from which to assign machine IP addresses, for example `10.0.0.0/16`.", + "type": "string" + }, + "pod_cidr": { + "description": "IP address block from which to assign pod IP addresses, for example `10.128.0.0/14`.", + "type": "string" + }, + "service_cidr": { + "description": "IP address block from which to assign service IP addresses, for example `172.30.0.0/16`.", + "type": "string" + }, + "type": { + "description": "The main controller responsible for rendering the core networking components.", + "type": "string" + } + } + }, + "NodePool": { + "description": "Representation of a node pool in a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'NodePool' if this is a complete object or 'NodePoolLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "aws_node_pool": { + "description": "AWS specific parameters (Optional).", + "$ref": "#/components/schemas/AWSNodePool" + }, + "auto_repair": { + "description": "Specifies whether health checks should be enabled for machines in the NodePool.", + "type": "boolean" + }, + "autoscaling": { + "description": "Details for auto-scaling the machine pool.\nReplicas and autoscaling cannot be used together.", + "$ref": "#/components/schemas/NodePoolAutoscaling" + }, + "availability_zone": { + "description": "The availability zone upon which the node is created.", + "type": "string" + }, + "azure_node_pool": { + "description": "Azure specific parameters.", + "$ref": "#/components/schemas/AzureNodePool" + }, + "kubelet_configs": { + "description": "The names of the KubeletConfigs for this node pool.", + "type": "array", + "items": { + "type": "string" + } + }, + "labels": { + "description": "The labels set on the Nodes created.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "management_upgrade": { + "description": "Management parameters (Optional).", + "$ref": "#/components/schemas/NodePoolManagementUpgrade" + }, + "node_drain_grace_period": { + "description": "Time to wait for a NodePool to drain when it is upgraded or replaced before it is forcibly removed.", + "$ref": "#/components/schemas/Value" + }, + "replicas": { + "description": "The number of Machines (and Nodes) to create.\nReplicas and autoscaling cannot be used together.", + "type": "integer", + "format": "int32" + }, + "status": { + "description": "NodePool status.", + "$ref": "#/components/schemas/NodePoolStatus" + }, + "subnet": { + "description": "The subnet upon which the nodes are created.", + "type": "string" + }, + "taints": { + "description": "The taints set on the Nodes created.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Taint" + } + }, + "tuning_configs": { + "description": "The names of the tuning configs for this node pool.", + "type": "array", + "items": { + "type": "string" + } + }, + "version": { + "description": "Version of the node pool.", + "$ref": "#/components/schemas/Version" + } + } + }, + "NodePoolAutoscaling": { + "description": "Representation of a autoscaling in a node pool.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'NodePoolAutoscaling' if this is a complete object or 'NodePoolAutoscalingLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "max_replica": { + "description": "The maximum number of replicas for the node pool.", + "type": "integer", + "format": "int32" + }, + "min_replica": { + "description": "The minimum number of replicas for the node pool.", + "type": "integer", + "format": "int32" + } + } + }, + "NodePoolManagementUpgrade": { + "description": "Representation of node pool management.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'NodePoolManagementUpgrade' if this is a complete object or 'NodePoolManagementUpgradeLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "max_surge": { + "description": "Maximum number of nodes in the NodePool of a ROSA HCP cluster that can be scheduled above the desired number of nodes during the upgrade.", + "type": "string" + }, + "max_unavailable": { + "description": "Maximum number of nodes in the NodePool of a ROSA HCP cluster that can be unavailable during the upgrade.", + "type": "string" + }, + "type": { + "description": "Type of strategy for handling upgrades.", + "type": "string" + } + } + }, + "NodePoolState": { + "description": "Representation of the status of a node pool.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'NodePoolState' if this is a complete object or 'NodePoolStateLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "last_updated_timestamp": { + "description": "The current number of replicas for the node pool.", + "type": "string", + "format": "date-time" + }, + "node_pool_state_value": { + "description": "The current state of the node pool", + "type": "string" + } + } + }, + "NodePoolStatus": { + "description": "Representation of the status of a node pool.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'NodePoolStatus' if this is a complete object or 'NodePoolStatusLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "current_replicas": { + "description": "The current number of replicas for the node pool.", + "type": "integer", + "format": "int32" + }, + "message": { + "description": "Adds additional information about the NodePool status when the node pool doesn't reach the desired replicas.", + "type": "string" + }, + "state": { + "description": "The current state of the node pool", + "$ref": "#/components/schemas/NodePoolState" + } + } + }, + "OidcConfig": { + "description": "Contains the necessary attributes to support oidc configuration hosting under Red Hat or registering a Customer's byo oidc config.", + "properties": { + "href": { + "description": "HREF for the oidc config, filled in response.", + "type": "string" + }, + "id": { + "description": "ID for the oidc config, filled in response.", + "type": "string" + }, + "creation_timestamp": { + "description": "Creation timestamp, filled in response.", + "type": "string", + "format": "date-time" + }, + "installer_role_arn": { + "description": "ARN of the AWS role to assume when installing the cluster as to reveal the secret, supplied in request. It is only to be used in Unmanaged Oidc Config.", + "type": "string" + }, + "issuer_url": { + "description": "Issuer URL, filled in response when Managed and supplied in Unmanaged.", + "type": "string" + }, + "last_update_timestamp": { + "description": "Last update timestamp, filled when patching a valid attribute of this oidc config.", + "type": "string", + "format": "date-time" + }, + "last_used_timestamp": { + "description": "Last used timestamp, filled by the latest cluster that used this oidc config.", + "type": "string", + "format": "date-time" + }, + "managed": { + "description": "Indicates whether it is Managed or Unmanaged (Customer hosted).", + "type": "boolean" + }, + "organization_id": { + "description": "Organization ID, filled in response respecting token provided.", + "type": "string" + }, + "reusable": { + "description": "Indicates whether the Oidc Config can be reused.", + "type": "boolean" + }, + "secret_arn": { + "description": "Secrets Manager ARN for the OIDC private key, supplied in request. It is only to be used in Unmanaged Oidc Config.", + "type": "string" + } + } + }, + "OperatorIAMRole": { + "description": "Contains the necessary attributes to allow each operator to access the necessary AWS resources", + "properties": { + "id": { + "description": "Randomly-generated ID to identify the operator role", + "type": "string" + }, + "name": { + "description": "Name of the credentials secret used to access cloud resources", + "type": "string" + }, + "namespace": { + "description": "Namespace where the credentials secret lives in the cluster", + "type": "string" + }, + "role_arn": { + "description": "Role to assume when accessing AWS resources", + "type": "string" + }, + "service_account": { + "description": "Service account name to use when authenticating", + "type": "string" + } + } + }, + "PrivateLinkClusterConfiguration": { + "description": "Manages the configuration for the Private Links.", + "properties": { + "principals": { + "description": "List of additional principals for the Private Link", + "type": "array", + "items": { + "$ref": "#/components/schemas/PrivateLinkPrincipal" + } + } + } + }, + "PrivateLinkPrincipal": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'PrivateLinkPrincipal' if this is a complete object or 'PrivateLinkPrincipalLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "principal": { + "description": "ARN for a principal that is allowed for this Private Link.", + "type": "string" + } + } + }, + "ProcessorType": { + "description": "Processor type category.", + "type": "string", + "enum": [ + "amd64", + "arm64" + ] + }, + "ProvisionShard": { + "description": "Contains the properties of the provision shard, including AWS and GCP related configurations", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ProvisionShard' if this is a complete object or 'ProvisionShardLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "aws_account_operator_config": { + "description": "Contains the configuration for the AWS account operator.", + "$ref": "#/components/schemas/ServerConfig" + }, + "aws_base_domain": { + "description": "Contains the AWS base domain.", + "type": "string" + }, + "gcp_base_domain": { + "description": "Contains the GCP base domain.", + "type": "string" + }, + "gcp_project_operator": { + "description": "Contains the configuration for the GCP project operator.", + "$ref": "#/components/schemas/ServerConfig" + }, + "cloud_provider": { + "description": "Contains the cloud provider name.", + "$ref": "#/components/schemas/CloudProvider" + }, + "creation_timestamp": { + "description": "Date and time when the provision shard was initially created, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + }, + "hive_config": { + "description": "Contains the configuration for Hive.", + "$ref": "#/components/schemas/ServerConfig" + }, + "hypershift_config": { + "description": "Contains the configuration for Hypershift.", + "$ref": "#/components/schemas/ServerConfig" + }, + "last_update_timestamp": { + "description": "Date and time when the provision shard was last updated, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + }, + "management_cluster": { + "description": "Contains the name of the management cluster for Hypershift clusters that are assigned to this shard.\nThis field is populated by OCM, and must not be overwritten via API.", + "type": "string" + }, + "region": { + "description": "Contains the cloud-provider region in which the provisioner spins up the cluster.", + "$ref": "#/components/schemas/CloudRegion" + }, + "status": { + "description": "Status of the provision shard. Possible values: active/maintenance/offline.", + "type": "string" + } + } + }, + "ProvisionShardTopology": { + "type": "string", + "enum": [ + "dedicated" + ] + }, + "Proxy": { + "description": "Proxy configuration of a cluster.", + "properties": { + "http_proxy": { + "description": "HTTPProxy is the URL of the proxy for HTTP requests.", + "type": "string" + }, + "https_proxy": { + "description": "HTTPSProxy is the URL of the proxy for HTTPS requests.", + "type": "string" + }, + "no_proxy": { + "description": "NoProxy is a comma-separated list of domains and CIDRs for which \nthe proxy should not be used", + "type": "string" + } + } + }, + "RegistryAllowlist": { + "description": "RegistryAllowlist represents a single registry allowlist.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'RegistryAllowlist' if this is a complete object or 'RegistryAllowlistLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "cloud_provider": { + "description": "CloudProvider is the cloud provider for which this allowlist is valid.", + "$ref": "#/components/schemas/CloudProvider" + }, + "creation_timestamp": { + "description": "CreationTimestamp is the date and time when the allow list has been created.", + "type": "string", + "format": "date-time" + }, + "registries": { + "description": "Registries is the list of registries contained in this Allowlist.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "RegistryLocation": { + "description": "RegistryLocation contains a location of the registry specified by the registry domain\nname. The domain name might include wildcards, like '*' or '??'.", + "properties": { + "domain_name": { + "description": "domainName specifies a domain name for the registry\nIn case the registry use non-standard (80 or 443) port, the port should be included\nin the domain name as well.", + "type": "string" + }, + "insecure": { + "description": "insecure indicates whether the registry is secure (https) or insecure (http)\nBy default (if not specified) the registry is assumed as secure.", + "type": "boolean" + } + } + }, + "RegistrySources": { + "description": "RegistrySources contains configuration that determines how the container runtime should treat individual\nregistries when accessing images for builds and pods. For instance, whether or not to allow insecure access.\nIt does not contain configuration for the internal cluster registry.", + "properties": { + "allowed_registries": { + "description": "AllowedRegistries: registries for which image pull and push actions are allowed.\nTo specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name.\nFor example, *.example.com. You can specify an individual repository within a registry.\nFor example: reg1.io/myrepo/myapp:latest. All other registries are blocked.\nMutually exclusive with `BlockedRegistries`", + "type": "array", + "items": { + "type": "string" + } + }, + "blocked_registries": { + "description": "BlockedRegistries: registries for which image pull and push actions are denied.\nTo specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name.\nFor example, *.example.com. You can specify an individual repository within a registry.\nFor example: reg1.io/myrepo/myapp:latest. All other registries are allowed.\nMutually exclusive with `AllowedRegistries`", + "type": "array", + "items": { + "type": "string" + } + }, + "insecure_registries": { + "description": "InsecureRegistries are registries which do not have a valid TLS certificate or only support HTTP connections.\nTo specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name.\nFor example, *.example.com. You can specify an individual repository within a registry.\nFor example: reg1.io/myrepo/myapp:latest.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "ReleaseImageDetails": { + "properties": { + "available_upgrades": { + "description": "AvailableUpgrades is the list of versions this version can be upgraded to.", + "type": "array", + "items": { + "type": "string" + } + }, + "release_image": { + "description": "ReleaseImage contains the URI of Openshift release image.", + "type": "string" + } + } + }, + "ReleaseImages": { + "properties": { + "arm64": { + "description": "Arm64 will contain the reference for the arm64 image which will be used for cluster deployments", + "$ref": "#/components/schemas/ReleaseImageDetails" + }, + "multi": { + "description": "Multi will contain the reference for the multi image which will be used for cluster deployments", + "$ref": "#/components/schemas/ReleaseImageDetails" + } + } + }, + "RootVolume": { + "description": "Root volume capabilities.", + "properties": { + "aws": { + "description": "AWS volume specification", + "$ref": "#/components/schemas/AWSVolume" + }, + "gcp": { + "description": "GCP Volume specification", + "$ref": "#/components/schemas/GCPVolume" + } + } + }, + "ServerConfig": { + "description": "Representation of a server config", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ServerConfig' if this is a complete object or 'ServerConfigLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "aws_shard": { + "description": "Config for AWS provision shards", + "$ref": "#/components/schemas/AWSShard" + }, + "kubeconfig": { + "description": "The kubeconfig of the server.", + "type": "string" + }, + "server": { + "description": "The URL of the server.", + "type": "string" + }, + "topology": { + "description": "The topology of a provision shard (Optional).", + "$ref": "#/components/schemas/ProvisionShardTopology" + } + } + }, + "Taint": { + "description": "Representation of a Taint set on a MachinePool in a cluster.", + "properties": { + "effect": { + "description": "The effect on the node for the pods matching the taint, i.e: NoSchedule, NoExecute, PreferNoSchedule.", + "type": "string" + }, + "key": { + "description": "The key for the taint", + "type": "string" + }, + "value": { + "description": "The value for the taint.", + "type": "string" + } + } + }, + "Value": { + "description": "Numeric value and the unit used to measure it.\n\nUnits are not mandatory, and they're not specified for some resources. For\nresources that use bytes, the accepted units are:\n\n- 1 B = 1 byte\n- 1 KB = 10^3 bytes\n- 1 MB = 10^6 bytes\n- 1 GB = 10^9 bytes\n- 1 TB = 10^12 bytes\n- 1 PB = 10^15 bytes\n\n- 1 B = 1 byte\n- 1 KiB = 2^10 bytes\n- 1 MiB = 2^20 bytes\n- 1 GiB = 2^30 bytes\n- 1 TiB = 2^40 bytes\n- 1 PiB = 2^50 bytes", + "properties": { + "unit": { + "description": "Name of the unit used to measure the value.", + "type": "string" + }, + "value": { + "description": "Numeric value.", + "type": "number", + "format": "float" + } + } + }, + "Version": { + "description": "Representation of an _OpenShift_ version.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Version' if this is a complete object or 'VersionLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "gcp_marketplace_enabled": { + "description": "GCPMarketplaceEnabled indicates if this version can be used to create GCP Marketplace clusters.", + "type": "boolean" + }, + "rosa_enabled": { + "description": "ROSAEnabled indicates whether this version can be used to create ROSA clusters.", + "type": "boolean" + }, + "available_upgrades": { + "description": "AvailableUpgrades is the list of versions this version can be upgraded to.", + "type": "array", + "items": { + "type": "string" + } + }, + "channel_group": { + "description": "ChannelGroup is the name of the group where this image belongs.\nChannelGroup is a mechanism to partition the images to different groups,\neach image belongs to only a single group.", + "type": "string" + }, + "default": { + "description": "Indicates if this should be selected as the default version when a cluster is created\nwithout specifying explicitly the version.", + "type": "boolean" + }, + "enabled": { + "description": "Indicates if this version can be used to create clusters.", + "type": "boolean" + }, + "end_of_life_timestamp": { + "description": "EndOfLifeTimestamp is the date and time when the version will get to End of Life, using the\nformat defined in https://www.ietf.org/rfc/rfc3339.txt[RC3339].", + "type": "string", + "format": "date-time" + }, + "hosted_control_plane_default": { + "description": "HostedControlPlaneDefault is a flag that indicates if this should be selected as the default version when a\nHCP cluster is created without specifying explicitly the version.", + "type": "boolean" + }, + "hosted_control_plane_enabled": { + "description": "HostedControlPlaneEnabled indicates whether this version can be used to create HCP clusters.", + "type": "boolean" + }, + "image_overrides": { + "description": "ImageOverrides contains the lists of images per cloud provider.", + "$ref": "#/components/schemas/ImageOverrides" + }, + "raw_id": { + "description": "RawID is the id of the version - without channel group and prefix.", + "type": "string" + }, + "release_image": { + "description": "ReleaseImage contains the URI of Openshift release image for amd64 architecture.", + "type": "string" + }, + "release_images": { + "description": "ReleaseImages contains the URI of OpenShift release images for arm64 and multi architectures.", + "$ref": "#/components/schemas/ReleaseImages" + }, + "wif_enabled": { + "description": "WifEnabled is a flag that indicates whether this version is enabled for Workload Identity Federation.", + "type": "boolean" + } + } + }, + "Error": { + "type": "object", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will always be 'Error'", + "type": "string" + }, + "id": { + "description": "Numeric identifier of the error.", + "type": "integer", + "format": "int32" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "description": "Globally unique code of the error, composed of the unique identifier of the API and the numeric identifier of the error. For example, for if the numeric identifier of the error is `93` and the identifier of the API is `clusters_mgmt` then the code will be `CLUSTERS-MGMT-93`.", + "type": "string" + }, + "reason": { + "description": "Human readable description of the error.", + "type": "string" + }, + "details": { + "description": "Extra information about the error.", + "type": "object", + "additionalProperties": true + } + } + } + }, + "securitySchemes": { + "bearer": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "security": [ + { + "bearer": [ + + ] + } + ] +} \ No newline at end of file diff --git a/openapi/authorizations/v1/openapi.json b/openapi/authorizations/v1/openapi.json new file mode 100644 index 00000000..a78aa55c --- /dev/null +++ b/openapi/authorizations/v1/openapi.json @@ -0,0 +1,911 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "v1", + "title": "authorizations", + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + }, + "contact": { + "name": "OCM Feedback", + "email": "ocm-feedback@redhat.com" + } + }, + "servers": [ + { + "description": "Production", + "url": "https://api.openshift.com" + }, + { + "description": "Stage", + "url": "https://api.stage.openshift.com" + } + ], + "paths": { + "/api/authorizations/v1": { + "get": { + "description": "Retrieves the version metadata.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Metadata" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/authorizations/v1/access_review": { + "post": { + "description": "Reviews a user's access to a resource", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccessReviewRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccessReviewResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/authorizations/v1/capability_review": { + "post": { + "description": "Reviews a user's capability to a resource.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CapabilityReviewRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CapabilityReviewResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/authorizations/v1/export_control_review": { + "post": { + "description": "Screens a user by account user name.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExportControlReviewRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExportControlReviewResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/authorizations/v1/feature_review": { + "post": { + "description": "Reviews a user's ability to toggle a feature", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FeatureReviewRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FeatureReviewResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/authorizations/v1/resource_review": { + "post": { + "description": "Returns the list of identifiers of the resources that an account can\nperform the specified action upon.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceReviewRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceReview" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/authorizations/v1/self_access_review": { + "post": { + "description": "Reviews a user's access to a resource", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SelfAccessReviewRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SelfAccessReviewResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/authorizations/v1/self_capability_review": { + "post": { + "description": "Reviews a user's capability to a resource.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SelfCapabilityReviewRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SelfCapabilityReviewResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/authorizations/v1/self_feature_review": { + "post": { + "description": "Reviews ability to toggle a feature", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SelfFeatureReviewRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SelfFeatureReviewResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/authorizations/v1/self_terms_review": { + "post": { + "description": "Reviews a user's status of Terms.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SelfTermsReviewRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TermsReviewResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/authorizations/v1/terms_review": { + "post": { + "description": "Reviews a user's status of Terms.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TermsReviewRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TermsReviewResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Metadata": { + "description": "Version metadata.", + "properties": { + "server_version": { + "description": "Version of the server.", + "type": "string" + } + } + }, + "AccessReviewRequest": { + "description": "Representation of an access review", + "properties": { + "account_username": { + "description": "Defines the username of the account of which access is being reviewed", + "type": "string" + }, + "action": { + "description": "Indicates the action, one of: [get,list,create,delete,update]", + "type": "string" + }, + "cluster_id": { + "description": "Indicates which Cluster (internal id) the resource type belongs to", + "type": "string" + }, + "cluster_uuid": { + "description": "Indicates which Cluster (external id) the resource type belongs to", + "type": "string" + }, + "organization_id": { + "description": "Indicates which Organization the resource type belongs to", + "type": "string" + }, + "resource_type": { + "description": "Indicates the type of the resource an action would be taken on.\nSee uhc-account-manager/openapi/openapi.yaml for a list of possible values", + "type": "string" + }, + "subscription_id": { + "description": "Indicates which Subscription the resource type belongs to", + "type": "string" + } + } + }, + "AccessReviewResponse": { + "description": "Representation of an access review response", + "properties": { + "account_username": { + "description": "Defines the username of the account of which access is being reviewed.", + "type": "string" + }, + "action": { + "description": "Indicates the action, one of: [get,list,create,delete,update].", + "type": "string" + }, + "allowed": { + "description": "Defines whether the action on the specified resource type is allowed.", + "type": "boolean" + }, + "cluster_id": { + "description": "Indicates which Cluster (internal id) the resource type belongs to.", + "type": "string" + }, + "cluster_uuid": { + "description": "Indicates which Cluster (external id) the resource type belongs to.", + "type": "string" + }, + "is_ocm_internal": { + "description": "Defines whether an account is ocm internal.", + "type": "boolean" + }, + "organization_id": { + "description": "Indicates which Organization the resource type belongs to.", + "type": "string" + }, + "reason": { + "description": "Defines further context for the value in allowed (if applicable).", + "type": "string" + }, + "resource_type": { + "description": "Indicates the type of the resource an action would be taken on.\nSee uhc-account-manager/openapi/openapi.yaml for a list of possible values.", + "type": "string" + }, + "subscription_id": { + "description": "Indicates which Subscription the resource type belongs to.", + "type": "string" + } + } + }, + "CapabilityReviewRequest": { + "description": "Representation of a capability review.", + "properties": { + "account_username": { + "description": "Defines the username of the account of which capability is being reviewed.", + "type": "string" + }, + "capability": { + "description": "Capability to review [manage_cluster_admin].", + "type": "string" + }, + "cluster_id": { + "description": "Indicates which Cluster (internal id) the resource type belongs to.", + "type": "string" + }, + "organization_id": { + "description": "Indicates which Organization the resource type belongs to.", + "type": "string" + }, + "resource_type": { + "description": "Indicates the type of the resource.\nSee uhc-account-manager/openapi/openapi.yaml for a list of possible values.", + "type": "string" + }, + "subscription_id": { + "description": "Indicates which Subscription the resource type belongs to.", + "type": "string" + }, + "type": { + "description": "Type of capability [Cluster].", + "type": "string" + } + } + }, + "CapabilityReviewResponse": { + "description": "Representation of a capability review response.", + "properties": { + "result": { + "type": "string" + } + } + }, + "ExportControlReviewRequest": { + "properties": { + "account_username": { + "type": "string" + } + } + }, + "ExportControlReviewResponse": { + "properties": { + "restricted": { + "type": "boolean" + } + } + }, + "FeatureReviewRequest": { + "description": "Representation of a feature review", + "properties": { + "account_username": { + "description": "Defines the username of the account of which access is being reviewed ", + "type": "string" + }, + "feature": { + "description": "Indicates the feature which can be toggled", + "type": "string" + }, + "organization_id": { + "description": "Defines the organisation id of the account of which access is being reviewed", + "type": "string" + } + } + }, + "FeatureReviewResponse": { + "description": "Representation of a feature review response", + "properties": { + "enabled": { + "description": "Defines whether the feature can be toggled", + "type": "boolean" + }, + "feature_id": { + "description": "Defines the feature id which can be toggled", + "type": "string" + } + } + }, + "ResourceReview": { + "description": "Contains the result of performing a resource access review.", + "properties": { + "account_username": { + "description": "Name of the account that is trying to perform the access.", + "type": "string" + }, + "action": { + "description": "Action that will the user is trying to perform.", + "type": "string" + }, + "cluster_ids": { + "description": "Identifiers of the Clusters (internal ids) that the user has permission to perform the action upon.", + "type": "array", + "items": { + "type": "string" + } + }, + "cluster_uuids": { + "description": "Identifiers which Clusters (external ids) that the user has permission to perform the action upon.", + "type": "array", + "items": { + "type": "string" + } + }, + "organization_ids": { + "description": "Identifiers of the organizations that the user has permissions to perform the action\nupon.", + "type": "array", + "items": { + "type": "string" + } + }, + "resource_type": { + "description": "Type of resource.", + "type": "string" + }, + "subscription_ids": { + "description": "Identifiers of the subscriptions that the user has permission to perform the action upon.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "ResourceReviewRequest": { + "description": "Request to perform a resource access review.", + "properties": { + "account_username": { + "description": "Name of the account that is trying to access the resource.", + "type": "string" + }, + "action": { + "description": "Action that will be performed on the resource.", + "type": "string" + }, + "exclude_subscription_statuses": { + "description": "Subscriptions with these statuses will be excluded from results.", + "type": "array", + "items": { + "$ref": "#/components/schemas/SubscriptionStatus" + } + }, + "reduce_cluster_list": { + "description": "If true, in the case when all subscriptions in organization are permitted, response will *not* include\nthese subscriptions' ID, but organization only.", + "type": "boolean" + }, + "resource_type": { + "description": "Type of resource.", + "type": "string" + } + } + }, + "SelfAccessReviewRequest": { + "description": "Representation of an access review performed against oneself", + "properties": { + "action": { + "description": "Indicates the action, one of: [get,list,create,delete,update]", + "type": "string" + }, + "cluster_id": { + "description": "Indicates which Cluster (internal id) the resource type belongs to", + "type": "string" + }, + "cluster_uuid": { + "description": "Indicates which Cluster (external id) the resource type belongs to", + "type": "string" + }, + "organization_id": { + "description": "Indicates which Organization the resource type belongs to", + "type": "string" + }, + "resource_type": { + "description": "Indicates the type of the resource an action would be taken on.\nSee uhc-account-manager/openapi/openapi.yaml for a list of possible values", + "type": "string" + }, + "subscription_id": { + "description": "Indicates which Subscription the resource type belongs to", + "type": "string" + } + } + }, + "SelfAccessReviewResponse": { + "description": "Representation of an access review response, performed against oneself", + "properties": { + "action": { + "description": "Indicates the action, one of: [get,list,create,delete,update].", + "type": "string" + }, + "allowed": { + "description": "Defines whether the action on the specified resource type is allowed.", + "type": "boolean" + }, + "cluster_id": { + "description": "Indicates which Cluster (internal id) the resource type belongs to.", + "type": "string" + }, + "cluster_uuid": { + "description": "Indicates which Cluster (external id) the resource type belongs to.", + "type": "string" + }, + "is_ocm_internal": { + "description": "Defines whether an account is ocm internal.", + "type": "boolean" + }, + "organization_id": { + "description": "Indicates which Organization the resource type belongs to.", + "type": "string" + }, + "reason": { + "description": "Defines further context for the value in allowed (if applicable).", + "type": "string" + }, + "resource_type": { + "description": "Indicates the type of the resource an action would be taken on.\nSee uhc-account-manager/openapi/openapi.yaml for a list of possible values.", + "type": "string" + }, + "subscription_id": { + "description": "Indicates which Subscription the resource type belongs to.", + "type": "string" + } + } + }, + "SelfCapabilityReviewRequest": { + "description": "Representation of a capability review.", + "properties": { + "account_username": { + "description": "Defines the username of the account of which capability is being reviewed.", + "type": "string" + }, + "capability": { + "description": "Capability to review [manage_cluster_admin].", + "type": "string" + }, + "cluster_id": { + "description": "Indicates which Cluster (internal id) the resource type belongs to.", + "type": "string" + }, + "organization_id": { + "description": "Indicates which Organization the resource type belongs to.", + "type": "string" + }, + "resource_type": { + "description": "Indicates the type of the resource.\nSee uhc-account-manager/openapi/openapi.yaml for a list of possible values.", + "type": "string" + }, + "subscription_id": { + "description": "Indicates which Subscription the resource type belongs to.", + "type": "string" + }, + "type": { + "description": "Type of capability [Cluster].", + "type": "string" + } + } + }, + "SelfCapabilityReviewResponse": { + "description": "Representation of a capability review response.", + "properties": { + "result": { + "type": "string" + } + } + }, + "SelfFeatureReviewRequest": { + "description": "Representation of a feature review performed against oneself", + "properties": { + "feature": { + "description": "Indicates the feature which can be toggled", + "type": "string" + } + } + }, + "SelfFeatureReviewResponse": { + "description": "Representation of a feature review response, performed against oneself", + "properties": { + "enabled": { + "description": "Defines whether the feature can be toggled", + "type": "boolean" + }, + "feature_id": { + "description": "Defines the feature id which can be toggled", + "type": "string" + } + } + }, + "SelfTermsReviewRequest": { + "description": "Representation of Red Hat's Terms and Conditions for using OpenShift Dedicated and Amazon Red Hat OpenShift [Terms]\nreview requests.", + "properties": { + "event_code": { + "description": "Defines the event code of the terms being checked", + "type": "string" + }, + "site_code": { + "description": "Defines the site code of the terms being checked", + "type": "string" + } + } + }, + "SubscriptionStatus": { + "type": "string", + "enum": [ + "active", + "archived", + "deprovisioned", + "disconnected", + "reserved", + "stale" + ] + }, + "TermsReviewRequest": { + "description": "Representation of Red Hat's Terms and Conditions for using OpenShift Dedicated and Amazon Red Hat OpenShift [Terms]\nreview requests.", + "properties": { + "account_username": { + "description": "Defines the username of the account of which Terms is being reviewed.", + "type": "string" + }, + "check_optional_terms": { + "description": "If false, only `terms_required` will be checked", + "type": "boolean" + }, + "event_code": { + "description": "Defines the event code of the terms being checked", + "type": "string" + }, + "site_code": { + "description": "Defines the site code of the terms being checked", + "type": "string" + } + } + }, + "TermsReviewResponse": { + "description": "Representation of Red Hat's Terms and Conditions for using OpenShift Dedicated and Amazon Red Hat OpenShift [Terms]\nreview response.", + "properties": { + "account_id": { + "description": "Account ID of requesting user.", + "type": "string" + }, + "organization_id": { + "description": "Indicates which Organization the user belongs to.", + "type": "string" + }, + "redirect_url": { + "description": "Optional URL to Red Hat's Terms and Conditions Application if the user has either required or available Terms\nneeds to acknowledge.", + "type": "string" + }, + "terms_available": { + "description": "Defines whether Terms are available.", + "type": "boolean" + }, + "terms_required": { + "description": "Defines whether user is required to accept Terms before using OpenShift Dedicated and Amazon Red Hat OpenShift.", + "type": "boolean" + } + } + }, + "Error": { + "type": "object", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will always be 'Error'", + "type": "string" + }, + "id": { + "description": "Numeric identifier of the error.", + "type": "integer", + "format": "int32" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "description": "Globally unique code of the error, composed of the unique identifier of the API and the numeric identifier of the error. For example, for if the numeric identifier of the error is `93` and the identifier of the API is `clusters_mgmt` then the code will be `CLUSTERS-MGMT-93`.", + "type": "string" + }, + "reason": { + "description": "Human readable description of the error.", + "type": "string" + }, + "details": { + "description": "Extra information about the error.", + "type": "object", + "additionalProperties": true + } + } + } + }, + "securitySchemes": { + "bearer": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "security": [ + { + "bearer": [ + + ] + } + ] +} \ No newline at end of file diff --git a/openapi/clusters_mgmt/v1/openapi.json b/openapi/clusters_mgmt/v1/openapi.json new file mode 100644 index 00000000..f28d8fbd --- /dev/null +++ b/openapi/clusters_mgmt/v1/openapi.json @@ -0,0 +1,19291 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "v1", + "title": "clusters_mgmt", + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + }, + "contact": { + "name": "OCM Feedback", + "email": "ocm-feedback@redhat.com" + } + }, + "servers": [ + { + "description": "Production", + "url": "https://api.openshift.com" + }, + { + "description": "Stage", + "url": "https://api.stage.openshift.com" + } + ], + "paths": { + "/api/clusters_mgmt/v1": { + "get": { + "description": "Retrieves the version metadata.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Metadata" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/addons": { + "post": { + "description": "Create a new add-on and add it to the collection of add-ons.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOn" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOn" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of add-ons.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the add-on instead of\nthe names of the columns of a table. For example, in order to sort the add-ons\ndescending by name the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the add-on instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nadd-ons with a name starting with `my` the value should be:\n\n```sql\nname like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the add-ons\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of add-ons.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOn" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/addons/{addon_id}": { + "delete": { + "description": "Deletes the add-on.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the add-on.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOn" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the add-on.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOn" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOn" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/addons/{addon_id}/versions": { + "post": { + "description": "Create a new add-on version and add it to the collection of add-ons.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOnVersion" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOnVersion" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of add-on versions.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the add-on instead of\nthe names of the columns of a table. For example, in order to sort the add-on\nversions descending by id the value should be:\n\n```sql\nid desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the add-on version instead\nof the names of the columns of a table. For example, in order to retrieve all the\nadd-on versions with an id starting with `0.1` the value should be:\n\n```sql\nid like '0.1.%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the add-on\nversions that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of add-on versions.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnVersion" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/addons/{addon_id}/versions/{version_id}": { + "delete": { + "description": "Deletes the add-on version.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "version_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the add-on version.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "version_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOnVersion" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the add-on version.", + "parameters": [ + { + "name": "addon_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "version_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOnVersion" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOnVersion" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/aws_infrastructure_access_roles": { + "get": { + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the role instead of\nthe names of the columns of a table. For example, in order to sort the roles\ndescending by dislay_name the value should be:\n\n```sql\ndisplay_name desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the role instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nrole with a name starting with `my`the value should be:\n\n```sql\ndisplay_name like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the roles\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of roles.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AWSInfrastructureAccessRole" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/aws_infrastructure_access_roles/{aws_infrastructure_access_role_id}": { + "get": { + "description": "Retrieves the details of the aws infrastructure access role.", + "parameters": [ + { + "name": "aws_infrastructure_access_role_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AWSInfrastructureAccessRole" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/aws_inquiries/machine_types": { + "post": { + "description": "Retrieves the list of machine types in the provided region.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudProviderData" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of machine types.", + "type": "array", + "items": { + "$ref": "#/components/schemas/MachineType" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/aws_inquiries/oidc_thumbprint": { + "post": { + "description": "Fetches/creates an OIDC Config Thumbprint from either a cluster ID, or an oidc config ID.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OidcThumbprintInput" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OidcThumbprint" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/aws_inquiries/regions": { + "post": { + "description": "Retrieves the list of available regions of the cloud provider.\nIMPORTANT: This list doesn't currently support paging or searching, so the returned\n`page` will always be 1 and `size` and `total` will always be the total number of available regions\nof the provider.", + "parameters": [ + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nregions of the provider.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudProviderData" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of regions.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudRegion" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nregions of the provider.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of available regions of the provider.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/aws_inquiries/sts_account_roles": { + "post": { + "parameters": [ + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nbe the total number of STS account roles.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AWS" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "aws_account_id": { + "description": "The AWS Account Id for the STS Account Roles", + "type": "string" + }, + "items": { + "description": "Retrieved list of STS Account Roles", + "type": "array", + "items": { + "$ref": "#/components/schemas/AWSSTSAccountRole" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nbe the total number of STS account roles.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of STS account roles", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/aws_inquiries/sts_credential_requests": { + "get": { + "description": "Retrieves the list of policies.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of CredRequest.", + "type": "array", + "items": { + "$ref": "#/components/schemas/STSCredentialRequest" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/aws_inquiries/sts_policies": { + "get": { + "description": "Retrieves the list of policies.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the awsstspolicies instead of\nthe names of the columns of a table. For example, in order to sort the policies\ndescending by operator type identifier the value should be:\n\n```sql\norderBy id desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the awsstspolicies instead of\nthe names of the columns of a table. For example, in order to retrieve all the\npolicies of type `operatorrole`\nshould be:\n\n```sql\npolicy_type like 'OperatorRole%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\npolicies will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of policies.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AWSSTSPolicy" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/aws_inquiries/validate_credentials": { + "post": { + "description": "Manages aws creds validation.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudProviderData" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudProviderData" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/aws_inquiries/vpcs": { + "post": { + "description": "Retrieves the list of available vpcs of the cloud provider for specific region.\nIMPORTANT: This collection doesn't currently support paging or searching, so the returned\n`page` will always be 1 and `size` and `total` will always be the total number of available vpcs\nof the provider.", + "parameters": [ + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nvpcs of the provider.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudProviderData" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of cloud VPC.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudVPC" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nvpcs of the provider.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of available vpcs of the provider.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/cloud_providers": { + "get": { + "description": "Retrieves the list of cloud providers.", + "parameters": [ + { + "name": "fetchRegions", + "description": "If true, includes the regions on each provider in the output. Could slow request response time.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the cloud provider\ninstead of the names of the columns of a table. For example, in order to sort the\nclusters descending by name identifier the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the cloud provider\ninstead of the names of the columns of a table. For example, in order to retrieve\nall the cloud providers with a name starting with `A` the value should be:\n\n```sql\nname like 'A%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the clusters\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of cloud providers.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudProvider" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/cloud_providers/{cloud_provider_id}": { + "get": { + "description": "Retrieves the details of the cloud provider.", + "parameters": [ + { + "name": "cloud_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudProvider" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/cloud_providers/{cloud_provider_id}/available_regions": { + "post": { + "description": "Retrieves the list of available regions of the cloud provider.\n\nIMPORTANT: This collection doesn't currently support paging or searching, so the returned\n`page` will always be 1 and `size` and `total` will always be the total number of available regions\nof the provider.", + "parameters": [ + { + "name": "cloud_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nregions of the provider.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AWS" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of cloud regions.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudRegion" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nregions of the provider.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of available regions of the provider.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/cloud_providers/{cloud_provider_id}/regions": { + "post": { + "description": "Adds a cloud region to the database.", + "parameters": [ + { + "name": "cloud_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudRegion" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudRegion" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of regions of the cloud provider.\n\nIMPORTANT: This collection doesn't currently support paging or searching, so the returned\n`page` will always be 1 and `size` and `total` will always be the total number of regions\nof the provider.", + "parameters": [ + { + "name": "cloud_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nregions of the provider.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of cloud providers.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudRegion" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nregions of the provider.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of regions of the provider.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/cloud_providers/{cloud_provider_id}/regions/{region_id}": { + "delete": { + "description": "Deletes the region.", + "parameters": [ + { + "name": "cloud_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "region_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the region.", + "parameters": [ + { + "name": "cloud_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "region_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudRegion" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the region.", + "parameters": [ + { + "name": "cloud_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "region_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudRegion" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudRegion" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters": { + "post": { + "description": "Provision a new cluster and add it to the collection of clusters.\n\nSee the `register_cluster` method for adding an existing cluster.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Cluster" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Cluster" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of clusters.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the cluster instead of\nthe names of the columns of a table. For example, in order to sort the clusters\ndescending by region identifier the value should be:\n\n```sql\nregion.id desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the cluster instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nclusters with a name starting with `my` in the `us-east-1` region the value\nshould be:\n\n```sql\nname like 'my%' and region.id = 'us-east-1'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nclusters that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of clusters.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Cluster" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}": { + "delete": { + "description": "Deletes the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "best_effort", + "description": "BestEffort flag is used to check if the cluster deletion should be best-effort mode or not.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "deprovision", + "description": "If false it will only delete from OCM but not the actual cluster resources.\nfalse is only allowed for OCP clusters. true by default.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "dry_run", + "description": "Dry run flag is used to check if the operation can be completed, but won't delete.", + "in": "query", + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Cluster" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Cluster" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Cluster" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/hibernate": { + "post": { + "description": "Initiates cluster hibernation. While hibernating a cluster will not consume any cloud provider infrastructure\nbut will be counted for quota.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/resume": { + "post": { + "description": "Resumes from Hibernation.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/addon_inquiries": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the add-on instead of\nthe names of the columns of a table. For example, in order to sort the add-ons\ndescending by name the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the add-on instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nadd-ons with a name starting with `my` the value should be:\n\n```sql\nname like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the add-ons\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of add-ons.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOn" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/addon_inquiries/{addon_inquiry_id}": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addon_inquiry_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOn" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/addon_upgrade_policies": { + "post": { + "description": "Adds a new addon upgrade policy to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonUpgradePolicy" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonUpgradePolicy" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of addon upgrade policies.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of addon upgrade policy.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddonUpgradePolicy" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/addon_upgrade_policies/{addon_upgrade_policy_id}": { + "delete": { + "description": "Deletes the addon upgrade policy.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addon_upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the addon upgrade policy.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addon_upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonUpgradePolicy" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Update the addon upgrade policy.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addon_upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonUpgradePolicy" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonUpgradePolicy" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/addon_upgrade_policies/{addon_upgrade_policy_id}/state": { + "get": { + "description": "Retrieves the details of the upgrade policy state.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addon_upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonUpgradePolicyState" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Update the upgrade policy state.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addon_upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonUpgradePolicyState" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddonUpgradePolicyState" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/addons": { + "post": { + "description": "Create a new add-on installation and add it to the collection of add-on installations on the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOnInstallation" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOnInstallation" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of add-on installations.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the add-on installation\ninstead of the names of the columns of a table. For example, in order to sort the\nadd-on installations descending by name the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the add-on installation\ninstead of the names of the columns of a table. For example, in order to retrieve\nall the add-on installations with a name starting with `my` the value should be:\n\n```sql\nname like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the add-on\ninstallations that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of add-on installations.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnInstallation" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/addons/{addoninstallation_id}": { + "delete": { + "description": "Delete an add-on installation and remove it from the collection of add-on installations on the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addoninstallation_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the add-on installation.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addoninstallation_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOnInstallation" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the add-on installation.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "addoninstallation_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOnInstallation" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOnInstallation" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/autoscaler": { + "delete": { + "description": "Deletes the cluster autoscaler.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the autoscaler of a cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterAutoscaler" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "post": { + "description": "Creates a new cluster autoscaler object.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterAutoscaler" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterAutoscaler" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the cluster autoscaler.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterAutoscaler" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterAutoscaler" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/aws/private_link_configuration": { + "get": { + "description": "Retrieves the details of the configuration for the Private Link.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PrivateLinkConfiguration" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/aws/private_link_configuration/principals": { + "post": { + "description": "Adds a new principal for the Private Link.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PrivateLinkPrincipal" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PrivateLinkPrincipal" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of principals.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the role binding\ninstead of the names of the columns of a table. For example, in order to\nretrieve role bindings with role_id AuthenticatedUser:\n\n```sql\nrole_id = 'AuthenticatedUser'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of principals.", + "type": "array", + "items": { + "$ref": "#/components/schemas/PrivateLinkPrincipal" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/aws/private_link_configuration/principals/{principal_id}": { + "delete": { + "description": "Deletes the principal.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "principal_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the principal.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "principal_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PrivateLinkPrincipal" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/aws/role_policy_bindings": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "fetchCurrent", + "description": "If true, retrieves role policy binding states from AWS.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of role policy bindings.", + "type": "array", + "items": { + "$ref": "#/components/schemas/RolePolicyBinding" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/aws_infrastructure_access_role_grants": { + "post": { + "description": "Create a new AWS infrastructure access role grant and add it to the collection of\nAWS infrastructure access role grants on the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AWSInfrastructureAccessRoleGrant" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AWSInfrastructureAccessRoleGrant" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of AWS infrastructure access role grants.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the AWS infrastructure access role grant\ninstead of the names of the columns of a table. For example, in order to sort the\nAWS infrastructure access role grants descending by user ARN the value should be:\n\n```sql\nuser_arn desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the AWS infrastructure access role grant\ninstead of the names of the columns of a table. For example, in order to retrieve\nall the AWS infrastructure access role grants with a user ARN starting with `user` the value should be:\n\n```sql\nuser_arn like '%user'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the AWS\ninfrastructure access role grants that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of AWS infrastructure access role grants.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AWSInfrastructureAccessRoleGrant" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/aws_infrastructure_access_role_grants/{aws_infrastructure_access_role_grant_id}": { + "delete": { + "description": "Deletes the AWS infrastructure access role grant.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "aws_infrastructure_access_role_grant_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the AWS infrastructure access role grant.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "aws_infrastructure_access_role_grant_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AWSInfrastructureAccessRoleGrant" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/break_glass_credentials": { + "post": { + "description": "Adds a new break glass credential to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BreakGlassCredential" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BreakGlassCredential" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "delete": { + "description": "Revokes all the break glass certificates signed by a specific signer.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of break glass credentials.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the break glass credentials\ninstead of the the names of the columns of a table. For example, in order to sort the\ncredentials descending by identifier the value should be:\n\n```sql\nid desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the break glass credentials\ninstead of the names of the columns of a table. For example, in order to retrieve all\nthe credentials with a specific username and status the following is required:\n\n```sql\nusername='user1' AND status='expired'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nbreak glass credentials that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of break glass credentials.", + "type": "array", + "items": { + "$ref": "#/components/schemas/BreakGlassCredential" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/break_glass_credentials/{break_glass_credential_id}": { + "get": { + "description": "Retrieves the details of the break glass credential.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "break_glass_credential_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BreakGlassCredential" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/clusterdeployment": { + "delete": { + "description": "Deletes the clusterdeployment.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/control_plane/upgrade_policies": { + "post": { + "description": "Adds a new upgrade policy to the control plane of the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ControlPlaneUpgradePolicy" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ControlPlaneUpgradePolicy" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of upgrade policies for the control plane.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of upgrade policy.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ControlPlaneUpgradePolicy" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/control_plane/upgrade_policies/{control_plane_upgrade_policy_id}": { + "delete": { + "description": "Deletes the upgrade policy for the control plane.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "control_plane_upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the upgrade policy for the control plane.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "control_plane_upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ControlPlaneUpgradePolicy" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Update the upgrade policy for the control plane.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "control_plane_upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ControlPlaneUpgradePolicy" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ControlPlaneUpgradePolicy" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/credentials": { + "get": { + "description": "Retrieves the details of the credentials of a cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterCredentials" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/delete_protection": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteProtection" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteProtection" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteProtection" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/external_auth_config": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExternalAuthConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/external_auth_config/external_auths": { + "post": { + "description": "Adds a new authentication to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExternalAuth" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExternalAuth" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of external authentications.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ExternalAuth" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/external_auth_config/external_auths/{external_auth_id}": { + "delete": { + "description": "Deletes the external authentication.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "external_auth_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of an external authentication.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "external_auth_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExternalAuth" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the external authentication.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "external_auth_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExternalAuth" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExternalAuth" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/external_configuration": { + "get": { + "description": "Retrieves the details of the external configuration.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExternalConfiguration" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/external_configuration/labels": { + "post": { + "description": "Adds a new label to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of labels.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of labels.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/external_configuration/labels/{label_id}": { + "delete": { + "description": "Deletes the label.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the label.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Update the label.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/external_configuration/manifests": { + "post": { + "description": "Adds a new manifest to a cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Manifest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Manifest" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of manifests.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of Manifests.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Manifest" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/external_configuration/manifests/{manifest_id}": { + "delete": { + "description": "Deletes the manifest.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "manifest_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the manifest.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "manifest_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Manifest" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Update the manifest.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "manifest_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Manifest" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Manifest" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/external_configuration/syncsets": { + "post": { + "description": "Adds a new syncset to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Syncset" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Syncset" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of syncsets.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of syncsets.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Syncset" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/external_configuration/syncsets/{syncset_id}": { + "delete": { + "description": "Deletes the syncset.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "syncset_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the syncset.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "syncset_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Syncset" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Update the syncset.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "syncset_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Syncset" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Syncset" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/gate_agreements": { + "post": { + "description": "Adds a new agreed version gate to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionGateAgreement" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionGateAgreement" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of reasons.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of version gate agreement.", + "type": "array", + "items": { + "$ref": "#/components/schemas/VersionGateAgreement" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/gate_agreements/{version_gate_agreement_id}": { + "delete": { + "description": "Deletes the version gate agreement.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "version_gate_agreement_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the version gate agreement.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "version_gate_agreement_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionGateAgreement" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/groups": { + "get": { + "description": "Retrieves the list of groups.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of groups.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Group" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/groups/{group_id}": { + "get": { + "description": "Retrieves the details of the group.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "group_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Group" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/groups/{group_id}/users": { + "post": { + "description": "Adds a new user to the group.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "group_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of users.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "group_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of users.", + "type": "array", + "items": { + "$ref": "#/components/schemas/User" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/groups/{group_id}/users/{user_id}": { + "delete": { + "description": "Deletes the user.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "group_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "user_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the user.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "group_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "user_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/hypershift": { + "get": { + "description": "Retrieves the Hypershift details for a single cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HypershiftConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the Hypershift details for a single cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HypershiftConfig" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HypershiftConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/identity_providers": { + "post": { + "description": "Adds a new identity provider to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IdentityProvider" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IdentityProvider" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of identity providers.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of identity providers.", + "type": "array", + "items": { + "$ref": "#/components/schemas/IdentityProvider" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/identity_providers/{identity_provider_id}": { + "delete": { + "description": "Deletes the identity provider.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "identity_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the identity provider.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "identity_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IdentityProvider" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Update identity provider in the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "identity_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IdentityProvider" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IdentityProvider" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/identity_providers/{identity_provider_id}/htpasswd_users": { + "post": { + "description": "Adds a new user to the _HTPasswd_ file.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "identity_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTPasswdUser" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTPasswdUser" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of _HTPasswd_ IDP users.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "identity_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of users of the IDP.", + "type": "array", + "items": { + "$ref": "#/components/schemas/HTPasswdUser" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/identity_providers/{identity_provider_id}/htpasswd_users/import": { + "post": { + "description": "Adds multiple new users to the _HTPasswd_ file.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "identity_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "List of users to add to the IDP.", + "type": "array", + "items": { + "$ref": "#/components/schemas/HTPasswdUser" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Updated list of users of the IDP.", + "type": "array", + "items": { + "$ref": "#/components/schemas/HTPasswdUser" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/identity_providers/{identity_provider_id}/htpasswd_users/{htpasswd_user_id}": { + "delete": { + "description": "Deletes the user.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "identity_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "htpasswd_user_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the user.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "identity_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "htpasswd_user_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTPasswdUser" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the user's password. The username is not editable", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "identity_provider_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "htpasswd_user_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTPasswdUser" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTPasswdUser" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/inflight_checks": { + "get": { + "description": "Retrieves the list of inflight checks.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of inflight checks.", + "type": "array", + "items": { + "$ref": "#/components/schemas/InflightCheck" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/inflight_checks/{inflight_check_id}": { + "get": { + "description": "Retrieves the details of the inflight check.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "inflight_check_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InflightCheck" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/ingresses": { + "post": { + "description": "Adds a new ingress to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Ingress" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Ingress" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of ingresses.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of ingresses.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Ingress" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates all ingresses", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Ingress" + } + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Ingress" + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/ingresses/{ingress_id}": { + "delete": { + "description": "Deletes the ingress.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "ingress_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the ingress.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "ingress_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Ingress" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the ingress.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "ingress_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Ingress" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Ingress" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/kubelet_config": { + "delete": { + "description": "Deletes the cluster KubeletConfig", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the KubeletConfig for a cluster", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KubeletConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "post": { + "description": "Creates a new cluster KubeletConfig", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KubeletConfig" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KubeletConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the existing cluster KubeletConfig", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KubeletConfig" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KubeletConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/kubelet_configs": { + "post": { + "description": "Adds a new KubeletConfig to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KubeletConfig" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KubeletConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of KubeletConfigs for the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of KubeletConfigs.", + "type": "array", + "items": { + "$ref": "#/components/schemas/KubeletConfig" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/kubelet_configs/{kubelet_config_id}": { + "delete": { + "description": "Deletes the KubeletConfig specified by the id.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "kubelet_config_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the KubeletConfig specified by the id.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "kubelet_config_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KubeletConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the KubeletConfig specified by the id.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "kubelet_config_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KubeletConfig" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KubeletConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/limited_support_reasons": { + "post": { + "description": "Adds a new reason to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LimitedSupportReason" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LimitedSupportReason" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of reasons.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of template.", + "type": "array", + "items": { + "$ref": "#/components/schemas/LimitedSupportReason" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/limited_support_reasons/{limited_support_reason_id}": { + "delete": { + "description": "Deletes the reason.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "limited_support_reason_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the reason.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "limited_support_reason_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LimitedSupportReason" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/logs": { + "get": { + "description": "Retrieves the list of log links.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of log links.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Log" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/logs/install": { + "get": { + "description": "Retrieves the details of the log.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "offset", + "description": "Line offset to start logs from. if 0 retreive entire log.\nIf offset > #lines return an empty log.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "tail", + "description": "Returns the number of tail lines from the end of the log.\nIf there are no line breaks or the number of lines < tail\nreturn the entire log.\nEither 'tail' or 'offset' can be set. Not both. ", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Log" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/logs/uninstall": { + "get": { + "description": "Retrieves the details of the log.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "offset", + "description": "Line offset to start logs from. if 0 retreive entire log.\nIf offset > #lines return an empty log.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "tail", + "description": "Returns the number of tail lines from the end of the log.\nIf there are no line breaks or the number of lines < tail\nreturn the entire log.\nEither 'tail' or 'offset' can be set. Not both. ", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Log" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/machine_pools": { + "post": { + "description": "Adds a new machine pool to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MachinePool" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MachinePool" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of machine pools.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of machine pools.", + "type": "array", + "items": { + "$ref": "#/components/schemas/MachinePool" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/machine_pools/{machine_pool_id}": { + "delete": { + "description": "Deletes the machine pool.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "machine_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the machine pool.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "machine_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MachinePool" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the machine pool.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "machine_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MachinePool" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MachinePool" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/metric_queries/alerts": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AlertsInfo" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/metric_queries/cluster_operators": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterOperatorsInfo" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/metric_queries/cpu_total_by_node_roles_os": { + "get": { + "description": "Retrieves the metrics.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CPUTotalsNodeRoleOSMetricNode" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/metric_queries/nodes": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodesInfo" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/metric_queries/socket_total_by_node_roles_os": { + "get": { + "description": "Retrieves the metrics.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SocketTotalsNodeRoleOSMetricNode" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/migrations": { + "post": { + "description": "Adds a cluster migration to the database.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterMigration" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterMigration" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of cluster migrations.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ClusterMigration" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of migrations of the cluster.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/migrations/{migration_id}": { + "get": { + "description": "Retrieves the details of the cluster migration.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "migration_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterMigration" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/node_pools": { + "post": { + "description": "Adds a new node pool to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePool" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePool" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of node pools.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the node pools instead of\nthe names of the columns of a table. For example, in order to sort the node pools\ndescending by identifier the value should be:\n\n```sql\nid desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the node pools instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nnode pools with replicas of two the following is required:\n\n```sql\nreplicas = 2\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nnode pools that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of node pools.", + "type": "array", + "items": { + "$ref": "#/components/schemas/NodePool" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/node_pools/{node_pool_id}": { + "delete": { + "description": "Deletes the node pool.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the node pool.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePool" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the node pool.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePool" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePool" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/node_pools/{node_pool_id}/upgrade_policies": { + "post": { + "description": "Adds a new upgrade policy to the node pool of the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePoolUpgradePolicy" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePoolUpgradePolicy" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of upgrade policies for the node pool.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of upgrade policy.", + "type": "array", + "items": { + "$ref": "#/components/schemas/NodePoolUpgradePolicy" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/node_pools/{node_pool_id}/upgrade_policies/{node_pool_upgrade_policy_id}": { + "delete": { + "description": "Deletes the upgrade policy for the node pool.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the upgrade policy for the node pool.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePoolUpgradePolicy" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Update the upgrade policy for the node pool.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "node_pool_upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePoolUpgradePolicy" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NodePoolUpgradePolicy" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/provision_shard": { + "delete": { + "description": "Delete the provision shard.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the provision shard.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProvisionShard" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the details of the provision shard.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProvisionShard" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProvisionShard" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/resources": { + "get": { + "description": "Retrieves a list of resources for a cluster in error state", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterResources" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/resources/live": { + "get": { + "description": "Retrieves currently available cluster resources", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterResources" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/status": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterStatus" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/sts_operator_roles": { + "post": { + "description": "Adds a new operator role to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OperatorIAMRole" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OperatorIAMRole" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of operator roles.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of operator roles.", + "type": "array", + "items": { + "$ref": "#/components/schemas/OperatorIAMRole" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/sts_operator_roles/{operator_iam_role_id}": { + "delete": { + "description": "Deletes the operator role.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "operator_iam_role_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/sts_support_jump_role": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StsSupportJumpRole" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/tuning_configs": { + "post": { + "description": "Adds a new tuning config to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TuningConfig" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TuningConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of tuning configs.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of tuning configs.", + "type": "array", + "items": { + "$ref": "#/components/schemas/TuningConfig" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/tuning_configs/{tuning_config_id}": { + "delete": { + "description": "Deletes the tuning config.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "tuning_config_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the tuning config.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "tuning_config_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TuningConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the tuning config.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "tuning_config_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TuningConfig" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TuningConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/upgrade_policies": { + "post": { + "description": "Adds a new upgrade policy to the cluster.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpgradePolicy" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpgradePolicy" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of upgrade policies.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of upgrade policy.", + "type": "array", + "items": { + "$ref": "#/components/schemas/UpgradePolicy" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/upgrade_policies/{upgrade_policy_id}": { + "delete": { + "description": "Deletes the upgrade policy.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the upgrade policy.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpgradePolicy" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Update the upgrade policy.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpgradePolicy" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpgradePolicy" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/upgrade_policies/{upgrade_policy_id}/state": { + "get": { + "description": "Retrieves the details of the upgrade policy state.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpgradePolicyState" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Update the upgrade policy state.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "upgrade_policy_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpgradePolicyState" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpgradePolicyState" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/clusters/{cluster_id}/vpc": { + "get": { + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudVPC" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/dns_domains": { + "post": { + "description": "Adds a DNS domain.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DNSDomain" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DNSDomain" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the dns domain instead of\nthe names of the columns of a table. For example, in order to retrieve all the\ndns domains with a ID starting with `02a5` should be:\n\n```sql\nid like '02a5%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\ndns domains that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved a list of DNS domains.", + "type": "array", + "items": { + "$ref": "#/components/schemas/DNSDomain" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/dns_domains/{dns_domain_id}": { + "delete": { + "description": "Delete the DNS domain.", + "parameters": [ + { + "name": "dns_domain_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the DNS domain.", + "parameters": [ + { + "name": "dns_domain_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DNSDomain" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/environment": { + "get": { + "description": "Retrieves the details of the environment.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Environment" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the environment.\n\nAttributes that can be updated are:\n\n- `last_upgrade_available_check`\n- `last_limited_support_check`", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Environment" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Environment" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/events": { + "post": { + "description": "Adds a new event to be tracked. When sending a new event request,\nit gets tracked in Prometheus, Pendo, CloudWatch, or whichever\nanalytics client is configured as part of clusters service. This\nallows for reporting on events that happen outside of a regular API\nrequest, but are found to be useful for understanding customer\nneeds and possible blockers.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Event" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Event" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/flavours": { + "get": { + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the flavour instead of\nthe names of the columns of a table. For example, in order to sort the flavours\ndescending by name the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the flavour instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nflavours with a name starting with `my`the value should be:\n\n```sql\nname like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the flavours\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of flavours.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Flavour" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/flavours/{flavour_id}": { + "get": { + "description": "Retrieves the details of the cluster flavour.", + "parameters": [ + { + "name": "flavour_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Flavour" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the flavour.\n\nAttributes that can be updated are:\n\n- `aws.infra_volume`\n- `aws.infra_instance_type`\n- `gcp.infra_instance_type`", + "parameters": [ + { + "name": "flavour_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Flavour" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Flavour" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/gcp/wif_configs": { + "post": { + "description": "Provision a new wif_config resource and add it to the collection of wif_configs.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WifConfig" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WifConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of wif_configs", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the cluster instead of\nthe names of the columns of a table. For example, in order to sort the clusters\ndescending by region identifier the value should be:\n\n```sql\nregion.id desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the cluster instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nclusters with a name starting with `my` in the `us-east-1` region the value\nshould be:\n\n```sql\nname like 'my%' and region.id = 'us-east-1'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nwif_configs that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of wif_configs.", + "type": "array", + "items": { + "$ref": "#/components/schemas/WifConfig" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/gcp/wif_configs/{wif_config_id}": { + "delete": { + "description": "Deletes the wif_config.", + "parameters": [ + { + "name": "wif_config_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "dry_run", + "description": "Dry run flag is used to check if the operation can be completed, but won't delete.", + "in": "query", + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the WifConfig.", + "parameters": [ + { + "name": "wif_config_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WifConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the WifConfig.", + "parameters": [ + { + "name": "wif_config_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WifConfig" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WifConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/gcp/wif_configs/{wif_config_id}/status": { + "get": { + "parameters": [ + { + "name": "wif_config_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WifConfigStatus" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/gcp_inquiries/encryption_keys": { + "post": { + "description": "Retrieves the list of encryption keys.\nIMPORTANT: This collection doesn't currently support paging or searching, so the returned\n`page` will always be 1 and `size` and `total` will always be the total number of available regions\nof the provider.", + "parameters": [ + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nregions of the provider.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudProviderData" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of encryption keys.", + "type": "array", + "items": { + "$ref": "#/components/schemas/EncryptionKey" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nregions of the provider.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of available regions of the provider.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/gcp_inquiries/key_rings": { + "post": { + "description": "Retrieves the list of available key rings of the cloud provider.\nIMPORTANT: This collection doesn't currently support paging or searching, so the returned\n`page` will always be 1 and `size` and `total` will always be the total number of available regions\nof the provider.", + "parameters": [ + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nkey rings of the provider.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudProviderData" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of key rings.", + "type": "array", + "items": { + "$ref": "#/components/schemas/KeyRing" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nkey rings of the provider.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of available key rings of the provider.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/gcp_inquiries/machine_types": { + "post": { + "description": "Retrieves the list of machine types in the provided region.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudProviderData" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of machine types.", + "type": "array", + "items": { + "$ref": "#/components/schemas/MachineType" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/gcp_inquiries/regions": { + "post": { + "description": "Retrieves the list of available regions of the cloud provider.\nIMPORTANT: This list doesn't currently support paging or searching, so the returned\n`page` will always be 1 and `size` and `total` will always be the total number of available regions\nof the provider.", + "parameters": [ + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nregions of the provider.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudProviderData" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of regions.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudRegion" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nregions of the provider.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of available regions of the provider.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/gcp_inquiries/vpcs": { + "post": { + "description": "Retrieves the list of available vpcs of the cloud provider for specific region.\nIMPORTANT: This collection doesn't currently support paging or searching, so the returned\n`page` will always be 1 and `size` and `total` will always be the total number of available vpcs\nof the provider.", + "parameters": [ + { + "name": "page", + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nvpcs of the provider.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudProviderData" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of cloud VPC.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudVPC" + } + }, + "page": { + "description": "Index of the returned page, where one corresponds to the first page. As this\ncollection doesn't support paging the result will always be `1`.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items that will be contained in the returned page. As this collection\ndoesn't support paging or searching the result will always be the total number of\nvpcs of the provider.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page. As this collection doesn't support paging or\nsearching the result will always be the total number of available vpcs of the provider.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/limited_support_reason_templates": { + "get": { + "description": "Retrieves the list of templates.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of template.", + "type": "array", + "items": { + "$ref": "#/components/schemas/LimitedSupportReasonTemplate" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/limited_support_reason_templates/{limited_support_reason_template_id}": { + "get": { + "description": "Retrieves the details of the template.", + "parameters": [ + { + "name": "limited_support_reason_template_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LimitedSupportReasonTemplate" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/load_balancer_quota_values": { + "get": { + "description": "Retrieves the list of Load Balancer Quota Values.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of values.", + "type": "array", + "items": { + "type": "integer", + "format": "int32" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/machine_types": { + "get": { + "description": "Retrieves the list of machine types.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the machine type\ninstead of the names of the columns of a table. For example, in order to sort the\nmachine types descending by name identifier the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the machine type\ninstead of the names of the columns of a table. For example, in order to retrieve\nall the machine types with a name starting with `A` the value should be:\n\n```sql\nname like 'A%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the machine\ntypes that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of cloud providers.", + "type": "array", + "items": { + "$ref": "#/components/schemas/MachineType" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/machine_types/{machine_type_id}": { + "get": { + "description": "Retrieves the details of the machine type.", + "parameters": [ + { + "name": "machine_type_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MachineType" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/network_verifications": { + "post": { + "description": "Creates an entry for a network verification for each subnet supplied setting then to initial state.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NetworkVerification" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NetworkVerification" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/network_verifications/{network_verification_id}": { + "get": { + "description": "Retrieves the details of a subnet network verification.", + "parameters": [ + { + "name": "network_verification_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubnetNetworkVerification" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/oidc_configs": { + "post": { + "description": "Creates a hosting under Red Hat's S3 bucket for byo oidc configuration.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OidcConfig" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OidcConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of oidc configs.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of identity providers.", + "type": "array", + "items": { + "$ref": "#/components/schemas/OidcConfig" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/oidc_configs/{oidc_config_id}": { + "delete": { + "description": "Deletes the OidcConfig.", + "parameters": [ + { + "name": "oidc_config_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of an OidcConfig.", + "parameters": [ + { + "name": "oidc_config_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OidcConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates attributes of an OidcConfig.", + "parameters": [ + { + "name": "oidc_config_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OidcConfig" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OidcConfig" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/pending_delete_clusters": { + "get": { + "description": "Retrieves the list of pending delete clusters.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the pending delete cluster instead of\nthe names of the columns of a table. For example, in order to sort the pending delete clusters\ndescending by creation timestamp (i.e. their deletion time) the value should be:\n\n```sql\ncreation_timestamp desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the pending delete cluster instead of\nthe names of the columns of a table. For example, in order to retrieve all the\npending delete clusters with creation time later than 2023-03-01T00:00:00Z the following is required:\n\n```sql\ncreation_timestamp > '2023-03-01T00:00:00Z'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\npending delete clusters that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of pending delete clusters.", + "type": "array", + "items": { + "$ref": "#/components/schemas/PendingDeleteCluster" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/pending_delete_clusters/{pending_delete_cluster_id}": { + "get": { + "description": "Retrieves the details of the pending delete cluster.", + "parameters": [ + { + "name": "pending_delete_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PendingDeleteCluster" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the pending delete cluster entry.", + "parameters": [ + { + "name": "pending_delete_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PendingDeleteCluster" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PendingDeleteCluster" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/products": { + "get": { + "description": "Retrieves the list of products.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the product instead of\nthe names of the columns of a table. For example, in order to sort the products\ndescending by name the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the product instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nproducts with a name starting with `my` the value should be:\n\n```sql\nname like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the products\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of products.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Product" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/products/{product_id}": { + "get": { + "description": "Retrieves the details of the product.", + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Product" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/products/{product_id}/minimal_versions": { + "get": { + "description": "Retrieves the list of product minimal versions.", + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the product instead of\nthe names of the columns of a table. For example, in order to sort the products\ndescending by name the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the product instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nproducts with a name starting with `my` the value should be:\n\n```sql\nname like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the products\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of product minimal versions.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ProductMinimalVersion" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/products/{product_id}/minimal_versions/{minimal_version_id}": { + "get": { + "description": "Retrieves the details of the product minimal version.", + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "minimal_version_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProductMinimalVersion" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/products/{product_id}/technology_previews": { + "get": { + "description": "Retrieves the list of product technology previews.", + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the product instead of\nthe names of the columns of a table. For example, in order to sort the products\ndescending by name the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the product instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nproducts with a name starting with `my` the value should be:\n\n```sql\nname like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the products\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of product technology previews.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ProductTechnologyPreview" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/products/{product_id}/technology_previews/{technology_preview_id}": { + "get": { + "description": "Retrieves the details of the product technology preview.", + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "technology_preview_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProductTechnologyPreview" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/provision_shards": { + "post": { + "description": "Adds a provision shard.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProvisionShard" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProvisionShard" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the cluster instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nclusters with a name starting with `my` in the `us-east-1` region the value\nshould be:\n\n```sql\nname like 'my%' and region.id = 'us-east-1'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nprovision shards that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved a list of provision shards.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ProvisionShard" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/provision_shards/{provision_shard_id}": { + "delete": { + "description": "Delete the provision shard.", + "parameters": [ + { + "name": "provision_shard_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the provision shard.", + "parameters": [ + { + "name": "provision_shard_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProvisionShard" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "description": "Updates the details of the provision shard.", + "parameters": [ + { + "name": "provision_shard_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProvisionShard" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProvisionShard" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/registry_allowlists": { + "post": { + "description": "Adds a new break registry allowlist.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RegistryAllowlist" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RegistryAllowlist" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of registry allowlists.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the registry allowlists\ninstead of the the names of the columns of a table. For example, in order to sort the\nallowlists descending by identifier the value should be:\n\n```sql\ncreation_timestamp desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the registry allowlists\ninstead of the names of the columns of a table. For example, in order to retrieve all\nthe allowlists with a specific cloud provider and creation time the following is required:\n\n```sql\ncloud_provider.id='aws' and creation_timestamp > '2023-03-01T00:00:00Z'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nregistry allowlists that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of registry allowlists.", + "type": "array", + "items": { + "$ref": "#/components/schemas/RegistryAllowlist" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/registry_allowlists/{registry_allowlist_id}": { + "delete": { + "description": "Deletes the allowlist.", + "parameters": [ + { + "name": "registry_allowlist_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the allowlist.", + "parameters": [ + { + "name": "registry_allowlist_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RegistryAllowlist" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/storage_quota_values": { + "get": { + "description": "Retrieves the list of Storage Quota Values.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of values.", + "type": "array", + "items": { + "$ref": "#/components/schemas/StorageQuota" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/trusted_ip_addresses": { + "get": { + "description": "Retrieves the list of trusted ip addresses.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Number of items contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of trusted ip addresses.", + "type": "array", + "items": { + "$ref": "#/components/schemas/TrustedIp" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Number of items contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/version_gates": { + "post": { + "description": "Adds a new version gate", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionGate" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionGate" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves a list of version gates.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\nan SQL statement, but using the names of the attributes of the version gate instead of\nthe names of the columns of a table. For example, in order to sort the version gates\ndescending by identifier the value should be:\n\n```sql\nid desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of an\nSQL statement, but using the names of the attributes of the version gate instead of\nthe names of the columns of a table.\n\nIf the parameter isn't provided, or if the value is empty, then all the version gates\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.\n\nDefault value is `100`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of version gates.", + "type": "array", + "items": { + "$ref": "#/components/schemas/VersionGate" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.\n\nDefault value is `100`.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/version_gates/{version_gate_id}": { + "delete": { + "description": "Deletes the version gate.", + "parameters": [ + { + "name": "version_gate_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the version gate.", + "parameters": [ + { + "name": "version_gate_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionGate" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/versions": { + "get": { + "description": "Retrieves a list of versions.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement, but using the names of the attributes of the version instead of\nthe names of the columns of a table. For example, in order to sort the versions\ndescending by identifier the value should be:\n\n```sql\nid desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause of a\nSQL statement, but using the names of the attributes of the version instead of\nthe names of the columns of a table. For example, in order to retrieve all the\nversions that are enabled:\n\n```sql\nenabled = 't'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the versions\nthat the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.\n\nDefault value is `100`.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of versions.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Version" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.\n\nDefault value is `100`.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/clusters_mgmt/v1/versions/{version_id}": { + "get": { + "description": "Retrieves the details of the version.", + "parameters": [ + { + "name": "version_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Version" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Metadata": { + "description": "Version metadata.", + "properties": { + "server_version": { + "description": "Version of the server.", + "type": "string" + } + } + }, + "AMIOverride": { + "description": "AMIOverride specifies what Amazon Machine Image should be used for a particular product and region.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AMIOverride' if this is a complete object or 'AMIOverrideLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "ami": { + "description": "AMI is the id of the Amazon Machine Image.", + "type": "string" + }, + "product": { + "description": "Link to the product type.", + "$ref": "#/components/schemas/Product" + }, + "region": { + "description": "Link to the cloud provider region.", + "$ref": "#/components/schemas/CloudRegion" + } + } + }, + "AWS": { + "description": "_Amazon Web Services_ specific settings of a cluster.", + "properties": { + "kms_key_arn": { + "description": "Customer Managed Key to encrypt EBS Volume", + "type": "string" + }, + "sts": { + "description": "Contains the necessary attributes to support role-based authentication on AWS.", + "$ref": "#/components/schemas/STS" + }, + "access_key_id": { + "description": "AWS access key identifier.", + "type": "string" + }, + "account_id": { + "description": "AWS account identifier.", + "type": "string" + }, + "additional_allowed_principals": { + "description": "Additional allowed principal ARNs to be added to the hosted control plane's VPC Endpoint Service.", + "type": "array", + "items": { + "type": "string" + } + }, + "additional_compute_security_group_ids": { + "description": "Additional AWS Security Groups to be added to default worker (compute) machine pool.", + "type": "array", + "items": { + "type": "string" + } + }, + "additional_control_plane_security_group_ids": { + "description": "Additional AWS Security Groups to be added to default control plane machine pool.", + "type": "array", + "items": { + "type": "string" + } + }, + "additional_infra_security_group_ids": { + "description": "Additional AWS Security Groups to be added to default infra machine pool.", + "type": "array", + "items": { + "type": "string" + } + }, + "audit_log": { + "description": "Audit log forwarding configuration", + "$ref": "#/components/schemas/AuditLog" + }, + "billing_account_id": { + "description": "BillingAccountID is the account used for billing subscriptions purchased via the marketplace", + "type": "string" + }, + "ec2_metadata_http_tokens": { + "description": "Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances", + "$ref": "#/components/schemas/Ec2MetadataHttpTokens" + }, + "etcd_encryption": { + "description": "Related etcd encryption configuration", + "$ref": "#/components/schemas/AwsEtcdEncryption" + }, + "hcp_internal_communication_hosted_zone_id": { + "description": "ID of local private hosted zone for hypershift internal communication.", + "type": "string" + }, + "private_hosted_zone_id": { + "description": "ID of private hosted zone.", + "type": "string" + }, + "private_hosted_zone_role_arn": { + "description": "Role ARN for private hosted zone.", + "type": "string" + }, + "private_link": { + "description": "Sets cluster to be inaccessible externally.", + "type": "boolean" + }, + "private_link_configuration": { + "description": "Manages additional configuration for Private Links.", + "$ref": "#/components/schemas/PrivateLinkClusterConfiguration" + }, + "secret_access_key": { + "description": "AWS secret access key.", + "type": "string" + }, + "subnet_ids": { + "description": "The subnet ids to be used when installing the cluster.", + "type": "array", + "items": { + "type": "string" + } + }, + "tags": { + "description": "Optional keys and values that the installer will add as tags to all AWS resources it creates", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "vpc_endpoint_role_arn": { + "description": "Role ARN for VPC Endpoint Service cross account role.", + "type": "string" + } + } + }, + "AWSFlavour": { + "description": "Specification for different classes of nodes inside a flavour.", + "properties": { + "compute_instance_type": { + "description": "AWS default instance type for the worker volume.\n\nUser can be overridden specifying in the cluster itself a type for compute node.", + "type": "string" + }, + "infra_instance_type": { + "description": "AWS default instance type for the infra volume.", + "type": "string" + }, + "infra_volume": { + "description": "Infra volume specification.", + "$ref": "#/components/schemas/AWSVolume" + }, + "master_instance_type": { + "description": "AWS default instance type for the master volume.", + "type": "string" + }, + "master_volume": { + "description": "Master volume specification.", + "$ref": "#/components/schemas/AWSVolume" + }, + "worker_volume": { + "description": "Worker volume specification.", + "$ref": "#/components/schemas/AWSVolume" + } + } + }, + "AWSInfrastructureAccessRole": { + "description": "A set of acces permissions for AWS resources", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AWSInfrastructureAccessRole' if this is a complete object or 'AWSInfrastructureAccessRoleLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "description": { + "description": "Description of the role.", + "type": "string" + }, + "display_name": { + "description": "Human friendly identifier of the role, for example `Read only`.", + "type": "string" + }, + "state": { + "description": "State of the role.", + "$ref": "#/components/schemas/AWSInfrastructureAccessRoleState" + } + } + }, + "AWSInfrastructureAccessRoleGrant": { + "description": "Representation of an AWS infrastructure access role grant.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AWSInfrastructureAccessRoleGrant' if this is a complete object or 'AWSInfrastructureAccessRoleGrantLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "console_url": { + "description": "URL to switch to the role in AWS console.", + "type": "string" + }, + "role": { + "description": "Link to AWS infrastructure access role.\nGrant must use a 'valid' role. ", + "$ref": "#/components/schemas/AWSInfrastructureAccessRole" + }, + "state": { + "description": "State of the grant.", + "$ref": "#/components/schemas/AWSInfrastructureAccessRoleGrantState" + }, + "state_description": { + "description": "Description of the state.\nWill be empty unless state is 'Failed'.", + "type": "string" + }, + "user_arn": { + "description": "The user AWS IAM ARN we want to grant the role.", + "type": "string" + } + } + }, + "AWSInfrastructureAccessRoleGrantState": { + "description": "State of an AWS infrastructure access role grant.", + "type": "string", + "enum": [ + "deleting", + "failed", + "pending", + "ready", + "removed" + ] + }, + "AWSInfrastructureAccessRoleState": { + "description": "State of an AWS infrastructure access role.", + "type": "string", + "enum": [ + "invalid", + "removed", + "valid" + ] + }, + "AWSMachinePool": { + "description": "Representation of aws machine pool specific parameters.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AWSMachinePool' if this is a complete object or 'AWSMachinePoolLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "additional_security_group_ids": { + "description": "Additional AWS Security Groups to be added machine pool. Note that machine pools can only be worker node at the time.", + "type": "array", + "items": { + "type": "string" + } + }, + "availability_zone_types": { + "description": "Associates nodepool availability zones with zone types (e.g. wavelength, local).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "spot_market_options": { + "description": "Use spot instances on this machine pool to reduce cost.", + "$ref": "#/components/schemas/AWSSpotMarketOptions" + }, + "subnet_outposts": { + "description": "Associates nodepool subnets with AWS Outposts.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "tags": { + "description": "Optional keys and values that the machine pool provisioner will add as AWS tags to all AWS resources it creates.\n\nAWS tags must conform to the following standards:\n- Each resource may have a maximum of 25 tags\n- Tags beginning with \"aws:\" are reserved for system use and may not be set\n- Tag keys may be between 1 and 128 characters in length\n- Tag values may be between 0 and 256 characters in length\n- Tags may only contain letters, numbers, spaces, and the following characters: [_ . : / = + - @]", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "AWSNodePool": { + "description": "Representation of aws node pool specific parameters.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AWSNodePool' if this is a complete object or 'AWSNodePoolLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "additional_security_group_ids": { + "description": "Additional AWS Security Groups to be added node pool.", + "type": "array", + "items": { + "type": "string" + } + }, + "availability_zone_types": { + "description": "Associates nodepool availability zones with zone types (e.g. wavelength, local).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "ec2_metadata_http_tokens": { + "description": "Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances", + "$ref": "#/components/schemas/Ec2MetadataHttpTokens" + }, + "instance_profile": { + "description": "InstanceProfile is the AWS EC2 instance profile, which is a container for an IAM role that the EC2 instance uses.", + "type": "string" + }, + "instance_type": { + "description": "InstanceType is an ec2 instance type for node instances (e.g. m5.large).", + "type": "string" + }, + "root_volume": { + "description": "AWS Volume specification to be used to set custom worker disk size", + "$ref": "#/components/schemas/AWSVolume" + }, + "subnet_outposts": { + "description": "Associates nodepool subnets with AWS Outposts.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "tags": { + "description": "Optional keys and values that the installer will add as tags to all AWS resources it creates.\n\nAWS tags must conform to the following standards:\n- Each resource may have a maximum of 25 tags\n- Tags beginning with \"aws:\" are reserved for system use and may not be set\n- Tag keys may be between 1 and 128 characters in length\n- Tag values may be between 0 and 256 characters in length\n- Tags may only contain letters, numbers, spaces, and the following characters: [_ . : / = + - @]", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "AWSShard": { + "description": "Config for AWS provision shards", + "properties": { + "ecr_repository_urls": { + "description": "ECR repository URLs of the provision shard", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "AWSSpotMarketOptions": { + "description": "Spot market options for AWS machine pool.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AWSSpotMarketOptions' if this is a complete object or 'AWSSpotMarketOptionsLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "max_price": { + "description": "The max price for spot instance. Optional.\nIf not set, use the on-demand price.", + "type": "number", + "format": "float" + } + } + }, + "AWSVolume": { + "description": "Holds settings for an AWS storage volume.", + "properties": { + "iops": { + "description": "Volume provisioned IOPS.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Volume size in Gib.", + "type": "integer", + "format": "int32" + } + } + }, + "AWSSTSAccountRole": { + "description": "Representation of an sts account role for a rosa cluster", + "properties": { + "items": { + "description": "The list of STS Roles for this Account Role", + "type": "array", + "items": { + "$ref": "#/components/schemas/AWSSTSRole" + } + }, + "prefix": { + "description": "The Prefix for this Account Role", + "type": "string" + } + } + }, + "AWSSTSPolicy": { + "description": "Representation of an sts policies for rosa cluster", + "properties": { + "arn": { + "description": "The ARN of the managed policy", + "type": "string" + }, + "id": { + "description": "Policy ID", + "type": "string" + }, + "details": { + "description": "Policy Details", + "type": "string" + }, + "type": { + "description": "Type of policy operator/account role", + "type": "string" + } + } + }, + "AWSSTSRole": { + "description": "Representation of an sts role for a rosa cluster", + "properties": { + "hcpManagedPolicies": { + "description": "Does this Role have HCP Managed Policies?", + "type": "boolean" + }, + "isAdmin": { + "description": "Does this role have Admin permission?", + "type": "boolean" + }, + "managedPolicies": { + "description": "Does this Role have Managed Policies?", + "type": "boolean" + }, + "arn": { + "description": "The AWS ARN for this Role", + "type": "string" + }, + "type": { + "description": "The type of this Role", + "type": "string" + }, + "roleVersion": { + "description": "The Openshift Version for this Role", + "type": "string" + } + } + }, + "CCS": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'CCS' if this is a complete object or 'CCSLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "disable_scp_checks": { + "description": "Indicates if cloud permissions checks are disabled,\nwhen attempting installation of the cluster.", + "type": "boolean" + }, + "enabled": { + "description": "Indicates if Customer Cloud Subscription is enabled on the cluster.", + "type": "boolean" + } + } + }, + "CPUTotalNodeRoleOSMetricNode": { + "description": "Representation of information from telemetry about a the CPU capacity by node role and OS.", + "properties": { + "cpu_total": { + "description": "The total CPU capacity of nodes with this set of roles and operating system.", + "type": "number", + "format": "float" + }, + "node_roles": { + "description": "Representation of the node role for a cluster.", + "type": "array", + "items": { + "type": "string" + } + }, + "operating_system": { + "description": "The operating system.", + "type": "string" + }, + "time": { + "type": "string", + "format": "date-time" + } + } + }, + "CPUTotalsNodeRoleOSMetricNode": { + "description": "Representation of information from telemetry about the CPU capacity by node\nrole and OS of a cluster.", + "properties": { + "cpu_totals": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CPUTotalNodeRoleOSMetricNode" + } + } + } + }, + "DNS": { + "description": "DNS settings of the cluster.", + "properties": { + "base_domain": { + "description": "Base DNS domain of the cluster.\n\nDuring the installation of the cluster it is necessary to create multiple DNS records.\nThey will be created as sub-domains of this domain. For example, if the domain_prefix of the\ncluster is `mycluster` and the base domain is `example.com` then the following DNS\nrecords will be created:\n\n```\nmycluster-api.example.com\nmycluster-etcd-0.example.com\nmycluster-etcd-1.example.com\nmycluster-etcd-3.example.com\n```\n\nThe exact number, type and names of the created DNS record depends on the characteristics\nof the cluster, and may be different for different versions of _OpenShift_. Please don't\nrely on them. For example, to find what is the URL of the Kubernetes API server of the\ncluster don't assume that it will be `mycluster-api.example.com`. Instead of that use\nthis API to retrieve the description of the cluster, and get it from the `api.url`\nattribute. For example, if the identifier of the cluster is `123` send a request like\nthis:\n\n```http\nGET /api/clusters_mgmt/v1/clusters/123 HTTP/1.1\n```\n\nThat will return a response like this, including the `api.url` attribute:\n\n```json\n{\n \"kind\": \"Cluster\",\n \"id\": \"123\",\n \"href\": \"/api/clusters_mgmt/v1/clusters/123\",\n \"api\": {\n \"url\": \"https://mycluster-api.example.com:6443\"\n },\n ...\n}\n```\n\nWhen the cluster is created in Amazon Web Services it is necessary to create this base\nDNS domain in advance, using AWS Route53 (https://console.aws.amazon.com/route53).", + "type": "string" + } + } + }, + "DNSDomain": { + "description": "Contains the properties of a DNS domain.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'DNSDomain' if this is a complete object or 'DNSDomainLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "cluster": { + "description": "Link to the cluster that is registered with the DNS domain (optional).", + "$ref": "#/components/schemas/ClusterLink" + }, + "cluster_arch": { + "description": "Signals which cluster architecture the domain is ready for.", + "$ref": "#/components/schemas/ClusterArchitecture" + }, + "organization": { + "description": "Link to the organization that reserved the DNS domain.", + "$ref": "#/components/schemas/OrganizationLink" + }, + "reserved_at_timestamp": { + "description": "Date and time when the DNS domain was reserved.", + "type": "string", + "format": "date-time" + }, + "user_defined": { + "description": "Indicates if this dns domain is user defined.", + "type": "boolean" + } + } + }, + "GCP": { + "description": "Google cloud platform settings of a cluster.", + "properties": { + "auth_uri": { + "description": "GCP authentication uri", + "type": "string" + }, + "auth_provider_x509_cert_url": { + "description": "GCP Authentication provider x509 certificate url", + "type": "string" + }, + "authentication": { + "description": "GCP Authentication Method", + "$ref": "#/components/schemas/GcpAuthentication" + }, + "client_id": { + "description": "GCP client identifier", + "type": "string" + }, + "client_x509_cert_url": { + "description": "GCP client x509 certificate url", + "type": "string" + }, + "client_email": { + "description": "GCP client email", + "type": "string" + }, + "private_key": { + "description": "GCP private key", + "type": "string" + }, + "private_key_id": { + "description": "GCP private key identifier", + "type": "string" + }, + "private_service_connect": { + "description": "GCP PrivateServiceConnect configuration", + "$ref": "#/components/schemas/GcpPrivateServiceConnect" + }, + "project_id": { + "description": "GCP project identifier.", + "type": "string" + }, + "security": { + "description": "GCP Security Settings", + "$ref": "#/components/schemas/GcpSecurity" + }, + "token_uri": { + "description": "GCP token uri", + "type": "string" + }, + "type": { + "description": "GCP the type of the service the key belongs to", + "type": "string" + } + } + }, + "GCPEncryptionKey": { + "description": "GCP Encryption Key for CCS clusters.", + "properties": { + "kms_key_service_account": { + "description": "Service account used to access the KMS key", + "type": "string" + }, + "key_location": { + "description": "Location of the encryption key ring", + "type": "string" + }, + "key_name": { + "description": "Name of the encryption key", + "type": "string" + }, + "key_ring": { + "description": "Name of the key ring the encryption key is located on", + "type": "string" + } + } + }, + "GCPFlavour": { + "description": "Specification for different classes of nodes inside a flavour.", + "properties": { + "compute_instance_type": { + "description": "GCP default instance type for the worker volume.\n\nUser can be overridden specifying in the cluster itself a type for compute node.", + "type": "string" + }, + "infra_instance_type": { + "description": "GCP default instance type for the infra volume.", + "type": "string" + }, + "infra_volume": { + "description": "Infra volume specification.", + "$ref": "#/components/schemas/GCPVolume" + }, + "master_instance_type": { + "description": "GCP default instance type for the master volume.", + "type": "string" + }, + "master_volume": { + "description": "Master volume specification.", + "$ref": "#/components/schemas/GCPVolume" + }, + "worker_volume": { + "description": "Worker volume specification.", + "$ref": "#/components/schemas/GCPVolume" + } + } + }, + "GCPImageOverride": { + "description": "GcpImageOverride specifies what a GCP VM Image should be used for a particular product and billing model", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'GCPImageOverride' if this is a complete object or 'GCPImageOverrideLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "billing_model": { + "description": "Link to the billing model.", + "$ref": "#/components/schemas/BillingModelItem" + }, + "image_id": { + "description": "ImageID is the id of the Google Cloud Platform image.", + "type": "string" + }, + "product": { + "description": "Link to the product type.", + "$ref": "#/components/schemas/Product" + }, + "project_id": { + "description": "ProjectID is the id of the Google Cloud Platform project that hosts the image.", + "type": "string" + } + } + }, + "GCPMachinePool": { + "description": "Representation of gcp machine pool specific parameters.", + "properties": { + "secure_boot": { + "description": "Determines whether the Shielded VM's SecureBoot feature should be\nenabled for the nodes of the machine pool. If SecureBoot is not\nspecified, the value of this attribute will remain unspecified and the\nSecureBoot's value specified in the `.gcp.security.secure_boot`\nattribute of the parent Cluster will be the one applied to the nodes of\nthe machine pool.\nImmutable.", + "type": "boolean" + } + } + }, + "GCPNetwork": { + "description": "GCP Network configuration of a cluster.", + "properties": { + "vpc_name": { + "description": "VPC mame used by the cluster.", + "type": "string" + }, + "vpc_project_id": { + "description": "The name of the host project where the shared VPC exists.", + "type": "string" + }, + "compute_subnet": { + "description": "Compute subnet used by the cluster.", + "type": "string" + }, + "control_plane_subnet": { + "description": "Control plane subnet used by the cluster.", + "type": "string" + } + } + }, + "GCPVolume": { + "description": "Holds settings for an GCP storage volume.", + "properties": { + "size": { + "description": "Volume size in Gib.", + "type": "integer", + "format": "int32" + } + } + }, + "HTPasswdIdentityProvider": { + "description": "Details for `htpasswd` identity providers.", + "properties": { + "password": { + "description": "Password to be used in the _HTPasswd_ data file.", + "type": "string" + }, + "username": { + "description": "Username to be used in the _HTPasswd_ data file.", + "type": "string" + }, + "users": { + "description": "Link to the collection of _HTPasswd_ users.", + "type": "array", + "items": { + "$ref": "#/components/schemas/HTPasswdUser" + } + } + } + }, + "HTPasswdUser": { + "properties": { + "id": { + "description": "ID for a secondary user in the _HTPasswd_ data file.", + "type": "string" + }, + "hashed_password": { + "description": "HTPasswd Hashed Password for a user in the _HTPasswd_ data file.\nThe value of this field is set as-is in the _HTPasswd_ data file for the HTPasswd IDP", + "type": "string" + }, + "password": { + "description": "Password in plain-text for a user in the _HTPasswd_ data file.\nThe value of this field is hashed before setting it in the _HTPasswd_ data file for the HTPasswd IDP", + "type": "string" + }, + "username": { + "description": "Username for a secondary user in the _HTPasswd_ data file.", + "type": "string" + } + } + }, + "LDAPAttributes": { + "description": "LDAP attributes used to configure the LDAP identity provider.", + "properties": { + "id": { + "description": "List of attributes to use as the identity.", + "type": "array", + "items": { + "type": "string" + } + }, + "email": { + "description": "List of attributes to use as the mail address.", + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "description": "List of attributes to use as the display name.", + "type": "array", + "items": { + "type": "string" + } + }, + "preferred_username": { + "description": "List of attributes to use as the preferred user name when provisioning a user.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "LDAPIdentityProvider": { + "description": "Details for `ldap` identity providers.", + "properties": { + "ca": { + "description": "Certificate bundle to use to validate server certificates for the configured URL.", + "type": "string" + }, + "url": { + "description": "An https://tools.ietf.org/html/rfc2255[RFC 2255] URL which specifies the LDAP host and\nsearch parameters to use.", + "type": "string" + }, + "attributes": { + "description": "LDAP attributes used to configure the provider.", + "$ref": "#/components/schemas/LDAPAttributes" + }, + "bind_dn": { + "description": "Optional distinguished name to use to bind during the search phase.", + "type": "string" + }, + "bind_password": { + "description": "Optional password to use to bind during the search phase.", + "type": "string" + }, + "insecure": { + "description": "When `true` no TLS connection is made to the server. When `false` `ldaps://...` URLs\nconnect using TLS and `ldap://...` are upgraded to TLS.", + "type": "boolean" + } + } + }, + "STS": { + "description": "Contains the necessary attributes to support role-based authentication on AWS.", + "properties": { + "oidc_endpoint_url": { + "description": "URL of the location where OIDC configuration and keys are available", + "type": "string" + }, + "auto_mode": { + "description": "Auto creation mode for cluster - OCM will create the operator roles and OIDC provider. false by default.", + "type": "boolean" + }, + "enabled": { + "description": "If STS is enabled or disabled", + "type": "boolean" + }, + "external_id": { + "description": "Optional unique identifier when assuming role in another account", + "type": "string" + }, + "instance_iam_roles": { + "description": "Instance IAM roles to use for the instance profiles of the master and worker instances", + "$ref": "#/components/schemas/InstanceIAMRoles" + }, + "managed_policies": { + "description": "If true, cluster account and operator roles have managed policies attached.", + "type": "boolean" + }, + "oidc_config": { + "description": "Registered Oidc Config, if available holds information related to the oidc config.", + "$ref": "#/components/schemas/OidcConfig" + }, + "operator_iam_roles": { + "description": "List of roles necessary to access the AWS resources of the various operators used during installation", + "type": "array", + "items": { + "$ref": "#/components/schemas/OperatorIAMRole" + } + }, + "operator_role_prefix": { + "description": "Optional user provided prefix for operator roles.", + "type": "string" + }, + "permission_boundary": { + "description": "Optional user provided permission boundary.", + "type": "string" + }, + "role_arn": { + "description": "ARN of the AWS role to assume when installing the cluster", + "type": "string" + }, + "support_role_arn": { + "description": "ARN of the AWS role used by SREs to access the cluster AWS account in order to provide support", + "type": "string" + } + } + }, + "STSCredentialRequest": { + "description": "Representation of an credRequest", + "properties": { + "name": { + "description": "Name of CredRequest", + "type": "string" + }, + "operator": { + "description": "Operator Details", + "$ref": "#/components/schemas/STSOperator" + } + } + }, + "STSOperator": { + "description": "Representation of an sts operator", + "properties": { + "max_version": { + "description": "Maximum ocp version supported", + "type": "string" + }, + "min_version": { + "description": "Minimum ocp version supported", + "type": "string" + }, + "name": { + "description": "Operator Name", + "type": "string" + }, + "namespace": { + "description": "Operator Namespace", + "type": "string" + }, + "service_accounts": { + "description": "Service Accounts", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "AddOn": { + "description": "Representation of an add-on that can be installed in a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddOn' if this is a complete object or 'AddOnLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "common_annotations": { + "description": "Common annotations to be applied to all resources created by this addon.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "common_labels": { + "description": "Common labels to be applied to all resources created by this addon.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "config": { + "description": "Additional configs to be used by the addon once its installed in the cluster.", + "$ref": "#/components/schemas/AddOnConfig" + }, + "credentials_requests": { + "description": "List of credentials requests to authenticate operators to access cloud resources.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CredentialRequest" + } + }, + "description": { + "description": "Description of the add-on.", + "type": "string" + }, + "docs_link": { + "description": "Link to documentation about the add-on.", + "type": "string" + }, + "enabled": { + "description": "Indicates if this add-on can be added to clusters.", + "type": "boolean" + }, + "has_external_resources": { + "description": "Indicates if this add-on has external resources associated with it", + "type": "boolean" + }, + "hidden": { + "description": "Indicates if this add-on is hidden.", + "type": "boolean" + }, + "icon": { + "description": "Base64-encoded icon representing an add-on. The icon should be in PNG format.", + "type": "string" + }, + "install_mode": { + "description": "The mode in which the addon is deployed.", + "$ref": "#/components/schemas/AddOnInstallMode" + }, + "label": { + "description": "Label used to attach to a cluster deployment when add-on is installed.", + "type": "string" + }, + "managed_service": { + "description": "Indicates if add-on is part of a managed service", + "type": "boolean" + }, + "name": { + "description": "Name of the add-on.", + "type": "string" + }, + "namespaces": { + "description": "Namespaces which are required by this addon.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnNamespace" + } + }, + "operator_name": { + "description": "The name of the operator installed by this add-on.", + "type": "string" + }, + "parameters": { + "description": "List of parameters for this add-on.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnParameter" + } + }, + "requirements": { + "description": "List of requirements for this add-on.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnRequirement" + } + }, + "resource_cost": { + "description": "Used to determine how many units of quota an add-on consumes per resource name.", + "type": "number", + "format": "float" + }, + "resource_name": { + "description": "Used to determine from where to reserve quota for this add-on.", + "type": "string" + }, + "sub_operators": { + "description": "List of sub operators for this add-on.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnSubOperator" + } + }, + "target_namespace": { + "description": "The namespace in which the addon CRD exists.", + "type": "string" + }, + "version": { + "description": "Link to the current default version of this add-on.", + "$ref": "#/components/schemas/AddOnVersion" + } + } + }, + "AddOnConfig": { + "description": "Representation of an add-on config.\nThe attributes under it are to be used by the addon once its installed in the cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddOnConfig' if this is a complete object or 'AddOnConfigLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "add_on_environment_variables": { + "description": "List of environment variables for the addon", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnEnvironmentVariable" + } + }, + "secret_propagations": { + "description": "List of secret propagations for the addon", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnSecretPropagation" + } + } + } + }, + "AddOnEnvironmentVariable": { + "description": "Representation of an add-on env object.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddOnEnvironmentVariable' if this is a complete object or 'AddOnEnvironmentVariableLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "name": { + "description": "Name of the env object.", + "type": "string" + }, + "value": { + "description": "Value of the env object.", + "type": "string" + } + } + }, + "AddOnInstallMode": { + "description": "Representation of an add-on InstallMode field.", + "type": "string", + "enum": [ + "all_namespaces", + "own_namespace" + ] + }, + "AddOnInstallation": { + "description": "Representation of an add-on installation in a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddOnInstallation' if this is a complete object or 'AddOnInstallationLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "addon": { + "description": "Link to add-on attached to this cluster.", + "$ref": "#/components/schemas/AddOn" + }, + "addon_version": { + "description": "Link to the installed version of this add-on.", + "$ref": "#/components/schemas/AddOnVersion" + }, + "billing": { + "description": "Billing details for add-on installation resource ", + "$ref": "#/components/schemas/AddOnInstallationBilling" + }, + "creation_timestamp": { + "description": "Date and time when the add-on was initially installed in the cluster.", + "type": "string", + "format": "date-time" + }, + "operator_version": { + "description": "Version of the operator installed by the add-on.", + "type": "string" + }, + "parameters": { + "description": "List of add-on parameters for this add-on installation.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnInstallationParameter" + } + }, + "state": { + "description": "Overall state of the add-on installation.", + "$ref": "#/components/schemas/AddOnInstallationState" + }, + "state_description": { + "description": "Reason for the current State.", + "type": "string" + }, + "updated_timestamp": { + "description": "Date and time when the add-on installation information was last updated.", + "type": "string", + "format": "date-time" + } + } + }, + "AddOnInstallationBilling": { + "description": "Representation of an add-on installation billing.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddOnInstallationBilling' if this is a complete object or 'AddOnInstallationBillingLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "billing_marketplace_account": { + "description": "Account ID for billing market place", + "type": "string" + }, + "billing_model": { + "description": "Billing Model for addon resources", + "$ref": "#/components/schemas/BillingModel" + } + } + }, + "AddOnInstallationParameter": { + "description": "Representation of an add-on installation parameter.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddOnInstallationParameter' if this is a complete object or 'AddOnInstallationParameterLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "value": { + "description": "Value of the parameter.", + "type": "string" + } + } + }, + "AddOnInstallationState": { + "description": "Representation of an add-on installation State field.", + "type": "string", + "enum": [ + "deleting", + "failed", + "installing", + "pending", + "ready" + ] + }, + "AddOnNamespace": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddOnNamespace' if this is a complete object or 'AddOnNamespaceLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "annotations": { + "description": "Annotations to be applied to this namespace.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "labels": { + "description": "Labels to be applied to this namespace.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "description": "Name of the namespace.", + "type": "string" + } + } + }, + "AddOnParameter": { + "description": "Representation of an add-on parameter.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddOnParameter' if this is a complete object or 'AddOnParameterLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "addon": { + "description": "Link to add-on.", + "$ref": "#/components/schemas/AddOn" + }, + "conditions": { + "description": "Conditions in which this parameter is valid for", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnRequirement" + } + }, + "default_value": { + "description": "Indicates the value default for the add-on parameter.", + "type": "string" + }, + "description": { + "description": "Description of the add-on parameter.", + "type": "string" + }, + "editable": { + "description": "Indicates if this parameter can be edited after creation.", + "type": "boolean" + }, + "editable_direction": { + "description": "Restricts if the parameter can be upscaled/downscaled\nExpected values are \"up\", \"down\", or \"\" (no restriction).", + "type": "string" + }, + "enabled": { + "description": "Indicates if this parameter is enabled for the add-on.", + "type": "boolean" + }, + "name": { + "description": "Name of the add-on parameter.", + "type": "string" + }, + "options": { + "description": "List of options for the add-on parameter value.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnParameterOption" + } + }, + "required": { + "description": "Indicates if this parameter is required by the add-on.", + "type": "boolean" + }, + "validation": { + "description": "Validation rule for the add-on parameter.", + "type": "string" + }, + "validation_err_msg": { + "description": "Error message to return should the parameter be invalid.", + "type": "string" + }, + "value_type": { + "description": "Type of value of the add-on parameter.", + "type": "string" + } + } + }, + "AddOnParameterOption": { + "description": "Representation of an add-on parameter option.", + "properties": { + "name": { + "description": "Name of the add-on parameter option.", + "type": "string" + }, + "rank": { + "description": "Rank of option to be used in cases where editable direction should be restricted.", + "type": "integer", + "format": "int32" + }, + "requirements": { + "description": "List of add-on requirements for this parameter option.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnRequirement" + } + }, + "value": { + "description": "Value of the add-on parameter option.", + "type": "string" + } + } + }, + "AddOnRequirement": { + "description": "Representation of an add-on requirement.", + "properties": { + "id": { + "description": "ID of the add-on requirement.", + "type": "string" + }, + "data": { + "description": "Data for the add-on requirement.", + "type": "object", + "additionalProperties": { + "type": "object" + } + }, + "enabled": { + "description": "Indicates if this requirement is enabled for the add-on.", + "type": "boolean" + }, + "resource": { + "description": "Type of resource of the add-on requirement.", + "type": "string" + }, + "status": { + "description": "Optional cluster specific status for the add-on.", + "$ref": "#/components/schemas/AddOnRequirementStatus" + } + } + }, + "AddOnRequirementStatus": { + "description": "Representation of an add-on requirement status.", + "properties": { + "error_msgs": { + "description": "Error messages detailing reasons for unfulfilled requirements.", + "type": "array", + "items": { + "type": "string" + } + }, + "fulfilled": { + "description": "Indicates if this requirement is fulfilled.", + "type": "boolean" + } + } + }, + "AddOnSecretPropagation": { + "description": "Representation of an addon secret propagation", + "properties": { + "id": { + "description": "ID of the secret propagation", + "type": "string" + }, + "destination_secret": { + "description": "DestinationSecret is location of the secret to be added", + "type": "string" + }, + "enabled": { + "description": "Indicates is this secret propagation is enabled for the addon", + "type": "boolean" + }, + "source_secret": { + "description": "SourceSecret is location of the source secret", + "type": "string" + } + } + }, + "AddOnSubOperator": { + "description": "Representation of an add-on sub operator. A sub operator is an operator\nwho's life cycle is controlled by the add-on umbrella operator. ", + "properties": { + "enabled": { + "description": "Indicates if the sub operator is enabled for the add-on", + "type": "boolean" + }, + "operator_name": { + "description": "Name of the add-on sub operator", + "type": "string" + }, + "operator_namespace": { + "description": "Namespace of the add-on sub operator", + "type": "string" + } + } + }, + "AddOnVersion": { + "description": "Representation of an add-on version.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddOnVersion' if this is a complete object or 'AddOnVersionLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "additional_catalog_sources": { + "description": "Additional catalog sources associated with this addon version", + "type": "array", + "items": { + "$ref": "#/components/schemas/AdditionalCatalogSource" + } + }, + "available_upgrades": { + "description": "AvailableUpgrades is the list of versions this version can be upgraded to.", + "type": "array", + "items": { + "type": "string" + } + }, + "channel": { + "description": "The specific addon catalog source channel of packages", + "type": "string" + }, + "config": { + "description": "Additional configs to be used by the addon once its installed in the cluster.", + "$ref": "#/components/schemas/AddOnConfig" + }, + "enabled": { + "description": "Indicates if this add-on version can be added to clusters.", + "type": "boolean" + }, + "package_image": { + "description": "The package image for this addon version", + "type": "string" + }, + "parameters": { + "description": "List of parameters for this add-on version.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnParameter" + } + }, + "pull_secret_name": { + "description": "The pull secret name used for this addon version.", + "type": "string" + }, + "requirements": { + "description": "List of requirements for this add-on version.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnRequirement" + } + }, + "source_image": { + "description": "The catalog source image for this add-on version.", + "type": "string" + }, + "sub_operators": { + "description": "List of sub operators for this add-on version.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnSubOperator" + } + } + } + }, + "AdditionalCatalogSource": { + "description": "Representation of an addon catalog source object used by addon versions.", + "properties": { + "id": { + "description": "ID of the additional catalog source", + "type": "string" + }, + "enabled": { + "description": "Indicates is this additional catalog source is enabled for the addon", + "type": "boolean" + }, + "image": { + "description": "Image of the additional catalog source.", + "type": "string" + }, + "name": { + "description": "Name of the additional catalog source.", + "type": "string" + } + } + }, + "AddonUpgradePolicy": { + "description": "Representation of an upgrade policy that can be set for a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddonUpgradePolicy' if this is a complete object or 'AddonUpgradePolicyLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "addon_id": { + "description": "Addon ID this upgrade policy is defined for", + "type": "string" + }, + "cluster_id": { + "description": "Cluster ID this upgrade policy is defined for.", + "type": "string" + }, + "next_run": { + "description": "Next time the upgrade should run.", + "type": "string", + "format": "date-time" + }, + "schedule": { + "description": "Schedule cron expression that defines automatic upgrade scheduling.", + "type": "string" + }, + "schedule_type": { + "description": "Schedule type can be either \"manual\" (single execution) or \"automatic\" (re-occurring).", + "type": "string" + }, + "upgrade_type": { + "description": "Upgrade type specify the type of the upgrade. Must be \"ADDON\".", + "type": "string" + }, + "version": { + "description": "Version is the desired upgrade version.", + "type": "string" + } + } + }, + "AddonUpgradePolicyState": { + "description": "Representation of an addon upgrade policy state that that is set for a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'AddonUpgradePolicyState' if this is a complete object or 'AddonUpgradePolicyStateLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "description": { + "description": "Description of the state.", + "type": "string" + }, + "value": { + "description": "State value can be 'pending', 'scheduled', 'cancelled', 'started', 'delayed',\n'failed' or 'completed'.", + "$ref": "#/components/schemas/UpgradePolicyStateValue" + } + } + }, + "AdminCredentials": { + "description": "Temporary administrator credentials generated during the installation of the\ncluster.", + "properties": { + "password": { + "description": "Cluster administrator password.", + "type": "string" + }, + "user": { + "description": "Cluster administrator user name.", + "type": "string" + } + } + }, + "AlertInfo": { + "description": "Provides information about a single alert firing on the cluster.", + "properties": { + "name": { + "description": "The alert name. Multiple alerts with same name are possible.", + "type": "string" + }, + "severity": { + "description": "The alert severity.", + "$ref": "#/components/schemas/AlertSeverity" + } + } + }, + "AlertSeverity": { + "description": "Severity of a cluster alert received via telemetry.", + "type": "string", + "enum": [ + "critical", + "none", + "warning" + ] + }, + "AlertsInfo": { + "description": "Provides information about the alerts firing on the cluster.", + "properties": { + "alerts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AlertInfo" + } + } + } + }, + "AuditLog": { + "description": "Contains the necessary attributes to support audit log forwarding", + "properties": { + "role_arn": { + "description": "ARN of the CloudWatch audit log forwarding role", + "type": "string" + } + } + }, + "AutoscalerResourceLimits": { + "properties": { + "gpus": { + "description": "Minimum and maximum number of different GPUs in cluster, in the format ::.\nCluster autoscaler will not scale the cluster beyond these numbers. Can be passed multiple times.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AutoscalerResourceLimitsGPULimit" + } + }, + "cores": { + "description": "Minimum and maximum number of cores in cluster, in the format :.\nCluster autoscaler will not scale the cluster beyond these numbers.", + "$ref": "#/components/schemas/ResourceRange" + }, + "max_nodes_total": { + "description": "Maximum number of nodes in all node groups.\nCluster autoscaler will not grow the cluster beyond this number.", + "type": "integer", + "format": "int32" + }, + "memory": { + "description": "Minimum and maximum number of gigabytes of memory in cluster, in the format :.\nCluster autoscaler will not scale the cluster beyond these numbers.", + "$ref": "#/components/schemas/ResourceRange" + } + } + }, + "AutoscalerResourceLimitsGPULimit": { + "properties": { + "range": { + "$ref": "#/components/schemas/ResourceRange" + }, + "type": { + "description": "The type of GPU to associate with the minimum and maximum limits.\nThis value is used by the Cluster Autoscaler to identify Nodes that will have GPU capacity by searching\nfor it as a label value on the Node objects. For example, Nodes that carry the label key\n`cluster-api/accelerator` with the label value being the same as the Type field will be counted towards\nthe resource limits by the Cluster Autoscaler.", + "type": "string" + } + } + }, + "AutoscalerScaleDownConfig": { + "properties": { + "delay_after_add": { + "description": "How long after scale up that scale down evaluation resumes.", + "type": "string" + }, + "delay_after_delete": { + "description": "How long after node deletion that scale down evaluation resumes, defaults to scan-interval.", + "type": "string" + }, + "delay_after_failure": { + "description": "How long after scale down failure that scale down evaluation resumes.", + "type": "string" + }, + "enabled": { + "description": "Should cluster-autoscaler scale down the cluster.", + "type": "boolean" + }, + "unneeded_time": { + "description": "How long a node should be unneeded before it is eligible for scale down.", + "type": "string" + }, + "utilization_threshold": { + "description": "Node utilization level, defined as sum of requested resources divided by capacity, below which a node can be considered for scale down.", + "type": "string" + } + } + }, + "AwsEtcdEncryption": { + "description": "Contains the necessary attributes to support etcd encryption for AWS based clusters.", + "properties": { + "kms_key_arn": { + "description": "ARN of the KMS to be used for the etcd encryption", + "type": "string" + } + } + }, + "Azure": { + "description": "Microsoft Azure settings of a cluster.", + "properties": { + "managed_resource_group_name": { + "description": "The desired name of the Azure Resource Group where the Azure Resources related\nto the cluster are created. It must not previously exist. The Azure Resource\nGroup is created with the given value, within the Azure Subscription\n`subscription_id` of the cluster.\n`managed_resource_group_name` cannot be equal to the value of `managed_resource_group`.\n`managed_resource_group_name` is located in the same Azure location as the\ncluster's region.\nNot to be confused with `resource_group_name`, which is the Azure Resource Group Name\nwhere the own Azure Resource associated to the cluster resides.\nRequired during creation.\nImmutable.", + "type": "string" + }, + "network_security_group_resource_id": { + "description": "The Azure Resource ID of a pre-existing Azure Network Security Group.\nThe Network Security Group specified in network_security_group_resource_id\nmust already be associated to the Azure Subnet `subnet_resource_id`.\nIt is the Azure Network Security Group associated to the cluster's subnet\nspecified in `subnet_resource_id`.\n`network_security_group_resource_id` must be located in the same Azure\nlocation as the cluster's region.\nThe Azure Subscription specified as part of\n`network_security_group_resource_id` must be located in the same Azure\nSubscription as `subscription_id`.\nThe Azure Resource Group Name specified as part of `network_security_group_resource_id`\nmust belong to the Azure Subscription `subscription_id`, and in the same\nAzure location as the cluster's region.\nThe Azure Resource Group Name specified as part of `network_security_group_resource_id`\nmust be a different Resource Group Name than the one specified in\n`managed_resource_group_name`.\nThe Azure Resource Group Name specified as part of `network_security_group_resource_id`\ncan be the same, or a different one than the one specified in\n`resource_group_name`.\nRequired during creation.\nImmutable.", + "type": "string" + }, + "nodes_outbound_connectivity": { + "description": "NodesOutboundConnectivity defines how the network outbound\nconfiguration of the Cluster's Node Pool's Nodes is performed.\nBy default this is configured as Azure Load Balancer. This value is immutable.", + "$ref": "#/components/schemas/AzureNodesOutboundConnectivity" + }, + "operators_authentication": { + "description": "Defines how the operators of the cluster authenticate to Azure.\nRequired during creation.\nImmutable.", + "$ref": "#/components/schemas/AzureOperatorsAuthentication" + }, + "resource_group_name": { + "description": "The Azure Resource Group Name of the cluster. It must be a pre-existing\nAzure Resource Group and it must exist within the Azure Subscription\n`subscription_id` of the cluster.\n`resource_group_name` is located in the same Azure location as the\ncluster's region.\nRequired during creation.\nImmutable.", + "type": "string" + }, + "resource_name": { + "description": "The Azure Resource Name of the cluster. It must be within the\nAzure Resource Group Name `resource_group_name`.\n`resource_name` is located in the same Azure location as the cluster's region.\nRequired during creation.\nImmutable.", + "type": "string" + }, + "subnet_resource_id": { + "description": "The Azure Resource ID of a pre-existing Azure Subnet. It is an Azure\nSubnet used for the Data Plane of the cluster. `subnet_resource_id`\nmust be located in the same Azure location as the cluster's region.\nThe Azure Subscription specified as part of the `subnet_resource_id`\nmust be located in the same Azure Subscription as `subscription_id`.\nThe Azure Resource Group Name specified as part of `subnet_resource_id`\nmust belong to the Azure Subscription `subscription_id`, and in the same\nAzure location as the cluster's region.\nThe Azure Resource Group Name specified as part of `subnet_resource_id`\nmust be a different Resource Group Name than the one specified in\n`managed_resource_group_name`.\nThe Azure Resource Group Name specified as part of the `subnet_resource_id`\ncan be the same, or a different one than the one specified in\n`resource_group_name`.\nRequired during creation.\nImmutable.", + "type": "string" + }, + "subscription_id": { + "description": "The Azure Subscription ID associated with the cluster. It must belong to\nthe Microsoft Entra Tenant ID `tenant_id`.\nRequired during creation.\nImmutable.", + "type": "string" + }, + "tenant_id": { + "description": "The Microsoft Entra Tenant ID where the cluster belongs.\nRequired during creation.\nImmutable.", + "type": "string" + } + } + }, + "AzureControlPlaneManagedIdentity": { + "description": "Represents the information associated to an Azure User-Assigned\nManaged Identity belonging to the Control Plane of the cluster.", + "properties": { + "client_id": { + "description": "The Client ID associated to the Azure User-Assigned Managed Identity.\nReadonly.", + "type": "string" + }, + "principal_id": { + "description": "The Principal ID associated to the Azure User-Assigned Identity.\nReadonly.", + "type": "string" + }, + "resource_id": { + "description": "The Azure Resource ID of the Azure User-Assigned Managed\nIdentity. The managed identity represented must exist before\ncreating the cluster.\nThe Azure Resource Group Name specified as part of the Resource ID\nmust belong to the Azure Subscription specified in `.azure.subscription_id`,\nand in the same Azure location as the cluster's region.\nThe Azure Resource Group Name specified as part of the Resource ID\nmust be a different Resource Group Name than the one specified in\n`.azure.managed_resource_group_name`.\nThe Azure Resource Group Name specified as part of the Resource ID\ncan be the same, or a different one than the one specified in\n`.azure.resource_group_name`.\nRequired during creation.\nImmutable.", + "type": "string" + } + } + }, + "AzureDataPlaneManagedIdentity": { + "description": "Represents the information associated to an Azure User-Assigned\nManaged Identity belonging to the Data Plane of the cluster.", + "properties": { + "resource_id": { + "description": "The Azure Resource ID of the Azure User-Assigned Managed\nIdentity. The managed identity represented must exist before\ncreating the cluster.\nThe Azure Resource Group Name specified as part of the Resource ID\nmust belong to the Azure Subscription specified in `.azure.subscription_id`,\nand in the same Azure location as the cluster's region.\nThe Azure Resource Group Name specified as part of the Resource ID\nmust be a different Resource Group Name than the one specified in\n`.azure.managed_resource_group_name`.\nThe Azure Resource Group Name specified as part of the Resource ID\ncan be the same, or a different one than the one specified in\n`.azure.resource_group_name`.\nRequired during creation.\nImmutable.", + "type": "string" + } + } + }, + "AzureNodePool": { + "description": "Representation of azure node pool specific parameters.", + "properties": { + "os_disk_size_gibibytes": { + "description": "The size in GiB to assign to the OS disks of the\nNodes in the Node Pool. The property\nis the number of bytes x 1024^3.\nIf not specified, OS disk size is 30 GiB.", + "type": "integer", + "format": "int32" + }, + "os_disk_storage_account_type": { + "description": "The disk storage account type to use for the OS disks of the Nodes in the\nNode Pool. Valid values are:\n* Standard_LRS: HDD\n* StandardSSD_LRS: Standard SSD\n* Premium_LRS: Premium SDD\n* UltraSSD_LRS: Ultra SDD\n\nIf not specified, `Premium_LRS` is used.", + "type": "string" + }, + "vm_size": { + "description": "The Azure Virtual Machine size identifier used for the\nNodes of the Node Pool.\nAvailability of VM sizes are dependent on the Azure Location\nof the parent Cluster.\nRequired during creation.", + "type": "string" + }, + "ephemeral_os_disk_enabled": { + "description": "Enables Ephemeral OS Disks for the Nodes in the Node Pool.\nIf not specified, no Ephemeral OS Disks are used.", + "type": "boolean" + }, + "resource_name": { + "description": "ResourceName is the Azure Resource Name of the NodePool.\nResourceName must be within the Azure Resource Group Name of the parent\nCluster it belongs to.\nResourceName must be located in the same Azure Location as the parent\nCluster it belongs to.\nResourceName must be located in the same Azure Subscription as the parent\nCluster it belongs to.\nResourceName must belong to the same Microsoft Entra Tenant ID as the parent\nCluster it belongs to.\nRequired during creation.\nImmutable.", + "type": "string" + } + } + }, + "AzureNodesOutboundConnectivity": { + "description": "The configuration of the node outbound connectivity", + "properties": { + "outbound_type": { + "description": "OutboundType is the type of network outbound configuration.\nThe default and only accepted value is 'load_balancer'.\nThis value is immutable.", + "type": "string" + } + } + }, + "AzureOperatorsAuthentication": { + "description": "The configuration that the operators of the\ncluster have to authenticate to Azure.", + "properties": { + "managed_identities": { + "description": "The authentication configuration to authenticate\nto Azure using Azure User-Assigned Managed Identities.\nRequired during creation.", + "$ref": "#/components/schemas/AzureOperatorsAuthenticationManagedIdentities" + } + } + }, + "AzureOperatorsAuthenticationManagedIdentities": { + "description": "Represents the information related to Azure User-Assigned managed identities\nneeded to perform Operators authentication based on Azure User-Assigned\nManaged Identities", + "properties": { + "control_plane_operators_managed_identities": { + "description": "The set of Azure User-Assigned Managed Identities leveraged for the\nControl Plane operators of the cluster. The set of required managed\nidentities is dependent on the Cluster's OpenShift version.\nImmutable", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/AzureControlPlaneManagedIdentity" + } + }, + "data_plane_operators_managed_identities": { + "description": "The set of Azure User-Assigned Managed Identities leveraged for the\nData Plane operators of the cluster. The set of required managed\nidentities is dependent on the Cluster's OpenShift version.\nImmutable.", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/AzureDataPlaneManagedIdentity" + } + }, + "managed_identities_data_plane_identity_url": { + "description": "The Managed Identities Data Plane Identity URL associated with the\ncluster. It is the URL that will be used to communicate with the\nManaged Identities Resource Provider (MI RP).\nRequired during creation.\nImmutable.", + "type": "string" + }, + "service_managed_identity": { + "description": "The Azure User-Assigned Managed Identity used to perform service\nlevel actions. Specifically:\n- Add Federated Identity Credentials to the identities in\n `data_plane_operators_managed_identities` that belong to Data\n Plane Cluster Operators\n- Perform permissions validation for the BYOVNet related resources\n associated to the Cluster\nRequired during creation.\nImmutable.", + "$ref": "#/components/schemas/AzureServiceManagedIdentity" + } + } + }, + "AzureServiceManagedIdentity": { + "description": "Represents the information associated to an Azure User-Assigned\nManaged Identity whose purpose is to perform service level actions.", + "properties": { + "client_id": { + "description": "The Client ID associated to the Azure User-Assigned Managed Identity.\nReadonly.", + "type": "string" + }, + "principal_id": { + "description": "The Principal ID associated to the Azure User-Assigned Managed Identity.\nReadonly.", + "type": "string" + }, + "resource_id": { + "description": "The Azure Resource ID of the Azure User-Assigned Managed\nIdentity. The managed identity represented must exist before\ncreating the cluster.\nThe Azure Resource Group Name specified as part of the Resource ID\nmust belong to the Azure Subscription specified in `.azure.subscription_id`,\nand in the same Azure location as the cluster's region.\nThe Azure Resource Group Name specified as part of the Resource ID\nmust be a different Resource Group Name than the one specified in\n`.azure.managed_resource_group_name`.\nThe Azure Resource Group Name specified as part of the Resource ID\ncan be the same, or a different one than the one specified in\n`.azure.resource_group_name`.\nRequired during creation.\nImmutable.", + "type": "string" + } + } + }, + "BillingModel": { + "description": "Billing model for cluster resources.", + "type": "string", + "enum": [ + "marketplace", + "marketplace-aws", + "marketplace-gcp", + "marketplace-rhm", + "marketplace-azure", + "standard" + ] + }, + "BillingModelItem": { + "description": "BillingModelItem represents a billing model", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'BillingModelItem' if this is a complete object or 'BillingModelItemLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "billing_model_type": { + "description": "BillingModelType is the type of the BillingModel. e.g. standard, marketplace.", + "type": "string" + }, + "description": { + "description": "Single line description of the billing model.", + "type": "string" + }, + "display_name": { + "description": "User friendly display name of the billing model.", + "type": "string" + }, + "marketplace": { + "description": "Indicates the marketplace of the billing model. e.g. gcp, aws, etc.", + "type": "string" + } + } + }, + "BreakGlassCredential": { + "description": "Representation of a break glass credential.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'BreakGlassCredential' if this is a complete object or 'BreakGlassCredentialLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "expiration_timestamp": { + "description": "ExpirationTimestamp is the date and time when the credential will expire.", + "type": "string", + "format": "date-time" + }, + "kubeconfig": { + "description": "Kubeconfig is the generated kubeconfig for this credential. It is only stored in memory", + "type": "string" + }, + "revocation_timestamp": { + "description": "RevocationTimestamp is the date and time when the credential has been revoked.", + "type": "string", + "format": "date-time" + }, + "status": { + "description": "Status is the status of this credential", + "$ref": "#/components/schemas/BreakGlassCredentialStatus" + }, + "username": { + "description": "Username is the user which will be used for this credential.", + "type": "string" + } + } + }, + "BreakGlassCredentialStatus": { + "description": "Status of the break glass credential.", + "type": "string", + "enum": [ + "awaiting_revocation", + "created", + "expired", + "failed", + "issued", + "revoked" + ] + }, + "ByoOidc": { + "description": "ByoOidc configuration.", + "properties": { + "enabled": { + "description": "Boolean flag indicating if the cluster should be creating using _ByoOidc_.\n\nBy default this is `false`.\n\nTo enable it the cluster needs to be ROSA cluster and the organization of the user needs\nto have the `byo-oidc` feature toggle enabled.", + "type": "boolean" + } + } + }, + "ClientComponent": { + "description": "The reference of a component that will consume the client configuration.", + "properties": { + "name": { + "description": "The name of the component.", + "type": "string" + }, + "namespace": { + "description": "The namespace of the component.", + "type": "string" + } + } + }, + "CloudVPC": { + "description": "Description of a cloud provider virtual private cloud.", + "properties": { + "aws_security_groups": { + "description": "List of AWS security groups with details.", + "type": "array", + "items": { + "$ref": "#/components/schemas/SecurityGroup" + } + }, + "aws_subnets": { + "description": "List of AWS subnetworks with details.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Subnetwork" + } + }, + "cidr_block": { + "description": "CIDR block of the virtual private cloud.", + "type": "string" + }, + "id": { + "description": "ID of virtual private cloud.", + "type": "string" + }, + "name": { + "description": "Name of virtual private cloud according to its `Name` tag on AWS.", + "type": "string" + }, + "red_hat_managed": { + "description": "If the resource is RH managed.", + "type": "boolean" + }, + "subnets": { + "description": "List of subnets used by the virtual private cloud.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CloudProvider": { + "description": "Cloud provider.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'CloudProvider' if this is a complete object or 'CloudProviderLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "display_name": { + "description": "Name of the cloud provider for display purposes. It can contain any characters,\nincluding spaces.", + "type": "string" + }, + "name": { + "description": "Human friendly identifier of the cloud provider, for example `aws`.", + "type": "string" + }, + "regions": { + "description": "(optional) Provider's regions - only included when listing providers with `fetchRegions=true`.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudRegion" + } + } + } + }, + "CloudProviderData": { + "description": "Description of a cloud provider data used for cloud provider inquiries.", + "properties": { + "aws": { + "description": "Amazon Web Services settings.", + "$ref": "#/components/schemas/AWS" + }, + "gcp": { + "description": "Google cloud platform settings.", + "$ref": "#/components/schemas/GCP" + }, + "availability_zones": { + "description": "Availability zone", + "type": "array", + "items": { + "type": "string" + } + }, + "key_location": { + "description": "Key location", + "type": "string" + }, + "key_ring_name": { + "description": "Key ring name", + "type": "string" + }, + "region": { + "description": "Region", + "$ref": "#/components/schemas/CloudRegion" + }, + "subnets": { + "description": "Subnets", + "type": "array", + "items": { + "type": "string" + } + }, + "version": { + "description": "Openshift version", + "$ref": "#/components/schemas/Version" + }, + "vpc_ids": { + "description": "VPC ids", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CloudRegion": { + "description": "Description of a region of a cloud provider.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'CloudRegion' if this is a complete object or 'CloudRegionLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "ccs_only": { + "description": "'true' if the region is supported only for CCS clusters, 'false' otherwise.", + "type": "boolean" + }, + "kms_location_id": { + "description": "(GCP only) Comma-separated list of KMS location IDs that can be used with this region.\nE.g. \"global,nam4,us\". Order is not guaranteed.", + "type": "string" + }, + "kms_location_name": { + "description": "(GCP only) Comma-separated list of display names corresponding to KMSLocationID.\nE.g. \"Global,nam4 (Iowa, South Carolina, and Oklahoma),US\". Order is not guaranteed but will match KMSLocationID.\nUnfortunately, this API doesn't allow robust splitting - Contact ocm-feedback@redhat.com if you want to rely on this.", + "type": "string" + }, + "cloud_provider": { + "description": "Link to the cloud provider that the region belongs to.", + "$ref": "#/components/schemas/CloudProvider" + }, + "display_name": { + "description": "Name of the region for display purposes, for example `N. Virginia`.", + "type": "string" + }, + "enabled": { + "description": "Whether the region is enabled for deploying a managed cluster.", + "type": "boolean" + }, + "govcloud": { + "description": "Whether the region is an AWS GovCloud region.", + "type": "boolean" + }, + "name": { + "description": "Human friendly identifier of the region, for example `us-east-1`.\n\nNOTE: Currently for all cloud providers and all regions `id` and `name` have exactly\nthe same values.", + "type": "string" + }, + "supports_hypershift": { + "description": "'true' if the region is supported for Hypershift deployments, 'false' otherwise.", + "type": "boolean" + }, + "supports_multi_az": { + "description": "Whether the region supports multiple availability zones.", + "type": "boolean" + } + } + }, + "Cluster": { + "description": "Definition of an _OpenShift_ cluster.\n\nThe `cloud_provider` attribute is a reference to the cloud provider. When a\ncluster is retrieved it will be a link to the cloud provider, containing only\nthe kind, id and href attributes:\n\n```json\n{\n \"cloud_provider\": {\n \"kind\": \"CloudProviderLink\",\n \"id\": \"123\",\n \"href\": \"/api/clusters_mgmt/v1/cloud_providers/123\"\n }\n}\n```\n\nWhen a cluster is created this is optional, and if used it should contain the\nidentifier of the cloud provider to use:\n\n```json\n{\n \"cloud_provider\": {\n \"id\": \"123\",\n }\n}\n```\n\nIf not included, then the cluster will be created using the default cloud\nprovider, which is currently Amazon Web Services.\n\nThe region attribute is mandatory when a cluster is created.\n\nThe `aws.access_key_id`, `aws.secret_access_key` and `dns.base_domain`\nattributes are mandatory when creation a cluster with your own Amazon Web\nServices account.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Cluster' if this is a complete object or 'ClusterLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "api": { + "description": "Information about the API of the cluster.", + "$ref": "#/components/schemas/ClusterAPI" + }, + "aws": { + "description": "Amazon Web Services settings of the cluster.", + "$ref": "#/components/schemas/AWS" + }, + "aws_infrastructure_access_role_grants": { + "description": "List of AWS infrastructure access role grants on this cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AWSInfrastructureAccessRoleGrant" + } + }, + "ccs": { + "description": "Contains configuration of a Customer Cloud Subscription cluster.", + "$ref": "#/components/schemas/CCS" + }, + "dns": { + "description": "DNS settings of the cluster.", + "$ref": "#/components/schemas/DNS" + }, + "fips": { + "description": "Create cluster that uses FIPS Validated / Modules in Process cryptographic libraries.", + "type": "boolean" + }, + "gcp": { + "description": "Google cloud platform settings of the cluster.", + "$ref": "#/components/schemas/GCP" + }, + "gcp_encryption_key": { + "description": "Key used for encryption of GCP cluster nodes.", + "$ref": "#/components/schemas/GCPEncryptionKey" + }, + "gcp_network": { + "description": "GCP Network.", + "$ref": "#/components/schemas/GCPNetwork" + }, + "additional_trust_bundle": { + "description": "Additional trust bundle.", + "type": "string" + }, + "addons": { + "description": "List of add-ons on this cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/AddOnInstallation" + } + }, + "autoscaler": { + "description": "Link to an optional _ClusterAutoscaler_ that is coupled with the cluster.", + "$ref": "#/components/schemas/ClusterAutoscaler" + }, + "azure": { + "description": "Microsoft Azure settings of the cluster.", + "$ref": "#/components/schemas/Azure" + }, + "billing_model": { + "description": "Billing model for cluster resources.", + "$ref": "#/components/schemas/BillingModel" + }, + "byo_oidc": { + "description": "Contains information about BYO OIDC.", + "$ref": "#/components/schemas/ByoOidc" + }, + "capabilities": { + "description": "OpenShift Cluster Capabilities configuration", + "$ref": "#/components/schemas/ClusterCapabilities" + }, + "cloud_provider": { + "description": "Link to the cloud provider where the cluster is installed.", + "$ref": "#/components/schemas/CloudProvider" + }, + "console": { + "description": "Information about the console of the cluster.", + "$ref": "#/components/schemas/ClusterConsole" + }, + "creation_timestamp": { + "description": "Date and time when the cluster was initially created, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + }, + "delete_protection": { + "description": "Delete protection", + "$ref": "#/components/schemas/DeleteProtection" + }, + "disable_user_workload_monitoring": { + "description": "Indicates whether the User workload monitoring is enabled or not\nIt is enabled by default", + "type": "boolean" + }, + "domain_prefix": { + "description": "DomainPrefix of the cluster. This prefix is optionally assigned by the user when the\ncluster is created. It will appear in the Cluster's domain when the cluster is provisioned.", + "type": "string" + }, + "etcd_encryption": { + "description": "Indicates whether that etcd is encrypted or not.\nThis is set only during cluster creation.", + "type": "boolean" + }, + "expiration_timestamp": { + "description": "Date and time when the cluster will be automatically deleted, using the format defined in\n[RFC3339](https://www.ietf.org/rfc/rfc3339.txt). If no timestamp is provided, the cluster\nwill never expire.\n\nThis option is unsupported.", + "type": "string", + "format": "date-time" + }, + "external_id": { + "description": "External identifier of the cluster, generated by the installer.", + "type": "string" + }, + "external_auth_config": { + "description": "External authentication configuration", + "$ref": "#/components/schemas/ExternalAuthConfig" + }, + "external_configuration": { + "description": "ExternalConfiguration shows external configuration on the cluster.", + "$ref": "#/components/schemas/ExternalConfiguration" + }, + "flavour": { + "description": "Link to the _flavour_ that was used to create the cluster.", + "$ref": "#/components/schemas/Flavour" + }, + "groups": { + "description": "Link to the collection of groups of user of the cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Group" + } + }, + "health_state": { + "description": "HealthState indicates the overall health state of the cluster.", + "$ref": "#/components/schemas/ClusterHealthState" + }, + "htpasswd": { + "description": "Details for `htpasswd` identity provider.", + "$ref": "#/components/schemas/HTPasswdIdentityProvider" + }, + "hypershift": { + "description": "Hypershift configuration.", + "$ref": "#/components/schemas/Hypershift" + }, + "identity_providers": { + "description": "Link to the collection of identity providers of the cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/IdentityProvider" + } + }, + "inflight_checks": { + "description": "List of inflight checks on this cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/InflightCheck" + } + }, + "infra_id": { + "description": "InfraID is used for example to name the VPCs.", + "type": "string" + }, + "ingresses": { + "description": "List of ingresses on this cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Ingress" + } + }, + "kubelet_config": { + "description": "Details of cluster-wide KubeletConfig", + "$ref": "#/components/schemas/KubeletConfig" + }, + "load_balancer_quota": { + "description": "Load Balancer quota to be assigned to the cluster.", + "type": "integer", + "format": "int32" + }, + "machine_pools": { + "description": "List of machine pools on this cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/MachinePool" + } + }, + "managed": { + "description": "Flag indicating if the cluster is managed (by Red Hat) or\nself-managed by the user.", + "type": "boolean" + }, + "managed_service": { + "description": "Contains information about Managed Service", + "$ref": "#/components/schemas/ManagedService" + }, + "multi_az": { + "description": "Flag indicating if the cluster should be created with nodes in\ndifferent availability zones or all the nodes in a single one\nrandomly selected.", + "type": "boolean" + }, + "multi_arch_enabled": { + "description": "Indicate whether the cluster is enabled for multi arch workers", + "type": "boolean" + }, + "name": { + "description": "Name of the cluster. This name is assigned by the user when the\ncluster is created. This is used to uniquely identify the cluster", + "type": "string" + }, + "network": { + "description": "Network settings of the cluster.", + "$ref": "#/components/schemas/Network" + }, + "node_drain_grace_period": { + "description": "Node drain grace period.", + "$ref": "#/components/schemas/Value" + }, + "node_pools": { + "description": "List of node pools on this cluster.\nNodePool is a scalable set of worker nodes attached to a hosted cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/NodePool" + } + }, + "nodes": { + "description": "Information about the nodes of the cluster.", + "$ref": "#/components/schemas/ClusterNodes" + }, + "openshift_version": { + "description": "Version of _OpenShift_ installed in the cluster, for example `4.0.0-0.2`.\n\nWhen retrieving a cluster this will always be reported.\n\nWhen provisioning a cluster this will be ignored, as the version to\ndeploy will be determined internally.", + "type": "string" + }, + "product": { + "description": "Link to the product type of this cluster.", + "$ref": "#/components/schemas/Product" + }, + "properties": { + "description": "User defined properties for tagging and querying.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "provision_shard": { + "description": "ProvisionShard contains the properties of the provision shard, including AWS and GCP related configurations", + "$ref": "#/components/schemas/ProvisionShard" + }, + "proxy": { + "description": "Proxy.", + "$ref": "#/components/schemas/Proxy" + }, + "region": { + "description": "Link to the cloud provider region where the cluster is installed.", + "$ref": "#/components/schemas/CloudRegion" + }, + "registry_config": { + "description": "Registry configuration for the cluster", + "$ref": "#/components/schemas/ClusterRegistryConfig" + }, + "state": { + "description": "Overall state of the cluster.", + "$ref": "#/components/schemas/ClusterState" + }, + "status": { + "description": "Status of cluster", + "$ref": "#/components/schemas/ClusterStatus" + }, + "storage_quota": { + "description": "Storage quota to be assigned to the cluster.", + "$ref": "#/components/schemas/Value" + }, + "subscription": { + "description": "Link to the subscription that comes from the account management service when the cluster\nis registered.", + "$ref": "#/components/schemas/Subscription" + }, + "version": { + "description": "Link to the version of _OpenShift_ that will be used to install the cluster.", + "$ref": "#/components/schemas/Version" + } + } + }, + "ClusterAPI": { + "description": "Information about the API of a cluster.", + "properties": { + "url": { + "description": "The URL of the API server of the cluster.", + "type": "string" + }, + "listening": { + "description": "The listening method of the API server.", + "$ref": "#/components/schemas/ListeningMethod" + } + } + }, + "ClusterArchitecture": { + "description": "Possible cluster architectures.", + "type": "string", + "enum": [ + "classic", + "hcp" + ] + }, + "ClusterAutoscaler": { + "description": "Cluster-wide autoscaling configuration.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ClusterAutoscaler' if this is a complete object or 'ClusterAutoscalerLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "balance_similar_node_groups": { + "description": "BalanceSimilarNodeGroups enables/disables the\n`--balance-similar-node-groups` cluster-autoscaler feature.\nThis feature will automatically identify node groups with\nthe same instance type and the same set of labels and try\nto keep the respective sizes of those node groups balanced.", + "type": "boolean" + }, + "balancing_ignored_labels": { + "description": "This option specifies labels that cluster autoscaler should ignore when considering node group similarity.\nFor example, if you have nodes with \"topology.ebs.csi.aws.com/zone\" label, you can add name of this label here\nto prevent cluster autoscaler from splitting nodes into different node groups based on its value.", + "type": "array", + "items": { + "type": "string" + } + }, + "ignore_daemonsets_utilization": { + "description": "Should CA ignore DaemonSet pods when calculating resource utilization for scaling down. false by default.", + "type": "boolean" + }, + "log_verbosity": { + "description": "Sets the autoscaler log level.\nDefault value is 1, level 4 is recommended for DEBUGGING and level 6 will enable almost everything.", + "type": "integer", + "format": "int32" + }, + "max_node_provision_time": { + "description": "Maximum time CA waits for node to be provisioned.", + "type": "string" + }, + "max_pod_grace_period": { + "description": "Gives pods graceful termination time before scaling down.", + "type": "integer", + "format": "int32" + }, + "pod_priority_threshold": { + "description": "To allow users to schedule \"best-effort\" pods, which shouldn't trigger\nCluster Autoscaler actions, but only run when there are spare resources available,\nMore info: https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#how-does-cluster-autoscaler-work-with-pod-priority-and-preemption.", + "type": "integer", + "format": "int32" + }, + "resource_limits": { + "description": "Constraints of autoscaling resources.", + "$ref": "#/components/schemas/AutoscalerResourceLimits" + }, + "scale_down": { + "description": "Configuration of scale down operation.", + "$ref": "#/components/schemas/AutoscalerScaleDownConfig" + }, + "skip_nodes_with_local_storage": { + "description": "Enables/Disables `--skip-nodes-with-local-storage` CA feature flag. If true cluster autoscaler will never delete nodes with pods with local storage, e.g. EmptyDir or HostPath. true by default at autoscaler.", + "type": "boolean" + } + } + }, + "ClusterCapabilities": { + "properties": { + "disabled": { + "description": "Immutable list of disabled capabilities. May only contain \"ImageRegistry\" at\nthis time. Additional capabilities may be available in the future. Clients\nshould expect to handle additional values.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "ClusterConfigurationMode": { + "description": "Configuration mode of a cluster.", + "type": "string", + "enum": [ + "full", + "read_only" + ] + }, + "ClusterConsole": { + "description": "Information about the console of a cluster.", + "properties": { + "url": { + "description": "The URL of the console of the cluster.", + "type": "string" + } + } + }, + "ClusterCredentials": { + "description": "Credentials of the a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ClusterCredentials' if this is a complete object or 'ClusterCredentialsLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "kubeconfig": { + "description": "Administrator _kubeconfig_ file for the cluster.", + "type": "string" + } + } + }, + "ClusterDeployment": { + "description": "Representation of a clusterdeployment.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ClusterDeployment' if this is a complete object or 'ClusterDeploymentLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "content": { + "description": "Content of the clusterdeployment.", + "type": "object" + } + } + }, + "ClusterHealthState": { + "description": "ClusterHealthState indicates the health of a cluster.", + "type": "string", + "enum": [ + "healthy", + "unhealthy", + "unknown" + ] + }, + "ClusterLink": { + "description": "Definition of a cluster link.", + "properties": { + "href": { + "description": "HREF for the cluster, filled in response.", + "type": "string" + }, + "id": { + "description": "The cluster's ID.", + "type": "string" + } + } + }, + "ClusterMigration": { + "description": "Representation of a cluster migration.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ClusterMigration' if this is a complete object or 'ClusterMigrationLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "cluster_id": { + "description": "Internal cluster ID.", + "type": "string" + }, + "creation_timestamp": { + "description": "Date and time when the cluster migration was initially created, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + }, + "sdn_to_ovn": { + "description": "Details for `SdnToOvn` cluster migrations.", + "$ref": "#/components/schemas/SdnToOvnClusterMigration" + }, + "state": { + "description": "The state of the cluster migration.", + "$ref": "#/components/schemas/ClusterMigrationState" + }, + "type": { + "description": "Type of cluster migration. The rest of the attributes will be populated according to this\nvalue. For example, if the type is `sdnToOvn` then only the `SdnToOvn` attribute will be\npopulated.", + "$ref": "#/components/schemas/ClusterMigrationType" + }, + "updated_timestamp": { + "description": "Date and time when the cluster migration was last updated, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + } + } + }, + "ClusterMigrationState": { + "description": "Representation of a cluster migration state.", + "properties": { + "description": { + "description": "A longer description of the current state of the cluster migration.", + "type": "string" + }, + "value": { + "description": "The current state of the cluster migration.", + "$ref": "#/components/schemas/ClusterMigrationStateValue" + } + } + }, + "ClusterMigrationStateValue": { + "description": "The state of the cluster migration.", + "type": "string", + "enum": [ + "completed", + "in progress", + "scheduled" + ] + }, + "ClusterMigrationType": { + "description": "Type of cluster migration.", + "type": "string", + "enum": [ + "sdnToOvn" + ] + }, + "ClusterNodes": { + "description": "Counts of different classes of nodes inside a cluster.", + "properties": { + "autoscale_compute": { + "description": "Details for auto-scaling the compute machine pool.\nCompute and AutoscaleCompute cannot be used together.", + "$ref": "#/components/schemas/MachinePoolAutoscaling" + }, + "availability_zones": { + "description": "The availability zones upon which the nodes are created.", + "type": "array", + "items": { + "type": "string" + } + }, + "compute": { + "description": "Number of compute nodes of the cluster.\nCompute and AutoscaleCompute cannot be used together.", + "type": "integer", + "format": "int32" + }, + "compute_labels": { + "description": "The labels set on the \"default\" compute machine pool.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "compute_machine_type": { + "description": "The compute machine type to use, for example `r5.xlarge`.", + "$ref": "#/components/schemas/MachineType" + }, + "compute_root_volume": { + "description": "The compute machine root volume capabilities.", + "$ref": "#/components/schemas/RootVolume" + }, + "infra": { + "description": "Number of infrastructure nodes of the cluster.", + "type": "integer", + "format": "int32" + }, + "infra_machine_type": { + "description": "The infra machine type to use, for example `r5.xlarge` (Optional).", + "$ref": "#/components/schemas/MachineType" + }, + "master": { + "description": "Number of master nodes of the cluster.", + "type": "integer", + "format": "int32" + }, + "master_machine_type": { + "description": "The master machine type to use, for example `r5.xlarge` (Optional).", + "$ref": "#/components/schemas/MachineType" + }, + "security_group_filters": { + "description": "List of security groups to be applied to nodes (Optional).", + "type": "array", + "items": { + "$ref": "#/components/schemas/MachinePoolSecurityGroupFilter" + } + }, + "total": { + "description": "Total number of nodes of the cluster.", + "type": "integer", + "format": "int32" + } + } + }, + "ClusterOperatorInfo": { + "properties": { + "condition": { + "description": "Operator status. Empty string if unknown.", + "$ref": "#/components/schemas/ClusterOperatorState" + }, + "name": { + "description": "Name of the operator.", + "type": "string" + }, + "reason": { + "description": "Extra detail on condition, if available. Empty string if unknown.", + "type": "string" + }, + "time": { + "description": "Time when the sample was obtained, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format.", + "type": "string", + "format": "date-time" + }, + "version": { + "description": "Current version of the operator. Empty string if unknown.", + "type": "string" + } + } + }, + "ClusterOperatorState": { + "description": "Overall state of a cluster operator.", + "type": "string", + "enum": [ + "available", + "degraded", + "failing", + "upgrading" + ] + }, + "ClusterOperatorsInfo": { + "description": "Provides detailed information about the operators installed on the cluster.", + "properties": { + "operators": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ClusterOperatorInfo" + } + } + } + }, + "ClusterRegistration": { + "description": "Registration of a new cluster to the service.\n\nFor example, to register a cluster that has been provisioned outside\nof this service, send a a request like this:\n\n```http\nPOST /api/clusters_mgmt/v1/register_cluster HTTP/1.1\n```\n\nWith a request body like this:\n\n```json\n{\n \"external_id\": \"d656aecf-11a6-4782-ad86-8f72638449ba\",\n \"subscription_id\": \"...\",\n \"organization_id\": \"...\"\n}\n```", + "properties": { + "console_url": { + "description": "Optional Console URL of the cluster.", + "type": "string" + }, + "external_id": { + "description": "Identifier of the cluster generated by the installer.", + "type": "string" + }, + "organization_id": { + "description": "Organization identifier of the cluster generated by the\naccount manager.", + "type": "string" + }, + "subscription_id": { + "description": "Subscription identifier of the cluster generated by the account\nmanager.", + "type": "string" + } + } + }, + "ClusterRegistryConfig": { + "description": "ClusterRegistryConfig describes the configuration of registries for the cluster.\nIts format reflects the OpenShift Image Configuration, for which docs are available on\n[docs.openshift.com](https://docs.openshift.com/container-platform/4.16/openshift_images/image-configuration.html)\n```json\n{\n \"registry_config\": {\n \"registry_sources\": {\n \"blocked_registries\": [\n \"badregistry.io\",\n \"badregistry8.io\"\n ]\n }\n }\n}\n```\n", + "properties": { + "additional_trusted_ca": { + "description": "A map containing the registry hostname as the key, and the PEM-encoded certificate as the value,\nfor each additional registry CA to trust.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "allowed_registries_for_import": { + "description": "AllowedRegistriesForImport limits the container image registries that normal users may import\nimages from. Set this list to the registries that you trust to contain valid Docker\nimages and that you want applications to be able to import from. Users with\npermission to create Images or ImageStreamMappings via the API are not affected by\nthis policy - typically only administrators or system integrations will have those\npermissions.", + "type": "array", + "items": { + "$ref": "#/components/schemas/RegistryLocation" + } + }, + "platform_allowlist": { + "description": "PlatformAllowlist contains a reference to a RegistryAllowlist which is a list of internal registries\nwhich needs to be whitelisted for the platform to work. It can be omitted at creation and \nupdating and its lifecycle can be managed separately if needed.", + "$ref": "#/components/schemas/RegistryAllowlist" + }, + "registry_sources": { + "description": "RegistrySources contains configuration that determines how the container runtime\nshould treat individual registries when accessing images for builds+pods. (e.g.\nwhether or not to allow insecure access). It does not contain configuration for the\ninternal cluster registry.", + "$ref": "#/components/schemas/RegistrySources" + } + } + }, + "ClusterResources": { + "description": "Cluster Resource which belongs to a cluster, example Cluster Deployment.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ClusterResources' if this is a complete object or 'ClusterResourcesLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "cluster_id": { + "description": "Cluster ID for the fetched resources", + "type": "string" + }, + "creation_timestamp": { + "description": "Date and time when the resources were fetched.", + "type": "string", + "format": "date-time" + }, + "resources": { + "description": "Returned map of cluster resources fetched.", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "ClusterState": { + "description": "Overall state of a cluster.", + "type": "string", + "enum": [ + "error", + "hibernating", + "installing", + "pending", + "powering_down", + "ready", + "resuming", + "uninstalling", + "unknown", + "validating", + "waiting" + ] + }, + "ClusterStatus": { + "description": "Detailed status of a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ClusterStatus' if this is a complete object or 'ClusterStatusLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "dns_ready": { + "description": "DNSReady from Provisioner", + "type": "boolean" + }, + "oidc_ready": { + "description": "OIDCReady from user configuration.", + "type": "boolean" + }, + "configuration_mode": { + "description": "Configuration mode", + "$ref": "#/components/schemas/ClusterConfigurationMode" + }, + "current_compute": { + "description": "Current Replicas available for a Hosted Cluster", + "type": "integer", + "format": "int32" + }, + "description": { + "description": "Detailed description of the cluster status.", + "type": "string" + }, + "limited_support_reason_count": { + "description": "Limited Support Reason Count", + "type": "integer", + "format": "int32" + }, + "provision_error_code": { + "description": "Provisioning Error Code", + "type": "string" + }, + "provision_error_message": { + "description": "Provisioning Error Message", + "type": "string" + }, + "state": { + "description": "The overall state of the cluster.", + "$ref": "#/components/schemas/ClusterState" + } + } + }, + "ComponentRoute": { + "description": "Representation of a Component Route.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ComponentRoute' if this is a complete object or 'ComponentRouteLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "hostname": { + "description": "Hostname of the route.", + "type": "string" + }, + "tls_secret_ref": { + "description": "TLS Secret reference of the route.", + "type": "string" + } + } + }, + "ComponentRouteType": { + "description": "Type of Component Route.", + "type": "string", + "enum": [ + "console", + "downloads", + "oauth" + ] + }, + "ControlPlaneUpgradePolicy": { + "description": "Representation of an upgrade policy that can be set for a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ControlPlaneUpgradePolicy' if this is a complete object or 'ControlPlaneUpgradePolicyLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "cluster_id": { + "description": "Cluster ID this upgrade policy for control plane is defined for.", + "type": "string" + }, + "creation_timestamp": { + "description": "Timestamp for creation of resource.", + "type": "string", + "format": "date-time" + }, + "enable_minor_version_upgrades": { + "description": "Indicates if minor version upgrades are allowed for automatic upgrades (for manual it's always allowed).", + "type": "boolean" + }, + "last_update_timestamp": { + "description": "Timestamp for last update that happened to resource.", + "type": "string", + "format": "date-time" + }, + "next_run": { + "description": "Next time the upgrade should run.", + "type": "string", + "format": "date-time" + }, + "schedule": { + "description": "Schedule cron expression that defines automatic upgrade scheduling.", + "type": "string" + }, + "schedule_type": { + "description": "Schedule type of the control plane upgrade.", + "$ref": "#/components/schemas/ScheduleType" + }, + "state": { + "description": "State of the upgrade policy for the hosted control plane.", + "$ref": "#/components/schemas/UpgradePolicyState" + }, + "upgrade_type": { + "description": "Upgrade type of the control plane.", + "$ref": "#/components/schemas/UpgradeType" + }, + "version": { + "description": "Version is the desired upgrade version.", + "type": "string" + } + } + }, + "CredentialRequest": { + "description": "Contains the necessary attributes to allow each operator to access the necessary AWS resources", + "properties": { + "name": { + "description": "Name of the credentials secret used to access cloud resources", + "type": "string" + }, + "namespace": { + "description": "Namespace where the credentials secret lives in the cluster", + "type": "string" + }, + "policy_permissions": { + "description": "List of policy permissions needed to access cloud resources", + "type": "array", + "items": { + "type": "string" + } + }, + "service_account": { + "description": "Service account name to use when authenticating", + "type": "string" + } + } + }, + "DeleteProtection": { + "description": "DeleteProtection configuration.", + "properties": { + "enabled": { + "description": "Boolean flag indicating if the cluster should be be using _DeleteProtection_.\n\nBy default this is `false`.\n\nTo enable it a SREP needs to patch the value through OCM API", + "type": "boolean" + } + } + }, + "DetectionType": { + "type": "string", + "enum": [ + "auto", + "manual" + ] + }, + "Ec2MetadataHttpTokens": { + "description": "Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances", + "type": "string", + "enum": [ + "optional", + "required" + ] + }, + "EncryptionKey": { + "description": "Description of a cloud provider encryption key.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'EncryptionKey' if this is a complete object or 'EncryptionKeyLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "name": { + "description": "Name of the encryption key.", + "type": "string" + } + } + }, + "Environment": { + "description": "Description of an environment", + "properties": { + "backplane_url": { + "description": "the backplane url for the environment", + "type": "string" + }, + "last_limited_support_check": { + "description": "last time that the worker checked for limited support clusters", + "type": "string", + "format": "date-time" + }, + "last_upgrade_available_check": { + "description": "last time that the worker checked for available upgrades", + "type": "string", + "format": "date-time" + }, + "name": { + "description": "environment name", + "type": "string" + } + } + }, + "Event": { + "description": "Representation of a trackable event.", + "properties": { + "body": { + "description": "Body of the event to track the details of the tracking event as Key value pair", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "key": { + "description": "Key of the event to be tracked. This key should start with an\nuppercase letter followed by alphanumeric characters or\nunderscores. The entire key needs to be smaller than 64 characters.", + "type": "string" + } + } + }, + "ExternalAuth": { + "description": "Representation of an external authentication provider.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ExternalAuth' if this is a complete object or 'ExternalAuthLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "claim": { + "description": "The rules on how to transform information from an ID token into a cluster identity.", + "$ref": "#/components/schemas/ExternalAuthClaim" + }, + "clients": { + "description": "The list of the platform's clients that need to request tokens from the issuer.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ExternalAuthClientConfig" + } + }, + "issuer": { + "description": "The issuer describes the attributes of the OIDC token issuer.", + "$ref": "#/components/schemas/TokenIssuer" + } + } + }, + "ExternalAuthClaim": { + "description": "The claims and validation rules used in the configuration of the external authentication.", + "properties": { + "mappings": { + "description": "Mapping describes rules on how to transform information from an ID token into a cluster identity.", + "$ref": "#/components/schemas/TokenClaimMappings" + }, + "validation_rules": { + "description": "ValidationRules are rules that are applied to validate token claims to authenticate users.", + "type": "array", + "items": { + "$ref": "#/components/schemas/TokenClaimValidationRule" + } + } + } + }, + "ExternalAuthClientConfig": { + "description": "ExternalAuthClientConfig contains configuration for the platform's clients that\nneed to request tokens from the issuer.", + "properties": { + "id": { + "description": "The identifier of the OIDC client from the OIDC provider.", + "type": "string" + }, + "component": { + "description": "The component that is supposed to consume this client configuration.", + "$ref": "#/components/schemas/ClientComponent" + }, + "extra_scopes": { + "description": "ExtraScopes is an optional set of scopes to request tokens with.", + "type": "array", + "items": { + "type": "string" + } + }, + "secret": { + "description": "The secret of the OIDC client from the OIDC provider.", + "type": "string" + } + } + }, + "ExternalAuthConfig": { + "description": "ExternalAuthConfig configuration", + "properties": { + "enabled": { + "description": "Boolean flag indicating if the cluster should use an external authentication configuration.\n\nBy default this is false.\n\nTo enable it the cluster needs to be ROSA HCP cluster and the organization of the user needs\nto have the `external-authentication` feature toggle enabled.", + "type": "boolean" + }, + "external_auths": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ExternalAuth" + } + } + } + }, + "ExternalConfiguration": { + "description": "Representation of cluster external configuration.", + "properties": { + "labels": { + "description": "list of labels externally configured on the clusterdeployment.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "manifests": { + "description": "list of manifest externally configured for a hosted cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Manifest" + } + }, + "syncsets": { + "description": "list of syncsets externally configured on the cluster.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Syncset" + } + } + } + }, + "Flavour": { + "description": "Set of predefined properties of a cluster. For example, a _huge_ flavour can be a cluster\nwith 10 infra nodes and 1000 compute nodes.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Flavour' if this is a complete object or 'FlavourLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "aws": { + "description": "Default _Amazon Web Services_ settings of the cluster.", + "$ref": "#/components/schemas/AWSFlavour" + }, + "gcp": { + "description": "Default _Google Cloud Platform_ settings of the cluster.", + "$ref": "#/components/schemas/GCPFlavour" + }, + "name": { + "description": "Human friendly identifier of the cluster, for example `4`.\n\nNOTE: Currently for all flavours the `id` and `name` attributes have exactly the\nsame values.", + "type": "string" + }, + "network": { + "description": "Default network settings of the cluster.\n\nThese can be overridden specifying in the cluster itself a different set of settings.", + "$ref": "#/components/schemas/Network" + }, + "nodes": { + "description": "Number of nodes that will be used by default when creating a cluster that uses\nthis flavour.\n\nThese can be overridden specifying in the cluster itself a different number of nodes.", + "$ref": "#/components/schemas/FlavourNodes" + } + } + }, + "FlavourNodes": { + "description": "Counts of different classes of nodes inside a flavour.", + "properties": { + "master": { + "description": "Number of master nodes of the cluster.", + "type": "integer", + "format": "int32" + } + } + }, + "GcpAuthentication": { + "description": "Google cloud platform authentication method of a cluster.", + "properties": { + "href": { + "description": "Self link", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object", + "type": "string" + }, + "kind": { + "description": "Indicates the type of this object", + "type": "string" + } + } + }, + "GcpPrivateServiceConnect": { + "description": "Google cloud platform private service connect configuration of a cluster.", + "properties": { + "service_attachment_subnet": { + "description": "The name of the subnet where the PSC service attachment is created", + "type": "string" + } + } + }, + "GcpSecurity": { + "description": "Google cloud platform security settings of a cluster.", + "properties": { + "secure_boot": { + "description": "Determines if Shielded VM feature \"Secure Boot\" should be set for the nodes of the cluster.", + "type": "boolean" + } + } + }, + "GithubIdentityProvider": { + "description": "Details for `github` identity providers.", + "properties": { + "ca": { + "description": "Optional trusted certificate authority bundle to use when making requests tot he server.", + "type": "string" + }, + "client_id": { + "description": "Client identifier of a registered _GitHub_ OAuth application.", + "type": "string" + }, + "client_secret": { + "description": "Client secret of a registered _GitHub_ OAuth application.", + "type": "string" + }, + "hostname": { + "description": "For _GitHub Enterprise_ you must provide the host name of your instance, such as\n`example.com`. This value must match the _GitHub Enterprise_ host name value in the\n`/setup/settings` file and cannot include a port number.\n\nFor plain _GitHub_ omit this parameter.", + "type": "string" + }, + "organizations": { + "description": "Optional list of organizations. Cannot be used in combination with the Teams field.", + "type": "array", + "items": { + "type": "string" + } + }, + "teams": { + "description": "Optional list of teams. Cannot be used in combination with the Organizations field.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "GitlabIdentityProvider": { + "description": "Details for `gitlab` identity providers.", + "properties": { + "ca": { + "description": "Optional trusted certificate authority bundle to use when making requests tot he server.", + "type": "string" + }, + "url": { + "description": "URL of the _GitLab_ instance.", + "type": "string" + }, + "client_id": { + "description": "Client identifier of a registered _GitLab_ OAuth application.", + "type": "string" + }, + "client_secret": { + "description": "Client secret issued by _GitLab_.", + "type": "string" + } + } + }, + "GoogleIdentityProvider": { + "description": "Details for `google` identity providers.", + "properties": { + "client_id": { + "description": "Client identifier of a registered _Google_ project.", + "type": "string" + }, + "client_secret": { + "description": "Client secret issued by _Google_.", + "type": "string" + }, + "hosted_domain": { + "description": "Optional hosted domain to restrict sign-in accounts to.", + "type": "string" + } + } + }, + "Group": { + "description": "Representation of a group of users.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Group' if this is a complete object or 'GroupLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "users": { + "description": "List of users of the group.", + "type": "array", + "items": { + "$ref": "#/components/schemas/User" + } + } + } + }, + "GroupsClaim": { + "properties": { + "claim": { + "description": "The claim used in the token.", + "type": "string" + }, + "prefix": { + "description": "A prefix contatenated in the claim (Optional).", + "type": "string" + } + } + }, + "Hypershift": { + "description": "Hypershift configuration.", + "properties": { + "enabled": { + "description": "Boolean flag indicating if the cluster should be creating using _Hypershift_.\n\nBy default this is `false`.\n\nTo enable it the cluster needs to be ROSA cluster and the organization of the user needs\nto have the `hypershift` capability enabled.", + "type": "boolean" + } + } + }, + "HypershiftConfig": { + "description": "Hypershift configuration.", + "properties": { + "hcp_namespace": { + "description": "Contains the name of the hcp namespace for this Hypershift cluster.\nEmpty for non Hypershift clusters.", + "type": "string" + }, + "enabled": { + "description": "Boolean flag indicating if the cluster should be creating using _Hypershift_.\n\nBy default this is `false`.\n\nTo enable it the cluster needs to be ROSA cluster and the organization of the user needs\nto have the `hypershift` capability enabled.", + "type": "boolean" + }, + "management_cluster": { + "description": "Contains the name of the current management cluster for this Hypershift cluster.\nEmpty for non Hypershift clusters.", + "type": "string" + } + } + }, + "IdentityProvider": { + "description": "Representation of an identity provider.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'IdentityProvider' if this is a complete object or 'IdentityProviderLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "ldap": { + "description": "Details for `ldap` identity providers.", + "$ref": "#/components/schemas/LDAPIdentityProvider" + }, + "challenge": { + "description": "When `true` unauthenticated token requests from non-web clients (like the CLI) are sent a\n`WWW-Authenticate` challenge header for this provider.", + "type": "boolean" + }, + "github": { + "description": "Details for `github` identity providers.", + "$ref": "#/components/schemas/GithubIdentityProvider" + }, + "gitlab": { + "description": "Details for `gitlab` identity providers.", + "$ref": "#/components/schemas/GitlabIdentityProvider" + }, + "google": { + "description": "Details for `google` identity providers.", + "$ref": "#/components/schemas/GoogleIdentityProvider" + }, + "htpasswd": { + "description": "Details for `htpasswd` identity providers.", + "$ref": "#/components/schemas/HTPasswdIdentityProvider" + }, + "login": { + "description": "When `true` unauthenticated token requests from web clients (like the web console) are\nredirected to the authorize URL to log in.", + "type": "boolean" + }, + "mapping_method": { + "description": "Controls how mappings are established between this provider's identities and user\nobjects.", + "$ref": "#/components/schemas/IdentityProviderMappingMethod" + }, + "name": { + "description": "The name of the identity provider.", + "type": "string" + }, + "open_id": { + "description": "Details for `openid` identity providers.", + "$ref": "#/components/schemas/OpenIDIdentityProvider" + }, + "type": { + "description": "Type of identity provider. The rest of the attributes will be populated according to this\nvalue. For example, if the type is `github` then only the `github` attribute will be\npopulated.", + "$ref": "#/components/schemas/IdentityProviderType" + } + } + }, + "IdentityProviderMappingMethod": { + "description": "Controls how mappings are established between provider identities and user objects.", + "type": "string", + "enum": [ + "add", + "claim", + "generate", + "lookup" + ] + }, + "IdentityProviderType": { + "description": "Type of identity provider.", + "type": "string", + "enum": [ + "LDAPIdentityProvider", + "GithubIdentityProvider", + "GitlabIdentityProvider", + "GoogleIdentityProvider", + "HTPasswdIdentityProvider", + "OpenIDIdentityProvider" + ] + }, + "ImageOverrides": { + "description": "ImageOverrides holds the lists of available images per cloud provider.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ImageOverrides' if this is a complete object or 'ImageOverridesLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "aws": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AMIOverride" + } + }, + "gcp": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GCPImageOverride" + } + } + } + }, + "InflightCheck": { + "description": "Representation of check running before the cluster is provisioned.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'InflightCheck' if this is a complete object or 'InflightCheckLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "details": { + "description": "Details regarding the state of the inflight check.", + "type": "object" + }, + "ended_at": { + "description": "The time the check finished running.", + "type": "string", + "format": "date-time" + }, + "name": { + "description": "The name of the inflight check.", + "type": "string" + }, + "restarts": { + "description": "The number of times the inflight check restarted.", + "type": "integer", + "format": "int32" + }, + "started_at": { + "description": "The time the check started running.", + "type": "string", + "format": "date-time" + }, + "state": { + "description": "State of the inflight check.", + "$ref": "#/components/schemas/InflightCheckState" + } + } + }, + "InflightCheckState": { + "description": "State of an inflight check.", + "type": "string", + "enum": [ + "failed", + "passed", + "pending", + "running" + ] + }, + "Ingress": { + "description": "Representation of an ingress.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Ingress' if this is a complete object or 'IngressLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "dns_name": { + "description": "DNS Name of the ingress.", + "type": "string" + }, + "cluster_routes_hostname": { + "description": "Cluster routes hostname.", + "type": "string" + }, + "cluster_routes_tls_secret_ref": { + "description": "Cluster routes TLS Secret reference.", + "type": "string" + }, + "component_routes": { + "description": "Component Routes settings.", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/ComponentRoute" + } + }, + "default": { + "description": "Indicates if this is the default ingress.", + "type": "boolean" + }, + "excluded_namespaces": { + "description": "A set of excluded namespaces for the ingress.", + "type": "array", + "items": { + "type": "string" + } + }, + "listening": { + "description": "Listening method of the ingress", + "$ref": "#/components/schemas/ListeningMethod" + }, + "load_balancer_type": { + "description": "Load Balancer type of the ingress", + "$ref": "#/components/schemas/LoadBalancerFlavor" + }, + "route_namespace_ownership_policy": { + "description": "Namespace Ownership Policy for the ingress.", + "$ref": "#/components/schemas/NamespaceOwnershipPolicy" + }, + "route_selectors": { + "description": "A set of labels for the ingress. ", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "route_wildcard_policy": { + "description": "Wildcard policy for the ingress.", + "$ref": "#/components/schemas/WildcardPolicy" + } + } + }, + "InstanceIAMRoles": { + "description": "Contains the necessary attributes to support role-based authentication on AWS.", + "properties": { + "master_role_arn": { + "description": "The IAM role ARN that will be attached to master instances", + "type": "string" + }, + "worker_role_arn": { + "description": "The IAM role ARN that will be attached to worker instances", + "type": "string" + } + } + }, + "KeyRing": { + "description": "Description of a cloud provider key ring.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'KeyRing' if this is a complete object or 'KeyRingLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "name": { + "description": "Name of the key ring.", + "type": "string" + } + } + }, + "KubeletConfig": { + "description": "OCM representation of KubeletConfig, exposing the fields of Kubernetes\nKubeletConfig that can be managed by users", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'KubeletConfig' if this is a complete object or 'KubeletConfigLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "name": { + "description": "Allows the user to specify the name to be used to identify this KubeletConfig.\nOptional. A name will be generated if not provided.", + "type": "string" + }, + "pod_pids_limit": { + "description": "Allows the user to specify the podPidsLimit to be applied via KubeletConfig.\nUseful if workloads have greater PIDs limit requirements than the OCP default.", + "type": "integer", + "format": "int32" + } + } + }, + "Label": { + "description": "Representation of a label in clusterdeployment.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Label' if this is a complete object or 'LabelLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "key": { + "description": "the key of the label", + "type": "string" + }, + "value": { + "description": "the value to set in the label", + "type": "string" + } + } + }, + "LimitedSupportReason": { + "description": "A reason that a cluster is in limited support.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'LimitedSupportReason' if this is a complete object or 'LimitedSupportReasonLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "creation_timestamp": { + "description": "The time the reason was detected.", + "type": "string", + "format": "date-time" + }, + "details": { + "description": "URL with a link to a detailed description of the reason.", + "type": "string" + }, + "detection_type": { + "description": "Indicates if the reason was detected automatically or manually.\nWhen creating a new reason this field should be empty or \"manual\".", + "$ref": "#/components/schemas/DetectionType" + }, + "override": { + "description": "Indicates if the override is enabled", + "$ref": "#/components/schemas/LimitedSupportReasonOverride" + }, + "summary": { + "description": "Summary of the reason.", + "type": "string" + }, + "template": { + "description": "Optional link to a template with summary and details.", + "$ref": "#/components/schemas/LimitedSupportReasonTemplate" + } + } + }, + "LimitedSupportReasonOverride": { + "description": "Representation of the limited support reason override.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'LimitedSupportReasonOverride' if this is a complete object or 'LimitedSupportReasonOverrideLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "enabled": { + "description": "Indicates if the override is enabled", + "type": "boolean" + } + } + }, + "LimitedSupportReasonTemplate": { + "description": "A template for cluster limited support reason.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'LimitedSupportReasonTemplate' if this is a complete object or 'LimitedSupportReasonTemplateLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "details": { + "description": "A detailed description of the reason.", + "type": "string" + }, + "summary": { + "description": "Summary of the reason.", + "type": "string" + } + } + }, + "ListeningMethod": { + "description": "Cluster components listening method.", + "type": "string", + "enum": [ + "external", + "internal" + ] + }, + "LoadBalancerFlavor": { + "description": "Type of load balancer for AWS cloud provider parameters.", + "type": "string", + "enum": [ + "classic", + "nlb" + ] + }, + "Log": { + "description": "Log of the cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Log' if this is a complete object or 'LogLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "content": { + "description": "Content of the log.", + "type": "string" + } + } + }, + "MachinePool": { + "description": "Representation of a machine pool in a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'MachinePool' if this is a complete object or 'MachinePoolLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "aws": { + "description": "AWS specific parameters (Optional).", + "$ref": "#/components/schemas/AWSMachinePool" + }, + "gcp": { + "description": "GCP specific parameters (Optional).", + "$ref": "#/components/schemas/GCPMachinePool" + }, + "autoscaling": { + "description": "Details for auto-scaling the machine pool.\nReplicas and autoscaling cannot be used together.", + "$ref": "#/components/schemas/MachinePoolAutoscaling" + }, + "availability_zones": { + "description": "The availability zones upon which the nodes are created.", + "type": "array", + "items": { + "type": "string" + } + }, + "instance_type": { + "description": "The instance type of Nodes to create.", + "type": "string" + }, + "labels": { + "description": "The labels set on the Nodes created.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "replicas": { + "description": "The number of Machines (and Nodes) to create.\nReplicas and autoscaling cannot be used together.", + "type": "integer", + "format": "int32" + }, + "root_volume": { + "description": "The machine root volume capabilities.", + "$ref": "#/components/schemas/RootVolume" + }, + "security_group_filters": { + "description": "List of security groups to be applied to MachinePool (Optional)", + "type": "array", + "items": { + "$ref": "#/components/schemas/MachinePoolSecurityGroupFilter" + } + }, + "subnets": { + "description": "The subnets upon which the nodes are created.", + "type": "array", + "items": { + "type": "string" + } + }, + "taints": { + "description": "The taints set on the Nodes created.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Taint" + } + } + } + }, + "MachinePoolAutoscaling": { + "description": "Representation of a autoscaling in a machine pool.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'MachinePoolAutoscaling' if this is a complete object or 'MachinePoolAutoscalingLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "max_replicas": { + "description": "The maximum number of replicas for the machine pool.", + "type": "integer", + "format": "int32" + }, + "min_replicas": { + "description": "The minimum number of replicas for the machine pool.", + "type": "integer", + "format": "int32" + } + } + }, + "MachinePoolSecurityGroupFilter": { + "description": "Security Group Filter object, containing name of the filter tag and value of the filter tag", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "MachineType": { + "description": "Machine type.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'MachineType' if this is a complete object or 'MachineTypeLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "ccs_only": { + "description": "'true' if the instance type is supported only for CCS clusters, 'false' otherwise.", + "type": "boolean" + }, + "cpu": { + "description": "The amount of cpu's of the machine type.", + "$ref": "#/components/schemas/Value" + }, + "architecture": { + "description": "The architecture of the machine type.", + "$ref": "#/components/schemas/ProcessorType" + }, + "category": { + "description": "The category which the machine type is suitable for.", + "$ref": "#/components/schemas/MachineTypeCategory" + }, + "cloud_provider": { + "description": "Link to the cloud provider that the machine type belongs to.", + "$ref": "#/components/schemas/CloudProvider" + }, + "generic_name": { + "description": "Generic name for quota purposes, for example `highmem-4`.\nCloud provider agnostic - many values are shared between \"similar\"\nmachine types on different providers.\nCorresponds to `resource_name` values in \"compute.node\" quota cost data.", + "type": "string" + }, + "memory": { + "description": "The amount of memory of the machine type.", + "$ref": "#/components/schemas/Value" + }, + "name": { + "description": "Human friendly identifier of the machine type, for example `r5.xlarge - Memory Optimized`.", + "type": "string" + }, + "size": { + "description": "The size of the machine type.", + "$ref": "#/components/schemas/MachineTypeSize" + } + } + }, + "MachineTypeCategory": { + "description": "Machine type category.", + "type": "string", + "enum": [ + "accelerated_computing", + "compute_optimized", + "general_purpose", + "memory_optimized" + ] + }, + "MachineTypeSize": { + "description": "Machine type size.", + "type": "string", + "enum": [ + "large", + "medium", + "small" + ] + }, + "ManagedService": { + "description": "Contains the necessary attributes to support role-based authentication on AWS.", + "properties": { + "enabled": { + "description": "Indicates whether the cluster belongs to a managed service\nThis should only be set by the \"Managed Service\" service.\nclusters with this set can only be modified by the \"Managed Service\" service.", + "type": "boolean" + } + } + }, + "Manifest": { + "description": "Representation of a manifestwork.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Manifest' if this is a complete object or 'ManifestLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "creation_timestamp": { + "description": "Date and time when the manifest got created in OCM database.", + "type": "string", + "format": "date-time" + }, + "live_resource": { + "description": "Transient value to represent the underlying live resource.", + "type": "object" + }, + "spec": { + "description": "Spec of Manifest Work object from open cluster management\nFor more info please check https://open-cluster-management.io/concepts/manifestwork.", + "type": "object" + }, + "updated_timestamp": { + "description": "Date and time when the manifest got updated in OCM database.", + "type": "string", + "format": "date-time" + }, + "workloads": { + "description": "List of k8s objects to deploy on a hosted cluster.", + "type": "array", + "items": { + "type": "object" + } + } + } + }, + "NamespaceOwnershipPolicy": { + "description": "Type of Namespace Ownership Policy.", + "type": "string", + "enum": [ + "InterNamespaceAllowed", + "Strict" + ] + }, + "Network": { + "description": "Network configuration of a cluster.", + "properties": { + "host_prefix": { + "description": "Network host prefix which is defaulted to `23` if not specified.", + "type": "integer", + "format": "int32" + }, + "machine_cidr": { + "description": "IP address block from which to assign machine IP addresses, for example `10.0.0.0/16`.", + "type": "string" + }, + "pod_cidr": { + "description": "IP address block from which to assign pod IP addresses, for example `10.128.0.0/14`.", + "type": "string" + }, + "service_cidr": { + "description": "IP address block from which to assign service IP addresses, for example `172.30.0.0/16`.", + "type": "string" + }, + "type": { + "description": "The main controller responsible for rendering the core networking components.", + "type": "string" + } + } + }, + "NetworkVerification": { + "properties": { + "cloud_provider_data": { + "description": "Cloud provider data to execute the network verification.", + "$ref": "#/components/schemas/CloudProviderData" + }, + "cluster_id": { + "description": "Cluster ID needed to execute the network verification.", + "type": "string" + }, + "items": { + "description": "Details about each subnet network verification.", + "type": "array", + "items": { + "$ref": "#/components/schemas/SubnetNetworkVerification" + } + }, + "platform": { + "description": "Platform needed to execute the network verification.", + "$ref": "#/components/schemas/Platform" + }, + "total": { + "description": "Amount of network verifier executions started.", + "type": "integer", + "format": "int32" + } + } + }, + "NodeInfo": { + "description": "Provides information about a node from specific type in the cluster.", + "properties": { + "amount": { + "description": "The amount of the nodes from this type.", + "type": "integer", + "format": "int32" + }, + "type": { + "description": "The Node type.", + "$ref": "#/components/schemas/NodeType" + } + } + }, + "NodePool": { + "description": "Representation of a node pool in a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'NodePool' if this is a complete object or 'NodePoolLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "aws_node_pool": { + "description": "AWS specific parameters (Optional).", + "$ref": "#/components/schemas/AWSNodePool" + }, + "auto_repair": { + "description": "Specifies whether health checks should be enabled for machines in the NodePool.", + "type": "boolean" + }, + "autoscaling": { + "description": "Details for auto-scaling the machine pool.\nReplicas and autoscaling cannot be used together.", + "$ref": "#/components/schemas/NodePoolAutoscaling" + }, + "availability_zone": { + "description": "The availability zone upon which the node is created.", + "type": "string" + }, + "azure_node_pool": { + "description": "Azure specific parameters.", + "$ref": "#/components/schemas/AzureNodePool" + }, + "kubelet_configs": { + "description": "The names of the KubeletConfigs for this node pool.", + "type": "array", + "items": { + "type": "string" + } + }, + "labels": { + "description": "The labels set on the Nodes created.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "management_upgrade": { + "description": "Management parameters (Optional).", + "$ref": "#/components/schemas/NodePoolManagementUpgrade" + }, + "node_drain_grace_period": { + "description": "Time to wait for a NodePool to drain when it is upgraded or replaced before it is forcibly removed.", + "$ref": "#/components/schemas/Value" + }, + "replicas": { + "description": "The number of Machines (and Nodes) to create.\nReplicas and autoscaling cannot be used together.", + "type": "integer", + "format": "int32" + }, + "status": { + "description": "NodePool status.", + "$ref": "#/components/schemas/NodePoolStatus" + }, + "subnet": { + "description": "The subnet upon which the nodes are created.", + "type": "string" + }, + "taints": { + "description": "The taints set on the Nodes created.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Taint" + } + }, + "tuning_configs": { + "description": "The names of the tuning configs for this node pool.", + "type": "array", + "items": { + "type": "string" + } + }, + "version": { + "description": "Version of the node pool.", + "$ref": "#/components/schemas/Version" + } + } + }, + "NodePoolAutoscaling": { + "description": "Representation of a autoscaling in a node pool.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'NodePoolAutoscaling' if this is a complete object or 'NodePoolAutoscalingLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "max_replica": { + "description": "The maximum number of replicas for the node pool.", + "type": "integer", + "format": "int32" + }, + "min_replica": { + "description": "The minimum number of replicas for the node pool.", + "type": "integer", + "format": "int32" + } + } + }, + "NodePoolManagementUpgrade": { + "description": "Representation of node pool management.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'NodePoolManagementUpgrade' if this is a complete object or 'NodePoolManagementUpgradeLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "max_surge": { + "description": "Maximum number of nodes in the NodePool of a ROSA HCP cluster that can be scheduled above the desired number of nodes during the upgrade.", + "type": "string" + }, + "max_unavailable": { + "description": "Maximum number of nodes in the NodePool of a ROSA HCP cluster that can be unavailable during the upgrade.", + "type": "string" + }, + "type": { + "description": "Type of strategy for handling upgrades.", + "type": "string" + } + } + }, + "NodePoolState": { + "description": "Representation of the status of a node pool.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'NodePoolState' if this is a complete object or 'NodePoolStateLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "last_updated_timestamp": { + "description": "The current number of replicas for the node pool.", + "type": "string", + "format": "date-time" + }, + "node_pool_state_value": { + "description": "The current state of the node pool", + "type": "string" + } + } + }, + "NodePoolStatus": { + "description": "Representation of the status of a node pool.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'NodePoolStatus' if this is a complete object or 'NodePoolStatusLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "current_replicas": { + "description": "The current number of replicas for the node pool.", + "type": "integer", + "format": "int32" + }, + "message": { + "description": "Adds additional information about the NodePool status when the node pool doesn't reach the desired replicas.", + "type": "string" + }, + "state": { + "description": "The current state of the node pool", + "$ref": "#/components/schemas/NodePoolState" + } + } + }, + "NodePoolUpgradePolicy": { + "description": "Representation of an upgrade policy that can be set for a node pool.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'NodePoolUpgradePolicy' if this is a complete object or 'NodePoolUpgradePolicyLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "cluster_id": { + "description": "Cluster ID this upgrade policy for node pool is defined for.", + "type": "string" + }, + "creation_timestamp": { + "description": "Timestamp for creation of resource.", + "type": "string", + "format": "date-time" + }, + "enable_minor_version_upgrades": { + "description": "Indicates if minor version upgrades are allowed for automatic upgrades (for manual it's always allowed).", + "type": "boolean" + }, + "last_update_timestamp": { + "description": "Timestamp for last update that happened to resource.", + "type": "string", + "format": "date-time" + }, + "next_run": { + "description": "Next time the upgrade should run.", + "type": "string", + "format": "date-time" + }, + "node_pool_id": { + "description": "Node Pool ID this upgrade policy is defined for.", + "type": "string" + }, + "schedule": { + "description": "Schedule cron expression that defines automatic upgrade scheduling.", + "type": "string" + }, + "schedule_type": { + "description": "Schedule type of the upgrade.", + "$ref": "#/components/schemas/ScheduleType" + }, + "state": { + "description": "State of the upgrade policy for the node pool.", + "$ref": "#/components/schemas/UpgradePolicyState" + }, + "upgrade_type": { + "description": "Upgrade type of the node pool.", + "$ref": "#/components/schemas/UpgradeType" + }, + "version": { + "description": "Version is the desired upgrade version.", + "type": "string" + } + } + }, + "NodeType": { + "description": "Type of node received via telemetry.", + "type": "string", + "enum": [ + "compute", + "infra", + "master" + ] + }, + "NodesInfo": { + "description": "Provides information about the nodes in the cluster.", + "properties": { + "nodes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/NodeInfo" + } + } + } + }, + "OidcConfig": { + "description": "Contains the necessary attributes to support oidc configuration hosting under Red Hat or registering a Customer's byo oidc config.", + "properties": { + "href": { + "description": "HREF for the oidc config, filled in response.", + "type": "string" + }, + "id": { + "description": "ID for the oidc config, filled in response.", + "type": "string" + }, + "creation_timestamp": { + "description": "Creation timestamp, filled in response.", + "type": "string", + "format": "date-time" + }, + "installer_role_arn": { + "description": "ARN of the AWS role to assume when installing the cluster as to reveal the secret, supplied in request. It is only to be used in Unmanaged Oidc Config.", + "type": "string" + }, + "issuer_url": { + "description": "Issuer URL, filled in response when Managed and supplied in Unmanaged.", + "type": "string" + }, + "last_update_timestamp": { + "description": "Last update timestamp, filled when patching a valid attribute of this oidc config.", + "type": "string", + "format": "date-time" + }, + "last_used_timestamp": { + "description": "Last used timestamp, filled by the latest cluster that used this oidc config.", + "type": "string", + "format": "date-time" + }, + "managed": { + "description": "Indicates whether it is Managed or Unmanaged (Customer hosted).", + "type": "boolean" + }, + "organization_id": { + "description": "Organization ID, filled in response respecting token provided.", + "type": "string" + }, + "reusable": { + "description": "Indicates whether the Oidc Config can be reused.", + "type": "boolean" + }, + "secret_arn": { + "description": "Secrets Manager ARN for the OIDC private key, supplied in request. It is only to be used in Unmanaged Oidc Config.", + "type": "string" + } + } + }, + "OidcThumbprint": { + "description": "Contains the necessary attributes to support oidc configuration thumbprint operations such as fetching/creation of a thumbprint", + "properties": { + "href": { + "description": "HREF for the oidc config thumbprint, filled in response.", + "type": "string" + }, + "cluster_id": { + "description": "ClusterId is the for the cluster used, filled in response.", + "type": "string" + }, + "kind": { + "description": "Kind is the resource type, filled in response.", + "type": "string" + }, + "oidc_config_id": { + "description": "OidcConfigId is the ID for the oidc config used, filled in response.", + "type": "string" + }, + "thumbprint": { + "description": "Thumbprint is the thumbprint itself, filled in response.", + "type": "string" + } + } + }, + "OidcThumbprintInput": { + "description": "Contains the necessary attributes to fetch an OIDC Configuration thumbprint", + "properties": { + "cluster_id": { + "description": "ClusterId is the for the cluster used, exclusive from OidcConfigId.", + "type": "string" + }, + "oidc_config_id": { + "description": "OidcConfigId is the ID for the oidc config used, exclusive from ClusterId.", + "type": "string" + } + } + }, + "OpenIDClaims": { + "description": "_OpenID_ identity provider claims.", + "properties": { + "email": { + "description": "List of claims to use as the mail address.", + "type": "array", + "items": { + "type": "string" + } + }, + "groups": { + "description": "List of claims to use as the group name.", + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "description": "List of claims to use as the display name.", + "type": "array", + "items": { + "type": "string" + } + }, + "preferred_username": { + "description": "List of claims to use as the preferred user name when provisioning a user.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "OpenIDIdentityProvider": { + "description": "Details for `openid` identity providers.", + "properties": { + "ca": { + "description": "Certificate bunde to use to validate server certificates for the configured URL.", + "type": "string" + }, + "claims": { + "description": "Claims used to configure the provider.", + "$ref": "#/components/schemas/OpenIDClaims" + }, + "client_id": { + "description": "Identifier of a client registered with the _OpenID_ provider.", + "type": "string" + }, + "client_secret": { + "description": "Client secret.", + "type": "string" + }, + "extra_authorize_parameters": { + "description": "Optional map of extra parameters to add to the authorization token request.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "extra_scopes": { + "description": "Optional list of scopes to request, in addition to the `openid` scope, during the\nauthorization token request.", + "type": "array", + "items": { + "type": "string" + } + }, + "issuer": { + "description": "The URL that the OpenID Provider asserts as the Issuer Identifier", + "type": "string" + } + } + }, + "OperatorIAMRole": { + "description": "Contains the necessary attributes to allow each operator to access the necessary AWS resources", + "properties": { + "id": { + "description": "Randomly-generated ID to identify the operator role", + "type": "string" + }, + "name": { + "description": "Name of the credentials secret used to access cloud resources", + "type": "string" + }, + "namespace": { + "description": "Namespace where the credentials secret lives in the cluster", + "type": "string" + }, + "role_arn": { + "description": "Role to assume when accessing AWS resources", + "type": "string" + }, + "service_account": { + "description": "Service account name to use when authenticating", + "type": "string" + } + } + }, + "OrganizationLink": { + "description": "Definition of an organization link.", + "properties": { + "href": { + "description": "HREF for the Organization, filled in response.", + "type": "string" + }, + "id": { + "description": "The organization's ID.", + "type": "string" + } + } + }, + "PendingDeleteCluster": { + "description": "Represents a pending delete entry for a specific cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'PendingDeleteCluster' if this is a complete object or 'PendingDeleteClusterLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "best_effort": { + "description": "Flag indicating if the cluster deletion should be best-effort mode or not.", + "type": "boolean" + }, + "cluster": { + "description": "Cluster is the details of the cluster that is pending deletion.", + "$ref": "#/components/schemas/Cluster" + }, + "creation_timestamp": { + "description": "Date and time when the cluster was initially created, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + } + } + }, + "Platform": { + "description": "Representation of an platform type field.", + "type": "string", + "enum": [ + "aws", + "aws-classic", + "aws-hosted-cp", + "gcp", + "hostedcluster" + ] + }, + "PrivateLinkClusterConfiguration": { + "description": "Manages the configuration for the Private Links.", + "properties": { + "principals": { + "description": "List of additional principals for the Private Link", + "type": "array", + "items": { + "$ref": "#/components/schemas/PrivateLinkPrincipal" + } + } + } + }, + "PrivateLinkConfiguration": { + "description": "Manages the configuration for the Private Links.", + "properties": { + "principals": { + "description": "List of additional principals for the Private Link", + "$ref": "#/components/schemas/PrivateLinkPrincipals" + } + } + }, + "PrivateLinkPrincipal": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'PrivateLinkPrincipal' if this is a complete object or 'PrivateLinkPrincipalLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "principal": { + "description": "ARN for a principal that is allowed for this Private Link.", + "type": "string" + } + } + }, + "PrivateLinkPrincipals": { + "description": "Contains a list of principals for the Private Link.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'PrivateLinkPrincipals' if this is a complete object or 'PrivateLinkPrincipalsLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "principals": { + "description": "List of additional principals for the Private Link", + "type": "array", + "items": { + "$ref": "#/components/schemas/PrivateLinkPrincipal" + } + } + } + }, + "ProcessorType": { + "description": "Processor type category.", + "type": "string", + "enum": [ + "amd64", + "arm64" + ] + }, + "Product": { + "description": "Representation of an product that can be selected as a cluster type.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Product' if this is a complete object or 'ProductLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "name": { + "description": "Name of the product.", + "type": "string" + } + } + }, + "ProductMinimalVersion": { + "description": "Representation of a product minimal version.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ProductMinimalVersion' if this is a complete object or 'ProductMinimalVersionLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "rosa_cli": { + "description": "The ROSA CLI minimal version.", + "type": "string" + }, + "start_date": { + "description": "The start date for this minimal version.", + "type": "string", + "format": "date-time" + } + } + }, + "ProductTechnologyPreview": { + "description": "Representation of a product technology preview.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ProductTechnologyPreview' if this is a complete object or 'ProductTechnologyPreviewLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "additional_text": { + "description": "Message associated with this technology preview.", + "type": "string" + }, + "end_date": { + "description": "The end date for this technology preview.", + "type": "string", + "format": "date-time" + }, + "start_date": { + "description": "The start date for this technology preview.", + "type": "string", + "format": "date-time" + } + } + }, + "ProvisionShard": { + "description": "Contains the properties of the provision shard, including AWS and GCP related configurations", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ProvisionShard' if this is a complete object or 'ProvisionShardLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "aws_account_operator_config": { + "description": "Contains the configuration for the AWS account operator.", + "$ref": "#/components/schemas/ServerConfig" + }, + "aws_base_domain": { + "description": "Contains the AWS base domain.", + "type": "string" + }, + "gcp_base_domain": { + "description": "Contains the GCP base domain.", + "type": "string" + }, + "gcp_project_operator": { + "description": "Contains the configuration for the GCP project operator.", + "$ref": "#/components/schemas/ServerConfig" + }, + "cloud_provider": { + "description": "Contains the cloud provider name.", + "$ref": "#/components/schemas/CloudProvider" + }, + "creation_timestamp": { + "description": "Date and time when the provision shard was initially created, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + }, + "hive_config": { + "description": "Contains the configuration for Hive.", + "$ref": "#/components/schemas/ServerConfig" + }, + "hypershift_config": { + "description": "Contains the configuration for Hypershift.", + "$ref": "#/components/schemas/ServerConfig" + }, + "last_update_timestamp": { + "description": "Date and time when the provision shard was last updated, using the\nformat defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt).", + "type": "string", + "format": "date-time" + }, + "management_cluster": { + "description": "Contains the name of the management cluster for Hypershift clusters that are assigned to this shard.\nThis field is populated by OCM, and must not be overwritten via API.", + "type": "string" + }, + "region": { + "description": "Contains the cloud-provider region in which the provisioner spins up the cluster.", + "$ref": "#/components/schemas/CloudRegion" + }, + "status": { + "description": "Status of the provision shard. Possible values: active/maintenance/offline.", + "type": "string" + } + } + }, + "ProvisionShardTopology": { + "type": "string", + "enum": [ + "dedicated" + ] + }, + "Proxy": { + "description": "Proxy configuration of a cluster.", + "properties": { + "http_proxy": { + "description": "HTTPProxy is the URL of the proxy for HTTP requests.", + "type": "string" + }, + "https_proxy": { + "description": "HTTPSProxy is the URL of the proxy for HTTPS requests.", + "type": "string" + }, + "no_proxy": { + "description": "NoProxy is a comma-separated list of domains and CIDRs for which \nthe proxy should not be used", + "type": "string" + } + } + }, + "RegistryAllowlist": { + "description": "RegistryAllowlist represents a single registry allowlist.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'RegistryAllowlist' if this is a complete object or 'RegistryAllowlistLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "cloud_provider": { + "description": "CloudProvider is the cloud provider for which this allowlist is valid.", + "$ref": "#/components/schemas/CloudProvider" + }, + "creation_timestamp": { + "description": "CreationTimestamp is the date and time when the allow list has been created.", + "type": "string", + "format": "date-time" + }, + "registries": { + "description": "Registries is the list of registries contained in this Allowlist.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "RegistryLocation": { + "description": "RegistryLocation contains a location of the registry specified by the registry domain\nname. The domain name might include wildcards, like '*' or '??'.", + "properties": { + "domain_name": { + "description": "domainName specifies a domain name for the registry\nIn case the registry use non-standard (80 or 443) port, the port should be included\nin the domain name as well.", + "type": "string" + }, + "insecure": { + "description": "insecure indicates whether the registry is secure (https) or insecure (http)\nBy default (if not specified) the registry is assumed as secure.", + "type": "boolean" + } + } + }, + "RegistrySources": { + "description": "RegistrySources contains configuration that determines how the container runtime should treat individual\nregistries when accessing images for builds and pods. For instance, whether or not to allow insecure access.\nIt does not contain configuration for the internal cluster registry.", + "properties": { + "allowed_registries": { + "description": "AllowedRegistries: registries for which image pull and push actions are allowed.\nTo specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name.\nFor example, *.example.com. You can specify an individual repository within a registry.\nFor example: reg1.io/myrepo/myapp:latest. All other registries are blocked.\nMutually exclusive with `BlockedRegistries`", + "type": "array", + "items": { + "type": "string" + } + }, + "blocked_registries": { + "description": "BlockedRegistries: registries for which image pull and push actions are denied.\nTo specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name.\nFor example, *.example.com. You can specify an individual repository within a registry.\nFor example: reg1.io/myrepo/myapp:latest. All other registries are allowed.\nMutually exclusive with `AllowedRegistries`", + "type": "array", + "items": { + "type": "string" + } + }, + "insecure_registries": { + "description": "InsecureRegistries are registries which do not have a valid TLS certificate or only support HTTP connections.\nTo specify all subdomains, add the asterisk (*) wildcard character as a prefix to the domain name.\nFor example, *.example.com. You can specify an individual repository within a registry.\nFor example: reg1.io/myrepo/myapp:latest.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "ReleaseImageDetails": { + "properties": { + "available_upgrades": { + "description": "AvailableUpgrades is the list of versions this version can be upgraded to.", + "type": "array", + "items": { + "type": "string" + } + }, + "release_image": { + "description": "ReleaseImage contains the URI of Openshift release image.", + "type": "string" + } + } + }, + "ReleaseImages": { + "properties": { + "arm64": { + "description": "Arm64 will contain the reference for the arm64 image which will be used for cluster deployments", + "$ref": "#/components/schemas/ReleaseImageDetails" + }, + "multi": { + "description": "Multi will contain the reference for the multi image which will be used for cluster deployments", + "$ref": "#/components/schemas/ReleaseImageDetails" + } + } + }, + "ResourceRange": { + "properties": { + "max": { + "type": "integer", + "format": "int32" + }, + "min": { + "type": "integer", + "format": "int32" + } + } + }, + "RolePolicy": { + "properties": { + "arn": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "RolePolicyBinding": { + "properties": { + "arn": { + "type": "string" + }, + "creation_timestamp": { + "type": "string", + "format": "date-time" + }, + "last_update_timestamp": { + "type": "string", + "format": "date-time" + }, + "name": { + "type": "string" + }, + "policies": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RolePolicy" + } + }, + "status": { + "$ref": "#/components/schemas/RolePolicyBindingStatus" + }, + "type": { + "type": "string" + } + } + }, + "RolePolicyBindingStatus": { + "properties": { + "description": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "RootVolume": { + "description": "Root volume capabilities.", + "properties": { + "aws": { + "description": "AWS volume specification", + "$ref": "#/components/schemas/AWSVolume" + }, + "gcp": { + "description": "GCP Volume specification", + "$ref": "#/components/schemas/GCPVolume" + } + } + }, + "ScheduleType": { + "description": "ScheduleType defines which type of scheduling should be used for the upgrade policy.", + "type": "string", + "enum": [ + "automatic", + "manual" + ] + }, + "SdnToOvnClusterMigration": { + "description": "Details for `SdnToOvn` cluster migrations.", + "properties": { + "join_ipv4": { + "description": "The IP address range to use for the internalJoinSubnet parameter of OVN-Kubernetes\nupon migration.", + "type": "string" + }, + "masquerade_ipv4": { + "description": "The IP address range to us for the internalMasqueradeSubnet parameter of OVN-Kubernetes\nupon migration.", + "type": "string" + }, + "transit_ipv4": { + "description": "The IP address range to use for the internalTransSwitchSubnet parameter of OVN-Kubernetes\nupon migration.", + "type": "string" + } + } + }, + "SecurityGroup": { + "description": "AWS security group object", + "properties": { + "id": { + "description": "The security group ID.", + "type": "string" + }, + "name": { + "description": "Name of the security group according to its `Name` tag on AWS.", + "type": "string" + }, + "red_hat_managed": { + "description": "If the resource is RH managed.", + "type": "boolean" + } + } + }, + "ServerConfig": { + "description": "Representation of a server config", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ServerConfig' if this is a complete object or 'ServerConfigLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "aws_shard": { + "description": "Config for AWS provision shards", + "$ref": "#/components/schemas/AWSShard" + }, + "kubeconfig": { + "description": "The kubeconfig of the server.", + "type": "string" + }, + "server": { + "description": "The URL of the server.", + "type": "string" + }, + "topology": { + "description": "The topology of a provision shard (Optional).", + "$ref": "#/components/schemas/ProvisionShardTopology" + } + } + }, + "SocketTotalNodeRoleOSMetricNode": { + "description": "Representation of information from telemetry about a the socket capacity\nby node role and OS.", + "properties": { + "node_roles": { + "description": "Representation of the node role for a cluster.", + "type": "array", + "items": { + "type": "string" + } + }, + "operating_system": { + "description": "The operating system.", + "type": "string" + }, + "socket_total": { + "description": "The total socket capacity of nodes with this set of roles and operating system.", + "type": "number", + "format": "float" + }, + "time": { + "type": "string", + "format": "date-time" + } + } + }, + "SocketTotalsNodeRoleOSMetricNode": { + "description": "Representation of information from telemetry about the socket capacity by node\nrole and OS of a cluster.", + "properties": { + "socket_totals": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SocketTotalNodeRoleOSMetricNode" + } + } + } + }, + "StorageQuota": { + "description": "Representation of a storage quota ", + "properties": { + "unit": { + "description": "Unit of storage", + "type": "string" + }, + "value": { + "description": "Numerical value", + "type": "number", + "format": "float" + } + } + }, + "StsSupportJumpRole": { + "description": "Isolated STS support role created per organization.", + "properties": { + "role_arn": { + "description": "ARN of the support role created in the SRE jump account.", + "type": "string" + } + } + }, + "SubnetNetworkVerification": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'SubnetNetworkVerification' if this is a complete object or 'SubnetNetworkVerificationLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "details": { + "description": "Slice of failures that happened during a subnet network verification.", + "type": "array", + "items": { + "type": "string" + } + }, + "platform": { + "description": "Platform supplied to the network verifier for this subnet.", + "$ref": "#/components/schemas/Platform" + }, + "state": { + "description": "State of the subnet network verification.", + "type": "string" + }, + "tags": { + "description": "Tags supplied to the network verifier for this subnet.", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "Subnetwork": { + "description": "AWS subnetwork object to be used while installing a cluster", + "properties": { + "cidr_block": { + "description": "The CIDR Block of the subnet.", + "type": "string" + }, + "availability_zone": { + "description": "The availability zone to which the subnet is related.", + "type": "string" + }, + "name": { + "description": "Name of the subnet according to its `Name` tag on AWS.", + "type": "string" + }, + "public": { + "description": "Whether or not it is a public subnet.", + "type": "boolean" + }, + "red_hat_managed": { + "description": "If the resource is RH managed.", + "type": "boolean" + }, + "subnet_id": { + "description": "The subnet ID to be used while installing a cluster.", + "type": "string" + } + } + }, + "Subscription": { + "description": "Definition of a subscription.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Subscription' if this is a complete object or 'SubscriptionLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + } + } + }, + "Syncset": { + "description": "Representation of a syncset.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Syncset' if this is a complete object or 'SyncsetLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "resources": { + "description": "List of k8s objects to configure for the cluster.", + "type": "array", + "items": { + "type": "object" + } + } + } + }, + "Taint": { + "description": "Representation of a Taint set on a MachinePool in a cluster.", + "properties": { + "effect": { + "description": "The effect on the node for the pods matching the taint, i.e: NoSchedule, NoExecute, PreferNoSchedule.", + "type": "string" + }, + "key": { + "description": "The key for the taint", + "type": "string" + }, + "value": { + "description": "The value for the taint.", + "type": "string" + } + } + }, + "TokenClaimMappings": { + "description": "The claim mappings defined for users and groups.", + "properties": { + "groups": { + "description": "Groups is a name of the claim that should be used to construct groups for the cluster identity.", + "$ref": "#/components/schemas/GroupsClaim" + }, + "username": { + "description": "Username is a name of the claim that should be used to construct usernames for the cluster identity.", + "$ref": "#/components/schemas/UsernameClaim" + } + } + }, + "TokenClaimValidationRule": { + "description": "The rule that is applied to validate token claims to authenticate users.", + "properties": { + "claim": { + "description": "Claim is a name of a required claim.", + "type": "string" + }, + "required_value": { + "description": "RequiredValue is the required value for the claim.", + "type": "string" + } + } + }, + "TokenIssuer": { + "description": "Representation of a token issuer used in an external authentication.", + "properties": { + "ca": { + "description": "Certificate bundle to use to validate server certificates for the configured URL.", + "type": "string" + }, + "url": { + "description": "URL is the serving URL of the token issuer.", + "type": "string" + }, + "audiences": { + "description": "Audiences is an array of audiences that the token was issued for.\nValid tokens must include at least one of these values in their\n\"aud\" claim.\nMust be set to exactly one value.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "TrustedIp": { + "description": "Representation of a trusted ip address in clusterdeployment.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'TrustedIp' if this is a complete object or 'TrustedIpLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "enabled": { + "description": "The boolean set to show if the ip is enabled.", + "type": "boolean" + } + } + }, + "TuningConfig": { + "description": "Representation of a tuning config.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'TuningConfig' if this is a complete object or 'TuningConfigLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "name": { + "description": "Name of the tuning config.", + "type": "string" + }, + "spec": { + "description": "Spec of the tuning config.", + "type": "object" + } + } + }, + "UpgradePolicy": { + "description": "Representation of an upgrade policy that can be set for a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'UpgradePolicy' if this is a complete object or 'UpgradePolicyLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "cluster_id": { + "description": "Cluster ID this upgrade policy is defined for.", + "type": "string" + }, + "enable_minor_version_upgrades": { + "description": "Indicates if minor version upgrades are allowed for automatic upgrades (for manual it's always allowed).", + "type": "boolean" + }, + "next_run": { + "description": "Next time the upgrade should run.", + "type": "string", + "format": "date-time" + }, + "schedule": { + "description": "Schedule cron expression that defines automatic upgrade scheduling.", + "type": "string" + }, + "schedule_type": { + "description": "Schedule type of the upgrade.", + "$ref": "#/components/schemas/ScheduleType" + }, + "upgrade_type": { + "description": "Upgrade type specify the type of the upgrade.", + "$ref": "#/components/schemas/UpgradeType" + }, + "version": { + "description": "Version is the desired upgrade version.", + "type": "string" + } + } + }, + "UpgradePolicyState": { + "description": "Representation of an upgrade policy state that that is set for a cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'UpgradePolicyState' if this is a complete object or 'UpgradePolicyStateLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "description": { + "description": "Description of the state.", + "type": "string" + }, + "value": { + "description": "State value can be 'pending', 'scheduled', 'cancelled', 'started', 'delayed', \n'failed' or 'completed'.", + "$ref": "#/components/schemas/UpgradePolicyStateValue" + } + } + }, + "UpgradePolicyStateValue": { + "description": "Overall state of a cluster upgrade policy.", + "type": "string", + "enum": [ + "cancelled", + "completed", + "delayed", + "failed", + "pending", + "scheduled", + "started" + ] + }, + "UpgradeType": { + "description": "UpgradeType defines which type of upgrade should be used.", + "type": "string", + "enum": [ + "OSD", + "ADDON", + "ControlPlane", + "NodePool" + ] + }, + "User": { + "description": "Representation of a user.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'User' if this is a complete object or 'UserLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + } + } + }, + "UsernameClaim": { + "description": "The username claim mapping.", + "properties": { + "claim": { + "description": "The claim used in the token.", + "type": "string" + }, + "prefix": { + "description": "A prefix contatenated in the claim (Optional).", + "type": "string" + }, + "prefix_policy": { + "description": "PrefixPolicy specifies how a prefix should apply.\n\nBy default, claims other than `email` will be prefixed with the issuer URL to\nprevent naming clashes with other plugins.\n\nSet to \"NoPrefix\" to disable prefixing.", + "type": "string" + } + } + }, + "Value": { + "description": "Numeric value and the unit used to measure it.\n\nUnits are not mandatory, and they're not specified for some resources. For\nresources that use bytes, the accepted units are:\n\n- 1 B = 1 byte\n- 1 KB = 10^3 bytes\n- 1 MB = 10^6 bytes\n- 1 GB = 10^9 bytes\n- 1 TB = 10^12 bytes\n- 1 PB = 10^15 bytes\n\n- 1 B = 1 byte\n- 1 KiB = 2^10 bytes\n- 1 MiB = 2^20 bytes\n- 1 GiB = 2^30 bytes\n- 1 TiB = 2^40 bytes\n- 1 PiB = 2^50 bytes", + "properties": { + "unit": { + "description": "Name of the unit used to measure the value.", + "type": "string" + }, + "value": { + "description": "Numeric value.", + "type": "number", + "format": "float" + } + } + }, + "Version": { + "description": "Representation of an _OpenShift_ version.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Version' if this is a complete object or 'VersionLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "gcp_marketplace_enabled": { + "description": "GCPMarketplaceEnabled indicates if this version can be used to create GCP Marketplace clusters.", + "type": "boolean" + }, + "rosa_enabled": { + "description": "ROSAEnabled indicates whether this version can be used to create ROSA clusters.", + "type": "boolean" + }, + "available_upgrades": { + "description": "AvailableUpgrades is the list of versions this version can be upgraded to.", + "type": "array", + "items": { + "type": "string" + } + }, + "channel_group": { + "description": "ChannelGroup is the name of the group where this image belongs.\nChannelGroup is a mechanism to partition the images to different groups,\neach image belongs to only a single group.", + "type": "string" + }, + "default": { + "description": "Indicates if this should be selected as the default version when a cluster is created\nwithout specifying explicitly the version.", + "type": "boolean" + }, + "enabled": { + "description": "Indicates if this version can be used to create clusters.", + "type": "boolean" + }, + "end_of_life_timestamp": { + "description": "EndOfLifeTimestamp is the date and time when the version will get to End of Life, using the\nformat defined in https://www.ietf.org/rfc/rfc3339.txt[RC3339].", + "type": "string", + "format": "date-time" + }, + "hosted_control_plane_default": { + "description": "HostedControlPlaneDefault is a flag that indicates if this should be selected as the default version when a\nHCP cluster is created without specifying explicitly the version.", + "type": "boolean" + }, + "hosted_control_plane_enabled": { + "description": "HostedControlPlaneEnabled indicates whether this version can be used to create HCP clusters.", + "type": "boolean" + }, + "image_overrides": { + "description": "ImageOverrides contains the lists of images per cloud provider.", + "$ref": "#/components/schemas/ImageOverrides" + }, + "raw_id": { + "description": "RawID is the id of the version - without channel group and prefix.", + "type": "string" + }, + "release_image": { + "description": "ReleaseImage contains the URI of Openshift release image for amd64 architecture.", + "type": "string" + }, + "release_images": { + "description": "ReleaseImages contains the URI of OpenShift release images for arm64 and multi architectures.", + "$ref": "#/components/schemas/ReleaseImages" + }, + "wif_enabled": { + "description": "WifEnabled is a flag that indicates whether this version is enabled for Workload Identity Federation.", + "type": "boolean" + } + } + }, + "VersionGate": { + "description": "Representation of an _OpenShift_ version gate.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'VersionGate' if this is a complete object or 'VersionGateLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "sts_only": { + "description": "STSOnly indicates if this version gate is for STS clusters only,\ndeprecated: to be replaced with ClusterCondition", + "type": "boolean" + }, + "cluster_condition": { + "description": "ClusterCondition aims at selecting the clusters targeted by this version gate,\nignored if STSOnly is true", + "type": "string" + }, + "creation_timestamp": { + "description": "CreationTimestamp is the date and time when the version gate was created,\nformat defined in https://www.ietf.org/rfc/rfc3339.txt[RC3339].", + "type": "string", + "format": "date-time" + }, + "description": { + "description": "Description of the version gate.", + "type": "string" + }, + "documentation_url": { + "description": "DocumentationURL is the URL for the documentation of the version gate.", + "type": "string" + }, + "label": { + "description": "Label representing the version gate in OpenShift.", + "type": "string" + }, + "value": { + "description": "Value represents the required value of the label.", + "type": "string" + }, + "version_raw_id_prefix": { + "description": "VersionRawIDPrefix represents the versions prefix that the gate applies to.", + "type": "string" + }, + "warning_message": { + "description": "WarningMessage is a warning that will be displayed to the user before they acknowledge the gate", + "type": "string" + } + } + }, + "VersionGateAgreement": { + "description": "VersionGateAgreement represents a version gate that the user agreed to for a specific cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'VersionGateAgreement' if this is a complete object or 'VersionGateAgreementLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "agreed_timestamp": { + "description": "The time the user agreed to the version gate", + "type": "string", + "format": "date-time" + }, + "version_gate": { + "description": "link to the version gate that the user agreed to", + "$ref": "#/components/schemas/VersionGate" + } + } + }, + "WifAccessMethod": { + "type": "string", + "enum": [ + "impersonate", + "vm", + "wif" + ] + }, + "WifConfig": { + "description": "Definition of an wif_config resource.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'WifConfig' if this is a complete object or 'WifConfigLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "display_name": { + "description": "The name OCM clients will display for this wif_config.", + "type": "string" + }, + "gcp": { + "description": "Holds GCP related data.", + "$ref": "#/components/schemas/WifGcp" + }, + "organization": { + "description": "The OCM organization that this wif_config resource belongs to.", + "$ref": "#/components/schemas/OrganizationLink" + }, + "wif_templates": { + "description": "Wif template(s) used to configure IAM resources", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "WifConfigStatus": { + "description": "Configuration status of a WifConfig.", + "properties": { + "configured": { + "description": "Indicates the current status of the WifConfig resource configuration.\n- `false`: The WifConfig resource has a user configuration error.\n- `true`: The resources associated with the WifConfig object are properly configured and operational at the time of the check.", + "type": "boolean" + }, + "description": { + "description": "Provides additional information about the WifConfig resource status.\n- When `Configured` is `false`, this field contains details about the user configuration error.\n- When `Configured` is `true`, this field may be empty or contain optional notes about the configuration.", + "type": "string" + } + } + }, + "WifCredentialRequest": { + "properties": { + "secret_ref": { + "$ref": "#/components/schemas/WifSecretRef" + }, + "service_account_names": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "WifGcp": { + "properties": { + "impersonator_email": { + "description": "This is the service account email that OCM will use to access other SAs. ", + "type": "string" + }, + "project_id": { + "description": "This represents the GCP project ID in which the wif resources will be configured.", + "type": "string" + }, + "project_number": { + "description": "This represents the GCP project number in which the wif resources will be configured.", + "type": "string" + }, + "role_prefix": { + "description": "Prefix for naming GCP custom roles configured.", + "type": "string" + }, + "service_accounts": { + "description": "The list of service accounts and their associated roles that will need to be\nconfigured on the user's GCP project.", + "type": "array", + "items": { + "$ref": "#/components/schemas/WifServiceAccount" + } + }, + "support": { + "description": "Defines the access configuration for support.", + "$ref": "#/components/schemas/WifSupport" + }, + "workload_identity_pool": { + "description": "The workload identity configuration data that will be used to create the\nworkload identity pool on the user's account.", + "$ref": "#/components/schemas/WifPool" + } + } + }, + "WifIdentityProvider": { + "properties": { + "allowed_audiences": { + "type": "array", + "items": { + "type": "string" + } + }, + "identity_provider_id": { + "type": "string" + }, + "issuer_url": { + "type": "string" + }, + "jwks": { + "type": "string" + } + } + }, + "WifPool": { + "properties": { + "identity_provider": { + "description": "Identity provider configuration data that will be created as part of the\nworkload identity pool.", + "$ref": "#/components/schemas/WifIdentityProvider" + }, + "pool_id": { + "description": "The Id of the workload identity pool.", + "type": "string" + }, + "pool_name": { + "description": "The display name of the workload identity pool.", + "type": "string" + } + } + }, + "WifRole": { + "properties": { + "permissions": { + "type": "array", + "items": { + "type": "string" + } + }, + "predefined": { + "type": "boolean" + }, + "role_id": { + "type": "string" + } + } + }, + "WifSecretRef": { + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + } + } + }, + "WifServiceAccount": { + "properties": { + "access_method": { + "$ref": "#/components/schemas/WifAccessMethod" + }, + "credential_request": { + "$ref": "#/components/schemas/WifCredentialRequest" + }, + "osd_role": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WifRole" + } + }, + "service_account_id": { + "type": "string" + } + } + }, + "WifSupport": { + "properties": { + "principal": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WifRole" + } + } + } + }, + "WildcardPolicy": { + "description": "Type of wildcard policy.", + "type": "string", + "enum": [ + "WildcardsAllowed", + "WildcardsDisallowed" + ] + }, + "Error": { + "type": "object", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will always be 'Error'", + "type": "string" + }, + "id": { + "description": "Numeric identifier of the error.", + "type": "integer", + "format": "int32" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "description": "Globally unique code of the error, composed of the unique identifier of the API and the numeric identifier of the error. For example, for if the numeric identifier of the error is `93` and the identifier of the API is `clusters_mgmt` then the code will be `CLUSTERS-MGMT-93`.", + "type": "string" + }, + "reason": { + "description": "Human readable description of the error.", + "type": "string" + }, + "details": { + "description": "Extra information about the error.", + "type": "object", + "additionalProperties": true + } + } + } + }, + "securitySchemes": { + "bearer": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "security": [ + { + "bearer": [ + + ] + } + ] +} \ No newline at end of file diff --git a/openapi/job_queue/v1/openapi.json b/openapi/job_queue/v1/openapi.json new file mode 100644 index 00000000..7c850fe0 --- /dev/null +++ b/openapi/job_queue/v1/openapi.json @@ -0,0 +1,574 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "v1", + "title": "job_queue", + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + }, + "contact": { + "name": "OCM Feedback", + "email": "ocm-feedback@redhat.com" + } + }, + "servers": [ + { + "description": "Production", + "url": "https://api.openshift.com" + }, + { + "description": "Stage", + "url": "https://api.stage.openshift.com" + } + ], + "paths": { + "/api/job_queue/v1": { + "get": { + "description": "Retrieves the version metadata.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Metadata" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/job_queue/v1/queues": { + "get": { + "description": "Retrieves a list of job queues.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.\nPage may be a token to the next page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of job queues.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Queue" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.\nPage may be a token to the next page", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection regardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/job_queue/v1/queues/{queue_id}": { + "get": { + "description": "Retrieves the details of a job queue by ID.", + "parameters": [ + { + "name": "queue_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Queue" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/job_queue/v1/queues/{queue_id}/pop": { + "post": { + "description": "POP new job from a job queue", + "parameters": [ + { + "name": "queue_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "id": { + "type": "string" + }, + "abandoned_at": { + "type": "string", + "format": "date-time" + }, + "arguments": { + "type": "string" + }, + "attempts": { + "type": "integer", + "format": "int32" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "kind": { + "type": "string" + }, + "receipt_id": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/job_queue/v1/queues/{queue_id}/push": { + "post": { + "description": "PUSH a new job into job queue", + "parameters": [ + { + "name": "queue_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "abandoned_at": { + "type": "string", + "format": "date-time" + }, + "arguments": { + "type": "string" + }, + "attempts": { + "type": "integer", + "format": "int32" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "id": { + "type": "string" + }, + "abandoned_at": { + "type": "string", + "format": "date-time" + }, + "arguments": { + "type": "string" + }, + "attempts": { + "type": "integer", + "format": "int32" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "kind": { + "type": "string" + }, + "receipt_id": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/job_queue/v1/queues/{queue_id}/jobs/{job_id}/failure": { + "post": { + "description": "Mark a job as Failed. This method returns '204 No Content'", + "parameters": [ + { + "name": "queue_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "job_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "failure_reason": { + "type": "string" + }, + "receipt_id": { + "description": "A unique ID of a pop'ed job", + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/job_queue/v1/queues/{queue_id}/jobs/{job_id}/success": { + "post": { + "description": "Mark a job as Successful. This method returns '204 No Content'", + "parameters": [ + { + "name": "queue_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "job_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "receipt_id": { + "description": "A unique ID of a pop'ed job", + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Metadata": { + "description": "Version metadata.", + "properties": { + "server_version": { + "description": "Version of the server.", + "type": "string" + } + } + }, + "Job": { + "description": "This struct is a job in a Job Queue.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Job' if this is a complete object or 'JobLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "abandoned_at": { + "description": "DLQ sent timestamp", + "type": "string", + "format": "date-time" + }, + "arguments": { + "description": "Arguments to run Job with.", + "type": "string" + }, + "attempts": { + "description": "Number of retries.", + "type": "integer", + "format": "int32" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "receipt_id": { + "description": "Each time a specific job is pop'd, the receiptId will change, while the ID stays the same.", + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "Queue": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Queue' if this is a complete object or 'QueueLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "max_attempts": { + "description": "SQS Visibility Timeout", + "type": "integer", + "format": "int32" + }, + "max_run_time": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "Error": { + "type": "object", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will always be 'Error'", + "type": "string" + }, + "id": { + "description": "Numeric identifier of the error.", + "type": "integer", + "format": "int32" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "description": "Globally unique code of the error, composed of the unique identifier of the API and the numeric identifier of the error. For example, for if the numeric identifier of the error is `93` and the identifier of the API is `clusters_mgmt` then the code will be `CLUSTERS-MGMT-93`.", + "type": "string" + }, + "reason": { + "description": "Human readable description of the error.", + "type": "string" + }, + "details": { + "description": "Extra information about the error.", + "type": "object", + "additionalProperties": true + } + } + } + }, + "securitySchemes": { + "bearer": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "security": [ + { + "bearer": [ + + ] + } + ] +} \ No newline at end of file diff --git a/openapi/osd_fleet_mgmt/v1/openapi.json b/openapi/osd_fleet_mgmt/v1/openapi.json new file mode 100644 index 00000000..60883393 --- /dev/null +++ b/openapi/osd_fleet_mgmt/v1/openapi.json @@ -0,0 +1,1145 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "v1", + "title": "osd_fleet_mgmt", + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + }, + "contact": { + "name": "OCM Feedback", + "email": "ocm-feedback@redhat.com" + } + }, + "servers": [ + { + "description": "Production", + "url": "https://api.openshift.com" + }, + { + "description": "Stage", + "url": "https://api.stage.openshift.com" + } + ], + "paths": { + "/api/osd_fleet_mgmt/v1": { + "get": { + "description": "Retrieves the version metadata.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Metadata" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/osd_fleet_mgmt/v1/management_clusters": { + "get": { + "description": "Retrieves the list of management clusters.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved a list of management clusters.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ManagementCluster" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/osd_fleet_mgmt/v1/management_clusters/{management_cluster_id}": { + "delete": { + "description": "Deletes the management cluster.", + "parameters": [ + { + "name": "management_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the management cluster.", + "parameters": [ + { + "name": "management_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ManagementCluster" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "post": { + "description": "Updates the management cluster.", + "parameters": [ + { + "name": "management_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ManagementClusterRequestPayload" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ManagementCluster" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/osd_fleet_mgmt/v1/management_clusters/{management_cluster_id}/labels": { + "get": { + "description": "Retrieves the list of labels.", + "parameters": [ + { + "name": "management_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved a list of labels.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/osd_fleet_mgmt/v1/management_clusters/{management_cluster_id}/labels/{label_id}": { + "delete": { + "description": "Deletes the label.", + "parameters": [ + { + "name": "management_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the cluster.", + "parameters": [ + { + "name": "management_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "post": { + "description": "Creates the label.", + "parameters": [ + { + "name": "management_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LabelRequestPayload" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/osd_fleet_mgmt/v1/service_clusters": { + "get": { + "description": "Retrieves the list of service clusters.", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved a list of service clusters.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ServiceCluster" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/osd_fleet_mgmt/v1/service_clusters/{service_cluster_id}": { + "delete": { + "description": "Deletes the service cluster.", + "parameters": [ + { + "name": "service_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the cluster.", + "parameters": [ + { + "name": "service_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ServiceCluster" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "post": { + "description": "Updates the service cluster.", + "parameters": [ + { + "name": "service_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ServiceClusterRequestPayload" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ServiceCluster" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/osd_fleet_mgmt/v1/service_clusters/{service_cluster_id}/labels": { + "get": { + "description": "Retrieves the list of labels.", + "parameters": [ + { + "name": "service_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved a list of labels.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/osd_fleet_mgmt/v1/service_clusters/{service_cluster_id}/labels/{label_id}": { + "delete": { + "description": "Deletes the label.", + "parameters": [ + { + "name": "service_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the cluster.", + "parameters": [ + { + "name": "service_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "post": { + "description": "Creates the label.", + "parameters": [ + { + "name": "service_cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "label_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LabelRequestPayload" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Label" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Metadata": { + "description": "Version metadata.", + "properties": { + "server_version": { + "description": "Version of the server.", + "type": "string" + } + } + }, + "DNS": { + "description": "DNS settings of the cluster.", + "properties": { + "base_domain": { + "description": "Base DNS domain of the cluster.\n\nDuring the installation of the cluster it is necessary to create multiple DNS records.\nThey will be created as sub-domains of this domain. For example, if the name of the\ncluster is `mycluster` and the base domain is `example.com` then the following DNS\nrecords will be created:\n\n```\nmycluster-api.example.com\nmycluster-etcd-0.example.com\nmycluster-etcd-1.example.com\nmycluster-etcd-3.example.com\n```\n\nThe exact number, type and names of the created DNS record depends on the characteristics\nof the cluster, and may be different for different versions of _OpenShift_. Please don't\nrely on them. For example, to find what is the URL of the Kubernetes API server of the\ncluster don't assume that it will be `mycluster-api.example.com`. Instead of that use\nthis API to retrieve the description of the cluster, and get it from the `api.url`\nattribute. For example, if the identifier of the cluster is `123` send a request like\nthis:\n\n```http\nGET /api/clusters_mgmt/v1/clusters/123 HTTP/1.1\n```\n\nThat will return a response like this, including the `api.url` attribute:\n\n```json\n{\n \"kind\": \"Cluster\",\n \"id\": \"123\",\n \"href\": \"/api/clusters_mgmt/v1/clusters/123\",\n \"api\": {\n \"url\": \"https://mycluster-api.example.com:6443\"\n },\n ...\n}\n```\n\nWhen the cluster is created in Amazon Web Services it is necessary to create this base\nDNS domain in advance, using AWS Route53 (https://console.aws.amazon.com/route53).", + "type": "string" + } + } + }, + "ClusterManagementReference": { + "description": "Cluster Mgmt reference settings of the cluster.", + "properties": { + "cluster_id": { + "description": "Cluster Mgmt ID ", + "type": "string" + }, + "href": { + "description": "Reference link to external cluster_mgmt service based on ClusterId field\nClusterId is not the name of the field used by the external cluster_mgmt service", + "type": "string" + } + } + }, + "Label": { + "description": "label settings of the cluster.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Label' if this is a complete object or 'LabelLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "key": { + "description": "Label key associated to the OSD FM managed cluster", + "type": "string" + }, + "value": { + "description": "Label value associated to the OSD FM managed cluster", + "type": "string" + } + } + }, + "LabelReference": { + "description": "label reference settings of the cluster.", + "properties": { + "href": { + "description": "link to the Label associated to the OSD FM managed cluster", + "type": "string" + }, + "id": { + "description": "Id of the Label associated to the OSD FM managed cluster", + "type": "string" + } + } + }, + "LabelRequestPayload": { + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "ManagementCluster": { + "description": "Definition of an _OpenShift_ cluster.\n\nThe `cloud_provider` attribute is a reference to the cloud provider. When a\ncluster is retrieved it will be a link to the cloud provider, containing only\nthe kind, id and href attributes:\n\n```json\n{\n \"cloud_provider\": {\n \"kind\": \"CloudProviderLink\",\n \"id\": \"123\",\n \"href\": \"/api/clusters_mgmt/v1/cloud_providers/123\"\n }\n}\n```\n\nWhen a cluster is created this is optional, and if used it should contain the\nidentifier of the cloud provider to use:\n\n```json\n{\n \"cloud_provider\": {\n \"id\": \"123\",\n }\n}\n```\n\nIf not included, then the cluster will be created using the default cloud\nprovider, which is currently Amazon Web Services.\n\nThe region attribute is mandatory when a cluster is created.\n\nThe `aws.access_key_id`, `aws.secret_access_key` and `dns.base_domain`\nattributes are mandatory when creation a cluster with your own Amazon Web\nServices account.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ManagementCluster' if this is a complete object or 'ManagementClusterLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "dns": { + "description": "DNS settings of the cluster.", + "$ref": "#/components/schemas/DNS" + }, + "cloud_provider": { + "description": "Cloud provider where the cluster is installed.", + "type": "string" + }, + "cluster_management_reference": { + "description": "Cluster mgmt reference", + "$ref": "#/components/schemas/ClusterManagementReference" + }, + "creation_timestamp": { + "description": "Creation timestamp of the cluster", + "type": "string", + "format": "date-time" + }, + "labels": { + "description": "Labels on management cluster", + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "name": { + "description": "Cluster name", + "type": "string" + }, + "parent": { + "description": "Service cluster handling the management cluster", + "$ref": "#/components/schemas/ManagementClusterParent" + }, + "region": { + "description": "Cloud provider region where the cluster is installed.", + "type": "string" + }, + "sector": { + "description": "Sector of cluster", + "type": "string" + }, + "status": { + "description": "Status of cluster", + "type": "string" + }, + "update_timestamp": { + "description": "Update timestamp of the cluster", + "type": "string", + "format": "date-time" + } + } + }, + "ManagementClusterParent": { + "description": "ManagementClusterParent reference settings of the cluster.", + "properties": { + "cluster_id": { + "description": "Parent Cluster ID ", + "type": "string" + }, + "href": { + "description": "Reference link to internal parent cluster", + "type": "string" + }, + "kind": { + "description": "Kind of internal parent cluster", + "type": "string" + }, + "name": { + "description": "Parent Cluster Name", + "type": "string" + } + } + }, + "ManagementClusterRequestPayload": { + "properties": { + "service_cluster_id_service_cluster_id_service_cluster_id_service_cluster_id_id": { + "type": "string" + } + } + }, + "ProvisionShardReference": { + "description": "Provision Shard Reference of the cluster.", + "properties": { + "href": { + "description": "link to the Provision Shards associated to the cluster", + "type": "string" + }, + "id": { + "description": "Id of the Provision Shards associated to the Ocluster", + "type": "string" + } + } + }, + "ServiceCluster": { + "description": "Definition of an _OpenShift_ cluster.\n\nThe `cloud_provider` attribute is a reference to the cloud provider. When a\ncluster is retrieved it will be a link to the cloud provider, containing only\nthe kind, id and href attributes:\n\n```json\n{\n \"cloud_provider\": {\n \"kind\": \"CloudProviderLink\",\n \"id\": \"123\",\n \"href\": \"/api/clusters_mgmt/v1/cloud_providers/123\"\n }\n}\n```\n\nWhen a cluster is created this is optional, and if used it should contain the\nidentifier of the cloud provider to use:\n\n```json\n{\n \"cloud_provider\": {\n \"id\": \"123\",\n }\n}\n```\n\nIf not included, then the cluster will be created using the default cloud\nprovider, which is currently Amazon Web Services.\n\nThe region attribute is mandatory when a cluster is created.\n\nThe `aws.access_key_id`, `aws.secret_access_key` and `dns.base_domain`\nattributes are mandatory when creation a cluster with your own Amazon Web\nServices account.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ServiceCluster' if this is a complete object or 'ServiceClusterLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "dns": { + "description": "DNS settings of the cluster.", + "$ref": "#/components/schemas/DNS" + }, + "cloud_provider": { + "description": "Cloud provider where the cluster is installed.", + "type": "string" + }, + "cluster_management_reference": { + "description": "Cluster mgmt reference", + "$ref": "#/components/schemas/ClusterManagementReference" + }, + "labels": { + "description": "Labels on service cluster", + "type": "array", + "items": { + "$ref": "#/components/schemas/Label" + } + }, + "name": { + "description": "Cluster name", + "type": "string" + }, + "provision_shard_reference": { + "description": "Provision shard reference for the service cluster", + "$ref": "#/components/schemas/ProvisionShardReference" + }, + "region": { + "description": "Cloud provider region where the cluster is installed.", + "type": "string" + }, + "sector": { + "description": "Sector of cluster", + "type": "string" + }, + "status": { + "description": "Status of cluster", + "type": "string" + } + } + }, + "ServiceClusterRequestPayload": { + "properties": { + "cloud_provider": { + "type": "string" + }, + "labels": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LabelRequestPayload" + } + }, + "region": { + "type": "string" + } + } + }, + "Error": { + "type": "object", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will always be 'Error'", + "type": "string" + }, + "id": { + "description": "Numeric identifier of the error.", + "type": "integer", + "format": "int32" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "description": "Globally unique code of the error, composed of the unique identifier of the API and the numeric identifier of the error. For example, for if the numeric identifier of the error is `93` and the identifier of the API is `clusters_mgmt` then the code will be `CLUSTERS-MGMT-93`.", + "type": "string" + }, + "reason": { + "description": "Human readable description of the error.", + "type": "string" + }, + "details": { + "description": "Extra information about the error.", + "type": "object", + "additionalProperties": true + } + } + } + }, + "securitySchemes": { + "bearer": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "security": [ + { + "bearer": [ + + ] + } + ] +} \ No newline at end of file diff --git a/openapi/service_logs/v1/openapi.json b/openapi/service_logs/v1/openapi.json new file mode 100644 index 00000000..b395431f --- /dev/null +++ b/openapi/service_logs/v1/openapi.json @@ -0,0 +1,597 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "v1", + "title": "service_logs", + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + }, + "contact": { + "name": "OCM Feedback", + "email": "ocm-feedback@redhat.com" + } + }, + "servers": [ + { + "description": "Production", + "url": "https://api.openshift.com" + }, + { + "description": "Stage", + "url": "https://api.stage.openshift.com" + } + ], + "paths": { + "/api/service_logs/v1": { + "get": { + "description": "Retrieves the version metadata.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Metadata" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/service_logs/v1/cluster_logs": { + "post": { + "description": "Creates a new log entry.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LogEntry" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LogEntry" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of cluster logs.\nUse this endpoint to list service logs (including private logs).\nThis endpoint is limited to users who allowed to view private logs.", + "parameters": [ + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement. For example, in order to sort the\ncluster logs descending by name identifier the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the cluster logs\ninstead of the names of the columns of a table. For example, in order to\nretrieve cluster logs with service_name starting with my:\n\n```sql\nservice_name like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of Cluster logs.", + "type": "array", + "items": { + "$ref": "#/components/schemas/LogEntry" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/service_logs/v1/cluster_logs/{log_entry_id}": { + "delete": { + "description": "Deletes the log entry.", + "parameters": [ + { + "name": "log_entry_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the details of the log entry.", + "parameters": [ + { + "name": "log_entry_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LogEntry" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/service_logs/v1/clusters/cluster_logs": { + "get": { + "description": "Retrieves the list of cluster logs by the cluster_id and/or cluster_uuid parameters.\nUse this endpoint to list service logs for a specific cluster (excluding private logs).\nAny authenticated user is able to use this endpoint without any special permissions.", + "parameters": [ + { + "name": "cluster_id", + "description": "cluster_id parameter.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "cluster_uuid", + "description": "cluster_uuid parameter.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement. For example, in order to sort the\ncluster logs descending by name identifier the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the cluster logs\ninstead of the names of the columns of a table. For example, in order to\nretrieve cluster logs with service_name starting with my:\n\n```sql\nservice_name like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of Cluster logs.", + "type": "array", + "items": { + "$ref": "#/components/schemas/LogEntry" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/service_logs/v1/clusters/{cluster_id}/cluster_logs": { + "get": { + "description": "Retrieves the list of cluster logs by cluster uuid.", + "parameters": [ + { + "name": "cluster_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order", + "description": "Order criteria.\n\nThe syntax of this parameter is similar to the syntax of the _order by_ clause of\na SQL statement. For example, in order to sort the\ncluster logs descending by name identifier the value should be:\n\n```sql\nname desc\n```\n\nIf the parameter isn't provided, or if the value is empty, then the order of the\nresults is undefined.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "description": "Search criteria.\n\nThe syntax of this parameter is similar to the syntax of the _where_ clause\nof an SQL statement, but using the names of the attributes of the cluster logs\ninstead of the names of the columns of a table. For example, in order to\nretrieve cluster logs with service_name starting with my:\n\n```sql\nservice_name like 'my%'\n```\n\nIf the parameter isn't provided, or if the value is empty, then all the\nitems that the user has permission to see will be returned.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of Cluster logs.", + "type": "array", + "items": { + "$ref": "#/components/schemas/LogEntry" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Metadata": { + "description": "Version metadata.", + "properties": { + "server_version": { + "description": "Version of the server.", + "type": "string" + } + } + }, + "LogEntry": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'LogEntry' if this is a complete object or 'LogEntryLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "cluster_id": { + "description": "Internal cluster ID.", + "type": "string" + }, + "cluster_uuid": { + "description": "External cluster ID.", + "type": "string" + }, + "created_at": { + "description": "The time at which the cluster log was created.", + "type": "string", + "format": "date-time" + }, + "created_by": { + "description": "The name of the user who created the cluster log.", + "type": "string" + }, + "description": { + "description": "Full description of the log entry content (supports Markdown format as well).", + "type": "string" + }, + "doc_references": { + "description": "The list of documentation references (i.e links) contained in the event.", + "type": "array", + "items": { + "type": "string" + } + }, + "event_stream_id": { + "description": "Log custom event id for a simple search of related cluster logs.", + "type": "string" + }, + "internal_only": { + "description": "A flag that indicates whether the log entry should be internal/private only.", + "type": "boolean" + }, + "log_type": { + "description": "Type of the service log entry.", + "$ref": "#/components/schemas/LogType" + }, + "service_name": { + "description": "The name of the service who created the log.", + "type": "string" + }, + "severity": { + "description": "Log severity for the specific log entry.", + "$ref": "#/components/schemas/Severity" + }, + "subscription_id": { + "description": "The related subscription id of the cluster.", + "type": "string" + }, + "summary": { + "description": "Title of the log entry.", + "type": "string" + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "username": { + "description": "The username that triggered the event (if available).", + "type": "string" + } + } + }, + "LogType": { + "description": "Representation of the log type field used in cluster log type model.", + "type": "string", + "enum": [ + "clustercreate-details", + "clustercreate-high-level", + "clusterremove-details", + "clusterremove-high-level", + "cluster-state-updates" + ] + }, + "Severity": { + "type": "string", + "enum": [ + "Debug", + "Error", + "Fatal", + "Info", + "Warning" + ] + }, + "Error": { + "type": "object", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will always be 'Error'", + "type": "string" + }, + "id": { + "description": "Numeric identifier of the error.", + "type": "integer", + "format": "int32" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "description": "Globally unique code of the error, composed of the unique identifier of the API and the numeric identifier of the error. For example, for if the numeric identifier of the error is `93` and the identifier of the API is `clusters_mgmt` then the code will be `CLUSTERS-MGMT-93`.", + "type": "string" + }, + "reason": { + "description": "Human readable description of the error.", + "type": "string" + }, + "details": { + "description": "Extra information about the error.", + "type": "object", + "additionalProperties": true + } + } + } + }, + "securitySchemes": { + "bearer": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "security": [ + { + "bearer": [ + + ] + } + ] +} \ No newline at end of file diff --git a/openapi/service_mgmt/v1/openapi.json b/openapi/service_mgmt/v1/openapi.json new file mode 100644 index 00000000..9f93726a --- /dev/null +++ b/openapi/service_mgmt/v1/openapi.json @@ -0,0 +1,664 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "v1", + "title": "service_mgmt", + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + }, + "contact": { + "name": "OCM Feedback", + "email": "ocm-feedback@redhat.com" + } + }, + "servers": [ + { + "description": "Production", + "url": "https://api.openshift.com" + }, + { + "description": "Stage", + "url": "https://api.stage.openshift.com" + } + ], + "paths": { + "/api/service_mgmt/v1": { + "get": { + "description": "Retrieves the version metadata.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Metadata" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/service_mgmt/v1/services": { + "post": { + "description": "Creates a new Managed Service", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ManagedService" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ManagedService" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Lists the Managed Services the user has running", + "parameters": [ + { + "name": "page", + "description": "Index of the requested page, where one corresponds to the first page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "description": "Maximum number of items that will be contained in the returned page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "description": "Retrieved list of clusters.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ManagedService" + } + }, + "page": { + "description": "Index of the requested page, where one corresponds to the first page.", + "type": "integer", + "format": "int32" + }, + "size": { + "description": "Maximum number of items that will be contained in the returned page.", + "type": "integer", + "format": "int32" + }, + "total": { + "description": "Total number of items of the collection that match the search criteria,\nregardless of the size of the page.", + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/service_mgmt/v1/services/version_inquiry": { + "post": { + "description": "Returns the Openshift version a service of this type will use.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionInquiryRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionInquiryResponse" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/service_mgmt/v1/services/{service_id}": { + "delete": { + "description": "Deletes the Managed Service", + "parameters": [ + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Gets information on the Managed Service", + "parameters": [ + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ManagedService" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ManagedService" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ManagedService" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Metadata": { + "description": "Version metadata.", + "properties": { + "server_version": { + "description": "Version of the server.", + "type": "string" + } + } + }, + "AWS": { + "description": "_Amazon Web Services_ specific settings of a cluster.", + "properties": { + "sts": { + "description": "Contains the necessary attributes to support role-based authentication on AWS.", + "$ref": "#/components/schemas/STS" + }, + "access_key_id": { + "description": "AWS access key identifier.", + "type": "string" + }, + "account_id": { + "description": "AWS account identifier.", + "type": "string" + }, + "private_link": { + "description": "For PrivateLink-enabled clusters", + "type": "boolean" + }, + "secret_access_key": { + "description": "AWS secret access key.", + "type": "string" + }, + "subnet_ids": { + "description": "The subnet ids to be used when installing the cluster.", + "type": "array", + "items": { + "type": "string" + } + }, + "tags": { + "description": "Optional keys and values that the installer will add as tags to all AWS resources it creates", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "STS": { + "description": "Contains the necessary attributes to support role-based authentication on AWS.", + "properties": { + "oidc_endpoint_url": { + "description": "URL of the location where OIDC configuration and keys are available", + "type": "string" + }, + "instance_iam_roles": { + "description": "Instance IAM roles to use for the instance profiles of the master and worker instances", + "$ref": "#/components/schemas/InstanceIAMRoles" + }, + "operator_iam_roles": { + "description": "List of roles necessary to access the AWS resources of the various operators used during installation", + "type": "array", + "items": { + "$ref": "#/components/schemas/OperatorIAMRole" + } + }, + "operator_role_prefix": { + "type": "string" + }, + "role_arn": { + "description": "ARN of the AWS role to assume when installing the cluster", + "type": "string" + }, + "support_role_arn": { + "description": "ARN of the AWS role used by SREs to access the cluster AWS account in order to provide support", + "type": "string" + } + } + }, + "CloudRegion": { + "description": "Description of a region of a cloud provider.", + "properties": { + "id": { + "description": "Human-friendly identifier of the region, for example `us-east-1`.", + "type": "string" + } + } + }, + "Cluster": { + "description": "This represents the parameters needed by Managed Service to create a cluster.", + "properties": { + "api": { + "$ref": "#/components/schemas/ClusterAPI" + }, + "aws": { + "$ref": "#/components/schemas/AWS" + }, + "display_name": { + "description": "DisplayName is the name of the cluster for display purposes.\nIt can contain spaces.", + "type": "string" + }, + "href": { + "type": "string" + }, + "id": { + "type": "string" + }, + "multi_az": { + "description": "Flag indicating if the cluster should be created with nodes in\ndifferent availability zones or all the nodes in a single one\nrandomly selected.", + "type": "boolean" + }, + "name": { + "type": "string" + }, + "network": { + "$ref": "#/components/schemas/Network" + }, + "nodes": { + "$ref": "#/components/schemas/ClusterNodes" + }, + "properties": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "region": { + "$ref": "#/components/schemas/CloudRegion" + }, + "state": { + "type": "string" + } + } + }, + "ClusterAPI": { + "description": "Information about the API of a cluster.", + "properties": { + "listening": { + "description": "The listening method of the API server.", + "$ref": "#/components/schemas/ListeningMethod" + } + } + }, + "ClusterNodes": { + "properties": { + "availability_zones": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "InstanceIAMRoles": { + "description": "Contains the necessary attributes to support role-based authentication on AWS.", + "properties": { + "master_role_arn": { + "description": "The IAM role ARN that will be attached to master instances", + "type": "string" + }, + "worker_role_arn": { + "description": "The IAM role ARN that will be attached to worker instances", + "type": "string" + } + } + }, + "ListeningMethod": { + "description": "Cluster components listening method.", + "type": "string", + "enum": [ + "external", + "internal" + ] + }, + "ManagedService": { + "description": "Represents data about a running Managed Service.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ManagedService' if this is a complete object or 'ManagedServiceLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "addon": { + "$ref": "#/components/schemas/StatefulObject" + }, + "cluster": { + "$ref": "#/components/schemas/Cluster" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "expired_at": { + "type": "string", + "format": "date-time" + }, + "parameters": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ServiceParameter" + } + }, + "resources": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StatefulObject" + } + }, + "service": { + "type": "string" + }, + "service_state": { + "type": "string" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "Network": { + "description": "Network configuration of a cluster.", + "properties": { + "host_prefix": { + "description": "Network host prefix which is defaulted to `23` if not specified.", + "type": "integer", + "format": "int32" + }, + "machine_cidr": { + "description": "IP address block from which to assign machine IP addresses, for example `10.0.0.0/16`.", + "type": "string" + }, + "pod_cidr": { + "description": "IP address block from which to assign pod IP addresses, for example `10.128.0.0/14`.", + "type": "string" + }, + "service_cidr": { + "description": "IP address block from which to assign service IP addresses, for example `172.30.0.0/16`.", + "type": "string" + }, + "type": { + "description": "The main controller responsible for rendering the core networking components.", + "type": "string" + } + } + }, + "OperatorIAMRole": { + "description": "Contains the necessary attributes to allow each operator to access the necessary AWS resources", + "properties": { + "name": { + "description": "Name of the operator", + "type": "string" + }, + "namespace": { + "description": "Namespace where the operator lives in the cluster", + "type": "string" + }, + "role_arn": { + "description": "Role to assume when accessing AWS resources", + "type": "string" + } + } + }, + "ServiceParameter": { + "properties": { + "id": { + "description": "Name of the parameter", + "type": "string" + }, + "value": { + "description": "Value of the parameter", + "type": "string" + } + } + }, + "StatefulObject": { + "properties": { + "id": { + "type": "string" + }, + "href": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "state": { + "type": "string" + } + } + }, + "VersionInquiryRequest": { + "properties": { + "service_type": { + "type": "string" + } + } + }, + "VersionInquiryResponse": { + "properties": { + "version": { + "type": "string" + } + } + }, + "Error": { + "type": "object", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will always be 'Error'", + "type": "string" + }, + "id": { + "description": "Numeric identifier of the error.", + "type": "integer", + "format": "int32" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "description": "Globally unique code of the error, composed of the unique identifier of the API and the numeric identifier of the error. For example, for if the numeric identifier of the error is `93` and the identifier of the API is `clusters_mgmt` then the code will be `CLUSTERS-MGMT-93`.", + "type": "string" + }, + "reason": { + "description": "Human readable description of the error.", + "type": "string" + }, + "details": { + "description": "Extra information about the error.", + "type": "object", + "additionalProperties": true + } + } + } + }, + "securitySchemes": { + "bearer": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "security": [ + { + "bearer": [ + + ] + } + ] +} \ No newline at end of file diff --git a/openapi/status_board/v1/openapi.json b/openapi/status_board/v1/openapi.json new file mode 100644 index 00000000..1075ce80 --- /dev/null +++ b/openapi/status_board/v1/openapi.json @@ -0,0 +1,4381 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "v1", + "title": "status_board", + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + }, + "contact": { + "name": "OCM Feedback", + "email": "ocm-feedback@redhat.com" + } + }, + "servers": [ + { + "description": "Production", + "url": "https://api.openshift.com" + }, + { + "description": "Stage", + "url": "https://api.stage.openshift.com" + } + ], + "paths": { + "/api/status_board/v1": { + "get": { + "description": "Retrieves the version metadata.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Metadata" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/application_dependencies": { + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApplicationDependency" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApplicationDependency" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of application dependencies.", + "parameters": [ + { + "name": "order_by", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ApplicationDependency" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/application_dependencies/{application_dependency_id}": { + "delete": { + "parameters": [ + { + "name": "application_dependency_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "application_dependency_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApplicationDependency" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "application_dependency_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApplicationDependency" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApplicationDependency" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/applications": { + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Application" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Application" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of applications.", + "parameters": [ + { + "name": "order_by", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Application" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/applications/{application_id}": { + "delete": { + "parameters": [ + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Application" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Application" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Application" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/applications/{application_id}/services": { + "post": { + "parameters": [ + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of services.", + "parameters": [ + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "mine", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "order_by", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Service" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/applications/{application_id}/services/{service_id}": { + "delete": { + "parameters": [ + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/applications/{application_id}/services/{service_id}/statuses": { + "post": { + "parameters": [ + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of statuses.", + "parameters": [ + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "created_after", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "created_before", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "flap_detection", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "full_names", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "limit_scope", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "product_ids", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Status" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/applications/{application_id}/services/{service_id}/statuses/{status_id}": { + "delete": { + "parameters": [ + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/errors": { + "get": { + "description": "Retrieves the list of errors.", + "parameters": [ + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/errors/{error_id}": { + "get": { + "parameters": [ + { + "name": "error_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/peer_dependencies": { + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PeerDependency" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PeerDependency" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of peer dependencies.", + "parameters": [ + { + "name": "order_by", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PeerDependency" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/peer_dependencies/{peer_dependency_id}": { + "delete": { + "parameters": [ + { + "name": "peer_dependency_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "peer_dependency_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "peer_dependency_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PeerDependency" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PeerDependency" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/products": { + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Product" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Product" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of products.", + "parameters": [ + { + "name": "order_by", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Product" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/products/{product_id}": { + "delete": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Product" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Product" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Product" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/products/{product_id}/applications": { + "post": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Application" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Application" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of applications.", + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "order_by", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Application" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/products/{product_id}/applications/{application_id}": { + "delete": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Application" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Application" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Application" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/products/{product_id}/applications/{application_id}/services": { + "post": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of services.", + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "mine", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "order_by", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Service" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/products/{product_id}/applications/{application_id}/services/{service_id}": { + "delete": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/products/{product_id}/applications/{application_id}/services/{service_id}/statuses": { + "post": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of statuses.", + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "created_after", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "created_before", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "flap_detection", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "full_names", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "limit_scope", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "product_ids", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Status" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/products/{product_id}/applications/{application_id}/services/{service_id}/statuses/{status_id}": { + "delete": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "application_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/products/{product_id}/updates": { + "post": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of statuses.", + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "created_after", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "created_before", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "flap_detection", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "full_names", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "limit_scope", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "product_ids", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Status" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/products/{product_id}/updates/{status_id}": { + "delete": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "product_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/services": { + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of services.", + "parameters": [ + { + "name": "mine", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "order_by", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "search", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Service" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/services/{service_id}": { + "delete": { + "parameters": [ + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/services/{service_id}/statuses": { + "post": { + "parameters": [ + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of statuses.", + "parameters": [ + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "created_after", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "created_before", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "flap_detection", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "full_names", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "limit_scope", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "product_ids", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Status" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/services/{service_id}/statuses/{status_id}": { + "delete": { + "parameters": [ + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "service_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/status_updates": { + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of statuses.", + "parameters": [ + { + "name": "created_after", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "created_before", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "flap_detection", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "full_names", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "limit_scope", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "product_ids", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Status" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/status_updates/{status_id}": { + "delete": { + "parameters": [ + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/statuses": { + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of statuses.", + "parameters": [ + { + "name": "created_after", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "created_before", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "flap_detection", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "full_names", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "limit_scope", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "product_ids", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Status" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/status_board/v1/statuses/{status_id}": { + "delete": { + "parameters": [ + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "status_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Metadata": { + "description": "Version metadata.", + "properties": { + "server_version": { + "description": "Version of the server.", + "type": "string" + } + } + }, + "Application": { + "description": "Definition of a Status Board application.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Application' if this is a complete object or 'ApplicationLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "fullname": { + "description": "The full name of the application. ", + "type": "string" + }, + "metadata": { + "description": "Miscellaneous metadata about the application.", + "type": "object" + }, + "name": { + "description": "The name of the application. ", + "type": "string" + }, + "owners": { + "description": "The application owners (name and email)", + "type": "array", + "items": { + "$ref": "#/components/schemas/Owner" + } + }, + "product": { + "description": "The group ID that the application belongs to. ", + "$ref": "#/components/schemas/Product" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "ApplicationDependency": { + "description": "Definition of a Status Board application dependency.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ApplicationDependency' if this is a complete object or 'ApplicationDependencyLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "application": { + "description": "The parent Application of the dependency.", + "$ref": "#/components/schemas/Application" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "metadata": { + "description": "Miscellaneous metadata about the application.", + "type": "object" + }, + "name": { + "description": "The name of the application. ", + "type": "string" + }, + "owners": { + "description": "The application dependency owners (name and email)", + "type": "array", + "items": { + "$ref": "#/components/schemas/Owner" + } + }, + "service": { + "description": "The Service associated with the dependency.", + "$ref": "#/components/schemas/Service" + }, + "type": { + "description": "The type of application dependency, e.g. soft or hard.", + "type": "string" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "Error": { + "description": "Definition of a Status Board error.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Error' if this is a complete object or 'ErrorLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "type": "string" + }, + "reason": { + "type": "string" + } + } + }, + "Owner": { + "description": "Definition of a Status Board owner.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Owner' if this is a complete object or 'OwnerLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "email": { + "description": "The owner's email address.", + "type": "string" + }, + "username": { + "description": "The owner's username.", + "type": "string" + } + } + }, + "PeerDependency": { + "description": "Definition of a Status Board peer dependency.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'PeerDependency' if this is a complete object or 'PeerDependencyLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "metadata": { + "description": "Miscellaneous metadata about the peer dependency.", + "type": "object" + }, + "name": { + "description": "The name of the peer dependency.", + "type": "string" + }, + "owners": { + "description": "The peer dependency owners (name and email)", + "type": "array", + "items": { + "$ref": "#/components/schemas/Owner" + } + }, + "services": { + "description": "Services associated with the peer dependency.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Service" + } + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "Product": { + "description": "Definition of a Status Board product.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Product' if this is a complete object or 'ProductLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "fullname": { + "description": "The fullname of the product.", + "type": "string" + }, + "metadata": { + "description": "Miscellaneous data about the product.", + "type": "object" + }, + "name": { + "description": "The name of the product.", + "type": "string" + }, + "owners": { + "description": "The product owners (name and email).", + "type": "array", + "items": { + "$ref": "#/components/schemas/Owner" + } + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "Service": { + "description": "Definition of a Status Board Service.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Service' if this is a complete object or 'ServiceLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "application": { + "description": "The Application associated with the Service", + "$ref": "#/components/schemas/Application" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "current_status": { + "type": "string" + }, + "fullname": { + "type": "string" + }, + "last_ping_at": { + "type": "string", + "format": "date-time" + }, + "metadata": { + "type": "object" + }, + "name": { + "description": "The name of the Service", + "type": "string" + }, + "owners": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Owner" + } + }, + "private": { + "type": "boolean" + }, + "service_endpoint": { + "type": "string" + }, + "status_type": { + "type": "string" + }, + "status_updated_at": { + "type": "string", + "format": "date-time" + }, + "token": { + "type": "string" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "ServiceDependency": { + "description": "Definition of a Status Board service dependency.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'ServiceDependency' if this is a complete object or 'ServiceDependencyLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "child_service": { + "description": "The service dependency's child service", + "$ref": "#/components/schemas/Service" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "metadata": { + "description": "Miscellaneous metadata about the service dependency.", + "type": "object" + }, + "name": { + "description": "The name of the service dependency.", + "type": "string" + }, + "owners": { + "description": "The service dependency owners (name and email)", + "type": "array", + "items": { + "$ref": "#/components/schemas/Owner" + } + }, + "parent_service": { + "description": "The service dependency's parent service", + "$ref": "#/components/schemas/Service" + }, + "type": { + "description": "The type of service dependency, e.g. soft or hard.", + "type": "string" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "ServiceInfo": { + "description": "Definition of a Status Board service info.", + "properties": { + "fullname": { + "description": "Full name of the service", + "type": "string" + }, + "status_type": { + "description": "Type of the service status", + "type": "string" + } + } + }, + "Status": { + "description": "Definition of a Status Board status.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Status' if this is a complete object or 'StatusLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "metadata": { + "description": "Miscellaneous metadata about the application.", + "type": "object" + }, + "service": { + "description": "The associated service ID.", + "$ref": "#/components/schemas/Service" + }, + "service_info": { + "description": "Additional Service related data.", + "$ref": "#/components/schemas/ServiceInfo" + }, + "status": { + "description": "A status message for the given service.", + "type": "string" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "StatusUpdate": { + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'StatusUpdate' if this is a complete object or 'StatusUpdateLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "metadata": { + "description": "Miscellaneous metadata about the application.", + "type": "object" + }, + "service": { + "description": "The associated service ID.", + "$ref": "#/components/schemas/Service" + }, + "service_info": { + "description": "Additional Service related data.", + "$ref": "#/components/schemas/ServiceInfo" + }, + "status": { + "description": "A status message for the given service.", + "type": "string" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "Error": { + "type": "object", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will always be 'Error'", + "type": "string" + }, + "id": { + "description": "Numeric identifier of the error.", + "type": "integer", + "format": "int32" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "description": "Globally unique code of the error, composed of the unique identifier of the API and the numeric identifier of the error. For example, for if the numeric identifier of the error is `93` and the identifier of the API is `clusters_mgmt` then the code will be `CLUSTERS-MGMT-93`.", + "type": "string" + }, + "reason": { + "description": "Human readable description of the error.", + "type": "string" + }, + "details": { + "description": "Extra information about the error.", + "type": "object", + "additionalProperties": true + } + } + } + }, + "securitySchemes": { + "bearer": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "security": [ + { + "bearer": [ + + ] + } + ] +} \ No newline at end of file diff --git a/openapi/web_rca/v1/openapi.json b/openapi/web_rca/v1/openapi.json new file mode 100644 index 00000000..c9ad28db --- /dev/null +++ b/openapi/web_rca/v1/openapi.json @@ -0,0 +1,2074 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "v1", + "title": "web_rca", + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + }, + "contact": { + "name": "OCM Feedback", + "email": "ocm-feedback@redhat.com" + } + }, + "servers": [ + { + "description": "Production", + "url": "https://api.openshift.com" + }, + { + "description": "Stage", + "url": "https://api.stage.openshift.com" + } + ], + "paths": { + "/api/web_rca/v1": { + "get": { + "description": "Retrieves the version metadata.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Metadata" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/errors": { + "get": { + "description": "Retrieves the list of errors.", + "parameters": [ + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/errors/{error_id}": { + "get": { + "parameters": [ + { + "name": "error_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/incidents": { + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Incident" + } + } + } + }, + "responses": { + "201": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Incident" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "description": "Retrieves the list of incidents.", + "parameters": [ + { + "name": "creator_id", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "incident_commander_id", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "incident_name", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "mine", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "on_call_id", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "order_by", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "participant_id", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "product_id", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "public_id", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "responsible_manager_id", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "status", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Incident" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/incidents/{incident_id}": { + "delete": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Incident" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Incident" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Incident" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/incidents/{incident_id}/events": { + "get": { + "description": "Retrieves the list of events", + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "created_after", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "created_before", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "event_type", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "note", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "order_by", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "show_system_events", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Event" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/incidents/{incident_id}/events/{event_id}": { + "delete": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "event_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "event_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Event" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "event_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Event" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Event" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/incidents/{incident_id}/events/{event_id}/attachments": { + "get": { + "description": "Retrieves the list of attachments", + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "event_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Attachment" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/incidents/{incident_id}/events/{event_id}/attachments/{attachment_id}": { + "delete": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "event_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "attachment_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "event_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "attachment_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Attachment" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "event_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "attachment_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Attachment" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Attachment" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/incidents/{incident_id}/follow_ups": { + "get": { + "description": "Retrieves the list of follow-ups", + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "created_after", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "created_before", + "in": "query", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "follow_up_status", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "order_by", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FollowUp" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/incidents/{incident_id}/follow_ups/{follow_up_id}": { + "delete": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "follow_up_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "follow_up_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FollowUp" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "follow_up_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FollowUp" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FollowUp" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/incidents/{incident_id}/notifications": { + "get": { + "description": "Retrieves the list of notifications", + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "checked", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Notification" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/incidents/{incident_id}/notifications/{notification_id}": { + "delete": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "notification_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "204": { + "description": "Success." + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "notification_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Notification" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "incident_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "notification_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Notification" + } + } + } + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Notification" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/users": { + "get": { + "description": "Retrieves the list of users.", + "parameters": [ + { + "name": "order_by", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/User" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "total": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api/web_rca/v1/users/{user_id}": { + "get": { + "parameters": [ + { + "name": "user_id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + }, + "default": { + "description": "Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Metadata": { + "description": "Version metadata.", + "properties": { + "server_version": { + "description": "Version of the server.", + "type": "string" + } + } + }, + "Attachment": { + "description": "Definition of a Web RCA attachment.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Attachment' if this is a complete object or 'AttachmentLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "content_type": { + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "creator": { + "$ref": "#/components/schemas/User" + }, + "deleted_at": { + "description": "Object deletion timestamp.", + "type": "string", + "format": "date-time" + }, + "event": { + "$ref": "#/components/schemas/Event" + }, + "file_size": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "Error": { + "description": "Definition of a Web RCA error.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Error' if this is a complete object or 'ErrorLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "type": "string" + }, + "reason": { + "type": "string" + } + } + }, + "Escalation": { + "description": "Definition of a Web RCA escalation.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Escalation' if this is a complete object or 'EscalationLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "description": "Object deletion timestamp.", + "type": "string", + "format": "date-time" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + }, + "user": { + "$ref": "#/components/schemas/User" + } + } + }, + "Event": { + "description": "Definition of a Web RCA event.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Event' if this is a complete object or 'EventLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "creator": { + "$ref": "#/components/schemas/User" + }, + "deleted_at": { + "description": "Object deletion timestamp.", + "type": "string", + "format": "date-time" + }, + "escalation": { + "$ref": "#/components/schemas/Escalation" + }, + "event_type": { + "type": "string" + }, + "external_reference_url": { + "type": "string" + }, + "follow_up": { + "$ref": "#/components/schemas/FollowUp" + }, + "follow_up_change": { + "$ref": "#/components/schemas/FollowUpChange" + }, + "handoff": { + "$ref": "#/components/schemas/Handoff" + }, + "incident": { + "$ref": "#/components/schemas/Incident" + }, + "note": { + "type": "string" + }, + "status_change": { + "$ref": "#/components/schemas/StatusChange" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "FollowUp": { + "description": "Definition of a Web RCA event.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'FollowUp' if this is a complete object or 'FollowUpLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "archived": { + "type": "boolean" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "description": "Object deletion timestamp.", + "type": "string", + "format": "date-time" + }, + "done": { + "type": "boolean" + }, + "follow_up_type": { + "type": "string" + }, + "incident": { + "$ref": "#/components/schemas/Incident" + }, + "owner": { + "type": "string" + }, + "priority": { + "type": "string" + }, + "status": { + "type": "string" + }, + "title": { + "type": "string" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + }, + "url": { + "type": "string" + }, + "worked_at": { + "type": "string", + "format": "date-time" + } + } + }, + "FollowUpChange": { + "description": "Definition of a Web RCA event.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'FollowUpChange' if this is a complete object or 'FollowUpChangeLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "description": "Object deletion timestamp.", + "type": "string", + "format": "date-time" + }, + "follow_up": { + "$ref": "#/components/schemas/FollowUp" + }, + "status": { + "type": "object" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "Handoff": { + "description": "Definition of a Web RCA handoff.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Handoff' if this is a complete object or 'HandoffLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "description": "Object deletion timestamp.", + "type": "string", + "format": "date-time" + }, + "handoff_from": { + "$ref": "#/components/schemas/User" + }, + "handoff_to": { + "$ref": "#/components/schemas/User" + }, + "handoff_type": { + "type": "string" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "Incident": { + "description": "Definition of a Web RCA incident.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Incident' if this is a complete object or 'IncidentLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "creator_id": { + "type": "string" + }, + "deleted_at": { + "description": "Object deletion timestamp.", + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + }, + "external_coordination": { + "type": "array", + "items": { + "type": "string" + } + }, + "incident_id": { + "type": "string" + }, + "incident_type": { + "type": "string" + }, + "last_updated": { + "type": "string", + "format": "date-time" + }, + "primary_team": { + "type": "string" + }, + "severity": { + "type": "string" + }, + "status": { + "type": "string" + }, + "summary": { + "type": "string" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + }, + "worked_at": { + "type": "string", + "format": "date-time" + } + } + }, + "Notification": { + "description": "Definition of a Web RCA notification.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Notification' if this is a complete object or 'NotificationLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "checked": { + "type": "boolean" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "description": "Object deletion timestamp.", + "type": "string", + "format": "date-time" + }, + "incident": { + "$ref": "#/components/schemas/Incident" + }, + "name": { + "type": "string" + }, + "rank": { + "type": "integer", + "format": "int32" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "Product": { + "description": "Definition of a Web RCA product.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'Product' if this is a complete object or 'ProductLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "description": "Object deletion timestamp.", + "type": "string", + "format": "date-time" + }, + "product_id": { + "description": "The product ID from status board", + "type": "string" + }, + "product_name": { + "description": "The name of the product from status-board.", + "type": "string" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "StatusChange": { + "description": "Definition of a Web RCA event.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'StatusChange' if this is a complete object or 'StatusChangeLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "description": "Object deletion timestamp.", + "type": "string", + "format": "date-time" + }, + "status": { + "type": "object" + }, + "status_id": { + "type": "string" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + } + } + }, + "User": { + "description": "Definition of a Web RCA user.", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will be 'User' if this is a complete object or 'UserLink' if it is just a link.", + "type": "string" + }, + "id": { + "description": "Unique identifier of the object.", + "type": "string" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "created_at": { + "description": "Object creation timestamp.", + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "description": "Object deletion timestamp.", + "type": "string", + "format": "date-time" + }, + "email": { + "type": "string" + }, + "from_auth": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "updated_at": { + "description": "Object modification timestamp.", + "type": "string", + "format": "date-time" + }, + "username": { + "type": "string" + } + } + }, + "Error": { + "type": "object", + "properties": { + "kind": { + "description": "Indicates the type of this object. Will always be 'Error'", + "type": "string" + }, + "id": { + "description": "Numeric identifier of the error.", + "type": "integer", + "format": "int32" + }, + "href": { + "description": "Self link.", + "type": "string" + }, + "code": { + "description": "Globally unique code of the error, composed of the unique identifier of the API and the numeric identifier of the error. For example, for if the numeric identifier of the error is `93` and the identifier of the API is `clusters_mgmt` then the code will be `CLUSTERS-MGMT-93`.", + "type": "string" + }, + "reason": { + "description": "Human readable description of the error.", + "type": "string" + }, + "details": { + "description": "Extra information about the error.", + "type": "object", + "additionalProperties": true + } + } + } + }, + "securitySchemes": { + "bearer": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "security": [ + { + "bearer": [ + + ] + } + ] +} \ No newline at end of file